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


Java CmisExtensionElement类代码示例

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


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

示例1: getTypeAspectIds

import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement; //导入依赖的package包/类
private static List<String> getTypeAspectIds(Session pSession, String pStrTypeId) {
	
	List<String> lFoundAspectIds = new ArrayList<String>();
	
	ObjectType lObjectType = getTypeDefinition(pSession, pStrTypeId);
	
	// cerco gli eventuali mandatoryAspect del tipo
	List<CmisExtensionElement> lExtensions = lObjectType.getExtensions();
	for (CmisExtensionElement lExtension : lExtensions) {
		if (lExtension.getName().matches("(?i:.*aspect.*)")) {
			for (CmisExtensionElement lAspectExtension : lExtension.getChildren()) {
				lFoundAspectIds.add(lAspectExtension.getValue());
			}
		}
	}
	
	return lFoundAspectIds;
}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:19,代码来源:AlfrescoHelper.java

示例2: afterLogin

import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement; //导入依赖的package包/类
@Override
public void afterLogin(Session session) {
	homeFolderId = null;

	List<CmisExtensionElement> extensions = session.getRepositoryInfo().getExtensions();
	if (extensions != null) {
		for (CmisExtensionElement ext : extensions) {
			if ("myDocuments".equals(ext.getName()) || "sharing".equals(ext.getName())
					|| "favorites".equals(ext.getName()) || "recycleBinHome".equals(ext.getName())) {
				if (ext.getValue() != null && ext.getValue().length() > 0) {
					homeFolderId = ext.getValue();
					break;
				}
			}
		}
	}
}
 
开发者ID:SAP,项目名称:cloud-cmis-workbench,代码行数:18,代码来源:DocumentCenterLoginTab.java

示例3: testGetRepositoryInfos

import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement; //导入依赖的package包/类
/**
 * ALF-20389 Test Alfresco cmis stream interceptor that checks content stream for mimetype. Only ContentStreamImpl extensions should take palace.
 */
@Test
public void testGetRepositoryInfos()
{
    boolean cmisEx = false;
    List<RepositoryInfo> infoDataList = null;
    try
    {
        infoDataList = withCmisService(new CmisServiceCallback<List<RepositoryInfo>>()
        {
            @Override
            public List<RepositoryInfo> execute(CmisService cmisService)
            {
                ExtensionDataImpl result = new ExtensionDataImpl();
                List<CmisExtensionElement> extensions = new ArrayList<CmisExtensionElement>();
                result.setExtensions(extensions);

                return cmisService.getRepositoryInfos(result);
            }
        });
    }
    catch (CmisRuntimeException e)
    {
        cmisEx = true;
    }

    assertNotNull(cmisEx ? "CmisRuntimeException was thrown. Please, take a look on ALF-20389" : "No CMIS repository information was retrieved", infoDataList);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:CMISTest.java

示例4: addTypeExtensions

import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement; //导入依赖的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

示例5: getProperties

import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement; //导入依赖的package包/类
private Properties getProperties(NodeRef nodeRef)
  {
CMISNodeInfoImpl nodeInfo = cmisConnector.createNodeInfo(nodeRef);
final Properties properties = cmisConnector.getNodeProperties(nodeInfo, null);
// fake the title property, which CMIS doesn't give us
String title = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE);
final PropertyStringImpl titleProp = new PropertyStringImpl(ContentModel.PROP_TITLE.toString(), title);
Properties wrapProperties = new Properties()
{
	@Override
	public List<CmisExtensionElement> getExtensions()
	{
		return properties.getExtensions();
	}

	@Override
	public void setExtensions(List<CmisExtensionElement> extensions)
	{
		properties.setExtensions(extensions);
	}

	@Override
	public Map<String, PropertyData<?>> getProperties()
	{
		Map<String, PropertyData<?>> updatedProperties = new HashMap<String, PropertyData<?>>(properties.getProperties());
		updatedProperties.put(titleProp.getId(), titleProp);
		return updatedProperties;
	}

	@Override
	public List<PropertyData<?>> getPropertyList()
	{
		List<PropertyData<?>> propertyList = new ArrayList<PropertyData<?>>(properties.getPropertyList());
		propertyList.add(titleProp);
		return propertyList;
	}
};
return wrapProperties;
  }
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:40,代码来源:RepoService.java

示例6: serialize

import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement; //导入依赖的package包/类
@Override
public void serialize(ObjectType value, JsonGenerator gen, SerializerProvider serializers)
        throws IOException, JsonProcessingException {

	gen.writeStartObject();

	gen.writeStringField("id", value.getId());
	gen.writeStringField("name", value.getDisplayName());
	gen.writeStringField("description", value.getDescription());
	
	gen.writeBooleanField("isSecondary",
		(value.getBaseTypeId() == null)? false : BaseTypeId.CMIS_SECONDARY.value().equals(value.getBaseTypeId().value()));
	
	if (value instanceof RelationshipType) {
		gen.writeFieldName("allowedSourceTypes");
		gen.writeObject(((RelationshipType) value).getAllowedSourceTypes());
		
		gen.writeFieldName("allowedTargetTypes");
		gen.writeObject(((RelationshipType) value).getAllowedTargetTypes());
	}
	
	// Proprietà
	gen.writeFieldName("properties");
	gen.writeObject(value.getPropertyDefinitions());
	
	// Aspetti
	gen.writeArrayFieldStart("aspects");
	if (value.getExtensions() != null) {
		for (CmisExtensionElement lExtension : value.getExtensions()) {
			if (lExtension.getName().matches("(?i:.*aspect.*)")) {
				for (CmisExtensionElement lAspectExtension : lExtension.getChildren()) {
					gen.writeString(lAspectExtension.getValue());
				}
			}
		}
	}
	gen.writeEndArray();

	gen.writeEndObject();
}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:41,代码来源:ObjectTypeSerializer.java

示例7: getAspectExtensions

import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement; //导入依赖的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

示例8: createAspectPropertyExtension

import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement; //导入依赖的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

示例9: createAspectPropertyExtension

import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement; //导入依赖的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.data.CmisExtensionElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。