本文整理汇总了Java中org.apache.chemistry.opencmis.commons.spi.Holder类的典型用法代码示例。如果您正苦于以下问题:Java Holder类的具体用法?Java Holder怎么用?Java Holder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Holder类属于org.apache.chemistry.opencmis.commons.spi包,在下文中一共展示了Holder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setContentStream
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的package包/类
/**
* Overridden to capture content upload for publishing to analytics service.
*/
@Override
public void setContentStream(String repositoryId, Holder<String> objectId,
Boolean overwriteFlag, Holder<String> changeToken, ContentStream contentStream,
ExtensionsData extension)
{
FileFilterMode.setClient(Client.cmis);
try
{
super.setContentStream(repositoryId, objectId, overwriteFlag, changeToken, contentStream, extension);
}
finally
{
FileFilterMode.clearClient();
}
}
示例2: moveObject
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的package包/类
/**
* See CMIS 1.0 section 2.2.4.13 moveObject
*/
public ObjectData moveObject(Holder<String> objectId, String targetFolderId,
ObjectInfoHandler objectInfos, boolean requiresObjectInfo) {
if(log.isTraceEnabled()) {
log.trace("<<<<<<<< Moving object from " + objectId.getValue() + " to "
+ targetFolderId);
}
if (!CommonUtil.hasObjectId(objectId)) {
throw new CmisInvalidArgumentException("Id is not valid!");
}
// get the node and parent
RegistryObject gregNode = getGregNode(objectId.getValue());
RegistryFolder parent = getGregNode(targetFolderId).asFolder();
gregNode = gregNode.move(parent);
objectId.setValue(gregNode.getId());
return gregNode.compileObjectType(null, false, objectInfos, requiresObjectInfo);
}
示例3: updateProperties
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的package包/类
/**
* See CMIS 1.0 section 2.2.4.12 updateProperties
*/
public ObjectData updateProperties(Holder<String> objectId, Properties properties,
ObjectInfoHandler objectInfos, boolean objectInfoRequired) {
if(log.isTraceEnabled()){
log.trace("<<<<<<< updateProperties for object id: " + objectId.getValue());
}
if (objectId == null) {
throw new CmisInvalidArgumentException("Id is not valid!");
}
// get the node
RegistryObject gregNode = getGregNode(objectId.getValue());
String id = gregNode.updateProperties(properties).getId();
objectId.setValue(id);
return gregNode.compileObjectType(null, false, objectInfos, objectInfoRequired);
}
示例4: checkOut
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的package包/类
/**
* See CMIS 1.0 section 2.2.7.1 checkOut
*/
public void checkOut(Holder<String> objectId, Holder<Boolean> contentCopied) {
if(log.isTraceEnabled()) {
log.trace("<<<<<<<<< checkout for object id " + objectId.getValue());
}
// check id
if (objectId == null || objectId.getValue() == null) {
throw new CmisInvalidArgumentException("Object Id must be set.");
}
// get the node
RegistryObject gregNode = getGregNode(objectId.getValue());
if (!gregNode.isVersionable()) {
throw new CmisUpdateConflictException("Not a version: " + gregNode);
}
// checkout
RegistryPrivateWorkingCopy pwc = gregNode.asVersion().checkout();
objectId.setValue(pwc.getId());
if (contentCopied != null) {
contentCopied.setValue(true);
}
}
示例5: updateProperties
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的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);
}
}
示例6: checkOut
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的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);
}
}
示例7: getContentChanges
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的package包/类
@Override
public ObjectList getContentChanges(
String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
return connector.getContentChanges(changeLogToken, maxItems);
}
示例8: setProperiesToObject
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的package包/类
private void setProperiesToObject(CmisService cmisService, String repositoryId, String objectIdStr, String propertyStr, BigInteger bigIntValue) throws CmisConstraintException{
Properties properties = cmisService.getProperties(repositoryId, objectIdStr, null, null);
PropertyIntegerImpl pd = (PropertyIntegerImpl)properties.getProperties().get(propertyStr);
pd.setValue(bigIntValue);
Collection<PropertyData<?>> propsList = new ArrayList<PropertyData<?>>();
propsList.add(pd);
Properties newProps = new PropertiesImpl(propsList);
cmisService.updateProperties(repositoryId, new Holder<String>(objectIdStr), null, newProps, null);
}
示例9: testGetContentChanges
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的package包/类
public void testGetContentChanges()
{
// create folder with file
String folderName = "testfolder" + GUID.generate();
String docName = "testdoc.txt" + GUID.generate();
createContent(folderName, docName, false);
folderName = "testfolder" + GUID.generate();
docName = "testdoc.txt" + GUID.generate();
createContent(folderName, docName, false);
Holder<String> changeLogToken = new Holder<String>();
ObjectList ol = this.cmisConnector.getContentChanges(changeLogToken, new BigInteger("2"));
assertEquals(2, ol.getNumItems());
assertEquals("3", changeLogToken.getValue());
}
示例10: setContentStream
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的package包/类
/**
* CMIS setContentStream and deleteContentStream.
*/
public void setContentStream(CallContext context, Holder<String> objectId, Boolean overwriteFlag, ContentStream contentStream) {
log.debug("setContentStream({}, {})", objectId, overwriteFlag);
if (objectId == null) {
throw new CmisInvalidArgumentException("Id is not valid!");
}
// check overwrite
// boolean owf = (overwriteFlag == null ? true : overwriteFlag.booleanValue());
// if (!owf && file.length() > 0) {
// throw new CmisContentAlreadyExistsException("Content already exists!");
// }
try {
if (!OKMDocument.getInstance().isValid(null, objectId.getValue())) {
throw new CmisStreamNotSupportedException("Not a document");
}
if (!OKMDocument.getInstance().isCheckedOut(null, objectId.getValue())) {
OKMDocument.getInstance().checkout(null, objectId.getValue());
}
new DbDocumentModule().checkin(null, objectId.getValue(), contentStream.getStream(), contentStream.getLength(), "CMIS Client",
null);
} catch (Exception e) {
throw new CmisStorageException("Could not write content: " + e.getMessage(), e);
}
}
示例11: appendContentStream
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的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);
}
}
示例12: deleteContentStream
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的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));
}
示例13: moveObject
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的package包/类
/**
* CMIS moveObject.
*/
public ObjectData moveObject(CallContext context, Holder<String> objectId, String targetFolderId,
ObjectInfoHandler objectInfos) {
boolean userReadOnly = checkUser(context, true);
if (objectId == null) {
throw new CmisInvalidArgumentException("Id is not valid!");
}
// get the file and parent
File file = getFile(objectId.getValue());
File parent = getFile(targetFolderId);
// build new path
File newFile = new File(parent, file.getName());
if (newFile.exists()) {
throw new CmisStorageException("Object already exists!");
}
// move it
if (!file.renameTo(newFile)) {
throw new CmisStorageException("Move failed!");
} else {
// set new id
objectId.setValue(getId(newFile));
}
return compileObjectData(context, newFile, null, false, false, userReadOnly, objectInfos);
}
示例14: updateProperties
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的package包/类
/**
* CMIS updateProperties.
*/
public ObjectData updateProperties(CallContext context, Holder<String> objectId, Properties properties,
ObjectInfoHandler objectInfos) {
boolean userReadOnly = checkUser(context, true);
// check object id
if (objectId == null || objectId.getValue() == null) {
throw new CmisInvalidArgumentException("Id is not valid!");
}
// get the file or folder
File file = getFile(objectId.getValue());
// check the properties
String typeId = (file.isDirectory() ? BaseTypeId.CMIS_FOLDER.value() : BaseTypeId.CMIS_DOCUMENT.value());
checkUpdateProperties(properties, typeId);
// get and check the new name
String newName = FileBridgeUtils.getStringProperty(properties, PropertyIds.NAME);
boolean isRename = (newName != null) && (!file.getName().equals(newName));
if (isRename && !isValidName(newName)) {
throw new CmisNameConstraintViolationException("Name is not valid!");
}
// rename file or folder if necessary
File newFile = file;
if (isRename) {
File parent = file.getParentFile();
newFile = new File(parent, newName);
if (!file.renameTo(newFile)) {
// if something went wrong, throw an exception
throw new CmisUpdateConflictException("Could not rename object!");
} else {
// set new id
objectId.setValue(getId(newFile));
}
}
return compileObjectData(context, newFile, null, false, false, userReadOnly, objectInfos);
}
示例15: bulkUpdateProperties
import org.apache.chemistry.opencmis.commons.spi.Holder; //导入依赖的package包/类
/**
* CMIS bulkUpdateProperties.
*/
public List<BulkUpdateObjectIdAndChangeToken> bulkUpdateProperties(CallContext context,
List<BulkUpdateObjectIdAndChangeToken> objectIdAndChangeToken, Properties properties,
ObjectInfoHandler objectInfos) {
checkUser(context, true);
if (objectIdAndChangeToken == null) {
throw new CmisInvalidArgumentException("No object ids provided!");
}
List<BulkUpdateObjectIdAndChangeToken> result = new ArrayList<BulkUpdateObjectIdAndChangeToken>();
for (BulkUpdateObjectIdAndChangeToken oid : objectIdAndChangeToken) {
if (oid == null) {
// ignore invalid ids
continue;
}
try {
Holder<String> oidHolder = new Holder<String>(oid.getId());
updateProperties(context, oidHolder, properties, objectInfos);
result.add(new BulkUpdateObjectIdAndChangeTokenImpl(oid.getId(), oidHolder.getValue(), null));
} catch (CmisBaseException e) {
// ignore exceptions - see specification
}
}
return result;
}