Software

Anuncio
Software
ILOG JRULES 7.1.1 with Spanish Pack
Database Engine: SQL Server 2005 Express Edition and Access 2003
The same behavior happen with a catalog in SQL server and Access
1- First Image example catalog SQL Server 2005 is only a example for the test
2- The java class that make the connection and the query in the plugin
package catalogosdinamicos;
import ilog.rules.bom.IlrClass;
import ilog.rules.vocabulary.model.bom.IlrBOMDomainValueProvider;
import
import
import
import
import
import
java.util.ArrayList;
java.util.Collection;
java.util.HashSet;
java.util.Locale;
java.util.Map;
java.sql.*;
public class Cmarca implements IlrBOMDomainValueProvider {
public void dispose() {
// TODO Auto-generated method stub
}
public String getBOM2XOMMapping(String valueName) {
return "return \"" + valueName + "\";";
}
public String getDisplayText(String arg0, Locale arg1) {
return arg0;
}
public String getDocumentation(String arg0, Locale arg1) {
// TODO Auto-generated method stub
return null;
}
public Map getProperties(String arg0) {
// TODO Auto-generated method stub
return null;
}
public String getTranslation(String arg0) {
// TODO Auto-generated method stub
return null;
}
public Collection<String> getValues(IlrClass ilrClass) {
ArrayList<String> list = new ArrayList<String>(); // Creaci�e
un objeto lista de string
String i;
HashSet<String> domainValues = new HashSet<String>(); //se
crea una tabla
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //se
registra el driver
Connection conexion =
DriverManager.getConnection("jdbc:sqlserver://localhost:1433;
databaseName = catalogosPrueba; user = sa; password = admin#2589;");
//URL de Conexion
Statement st = conexion.createStatement(); //Objeto para
hacer la consulta
ResultSet rs = st.executeQuery("select marca from
catalogoMarca"); //se hace la consulta y se guarda en un ruleset
while ( rs.next() )
//se lee el resultset
{
i =(String)rs.getObject(1);
list.add(i);
// se a� el valor de la
fila a un objeto de tipo lista
}
domainValues.addAll(list); //se a� al dominio la lista de
objetos
conexion.close(); //se cierra la conesssxi�
}
catch (Exception e) {
}
return domainValues;
los dominios
}
}
//se retorna la lista que contiene
3- Image with the behavior look the following image at the first sync the domain
look normal the values of the row 10 to 13 that have blanks space Jrules fill that
spaces with the char “_”.
4- For example I refresh my catalog with new members and I want to reflect those changes in jrules see what happens when I sync again.
Jrules sync again those members that have space See the image below. The error message was the following
The bom not find the attribute xxxxxx referenced in the domain
5- Let look what happen with a rule that use this domain. The members that have
space not display.
Descargar