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


Java CmisExtensionElementImpl类代码示例

本文整理汇总了Java中org.apache.chemistry.opencmis.commons.impl.dataobjects.CmisExtensionElementImpl的典型用法代码示例。如果您正苦于以下问题:Java CmisExtensionElementImpl类的具体用法?Java CmisExtensionElementImpl怎么用?Java CmisExtensionElementImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CmisExtensionElementImpl类属于org.apache.chemistry.opencmis.commons.impl.dataobjects包,在下文中一共展示了CmisExtensionElementImpl类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addTypeExtensions

import org.apache.chemistry.opencmis.commons.impl.dataobjects.CmisExtensionElementImpl; //导入依赖的package包/类
private void addTypeExtensions(TypeDefinitionWrapper td)
{
    QName classQName = td.getAlfrescoClass();
    ClassDefinition classDef = dictionaryService.getClass(classQName);
    if(classDef != null)
    {
     // add mandatory/default aspects
     List<AspectDefinition> defaultAspects = classDef.getDefaultAspects(true);
     if(defaultAspects != null && defaultAspects.size() > 0)
     {
      List<CmisExtensionElement> mandatoryAspectsExtensions = new ArrayList<CmisExtensionElement>();
      for(AspectDefinition aspectDef : defaultAspects)
      {
      	QName aspectQName = aspectDef.getName();
      	
      	TypeDefinitionWrapper aspectType = getTypeDefByQName(cmisMapping.getCmisType(aspectQName));
          if (aspectType == null)
          {
              continue;
          }
	
      	mandatoryAspectsExtensions.add(new CmisExtensionElementImpl(ALFRESCO_EXTENSION_NAMESPACE, MANDATORY_ASPECT, null, aspectType.getTypeId()));
      }
	
         if(!mandatoryAspectsExtensions.isEmpty())
         {
             td.getTypeDefinition(true).setExtensions(
                     Collections.singletonList((CmisExtensionElement) new CmisExtensionElementImpl(
                             ALFRESCO_EXTENSION_NAMESPACE, MANDATORY_ASPECTS, null, mandatoryAspectsExtensions)));
         }
     }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:34,代码来源:CMISDictionaryRegistryImpl.java

示例2: getAspectExtensions

import org.apache.chemistry.opencmis.commons.impl.dataobjects.CmisExtensionElementImpl; //导入依赖的package包/类
/**
 * Builds aspect extension.
 */
public List<CmisExtensionElement> getAspectExtensions(CMISNodeInfo info, String filter, Set<String> alreadySetProperties)
{
    List<CmisExtensionElement> extensions = new ArrayList<CmisExtensionElement>();
    Set<String> propertyIds = new HashSet<String>(alreadySetProperties);
    List<CmisExtensionElement> propertyExtensionList = new ArrayList<CmisExtensionElement>();
    Set<String> filterSet = splitFilter(filter);

    Set<QName> aspects = info.getNodeAspects();
    for (QName aspect : aspects)
    {
        TypeDefinitionWrapper aspectType = getOpenCMISDictionaryService().findNodeType(aspect);
        if (aspectType == null)
        {
            continue;
        }

        AspectDefinition aspectDefinition = dictionaryService.getAspect(aspect);
        Map<QName, org.alfresco.service.cmr.dictionary.PropertyDefinition> aspectProperties = aspectDefinition.getProperties();

        extensions.add(new CmisExtensionElementImpl(ALFRESCO_EXTENSION_NAMESPACE, APPLIED_ASPECTS, null, aspectType
                .getTypeId()));

        for (PropertyDefinitionWrapper propDef : aspectType.getProperties())
        {
            boolean addPropertyToExtensionList = getRequestCmisVersion().equals(CmisVersion.CMIS_1_1) && aspectProperties.keySet().contains(propDef.getAlfrescoName());
            // MNT-11876 : add property to extension even if it has been returned (CMIS 1.1)
            if (propertyIds.contains(propDef.getPropertyId()) && !addPropertyToExtensionList)
            {
                // skip properties that have already been added
                continue;
            }

            if ((filterSet != null) && (!filterSet.contains(propDef.getPropertyDefinition().getQueryName())))
            {
                // skip properties that are not in the filter
                continue;
            }

            Serializable value = propDef.getPropertyAccessor().getValue(info);
            propertyExtensionList.add(createAspectPropertyExtension(propDef.getPropertyDefinition(), value));

            // mark property as 'added'
            propertyIds.add(propDef.getPropertyId());
        }
    }

    if (!propertyExtensionList.isEmpty())
    {
        CmisExtensionElementImpl propertiesExtension = new CmisExtensionElementImpl(
                ALFRESCO_EXTENSION_NAMESPACE, "properties", null, propertyExtensionList);
        extensions.addAll(Collections.singletonList(propertiesExtension));
    }

    return extensions;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:59,代码来源:CMISConnector.java

示例3: createAspectPropertyExtension

import org.apache.chemistry.opencmis.commons.impl.dataobjects.CmisExtensionElementImpl; //导入依赖的package包/类
/**
 * Creates a property extension element.
 */
@SuppressWarnings("rawtypes")
private CmisExtensionElement createAspectPropertyExtension(PropertyDefinition<?> propertyDefinition, Object value)
{
    String name;
    switch (propertyDefinition.getPropertyType())
    {
    case BOOLEAN:
        name = "propertyBoolean";
        break;
    case DATETIME:
        name = "propertyDateTime";
        break;
    case DECIMAL:
        name = "propertyDecimal";
        break;
    case INTEGER:
        name = "propertyInteger";
        break;
    case ID:
        name = "propertyId";
        break;
    default:
        name = "propertyString";
    }

    Map<String, String> attributes = new HashMap<String, String>();
    attributes.put("propertyDefinitionId", propertyDefinition.getId());
    attributes.put("queryName", propertyDefinition.getQueryName());
    // optional value
    if (propertyDefinition.getDisplayName() !=null && propertyDefinition.getDisplayName().trim().length() > 0)
    {
        attributes.put("displayName", propertyDefinition.getDisplayName());
    }
    // optional value
    if (propertyDefinition.getLocalName() !=null && propertyDefinition.getLocalName().trim().length() > 0)
    {
        attributes.put("localName", propertyDefinition.getLocalName());
    }


    List<CmisExtensionElement> propertyValues = new ArrayList<CmisExtensionElement>();
    if (value != null)
    {
        if (value instanceof List)
        {
            for (Object o : ((List) value))
            {
            	if(o != null)
            	{
            		propertyValues.add(new CmisExtensionElementImpl(CMIS_NAMESPACE, "value", null,
            				convertAspectPropertyValue(o)));
            	}
            	else
            	{
            		logger.warn("Unexpected null entry in list value for property " + propertyDefinition.getDisplayName()
            				+ ", value = " + value);
            	}
            }
        }
        else
        {
            propertyValues.add(new CmisExtensionElementImpl(CMIS_NAMESPACE, "value", null,
                    convertAspectPropertyValue(value)));
        }
    }

    return new CmisExtensionElementImpl(CMIS_NAMESPACE, name, attributes, propertyValues);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:72,代码来源:CMISConnector.java

示例4: createAspectPropertyExtension

import org.apache.chemistry.opencmis.commons.impl.dataobjects.CmisExtensionElementImpl; //导入依赖的package包/类
/**
 * Creates a property extension element.
 */
@SuppressWarnings("rawtypes")
private CmisExtensionElement createAspectPropertyExtension(PropertyDefinition<?> propertyDefinition, Object value)
{
    String name;
    switch (propertyDefinition.getPropertyType())
    {
    case BOOLEAN:
        name = "propertyBoolean";
        break;
    case DATETIME:
        name = "propertyDateTime";
        break;
    case DECIMAL:
        name = "propertyDecimal";
        break;
    case INTEGER:
        name = "propertyInteger";
        break;
    case ID:
        name = "propertyId";
        break;
    default:
        name = "propertyString";
    }

    Map<String, String> attributes = new HashMap<String, String>();
    attributes.put("propertyDefinitionId", propertyDefinition.getId());
    attributes.put("queryName", propertyDefinition.getQueryName());
    // optional value
    if (propertyDefinition.getDisplayName() !=null && propertyDefinition.getDisplayName().trim().length() > 0)
    {
        attributes.put("displayName", propertyDefinition.getDisplayName());
    }
    // optional value
    if (propertyDefinition.getLocalName() !=null && propertyDefinition.getLocalName().trim().length() > 0)
    {
        attributes.put("localName", propertyDefinition.getLocalName());
    }
    

    List<CmisExtensionElement> propertyValues = new ArrayList<CmisExtensionElement>();
    if (value != null)
    {
        if (value instanceof List)
        {
            for (Object o : ((List) value))
            {
            	if(o != null)
            	{
            		propertyValues.add(new CmisExtensionElementImpl(CMIS_NAMESPACE, "value", null,
            				convertAspectPropertyValue(o)));
            	}
            	else
            	{
            		logger.warn("Unexpected null entry in list value for property " + propertyDefinition.getDisplayName()
            				+ ", value = " + value);
            	}
            }
        }
        else
        {
            propertyValues.add(new CmisExtensionElementImpl(CMIS_NAMESPACE, "value", null,
                    convertAspectPropertyValue(value)));
        }
    }

    return new CmisExtensionElementImpl(CMIS_NAMESPACE, name, attributes, propertyValues);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:72,代码来源:CMISConnector.java


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