本文整理匯總了Java中org.alfresco.opencmis.dictionary.CMISNodeInfo.getNodeRef方法的典型用法代碼示例。如果您正苦於以下問題:Java CMISNodeInfo.getNodeRef方法的具體用法?Java CMISNodeInfo.getNodeRef怎麽用?Java CMISNodeInfo.getNodeRef使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.alfresco.opencmis.dictionary.CMISNodeInfo
的用法示例。
在下文中一共展示了CMISNodeInfo.getNodeRef方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例2: getValueInternal
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
{
if (nodeInfo.getNodeRef() != null)
{
if (nodeInfo.isCurrentVersion())
{
return nodeInfo.getCurrentNodeNodeRef().toString();
} else
{
return nodeInfo.getNodeRef().toString();
}
} else if (nodeInfo.getAssociationRef() != null)
{
return nodeInfo.getAssociationRef().toString();
}
return null;
}
示例3: getValueInternal
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
{
if (nodeInfo.getNodeRef() != null)
{
return nodeInfo.getNodeProps().get(ContentModel.PROP_DESCRIPTION);
}
else if (nodeInfo.getAssociationRef() != null)
{
return getServiceRegistry().getNodeService().getProperty(
nodeInfo.getAssociationRef().getSourceRef(),
ContentModel.PROP_DESCRIPTION);
}
return null;
}
示例4: update
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
public void update()
{
String objectId = objectIdAndChangeToken.getId();
final CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");
if (!info.isVariant(CMISObjectVariant.ASSOC) && !info.isVariant(CMISObjectVariant.VERSION))
{
final NodeRef nodeRef = info.getNodeRef();
connector.setProperties(nodeRef, info.getType(), properties, new String[0]);
if (isObjectInfoRequired)
{
getObjectInfo(repositoryId, objectId, "*", IncludeRelationships.NONE);
}
connector.addSecondaryTypes(nodeRef, addSecondaryTypeIds);
connector.removeSecondaryTypes(nodeRef, removeSecondaryTypeIds);
if (properties.getProperties().size() > 0 || addSecondaryTypeIds.size() > 0 || removeSecondaryTypeIds.size() > 0)
{
bulkUpdateContext.success(info);
}
}
}
示例5: getValueInternal
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
{
NodeRef nodeRef = nodeInfo.getNodeRef();
if (nodeInfo.isVersion() || (nodeInfo.hasPWC() && !nodeInfo.isPWC()) || (lockService.getLockType(nodeRef) == LockType.READ_ONLY_LOCK))
{
return true;
}
return false;
}
示例6: 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;
}
示例7: isAllowed
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
/**
* Node must be versionable, must not have a Private Working Copy and must not be locked.
*/
public boolean isAllowed(CMISNodeInfo nodeInfo)
{
NodeRef nodeRef = nodeInfo.getNodeRef();
if (nodeInfo.hasPWC() || lockService.getLockType(nodeRef) == LockType.READ_ONLY_LOCK)
{
return false;
}
return permissionEvaluator.isAllowed(nodeInfo);
}
示例8: updateProperties
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public void updateProperties(
String repositoryId, Holder<String> objectId, Holder<String> changeToken,
final Properties properties, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
final CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");
if (info.isVariant(CMISObjectVariant.ASSOC))
{
throw new CmisInvalidArgumentException("Relationship properties cannot be updated!");
}
else
{
if (info.isVariant(CMISObjectVariant.VERSION))
{
throw new CmisInvalidArgumentException("Document is not the latest version!");
}
final NodeRef nodeRef = info.getNodeRef();
connector.setProperties(nodeRef, info.getType(), properties, new String[0]);
objectId.setValue(connector.createObjectId(nodeRef));
boolean isObjectInfoRequired = getContext().isObjectInfoRequired();
if (isObjectInfoRequired)
{
getObjectInfo(repositoryId, objectId.getValue(), "*", IncludeRelationships.NONE);
}
connector.getActivityPoster().postFileFolderUpdated(info.isFolder(), nodeRef);
}
}
示例9: checkOut
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public void checkOut(
String repositoryId, final Holder<String> objectId, ExtensionsData extension,
final Holder<Boolean> contentCopied)
{
checkRepositoryId(repositoryId);
CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");
// Check for current version
if (info.isVariant(CMISObjectVariant.CURRENT_VERSION))
{
// Good
}
else if (info.isVariant(CMISObjectVariant.VERSION))
{
throw new CmisInvalidArgumentException("Can't check out an old version of a document");
}
else {
throw new CmisInvalidArgumentException("Only documents can be checked out! Object was a " + info.getObjectVariant().toString());
}
// get object
final NodeRef nodeRef = info.getNodeRef();
if (!((DocumentTypeDefinition) info.getType().getTypeDefinition(false)).isVersionable())
{
throw new CmisConstraintException("Document is not versionable!");
}
// check out
NodeRef pwcNodeRef = connector.getCheckOutCheckInService().checkout(nodeRef);
CMISNodeInfo pwcNodeInfo = createNodeInfo(pwcNodeRef);
objectId.setValue(pwcNodeInfo.getObjectId());
if (contentCopied != null)
{
contentCopied.setValue(connector.getFileFolderService().getReader(pwcNodeRef) != null);
}
}
示例10: addObjectToFolder
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public void addObjectToFolder(
String repositoryId, String objectId, String folderId, Boolean allVersions,
ExtensionsData extension)
{
checkRepositoryId(repositoryId);
if (!allVersions)
{
throw new CmisInvalidArgumentException("Only allVersions=true supported!");
}
// get node ref
CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");
if (!info.isDocument())
{
throw new CmisInvalidArgumentException("Object is not a document!");
}
final NodeRef nodeRef = info.getNodeRef();
// get the folder node ref
final CMISNodeInfo folderInfo = getOrCreateFolderInfo(folderId, "Folder");
connector.checkChildObjectType(folderInfo, info.getType().getTypeId());
final QName name = QName.createQName(
NamespaceService.CONTENT_MODEL_1_0_URI,
QName.createValidLocalName((String) connector.getNodeService().getProperty(nodeRef,
ContentModel.PROP_NAME)));
connector.getNodeService().addChild(
folderInfo.getNodeRef(), nodeRef, ContentModel.ASSOC_CONTAINS, name);
}
示例11: removeObjectFromFolder
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
// get node ref
CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");
if (!info.isDocument())
{
throw new CmisInvalidArgumentException("Object is not a document!");
}
final NodeRef nodeRef = info.getNodeRef();
// get the folder node ref
final NodeRef folderNodeRef = getOrCreateFolderInfo(folderId, "Folder").getNodeRef();
// check primary parent
if (connector.getNodeService().getPrimaryParent(nodeRef).getParentRef().equals(folderNodeRef))
{
throw new CmisConstraintException(
"Unfiling from primary parent folder is not supported! Use deleteObject() instead.");
}
connector.getNodeService().removeChild(folderNodeRef, nodeRef);
}
示例12: appendContentStream
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
ContentStream contentStream, boolean isLastChunk, ExtensionsData extension)
{
if ((contentStream == null) || (contentStream.getStream() == null))
{
throw new CmisInvalidArgumentException("No content!");
}
checkRepositoryId(repositoryId);
CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");
NodeRef nodeRef = info.getNodeRef();
if (((DocumentTypeDefinition) info.getType().getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED)
{
throw new CmisStreamNotSupportedException("Document type doesn't allow content!");
}
try
{
connector.appendContent(info, contentStream, isLastChunk);
objectId.setValue(connector.createObjectId(nodeRef));
}
catch(IOException e)
{
throw new ContentIOException("", e);
}
}
示例13: deleteContentStream
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public void deleteContentStream(
String repositoryId, Holder<String> objectId, Holder<String> changeToken,
ExtensionsData extension)
{
checkRepositoryId(repositoryId);
CMISNodeInfo info = getOrCreateNodeInfo(objectId.getValue(), "Object");
if (!info.isVariant(CMISObjectVariant.CURRENT_VERSION) && !info.isVariant(CMISObjectVariant.PWC))
{
throw new CmisStreamNotSupportedException("Content can only be deleted from ondocuments!");
}
final NodeRef nodeRef = info.getNodeRef();
if (((DocumentTypeDefinition) info.getType().getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.REQUIRED)
{
throw new CmisInvalidArgumentException("Document type requires content!");
}
connector.getNodeService().setProperty(nodeRef, ContentModel.PROP_CONTENT, null);
// connector.createVersion(nodeRef, VersionType.MINOR, "Delete content");
connector.getActivityPoster().postFileFolderUpdated(info.isFolder(), nodeRef);
objectId.setValue(connector.createObjectId(nodeRef));
}
示例14: 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);
}
}
示例15: createRelationship
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public String createRelationship(
String repositoryId, Properties properties, List<String> policies, Acl addAces,
Acl removeAces, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
// get type
String objectTypeId = connector.getObjectTypeIdProperty(properties);
final TypeDefinitionWrapper type = connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_RELATIONSHIP);
// get source object
String sourceId = connector.getSourceIdProperty(properties);
CMISNodeInfo sourceInfo = getOrCreateNodeInfo(sourceId, "Source");
if (!sourceInfo.isVariant(CMISObjectVariant.CURRENT_VERSION) && !sourceInfo.isVariant(CMISObjectVariant.FOLDER) && !sourceInfo.isVariant(CMISObjectVariant.ITEM))
{
throw new CmisInvalidArgumentException("Source is not the latest version of a document, a folder or an item object!");
}
final NodeRef sourceNodeRef = sourceInfo.getNodeRef();
// get target object
String targetId = connector.getTargetIdProperty(properties);
CMISNodeInfo targetInfo = getOrCreateNodeInfo(targetId, "Target");
if (!targetInfo.isVariant(CMISObjectVariant.CURRENT_VERSION) && !targetInfo.isVariant(CMISObjectVariant.FOLDER) && !targetInfo.isVariant(CMISObjectVariant.ITEM))
{
throw new CmisInvalidArgumentException(
"Target is not the latest version of a document, a folder or an item object!!");
}
final NodeRef targetNodeRef = targetInfo.getNodeRef();
// check policies and ACLs
if ((policies != null) && (!policies.isEmpty()))
{
throw new CmisConstraintException("Relationships are not policy controllable!");
}
if ((addAces != null) && (addAces.getAces() != null) && (!addAces.getAces().isEmpty()))
{
throw new CmisConstraintException("Relationships are not ACL controllable!");
}
if ((removeAces != null) && (removeAces.getAces() != null) && (!removeAces.getAces().isEmpty()))
{
throw new CmisConstraintException("Relationships are not ACL controllable!");
}
// create relationship
// ALF-10085 : disable auditing behaviour for this use case
boolean wasEnabled = connector.disableBehaviour(ContentModel.ASPECT_AUDITABLE, sourceNodeRef); // Lasts for txn
try
{
AssociationRef assocRef = connector.getNodeService().createAssociation(
sourceNodeRef, targetNodeRef, type.getAlfrescoClass());
return CMISConnector.ASSOC_ID_PREFIX + assocRef.getId();
}
finally
{
if(wasEnabled)
{
connector.enableBehaviour(ContentModel.ASPECT_AUDITABLE, sourceNodeRef);
}
}
}