Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void saveData() {
- printCurrentPerson();
- log.debug("Check SAVE PERSON!");
- AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
- //Avoid poi savePosition loop when saving person
- PoiManager poiManager = (PoiManager)JSFUtils.getManagedBeanValue("poiManagerBean");
- poiManager.resetControlFrame();
- printCurrentPerson();
- //GET ROW
- Row personRow = am.getEditPersonView1().getCurrentRow();
- String name =
- (String)personRow.getAttribute("LastName") + " " + (String)personRow.getAttribute("FirstName"); /// NPE
- printCurrentPerson();
- int status = 0;
- if ((Integer)personRow.getAttribute("PersonStatusId") == 1)
- status = 2;
- addKeyIfInputTextsAreNotEmpty();
- //Update person category
- updatePersonCategory(am, personRow);
- if (savePressed) {
- CallableStatement st = null;
- String statement =
- "begin ? := p_person_history.create_person_histories(?,?,null,null,?,null,?,?,null,?,?,?,?); end;";
- st = am.getDBTransaction().createCallableStatement(statement, 0);
- Integer result = null;
- try {
- st.registerOutParameter(1, Types.INTEGER);
- st.setInt(2, (Integer)personRow.getAttribute("PersonId")); //PERSON_ID
- st.setDate(3, new java.sql.Date(new java.util.Date().getTime()));
- st.setInt(4, UserBean.getCurrent().getUserId());
- st.setString(5, "Prod TRAXXEO person update " + UserBean.getCurrent().getUserId());
- st.setString(6, UserBean.getCurrent().getUserTimeZone());
- st.setString(7, (String)ADFContext.getCurrent().getSessionScope().get("person_is_admin_status_ok_old"));
- st.setString(8, (String)personRow.getAttribute("IsAdminStatusOk"));
- st.setString(9, (String)ADFContext.getCurrent().getSessionScope().get("person_is_blacklisted_old"));
- st.setString(10, (String)personRow.getAttribute("IsBlacklisted"));
- st.execute();
- result = st.getInt(1);
- log.debug("result " + result);
- } catch (SQLException e) {
- log.error(e.getMessage(), e);
- } finally {
- if (st != null) {
- try {
- st.close();
- } catch (Exception e) {
- }
- }
- }
- // personRow.setAttribute("LmDate", new java.sql.Timestamp(new java.util.Date().getTime()));
- poiManager.updatePersonCategory((Integer)personRow.getAttribute("VoPersonCategoryId"));
- poiManager.saveData(name, (String)personRow.getAttribute("CompanyNr"), status, false);
- printCurrentPerson();
- ADFContext.getCurrent().getSessionScope().put("person_is_admin_status_ok_old",personRow.getAttribute("IsAdminStatusOk"));
- ADFContext.getCurrent().getSessionScope().put("person_is_blacklisted_old",personRow.getAttribute("IsBlacklisted"));
- //Avoid save loop
- String source = getSourceUrl(poiManager.getGviewControlUrl());
- poiManager.getControlFrame().setSource(source);
- System.out.println(poiManager.getGviewControlUrl() + " DISPLAYING THE URL zzz");
- // //Check if user has access to person. Insert into GU_PERSON if not the case
- // am.checkGuPerson(UserBean.getCurrent().getUserId(), (Integer)personRow.getAttribute("PersonId"));
- ContextBean.getCurrent().setSelectedPersonId((Integer)personRow.getAttribute("PersonId"));
- printCurrentPerson();
- am.getPersonView1().executeQuery();
- editPerson(this.visibleTab);
- Row homePoi = am.getEditPoiView1().getCurrentRow();
- Object latitude = homePoi.getAttribute("Wgs84Latitude");
- boolean isAddressExisting = isAddressExisting(homePoi);
- System.out.println(" LATITUDEEE " + latitude + "is address existing" + isAddressExisting);
- if (latitude == null && isAddressExisting) {
- openGeocodePopup();
- }
- } else {
- PoiResult poi = (PoiResult)ADFContext.getCurrent().getSessionScope().get("currentEditedPOI");
- poiManager.setJSON(poi);
- printCurrentPerson();
- }
- log.debug("~Check SAVE PERSON!");
- savePressed = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement