Lo primero es configurar el nuevo "storeNAS" donde estará montada la NAS:
Fichero: storeNAS-content-store-selector-context.xml (siempre dentro de alfresco/extension)
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http:// www.springframework.org/dtd/spring-beans.dtd'>
<!-- Define the new file stores -->
<beans>
<bean id="fileContentStoreNAS" class="org.alfresco.repo.content.filestore.FileContentStore">
<constructor-arg>
<value>${dir.root}/storeNAS</value>
</constructor-arg>
</bean>
<!-- Declare the mapping between store names and store instances -->
<bean id="storeSelectorContentStore" parent="storeSelectorContentStoreBase">
<property name="defaultStoreName">
<value>default</value>
</property>
<property name="storesByName">
<map>
<entry key="default">
<ref bean="fileContentStore" />
</entry>
<entry key="storeNAS">
<ref bean="fileContentStoreNAS" />
</entry>
</map>
</property>
</bean>
<!-- Point the ContentService to the 'selector' store -->
<bean id="contentService" parent="baseContentService">
<property name="store">
<ref bean="storeSelectorContentStore" />
</property>
</bean>
<!-- Add the other stores to the list of stores for cleaning -->
<bean id="eagerContentStoreCleaner" class="org.alfresco.repo.content.cleanup.EagerContentStoreCleaner" init-method="init">
<property name="eagerOrphanCleanup" >
<value>${system.content.eagerOrphanCleanup}</value>
</property>
<property name="stores" >
<list>
<ref bean="fileContentStore" />
<ref bean="fileContentStoreNAS" />
</list>
</property>
<property name="listeners" >
<ref bean="deletedContentBackupListeners" />
</property>
</bean>
</beans>
Ahora necesitamos configurar nuestra acción, eso lo realizamos en el fichero web-client-config-custom.xml y además de la acción configuramos también el aspecto:
Fichero: web-client-config-custom.xml
<config evaluator="aspect-name" condition="cm:storeSelector">
<property-sheet>
<show-property name="cm:storeName" />
</property-sheet>
</config>
<config evaluator="string-compare" condition="Action Wizards">
<aspects>
<aspect name="cm:storeSelector"/>
</aspects>
</config>
<config>
<actions>
<!-- Launch Add Aspect Dialog -->
<action id="add_store">
<label>Add Store</label>
<image>/images/icons/add.gif</image>
<action>dialog:addStore</action>
</action>
<!-- Add action to more actions menu for each space -->
<action-group id="space_browse_menu">
<action idref="add_store" />
</action-group>
</actions>
</config>
Para crear nuestra propia acción asignamos al mismo fichero web-client-config-custom.xml la acción con la llamada al script:
<config>
<actions>
<action id="sendStoreNAS">
<label>Enviar a NAS</label>
<image>/images/icons/new_edition_icon.gif</image>
<script>/Company Home/Data Dictionary/Scripts/ContentStoreNAS.js</script>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<action-group id="document_browse_menu">
<action idref="sendStoreNAS" />
</action-group>
</actions>
</config>
Y por último el código en jscript que subiremos a Empresa/Diccionario de datos/Scripts:
Fichero: ContentStoreNAS.js
var document = search.findNode( "workspace://SpacesStore/" + args["id"]);
document.addAspect("cm:storeSelector");
document.properties["cm:storeName"] = "storeNAS";
document.save();
var ret = "<html>" +
"<title></title>" +
"<body>" +
"<script>history.back();</script>" +
"</body>" +
"</html>";
ret;
Ahora para cada documento podemos enviarlo al ContentStore desde el menú emergente de más acciones.
Todavía queda alguna forma más para tratar los documentos con distintos almacenes, según las necesidades y requisitos, todo es cuestión de ponerse...
1 comentario:
Cuando quieras nos ponemos con ello.
Publicar un comentario en la entrada