当前位置: 首页>>代码示例>>Java>>正文


Java Holder.setValue方法代码示例

本文整理汇总了Java中org.apache.chemistry.opencmis.commons.spi.Holder.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java Holder.setValue方法的具体用法?Java Holder.setValue怎么用?Java Holder.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.chemistry.opencmis.commons.spi.Holder的用法示例。


在下文中一共展示了Holder.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:23,代码来源:CMISRepository.java

示例2: 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);
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:21,代码来源:CMISRepository.java

示例3: 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);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:27,代码来源:CMISRepository.java

示例4: 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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:AlfrescoCmisServiceImpl.java

示例5: 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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:41,代码来源:AlfrescoCmisServiceImpl.java

示例6: 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);
	}
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:30,代码来源:AlfrescoCmisServiceImpl.java

示例7: 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));
    }
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:30,代码来源:AlfrescoCmisServiceImpl.java

示例8: 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);
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:32,代码来源:FileBridgeRepository.java

示例9: 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);
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:43,代码来源:FileBridgeRepository.java

示例10: checkIn

import org.apache.chemistry.opencmis.commons.spi.Holder; //导入方法依赖的package包/类
/**
 * See CMIS 1.0 section 2.2.7.3 checkedIn
 */
public void checkIn(Holder<String> objectId, Boolean major, Properties properties,
                    ContentStream contentStream, String checkinComment) {

    if(log.isTraceEnabled()) {
        log.trace("<<<<<<< checkin 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;
    try {
        gregNode = getGregNode(objectId.getValue());
    }
    catch (CmisObjectNotFoundException e) {
        throw new CmisUpdateConflictException(e.getCause().getMessage(), e.getCause());
    }

    if (!gregNode.isVersionable()) {
        throw new CmisUpdateConflictException("Not a version: " + gregNode);
    }

    // checkin
    RegistryVersion checkedIn = gregNode.asVersion().checkin(properties, contentStream, checkinComment);
    objectId.setValue(checkedIn.getId());
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:33,代码来源:CMISRepository.java

示例11: 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);
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:33,代码来源:FileBridgeRepository.java

示例12: getContentChanges

import org.apache.chemistry.opencmis.commons.spi.Holder; //导入方法依赖的package包/类
/**
 * Returns content changes.
 */
public ObjectList getContentChanges(Holder<String> changeLogToken, BigInteger maxItems)
{
    final ObjectListImpl result = new ObjectListImpl();
    result.setObjects(new ArrayList<ObjectData>());

    EntryIdCallback changeLogCollectingCallback = new EntryIdCallback(true)
    {
        @Override
        public boolean handleAuditEntry(Long entryId, String user, long time, Map<String, Serializable> values)
        {
            result.getObjects().addAll(createChangeEvents(time, values));
            return super.handleAuditEntry(entryId, user, time, values);
        }
    };

    Long from = null;
    if ((changeLogToken != null) && (changeLogToken.getValue() != null))
    {
        try
        {
            from = Long.parseLong(changeLogToken.getValue());
        }
        catch (NumberFormatException e)
        {
            throw new CmisInvalidArgumentException("Invalid change log token: " + changeLogToken);
        }
    }

    AuditQueryParameters params = new AuditQueryParameters();
    params.setApplicationName(CMIS_CHANGELOG_AUDIT_APPLICATION);
    params.setForward(true);
    params.setFromId(from);

    // So we have a BigInteger.  We need to ensure that we cut it down to an integer smaller than Integer.MAX_VALUE
    
    int maxResults = (maxItems == null ? contentChangesDefaultMaxItems : maxItems.intValue());
    maxResults = maxResults < 1 ? contentChangesDefaultMaxItems : maxResults;           // Just a double check of the unbundled contents
    maxResults = maxResults > contentChangesDefaultMaxItems ? contentChangesDefaultMaxItems : maxResults;   // cut it down
    int queryFor = maxResults + 1;                          // Query for 1 more so that we know if there are more results

    auditService.auditQuery(changeLogCollectingCallback, params, queryFor);

    String newChangeLogToken = null;
    // Check if we got more than the client requested
    if (result.getObjects().size() >= maxResults)
    {
        // Build the change log token from the last item
        StringBuilder clt = new StringBuilder();
        newChangeLogToken = (from == null ? clt.append(maxItems.intValue() + 1).toString() : clt.append(from.longValue() + maxItems.intValue()).toString());    // TODO: Make this readable
        // Remove extra item that was not actually requested
        result.getObjects().remove(result.getObjects().size() - 1).getId();
        // Note to client that there are more items
        result.setHasMoreItems(true);
    }
    else
    {
        // We got the same or fewer than the number requested, so there are no more items
        result.setHasMoreItems(false);
    }

    if (changeLogToken != null)
    {
        changeLogToken.setValue(newChangeLogToken);
    }

    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:71,代码来源:CMISConnector.java

示例13: 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!");
    }

    //ALF-21852 - Separated appendContent and objectId.setValue in two different transactions because
    //after executing appendContent, the new objectId is not visible.
    RetryingTransactionHelper helper = connector.getRetryingTransactionHelper();
    helper.doInTransaction(new RetryingTransactionCallback<Void>()
    {
       public Void execute() throws Throwable
       {
           try
           {
               connector.appendContent(info, contentStream, isLastChunk);
           }
           catch(IOException e)
           {
                throw new ContentIOException("", e);
           }
            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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:49,代码来源:AlfrescoCmisServiceImpl.java

示例14: setContentStream

import org.apache.chemistry.opencmis.commons.spi.Holder; //导入方法依赖的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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:71,代码来源:AlfrescoCmisServiceImpl.java

示例15: 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!");
        }

        //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);
    }
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:49,代码来源:AlfrescoCmisServiceImpl.java


注:本文中的org.apache.chemistry.opencmis.commons.spi.Holder.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。