package org.alfresco.bluexml;
import org.alfresco.web.bean.BrowseBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.NodePropertyResolver;
import org.alfresco.web.ui.common.Utils;
public class CustomBrowseBean extends BrowseBean {
public CustomBrowseBean() {
super();
resolverFileType16 = new NodePropertyResolver() {
public Object get(Node node) {
String deft = Utils.getFileTypeImage(node.getName(), true);
if (node.getName().substring(0, 3).equalsIgnoreCase("sem")) {
deft.replace("_default", node.getName().replace(":", "_"));
}
return deft;
}
};
resolverFileType32 = new NodePropertyResolver() {
public Object get(Node node) {
String deft = Utils.getFileTypeImage(node.getName(), false);
if (node.getName().substring(0, 3).equalsIgnoreCase("sem")) {
deft.replace("_default", node.getName().replace(":", "_"));
}
return deft;
}
};
}
}
Avez vous une idée ?Overriding managed beans | faces-config-custom.xml in WEB-INFTu confirmes ?
package org.alfresco.bluexml;
public class CustomBrowseBean extends BrowseBean {
private static Logger logger = Logger.getLogger(BrowseBean.class);
public CustomBrowseBean() {
super();
resolverFileType16 = new NodePropertyResolver() {
public Object get(Node node) {
logger.error("INITIALISATION");
String deft = Utils.getFileTypeImage(node.getName(), true);
if (node.getType().toPrefixString().substring(0, 3).equalsIgnoreCase("crm")) {
deft.replace("_default", node.getType().toPrefixString().replace(":", "_"));
}
return deft;
}
};
resolverFileType32 = new NodePropertyResolver() {
public Object get(Node node) {
logger.error("INITIALISATION");
String deft = Utils.getFileTypeImage(node.getName(), false);
if (node.getName().substring(0, 3).equalsIgnoreCase("crm")) {
deft.replace("_default", node.getType().toPrefixString().replace(":", "_"));
}
return deft;
}
};
}
}
2. J'ai ensuite un fichier "faces-config.xml" dans un répertoire "WEB-INF" (même problème si c'est META-INF)<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
<description>
The bean that holds folder browse state.
</description>
<managed-bean-name>CustomBrowseBean</managed-bean-name>
<managed-bean-class>org.alfresco.bluexml.CustomBrowseBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>navigator</property-name>
<value>#{NavigationBean}</value>
</managed-property>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>searchService</property-name>
<value>#{SearchService}</value>
</managed-property>
<managed-property>
<property-name>lockService</property-name>
<value>#{LockService}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
<managed-property>
<property-name>fileFolderService</property-name>
<value>#{FileFolderService}</value>
</managed-property>
</managed-bean>
</faces-config>
3. Jai tout çà dans un fichier JAR que j'ai mis dans le dossier lib de tomcat (tomcatwebappsalfrescoWEB-INFlib).module.id=BlueXMLBrowseBean
module.title=BlueXML Browse Icon
module.description=BlueXML Browse Icon
module.version=1.0
- La définition de mon bean dans : WEB-INF/faces-config-custom.xml<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
<description>
The bean that holds folder browse state.
</description>
<managed-bean-name>BrowseBean</managed-bean-name>
<managed-bean-class>org.alfresco.bluexml.CustomBrowseBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>navigator</property-name>
<value>#{NavigationBean}</value>
</managed-property>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>searchService</property-name>
<value>#{SearchService}</value>
</managed-property>
<managed-property>
<property-name>lockService</property-name>
<value>#{LockService}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
<managed-property>
<property-name>fileFolderService</property-name>
<value>#{FileFolderService}</value>
</managed-property>
</managed-bean>
</faces-config>
Ces 3 fichiers sont dans un JAR que je mets dans le dossier lib. Je lance Alfresco, je vois qu'il charge mon module mais il ne l'utilise pas.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.