/** * Two mappings are equal if the type and the parameter is equal.<p> * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if ((obj instanceof I_CmsSearchFieldMapping)) { I_CmsSearchFieldMapping other = (I_CmsSearchFieldMapping)obj; return (CmsStringUtil.isEqual(m_type, other.getType())) && (CmsStringUtil.isEqual(m_param, other.getParam())); } return false; }
/** * Sets the mapping type of the mapping.<p> * * @param type String value of the mapping type */ public void setType(String type) { m_mapping.setType(type); }
mappingElement.addAttribute(A_TYPE, mapping.getType().toString()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(mapping.getDefaultValue())) { mappingElement.addAttribute(A_DEFAULT, mapping.getDefaultValue()); || (mapping.getType() == CmsSearchFieldMappingType.DYNAMIC)) { mappingElement.addAttribute(A_CLASS, mapping.getClass().getName()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(mapping.getParam())) { mappingElement.setText(mapping.getParam());
if ((field.getLocale() != null) && mapping.getType().equals(CmsSearchFieldMappingType.CONTENT)) { mapResult = mapping.getStringValue( cms, resource, } else if (mapping.getDefaultValue() != null) { text.append(mapping.getDefaultValue()); } else if (mapping.getStringValue( cms, resource, properties, propertiesSearched) != null) { String value = mapping.getStringValue( cms, resource,
try { fieldMapping = (I_CmsSearchFieldMapping)Class.forName(mappingClass).newInstance(); fieldMapping.setType(CmsSearchFieldMappingType.DYNAMIC); fieldMapping.setParam(element.getStringValue()); } catch (Exception e) { throw new CmsXmlException( fieldMapping.setDefaultValue(element.attributeValue(APPINFO_ATTR_DEFAULT));
String mapResult = mapping.getStringValue(cms, resource, extractionResult, properties, propertiesSearched); if (mapResult != null) { if (text.length() > 0) {
/** * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest) */ @SuppressWarnings({"unchecked", "rawtypes"}) @Override protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) { // initialize parameters and dialog actions in super implementation super.initWorkplaceRequestValues(settings, request); // save the current search index source Map dialogObject = (Map)getDialogObject(); if (dialogObject == null) { dialogObject = new HashMap(); dialogObject.put(PARAM_FIELDCONFIGURATION, m_fieldconfiguration); dialogObject.put(PARAM_FIELD, m_field); dialogObject.put(PARAM_PARAM, m_mapping.getParam()); if (m_mapping.getType() != null) { dialogObject.put(PARAM_TYPE, m_mapping.getType().toString()); } else { dialogObject.put(PARAM_TYPE, m_mapping.getType()); } setDialogObject(dialogObject); } }
/** * @see org.opencms.workplace.CmsWidgetDialog#actionCommit() */ @Override public void actionCommit() { List<Throwable> errors = new ArrayList<Throwable>(); try { // if new create it first boolean found = false; Iterator<I_CmsSearchFieldMapping> itMappings = m_field.getMappings().iterator(); while (itMappings.hasNext()) { I_CmsSearchFieldMapping curMapping = itMappings.next(); if (curMapping.getType().toString().equals(m_mapping.getType().toString()) && (((curMapping.getParam() == null) && (m_mapping.getParam() == null)) || (curMapping.getParam().equals(m_mapping.getParam())))) { found = true; } } if (!found) { m_field.addMapping(m_mapping); } writeConfiguration(); } catch (Throwable t) { errors.add(t); } // set the list of errors to display when saving failed setCommitErrors(errors); }
while (itMappings.hasNext()) { I_CmsSearchFieldMapping curMapping = itMappings.next(); if (curMapping.getType().toString().equals(getParamType()) && (((curMapping.getParam() == null) && getParamParam().equals("-")) || (curMapping.getParam().equals(getParamParam())))) { m_mapping = curMapping; break;