本文整理汇总了Java中org.alfresco.opencmis.dictionary.TypeDefinitionWrapper类的典型用法代码示例。如果您正苦于以下问题:Java TypeDefinitionWrapper类的具体用法?Java TypeDefinitionWrapper怎么用?Java TypeDefinitionWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeDefinitionWrapper类属于org.alfresco.opencmis.dictionary包,在下文中一共展示了TypeDefinitionWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBasicDefaultMetaData
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
public void testBasicDefaultMetaData()
{
CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM cmis:document", rootNodeRef.getStoreRef());
CMISResultSet rs = cmisQueryService.query(options);
CMISResultSetMetaData md = rs.getMetaData();
assertNotNull(md.getQueryOptions());
TypeDefinitionWrapper typeDef = cmisDictionaryService.findType(BaseTypeId.CMIS_DOCUMENT.value());
int count = 0;
for (PropertyDefinitionWrapper pdef : typeDef.getProperties())
{
count++;
}
assertEquals(count, md.getColumnNames().length);
assertNotNull(md.getColumn(PropertyIds.OBJECT_ID));
assertEquals(1, md.getSelectors().length);
assertNotNull(md.getSelector(""));
rs.close();
}
示例2: isSupported
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
/**
* @return Returns <tt>true</tt> if items in the CMIS domain model
* @see org.alfresco.repo.audit.extractor.DataExtractor#isSupported(java.io.Serializable)
*/
public boolean isSupported(Serializable data)
{
if (data != null)
{
NodeRef nodeRef = getNodeRef(data);
if (nodeRef != null)
{
QName typeQName = nodeService.getType(nodeRef);
TypeDefinitionWrapper type = cmisDictionaryService.findNodeType(typeQName);
return (type != null)
&& (type.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT || type.getBaseTypeId() == BaseTypeId.CMIS_FOLDER);
}
}
return false;
}
示例3: createObjectId
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
public String createObjectId(NodeRef nodeRef, boolean dropStoreRef)
{
QName typeQName = nodeService.getType(nodeRef);
TypeDefinitionWrapper type = getOpenCMISDictionaryService().findNodeType(typeQName);
if(type instanceof ItemTypeDefinitionWrapper)
{
return constructObjectId(nodeRef, null);
}
if(type instanceof FolderTypeDefintionWrapper)
{
return constructObjectId(nodeRef, null, dropStoreRef);
}
Serializable versionLabel = getNodeService()
.getProperty(nodeRef, ContentModel.PROP_VERSION_LABEL);
if (versionLabel == null)
{
versionLabel = CMISConnector.UNVERSIONED_VERSION_LABEL;
}
return constructObjectId(nodeRef, (String)versionLabel, dropStoreRef);
}
示例4: 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!");
}
}
示例5: getTypesDescendants
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
/**
* Gathers the type descendants tree.
*/
private TypeDefinitionContainer getTypesDescendants(
int depth, TypeDefinitionWrapper tdw, boolean includePropertyDefinitions)
{
TypeDefinitionContainerImpl result = new TypeDefinitionContainerImpl();
result.setTypeDefinition(tdw.getTypeDefinition(includePropertyDefinitions));
if (depth != 0)
{
String typeId = tdw.getTypeId();
List<TypeDefinitionWrapper> children = connector.getOpenCMISDictionaryService().getChildren(typeId);
if (children != null)
{
result.setChildren(new ArrayList<TypeDefinitionContainer>());
for (TypeDefinitionWrapper tdc : children)
{
result.getChildren().add(
getTypesDescendants(depth < 0 ? -1 : depth - 1, tdc, includePropertyDefinitions));
}
}
}
return result;
}
示例6: applyPolicy
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
@Override
public void applyPolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
// what kind of object is it?
CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");
TypeDefinitionWrapper type = info.getType();
if (type == null)
{
throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?");
}
connector.applyPolicies(info.getNodeRef(), type, Collections.singletonList(policyId));
}
示例7: removePolicy
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
@Override
public void removePolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
// what kind of object is it?
CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");
TypeDefinitionWrapper type = info.getType();
if (type == null)
{
throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?");
}
throw new CmisConstraintException("Object is not policy controllable!");
}
示例8: applyAcl
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
@Override
public Acl applyAcl(
String repositoryId, String objectId, final Acl addAces, final Acl removeAces,
AclPropagation aclPropagation, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
// We are spec compliant if we just let it through and the tck will not fail
CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");
// relationships don't have ACLs
if (info.isVariant(CMISObjectVariant.ASSOC))
{
throw new CmisConstraintException("Relationships are not ACL controllable!");
}
final NodeRef nodeRef = info.getCurrentNodeNodeRef();
final TypeDefinitionWrapper type = info.getType();
connector.applyACL(nodeRef, type, addAces, removeAces);
return connector.getACL(nodeRef, false);
}
示例9: getType
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
private String getType(String tableName)
{
TypeDefinitionWrapper typeDef = dictionaryService.findTypeByQueryName(tableName);
if (typeDef == null)
{
throw new CmisInvalidArgumentException("Unknown type: " + tableName);
}
if(!typeDef.isBaseType())
{
throw new CmisInvalidArgumentException("Not a base type: " + tableName);
}
if(!typeDef.getTypeDefinition(false).isQueryable())
{
throw new CmisInvalidArgumentException("Type is not queryable: " + tableName);
}
return typeDef.getAlfrescoClass().toString();
}
示例10: createObjectId
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
public String createObjectId(NodeRef nodeRef, boolean dropStoreRef)
{
QName typeQName = nodeService.getType(nodeRef);
TypeDefinitionWrapper type = getOpenCMISDictionaryService().findNodeType(typeQName);
if(type instanceof ItemTypeDefinitionWrapper)
{
return constructObjectId(nodeRef, null);
}
if(type instanceof FolderTypeDefintionWrapper)
{
return constructObjectId(nodeRef, null, dropStoreRef);
}
Serializable versionLabel = getNodeService()
.getProperty(nodeRef, ContentModel.PROP_VERSION_LABEL);
if (versionLabel == null)
{
versionLabel = CMISConnector.UNVERSIONED_VERSION_LABEL;
}
return constructObjectId(nodeRef, (String)versionLabel, dropStoreRef);
}
示例11: 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!");
}
}
示例12: getType
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
public TypeDefinitionWrapper getType()
{
if (type == null)
{
determineType(null);
}
return type;
}
示例13: getType
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
/**
* Returns the type definition of a node or <code>null</code> if no type
* definition could be found.
*/
public TypeDefinitionWrapper getType(NodeRef nodeRef)
{
try
{
QName typeQName = nodeService.getType(nodeRef);
return getOpenCMISDictionaryService().findNodeType(typeQName);
}
catch(InvalidNodeRefException inre)
{
return null;
}
}
示例14: getTypeForCreate
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
/**
* Returns the definition after it has checked if the type can be used for
* object creation.
*/
public TypeDefinitionWrapper getTypeForCreate(String cmisTypeId, BaseTypeId baseTypeId)
{
TypeDefinitionWrapper type = getType(cmisTypeId);
if ((type == null) || (type.getBaseTypeId() != baseTypeId))
{
switch (baseTypeId)
{
case CMIS_DOCUMENT:
throw new CmisConstraintException("Type is not a document type!");
case CMIS_FOLDER:
throw new CmisConstraintException("Type is not a folder type!");
case CMIS_RELATIONSHIP:
throw new CmisConstraintException("Type is not a relationship type!");
case CMIS_POLICY:
throw new CmisConstraintException("Type is not a policy type!");
case CMIS_ITEM:
throw new CmisConstraintException("Type is not an item type!");
}
}
if (!type.getTypeDefinition(false).isCreatable())
{
throw new CmisConstraintException("Type is not creatable!");
}
return type;
}
示例15: checkDocumentTypeForContent
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper; //导入依赖的package包/类
private void checkDocumentTypeForContent(TypeDefinitionWrapper type)
{
if (type == null)
{
throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?");
}
if (!(type instanceof DocumentTypeDefinitionWrapper))
{
throw new CmisStreamNotSupportedException("Object is not a document!");
}
if (((DocumentTypeDefinition) type.getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED)
{
throw new CmisConstraintException("Document cannot have content!");
}
}