<%@page import="java.util.*,java.io.*,org.alfresco.repo.dictionary.*,org.alfresco.service.cmr.dictionary.DictionaryException,org.alfresco.service.namespace.*" %>
<%
org.springframework.context.ApplicationContext ctx = org.springframework.web.jsf.FacesContextUtils.getWebApplicationContext(javax.faces.context.FacesContext.getCurrentInstance());
//out.print(ctx.toString());
org.alfresco.repo.dictionary.DictionaryDAO dao = (org.alfresco.repo.dictionary.DictionaryDAO)ctx.getBean("dictionaryDAO");
String bootstrapModel ;
bootstrapModel =request.getParameter("model") ;
if ( bootstrapModel != null )
{
java.io.InputStream modelStream = getClass().getClassLoader().getResourceAsStream(bootstrapModel);
if (modelStream == null) {
throw new DictionaryException("Could not find bootstrap model " + bootstrapModel);
}
M2Model model = M2Model.createModel(modelStream);
dao.putModel(model);
%>
<br>
reload MODEL <%=bootstrapModel%> OK <%= new Date().toString() %>
<%}
else
{
%>
usage: http://localhost:8080/alfresco/faces/jsp/_dev/reloadModel.jsp?model=nom du fichier.
<br>
example : http://localhost:8080/alfresco/faces/jsp/_dev/reloadModel.jsp?model=chemin de ton nouveau model
<% }
%>
ensuite tu lance dans le browseur ta page de la maniére suivanteInputStream is =getClass().getClassLoader().getResourceAsStream("chemin vers un ficher de config d'un modele");
M2Model model = M2Model.createModel(is); //création du modele
dictionaryDAO.putModel(model); //chargement
Pour recharger un modele pendant qu'alfresco tourne tu peux le faire soit via une jsp (voir post d'avant) soit via une classe java indépendante d'alfresco et que tu lance comme une appli normale.<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml,/WEB-INF/faces-config-wcm.xml,/WEB-INF/faces-config-enterprise.xml,WEB-INF/faces-config-custom.xml</param-value>
</context-param>
autres fichiers de config <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:alfresco/web-client-application-context.xml
classpath:web-services-application-context.xml
classpath:alfresco/web-api-application-context.xml
classpath:alfresco/application-context.xml
</param-value>
<description>Spring config file locations</description>
</context-param>
dans le fichier application-context.xml tu trouve la ligne<import resource="classpath*:alfresco/extension/*-context.xml"/>
ce qui te permet de définir un fichier custom-model-context.xml dans le repertoire alfresco/extension/ qui reprenda les chemins de tes fichiers de modele<beans>
<!– Registration of new models –>
<bean id="myModels" parent="dictionaryModelBootstrap">
<property name="models">
<list>
<!– New Aspect Model –>
<!–
<value>alfresco/extension/gesdos/IdentificationModel.xml</value>
<value>chemin de fichier modele</value>
……………….
………………
</list>
</property>
</bean>
</beans>
.
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.