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


Java TypeDefinitionWrapper.getPropertyById方法代码示例

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


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

示例1: checkChildObjectType

import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入方法依赖的package包/类
/**
 * Checks if a child of a given type can be added to a given folder.
 */
@SuppressWarnings("unchecked")
public void checkChildObjectType(CMISNodeInfo folderInfo, String childType)
{
    TypeDefinitionWrapper targetType = folderInfo.getType();
    PropertyDefinitionWrapper allowableChildObjectTypeProperty = targetType
            .getPropertyById(PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS);
    List<String> childTypes = (List<String>) allowableChildObjectTypeProperty.getPropertyAccessor().getValue(
            folderInfo);

    if ((childTypes == null) || childTypes.isEmpty())
    {
        return;
    }

    if (!childTypes.contains(childType))
    {
        throw new CmisConstraintException("Objects of type '" + childType + "' cannot be added to this folder!");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:CMISConnector.java

示例2: checkChildObjectType

import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入方法依赖的package包/类
/**
 * Checks if a child of a given type can be added to a given folder.
 */
@SuppressWarnings("unchecked")
public void checkChildObjectType(CMISNodeInfo folderInfo, String childType)
{
    TypeDefinitionWrapper targetType = folderInfo.getType();
    PropertyDefinitionWrapper allowableChildObjectTypeProperty = targetType
            .getPropertyById(PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS);
    List<String> childTypes = (List<String>) allowableChildObjectTypeProperty.getPropertyAccessor().getValue(
            folderInfo);

    if ((childTypes == null) || childTypes.isEmpty())
    {
        return;
    }
    
    if (!childTypes.contains(childType))
    {
        throw new CmisConstraintException("Objects of type '" + childType + "' cannot be added to this folder!");
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:CMISConnector.java

示例3: checkFieldApplies

import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入方法依赖的package包/类
public void checkFieldApplies(Selector selector, String propertyName)
{
    PropertyDefinitionWrapper propDef = cmisDictionaryService.findPropertyByQueryName(propertyName);
    if (propDef == null)
    {
        if (EXPOSED_FIELDS.contains(propertyName))
        {
            return;
        }
        else
        {
            throw new CmisInvalidArgumentException("Unknown column/property " + propertyName);
        }
    }

    TypeDefinitionWrapper typeDef = cmisDictionaryService.findTypeForClass(selector.getType(), validScopes);
    if (typeDef == null)
    {
        throw new CmisInvalidArgumentException("Type unsupported in CMIS queries: " + selector.getAlias());
    }

    // Check column/property applies to selector/type

    if (typeDef.getPropertyById(propDef.getPropertyId()) == null)
    {
        throw new CmisInvalidArgumentException("Invalid column for "
                + typeDef.getTypeDefinition(false).getQueryName() + "." + propertyName);
    }

}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:31,代码来源:CmisFunctionEvaluationContext.java

示例4: buildColumnReference

import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入方法依赖的package包/类
public PropertyArgument buildColumnReference(String argumentName, CommonTree columnReferenceNode,
        QueryModelFactory factory, Map<String, Selector> selectors, Map<String, Column> columnMap)
{
    String cmisPropertyName = columnReferenceNode.getChild(0).getText();
    String qualifier = "";
    if (columnReferenceNode.getChildCount() > 1)
    {
        qualifier = columnReferenceNode.getChild(1).getText();
    }

    if ((qualifier == "") && (columnMap != null))
    {
        Column column = columnMap.get(cmisPropertyName);
        if (column != null)
        {
            // check for function type
            if (column.getFunction().getName().equals(PropertyAccessor.NAME))
            {
                PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(
                        PropertyAccessor.ARG_PROPERTY);
                cmisPropertyName = arg.getPropertyName();
                qualifier = arg.getSelector();
            } else
            {
                // TODO: should be able to return non property arguments
                // The implementation should throw out what it can not
                // support at build time.
                throw new CmisInvalidArgumentException(
                        "Complex column reference unsupported (only direct column references are currently supported) "
                                + cmisPropertyName);
            }
        }
    }

    PropertyDefinitionWrapper propDef = cmisDictionaryService.findPropertyByQueryName(cmisPropertyName);
    if (propDef == null)
    {
        throw new CmisInvalidArgumentException("Unknown column/property " + cmisPropertyName);
    }

    if (selectors != null)
    {
        Selector selector = selectors.get(qualifier);
        if (selector == null)
        {
            if ((qualifier.equals("")) && (selectors.size() == 1))
            {
                selector = selectors.get(selectors.keySet().iterator().next());
            } else
            {
                throw new CmisInvalidArgumentException("No selector for " + qualifier);
            }
        }

        TypeDefinitionWrapper typeDef = cmisDictionaryService.findTypeForClass(selector.getType(), validScopes);
        if (typeDef == null)
        {
            throw new CmisInvalidArgumentException("Type unsupported in CMIS queries: " + selector.getAlias());
        }

        // Check column/property applies to selector/type

        if (typeDef.getPropertyById(propDef.getPropertyId()) == null)
        {
            throw new CmisInvalidArgumentException("Invalid column for "
                    + typeDef.getTypeDefinition(false).getQueryName() + "." + cmisPropertyName);
        }
    }

    if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
    {
        if (!propDef.getPropertyDefinition().isQueryable())
        {
            throw new CmisInvalidArgumentException("Column is not queryable " + qualifier + "." + cmisPropertyName);
        }
    }
    return factory.createPropertyArgument(argumentName, propDef.getPropertyDefinition().isQueryable(), propDef
            .getPropertyDefinition().isOrderable(), qualifier, propDef.getPropertyId());
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:80,代码来源:CMISQueryParser.java


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