當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。