/** * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CmsElementComparison)) { return false; } CmsElementComparison diffItem = (CmsElementComparison)o; return getName().equals(diffItem.getName()) && m_locale.equals(diffItem.getLocale()); }
/** * Creates a new element comparison.<p> * * @param locale the locale of the comparison * @param name the name of the element */ public CmsElementComparison(Locale locale, String name) { m_locale = locale; setName(name); }
while (diffs.hasNext()) { CmsElementComparison comparison = diffs.next(); String locale = comparison.getLocale().toString(); String attribute = comparison.getName(); CmsListItem item = getList().newItem(locale + attribute); item.set(LIST_COLUMN_LOCALE, locale); item.set(LIST_COLUMN_TYPE, ((CmsXmlContentElementComparison)comparison).getType()); if (CmsResourceComparison.TYPE_ADDED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_STATUS, key(Messages.GUI_COMPARE_ADDED_0)); } else if (CmsResourceComparison.TYPE_REMOVED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_STATUS, key(Messages.GUI_COMPARE_REMOVED_0)); } else if (CmsResourceComparison.TYPE_CHANGED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_STATUS, key(Messages.GUI_COMPARE_CHANGED_0)); } else { CmsStringUtil.trimToSize(comparison.getVersion1(), CmsPropertyComparisonList.TRIM_AT_LENGTH), "\n", "")); String origValue = comparison.getVersion2(); String value2 = formatContentValueForDiffTable(getCms(), comparison, origValue); item.set(LIST_COLUMN_VERSION_2, value2);
while (i.hasNext()) { CmsElementComparison elem = i.next(); elem.setStatus(CmsResourceComparison.TYPE_REMOVED); String value = resource1.getValue(elem.getName(), elem.getLocale()).getStringValue(cms); elem.setVersion1(value); elem.setVersion2(""); while (i.hasNext()) { CmsElementComparison elem = i.next(); elem.setStatus(CmsResourceComparison.TYPE_ADDED); elem.setVersion1(""); I_CmsXmlContentValue contentValue = resource2.getValue(elem.getName(), elem.getLocale()); String value = contentValue.getStringValue(cms); elem.setVersion2(value); while (i.hasNext()) { CmsElementComparison elem = i.next(); String value1 = resource1.getValue(elem.getName(), elem.getLocale()).getStringValue(cms); String value2 = resource2.getValue(elem.getName(), elem.getLocale()).getStringValue(cms); if (value1 == null) { value1 = ""; elem.setVersion1(value1); elem.setVersion2(value2); if (!value1.equals(value2)) { elem.setStatus(CmsResourceComparison.TYPE_CHANGED); } else { elem.setStatus(CmsResourceComparison.TYPE_UNCHANGED);
final String text1 = entry.getVersion1(); final String text2 = entry.getVersion2(); if (Objects.equal(text1, text2)) { continue;
/** * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return m_locale.hashCode() + getName().hashCode(); }
/** * Gets the locale.<p> * * @return the locale */ @Column(header = Messages.GUI_HISTORY_DIALOG_COL_LOCALE_0, order = 20) public String getLocale() { return m_elemComp.getLocale().toString(); }
/** * Gets the value for the second version.<p> * * @return the value for the second version */ @Column(header = "V2 (%(v2))", order = 50) public String getV2() { return CmsValueCompareBean.formatContentValueForDiffTable(m_cms, m_elemComp, m_elemComp.getVersion2()); }
/** * Gets the value for the first version.<p> * * @return the value for the first version */ @Column(header = "V1 (%(v1))", order = 40) public String getV1() { return CmsValueCompareBean.formatContentValueForDiffTable(m_cms, m_elemComp, m_elemComp.getVersion1()); }
m_elemComp = elemComp; String changeType = m_elemComp.getStatus(); String key = null; String style = null;
/** Returs a list of all element names of a xml page.<p> * * @param xmlPage the xml page to read the element names from * @return a list of all element names of a xml page */ private List getElements(I_CmsXmlDocument xmlPage) { List elements = new ArrayList(); Iterator locales = xmlPage.getLocales().iterator(); while (locales.hasNext()) { Locale locale = (Locale)locales.next(); Iterator elementNames = xmlPage.getNames(locale).iterator(); while (elementNames.hasNext()) { String elementName = (String)elementNames.next(); elements.add(new CmsElementComparison(locale, elementName)); } } return elements; } }
while (diffs.hasNext()) { CmsElementComparison comparison = (CmsElementComparison)diffs.next(); String locale = comparison.getLocale().toString(); String attribute = comparison.getName(); CmsListItem item = getList().newItem(locale + attribute); item.set(LIST_COLUMN_LOCALE, locale); item.set(LIST_COLUMN_TYPE, ((CmsXmlContentElementComparison)comparison).getType()); if (CmsResourceComparison.TYPE_ADDED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_STATUS, key(Messages.GUI_COMPARE_ADDED_0)); } else if (CmsResourceComparison.TYPE_REMOVED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_STATUS, key(Messages.GUI_COMPARE_REMOVED_0)); } else if (CmsResourceComparison.TYPE_CHANGED.equals(comparison.getStatus())) { item.set(LIST_COLUMN_STATUS, key(Messages.GUI_COMPARE_CHANGED_0)); } else { comparison.getVersion1(), CmsPropertyComparisonList.TRIM_AT_LENGTH), "\n", "")); comparison.getVersion2(), CmsPropertyComparisonList.TRIM_AT_LENGTH), "\n", ""));
while (i.hasNext()) { CmsElementComparison elem = (CmsElementComparison)i.next(); elem.setStatus(CmsResourceComparison.TYPE_REMOVED); String value = resource1.getValue(elem.getName(), elem.getLocale()).getStringValue(cms); elem.setVersion1(value); elem.setVersion2(""); while (i.hasNext()) { CmsElementComparison elem = (CmsElementComparison)i.next(); elem.setStatus(CmsResourceComparison.TYPE_ADDED); elem.setVersion1(""); I_CmsXmlContentValue contentValue = resource2.getValue(elem.getName(), elem.getLocale()); String value = contentValue.getStringValue(cms); elem.setVersion2(value); while (i.hasNext()) { CmsElementComparison elem = (CmsElementComparison)i.next(); String value1 = resource1.getValue(elem.getName(), elem.getLocale()).getStringValue(cms); String value2 = resource2.getValue(elem.getName(), elem.getLocale()).getStringValue(cms); if (value1 == null) { value1 = ""; elem.setVersion1(value1); elem.setVersion2(value2); if (!value1.equals(value2)) { elem.setStatus(CmsResourceComparison.TYPE_CHANGED); } else { elem.setStatus(CmsResourceComparison.TYPE_UNCHANGED);
/** * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return m_locale.hashCode() + getName().hashCode(); }
/** Returs a list of all element names of a xml page.<p> * * @param xmlPage the xml page to read the element names from * @return a list of all element names of a xml page */ private List<CmsElementComparison> getElements(I_CmsXmlDocument xmlPage) { List<CmsElementComparison> elements = new ArrayList<CmsElementComparison>(); Iterator<Locale> locales = xmlPage.getLocales().iterator(); while (locales.hasNext()) { Locale locale = locales.next(); Iterator<String> elementNames = xmlPage.getNames(locale).iterator(); while (elementNames.hasNext()) { String elementName = elementNames.next(); elements.add(new CmsElementComparison(locale, elementName)); } } return elements; } }
/** * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CmsElementComparison)) { return false; } CmsElementComparison diffItem = (CmsElementComparison)o; return getName().equals(diffItem.getName()) && m_locale.equals(diffItem.getLocale()); }
/** * Gets the element name.<p> * * @return the element name */ @Column(header = Messages.GUI_HISTORY_DIALOG_COL_XPATH_0, order = 30) public String getXPath() { return m_elemComp.getName(); }
/** * Creates a new element comparison.<p> * * @param locale the locale of the comparison * @param name the name of the element */ public CmsElementComparison(Locale locale, String name) { m_locale = locale; setName(name); }
/** * @see java.lang.Comparable#compareTo(java.lang.Object) */ @Override public int compareTo(CmsElementComparison diffItem) { if (this == diffItem) { return 0; } // first compare by name if (getName().compareTo(diffItem.getName()) != 0) { return getName().compareTo(diffItem.getName()); } // then by locale return m_locale.toString().compareTo(diffItem.getLocale().toString()); }
/** * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(Object o) { if (this == o) { return 0; } if (!(o instanceof CmsElementComparison)) { return 0; } CmsElementComparison diffItem = (CmsElementComparison)o; // first compare by name if (getName().compareTo(diffItem.getName()) != 0) { return getName().compareTo(diffItem.getName()); } // then by locale return m_locale.toString().compareTo(diffItem.getLocale().toString()); }