Session session = getSession(serverUrl, username, password); Document targetFile = (Document) session.getObject(path); Map<String, Object> properties = new HashMap<>(); properties.put(PropertyIds.NAME, name); targetFile.updateProperties(properties);
ObjectId newId = doc.updateProperties(properties2, false); Map<String, Object> properties3 = new HashMap<String, Object>(); properties3.put(PropertyIds.NAME, "update3.txt"); doc.updateProperties(properties3, false);
private void createDocumentAndAttachSecondaryType(Session session, Folder testFolder, ObjectType secondaryTestType) { Document doc = createDocument(session, testFolder, "createandattach.txt", "Secondary Type Test"); Document workDoc = doc; try { // test if check out is required boolean checkedout = false; if (needsCheckOut(doc)) { workDoc = (Document) session.getObject(doc.checkOut(), SELECT_ALL_NO_CACHE_OC); checkedout = true; } // attach secondary type ObjectId newId = workDoc.updateProperties(null, Collections.singletonList(secondaryTestType.getId()), null); Document newDoc = (Document) session.getObject(newId, SELECT_ALL_NO_CACHE_OC); // check if the secondary type is there boolean found = checkSecondaryType(newDoc, secondaryTestType); // -- detach secondary type if (found) { detachSecondaryType(session, newDoc, secondaryTestType); } // cancel a possible check out if (checkedout) { workDoc.cancelCheckOut(); } } finally { deleteObject(doc); } }
properties.put(PropertyIds.NAME, DOC_NAME2); ObjectId newId = workDoc.updateProperties(properties, false); Document doc2 = (Document) session.getObject(newId, SELECT_ALL_NO_CACHE_OC);
ObjectId newId = doc.updateProperties(null, null, Collections.singletonList(secondaryTestType.getId())); Document newDoc = (Document) session.getObject(newId, SELECT_ALL_NO_CACHE_OC);