use of pl.x3E.adInterface.LookupValue in project adempiere by adempiere.
the class Process method renderOption.
// startFinReport
private static void renderOption(LookupValues lvs, java.util.Hashtable assoc, String idx) {
Object ob = assoc.get(idx);
if (ob == null)
return;
LookupValue lv = lvs.addNewLv();
// o.setValue(idx);
lv.setKey(idx);
lv.setVal(ob.toString());
}
use of pl.x3E.adInterface.LookupValue in project adempiere by adempiere.
the class ADServiceImpl method getCountry.
private LookupValues getCountry(MLocation location) {
MCountry[] countries = MCountry.getCountries(location.getCtx());
int comp = location.getC_Country_ID();
if (comp == 0)
comp = Env.getContextAsInt(m_cs.getM_ctx(), "C_Country_ID");
LookupValues lvs = LookupValues.Factory.newInstance();
for (int i = 0; i < countries.length; i++) {
LookupValue lv = lvs.addNewLv();
lv.setKey(String.valueOf(countries[i].getC_Country_ID()));
lv.setVal(countries[i].getName());
}
return lvs;
}
use of pl.x3E.adInterface.LookupValue in project adempiere by adempiere.
the class ADServiceImpl method login.
public ADLoginResponseDocument login(ADLoginRequestDocument req) throws XFireFault {
authenticate(webServiceName, "login");
// TODO: Implement security layer
log.log(Level.SEVERE, "Warning: Security layer not implemented yet - opening web service " + webServiceName + " implies a security risk for server");
ADLoginResponseDocument res = ADLoginResponseDocument.Factory.newInstance();
ADLoginResponse lr = res.addNewADLoginResponse();
ADLoginRequest r = req.getADLoginRequest();
if (// initial phase - return possible translations
r.getStage() == 0) {
LookupValues langs = lr.addNewLangs();
for (int i = 0; i < Language.getLanguageCount(); i++) {
Language language = Language.getLanguage(i);
LookupValue lv = langs.addNewLv();
lv.setKey(language.getAD_Language());
lv.setVal(language.getName());
}
} else if (// Verify user and pass
r.getStage() == 1) {
KeyNamePair[] roles = null;
KeyNamePair[] clients = null;
KeyNamePair[] orgs = null;
KeyNamePair[] warehouses = null;
Login login = new Login(m_cs.getM_ctx());
roles = login.getRoles(r.getUser(), r.getPass());
if (roles == null) {
lr.setStatus(-1);
return res;
} else {
if (r.getRoleID() == -1 && roles != null && roles.length > 0)
r.setRoleID(Integer.parseInt(roles[0].getID()));
if (r.getRoleID() > -1)
clients = login.getClients(new KeyNamePair(r.getRoleID(), ""));
if (r.getClientID() == -1 && clients != null && clients.length > 0)
r.setClientID(Integer.parseInt(clients[0].getID()));
if (r.getClientID() > -1)
orgs = login.getOrgs(new KeyNamePair(r.getClientID(), ""));
if (r.getOrgID() == -1 && orgs != null && orgs.length > 0)
r.setOrgID(Integer.parseInt(orgs[0].getID()));
if (r.getOrgID() > -1)
warehouses = login.getWarehouses(new KeyNamePair(r.getOrgID(), ""));
ADLookup.fillLookupValues(lr.addNewRoles(), roles);
ADLookup.fillLookupValues(lr.addNewClients(), clients);
ADLookup.fillLookupValues(lr.addNewOrgs(), orgs);
ADLookup.fillLookupValues(lr.addNewWarehouses(), warehouses);
}
} else if (// Verify user and pass
r.getStage() == 2) {
Login login = new Login(m_cs.getM_ctx());
KeyNamePair[] roles = login.getRoles(r.getUser(), r.getPass());
if (roles != null) {
KeyNamePair org = new KeyNamePair(r.getRoleID(), Integer.toString(r.getRoleID()));
String error = login.validateLogin(org);
if (error != null && error.length() > 0) {
lr.setStatus(-1);
return res;
}
int AD_User_ID = Env.getAD_User_ID(m_cs.getM_ctx());
if (!m_cs.login(AD_User_ID, r.getRoleID(), r.getClientID(), r.getOrgID(), r.getWarehouseID(), r.getLang())) {
lr.setStatus(-1);
return res;
}
} else {
lr.setStatus(-1);
return res;
}
}
return res;
}
use of pl.x3E.adInterface.LookupValue in project adempiere by adempiere.
the class ADServiceImpl method fillField.
private void fillField(Field f, GridFieldVO fo) {
////(griddieldvo) adempiere specific
f.setADColumnID(fo.AD_Column_ID);
f.setADProcessID(fo.AD_Process_ID);
f.setADReferenceValueID(fo.AD_Reference_Value_ID);
f.setADWindowID(fo.AD_Window_ID);
f.setCallout(fo.Callout);
f.setColumnName(fo.ColumnName);
f.setDefaultValue(fo.DefaultValue);
f.setDefaultValue2(fo.DefaultValue2);
f.setDescription(fo.Description);
f.setDisplayLength(fo.DisplayLength);
f.setDisplayLogic(fo.DisplayLogic);
f.setDisplayType(fo.displayType);
f.setFieldGroup(fo.FieldGroup);
f.setFieldLength(fo.FieldLength);
f.setHeader(fo.Header);
f.setHelp(fo.Help);
f.setIsAlwaysUpdateable(fo.IsAlwaysUpdateable);
f.setIsDisplayed(fo.IsDisplayed);
f.setIsEncryptedColumn(fo.IsEncryptedColumn);
f.setIsEncryptedField(fo.IsEncryptedField);
f.setIsFieldOnly(fo.IsFieldOnly);
f.setIsHeading(fo.IsHeading);
f.setIsKey(fo.IsKey);
f.setIsMandatory(fo.IsMandatory);
f.setIsParent(fo.IsParent);
f.setIsProcess(fo.isProcess);
f.setIsRange(fo.IsRange);
f.setIsReadOnly(fo.IsReadOnly);
f.setIsSameLine(fo.IsSameLine);
f.setIsSelectionColumn(fo.IsSelectionColumn);
f.setIsUpdateable(fo.IsUpdateable);
if (DisplayType.isLookup(fo.displayType)) {
GridField ff = new GridField(fo);
ArrayList<String> deps = ff.getDependentOn();
Lookup lookup = ff.getLookup();
LookupInfo li = f.addNewLookupInfo();
if (fo.lookupInfo != null) {
li.setZoomWindow(fo.lookupInfo.ZoomWindow);
li.setZoomWindow(fo.lookupInfo.ZoomWindow);
}
//if (deps.size()==0)
if (lookup != null && (fo.ValidationCode == null || (fo.ValidationCode != null && fo.ValidationCode.length() == 0))) {
LookupValues lvs = f.addNewLookup();
//System.out.println( "lookup "+fo.ColumnName+" "+lookup.getSize() );
//if(lookup.size() == 0) - nie robic tego
// System.out.println("lookup refresh ["+fo.ColumnName+"]= "+lookup.refresh());
/*if(lookup.getSize() > 0)*/
// the last was false, 2007-05-11
ArrayList ar = lookup.getData(ff.isMandatory(false), true, !ff.isReadOnly(), true);
if (ar != null && ar.size() > 0) {
Object[] list = ar.toArray();
for (int i = 0; i < list.length; i++) {
boolean isNumber = list[0] instanceof KeyNamePair;
LookupValue lv = lvs.addNewLv();
if (isNumber) {
KeyNamePair p = (KeyNamePair) list[i];
lv.setKey(Integer.toString(p.getKey()));
lv.setVal(p.getName());
//System.out.println( "LV " + p.getKey() + " - "+ p.getName() );
} else {
ValueNamePair p = (ValueNamePair) list[i];
lv.setKey(p.getValue());
lv.setVal(p.getName());
//System.out.println( "LV " + p.getValue() + " - "+ p.getName());
}
}
}
}
}
}
use of pl.x3E.adInterface.LookupValue in project adempiere by adempiere.
the class ADServiceImpl method getRegion.
private LookupValues getRegion(MLocation location) {
MRegion[] regions = MRegion.getRegions(location.getCtx(), location.getC_Country_ID());
int comp = location.getC_Region_ID();
if (comp == 0)
comp = Env.getContextAsInt(m_cs.getM_ctx(), "C_Region_ID");
LookupValues lvs = LookupValues.Factory.newInstance();
for (int i = 0; i < regions.length; i++) {
LookupValue lv = lvs.addNewLv();
lv.setKey(String.valueOf(regions[i].getC_Region_ID()));
lv.setVal(regions[i].getName());
}
return lvs;
}
Aggregations