本文整理匯總了Java中org.alfresco.opencmis.dictionary.CMISNodeInfo.isVariant方法的典型用法代碼示例。如果您正苦於以下問題:Java CMISNodeInfo.isVariant方法的具體用法?Java CMISNodeInfo.isVariant怎麽用?Java CMISNodeInfo.isVariant使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.alfresco.opencmis.dictionary.CMISNodeInfo
的用法示例。
在下文中一共展示了CMISNodeInfo.isVariant方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRenditions
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
BigInteger maxItems, BigInteger skipCount, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
// what kind of object is it?
CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");
if (info.isVariant(CMISObjectVariant.ASSOC))
{
return Collections.emptyList();
}
else
{
return connector.getRenditions(info.getNodeRef(), renditionFilter, maxItems, skipCount);
}
}
示例2: 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);
}
}
}
示例3: getProperties
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
// what kind of object is it?
CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");
boolean isObjectInfoRequired = getContext().isObjectInfoRequired();
if (isObjectInfoRequired)
{
getObjectInfo(repositoryId, info.getObjectId(), IncludeRelationships.NONE);
}
if (info.isVariant(CMISObjectVariant.ASSOC))
{
return connector.getAssocProperties(info, filter);
}
else
{
return connector.getNodeProperties(info, filter);
}
}
示例4: getContentStream
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public ContentStream getContentStream(
String repositoryId, String objectId, String streamId, BigInteger offset,
BigInteger length, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
// what kind of object is it?
CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");
// relationships cannot have content
if (info.isVariant(CMISObjectVariant.ASSOC))
{
throw new CmisInvalidArgumentException("Object is a relationship and cannot have content!");
}
// now get it
return connector.getContentStream(info, streamId, offset, length);
}
示例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);
}
示例6: getAcl
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");
// relationships don't have ACLs
if (info.isVariant(CMISObjectVariant.ASSOC))
{
return new AccessControlListImpl(Collections.EMPTY_LIST);
}
// get the ACL
return connector.getACL(info.getCurrentNodeNodeRef(), onlyBasicPermissions);
}
示例7: 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);
}
}
示例8: 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);
}
}
示例9: getPropertiesOfLatestVersion
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public Properties getPropertiesOfLatestVersion(
String repositoryId, String objectId, String versionSeriesId,
Boolean major, String filter, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
if (objectId != null)
{
// it's an AtomPub call
versionSeriesId = connector.getCurrentVersionId(objectId);
}
// what kind of object is it?
CMISNodeInfo info = getOrCreateNodeInfo(versionSeriesId, "Version Series");
if (info.isVariant(CMISObjectVariant.ASSOC))
{
return connector.getAssocProperties(info, filter);
}
else
{
CMISNodeInfo versionInfo = createNodeInfo(((CMISNodeInfoImpl) info).getLatestVersionNodeRef(major));
addNodeInfo(versionInfo);
return connector.getNodeProperties(versionInfo, filter);
}
}
示例10: 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));
}
示例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);
}
}
示例12: 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);
}
}
}
示例13: setContentStream
import org.alfresco.opencmis.dictionary.CMISNodeInfo; //導入方法依賴的package包/類
@Override
public void setContentStream(
String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
Holder<String> changeToken, final ContentStream contentStream, 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 set on private working copies or current versions.");
}
final NodeRef nodeRef = info.getNodeRef();
if (((DocumentTypeDefinition) info.getType().getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED)
{
throw new CmisStreamNotSupportedException("Document type doesn't allow content!");
}
boolean existed = connector.getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT) != null;
if (existed && !overwriteFlag)
{
throw new CmisContentAlreadyExistsException("Content already exists!");
}
if ((contentStream == null) || (contentStream.getStream() == null))
{
throw new CmisInvalidArgumentException("No content!");
}
//ALF-21852 - Separated setContent and objectId.setValue in two different transactions because
//after executing setContent, the new objectId is not visible.
RetryingTransactionHelper helper = connector.getRetryingTransactionHelper();
helper.doInTransaction(new RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
{
String mimeType = parseMimeType(contentStream);
final File tempFile = copyToTempFile(contentStream);
String encoding = getEncoding(tempFile, mimeType);
try
{
ContentWriter writer = connector.getFileFolderService().getWriter(nodeRef);
writer.setMimetype(mimeType);
writer.setEncoding(encoding);
writer.putContent(tempFile);
}
finally
{
removeTempFile(tempFile);
}
connector.getActivityPoster().postFileFolderUpdated(info.isFolder(), nodeRef);
return null;
}
}, false, true);
String objId = helper.doInTransaction(new RetryingTransactionCallback<String>()
{
public String execute() throws Throwable
{
return connector.createObjectId(nodeRef);
}
}, true, true);
objectId.setValue(objId);
}
示例14: 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!");
}
//ALF-21852 - Separated deleteContent and objectId.setValue in two different transactions because
//after executing deleteContent, the new objectId is not visible.
RetryingTransactionHelper helper = connector.getRetryingTransactionHelper();
helper.doInTransaction(new RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
{
connector.getNodeService().setProperty(nodeRef, ContentModel.PROP_CONTENT, null);
// connector.createVersion(nodeRef, VersionType.MINOR, "Delete content");
connector.getActivityPoster().postFileFolderUpdated(info.isFolder(), nodeRef);
return null;
}
}, false, true);
String objId = helper.doInTransaction(new RetryingTransactionCallback<String>()
{
public String execute() throws Throwable
{
return connector.createObjectId(nodeRef);
}
}, true, true);
objectId.setValue(objId);
}
示例15: 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);
}