public class AddContentHelper {
public static void execute(byte[] doc, String extension, String filename, String type, String uuid) throws Exception {
// Start the session
AuthenticationUtils.startSession("admin", "admin");
// Creamos la referencia del nodo padre, donde se añadirá el contenido
// En este caso el nodo padre es company_home
FacesContext context = FacesContext.getCurrentInstance();
String homeSpaceUUID = Application.getCurrentUser(context).getHomeSpaceId();
Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
ParentReference companyHomeParent = new ParentReference(storeRef, (uuid!=null)? uuid : homeSpaceUUID,
null, Constants.ASSOC_CONTAINS, null);
Calendar calendario = Calendar.getInstance();
String timecad="";
timecad+=String.valueOf(calendario.get(Calendar.HOUR_OF_DAY));
timecad+=String.valueOf(calendario.get(Calendar.MINUTE));
timecad+=String.valueOf(calendario.get(Calendar.SECOND));
// Asignamos un nombre para el nodo que vamos a crea en company_home
String name = "Memorias (" + System.currentTimeMillis()
+ ")";
name= filename+"_"+timecad;
companyHomeParent.setChildName("cm:" + name);
// Comienza la construcción de nodo
NamedValue[] contentProps = new NamedValue[1];
contentProps[0] = Utils.createNamedValue(Constants.PROP_NAME, name+extension);
CMLCreate create = new CMLCreate("1", companyHomeParent, null, null,
null, Constants.TYPE_CONTENT, contentProps);
// Añadimos aspectos al nodo
NamedValue[] titledProps = new NamedValue[2];
titledProps[0] = Utils.createNamedValue(Constants.PROP_TITLE, name+extension);
titledProps[1] = Utils.createNamedValue(Constants.PROP_DESCRIPTION,
name+extension);
CMLAddAspect addAspect = new CMLAddAspect(Constants.ASPECT_TITLED,
titledProps, null, "1");
// Contruimos CML Block, con el nodo y sus aspectos
CML cml = new CML();
cml.setCreate(new CMLCreate[] { create });
cml.setAddAspect(new CMLAddAspect[] { addAspect });
// Creamos y recuperamos el contenido vía Repository Web Service
UpdateResult[] result = WebServiceFactory.getRepositoryService()
.update(cml);
Reference content = result[0].getDestination();
//
// Escribimos el contenido
//
ContentServiceSoapBindingStub contentService = WebServiceFactory
.getContentService();
ContentFormat contentFormat = new ContentFormat(type, "UTF-8");
contentService.write(content, Constants.PROP_CONTENT, doc,
contentFormat);
}}
Hola kylian:
En este otro hilo, me pegué un poco con los passwords de alfresco en la base de datos, con una problematica similar a la tuya. Los passwords en alfresco se guardan en MD4 (si, cuatro) para que sean compatibles con CIFS y no están en la típica tabla de usuarios.
http://forums.alfresco.com/es/viewtopic.php?f=10&t=2264
Un saludo y espero que te sirva.
–C.
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.