Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Gets selected row in the table. Only if the event is a badge (Check on event_type_id)
- * call procedure P_PERSON_DATA.delete_user_event(p_vehicle_data_id);
- * The procedure will change the event_type_id to 230 and the icon from ID will be changed to deleted ID
- * for tests only call post changes but when its done replace the post changes with commit.
- * After that execute the current query to refresh the table.
- */
- public void deleteBadgeByUser() {
- AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
- DCIteratorBinding vehicleTrackingIterator = ADFUtils.findIterator("VVehicleTrackingView1Iterator");
- if (null != vehicleTrackingIterator) {
- Row currentTrackingRow = vehicleTrackingIterator.getCurrentRow();
- if (null != currentTrackingRow) {
- Integer eventTypeId = (Integer)currentTrackingRow.getAttribute("EventTypeId");
- if (null != eventTypeId) {
- if (eventTypeId == 230) {
- Integer vehicleDataId = (Integer)currentTrackingRow.getAttribute("EventId");
- if (null != vehicleDataId) {
- String procedure = "OF_OWNER.P_PERSON_DATA.delete_user_event(?)";
- String statement = "BEGIN " + procedure + "; END;";
- CallableStatement callableStatement =
- am.getDBTransaction().createCallableStatement(statement, 0);
- try {
- callableStatement.setInt(1, vehicleDataId);
- callableStatement.executeUpdate();
- } catch (SQLException e) {
- log.error(e.getMessage(), e);
- } finally {
- try {
- callableStatement.close();
- } catch (SQLException se) {
- log.error(se.getMessage(), se);
- }
- }
- vehicleTrackingIterator.executeQuery();
- UIComponent tdata = JSFUtils.findComponentInRoot("tdata");
- if (null != tdata) {
- AdfFacesContext.getCurrentInstance().addPartialTarget(tdata);
- }
- }
- } else {
- BuildixxUtils.addErrorMessage("Please select a BADGE event!");
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment