if ((pageOrTemplate.getMetadata() != null) && (pageOrTemplate.getMetadata().getFields() != null))
{
Iterator fieldIter = pageOrTemplate.getMetadata().getFields().iterator();
while (fieldIter.hasNext())
{
LocalizedField field = (LocalizedField)fieldIter.next();
Locale fieldLocale = field.getLocale();
String fieldName = field.getName();
if (fieldName != null)
{
boolean containsField = false;
Iterator containsFieldIterator = contentPageImpl.getMetadata().getFields().iterator();
while (!containsField && containsFieldIterator.hasNext())
{
LocalizedField testField = (LocalizedField)containsFieldIterator.next();
Locale testFieldLocale = testField.getLocale();
String testFieldName = testField.getName();
containsField = (fieldName.equals(testFieldName) &&
(((fieldLocale == null) && (testFieldLocale == null)) ||
((fieldLocale != null) && fieldLocale.equals(testFieldLocale))));
}
if (!containsField)