public final Response executeCommand( Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) { try { // retrieve internationalization settings (Resources object)... ServerResourcesFactory factory = (ServerResourcesFactory) context.getAttribute(Controller.RESOURCES_FACTORY); String serverLanguageId = ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(); String t1 = factory .getResources(serverLanguageId) .getResource("there is already another people with the same first and last name."); String t2 = factory .getResources(serverLanguageId) .getResource("there is already another organization with the same corporate name."); String imagePath = (String) ((JAIOUserSessionParameters) userSessionPars) .getAppParams() .get(ApplicationConsts.IMAGE_PATH); Subjects bean = (Subjects) JAIOBeanFactory.getInstance().getBean(Subjects.class); Response answer = null; if (inputPar instanceof PeopleVO) answer = bean.insertPeople( (PeopleVO) inputPar, t1, t2, ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(), userSessionPars.getUsername()); else answer = bean.insertOrganization( (OrganizationVO) inputPar, imagePath, t1, t2, ((JAIOUserSessionParameters) userSessionPars).getServerLanguageId(), userSessionPars.getUsername()); return answer; } catch (Throwable ex) { Logger.error( userSessionPars.getUsername(), this.getClass().getName(), "executeCommand", "Error while processing request", ex); return new ErrorResponse(ex.getMessage()); } }
// Method to add new subject to database public void addSubject(Subjects subject) { ContentValues values = new ContentValues(); values.put(COLUMN_SUBNAME, subject.getSubName()); values.put(COLUMN_MISS, subject.getMissClass()); values.put(COLUMN_TOTAL, subject.getTotClass()); SQLiteDatabase db = getWritableDatabase(); db.insert(TABLE_SUBJECTS, null, values); db.close(); }