/** * @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); }
/** * 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; }
/** * @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); } }