To make the exercise more concise we will execute each request in a synchronous way.
Alfresco Java Client is currently in Early Access mode. It evolves as you use them, as you give feedback, and as the developers update and add file. We like to think app & lib development as services that grow and evolve with the involvement of the community.
//Get node information with isLink and path node = nodesAPI.getNodeCall(nodeId,newIncludeParam(Arrays.asList("isLink","path")), null, null).execute().body(); Assert.assertFalse(node.isLink()); Assert.assertNotNull(node.getPath());
//Change Node Type NodeRepresentation changedTypeNode = nodesAPI.updateNodeCall(nodeId,newNodeBodyUpdate(null,"cm:savedquery", null, null)).execute().body(); Assert.assertEquals(changedTypeNode.getNodeType(),"cm:savedquery");
//Update Content RequestBody requestBody = RequestBody.create(MediaType.parse("text/plain"),"This is the initial content for the file."); NodeRepresentation updatedContentNode = nodesAPI.updateNodeContentCall(nodeId, requestBody).execute().body(); Assert.assertEquals(updatedContentNode.getContent().getSizeInBytes(),41);