当前位置: 首页>>代码示例>>Java>>正文


Java PropertyDefinition.isMandatory方法代码示例

本文整理汇总了Java中org.alfresco.service.cmr.dictionary.PropertyDefinition.isMandatory方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyDefinition.isMandatory方法的具体用法?Java PropertyDefinition.isMandatory怎么用?Java PropertyDefinition.isMandatory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.service.cmr.dictionary.PropertyDefinition的用法示例。


在下文中一共展示了PropertyDefinition.isMandatory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isMandatory

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
private boolean isMandatory(ClassAttributeDefinition definition)
{
    if(definition instanceof PropertyDefinition)
    {
        PropertyDefinition propDef = (PropertyDefinition) definition;
        return propDef.isMandatory();
    }
    AssociationDefinition assocDSef = (AssociationDefinition) definition;
    return assocDSef.isTargetMandatory();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:ActivitiPropertyConverter.java

示例2: checkProperties

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
/**
 * @param propertyDefs the property definitions to check
 * @param properties the properties
 * @return Returns true if the property definitions were all satisified
 */
private boolean checkProperties(
        Collection<PropertyDefinition> propertyDefs,
        Map<QName, Serializable> properties)
{
    for (PropertyDefinition propertyDef : propertyDefs)
    {
        if (propertiesToIgnore.contains(propertyDef.getName()))
        {
            continue;
        }
        
        if (!propertyDef.isMandatory())
        {
            // The property isn't mandatory in any way
            continue;
        }
        else if (propertyDef.isMandatoryEnforced())
        {
            // The mandatory nature of the property is fully enforced
            // Leave these for integrity
            continue;
        }
        // The mandatory nature of the property is 'soft' a.k.a. 'required'
        // Check that the property value has been supplied
        if (properties.get(propertyDef.getName()) == null)
        {
            // property NOT supplied
            return false;
        }
    }
    // all properties were present
    return true;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:IncompleteNodeTagger.java

示例3: CustomModelProperty

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
public CustomModelProperty(PropertyDefinition propertyDefinition, MessageLookup messageLookup)
{
    this.name = propertyDefinition.getName().getLocalName();
    this.prefixedName = propertyDefinition.getName().toPrefixString();
    this.title = propertyDefinition.getTitle(messageLookup);
    this.dataType = propertyDefinition.getDataType().getName().toPrefixString();
    this.description = propertyDefinition.getDescription(messageLookup);
    this.isMandatory = propertyDefinition.isMandatory();
    this.isMandatoryEnforced = propertyDefinition.isMandatoryEnforced();
    this.isMultiValued = propertyDefinition.isMultiValued();
    this.defaultValue = propertyDefinition.getDefaultValue();
    this.isIndexed = propertyDefinition.isIndexed();
    this.facetable = propertyDefinition.getFacetable();
    this.indexTokenisationMode = propertyDefinition.getIndexTokenisationMode();
    List<ConstraintDefinition> constraintDefs = propertyDefinition.getConstraints();
    if (constraintDefs.size() > 0)
    {
        this.constraintRefs = new ArrayList<>();
        this.constraints = new ArrayList<>();
        for (ConstraintDefinition cd : constraintDefs)
        {
            if (cd.getRef() != null)
            {
                constraintRefs.add(cd.getRef().toPrefixString());
            }
            else
            {
                constraints.add(new CustomModelConstraint(cd, messageLookup));
            }
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:33,代码来源:CustomModelProperty.java

示例4: createOverriddenProperty

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
/**
 * Create a property definition whose values are overridden
 * 
 * @param propertyDef  the property definition to override
 * @param override  the overridden values
 * @return  the property definition
 */
private M2Property createOverriddenProperty(
        PropertyDefinition propertyDef,
        M2PropertyOverride override,
        NamespacePrefixResolver prefixResolver,
        Map<QName, ConstraintDefinition> modelConstraints)
{
    M2Property property = new M2Property();
    property.setOverride(true);
    
    // Process Default Value
    String defaultValue = override.getDefaultValue();
    property.setDefaultValue(defaultValue == null ? propertyDef.getDefaultValue() : defaultValue);

    // Process Mandatory Value
    Boolean isOverrideMandatory = override.isMandatory();
    Boolean isOverrideMandatoryEnforced = override.isMandatoryEnforced();
    if (isOverrideMandatory != null && propertyDef.isMandatory())
    {
        // the override specified whether the property should be mandatory or not
        // check that the mandatory enforcement is not relaxed
        if (!isOverrideMandatory)
        {
            throw new DictionaryException(
                    "d_dictionary.property.err.cannot_relax_mandatory",
                    propertyDef.getName().toPrefixString());
        }
        else if ((isOverrideMandatoryEnforced != null) && !isOverrideMandatoryEnforced && propertyDef.isMandatoryEnforced())
        {
            throw new DictionaryException(
                    "d_dictionary.property.err.cannot_relax_mandatory_enforcement",
                    propertyDef.getName().toPrefixString());
        }
    }
    property.setMandatory(isOverrideMandatory == null ? propertyDef.isMandatory() : isOverrideMandatory);
    property.setMandatoryEnforced(isOverrideMandatoryEnforced == null ? propertyDef.isMandatoryEnforced() : isOverrideMandatoryEnforced);

    // inherit or override constraints
    List<M2Constraint> overrideConstraints = override.getConstraints();
    if (overrideConstraints != null)
    {
        constraintDefs = buildConstraints(
                overrideConstraints,
                this,
                prefixResolver,
                modelConstraints);
    }
    else
    {
        this.constraintDefs = propertyDef.getConstraints();
    }

    // Copy all other properties as they are
    property.setDescription(propertyDef.getDescription(null));
    property.setIndexed(propertyDef.isIndexed());
    property.setIndexedAtomically(propertyDef.isIndexedAtomically());
    property.setMultiValued(propertyDef.isMultiValued());
    property.setProtected(propertyDef.isProtected());
    property.setStoredInIndex(propertyDef.isStoredInIndex());
    property.setTitle(propertyDef.getTitle(null));
    property.setIndexTokenisationMode(propertyDef.getIndexTokenisationMode());
    
    return property;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:71,代码来源:M2PropertyDefinition.java


注:本文中的org.alfresco.service.cmr.dictionary.PropertyDefinition.isMandatory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。