當前位置: 首頁>>代碼示例>>Java>>正文


Java CMISNodeInfo.getType方法代碼示例

本文整理匯總了Java中org.alfresco.opencmis.dictionary.CMISNodeInfo.getType方法的典型用法代碼示例。如果您正苦於以下問題:Java CMISNodeInfo.getType方法的具體用法?Java CMISNodeInfo.getType怎麽用?Java CMISNodeInfo.getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.alfresco.opencmis.dictionary.CMISNodeInfo的用法示例。


在下文中一共展示了CMISNodeInfo.getType方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getValueInternal

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
{
    NodeRef nodeRef = nodeInfo.getNodeRef();

    if(nodeRef == null || nodeInfo.getType() == null)
    {
    	// If the nodeRef or type is null, we can't handle it so return an empty list	
    	return (Serializable) Collections.emptyList();
    }

    Set<QName> aspects = nodeInfo.getNodeAspects();
    ArrayList<String> results = new ArrayList<String>(aspects.size());
    for (QName aspect : aspects)
    {
    	String typeId = cmisMapping.getCmisTypeId(aspect);
    	if (typeId != null)
    	{
    		results.add(typeId);
    	}
    }
    return results;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:24,代碼來源:SecondaryTypesProperty.java

示例2: checkChildObjectType

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的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!");
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:23,代碼來源:CMISConnector.java

示例3: applyPolicy

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的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));
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:17,代碼來源:AlfrescoCmisServiceImpl.java

示例4: removePolicy

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的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!");
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:17,代碼來源:AlfrescoCmisServiceImpl.java

示例5: applyAcl

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的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);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:25,代碼來源:AlfrescoCmisServiceImpl.java

示例6: checkChildObjectType

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的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!");
    }
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:23,代碼來源:CMISConnector.java

示例7: getValueInternal

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
{
    if(nodeInfo.getType() == null)
    {
        return (Serializable) Collections.emptyList();
    }
    
    return nodeInfo.getType().getTypeId();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:10,代碼來源:ObjectTypeIdProperty.java

示例8: getValueInternal

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
{
    if(nodeInfo.getType() == null)
    {
    	//If the type is null, we can't handle it so return an empty list	
    	return (Serializable) Collections.emptyList();
    }

    TypeDefinition type = getServiceRegistry().getDictionaryService()
            .getType(nodeInfo.getType().getAlfrescoClass());
    if ((type != null) && (type.getChildAssociations() != null) && (!type.getChildAssociations().isEmpty()))
    {
        ArrayList<String> result = new ArrayList<String>();

        for (ChildAssociationDefinition cad : type.getChildAssociations().values())
        {
            String typeId = cmisMapping.getCmisTypeId(cad.getTargetClass().getName());
            if (typeId != null)
            {
                result.add(typeId);
            }
        }

        return result;
    }

    return (Serializable) Collections.emptyList();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:30,代碼來源:AllowedChildObjectTypeIdsProperty.java

示例9: getValueInternal

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
{
    if (nodeInfo.getType() == null)
    {
        // Invalid node
        return null;
    }
    
    if (nodeInfo.getNodeRef() != null)
    {
        Serializable result = nodeInfo.getNodeProps().get(alfrescoName);

        /* MNT-10548 fix */
        if (result instanceof List)
        {
            @SuppressWarnings("unchecked")
            List<Object> resultList = (List<Object>)result;
            for (int index = 0; index < resultList.size(); index++)
            {
                Object element = resultList.get(index);
                if (element instanceof NodeRef)
                {
                	NodeRef nodeRef = (NodeRef)element;
                    resultList.set(index, nodeRef.getId());
                }
            }
        }
        
        return result;
    }
    else if (nodeInfo.getAssociationRef() != null)
    {
        return getServiceRegistry().getNodeService().getProperty(
                nodeInfo.getAssociationRef().getSourceRef(),
                alfrescoName);
    }

    return null;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:40,代碼來源:DirectProperty.java

示例10: createCMISObject

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
/**
 * Creates the CMIS object for a node.
 */
public ObjectData createCMISObject(CMISNodeInfo info, String filter, boolean includeAllowableActions,
        IncludeRelationships includeRelationships, String renditionFilter, boolean includePolicyIds,
        boolean includeAcl)
{
    if (info.getType() == null)
    {
        throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?");
    }

    Properties nodeProps = (info.isRelationship() ? getAssocProperties(info, filter) : getNodeProperties(info, filter));

    return createCMISObjectImpl(info, nodeProps, filter, includeAllowableActions, includeRelationships,
            renditionFilter, includePolicyIds, includeAcl);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:CMISConnector.java

示例11: createDocumentFromSource

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public String createDocumentFromSource(
        String repositoryId, String sourceId, final Properties properties,
        String folderId, VersioningState versioningState, final List<String> policies, final Acl addAces,
        final Acl removeAces, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // get the parent folder node ref
    final CMISNodeInfo parentInfo = getOrCreateFolderInfo(folderId, "Parent folder");

    // get source
    CMISNodeInfo info = getOrCreateNodeInfo(sourceId, "Source");

    // check source
    if (info.isVariant(CMISObjectVariant.ASSOC))
    {
        throw new CmisConstraintException("Source object is not a document!");
    }

    final NodeRef sourceNodeRef = info.getNodeRef();
    if (!info.isDocument())
    {
        throw new CmisConstraintException("Source object is not a document!");
    }
    
    // get name and type
    final String name = connector.getNameProperty(properties, info.getName());

    final TypeDefinitionWrapper type = info.getType();
    connector.checkChildObjectType(parentInfo, type.getTypeId());
    
    versioningState = getDocumentDefaultVersioningState(versioningState, type);

    try
    {
        FileInfo fileInfo = connector.getFileFolderService().copy(
                sourceNodeRef, parentInfo.getNodeRef(), name);
        NodeRef nodeRef = fileInfo.getNodeRef();
        connector.setProperties(nodeRef, type, properties, new String[] {
                PropertyIds.NAME, PropertyIds.OBJECT_TYPE_ID });
        connector.applyPolicies(nodeRef, type, policies);
        connector.applyACL(nodeRef, type, addAces, removeAces);
        
        connector.extractMetadata(nodeRef);
        connector.createThumbnails(nodeRef, Collections.singleton("doclib"));

        connector.applyVersioningState(nodeRef, versioningState);
        
        connector.getActivityPoster().postFileFolderAdded(nodeRef);
        
        return connector.createObjectId(nodeRef);
    }
    catch (FileNotFoundException e)
    {
        throw new CmisContentAlreadyExistsException("An object with this name already exists!", e);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:59,代碼來源:AlfrescoCmisServiceImpl.java

示例12: checkIn

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public void checkIn(
        String repositoryId, final Holder<String> objectId, final Boolean major,
        final Properties properties, final ContentStream contentStream, final String checkinComment,
        final List<String> policies, final Acl addAces, final Acl removeAces, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");

    // only accept a PWC
    if (!info.isVariant(CMISObjectVariant.PWC))
    {
        throw new CmisVersioningException("Object is not a PWC!");
    }

    // get object
    final NodeRef nodeRef = info.getNodeRef();
    final TypeDefinitionWrapper type = info.getType();

    // copy stream to temp file
    final File tempFile = copyToTempFile(contentStream);

    // check in
    // update PWC
    connector.setProperties(nodeRef, type, properties,
            new String[] { PropertyIds.OBJECT_TYPE_ID });
    connector.applyPolicies(nodeRef, type, policies);
    connector.applyACL(nodeRef, type, addAces, removeAces);

    // handle content
    if (contentStream != null)
    {
        String mimeType = parseMimeType(contentStream);
        String encoding =  getEncoding(tempFile, mimeType);
        // write content
        ContentWriter writer = connector.getFileFolderService().getWriter(nodeRef);
        writer.setMimetype(mimeType);
        writer.setEncoding(encoding);
        writer.putContent(tempFile);
    }

    // create version properties
    Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(5);
    versionProperties.put(VersionModel.PROP_VERSION_TYPE, major ? VersionType.MAJOR
            : VersionType.MINOR);
    if (checkinComment != null)
    {
        versionProperties.put(VersionModel.PROP_DESCRIPTION, checkinComment);
    }

    // check in
    NodeRef newNodeRef = connector.getCheckOutCheckInService().checkin(nodeRef, versionProperties);

    connector.getActivityPoster().postFileFolderUpdated(info.isFolder(), newNodeRef);

    objectId.setValue(connector.createObjectId(newNodeRef));
    
    removeTempFile(tempFile);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:61,代碼來源:AlfrescoCmisServiceImpl.java

示例13: createDocumentFromSource

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public String createDocumentFromSource(
        String repositoryId, String sourceId, final Properties properties,
        String folderId, final VersioningState versioningState, final List<String> policies, final Acl addAces,
        final Acl removeAces, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // get the parent folder node ref
    final CMISNodeInfo parentInfo = getOrCreateFolderInfo(folderId, "Parent folder");

    // get source
    CMISNodeInfo info = getOrCreateNodeInfo(sourceId, "Source");

    // check source
    if (info.isVariant(CMISObjectVariant.ASSOC))
    {
        throw new CmisConstraintException("Source object is not a document!");
    }

    final NodeRef sourceNodeRef = info.getNodeRef();
    if (!info.isDocument())
    {
        throw new CmisConstraintException("Source object is not a document!");
    }

    // get name and type
    final String name = connector.getNameProperty(properties, info.getName());

    final TypeDefinitionWrapper type = info.getType();
    connector.checkChildObjectType(parentInfo, type.getTypeId());

    try
    {
        FileInfo fileInfo = connector.getFileFolderService().copy(
                sourceNodeRef, parentInfo.getNodeRef(), name);
        NodeRef nodeRef = fileInfo.getNodeRef();
        connector.setProperties(nodeRef, type, properties, new String[] {
                PropertyIds.NAME, PropertyIds.OBJECT_TYPE_ID });
        connector.applyPolicies(nodeRef, type, policies);
        connector.applyACL(nodeRef, type, addAces, removeAces);
        
        connector.extractMetadata(nodeRef);
        connector.createThumbnails(nodeRef, Collections.singleton("doclib"));

        connector.applyVersioningState(nodeRef, versioningState);
        
        connector.getActivityPoster().postFileFolderAdded(nodeRef);
        
        return connector.createObjectId(nodeRef);
    }
    catch (FileNotFoundException e)
    {
        throw new CmisContentAlreadyExistsException("An object with this name already exists!", e);
    }
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:57,代碼來源:AlfrescoCmisServiceImpl.java

示例14: checkIn

import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public void checkIn(
        String repositoryId, final Holder<String> objectId, final Boolean major,
        final Properties properties, final ContentStream contentStream, final String checkinComment,
        final List<String> policies, final Acl addAces, final Acl removeAces, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");

    // only accept a PWC
    if (!info.isVariant(CMISObjectVariant.PWC))
    {
        throw new CmisVersioningException("Object is not a PWC!");
    }

    // get object
    final NodeRef nodeRef = info.getNodeRef();
    final TypeDefinitionWrapper type = info.getType();

    // copy stream to temp file
    final File tempFile = copyToTempFile(contentStream);
    final Charset encoding = (tempFile == null ? null : getEncoding(tempFile, contentStream.getMimeType()));

    // check in
    // update PWC
    connector.setProperties(nodeRef, type, properties,
            new String[] { PropertyIds.OBJECT_TYPE_ID });
    connector.applyPolicies(nodeRef, type, policies);
    connector.applyACL(nodeRef, type, addAces, removeAces);

    // handle content
    if (contentStream != null)
    {
        // write content
        ContentWriter writer = connector.getFileFolderService().getWriter(nodeRef);
        writer.setMimetype(parseMimeType(contentStream));
        writer.setEncoding(encoding.name());
        writer.putContent(tempFile);
    }

    // create version properties
    Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(5);
    versionProperties.put(VersionModel.PROP_VERSION_TYPE, major ? VersionType.MAJOR
            : VersionType.MINOR);
    if (checkinComment != null)
    {
        versionProperties.put(VersionModel.PROP_DESCRIPTION, checkinComment);
    }

    // check in
    NodeRef newNodeRef = connector.getCheckOutCheckInService().checkin(nodeRef, versionProperties);

    connector.getActivityPoster().postFileFolderUpdated(info.isFolder(), newNodeRef);

    objectId.setValue(connector.createObjectId(newNodeRef));
    
    removeTempFile(tempFile);
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:60,代碼來源:AlfrescoCmisServiceImpl.java


注:本文中的org.alfresco.opencmis.dictionary.CMISNodeInfo.getType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。