private void initDeclaredPropertyDefinitions()

in shared/impl-vlt/src/main/java/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java [120:190]


    private void initDeclaredPropertyDefinitions(VltNodeType nt, ResourceProxy child) {
        Map<String,VltPropertyDefinition> pds = new HashMap<>();
        
        // load propertyDefinition children
        for (ResourceProxy aChild : child.getChildren()) {
            String childName = PathUtil.getName(aChild.getPath());
            if (childName.startsWith("jcr:propertyDefinition")) {
                String jcrName = (String)aChild.getProperties().get("jcr:name");
                if (jcrName!=null) {
                    VltPropertyDefinition pd = new VltPropertyDefinition();
                    pd.setName(jcrName);
                    Boolean autoCreated = (Boolean)aChild.getProperties().get("jcr:autoCreated");
                    if (autoCreated!=null) {
                        pd.setAutoCreated(autoCreated);
                    }
                    Boolean multiple = (Boolean)aChild.getProperties().get("jcr:multiple");
                    if (multiple!=null) {
                        pd.setMultiple(multiple);
                    }
                    Boolean mandatory = (Boolean)aChild.getProperties().get("jcr:mandatory");
                    if (mandatory!=null) {
                        pd.setMandatory(mandatory);
                    }
                    Boolean isProtected = (Boolean)aChild.getProperties().get("jcr:protected");
                    if (isProtected!=null) {
                        pd.setProtected(isProtected);
                    }
                    final Object object = aChild.getProperties().get("jcr:requiredType");
                    if (object!=null) {
                        String requiredType = (String)object;
                        if (requiredType!=null) {
                            pd.setRequiredType(propertyTypeFromName(requiredType));
                        }
                    }
                    pds.put(jcrName, pd);
                }
            }
        }
        
        // load mandatory
        String[] mandatoryProperties = (String[]) child.getProperties().get("rep:mandatoryProperties");
        if (mandatoryProperties!=null) {
            for (int i = 0; i < mandatoryProperties.length; i++) {
                String aMandatoryProperty = mandatoryProperties[i];
                VltPropertyDefinition vpd = pds.get(aMandatoryProperty);
                if (vpd==null) {
                    vpd = new VltPropertyDefinition();
                    vpd.setName(aMandatoryProperty);
                    pds.put(aMandatoryProperty, vpd);
                }
                vpd.setMandatory(true);
            }
        }
        
        // load protected
        String[] protectedProperties = (String[]) child.getProperties().get("rep:protectedProperties");
        if (protectedProperties!=null) {
            for (int i = 0; i < protectedProperties.length; i++) {
                String aProtectedProperties = protectedProperties[i];
                VltPropertyDefinition vpd = pds.get(aProtectedProperties);
                if (vpd==null) {
                    vpd = new VltPropertyDefinition();
                    vpd.setName(aProtectedProperties);
                    pds.put(aProtectedProperties, vpd);
                }
                vpd.setProtected(true);
            }
        }
        
        nt.setDeclaredPropertyDefinitions(pds.values().toArray(new VltPropertyDefinition[pds.size()]));
    }