I created a project alfresco amp. To add a document, I run this Test class:
-------------------------------------------------------------------------------------------------------------------------------------------------------------
public class Test
{
public static void main(String[] args) throws UnsupportedEncodingException
{
Map<String, String> sessionParameters = new HashMap<String, String>();
sessionParameters.put(SessionParameter.USER, "admin");
sessionParameters.put(SessionParameter.PASSWORD, "admin");
sessionParameters.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/api/- default-/public/cmis/versions/1.1/atom");
sessionParameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
Session lSession = sessionFactory.getRepositories(sessionParameters).get(0).createSession();
Folder root = lSession.getRootFolder();
Map<String, Object> folderProperties = new HashMap<String, Object>();
folderProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
folderProperties.put(PropertyIds.NAME, "oo");
Folder newFolder = root.createFolder(folderProperties);
Map<String, Object> lProperties = new HashMap<String, Object>();
String name = "lol.txt";
lProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
lProperties.put(PropertyIds.NAME, name);
byte[] content = "CMIS Testdata One".getBytes();
InputStream stream = new ByteArrayInputStream(content);
ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(content), "text/plain", stream);
Document newContent1 = newFolder.createDocument(lProperties, contentStream, null);
System.out.println("Document created: " + newContent1.getId());
}
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------
The document is created with success; I got: Document created: e3184105-e59e-4b8a-88e7-9442942433a4;1.0
My problem is how can I access to this document (With which url can I access to that document). Please help?.