* Insert levels into the hierarchy, for each supported language.
*/
private BigDecimal insertLevels(Connection conn,String serverLanguageId,String username,List langsVO,String[] levelsDesc,String levelsSeparator,HashMap[] treeIndexes,BigDecimal progressiveHIE02,String defCompanyCodeSys01SYS03) throws Throwable {
BigDecimal progressiveHIE01 = null;
BigDecimal parentProgressiveHIE01 = null;
LanguageVO langVO = null;
String sep = levelsSeparator;
if (sep.equals("|"))
sep = "\\|";
String[][] splittedLevelsDesc = new String[langsVO.size()][];
for(int i=0;i<langsVO.size();i++)
splittedLevelsDesc[i] = levelsDesc[i].split(sep);
String aux[] = new String[langsVO.size()];
for(int i=0;i<langsVO.size();i++)
aux[i] = "";
Response res = null;
CompanyHierarchyLevelVO vo = null;
langVO = (LanguageVO)langsVO.get(0);
for(int j=0;j<splittedLevelsDesc[0].length;j++) {
for(int i=0;i<langsVO.size();i++) {
if (j > 0)
aux[i] += levelsSeparator;
aux[i] += splittedLevelsDesc[i][j];
}
progressiveHIE01 = (BigDecimal)treeIndexes[0].get(aux[0]);
if (progressiveHIE01==null) {
// level to insert, for each language...
vo = new CompanyHierarchyLevelVO();
vo.setCompanySys01HIE01(defCompanyCodeSys01SYS03);
vo.setDescriptionSYS10(splittedLevelsDesc[0][j]);
vo.setLevelHIE01(new BigDecimal(j));
vo.setProgressiveHie02HIE01(progressiveHIE02);
vo.setProgressiveHie01HIE01(parentProgressiveHIE01);
res = bean.insertLevel(vo,serverLanguageId,username,defCompanyCodeSys01SYS03);
if (!res.isError()) {
vo = (CompanyHierarchyLevelVO)((VOResponse)res).getVo();
progressiveHIE01 = vo.getProgressiveHIE01();
treeIndexes[0].put(aux[0],progressiveHIE01);
for(int i=0;i<langsVO.size();i++) {
langVO = (LanguageVO)langsVO.get(i);
CompanyTranslationUtils.updateTranslation(vo.getCompanySys01HIE01(),splittedLevelsDesc[0][j],splittedLevelsDesc[i][j],progressiveHIE01,langVO.getLanguageCodeSYS09(),username,conn);
treeIndexes[i].put(aux[i],progressiveHIE01);
}
}
else
throw new Exception(res.getErrorMessage());