Search in sources :

Example 6 with ContentDAO

use of com.tomasio.projects.trainning.dao.ContentDAO in project trainning by fernandotomasio.

the class Main method main.

public static void main(String[] args) throws Exception {
    // WebServiceFactory.setEndpointAddress("http://localhost:8084/alfresco/api");
    ContentDAO service = new AlfrescoContentDAO();
    DocumentDTO content = service.findDocumentSWFByUUID("6c8c1aad-79f6-46ce-a6f6-2380f7341271");
    OutputStream out = new FileOutputStream("DOCUMENT.pdf");
    out.write(content.getContentStream());
    out.close();
// DocumentDTO document = new DocumentDTO();
// FolderDTO folder = new FolderDTO();
// 
// document.setDescription("Description");
// document.setTitle("Title");
// document.setName("meusteste5s5.pdf");
// document.setMimeType("application/pdf");
// document.setCharset("UTF-8");
// 
// 
// InputStream viewStream = new FileInputStream(new File("/home/fernandofot/identidade.pdf"));
// byte[] bytes = org.apache.commons.io.IOUtils.toByteArray(viewStream);
// 
// document.setContentStream(bytes);
// 
// ContentDTO [] contents = service.findAllContentByPath("D-CTP");
// for(ContentDTO content: contents){
// System.out.println(content.getTitle());
// }
// service.addDocumentToTreinamento(document,"COMGAR", "2018", "AP005", "2");
// Open the file and convert to byte array
// 
// 
// folder.setDescription("My description folder");
// folder.setName("CTP001-3");
// folder.setTitle("Minha Linda Pasta");
// 
// 
// 
// 
// 
// ECMService service = new AlfrescoECMService();
// 
// ContentDTO content = service.findDocumentoByUUID("5e587e0b-f0ca-4264-abdc-dc791197b7f7");
// content.setName("new_name.pdf");
// content.setTitle("New Title");
// content.setDescription("New Description");
// DocumentDTO documento = (DocumentDTO) content;
// System.out.println(documento.getContentStream().length);
// ContentDTO [] docs = service.findDocumentosByTreinamento("CTP004", "5", "2015");
// for (ContentDTO documentDTO : docs) {
// System.out.println(documentDTO.getName());
// }
// ContentDTO [] documentos = service.findDocumentosByTreinamento("TEL007", "1", "2017");
// 
// for (ContentDTO contentDTO : documentos) {
// System.out.println(contentDTO.getName());
// }
// String uid = service.createDocument(document, "D-CTP/Documentos de Treinamentos/CTP001-3");
// System.out.println(uid);
// String uid = service.createFolder(folder, "D-CTP/Documentos de Treinamentos");
// System.out.println(uuid);
// service.findContentByUUID(uid);
// System.out.println(service.contentExistsByPath("D-CTP/Documentos de Treinamentos"));
}
Also used : OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream) DocumentDTO(com.tomasio.projects.trainning.dto.DocumentDTO) AlfrescoContentDAO(com.tomasio.projects.trainning.dao.AlfrescoContentDAO) ContentDAO(com.tomasio.projects.trainning.dao.ContentDAO) AlfrescoContentDAO(com.tomasio.projects.trainning.dao.AlfrescoContentDAO)

Example 7 with ContentDAO

use of com.tomasio.projects.trainning.dao.ContentDAO in project trainning by fernandotomasio.

the class ECMServiceSimpleImpl method createFolderWithUUIDParent.

@Override
public String createFolderWithUUIDParent(FolderDTO folder, String uuidParent) {
    ContentDAO dao = factory.getContentDAO();
    String uuid;
    uuid = dao.createFolderWithUUIDParent(folder, uuidParent);
    return uuid;
}
Also used : ContentDAO(com.tomasio.projects.trainning.dao.ContentDAO)

Example 8 with ContentDAO

use of com.tomasio.projects.trainning.dao.ContentDAO in project trainning by fernandotomasio.

the class ECMServiceSimpleImpl method createDocument.

@Override
public String createDocument(DocumentDTO document, String path) {
    ContentDAO dao = factory.getContentDAO();
    String uuid;
    uuid = dao.createDocument(document, path);
    return uuid;
}
Also used : ContentDAO(com.tomasio.projects.trainning.dao.ContentDAO)

Example 9 with ContentDAO

use of com.tomasio.projects.trainning.dao.ContentDAO in project trainning by fernandotomasio.

the class ECMServiceSimpleImpl method findDocumentSWFByUUID.

@Override
public DocumentDTO findDocumentSWFByUUID(String uuid) {
    ContentDAO dao = factory.getContentDAO();
    DocumentDTO document = dao.findDocumentSWFByUUID(uuid);
    return document;
}
Also used : DocumentDTO(com.tomasio.projects.trainning.dto.DocumentDTO) ContentDAO(com.tomasio.projects.trainning.dao.ContentDAO)

Aggregations

ContentDAO (com.tomasio.projects.trainning.dao.ContentDAO)9 DocumentDTO (com.tomasio.projects.trainning.dto.DocumentDTO)4 AlfrescoContentDAO (com.tomasio.projects.trainning.dao.AlfrescoContentDAO)2 HibernateTurmaDAO (com.tomasio.projects.trainning.dao.HibernateTurmaDAO)1 TurmaDAO (com.tomasio.projects.trainning.dao.TurmaDAO)1 ContentDTO (com.tomasio.projects.trainning.dto.ContentDTO)1 FolderDTO (com.tomasio.projects.trainning.dto.FolderDTO)1 DAOException (com.tomasio.projects.trainning.exception.DAOException)1 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1 RemoteException (java.rmi.RemoteException)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1