Java Code Examples for org.apache.chemistry.opencmis.commons.spi.Holder#setValue()

The following examples show how to use org.apache.chemistry.opencmis.commons.spi.Holder#setValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LDRepository.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void checkOut(Holder<String> objectId, Holder<Boolean> contentCopied) {
	//debug("checkOut " + objectId.getValue());
	log.debug("checkOut {}", objectId);
	validatePermission(objectId.getValue(), null, Permission.WRITE);

	try {
		// get the document
		PersistentObject object = getObject(objectId.getValue());
		if (object == null)
			throw new CmisObjectNotFoundException(String.format("Object %s not found!", objectId.getValue()));

		if (!(object instanceof Document))
			throw new CmisObjectNotFoundException(
					String.format("Object %s is not a Document!", objectId.getValue()));

		// Create the document history event
		DocumentHistory transaction = new DocumentHistory();
		transaction.setSessionId(sid);
		transaction.setEvent(DocumentEvent.CHECKEDOUT.toString());
		transaction.setComment("");
		transaction.setUser(getSessionUser());

		documentManager.checkout(object.getId(), transaction);
		objectId.setValue(getId(object));
		if (contentCopied != null)
			contentCopied.setValue(Boolean.TRUE);
	} catch (Throwable t) {
		catchError(t);
	}
}
 
Example 2
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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);
    }
}
 
Example 3
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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);
    }
}
 
Example 4
Source File: LDRepository.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ObjectList getContentChanges(Holder<String> changeLogToken, int max) throws CmisPermissionDeniedException {
		
		log.debug("getContentChanges {}", changeLogToken.getValue());
		
		if (changeLogToken == null) 
			throw new CmisInvalidArgumentException("Missing change log token holder");
		
		long minDate;

		try {
			minDate = Long.parseLong(changeLogToken.getValue());
		} catch (NumberFormatException e) {
			throw new CmisInvalidArgumentException("Invalid change log token");
		}
		
		ObjectListImpl ol = new ObjectListImpl();
		
		List<ObjectData> odsDocs = getDocumentLastChanges(minDate, max);
		List<ObjectData> odsFolders = getFolderLastChanges(minDate, max);
		
		//put together the 2 lists
		List<ObjectData> complex = new ArrayList<ObjectData>();
		complex.addAll(odsDocs);
		complex.addAll(odsFolders);
		
//	    log.debug("Before sort");
//	    for (ObjectData objectData : complex) {
//	    	log.debug("ChangeTime {}", objectData.getChangeEventInfo().getChangeTime().getTime());
//		}		
		
		// sort the content of list complex by date
		Collections.sort(complex, new Comparator<ObjectData>() {
			public int compare(ObjectData o1, ObjectData o2) {
				return o1.getChangeEventInfo().getChangeTime().getTime()
						.compareTo(o2.getChangeEventInfo().getChangeTime().getTime());
			}
		});
		
//	    log.debug("After sort");
//	    for (ObjectData objectData : complex) {
//	    	log.debug("ChangeTime {} {} {} {}", objectData.getChangeEventInfo().getChangeType(), objectData.getId() ,objectData.getChangeEventInfo().getChangeTime().getTime(), objectData.getChangeEventInfo().getChangeTime().getTime().getTime());
//		}
	    
	    boolean hasMoreItems = complex.size() > max;
        if (hasMoreItems) {
        	complex = complex.subList(0, max);
        }

		ol.setObjects(complex);
		
		Date date = null;
		if (complex.size() > 0) {
			//ol.setNumItems(BigInteger.valueOf(complex.size()));
			ol.setNumItems(BigInteger.valueOf(-1));
			//ol.setHasMoreItems(true);
			ol.setHasMoreItems(Boolean.valueOf(hasMoreItems));
			date = ((ObjectData)complex.get(complex.size() -1)).getChangeEventInfo().getChangeTime().getTime();
// 			log.debug("date {}", date);
// 			log.debug("date.getTime {}", date.getTime());
		} else {
			ol.setHasMoreItems(Boolean.valueOf(false));
			ol.setNumItems(BigInteger.ZERO);
		}

		String latestChangeLogToken = date == null ? null : String.valueOf(date.getTime());
		log.debug("latestChangeLogToken {}", latestChangeLogToken);
		changeLogToken.setValue(latestChangeLogToken);

		return ol;
	}
 
Example 5
Source File: CMISConnector.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Returns content changes.
 */
public ObjectList getContentChanges(Holder<String> changeLogToken, BigInteger maxItems)
{
    final ObjectListImpl result = new ObjectListImpl();
    result.setObjects(new ArrayList<ObjectData>());

    // Collect entryIds to use a counter and a way to find the last changeLogToken
    final List<Long> entryIds = new ArrayList<Long>();

    EntryIdCallback changeLogCollectingCallback = new EntryIdCallback(true)
    {
        @Override
        public boolean handleAuditEntry(Long entryId, String user, long time, Map<String, Serializable> values)
        {
            entryIds.add(entryId);
            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.getValue());
        }
    }

    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);

    int resultSize = result.getObjects().size();

    // Use the entryIds as a counter is more reliable then the result.getObjects().
    // result.getObjects() can be more or less then the requested maxResults, because it is filtered based on the content.
    boolean hasMoreItems = entryIds.size() >= maxResults;
    result.setHasMoreItems(hasMoreItems);
    // Check if we got more than the client requested
    if (hasMoreItems && resultSize >= maxResults)
    {
        // We are assuming there are there is only one extra document now in line with how it used to behave
        // Remove extra item that was not actually requested
        result.getObjects().remove(resultSize - 1);
        entryIds.remove(resultSize - 1);
    }

    if (changeLogToken != null)
    {
        //Update the changelog after removing the last item if there are more items.
        Long newChangeLogToken = entryIds.isEmpty() ? from : entryIds.get(entryIds.size() - 1);
        changeLogToken.setValue(String.valueOf(newChangeLogToken));
    }

    return result;
}
 
Example 6
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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);
}
 
Example 7
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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);
            String encoding = getEncoding(contentStream.getStream(), mimeType);
            ContentWriter writer = connector.getFileFolderService().getWriter(nodeRef);
            writer.setMimetype(mimeType);
            writer.setEncoding(encoding);
            writer.putContent(contentStream.getStream());
            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);
}
 
Example 8
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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);
    }
 
Example 9
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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();

    // 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(contentStream.getStream(), mimeType);
        // write content
        ContentWriter writer = connector.getFileFolderService().getWriter(nodeRef);
        writer.setMimetype(mimeType);
        writer.setEncoding(encoding);
        writer.putContent(contentStream.getStream());
    }

    // 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));
}
 
Example 10
Source File: CMISTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * MNT-20139
 * CmisConnector returns wrong values for changeLogToken and hasMoreItems
 */
@Test
public void testGetContentChanges()
{
    setupAudit();

    AuthenticationUtil.pushAuthentication();
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());

    try
    {
        // create folders with files
        createContent("testfolder" + GUID.generate(), "testdoc.txt" + GUID.generate(), false);
        createContent("testfolder" + GUID.generate(), "testdoc.txt" + GUID.generate(), false);
        createContent("testfolder" + GUID.generate(), "testdoc.txt" + GUID.generate(), false);

        Holder<String> changeLogToken = new Holder<String>();

        /*
         * GetContentChanges with maxitems = 2 and null changeLogToken
         * Check that changeLogToken should be the latest from the retrieved entries
         */
        ObjectList ol = this.cmisConnector.getContentChanges(changeLogToken, new BigInteger("2"));
        assertEquals(2, ol.getObjects().size());
        assertEquals("ChangeLogToken should be latest from retrieved entries.", "2", changeLogToken.getValue());
        assertTrue(ol.hasMoreItems());

        /*
         * GetContentChanges with maxitems = 2 and changeLogToken = 0
         * Check that changeLogToken should be the latest from the retrieved entries
         */
        changeLogToken.setValue(Integer.toString(0));
        ol = this.cmisConnector.getContentChanges(changeLogToken, new BigInteger("2"));
        assertEquals(2, ol.getObjects().size());
        assertEquals("ChangeLogToken should be latest from retrieved entries.", "2", changeLogToken.getValue());
        assertTrue(ol.hasMoreItems());

        /*
         * GetContentChanges with changeLogToken = maxChangeLogToken - 2
         * Check that changeLogToken is not null when the latest entries (fromToken) are retrieved
         */
        Long latestToken = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Long>()
        {
            public Long execute() throws Exception
            {
                return Long.parseLong(cmisConnector.getRepositoryInfo(CmisVersion.CMIS_1_1).getLatestChangeLogToken());
            }
        }, true, false);

        Long fromToken = latestToken - 2;
        changeLogToken.setValue(fromToken.toString());

        ol = this.cmisConnector.getContentChanges(changeLogToken, new BigInteger("20"));
        assertEquals(3, ol.getObjects().size());
        assertNotNull(changeLogToken.getValue());
        assertEquals("ChangeLogToken should be the latest from all entries.", latestToken.toString(), changeLogToken.getValue());
        assertFalse(ol.hasMoreItems());
    }
    finally
    {
        auditSubsystem.destroy();
        AuthenticationUtil.popAuthentication();
    };
}
 
Example 11
Source File: CMISTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * MNT-11727: move and rename operations should be shown as an UPDATE in the CMIS change log
 */
@Test
public void testMoveRenameWithCMISshouldBeAuditedAsUPDATE() throws Exception
{
    // setUp audit subsystem
    setupAudit();

    AuthenticationUtil.pushAuthentication();
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());

    try
    {
        assertTrue("Audit is not enabled", auditSubsystem.isAuditEnabled());
        assertNotNull("CMIS audit is not enabled", auditSubsystem.getAuditApplicationByName("CMISChangeLog"));

        NodeRef companyHomeNodeRef = repositoryHelper.getCompanyHome();

        String folder = GUID.generate();
        FileInfo folderInfo = fileFolderService.create(companyHomeNodeRef, folder, ContentModel.TYPE_FOLDER);

        final String actualToken = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<String>()
        {
            public String execute() throws Exception
            {
                return cmisConnector.getRepositoryInfo(CmisVersion.CMIS_1_1).getLatestChangeLogToken();
            }
        }, true, false);

        String content = GUID.generate();
        FileInfo document = fileFolderService.create(folderInfo.getNodeRef(), content, ContentModel.TYPE_CONTENT);
        assertNotNull(document);
        nodeService.setProperty(document.getNodeRef(), ContentModel.PROP_NAME, content);

        Holder<String> changeLogToken = new Holder<String>();
        changeLogToken.setValue(actualToken);
        ObjectList changeLog = CMISTest.this.cmisConnector.getContentChanges(changeLogToken, new BigInteger("10"));
        List<ObjectData> events = changeLog.getObjects();
        int count = events.size();
        // it should be 3 entries: 1 for previous folder create, 1 new CREATE (for document create)
        // and 1 NEW UPDATE
        assertEquals(3, count);

        assertEquals(events.get(0).getProperties().getPropertyList().get(0).getValues().get(0), folderInfo.getNodeRef().getId());
        assertEquals(events.get(0).getChangeEventInfo().getChangeType(), ChangeType.CREATED);

        assertTrue(((String) events.get(1).getProperties().getPropertyList().get(0).getValues().get(0)).contains(document.getNodeRef().getId()));
        assertEquals(events.get(1).getChangeEventInfo().getChangeType(), ChangeType.CREATED);

        assertTrue(((String) events.get(2).getProperties().getPropertyList().get(0).getValues().get(0)).contains(document.getNodeRef().getId()));
        assertEquals(events.get(2).getChangeEventInfo().getChangeType(), ChangeType.UPDATED);

        // test rename
        final String actualToken2 = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<String>()
        {
            public String execute() throws Exception
            {
                return cmisConnector.getRepositoryInfo(CmisVersion.CMIS_1_1).getLatestChangeLogToken();
            }
        }, true, false);
        nodeService.setProperty(document.getNodeRef(), ContentModel.PROP_NAME, content + "-updated");

        changeLogToken = new Holder<String>();
        changeLogToken.setValue(actualToken2);
        changeLog = CMISTest.this.cmisConnector.getContentChanges(changeLogToken, new BigInteger("10"));
        events = changeLog.getObjects();
        count = events.size();
        assertEquals(2, count);
        assertEquals("Rename operation should be shown as an UPDATE in the CMIS change log", events.get(1).getChangeEventInfo().getChangeType(), ChangeType.UPDATED);

        // test move
        String targetFolder = GUID.generate();
        FileInfo targetFolderInfo = fileFolderService.create(companyHomeNodeRef, targetFolder, ContentModel.TYPE_FOLDER);

        final String actualToken3 = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<String>()
        {
            public String execute() throws Exception
            {
                return cmisConnector.getRepositoryInfo(CmisVersion.CMIS_1_1).getLatestChangeLogToken();
            }
        }, true, false);
        nodeService.moveNode(document.getNodeRef(), targetFolderInfo.getNodeRef(), ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS);

        changeLogToken = new Holder<String>();
        changeLogToken.setValue(actualToken3);
        changeLog = CMISTest.this.cmisConnector.getContentChanges(changeLogToken, new BigInteger("10"));
        events = changeLog.getObjects();
        count = events.size();
        assertEquals(2, count);
        assertEquals("Move operation should be shown as an UPDATE in the CMIS change log", events.get(1).getChangeEventInfo().getChangeType(), ChangeType.UPDATED);
    }
    finally
    {
        auditSubsystem.destroy();
        AuthenticationUtil.popAuthentication();
    }
}