Examples of PropertyDefinition


Examples of fr.imag.adele.apam.declarations.PropertyDefinition

    if (Attribute.isReservedAttributePrefix(attr)) {
      logger.error("ERROR: \"" + attr + "\" is a reserved attribute");
      return false;
    }

    PropertyDefinition propDef = getAttrDefinition(attr);
    if (propDef != null && propDef.getField() != null && !forced) {
      logger.error("In " + this + " attribute " + attr
          + " is a program field and cannot be removed.");
      return false;
    }
View Full Code Here

Examples of fr.imag.adele.apam.declarations.PropertyDefinition

  public boolean setProperty(String attr, Object value, boolean forced) {
    /*
     * Validate that the property is defined and the value is valid Forced
     * means that we can set field attribute
     */
    PropertyDefinition def = validDef(attr, forced);
    if (def == null) {
      return false;
    }
    // At initialization, all valid attributes are ok for specs
    Object val = Attribute.checkAttrType(attr, value, def.getType());
    if (val == null) {
      return false;
    }

    /*
 
View Full Code Here

Examples of javax.jcr.nodetype.PropertyDefinition

        if (pds == null || pds.length == 0) {
            return QPropertyDefinition.EMPTY_ARRAY;
        }
        QPropertyDefinition[] declaredPropDefs = new QPropertyDefinition[pds.length];
        for (int i = 0; i < pds.length; i++) {
            PropertyDefinition propDef = pds[i];
            Name name = propDef.getName().equals(NameConstants.ANY_NAME.getLocalName())
                    ? NameConstants.ANY_NAME
                    : resolver.getQName(propDef.getName());
            // check if propDef provides declaring node type and if it matches 'this' one.
            if (propDef.getDeclaringNodeType() != null) {
                if (!declName.equals(resolver.getQName(propDef.getDeclaringNodeType().getName()))) {
                    throw new RepositoryException("Property definition specified invalid declaring nodetype: "
                            + propDef.getDeclaringNodeType().getName() + ", but should be " + declName);
                }
            }
            QValue[] defVls = propDef.getDefaultValues() == null
                    ? QValue.EMPTY_ARRAY
                    : ValueFormat.getQValues(propDef.getDefaultValues(), resolver, qValueFactory);
            String[] jcrConstraints = propDef.getValueConstraints();
            QValueConstraint[] constraints = QValueConstraint.EMPTY_ARRAY;
            if (jcrConstraints != null && jcrConstraints.length > 0) {
                constraints = new QValueConstraint[jcrConstraints.length];
                for (int j=0; j<constraints.length; j++) {
                    constraints[j] = ValueConstraint.create(propDef.getRequiredType(), jcrConstraints[j], resolver);
                }
            }
            declaredPropDefs[i] = new QPropertyDefinitionImpl(
                    name, declName,
                    propDef.isAutoCreated(),
                    propDef.isMandatory(),
                    propDef.getOnParentVersion(),
                    propDef.isProtected(),
                    defVls,
                    propDef.isMultiple(),
                    propDef.getRequiredType(),
                    constraints,
                    propDef.getAvailableQueryOperators(),
                    propDef.isFullTextSearchable(),
                    propDef.isQueryOrderable());
        }
        return declaredPropDefs;
    }
View Full Code Here

Examples of javax.jcr.nodetype.PropertyDefinition

        return null;
    }

    private PropertyDefinition searchPropertyDefinition(final Node node, final String name)
    throws RepositoryException {
        PropertyDefinition result = searchPropertyDefinition(node.getPrimaryNodeType(), name);
        if ( result == null ) {
            if ( node.getMixinNodeTypes() != null ) {
                for(final NodeType mt : node.getMixinNodeTypes()) {
                    result = this.searchPropertyDefinition(mt, name);
                    if ( result != null ) {
View Full Code Here

Examples of javax.jcr.nodetype.PropertyDefinition

            setPropertyAsIs(mod, prop);

        } else if (AUTO_PROPS.containsKey(name)) {
            // check if this is a JCR resource and check node type
            if ( mod.node != null ) {
                final PropertyDefinition pd = this.searchPropertyDefinition(mod.node, name);
                if ( pd != null ) {
                    // SLING-2877 (autocreated check is only required for new nodes)
                    if ( (mod.node.isNew() && pd.isAutoCreated()) || pd.isProtected() ) {
                        return;
                    }
                }
            }
View Full Code Here

Examples of javax.jcr.nodetype.PropertyDefinition

        return propertyDefinitions;
    }
   
    PropertyDefinition getPropertyDefinition(String name) {
        for (int i = 0; i < propertyDefinitions.length; i++) {
            PropertyDefinition pd = propertyDefinitions[i];
            if (pd.getName().equals(name)) {
                return pd;
            }
        }
        return null;
    }
View Full Code Here

Examples of javax.jcr.nodetype.PropertyDefinition

            throws RepositoryException {
        if (property == null) {
            return;
        }

        PropertyDefinition definition = property.getDefinition();
        if (definition.getRequiredType() != expectedType) {
            getLogger().trace("Removing property {0} of type {1} since we need type {2}", property.getName(),
                    definition.getRequiredType(), expectedType);
            property.remove();
            return;
        }

        if (definition.isMultiple() != expectedMultiplicity) {
            getLogger().trace("Removing property {0} of multiplicity {1} since we need type {2}", property.getName(),
                    definition.isMultiple(), expectedMultiplicity);
            property.remove();
            return;
        }
    }
View Full Code Here

Examples of javax.jcr.nodetype.PropertyDefinition

        Map<String,VltPropertyDefinition> pds = new HashMap<String,VltPropertyDefinition>();
       
        PropertyDefinition[] declaredPds = nt.getDeclaredPropertyDefinitions();
        if (declaredPds!=null) {
            for (int i = 0; i < declaredPds.length; i++) {
                PropertyDefinition pd = declaredPds[i];
                pds.put(pd.getName(), (VltPropertyDefinition) pd);
            }
        }
       
        NodeType[] superTypes = nt.getSupertypes();
        if (superTypes!=null) {
            for (int i = 0; i < superTypes.length; i++) {
                VltNodeType aSuperType = (VltNodeType) superTypes[i];
               
                VltPropertyDefinition[] superTypePds = (VltPropertyDefinition[])aSuperType.getPropertyDefinitions();
                for (int j = 0; j < superTypePds.length; j++) {
                    VltPropertyDefinition pd = superTypePds[j];
                    VltPropertyDefinition existingPd = pds.get(pd.getName());
                    if (existingPd!=null) {
                        // merge the two
                        existingPd.mergeFrom(pd);
                    } else {
                        pds.put(pd.getName(), pd);
                    }
                }
            }
        }
        nt.setPropertyDefinitions(pds.values().toArray(new VltPropertyDefinition[pds.size()]));
View Full Code Here

Examples of org.andromda.core.namespace.PropertyDefinition

                if (properties != null && properties.length > 0)
                {
                    final int numberOfProperties = properties.length;
                    for (int ctr = 0; ctr < numberOfProperties; ctr++)
                    {
                        final PropertyDefinition property = properties[ctr];
                        final String propertyName = property.getName();
                        if (Introspector.instance().isWritable(repositoryImplementation, propertyName))
                        {
                            Introspector.instance().setProperty(
                                repositoryImplementation,
                                property.getName(),
                                namespaces.getPropertyValue(
                                    namespace,
                                    property.getName()));
                        }
                    }
                }
                repositoryImplementation.open();
                this.repositories.put(
View Full Code Here

Examples of org.andromda.core.namespace.PropertyDefinition

     */
    public String getPropertyValue(
        final String namespace,
        final String name)
    {
        final PropertyDefinition definition = this.getPropertyDefinition(
                namespace,
                name);
        if (definition == null)
        {
            throw new NamespacesException("Property '" + name + "' is not registered in either the '" + namespace +
                "' or '" + Namespaces.DEFAULT + "' namespaces");
        }
        final String defaultValue = definition.getDefaultValue();
        boolean warning = defaultValue == null && definition.isRequired();
        final Property property = this.getProperty(
                namespace,
                name,
                warning);
        return property != null && !property.isIgnore() ? property.getValue() : defaultValue;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.