cancel
Showing results for 
Search instead for 
Did you mean: 

Como hacer check in con metadatos personalizados(CMIS)

juanvzla
Champ in-the-making
Champ in-the-making
Hola,

He seguido la guia que me han proporcionado para hacer conexion via CMIS, la misma la he logrado( http://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html#creating-...)

Actualmente me encuentro tratando de realizar un ckeck in de un documento con metadata personalizada peor no logro entender como lo trabaja alfresco,


Este es el metodo que estoy usando

<code>
public Document createTestDoc(String docName, String contentType) {
         Session session = getSession();
         
         System.out.println("crear documento createTestDoc ");
          // Grab a reference to the folder where we want to create content
         Folder folder = (Folder) session.getObjectByPath("/" + getFolderName());
         
         System.out.println("folder "+folder);
         
         String timeStamp = new Long(System.currentTimeMillis()).toString();
         String filename = docName + " (" + timeStamp + ")";
         System.out.println("filename  "+filename);
         // Create a Map of objects with the props we want to set
         Map <String, Object> properties = new HashMap<String, Object>();
         // Following sets the content type and adds the webable and productRelated aspects
         // This works because we are using the OpenCMIS extension for Alfresco
         properties.put(PropertyIds.OBJECT_TYPE_ID, "D:rg:Actas");      
         properties.put(PropertyIds.NAME, filename);
         
         String docText = "This is a sample " + contentType + " document called " + docName;
         byte[] content = docText.getBytes();
         InputStream stream = new ByteArrayInputStream(content);
         ContentStream contentStream = session.getObjectFactory().createContentStream(filename, Long.valueOf(content.length), "text/plain", stream);

         Document doc = folder.createDocument(
                  properties,
                  contentStream,
                  VersioningState.MAJOR);
         System.out.println("Created: " + doc.getId());
         System.out.println("Content Length: " + doc.getContentStreamLength());
         
         return doc;
      }

El metodo me da el siguiente error: 'D:rg:Actas' is unknown! , donde Actas es mi tipo.


Le coloco mi modelo como lo tengo a ver como me podrian ayudar.

<type name = "rg:actas">
     <title>Tipo Actas</title>
     <parent>cm:content</parent>         
     <properties>
          <property name="rg:numActa">
       
              <title>Número de Acta</title>
              <type>d:text</type>          
              <mandatory>false</mandatory>
           <constraints>               
               <constraint ref="rg:tamanoNUI" />
               <constraint ref="rg:soloCaracteres" />
          </constraints>
          </property>
        <property name="rg:tipoActas">       
              <title>Tipos de Actas</title>
              <type>d:text</type>          
              <mandatory>false</mandatory>
           <constraints>
               <!–<constraint ref="rg:llenarListaActa" />–>
            
                  <constraint ref="rg:CodeLabel" />
               
               
          </constraints>
          </property>
       
   
   </type>


  <aspects>
    <aspect name="rg:aspectoRelacionRegitroCivil">
         <title> Metadatos relacional </title>      
         <properties>
             <property name="rg:numExpediente">
                    <title>Número de Expediente</title>
                    <type>d:text</type>
                    <mandatory>false</mandatory>
             </property>
           <property name="rg:NUI">
                    <title>Número Único Identificación</title>
                    <type>d:text</type>
                    <mandatory>false</mandatory>
             </property>
          <property name="rg:numSolicitud">
                    <title>Número de Solicitud</title>
                    <type>d:text</type>
                    <mandatory>false</mandatory>
             </property>
         
         
         </properties>
      </aspect>
   </aspects>


Como podria hacer el ckeck in con todo  esta metadata?

Si me podrian dejar un ejemplo de busqueda y borrado tambien seria excelente mucha gracias
<code>
3 REPLIES 3

angelborroy
Community Manager Community Manager
Community Manager
Debería funcionar. ¿Has probado con 'D:rg:actas'? (con la A en minúscula)
Hyland Developer Evangelist

juanvzla
Champ in-the-making
Champ in-the-making
SI lo coloque , arriba en el codigo que deje esta. Aun asi sigue el error que te mostre

angelborroy
Community Manager Community Manager
Community Manager
Haz un par de comprobaciones.

La línea de código tiene que ser:
properties.put(PropertyIds.OBJECT_TYPE_ID, "D:rg:actas");


La URL de conexión a CMIS tiene que ser del tipo:
http://[host]:[port]/alfresco/api/-default-/public/cmis/versions/1.1/atom


Hyland Developer Evangelist