/** * Checks the configuration to write.<p> * * @return true if configuration is valid, otherwise false */ private boolean checkWriteConfiguration() { if ((m_fieldconfiguration != null) || m_fieldconfiguration.getFields().isEmpty()) { for (CmsSearchField field : m_fieldconfiguration.getFields()) { if (field.getMappings().isEmpty()) { return false; } } return true; } return false; } }
for (I_CmsSearchFieldMapping mapping : field.getMappings()) { String mapResult = mapping.getStringValue(cms, resource, extractionResult, properties, propertiesSearched); if (mapResult != null) {
/** * Removes a search field mapping from the given field.<p> * * @param field the field * @param mapping mapping to remove from the field * * @return true if remove was successful, false if preconditions for removal are ok but the given * mapping was unknown. * * @throws CmsIllegalStateException if the given mapping is the last mapping inside the given field. */ public boolean removeSearchFieldMapping(CmsSearchField field, CmsSearchFieldMapping mapping) throws CmsIllegalStateException { if (field.getMappings().size() < 2) { throw new CmsIllegalStateException(Messages.get().container( Messages.ERR_FIELD_MAPPING_DELETE_2, mapping.getType().toString(), field.getName())); } else { if (LOG.isInfoEnabled()) { LOG.info(Messages.get().getBundle().key( Messages.LOG_REMOVE_FIELD_MAPPING_INDEX_2, mapping.toString(), field.getName())); } return field.getMappings().remove(mapping); } }
/** * @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); }
Iterator<CmsSearchFieldMapping> mappings = fieldConfig.getMappings().iterator(); while (mappings.hasNext()) {
Iterator<I_CmsSearchFieldMapping> itMappings = m_field.getMappings().iterator(); while (itMappings.hasNext()) { I_CmsSearchFieldMapping curMapping = itMappings.next();
Iterator mappings = field.getMappings().iterator(); while (mappings.hasNext()) { CmsSearchFieldMapping mapping = (CmsSearchFieldMapping)mappings.next();