Adds the XML digester rules for resource properties.<p>

@param digester the digester to add the rules to
@param xpath the base xpath for the rules
552683
protected void addResourcePropertyRules(Digester digester, String xpath) {

        String xp_props = xpath + N_PROPERTIES + "/" + N_PROPERTY;
        // first rule in case the type is implicit
        digester.addCallMethod(xp_props, "addProperty");
        // second rule in case the type is given
        digester.addCallMethod(xp_props, "addProperty", 1);
        digester.addCallParam(xp_props, 0, A_TYPE);

        digester.addCallMethod(xp_props + "/" + N_NAME, "setPropertyName", 0);
        digester.addCallMethod(xp_props + "/" + N_VALUE, "setPropertyValue", 0);

    }
746851
public void addRuleInstances (String prefix, Digester dig)
    {
        // this creates the appropriate instance when we encounter our
        // prefix tag
        dig.addRule(prefix, new Rule() {
            @Override public void begin (String namespace, String name,
                               Attributes attributes) throws Exception {
                digester.push(createMisoSceneModel());
            }
            @Override public void end (String namespace, String name) throws Exception {
                digester.pop();
            }
        });

        // set up rules to parse and set our fields
        dig.addRule(prefix + "/swidth", new SetFieldRule("swidth"));
        dig.addRule(prefix + "/sheight", new SetFieldRule("sheight"));
        dig.addRule(prefix + "/defTileSet", new SetFieldRule("defTileSet"));

        String sprefix = prefix + "/sections/section";
        dig.addObjectCreate(sprefix, Section.class.getName());
        dig.addRule(sprefix, new SetPropertyFieldsRule());
        dig.addRule(sprefix + "/base", new SetFieldRule("baseTileIds"));
        addObjectExtractor(dig, "objects", sprefix, "addObject");
        dig.addSetNext(sprefix, "setSection", Section.class.getName());
    }
194991
public static I_CmsXmlContentHandler getContentHandlerForResource(CmsObject cms, CmsResource resource)
    throws CmsException {

        return getContentDefinitionForResource(cms, resource).getContentHandler();
    }
1043826
public CmsContainerElement setElementInfo(CmsContainerElementBean elementBean, CmsContainerElement result)
    throws CmsException {

        Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms);
        // reinitializing resource to avoid caching issues
        elementBean.initResource(m_cms);
        CmsResource resource = elementBean.getResource();
        boolean isModelGroup = elementBean.getIndividualSettings().containsKey(CmsContainerElement.MODEL_GROUP_ID);
        if (isModelGroup) {
            CmsUUID groupId = new CmsUUID(elementBean.getIndividualSettings().get(CmsContainerElement.MODEL_GROUP_ID));
            resource = m_cms.readResource(groupId, CmsResourceFilter.IGNORE_EXPIRATION);
        }

        boolean newEditorDisabled = !CmsWorkplaceEditorManager.checkAcaciaEditorAvailable(
            m_cms,
            elementBean.getResource());
        result.setNewEditorDisabled(newEditorDisabled);
        I_CmsResourceType resourceType = OpenCms.getResourceManager().getResourceType(resource);
        String typeName = resourceType.getTypeName();
        result.setHasEditHandler(
            (resourceType instanceof CmsResourceTypeXmlContent)
                && (((CmsResourceTypeXmlContent)resourceType).getEditHandler(m_cms) != null));
        result.setResourceType(typeName);
        result.setIconClasses(
            CmsIconUtil.getIconClasses(
                CmsIconUtil.getDisplayType(m_cms, resource),
                elementBean.getResource().getName(),
                false));
        CmsPermissionInfo permissionInfo;
        String title;
        String subTitle;
        if (!elementBean.isInMemoryOnly()) {
            permissionInfo = OpenCms.getADEManager().getPermissionInfo(m_cms, resource, m_page.getRootPath());
            if (CmsResourceTypeXmlContent.isXmlContent(resource)) {
                if (CmsStringUtil.isEmptyOrWhitespaceOnly(permissionInfo.getNoEditReason())
                    && elementBean.isInheritedContainer(m_cms)) {
                    String requestUri = m_cms.getRequestContext().getUri();
                    String folderPath = CmsResource.getFolderPath(requestUri);
                    String configPath = CmsStringUtil.joinPaths(
                        folderPath,
                        CmsContainerConfigurationCache.INHERITANCE_CONFIG_FILE_NAME);
                    if (m_cms.existsResource(configPath)) {
                        permissionInfo.setNoEditReason(
                            new CmsResourceUtil(m_cms, m_cms.readResource(configPath)).getNoEditReason(wpLocale, true));
                    } else {
                        if (!m_cms.getLock(folderPath).isLockableBy(m_cms.getRequestContext().getCurrentUser())) {
                            permissionInfo.setNoEditReason(
                                org.opencms.workplace.explorer.Messages.get().getBundle(wpLocale).key(
                                    org.opencms.workplace.explorer.Messages.GUI_NO_EDIT_REASON_LOCK_1,
                                    new CmsResourceUtil(m_cms, m_cms.readResource(folderPath)).getLockedByName()));
                        }
                    }
                }
            } else {
                permissionInfo.setNoEditReason(
                    Messages.get().getBundle(wpLocale).key(Messages.GUI_ELEMENT_RESOURCE_CAN_NOT_BE_EDITED_0));
            }
            CmsGallerySearchResult searchResult = CmsGallerySearch.searchById(
                m_cms,
                resource.getStructureId(),
                m_locale);
            title = searchResult.getTitle();
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(title)) {
                resource.getName();
            }
            subTitle = searchResult.getUserLastModified();
            Date lastModDate = searchResult.getDateLastModified();
            if (lastModDate != null) {
                subTitle += " / " + CmsDateUtil.getDateTime(lastModDate, DateFormat.MEDIUM, wpLocale);
            }
        } else {
            permissionInfo = new CmsPermissionInfo(true, true, "");
            title = CmsWorkplaceMessages.getResourceTypeName(wpLocale, typeName);
            subTitle = CmsWorkplaceMessages.getResourceTypeDescription(wpLocale, typeName);
        }
        result.setTitle(title);
        result.setSubTitle(subTitle);
        result.setClientId(elementBean.editorHash());
        result.setSitePath(m_cms.getSitePath(resource));

        result.setCreateNew(elementBean.isCreateNew());
        CmsResourceTypeConfig typeConfig = getConfigData().getResourceType(typeName);
        if (typeConfig != null) {
            result.setCopyInModels(typeConfig.isCopyInModels());
        }
        Map<CmsUUID, CmsElementView> viewMap = OpenCms.getADEManager().getElementViews(m_cms);

        boolean isModelGroupEditing = CmsModelGroupHelper.isModelGroupResource(m_page);
        if (!isModelGroup
            && isModelGroupEditing
            && elementBean.getIndividualSettings().containsKey(CmsContainerElement.MODEL_GROUP_STATE)
            && (ModelGroupState.isModelGroup == ModelGroupState.evaluate(
                elementBean.getIndividualSettings().get(CmsContainerElement.MODEL_GROUP_STATE)))) {
            isModelGroup = true;
        }
        if (!isModelGroupEditing && isModelGroup) {
            CmsResourceTypeConfig modelGroupConfig = getConfigData().getResourceType(
                CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME);
            if (modelGroupConfig != null) {
                CmsUUID elementView = modelGroupConfig.getElementView();
                CmsElementView viewObject = viewMap.get(elementView);
                if ((viewObject != null) && (viewObject.getParentViewId() != null)) {
                    elementView = viewObject.getParentViewId();
                }
                result.setElementView(elementView);
            }
        } else if (typeConfig != null) {
            CmsUUID elementView = typeConfig.getElementView();
            CmsElementView viewObject = viewMap.get(elementView);
            if ((viewObject != null) && (viewObject.getParentViewId() != null)) {
                elementView = viewObject.getParentViewId();
            }
            result.setElementView(elementView);
        }
        if (elementBean.isCreateNew()
            && CmsStringUtil.isEmptyOrWhitespaceOnly(permissionInfo.getNoEditReason())
            && ((typeConfig == null)
                || !typeConfig.checkCreatable(m_cms, CmsResource.getParentFolder(m_page.getRootPath())))) {
            String niceName = CmsWorkplaceMessages.getResourceTypeName(wpLocale, typeName);
            permissionInfo.setNoEditReason(
                Messages.get().getBundle(wpLocale).key(Messages.GUI_CONTAINERPAGE_TYPE_NOT_CREATABLE_1, niceName));
        }
        result.setHasSettings(hasSettings(m_cms, elementBean.getResource()));
        result.setPermissionInfo(permissionInfo);
        result.setReleasedAndNotExpired(elementBean.isReleasedAndNotExpired());
        if (elementBean.isModelGroup()) {
            String modelId = elementBean.getIndividualSettings().get(CmsContainerElement.MODEL_GROUP_ID);
            result.setModelGroupId(modelId != null ? new CmsUUID(modelId) : CmsUUID.getNullUUID());
        }
        result.setWasModelGroup(
            elementBean.getIndividualSettings().containsKey(CmsContainerElement.MODEL_GROUP_STATE)
                && (ModelGroupState.evaluate(
                    elementBean.getIndividualSettings().get(
                        CmsContainerElement.MODEL_GROUP_STATE)) == ModelGroupState.wasModelGroup));
        return result;
    }
183847
protected void addResourceAceRules(Digester digester, String xpath) {

        String xp_ace = xpath + N_ACCESSCONTROL_ENTRIES + "/" + N_ACCESSCONTROL_ENTRY;
        digester.addCallMethod(xp_ace, "addAccessControlEntry");
        digester.addCallMethod(xp_ace + "/" + N_ACCESSCONTROL_PRINCIPAL, "setAcePrincipalId", 0);
        digester.addCallMethod(xp_ace + "/" + N_FLAGS, "setAceFlags", 0);
        String xp_perms = xp_ace + "/" + N_ACCESSCONTROL_PERMISSIONSET + "/";
        digester.addCallMethod(xp_perms + N_ACCESSCONTROL_ALLOWEDPERMISSIONS, "setAcePermissionsAllowed", 0);
        digester.addCallMethod(xp_perms + N_ACCESSCONTROL_DENIEDPERMISSIONS, "setAcePermissionsDenied", 0);
    }
828436
protected void addToolManagerRules(Digester digester) {

        // add tool-manager
        String rulePath = "*/" + N_TOOLMANAGER;
        digester.addObjectCreate(rulePath, CmsToolManager.class);
        digester.addSetNext(rulePath, "setToolManager");
        // add tool-manager roots
        rulePath += "/" + N_ROOTS + "/" + N_ROOT;
        digester.addObjectCreate(rulePath, CmsToolRootHandler.class);
        digester.addSetNext(rulePath, "addToolRoot");
        digester.addBeanPropertySetter(rulePath + "/" + N_KEY);
        digester.addBeanPropertySetter(rulePath + "/" + N_URI);
        digester.addBeanPropertySetter(rulePath + "/" + N_NAME);
        digester.addBeanPropertySetter(rulePath + "/" + N_HELPTEXT, "helpText");
    }
1285180
public org.inferred.freebuilder.processor.property.Property.Builder addAccessorAnnotations(
      Excerpt element) {
    if (accessorAnnotations instanceof ImmutableList) {
      accessorAnnotations = new ArrayList<>(accessorAnnotations);
    }
    accessorAnnotations.add(Objects.requireNonNull(element));
    return (org.inferred.freebuilder.processor.property.Property.Builder) this;
  }
1127252
@Deprecated
    protected void addSearchField(CmsXmlContentDefinition contentDefinition, CmsSearchField field) {

        addSearchField(contentDefinition, field, I_CmsXmlContentHandler.MappingType.ELEMENT);
    }
1352185
public void configureRuntimeLexer(com.google.inject.Binder binder) {
		binder.bind(org.eclipse.xtext.parser.antlr.Lexer.class).annotatedWith(com.google.inject.name.Names.named(org.eclipse.xtext.parser.antlr.LexerBindings.RUNTIME)).to(org.eclipse.xtext.xtext.generator.parser.antlr.splitting.parser.antlr.internal.InternalSimpleExpressionsLexer.class);
	}
1074717
public void setResourceLoader(ResourceLoader resourceLoader) {
		this.resourceLoader = resourceLoader;
		this.xmlReader.setResourceLoader(resourceLoader);
		this.scanner.setResourceLoader(resourceLoader);
	}
843126
protected void addResourceAttributesRules(Digester digester, String xpath) {

        digester.addCallMethod(xpath + N_SOURCE, "setSource", 0);
        digester.addCallMethod(xpath + N_DESTINATION, "setDestination", 0);
        digester.addCallMethod(xpath + N_TYPE, "setType", 0);
        digester.addCallMethod(xpath + N_UUIDSTRUCTURE, "setStructureId", 0);
        digester.addCallMethod(xpath + N_UUIDRESOURCE, "setResourceId", 0);
        digester.addCallMethod(xpath + N_DATELASTMODIFIED, "setDateLastModified", 0);
        digester.addCallMethod(xpath + N_USERLASTMODIFIED, "setUserLastModified", 0);
        digester.addCallMethod(xpath + N_DATECREATED, "setDateCreated", 0);
        digester.addCallMethod(xpath + N_USERCREATED, "setUserCreated", 0);
        digester.addCallMethod(xpath + N_DATERELEASED, "setDateReleased", 0);
        digester.addCallMethod(xpath + N_DATEEXPIRED, "setDateExpired", 0);
        digester.addCallMethod(xpath + N_FLAGS, "setFlags", 0);
    }
985573
public Xml addElement(String xmlFragment) {
        Element element = elementBuilder.getElement(xmlFragment);
        return addElement(element);
    }
442643
@Override
    public void addRuleInstances(Digester digester) {
        digester.addObjectCreate("profiles", Profiles.class);
        digester.addObjectCreate(PROFILES_PROFILE, Profile.class);
        digester.addObjectCreate(PROFILES_PROFILE_SETTING, Setting.class);

        digester.addSetNext(PROFILES_PROFILE, "addProfile");
        digester.addSetNext(PROFILES_PROFILE_SETTING, "addSetting");

        digester.addSetProperties(PROFILES_PROFILE, "kind", "kind");
        digester.addSetProperties(PROFILES_PROFILE_SETTING, "id", "id");
        digester.addSetProperties(PROFILES_PROFILE_SETTING, "value", "value");
    }
522395
public void appendXmlSchema(Element root) {

        Element element = root.addElement(CmsXmlContentDefinition.XSD_NODE_ELEMENT);
        element.addAttribute(CmsXmlContentDefinition.XSD_ATTRIBUTE_NAME, getName());
        element.addAttribute(CmsXmlContentDefinition.XSD_ATTRIBUTE_TYPE, getTypeName());
        if ((getMinOccurs() > 1) || (getMinOccurs() == 0)) {
            element.addAttribute(CmsXmlContentDefinition.XSD_ATTRIBUTE_MIN_OCCURS, String.valueOf(getMinOccurs()));
        }
        if (getMaxOccurs() > 1) {
            if (getMaxOccurs() == Integer.MAX_VALUE) {
                element.addAttribute(
                    CmsXmlContentDefinition.XSD_ATTRIBUTE_MAX_OCCURS,
                    CmsXmlContentDefinition.XSD_ATTRIBUTE_VALUE_UNBOUNDED);
            } else {
                element.addAttribute(CmsXmlContentDefinition.XSD_ATTRIBUTE_MAX_OCCURS, String.valueOf(getMaxOccurs()));
            }
        }
    }
754784
@SuppressWarnings("rawtypes")
	public List<NodeConfig> parserByXpath(InputStreamReader xml, String xpath) throws UnmarshalException {
		
		List<NodeConfig> nodeConfigList = new ArrayList<NodeConfig>();
		SAXBuilder builder = new SAXBuilder(false);
		Document doc = null;
		
		try {
			doc = builder.build(xml);
			Element root = doc.getRootElement();
			
			if (xpath != null && !xpath.equals("")) {
				List selectNodes = XPath.selectNodes(root, xpath);
				for (Iterator iterNode = selectNodes.iterator(); iterNode.hasNext();) {
					NodeConfig nodeConfig = parserNode((Element) iterNode.next());
					nodeConfigList.add(nodeConfig);
				}
			}
			
			return nodeConfigList;
		} catch (JDOMException e) {
			throw new UnmarshalException(e);
		} catch (IOException e) {
			throw new UnmarshalException(e);
		}

	}
150492
protected void addAccountsGroupRules(Digester digester, String xpath) {

        String xp_group = xpath + N_GROUPS + "/" + N_GROUP;
        digester.addCallMethod(xp_group, "importGroup");
        xp_group += "/";
        digester.addCallMethod(xp_group + N_NAME, "setGroupName", 0);
        digester.addCallMethod(xp_group + N_DESCRIPTION, "setGroupDescription", 0);
        digester.addCallMethod(xp_group + N_FLAGS, "setGroupFlags", 0);
        digester.addCallMethod(xp_group + N_PARENTGROUP, "setGroupParent", 0);
    }
162036
private void parseResources(Element element, BeanDefinitionBuilder builder,
                                ManagedList<AbstractBeanDefinition> resourceList) {
        NodeList resources = element.getChildNodes();

        for (int i = 0; i < resources.getLength(); i++) {
            Node node = resources.item(i);

            if (!(node instanceof Element)) {
                continue;
            }

            Element resource = (Element) resources.item(i);
            Class<? extends IPluginResource> resourceClass = null;

            switch (getResourceType(getNodeName(resource))) {
                case button:
                    resourceClass = PluginResourceButton.class;
                    break;
                
                case help:
                    resourceClass = PluginResourceHelp.class;
                    break;
                
                case menu:
                    resourceClass = PluginResourceMenu.class;
                    break;
                
                case property:
                    resourceClass = PluginResourcePropertyGroup.class;
                    break;
                
                case css:
                    resourceClass = PluginResourceCSS.class;
                    break;
                
                case bean:
                    resourceClass = PluginResourceBean.class;
                    break;
                
                case command:
                    resourceClass = PluginResourceCommand.class;
                    break;
                
                case action:
                    resourceClass = PluginResourceAction.class;
                    break;
            }

            if (resourceClass != null) {
                BeanDefinitionBuilder resourceBuilder = BeanDefinitionBuilder.genericBeanDefinition(resourceClass);
                addProperties(resource, resourceBuilder);
                resourceList.add(resourceBuilder.getBeanDefinition());
            }
        }
    }