Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void translationPopupFetchListener(PopupFetchEvent popupFetchEvent) {
- DCIteratorBinding voWorkCodeIterator = ADFUtils.findIterator("VoWorkCodeView1Iterator");
- AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
- if (null != voWorkCodeIterator) {
- Row currentVoWorkCodeRow = voWorkCodeIterator.getCurrentRow();
- if (null != currentVoWorkCodeRow) {
- Integer descriptionStrId = (Integer)currentVoWorkCodeRow.getAttribute("DescriptionStrId");
- System.out.println("DUDE WAT " + descriptionStrId);
- if (null != descriptionStrId) {
- System.out.println("WE IN OR WAT?");
- updateDescriptionTranslationEntries(descriptionStrId);
- } else {
- descriptionStrId = insertDescriptionTranslations();
- currentVoWorkCodeRow.setAttribute("DescriptionStrId", descriptionStrId);
- }
- am.getDBTransaction().postChanges();
- }
- }
- }
- private void updateDescriptionTranslationEntries(Integer strId) {
- System.out.println("WHAT IS THE STR ID " + strId);
- if (null != strId) {
- System.out.println("ARE WE FUCKING IN OR WAT?");
- AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
- ViewObjectImpl bindVarStrView = am.getStrBindVarView1();
- bindVarStrView.clearCache();
- bindVarStrView.setNamedWhereClauseParam("strId", strId);
- bindVarStrView.executeQuery();
- while (bindVarStrView.hasNext()) {
- System.out.println("DUDE FOR REAL?!");
- Row bufRow = bindVarStrView.next();
- String language = (String)bufRow.getAttribute("Language");
- System.out.println("FUCKING LANGUAGE !?!?!!" + language);
- if ("EN".equalsIgnoreCase(language)) {
- setEnDesc((String)bufRow.getAttribute("StrValue"));
- System.out.println("PASSING EN? " + (String)bufRow.getAttribute("StrValue"));
- }
- if ("FR".equalsIgnoreCase(language)) {
- setFrDesc((String)bufRow.getAttribute("StrValue"));
- System.out.println("PASSING FR? " + (String)bufRow.getAttribute("StrValue"));
- }
- if ("DU".equalsIgnoreCase(language)) {
- setDuDesc((String)bufRow.getAttribute("StrValue"));
- System.out.println("PASSING DU? " + (String)bufRow.getAttribute("StrValue"));
- }
- }
- }
- }
- private void updateDescriptionTranslationDbEntries(Integer strId) {
- if (null != strId) {
- AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
- ViewObjectImpl bindVarStrView = am.getStrBindVarView1();
- bindVarStrView.clearCache();
- bindVarStrView.setNamedWhereClauseParam("strId", strId);
- bindVarStrView.executeQuery();
- while (bindVarStrView.hasNext()) {
- Row bufRow = bindVarStrView.next();
- String language = (String)bufRow.getAttribute("Language");
- if ("EN".equalsIgnoreCase(language) && (Integer)bufRow.getAttribute("StrId") == strId) {
- bufRow.setAttribute("StrValue", getEnDesc());
- }
- if ("FR".equalsIgnoreCase(language) && (Integer)bufRow.getAttribute("StrId") == strId) {
- bufRow.setAttribute("StrValue", getFrDesc());
- }
- if ("DU".equalsIgnoreCase(language) && (Integer)bufRow.getAttribute("StrId") == strId) {
- bufRow.setAttribute("StrValue", getDuDesc());
- }
- }
- }
- }
- public void translationDialogListener(DialogEvent dialogEvent) {
- if (dialogEvent.getOutcome() == DialogEvent.Outcome.ok) {
- DCIteratorBinding voWorkCodeViewIterator = ADFUtils.findIterator("VoWorkCodeView1Iterator");
- if (null != voWorkCodeViewIterator ) {
- Row currentVoWorkCodeRow = voWorkCodeViewIterator .getCurrentRow();
- if (null != currentVoWorkCodeRow ) {
- Integer descriptionStrId = (Integer)currentVoWorkCodeRow .getAttribute("DescriptionStrId");
- updateDescriptionTranslationDbEntries(descriptionStrId);
- }
- }
- }
- }
- private Integer insertDescriptionTranslations() {
- AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
- ViewObject genericStrView = am.getStrView1();
- Row enDescRow = genericStrView.createRow();
- enDescRow.setAttribute("Language", "EN");
- Integer descriptionStrId = (Integer)enDescRow.getAttribute("StrId");
- genericStrView.insertRow(enDescRow);
- setEnDesc("");
- Row frDescRow = genericStrView.createRow();
- frDescRow.setAttribute("Language", "FR");
- frDescRow.setAttribute("StrId", descriptionStrId);
- genericStrView.insertRow(frDescRow);
- setFrDesc("");
- Row duDescRow = genericStrView.createRow();
- duDescRow.setAttribute("Language", "DU");
- duDescRow.setAttribute("StrId", descriptionStrId);
- genericStrView.insertRow(duDescRow);
- setDuDesc("");
- return descriptionStrId;
- }
Add Comment
Please, Sign In to add comment