doc.checkIn(true, properties, contentStream, ""); reload();
public ObjectId checkIn(CmisObject document, String documentId, Object content, String filename, String mimeType, boolean major, String checkinComment, Map<String, Object> properties) { validateObjectOrId(document, documentId); validateRedundantIdentifier(document, documentId); Validate.notEmpty(filename, "filename is empty"); Validate.notNull(content, "content is null"); Validate.notEmpty(mimeType, "did you mean application/octet-stream?"); Validate.notEmpty(checkinComment, "checkinComment is empty"); CmisObject target = getCmisObject(document, documentId); if (target != null && target instanceof Document) { Document doc = (Document) target; return doc.checkIn(major, coalesceProperties(properties), createContentStream(filename, mimeType, content), checkinComment); } return null; }
private Document createVersion(Session session, Document doc, String content, int version) { CmisTestResult f; // check out ObjectId pwcId = doc.checkOut(); Document pwc = (Document) session.getObject(pwcId, SELECT_ALL_NO_CACHE_OC); addResult(checkObject(session, pwc, getAllProperties(pwc), "PWC " + version + " compliance")); // check in byte[] contentBytes = IOUtils.toUTF8Bytes(content); ContentStream contentStream = new ContentStreamImpl(doc.getName(), BigInteger.valueOf(contentBytes.length), "text/plain", new ByteArrayInputStream(contentBytes)); ObjectId newVersionId = pwc.checkIn(true, null, contentStream, "test version " + version); IOUtils.closeQuietly(contentStream); Document newVersion = (Document) session.getObject(newVersionId, SELECT_ALL_NO_CACHE_OC); addResult(checkObject(session, newVersion, getAllProperties(newVersion), "Version " + version + " compliance")); // check version history List<Document> versions = doc.getAllVersions(); f = createResult(FAILURE, "Version series should have " + version + " versions but has " + versions.size() + "!"); addResult(assertEquals(version, versions.size(), null, f)); if (!versions.isEmpty()) { f = createResult(FAILURE, "Newly created version " + version + " is not the latest version!"); addResult(assertEquals(newVersion.getId(), versions.get(0).getId(), null, f)); if (versions.size() > 1) { f = createResult(FAILURE, "The previous version of version " + version + " is not the document it has been created from!"); addResult(assertEquals(doc.getId(), versions.get(1).getId(), null, f)); } } return newVersion; }
boolean major = mode.equals(UpdateMode.MAJOR); try { ObjectId newObjectId = pwc.checkIn(major, null, contentStream, "Document update from process"); return (Document) session.getObject(newObjectId); } catch (CmisBaseException e) {
ObjectId newVersionId = pwc.checkIn(true, null, null, "Test Version 2"); Document newVersion = (Document) session.getObject(newVersionId, SELECT_ALL_NO_CACHE_OC); ObjectId thirdVersionId = pwc.checkIn(true, writableProperties, null, "Test Version 3"); Document thirdVersion = (Document) session.getObject(thirdVersionId, SELECT_ALL_NO_CACHE_OC); fourthContentBytes)); ObjectId fourthVersionId = pwc.checkIn(true, null, fourthContentStream, "Test Version 5"); Document fourthVersion = (Document) session.getObject(fourthVersionId, SELECT_ALL_NO_CACHE_OC); fifthContentBytes)); ObjectId fifthVersionId = pwc.checkIn(true, writableProperties, fifthContentStream, "Test Version 5"); Document fifthVersion = (Document) session.getObject(fifthVersionId, SELECT_ALL_NO_CACHE_OC);