cancel
Showing results for 
Search instead for 
Did you mean: 

Cant see title and description in node propierties(SOLVED)

sidi
Champ in-the-making
Champ in-the-making
After creating a node with custom type an propierties, all the information gest well in the repository, bur when seeing or editing propierties i cant see or modified the name, title or description I see the rest. ¿can anybody help?

this is the Alfresco Webservice use:

public Reference creaFichero(Reference reference, String name, String titul, String descripcion,
         Properties info, String filetype, String encoding, String path,
         InputStream ie) throws AuthenticationFault, RepositoryFault,
         FileNotFoundException, RemoteException, IOException {

      Reference theReference = reference;
      ParentReference parentReference = new ParentReference(spacesStore,
            theReference.getUuid(), theReference.getPath(),
            Constants.ASSOC_CONTAINS, Constants.createQNameString(
                  Constants.NAMESPACE_CONTENT_MODEL, name));

      int i = 3;
      Content content = null;
      try {

         NamedValue[] properties = new NamedValue[info.size() + 3];

         properties[0] = Utils.createNamedValue(Constants.PROP_NAME, name);
         properties[1] = Utils.createNamedValue(Constants.PROP_TITLE, titul);
         properties[2] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, descripcion);
         
        
               
         for (Enumeration e = info.keys(); e.hasMoreElements(); i++) {
            String key = (String) e.nextElement();
            String value = (String) info.get(key);

            /*
             * if (key.indexOf(ConstantesAlfresco.INFO_NAMESPACE) >= 0)
             * properties = Utils.createNamedValue(key, value); else
             * properties =
             * Utils.createNamedValue(ConstantesAlfresco.INFO_NAMESPACE +
             * key, value);
             */

            if (key.indexOf(ConstantesAlfresco.INFO_NAMESPACE) >= 0)
               properties = Utils.createNamedValue(key, value);
            else
               properties = Utils.createNamedValue(Constants
                     .createQNameString("gadir.types.model", key),
                     value);
         }

         CMLCreate create = new CMLCreate(null, parentReference,
               parentReference.getUuid(), parentReference
                     .getAssociationType(), parentReference
                     .getChildName(), Constants.TYPE_CONTENT, properties);
         create.setType(Constants.createQNameString("gadir.types.model",
               "Gadir")); // Cambia el type de un nodo para que sea de
                           // tipo Gadir
         CML cml = new CML();
         CMLCreate c = new CMLCreate();

         cml.setCreate(new CMLCreate[] { create });
         UpdateResult[] result = actualizaRepositoryService(cml);
         Reference newContentNode = result[0].getDestination();
         ContentFormat format = new ContentFormat(filetype, encoding);

         FileInputStream file = null;

         // si le pasamos el path
         if (path != null && !path.equals("")) {
            file = new FileInputStream(path);
            InputStream viewStream = file;
            byte[] bytes = convertToByteArray(viewStream);
            content = escribirEnContentService(newContentNode, bytes,
                  format);
         }
         // en caso de que le pasemos el inputStream
         else {
            BufferedInputStream bie = new BufferedInputStream(ie);
            InputStream viewStream = bie;
            byte[] bytes = convertToByteArray(viewStream);
            content = escribirEnContentService(newContentNode, bytes,
                  format);
         }

         return content.getNode();
      } catch (RepositoryFault e) {
         System.out.println("El fichero:  " + name.toString()
               + " ya existe en este espacio del repositorio.");
         return null;
      }

   }

thanks in advance.
4 REPLIES 4

sidi
Champ in-the-making
Champ in-the-making
Another question I need help for, is how to parse in a custom propertie with date type a empty value. I read from an xml file  with this value:
0000-00-00T00:00:00.000Z. Gives an error. If I yest put an empty value between the labels gives error. If I dont use the labels of that propertie gives an error. My xml file that works correctly is this:

<?xml version="1.0" encoding="utf-8"?><Documento>   <Documento> 
   <NumeroDocumento>110048200000063071109004.pdf</NumeroDocumento>
   <Expediente>0066256</Expediente> 
     <NIF>28669055S</NIF>  
       <ApellidosNombre>Isidro López-Sánchez</ApellidosNombre>  
         <CodTerritorial>11004</CodTerritorial>  
           <LugarEmision>Algeciras</LugarEmision> 
              <FechaEmision>2005-01-01T00:00:00.000Z</FechaEmision> 
                 <Titulo>Documento sin fianza</Titulo>
                 <Importe>600.00</Importe>
                 <Intentos>01</Intentos>
                   <Estado>03</Estado>  
                     <FechaEstado>2005-01-02T00:00:00.000Z</FechaEstado>
                     <Notificador>CO</Notificador> 
                      </Documento>
                       </Documento>

thank you again.

sidi
Champ in-the-making
Champ in-the-making
After reading other issue, it was the mandatory aspect "titled" in the contentype definition the only thing needed.
thanks in anycase.

jcblitz
Champ in-the-making
Champ in-the-making
After reading other issue, it was the mandatory aspect "titled" in the contentype definition the only thing needed.
thanks in anycase.

How did you go about updating the description? I looked in myNode.getAspects() and the titled aspect is not there.

sidi
Champ in-the-making
Champ in-the-making
After reading other issue, it was the mandatory aspect "titled" in the contentype definition the only thing needed.
thanks in anycase.

How did you go about updating the description? I looked in myNode.getAspects() and the titled aspect is not there.


The question is how you get the node into the space, my problem was that using Web-Services de titled aspect is not automatic added, unlike if you do it from web-client, so for web-services you need to include the mandatory aspect in the content type definition like this:

  <?xml version="1.0" encoding="UTF-8" ?>
- <!–  gadir Model
  –>
- <!–  Note: This model is pre-configured to load at startup of the Repository.  So, all gadir
  –>
- <!–        types and aspects added here will automatically be registered
  –>
- <model name="gadir:gadirTypesModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
- <!–  Optional meta-data about the model
  –>
  <description>Modelo Gadir</description>
  <author />
  <version>1.0</version>
- <imports>
- <!–  Import Alfresco Dictionary Definitions
  –>
  <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
- <!–  Import Alfresco Content Domain Model Definitions
  –>
  <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
  <import uri="gadir.aspects.model" prefix="gadirAspects" />
  </imports>
- <!–  Introduction of new namespaces defined by this model
  –>
- <!–  NOTE: The following namespace gadir.model should be changed to reflect your own namespace
  –>
- <namespaces>
  <namespace uri="gadir.types.model" prefix="gadir" />
  </namespaces>
- <types>
  gadir:Gadir
- <type name="gadir:Gadir">
  <title>Metadatos Gadir</title>
  <parent>cm:content</parent>
- <properties>
- <property name="gadir:NumeroDocumento">
  <title>NumeroDocumento</title>
  <type>d:text</type>
  </property>
- <property name="gadir:Expediente">
  <title>Expediente</title>
  <type>d:text</type>
  </property>
- <property name="gadir:NIF">
  <title>NIF</title>
  <type>d:text</type>
  </property>
- <property name="gadir:ApellidosNombre">
  <title>AppellidosNombre</title>
  <type>d:text</type>
  </property>
- <property name="gadir:CodTerritorial">
  <title>CodTerritorial</title>
  <type>d:text</type>
  </property>
- <property name="gadir:LugarEmision">
  <title>LugarEmision</title>
  <type>d:text</type>
  </property>
- <property name="gadir:FechaEmision">
  <title>FechaEmision</title>
  <type>d:date</type>
  </property>
- <property name="gadir:Titulo">
  <title>Titulo</title>
  <type>d:text</type>
  </property>
- <property name="gadir:Importe">
  <title>Importe</title>
  <type>d:text</type>
  </property>
- <property name="gadir:Intentos">
  <title>Intentos</title>
  <type>d:text</type>
  </property>
- <property name="gadir:Estado">
  <title>Estado</title>
  <type>d:text</type>
  </property>
- <property name="gadir:FechaEstado">
  <title>FechaEstado</title>
  <type>d:date</type>
  </property>
- <property name="gadir:Notificador">
  <title>Notificador</title>
  <type>d:text</type>
  </property>
  </properties>
- <mandatory-aspects>
  <aspect>gadirAspects:MetadatosGadir</aspect>
  <aspect>cm:titled</aspect>
- <!–       <aspect>cmSmiley Surprisedwnable</aspect>
               <aspect>cm:author</aspect>
               <aspect>cm:versionable</aspect>
               <aspect>cm:lockable</aspect>
               <aspect>cd:keywordable</aspect>
               <aspect>cd:versionLabel</aspect>
               <aspect>cm:complianceable</aspect>
               <aspect>cm:subscribable</aspect>
               <aspect>cd:lifecyclable</aspect>
               <aspect>cd:subjectable</aspect> 
  –>
  </mandatory-aspects>
  </type>
  </types>
  </model>

hope is useful.