url.addParameter(Constants.PARAM_CHECKIN_COMMENT, checkinComment);
url.addParameter(Constants.PARAM_MAJOR, major);
url.addParameter(Constants.PARAM_CHECK_IN, "true");
// set up object and writer
CmisObjectType object = new CmisObjectType();
object.setProperties(convert(properties));
object.setPolicyIds(convertPolicyIds(policies));
if (object.getProperties() == null) {
object.setProperties(new CmisPropertiesType());
}
String mediaType = null;
InputStream stream = null;
if (contentStream != null) {
mediaType = contentStream.getMimeType();
stream = contentStream.getStream();
}
final AtomEntryWriter entryWriter = new AtomEntryWriter(object, mediaType, stream);
// update
HttpUtils.Response resp = put(url, Constants.MEDIATYPE_ENTRY, new HttpUtils.Output() {
public void write(OutputStream out) throws Exception {
entryWriter.write(out);
}
});
// parse new entry
AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
// we expect a CMIS entry
if (entry.getId() == null) {
throw new CmisConnectionException("Received Atom entry is not a CMIS entry!");
}
// set object id
objectId.setValue(entry.getId());
Acl originalAces = null;
lockLinks();
try {
// clean up cache
removeLinks(repositoryId, entry.getId());
// walk through the entry
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
} else if (element.getObject() instanceof CmisObjectType) {
// extract current ACL
object = (CmisObjectType) element.getObject();
originalAces = convert(object.getAcl(), object.isExactACL());
}
}
} finally {
unlockLinks();
}