}
private void init() {
// define date formats...
Domain df = new Domain("DATE_FORMAT");
df.addDomainPair("dd-MM-yyyy","dd-MM-yyyy");
df.addDomainPair("dd/MM/yyyy","dd/MM/yyyy");
df.addDomainPair("ddMMyyyy","ddMMyyyy");
df.addDomainPair("yyyy-MM-dd","yyyy-MM-dd");
df.addDomainPair("yyyy/MM/dd","yyyy/MM/dd");
df.addDomainPair("yyyyMMdd","yyyyMMdd");
colDateFormat.setDomain(df);
// define the domain about data import type:
// - add all item types
Domain dit = new Domain("DATA_IMPORT_TYPE");
int pos = 0;
DataImportType ditVO = null;
java.util.List itemTypesList = null;
Response res = ClientUtils.getData("loadItemTypes",new GridParams());
if (!res.isError()) {
ItemTypeVO vo = null;
itemTypesList = ((VOListResponse)res).getRows();
for(int i=0;i<itemTypesList.size();i++) {
vo = (ItemTypeVO)itemTypesList.get(i);
ditVO = new DataImportType();
ditVO.comboItemIndex = pos++;
ditVO.progressiveHIE02 = vo.getProgressiveHie02ITM02();
ditVO.subTypeCode = vo.getProgressiveHie02ITM02();
ditVO.className = ImportItemsDescriptorVO.class.getName();
ditVO.companyCodeSys01 = vo.getCompanyCodeSys01ITM02();
dit.addDomainPair(
ditVO,
ClientSettings.getInstance().getResources().getResource("import")+" "+vo.getDescriptionSYS10()
);
}
}
// add to the domain about data import type:
// - customers
ClientApplet applet = ( (ApplicationClientFacade) MDIFrame.getInstance().getClientFacade()).getMainClass();
ButtonCompanyAuthorizations bca = applet.getAuthorizations().getCompanyBa();
ArrayList companiesList = bca.getCompaniesList("SAL07");
for(int i=0;i<companiesList.size();i++) {
if (applet.getAuthorizations().getCompanyBa().isInsertEnabled("SAL07",companiesList.get(i).toString())) {
ditVO = new DataImportType();
ditVO.comboItemIndex = pos++;
ditVO.className = ImportCustomersDescriptorVO.class.getName();
ditVO.companyCodeSys01 = companiesList.get(i).toString();
dit.addDomainPair(
ditVO,
ClientSettings.getInstance().getResources().getResource("import")+" "+ClientSettings.getInstance().getResources().getResource("customers")+" "+companiesList.get(i).toString()
);
}
}
// add to the domain about data import type:
// - sale pricelists
res = ClientUtils.getData("loadPricelists",new GridParams());
if (!res.isError()) {
PricelistVO vo = null;
java.util.List list = ((VOListResponse)res).getRows();
for(int i=0;i<list.size();i++) {
vo = (PricelistVO)list.get(i);
ditVO = new DataImportType();
ditVO.comboItemIndex = pos++;
ditVO.subTypeCode = vo.getPricelistCodeSAL01();
ditVO.className = ImportSalePricesDescriptorVO.class.getName();
ditVO.companyCodeSys01 = vo.getCompanyCodeSys01SAL01();
dit.addDomainPair(
ditVO,
ClientSettings.getInstance().getResources().getResource("import sale prices")+" "+
ClientSettings.getInstance().getResources().getResource("for pricelist")+" "+vo.getDescriptionSYS10()
);
}
}
// add to the domain about data import type:
// - supplier items
res = ClientUtils.getData("loadSuppliers",new GridParams());
if (!res.isError()) {
GridSupplierVO vo = null;
ItemTypeVO itemTypeVO = null;
java.util.List list = ((VOListResponse)res).getRows();
for(int i=0;i<list.size();i++) {
vo = (GridSupplierVO)list.get(i);
for(int j=0;j<itemTypesList.size();j++) {
itemTypeVO = (ItemTypeVO)itemTypesList.get(j);
ditVO = new DataImportType();
ditVO.comboItemIndex = pos++;
ditVO.subTypeCode = vo.getProgressiveREG04();
ditVO.subTypeCode2 = itemTypeVO.getProgressiveHie02ITM02();
ditVO.progressiveHIE02 = itemTypeVO.getProgressiveHie02ITM02();
ditVO.className = ImportSupplierItemsDescriptorVO.class.getName();
ditVO.companyCodeSys01 = vo.getCompanyCodeSys01REG04();
dit.addDomainPair(
ditVO,
ClientSettings.getInstance().getResources().getResource("import")+" "+
itemTypeVO.getDescriptionSYS10()+" "+
ClientSettings.getInstance().getResources().getResource("for supplier")+" "+
vo.getName_1REG04()
);
}
}
}
// add to the domain about data import type:
// - supplier prices
res = ClientUtils.getData("loadSupplierPricelists",new GridParams());
if (!res.isError()) {
SupplierPricelistVO vo = null;
java.util.List list = ((VOListResponse)res).getRows();
for(int i=0;i<list.size();i++) {
vo = (SupplierPricelistVO)list.get(i);
ditVO = new DataImportType();
ditVO.comboItemIndex = pos++;
ditVO.subTypeCode = vo.getPricelistCodePUR03();
ditVO.subTypeCode2 = vo.getProgressiveReg04PUR03();
ditVO.className = ImportSupplierPricesDescriptorVO.class.getName();
ditVO.companyCodeSys01 = vo.getCompanyCodeSys01PUR03();
dit.addDomainPair(
ditVO,
ClientSettings.getInstance().getResources().getResource("import prices")+" "+
ClientSettings.getInstance().getResources().getResource("for supplier")+" "+
vo.getName_1REG04()+" "+
ClientSettings.getInstance().getResources().getResource("in pricelist")+" "+vo.getDescriptionSYS10()
);
}
}
controlImportType.setDomain(dit);
controlImportType.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange()==e.SELECTED) {
DataImportType vo = (DataImportType)controlImportType.getValue();
ETLProcessVO processVO = (ETLProcessVO)mainPanel.getVOModel().getValueObject();
processVO.setCompanyCodeSys01SYS23(vo.companyCodeSys01);
processVO.setClassNameSYS23(vo.className);
processVO.setProgressiveHIE02(vo.progressiveHIE02);
processVO.setSubTypeValueSYS23(vo.subTypeCode);
processVO.setSubTypeValue2SYS23(vo.subTypeCode2);
grid.clearData();
grid.getOtherGridParams().put(ApplicationConsts.FILTER_VO,processVO);
grid.reloadData();
grid.setMode(Consts.EDIT);
controlDescr.setValue(controlImportType.getComboBox().getSelectedItem());
}
}
});
Domain d = new Domain("FILE_TYPES");
d.addDomainPair(XLS,"Excel");
d.addDomainPair(CSV1,"CSV(;)");
d.addDomainPair(CSV2,"CSV(,)");
d.addDomainPair(TXT,"Txt file");
controlFormat.setDomain(d);
controlFormat.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange()==e.SELECTED) {