/** * Creates a new mapping node.<p> * * @param document the document to modify * @param xpath the xpath to the field mapping, ie <code>opencms/search/fieldconfigurations/fieldconfiguration[name='...']/fields/field[@name="..."]/mappings/mapping[@type='...']</code> * @param mapping the field mapping */ protected void createFieldMapping(Document document, String xpath, CmsSearchFieldMapping mapping) { CmsSetupXmlHelper.setValue(document, xpath + "/@" + I_CmsXmlConfiguration.A_TYPE, mapping.getType().toString()); CmsSetupXmlHelper.setValue(document, xpath + "/@" + I_CmsXmlConfiguration.A_DEFAULT, mapping.getDefaultValue()); // add class attribute (if required) if (!mapping.getClass().equals(CmsSearchFieldMapping.class) || (mapping.getType() == CmsSearchFieldMappingType.DYNAMIC)) { CmsSetupXmlHelper.setValue( document, xpath + "/@" + I_CmsXmlConfiguration.A_CLASS, mapping.getClass().getName()); } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(mapping.getParam())) { CmsSetupXmlHelper.setValue(document, xpath, mapping.getParam()); } }
CmsSearchFieldMapping mapping = (CmsSearchFieldMapping)itMappings.next(); html.append(" <li>\n").append(" "); html.append(mapping.getType().toString()); if (CmsStringUtil.isNotEmpty(mapping.getParam())) { html.append("=").append(mapping.getParam()).append("\n");
CmsSearchFieldMapping mapping = (CmsSearchFieldMapping)itMappings.next(); html.append(" <li>\n").append(" "); html.append(mapping.getType().toString()); if (CmsStringUtil.isNotEmpty(mapping.getParam())) { html.append("=").append(mapping.getParam()).append("\n");
CmsSearchFieldMapping mapping = (CmsSearchFieldMapping)itMappings.next(); html.append(" <li>\n").append(" "); html.append(mapping.getType().toString()); if (CmsStringUtil.isNotEmpty(mapping.getParam())) { html.append("=").append(mapping.getParam()).append("\n");
String itemType = (String)listItem.get(LIST_COLUMN_TYPE); if (curMapping.getType().toString().equals(itemType) && (((curMapping.getParam() == null) && (itemValue == null)) || (curMapping.getParam().equals(itemValue)))) {
/** * @see org.opencms.workplace.list.A_CmsListDialog#getListItems() */ @Override protected List<CmsListItem> getListItems() { List<CmsListItem> result = new ArrayList<CmsListItem>(); // get content List<I_CmsSearchFieldMapping> mappings = getMappings(); Iterator<I_CmsSearchFieldMapping> itMappings = mappings.iterator(); CmsSearchFieldMapping mapping; while (itMappings.hasNext()) { mapping = (CmsSearchFieldMapping)itMappings.next(); CmsListItem item = getList().newItem(mapping.getType().toString()); String defaultValue = mapping.getDefaultValue(); String param = mapping.getParam(); if (defaultValue == null) { defaultValue = "-"; } if (param == null) { param = "-"; } item.set(LIST_COLUMN_VALUE, param); item.set(LIST_COLUMN_TYPE, mapping.getType().toString()); item.set(LIST_COLUMN_DEFAULT, defaultValue); result.add(item); } return result; }
/** * 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); } }
/** * 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(CmsLuceneField 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); } }
+ I_CmsXmlConfiguration.A_TYPE + "='" + mapping.getType().toString() + "']"; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(mapping.getParam())) {
switch (getType().getMode()) { case 0: // content if (extractionResult != null) { case 2: // property-search if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getParam())) { boolean search = (getType() == CmsSearchFieldMappingType.PROPERTY_SEARCH); if (search) { content = CmsProperty.get(getParam(), propertiesSearched).getValue();
CmsSearchFieldMapping mapping = (CmsSearchFieldMapping)mappings.next(); Element mappingElement = fieldElement.addElement(N_MAPPING); 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());
switch (getType().getMode()) { case 0: // content if (extractionResult != null) {