use of pl.x3E.adInterface.ProcessParams in project adempiere by adempiere.
the class Process method getProcessParams.
public static ProcessParamsDocument getProcessParams(CompiereService cs, GetProcessParamsDocument req) throws XFireFault {
ProcessParamsDocument res = ProcessParamsDocument.Factory.newInstance();
ProcessParams params = res.addNewProcessParams();
ProcessParamList PL = params.addNewParams();
int AD_Menu_ID = req.getGetProcessParams().getADMenuID();
int AD_Process_ID = req.getGetProcessParams().getADProcessID();
MProcess process = null;
if (AD_Menu_ID > 0 && AD_Process_ID == 0)
process = MProcess.getFromMenu(cs.getM_ctx(), AD_Menu_ID);
else if (AD_Menu_ID == 0 && AD_Process_ID > 0)
process = new MProcess(cs.getM_ctx(), AD_Process_ID, null);
if (process != null) {
params.setDescription(process.getDescription());
params.setHelp(process.getHelp());
params.setName(process.getName());
params.setADProcessID(process.getAD_Process_ID());
MProcessPara[] parameter = process.getParameters();
for (int i = 0; i < parameter.length; i++) {
MProcessPara para = parameter[i];
ProcessParam p = PL.addNewParam();
p.setName(para.getName());
p.setDescription(para.getDescription());
p.setDisplayType(para.getAD_Reference_ID());
p.setIsMandatory(para.isMandatory());
p.setFieldLength(para.getFieldLength());
p.setIsRange(para.isRange());
p.setColumnName(para.getColumnName());
p.setDefaultValue(para.getDefaultValue());
p.setDefaultValue2(para.getDefaultValue2());
if (para.getDefaultValue() != null) {
if (DisplayType.isDate(para.getAD_Reference_ID())) {
if (para.getDefaultValue().indexOf("@#Date@") >= 0) {
//Object t = Env.getContextAsDate( cs.getM_ctx(), "#Date" );
//String t = Env.getContext( cs.getM_ctx(), "#Date" );
String t = cs.dateFormat.format(Env.getContextAsDate(cs.getM_ctx(), "#Date"));
//cs.dateFormat.format( t ));
p.setDefaultValue(t);
}
} else if (DisplayType.YesNo == para.getAD_Reference_ID()) {
if ("Y".equalsIgnoreCase(para.getDefaultValue()))
p.setDefaultValue("true");
else
p.setDefaultValue("false");
}
} else {
if (DisplayType.YesNo == para.getAD_Reference_ID())
p.setDefaultValue("false");
}
if (para.getDefaultValue2() != null) {
if (DisplayType.isDate(para.getAD_Reference_ID())) {
if (para.getDefaultValue2().indexOf("@#Date@") >= 0) {
//Object t = Env.getContextAsDate( cs.getM_ctx(), "#Date" );
//String t = Env.getContext( cs.getM_ctx(), "#Date" );
String t = cs.dateFormat.format(Env.getContextAsDate(cs.getM_ctx(), "#Date"));
//cs.dateFormat.format( t ) );
p.setDefaultValue2(t);
}
}
}
if (para.isLookup()) {
LookupValues lvs = p.addNewLookup();
Lookup lookup = para.getLookup();
try {
ADLookup.fillLookupValues(lvs, lookup, para.isMandatory(), false);
} catch (Exception ex) {
System.out.println("getProcessParams exception: " + ex.getMessage());
ex.printStackTrace();
}
}
}
}
return res;
}
Aggregations