As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Inoltre una volta inseriti i documenti se li riverco tramite alfresco con la ricerca avanzata non li trova??? che posso fare??
contentProps[1] = Utils.createNamedValue(Constants.PROP_CONTENT, contentString);
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService(); ContentFormat contentFormat = new ContentFormat("application/pdf", "UTF-8"); Content contentRef = contentService.write(content, Constants.PROP_CONTENT, byteFile, contentFormat); System.out.println("Content Length: " + contentRef.getLength()); idContenutoAlfresco = contentRef.getNode().getUuid(); if (result[0].getDestination() != null) { System.out.println("RESULT DESTINATION PATH: " + contentRef.getNode().getPath()); System.out.println("RESULT DESTINATION UUID: " + contentRef.getNode().getUuid()); } NamedValue[] contentPropsUpdate = new NamedValue[8]; contentPropsUpdate[0] = Utils.createNamedValue(Constants.PROP_NAME, displayName); // dataCreation= "2005-09-16T17:01:03.456+01:00"; contentPropsUpdate[1] = Utils.createNamedValue(Constants.PROP_CREATED, it.opera21.migration.Utils.convertToAlfrescoDateFormatFromMigration(metadati.getCreation_date())); contentPropsUpdate[2] = Utils.createNamedValue(PROP_MODIFIED, it.opera21.migration.Utils.convertToAlfrescoDateFormatFromMigration(metadati.getModified())); contentPropsUpdate[3] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, descrizione); contentPropsUpdate[4] = Utils.createNamedValue(Constants.PROP_TITLE, metadati.getTitle()); contentPropsUpdate[5] = Utils.createNamedValue(PROP_AUTHOR, metadati.getReport()); contentPropsUpdate[6] = Utils.createNamedValue(PROP_CREATOR, metadati.getCreatedBy()); contentPropsUpdate[7] = Utils.createNamedValue(PROP_MODIFIER, metadati.getModifiedby()); CMLUpdate update = new CMLUpdate(); update.setProperty(contentPropsUpdate); Predicate predicate = new Predicate(); predicate.setStore(STORE_ALFRESCO); predicate.setNodes(new Reference[]{new Reference(STORE_ALFRESCO, contentRef.getNode().getUuid(), null)}); update.setWhere(predicate); CML cml1 = new CML(); cml1.setUpdate(new CMLUpdate[] {update}); UpdateResult[] result1; result1 = WebServiceFactory.getRepositoryService().update(cml1);
Grazie di tutto OpenPj, ma ho sempre il problema della verisone… non so più che fare! Vado a modificare con uno script il db di mysql? grazie anticipatamente.
come posso fare?
Salve, ho un piccolo problema, quando inserisco un documento su Alfresco e setto le proprieta ho come versione del documento 0.1 io verrei avere 1.0. il problema è che devo impostargli che il documento deve essere versionato (Utils.createNamedValue("{http://www.alfresco.org/model/content/1.0}autoVersion", "true") come faccio ad avere come versione iniziale 1.0. questo è il codice che ho scritto: NamedValue[] contentProps = new NamedValue[8]; contentProps[0] = Utils.createNamedValue(Constants.PROP_NAME, documentName); contentProps[1] = Utils.createNamedValue(Constants.PROP_CONTENT, contentString); // dataCreation= "2005-09-16T17:01:03.456+01:00"; contentProps[2] = Utils.createNamedValue(Constants.PROP_CREATED, it.opera21.migration.Utils.convertToAlfrescoDateFormatFromShare(metadati.getCreation_date())); contentProps[3] = Utils.createNamedValue(PROP_MODIFIED, it.opera21.migration.Utils.convertToAlfrescoDateFormatFromShare(metadati.getCreation_date())); contentProps[4] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, metadati.getTitle()); contentProps[5] = Utils.createNamedValue(Constants.PROP_TITLE, metadati.getTitle()); contentProps[6] = Utils.createNamedValue(PROP_AUTHOR, metadati.getReport()); contentProps[7] = Utils.createNamedValue("{http://www.alfresco.org/model/content/1.0}autoVersion", "true");CML cml1 = new CML();CMLCreate create2 = new CMLCreate(null, parentReference, null, null, null, Constants.TYPE_CONTENT, contentProps);cml1.setCreate(new CMLCreate[] { create2 });UpdateResult[] result; result = WebServiceFactory.getRepositoryService().update(cml1); System.out.println("######### UPLOAD CONTENT FINISHED #########");
// CREATE DOC ParentReference parent = ReferenceToParent(parentref); parent.setChildName(Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, normilizeNodeName(docname))); NamedValue[] properties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, docname)}; CMLCreate create = new CMLCreate("1", parent, null, null, null, Constants.TYPE_CONTENT, properties); CML cml = new CML(); cml.setCreate(new CMLCreate[]{create}); UpdateResult[] results = getRepositoryService().update(cml); Reference document = results[0].getDestination(); // UPLOAD CONTENT ContentFormat format = new ContentFormat(mimetype, "UTF-8"); getContentService().write(document, Constants.PROP_CONTENT, content, format); // CHECKOUT Predicate predicate = new Predicate(new Reference[]{document}, null, null); CheckoutResult checkOutResult = getAuthoringService().checkout(predicate, null); // WORKING COPY REFERENCE Reference workingCopyReference = checkOutResult.getWorkingCopies()[0]; Predicate workingCopyPredicate = new Predicate(new Reference[] { workingCopyReference }, null, null); // ADD VERSIONABLE ASPECT to WORKING COPY REFERENCE CMLAddAspect addAspect = new CMLAddAspect(Constants.ASPECT_VERSIONABLE, null, workingCopyPredicate, null); CML cml = new CML(); cml.setAddAspect(new CMLAddAspect[]{addAspect}); getRepositoryService().update(cml); // CHECKIN NamedValue[] revisionType = new NamedValue[] { Utils.createNamedValue("versionType", "MAJOR")}; CheckinResult checkinResult = getAuthoringService().checkin(workingCopyPredicate, revisionType, false); Reference[] refs = checkinResult.getCheckedIn();