Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleObject-oriented API
Map<String, Serializable> params = new HashMap<String, Serializable>();
params.put(Repository.PARAM_USERNAME, "username");
params.put(Repository.PARAM_PASSWORD, "password");

Connection conn = repository.getConnection(params);
try {
    Folder root = conn.getRootFolder();
    List<CMISObject> children = root.getChildren();
    for (CMISObject child : children) {
        System.out.println(child.getName());
    }
    Document doc = (Document) children.get(0);
    System.out.println("Child id: " + child.getId());
    doc.setValue("description", "First child");
    doc.save();
} finally {
    conn.close();
}

...

Code Block
titleObject-oriented API
Map<String, Serializable> params = new HashMap<String, Serializable>();
params.put(Repository.PARAM_USERNAME, "username");
params.put(Repository.PARAM_PASSWORD, "password");

SPI spi = repository.getSPI(params);
try {
    ObjectId rootId = repository.getInfo().getRootFolderId();
    ListPage<ObjectEntry> page = spi.getChildren(rootId, null, null, null);
    for (ObjectEntry entry : page) {
        System.out.println(entry.getValue(Property.NAME));
    }
    ObjectId docId = page.get(0); // ObjectEntry implements ObjectId
    System.out.println("Child id: " + docId.getId());
    Map<String, Serializable> props = new HashMap<String, Serializable>();
    props.put("description", "First child");
    spi.updateProperties(docId, null, props);    
} finally {
    spi.close();
}

...