本文整理汇总了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)));
}
}
}
}
示例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;
}
示例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);
}
示例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);
}