08-02-2010 03:37 AM
// Comienza la construcción de nodo
NamedValue[] contentProps = new NamedValue[1];
contentProps[0] = Utils.createNamedValue(Constants.PROP_NAME, name);
CMLCreate create = new CMLCreate("1", companyHomeParent, null, null, null, Constants.TYPE_CONTENT, contentProps);
// Añadimos aspectos al nodo
//[b]ASPECTO TITLED[/b]
NamedValue[] titledProps = new NamedValue[2];
titledProps[0] = Utils.createNamedValue(Constants.PROP_TITLE, titulo);
titledProps[1] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, descripción);
CMLAddAspect addAspect = new CMLAddAspect(createQNameString("http://www.alfresco.org/model/content/1.0", "titled"), titledProps, null, "1");
//[b]aspecto versionable[/b]
CMLAddAspect addAspectVersionable=null;
if (version){
//añado aspectos versionable
NamedValue[] versionable=new NamedValue[3];
versionable[0]=Utils.createNamedValue(createQNameString("http://www.alfresco.org/model/content/1.0", "initialVersion"), "1.0");
versionable[1]=Utils.createNamedValue(createQNameString("http://www.alfresco.org/model/content/1.0", "autoVersionOnUpdateProps"), "true");
versionable[2]=Utils.createNamedValue(createQNameString("http://www.alfresco.org/model/content/1.0", "autoVersion"), "true");
addAspectVersionable = new CMLAddAspect(createQNameString("http://www.alfresco.org/model/content/1.0", "versionable"), versionable, null, "1");
}
// [b]ASPECTO INLINEEDITABLE[/b]
CMLAddAspect addAspectInline=null;
if (editInline){
//añado aspecto editar online
NamedValue[] inline=new NamedValue[1];
inline[0]=Utils.createNamedValue(createQNameString("http://www.alfresco.org/model/application/1.0", "editInline"), "true");
addAspectInline=new CMLAddAspect(createQNameString("http://www.alfresco.org/model/application/1.0", "inlineeditable"), inline, null, "1");
}
// Contruimos CML Block, con el nodo y sus aspectos
CML cml = new CML();
cml.setCreate(new CMLCreate[] {create});
//DOY LOS ASPECTOS
cml.setAddAspect(new CMLAddAspect[] {addAspect});
if (version){
cml.setAddAspect(new CMLAddAspect[] {addAspectVersionable});
}
if (editInline){
cml.setAddAspect(new CMLAddAspect[] {addAspectInline});
}
// 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();
String text = textoHTML;
// hay que darle el formato segun el tipo!!!
ContentFormat contentFormat=null;
if (tipo.equalsIgnoreCase("html")){
contentFormat = new ContentFormat("application/msword", "UTF-8");
}
if (tipo.equalsIgnoreCase("txt")){
contentFormat = new ContentFormat("text/plain", "UTF-8");
}
System.out.println("formato del contentFormat–>"+contentFormat.getMimetype());
contentService.write(content, Constants.PROP_CONTENT, text.getBytes(), contentFormat);
08-17-2010 03:46 PM
<alfresco-config>
<!– Example of overriding the from email address –>
<!–
<config>
<client>
<from-email-address>someone@your-domain.com</from-email-address>
<search-max-results>100</search-max-results>
</client>
</config>
–>
<!– Example of adding languages to the list in the login page –>
<config evaluator="string-compare" condition="Languages">
<languages>
<language locale="en_US">English</language>
<language locale="es_ES">Spanish</language>
</languages>
</config>
<!– Example of configuring advanced search –>
<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
<type name="my:datosFactura"/>
</content-types>
<folder-types>
</folder-types>
<custom-properties>
<meta-data type="cm:dictionaryModel" property="cm:modelAuthor"/>
<meta-data aspect="my:datosFactura" property="my:tipo_documento"/>
<meta-data aspect="my:datosFactura" property="my:TITULO_ABREVIADO_DE_LA_INVENCION"/>
<meta-data aspect="my:datosFactura" property="my:SOLICITUD_PATENTE"/>
<meta-data type="cm:dictionaryModel" property="cm:modelPublishedDate"/>
</custom-properties>
</advanced-search>
</config>
<!– Example of changing the sort direction for a view in the client –>
<!–
<config evaluator="string-compare" condition="Views">
<views>
<view-defaults>
<topic>
<sort-direction>ascending</sort-direction>
</topic>
</view-defaults>
</views>
</config>
–>
<!– Example of adding a custom icon to the Create Space dialog –>
<!–
<config evaluator="string-compare" condition="cm:folder icons">
<icons>
<icon name="space-icon-custom" path="/images/icons/space-icon-custom.gif" />
</icons>
</config>
–>
<config evaluator="aspect-name" condition="my:datosFactura">
<property-sheet>
<show-property name="my:tipo_documento"/>
<show-property name="my:TITULO_ABREVIADO_DE_LA_INVENCION"/>
<show-property name="my:SOLICITUD_PATENTE"/>
<show-property name="my:PAISES_CON_SOLICITUD_DE_PATENTE"/>
<show-property name="my:FECHA_DE_PRESENTACION_DE_SOLICITUD"/>
<show-property name="my:TITULAR"/>
<show-property name="my:FACULTAD"/>
<show-property name="my:INVENTORES"/>
<show-property name="my:INVESTIGADOR_RESPONSABLE"/>
<show-property name="my:PROYECTO_ORIGEN"/>
<show-property name="my:ETAPA_DE_TRAMITACION"/>
<show-property name="my:FINANCIAMIENTO_PATENTAMIENTO"/>
<show-property name="my:DERECHOS_COMERCIALES"/>
<show-property name="my:DISTRIBUCION_DE_REGALIAS_UC"/>
<show-property name="my:COMERCIALIZACION"/>
<show-property name="my:PROYECTO"/>
<show-property name="my:CONSORCIO"/>
</property-sheet>
</config>
<config evaluator="aspect-name" condition="me:datosFactura1">
<property-sheet>
<show-property name="me:tipo_documento2"/>
<show-property name="me:TITULO_ABREVIADO_DEL_PROYECTO"/>
<show-property name="me:FACULTAD_CENTRO"/>
<show-property name="me:INVESTIGADOR_RESPONSABLE"/>
<show-property name="me:AGENCIA"/>
<show-property name="me:FONDO"/>
<show-property name="me:LINEA"/>
<show-property name="me:CODIGO_PROYECTO"/>
<show-property name="me:ANO_POSTULACION"/>
<show-property name="me:INSTITUCION_PRINCIPAL"/>
<show-property name="me:PATENTES"/>
<show-property name="me:CONSORCIO"/>
</property-sheet>
</config>
<config evaluator="aspect-name" condition="mi:datosFactura2">
<property-sheet>
<show-property name="mi:NOMBRE_DEL_CENTRO_CONSORCIO"/>
<show-property name="mi:NOMBRE_CORTO_DEL_CENTRO_CONSORCIO"/>
<show-property name="mi:TIPO_DE_CENTRO_CONSORCIO"/>
<show-property name="mi:tipo_documento3"/>
<show-property name="mi:ESTADO_DEL_DOCUMENTO"/>
<show-property name="mi:NOMBRE_CORTO_DEL_PROYECTO"/>
<show-property name="mi:FACULTADES"/>
<show-property name="mi:INVESTIGADOR_RESPONSABLE"/>
<show-property name="mi:ANO_SUSCRIPCION"/>
<show-property name="mi:INSTITUCIONES_SOCIAS"/>
<show-property name="mi:PATENTES"/>
<show-property name="mi:PROYECTOS"/>
</property-sheet>
</config>
<config evaluator="string-compare" condition="Action Wizards">
<aspects>
<aspect name="my:datosFactura"/>
</aspects>
</config>
<config evaluator="string-compare" condition="Action Wizards">
<aspects>
<aspect name="me:datosFactura1"/>
</aspects>
</config>
<config evaluator="string-compare" condition="Action Wizards">
<aspects>
<aspect name="mi:datosFactura2"/>
</aspects>
</config>
<!–The config below shows how to incorporate the example model–>
<!– into the web client, for this to work you will need to –>
<!– rename example-model-context.xml.sample to example-model-context.xml –>
<!–
<config evaluator="string-compare" condition="Content Wizards">
<content-types>
<type name="my:sop" />
</content-types>
</config>
<config evaluator="node-type" condition="my:sop">
<property-sheet>
<show-property name="mimetype" display-label-id="content_type"
component-generator="MimeTypeSelectorGenerator" />
<show-property name="size" display-label-id="size"
converter="org.alfresco.faces.ByteSizeConverter"
show-in-edit-mode="false" />
<show-property name="my:publishedDate" />
<show-association name="my:signOff" />
<show-property name="my:authorisedBy" />
<show-child-association name="my:processSteps" />
</property-sheet>
</config>
<config evaluator="aspect-name" condition="my:datosFactura">
<property-sheet>
<show-property name="my:fecha"/>
<show-property name="my:numero"/>
</property-sheet>
</config>
<config evaluator="string-compare" condition="Action Wizards">
<aspects>
<aspect name="my:datosFactura"/>
</aspects>
</config>
<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
<type name="my:sop" />
</content-types>
<custom-properties>
<meta-data type="my:sop" property="my:authorisedBy" />
<meta-data aspect="my:imageClassification" property="my:resolution" />
</custom-properties>
</advanced-search>
</config>
–>
</alfresco-config>
08-18-2010 04:12 AM
cml.setAddAspect(new CMLAddAspect[] {addAspectTitled, addAspectVersionable, addAspectInline});
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.