List of usage examples for java.util.regex Pattern LITERAL
int LITERAL
To view the source code for java.util.regex Pattern LITERAL.
Click Source Link
From source file:org.jahia.utils.osgi.parsers.cnd.JahiaCndReader.java
public void getDefinitionsAndReferences(Set<String> contentTypeDefinitions, Set<String> contentTypeReferences) throws RepositoryException { for (ExtendedNodeType extendedNodeType : getNodeTypesList()) { getLog().debug(filename + " Nodetype definition " + extendedNodeType.getName()); contentTypeDefinitions.add(extendedNodeType.getName()); for (String superTypeName : extendedNodeType.getDeclaredSupertypeNames()) { getLog().debug(filename + " node type super type reference " + superTypeName); contentTypeReferences.add(superTypeName); }/*from w w w. j av a 2s . c om*/ for (String mixinExtendName : extendedNodeType.getMixinExtendNames()) { getLog().debug(filename + " node type mixin type reference " + mixinExtendName); contentTypeReferences.add(mixinExtendName); } ExtendedNodeDefinition[] childNodeDefinitions = extendedNodeType.getDeclaredChildNodeDefinitions(); for (ExtendedNodeDefinition childNodeDefinition : childNodeDefinitions) { if (childNodeDefinition.getDefaultPrimaryTypeName() != null) { getLog().debug(filename + " child node default type reference " + childNodeDefinition.getDefaultPrimaryTypeName()); contentTypeReferences.add(childNodeDefinition.getDefaultPrimaryTypeName()); } String[] requiredPrimaryTypeNames = childNodeDefinition.getRequiredPrimaryTypeNames(); for (String requiredPrimaryTypeName : requiredPrimaryTypeNames) { getLog().debug(filename + " child node required type reference " + requiredPrimaryTypeName); contentTypeReferences.add(requiredPrimaryTypeName); } Map<String, String> selectorOptions = childNodeDefinition.getSelectorOptions(); if (selectorOptions.size() > 0) { getLog().debug(filename + "Found child node selector options !!!!!!!!!!!!!!!!!!"); } } ExtendedPropertyDefinition[] propertyDefinitions = extendedNodeType.getPropertyDefinitions(); for (ExtendedPropertyDefinition propertyDefinition : propertyDefinitions) { if (ExtendedPropertyType.REFERENCE == propertyDefinition.getRequiredType() || ExtendedPropertyType.WEAKREFERENCE == propertyDefinition.getRequiredType()) { String[] valueConstraints = propertyDefinition.getValueConstraints(); for (String valueConstraint : valueConstraints) { if (valueConstraint != null) { getLog().debug(filename + " reference property value contraints " + valueConstraint); contentTypeReferences.add(valueConstraint); } } Value[] defaultValues = propertyDefinition.getDefaultValues(); for (Value defaultValue : defaultValues) { if (defaultValue != null) { getLog().debug(filename + " found reference property default value " + defaultValue.getString()); contentTypeReferences.add(defaultValue.getString()); } } } Map<String, String> selectorOptions = propertyDefinition.getSelectorOptions(); if (selectorOptions.size() > 0) { if (selectorOptions.containsKey("nodes")) { String nodeSelector = selectorOptions.get("nodes"); for (String nodeSelectorItem : Pattern.compile("|", Pattern.LITERAL).split(nodeSelector)) { String[] nodeSelectorOptions = nodeSelectorItem.split(";"); if (nodeSelectorOptions.length > 1) { if (StringUtils.isNotEmpty(nodeSelectorOptions[1])) { getLog().debug( filename + " found choicelist node type " + nodeSelectorOptions[1]); contentTypeReferences.add(nodeSelectorOptions[1]); } } } } if (selectorOptions.containsKey("nodetypes")) { String param = selectorOptions.get("nodetypes"); if (param.indexOf(";fromDependencies") > -1) { } if (param.startsWith("MIXIN")) { } else if (param.startsWith("PRIMARY")) { } else if (param.startsWith("ALL")) { } else if (StringUtils.isEmpty(param)) { } else { getLog().debug(filename + " found choicelist nodetype type " + param); contentTypeReferences.add(param); } } if (selectorOptions.containsKey("subnodetypes")) { String param = selectorOptions.get("subnodetypes"); if (StringUtils.isEmpty(param)) { param = "jmix:editorialContent"; } String includedTypes = StringUtils.substringBefore(param, ";"); Set<String> excludedTypes = new HashSet<String>(); String exclusion = StringUtils.substringAfter(param, ";"); if (StringUtils.isNotBlank(exclusion)) { excludedTypes.addAll(CollectionUtils.collect( Arrays.asList(Patterns.COMMA.split(StringUtils.substringAfter(param, ";"))), new Transformer() { public Object transform(Object input) { return ((String) input).trim(); } })); } for (String nodeTypeName : Patterns.COMMA.split(includedTypes)) { if (StringUtils.isNotEmpty(nodeTypeName)) { getLog().debug( filename + " found choicelist subnodetype included type " + nodeTypeName); contentTypeReferences.add(nodeTypeName); } } for (String nodeTypeName : excludedTypes) { if (StringUtils.isNotEmpty(nodeTypeName)) { getLog().debug( filename + " found choicelist subnodetype excluded type " + nodeTypeName); contentTypeReferences.add(nodeTypeName); } } } if (selectorOptions.containsKey("componenttypes")) { String param = selectorOptions.get("componenttypes"); Set<String> DEF_INCLUDES = new TreeSet<String>(Arrays.asList("jmix:editorialContent")); Set<String> includeTypes = DEF_INCLUDES; Set<String> excludeTypes = new TreeSet<String>(); if (StringUtils.isNotEmpty(param)) { includeTypes = getNodeTypes(StringUtils.substringBefore(param, ";")); excludeTypes = getNodeTypes(StringUtils.substringAfter(param, ";")); } for (String nodeTypeName : includeTypes) { if (StringUtils.isNotEmpty(nodeTypeName)) { getLog().debug(filename + " found choicelist component type included type " + nodeTypeName); contentTypeReferences.add(nodeTypeName); } } for (String nodeTypeName : excludeTypes) { if (StringUtils.isNotEmpty(nodeTypeName)) { getLog().debug(filename + " found choicelist component type included type " + nodeTypeName); contentTypeReferences.add(nodeTypeName); } } } } } } // remove all content type references that are defined in this file to keep only exist definitions contentTypeReferences.removeAll(contentTypeDefinitions); }