private void init() { if (language.getId() != null) { Map param = new HashMap(); param.put("languageCode", language.getCode()); languageTrlList = languageTrlService.selectByExample(param); List<Language> list = languageService.selectByExample(null); List<Language> noList = new ArrayList<Language>(); if (languageTrlList == null || languageTrlList.size() == 0) { languageTrlList = new ArrayList<LanguageTrl>(); noList = list; } else { for (Language lang : list) { boolean has = false; for (LanguageTrl trl : languageTrlList) { if (trl.getLanguage().equals(lang.getCode())) { has = true; break; } } if (!has) { noList.add(lang); } } } for (Language lang : noList) { LanguageTrl trl = new LanguageTrl(); trl.setLanguage(lang.getCode()); trl.setLanguageCode(language.getCode()); languageTrlList.add(trl); } } }
/* (non-Javadoc) * @see com.delmar.core.web.action.CoreEditPrivAction#saveForm() */ @Override public String saveForm() { if (!language.isnew()) { language.setCode(null); } languageService.saveLanguage(language, this.languageTrlList); this.id = language.getId(); editForm(); return "edit"; }
/* (non-Javadoc) * @see com.delmar.core.web.action.CoreEditPrivAction#deleteList(java.lang.Integer[]) */ @Override public void deleteList(Integer[] ids) { languageService.deleteLanguageList(ids); }
/* (non-Javadoc) * @see com.delmar.core.web.action.CoreEditPrivAction#delete() */ @Override public String delete() { languageService.deleteByPrimaryKey(language.getId()); return "list"; }
/* (non-Javadoc) * @see com.delmar.core.web.action.CoreEditPrivAction#search() */ @Override public List search() { return languageService.selectByExample(null); }
/* (non-Javadoc) * @see com.delmar.core.web.action.CoreEditPrivAction#editForm() */ @Override public void editForm() { language = languageService.selectByPrimaryKey(id); init(); }