Quel est le besoin ?
Votre problème n'est en rien lié à Alfresco, mais plutôt aux bases du langage Java.
<constraints>
<constraint name="community:LanguageConstraint" type="org.alfresco.community.constraint.ListLanguageConstraint">
<parameter name="allowedValues">
<list>
</list>
</parameter>
<parameter name="caseSensitive"><value>true</value></parameter>
</constraint>
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<property type="config">
<!– Database properties –>
<dbhost>localhost</dbhost>
<dbport>3306</dbport>
<dbname>alfresco</dbname>
<dbuser>alfresco</dbuser>
<dbpasswd>password</dbpasswd>
<dbclass>org.gjt.mm.mysql.Driver</dbclass>
<jdbcdriver>jdbc:mysql</jdbcdriver>
<!–dbclass>org.postgresql.Driver</dbclass–>
<!–jdbcdriver>jdbc:postgresql</jdbcdriver–>
<!– Workflow properties –>
<wkfluser>workflow</wkfluser>
<wkflpasswd>password</wkflpasswd>
<!– Debug properties –>
<debug>true</debug>
<level>4</level>
<!– Application properties –>
<version>2.1.b1</version>
<tag>Approved by Alfresco System (Development Beta 1)</tag>
<!– Fonts properties –>
<fontpath>C:\Windows\Fonts</fontpath>
<font>Tahoma.ttf</font>
<fontbold>Tahomabd.ttf</fontbold>
<copyrightfont>Arial.ttf</copyrightfont>
<reffontsize>7</reffontsize>
<inffontsize>7</inffontsize>
<!– Document Reference Position –>
<posx>25</posx>
<posy>13</posy>
<logo>images\logo\AlfrescoLogo32.jpg</logo>
</property>
</config>
package org.alfresco.community.constraint;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.community.utility.db.DbUtils;
import org.alfresco.community.utility.db.SqlHelper;
import org.alfresco.community.config.GetConfig;
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class ListLanguageConstraint extends ListOfValuesConstraint {
private static Log logger = LogFactory.getLog("org.alfresco.community.constraint.DbUtils");
public ListLanguageConstraint() {
super();
logger.debug("Appel superConstructeur");
// SetallowedValues(getSubsisiary());
}
public List <String> getAllowedValues() {
logger.debug("getAllowedValues");
return super.getAllowedValues();
}
public void setAllowedValues(List allowedValues)
{
if (allowedValues == null)
{
allowedValues=getLanguage();
}
logger.debug("setAllowedValues Avant super.set");
super.setAllowedValues(allowedValues);
logger.debug("setAllowedValues Après super.set");
}
/**
*
* @return
*/
private ArrayList<String> getLanguage(){
ArrayList<String>language=null;
Connection conn=null;
try{
GetConfig.init(); // Méthode de chargement du fichier XML en mémoire
conn = DbUtils.getDBConnection();
language = SqlHelper.getAllLanguage(conn);
DbUtils.closeDBConnection(conn);
}
catch(Exception e){
logger.error(e.getMessage());
}
return language;
}
}
package org.alfresco.community.utility.db;
import java.sql.*;
import org.alfresco.community.config.GetConfig;
public class DbUtils {
public static Connection getDBConnection() throws Exception {
Connection con = null;
try {
Class.forName(GetConfig.dbClass()); //MySQL Driver
con = DriverManager.getConnection(GetConfig.dbConnection(),GetConfig.dbUser(),GetConfig.dbPasswd());
return con;
}
catch(Exception e){
e.printStackTrace();
}
return null;
}
public static void closeDBConnection(Connection con) throws SQLException {
try {
con.close();
}
catch(Exception e){
e.printStackTrace();
}
}
}
Bonjour,
A priori n'importe quel bean déclaré dans la configuration Spring sera instancié au démarrage. On peut en plus déclarer dans son élément bean une "init-method" pour appeler une méthode d'initialisation particulière.
Bonjour,
A priori n'importe quel bean déclaré dans la configuration Spring sera instancié au démarrage. On peut en plus déclarer dans son élément bean une "init-method" pour appeler une méthode d'initialisation particulière.
<bean id="CheckInOutBean" class="org.alfresco.community.web.bean.CheckInOutBean" init-method="init"></bean>
<bean id="GetConfig" class="org.alfresco.community.config.GetConfig" init-method="init"></bean>
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.