List of usage examples for java.util HashMap clear
public void clear()
From source file:com.ardhi.businessgame.services.BusinessGameService.java
public String loadInstallmentOwnedByEquipment(HttpServletRequest req) { String val = "0", hiElement = "", equipmentType; double hiVal = 0, tmpd1, tmpd2; int eff;/*from w w w. j a v a 2 s . c o m*/ SqlRowSet srs1 = db.getJdbc() .queryForRowSet("select equipment from list_equipment,desc_equipment where list_equipment.id='" + req.getParameter("id") + "' and list_equipment.[desc]=desc_equipment.id"), srs2, srs3; HashMap<String, Double> elementsRatio = new HashMap<String, Double>(), elements = new HashMap<String, Double>(), elementsCalc = new HashMap<String, Double>(); ArrayList<Installment> installments = new ArrayList<Installment>(); boolean pass = false; srs1.next(); equipmentType = srs1.getString("equipment"); srs1 = db.getJdbc().queryForRowSet( "select installment.id,[zone],type,draw,active from info_sector_equipment,installment,info_sector where equipment_type='" + equipmentType + "' and [user]='" + req.getParameter("user") + "' and [zone]=(select [zone] from businessgame.dbo.[user] where name='" + req.getParameter("user") + "') and installment.type=sector and type=name"); while (srs1.next()) { hiElement = ""; hiVal = 0; elementsRatio.clear(); elements.clear(); elementsCalc.clear(); pass = true; srs2 = db.getJdbc() .queryForRowSet("select equipment_type,items from info_sector_equipment where sector='" + srs1.getString("type") + "'"); while (srs2.next()) { elementsRatio.put(srs2.getString("equipment_type"), srs2.getDouble("items")); if (hiVal < srs2.getDouble("items")) { hiElement = srs2.getString("equipment_type"); hiVal = srs2.getDouble("items"); } srs3 = db.getJdbc().queryForRowSet( "select count(installment_equipment.id) from installment_equipment,list_equipment,desc_equipment where installment='" + srs1.getString("id") + "' and desc_equipment.equipment='" + srs2.getString("equipment_type") + "' and installment_equipment.id=list_equipment.id and list_equipment.[desc]=desc_equipment.id"); srs3.next(); elements.put(srs2.getString("equipment_type"), srs3.getDouble(1)); } srs2 = db.getJdbc().queryForRowSet("select employee_type,items from info_sector_employee where sector='" + srs1.getString("type") + "'"); while (srs2.next()) { elementsRatio.put(srs2.getString("employee_type"), srs2.getDouble("items")); if (hiVal < srs2.getDouble("items")) { hiElement = srs2.getString("employee_type"); hiVal = srs2.getDouble("items"); } srs3 = db.getJdbc().queryForRowSet( "select count(installment_employee.id) from installment_employee,list_employee,desc_employee where installment='" + srs1.getString("id") + "' and desc_employee.employee='" + srs2.getString("employee_type") + "' and installment_employee.id=list_employee.id and list_employee.[desc]=desc_employee.id"); srs3.next(); elements.put(srs2.getString("employee_type"), srs3.getDouble(1)); } //calculating: while (true) { for (String element : elementsRatio.keySet()) { if (element.equals(hiElement)) { elementsCalc.put(element, elements.get(element)); } else { elementsCalc.put(element, (elementsRatio.get(element) * elements.get(hiElement)) / elementsRatio.get(hiElement)); } } for (String element : elements.keySet()) { if (elements.get(element) < elementsCalc.get(element)) { pass = false; hiElement = element; hiVal = elements.get(element); break; } else { pass = true; } } if (pass) { eff = elements.get(hiElement).intValue() / elementsRatio.get(hiElement).intValue(); if (elements.get(hiElement) % elementsRatio.get(hiElement) > 0) { hiVal = (elementsRatio.get(hiElement) * (eff + 1)); if (hiVal > 0) tmpd1 = new BigDecimal(Double.valueOf( elementsCalc.get(hiElement) / (elementsRatio.get(hiElement) * (eff + 1)))) .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); else tmpd1 = 0; tmpd2 = eff + 1; } else { hiVal = (elementsRatio.get(hiElement) * eff); if (hiVal > 0) tmpd1 = new BigDecimal(Double .valueOf(elementsCalc.get(hiElement) / (elementsRatio.get(hiElement) * eff))) .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); else tmpd1 = 0; tmpd2 = eff; } installments.add( new Installment(srs1.getString("id"), srs1.getString("type"), srs1.getString("zone"), tmpd1, tmpd2, srs1.getString("draw"), srs1.getBoolean("active"))); break; } } } val = gson.toJson(installments); hiElement = null; elementsRatio = null; elements = null; elementsCalc = null; installments = null; gc(); return val; }
From source file:com.krawler.spring.hrms.rec.job.hrmsRecJobController.java
public ModelAndView editProspect(HttpServletRequest request, HttpServletResponse response) { Date joiningdate = null;//w w w . j a v a 2s .c o m DateFormat formatter; formatter = new SimpleDateFormat("MM/dd/yyyy"); KwlReturnObject result = null; JSONObject jobj1 = new JSONObject(); String appnames = ""; //Create transaction DefaultTransactionDefinition def = new DefaultTransactionDefinition(); def.setName("JE_Tx"); def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED); TransactionStatus status = txnManager.getTransaction(def); try { String[] ids = request.getParameterValues("ids"); String[] cnames = request.getParameterValues("cnames"); String[] positionids = request.getParameterValues("positionids"); String applicantStatus = request.getParameter("selected"); HashMap<String, Object> requestParams = new HashMap<String, Object>(); HashMap<String, Object> appParams = new HashMap<String, Object>(); for (int i = 0; i < ids.length; i++) { requestParams.clear(); requestParams.put("positionid", positionids[i]); requestParams.put("primary", true); result = hrmsRecJobDAOObj.getPositionmain(requestParams); Positionmain position = null; if (StringUtil.checkResultobjList(result)) { position = (Positionmain) result.getEntityList().get(0); } requestParams.clear(); requestParams.put("id", ids[i]); requestParams.put("primary", true); result = hrmsRecJobDAOObj.getPositionstatus(requestParams); appParams.put("id", ids[i]); Allapplications appl = null; if (StringUtil.checkResultobjList(result)) { appl = (Allapplications) result.getEntityList().get(0); } // Allapplications appl = (Allapplications) session.load(Allapplications.class, ids[i]); // Positionmain position = (Positionmain) session.load(Positionmain.class, positionids[i]); if (StringUtil.isNullOrEmpty(request.getParameter("callback")) == false) { appParams.put("callback", request.getParameter("callback")); // appl.setCallback((MasterData) session.load(MasterData.class, request.getParameter("callback"))); } if (StringUtil.isNullOrEmpty(applicantStatus)) { } else { // appl.setStatus(request.getParameter("status")); appParams.put("status", applicantStatus); if (applicantStatus.equalsIgnoreCase("Rejected")) { if (appl.getApplicationflag() == 1 && position.getPositionsfilled() > 0) { requestParams.clear(); requestParams.put("positionid", positionids[i]); requestParams.put("positionsfilled", position.getPositionsfilled() - 1); requestParams.put("delflag", 0); hrmsRecJobDAOObj.updatePositionmain(requestParams); // position.setPositionsfilled(position.getPositionsfilled()-1); // position.setDelflag(0); // session.update(position); } appParams.put("applicationflag", 2); appParams.put("rejectedbefore", 1); // appl.setApplicationflag(2); // appl.setRejectedbefore(1); } else if (applicantStatus.equalsIgnoreCase("Selected")) { joiningdate = (Date) formatter.parse(request.getParameter("joiningdate")); if (appl.getApplydate() != null && joiningdate != null && appl.getApplydate().compareTo(joiningdate) < 0) { // appl.setApplicationflag(1); appParams.put("applicationflag", 1); if (Boolean.parseBoolean(request.getParameter("changeselected"))) { requestParams.clear(); requestParams.put("positionid", positionids[i]); if (position.getNoofpos() >= position.getPositionsfilled() + 1) { if (position.getNoofpos() == position.getPositionsfilled() + 1) { requestParams.put("delflag", 3); // position.setDelflag(3); } // position.setPositionsfilled(position.getPositionsfilled() + 1); requestParams.put("positionsfilled", position.getPositionsfilled() + 1); } // session.update(position); hrmsRecJobDAOObj.updatePositionmain(requestParams); } if (!StringUtil.isNullOrEmpty(request.getParameter("joiningdate"))) { joiningdate = (Date) formatter.parse(request.getParameter("joiningdate")); // appl.setJoiningdate(joiningdate); appParams.put("joiningdate", joiningdate); } } } else { if (appl.getApplicationflag() == 1 && position.getPositionsfilled() >= 0) { requestParams.clear(); // position.setPositionsfilled(position.getPositionsfilled()-1); // position.setDelflag(0); // session.update(position); requestParams.put("positionid", positionids[i]); requestParams.put("positionsfilled", position.getPositionsfilled() - 1); requestParams.put("delflag", 0); hrmsRecJobDAOObj.updatePositionmain(requestParams); } // appl.setApplicationflag(0); appParams.put("applicationflag", 0); } } if (StringUtil.isNullOrEmpty(request.getParameter("rank")) == false) { // appl.setRank((MasterData) session.load(MasterData.class, request.getParameter("rank"))); appParams.put("rank", request.getParameter("rank")); } if (!StringUtil.isNullOrEmpty(request.getParameter("statuscomment"))) { // appl.setStatuscomment(request.getParameter("statuscomment")); appParams.put("statuscomment", request.getParameter("statuscomment")); } String usrnm; if (appl.getEmployee() != null) { usrnm = StringUtil.getFullName(appl.getEmployee()); } else { usrnm = appl.getConfigjobapplicant().getCol1() + " " + appl.getConfigjobapplicant().getCol2(); } // session.update(appl); if (request.getParameter("selected").equals("Selected")) { if (appl.getApplydate() != null && joiningdate != null && appl.getApplydate().compareTo(joiningdate) < 0) { hrmsRecJobDAOObj.addAllapplications(appParams); } else { appnames += (cnames[i] + " ,"); } } else { hrmsRecJobDAOObj.addAllapplications(appParams); } //@@ProfileHandler.insertAuditLog(session, AuditAction.PROSPECT_EDITED, "User " + AuthHandler.getFullName(session, AuthHandler.getUserid(request)) + " has edited prospect of " + usrnm,request); } txnManager.commit(status); if (!appnames.equals("")) { appnames = appnames.substring(0, appnames.length() - 1); } jobj1.put("msg", appnames); jobj1.put("success", true); jobj1.put("valid", true); } catch (Exception ex) { ex.printStackTrace(); txnManager.rollback(status); } finally { return new ModelAndView("jsonView", "model", jobj1.toString()); } }
From source file:com.krawler.spring.hrms.common.hrmsCommonController.java
public ModelAndView getparticularUserDetails(HttpServletRequest request, HttpServletResponse response) { JSONObject jobj = new JSONObject(); JSONObject jobj1 = new JSONObject(); KwlReturnObject result = null;// w w w .ja va 2s.c om try { HashMap<String, Object> requestParams = new HashMap<String, Object>(); ArrayList filter_names = new ArrayList(), filter_values = new ArrayList(); String companyid = sessionHandlerImplObj.getCompanyid(request); String lid = request.getParameter("lid"); filter_names.add("userID"); filter_values.add(lid); filter_names.add("company.companyID"); filter_values.add(companyid); requestParams.put("filter_names", filter_names); requestParams.put("filter_values", filter_values); result = hrmsCommonDAOObj.getUsers(requestParams); List list = result.getEntityList(); Iterator itr = list.iterator(); JSONArray jArr = new JSONArray(); while (itr.hasNext()) { User user = (User) itr.next(); Useraccount ua = (Useraccount) kwlCommonTablesDAOObj .getObject("com.krawler.common.admin.Useraccount", user.getUserID()); UserLogin ul = user.getUserLogin(); JSONObject obj = new JSONObject(); obj.put("userid", user.getUserID()); obj.put("username", ul.getUserName()); obj.put("firstname", user.getFirstName()); obj.put("lastname", user.getLastName()); obj.put("image", user.getImage()); obj.put("emailid", user.getEmailID()); obj.put("lastlogin", (ul.getLastActivityDate() == null ? "" : sessionHandlerImplObj.getDateFormatter(request).format(ul.getLastActivityDate()))); obj.put("aboutuser", user.getAboutUser()); obj.put("address", user.getAddress()); obj.put("contactno", user.getContactNumber()); obj.put("formatid", (user.getDateFormat() == null ? "4" : user.getDateFormat().getFormatID())); obj.put("tzid", (user.getTimeZone() == null ? "23" : user.getTimeZone().getTimeZoneID())); requestParams.clear(); requestParams.put("companyid", companyid); requestParams.put("empid", ua.getEmployeeid()); if (ua.getEmployeeIdFormat() == null) { obj.put("employeeid", ua.getEmployeeid() == null ? "" : profileHandlerDAOObj.getEmpidFormatEdit(requestParams).getEntityList().get(0)); } else { requestParams.put("standardEmpId", profileHandlerDAOObj.getEmpidFormatEdit(requestParams) .getEntityList().get(0).toString()); requestParams.put("employeeIdFormat", ua.getEmployeeIdFormat()); obj.put("employeeid", profileHandlerDAOObj.getNewEmployeeIdFormat(requestParams)); } jArr.put(obj); } jobj.put("data", jArr); jobj1.put("data", jobj); jobj1.put("valid", true); } catch (Exception e) { e.printStackTrace(); ; } return new ModelAndView("jsonView", "model", jobj1.toString()); }
From source file:com.krawler.spring.hrms.common.hrmsCommonController.java
public ModelAndView getEmpHistory(HttpServletRequest request, HttpServletResponse response) { JSONObject jobj = new JSONObject(); JSONObject jobj1 = new JSONObject(); int count = 0; List list = null;/* w ww . j a va 2 s . co m*/ Iterator itr; KwlReturnObject result; try { String userid = request.getParameter("userid"); String cmpid = sessionHandlerImplObj.getCompanyid(request); HashMap<String, Object> requestParams = new HashMap<String, Object>(); requestParams.put("filter_names", Arrays.asList("userid.userID", "userid.company.companyID")); requestParams.put("filter_values", Arrays.asList(userid, cmpid)); requestParams.put("allflag", false); StringUtil.checkpaging(requestParams, request); result = hrmsCommonDAOObj.getEmpHistory(requestParams); count = result.getRecordTotalCount(); list = result.getEntityList(); itr = list.iterator(); JSONArray jArr = new JSONArray(); while (itr.hasNext()) { JSONObject obj = new JSONObject(); Emphistory ehst = (Emphistory) itr.next(); obj.put("designation", (ehst.getDesignation() != null ? ehst.getDesignation().getValue() : "")); obj.put("department", (ehst.getDepartment() != null ? ehst.getDepartment().getValue() : "")); obj.put("startdate", ehst.getJoindate() != null ? sessionHandlerImplObj.getDateFormatter(request).format(ehst.getJoindate()) : ""); obj.put("enddate", ehst.getUpdatedon() != null ? sessionHandlerImplObj.getDateFormatter(request).format(ehst.getUpdatedon()) : ""); obj.put("salary", ehst.getSalary() != null ? ehst.getSalary() : ""); obj.put("category", ehst.getCategory().equals("1") ? messageSource.getMessage("hrms.common.designation", null, "Designation", RequestContextUtils.getLocale(request)) : messageSource.getMessage("hrms.common.Salary", null, "Salary", RequestContextUtils.getLocale(request))); obj.put("hid", ehst.getHid()); jArr.put(obj); } requestParams.clear(); requestParams.put("filter_names", Arrays.asList("userID.userID")); requestParams.put("filter_values", Arrays.asList(userid)); requestParams.put("allflag", false); StringUtil.checkpaging(requestParams, request); result = hrmsCommonDAOObj.getPayHistory(requestParams); count += result.getRecordTotalCount(); list = result.getEntityList(); itr = list.iterator(); while (itr.hasNext()) { JSONObject jobjtemp = new JSONObject(); Payhistory group = (Payhistory) itr.next(); jobjtemp.put("designation", group.getDesign()); jobjtemp.put("department", group.getDepartment()); jobjtemp.put("salary", group.getNet()); jobjtemp.put("startdate", sessionHandlerImplObj.getDateFormatter(request).format(group.getCreatedon())); jobjtemp.put("enddate", sessionHandlerImplObj.getDateFormatter(request).format(group.getCreatedfor())); jobjtemp.put("category", messageSource.getMessage("hrms.Featurelist.payroll", null, "Payroll", RequestContextUtils.getLocale(request))); jobjtemp.put("hid", group.getHistoryid()); jArr.put(jobjtemp); } jobj.put("count", count); jobj.put("data", jArr); jobj1.put("data", jobj); jobj1.put("valid", true); } catch (Exception e) { e.printStackTrace(); } return new ModelAndView(successView, "model", jobj1.toString()); }
From source file:com.wizecommerce.hecuba.HecubaCassandraManagerTestBase.java
@Test public void testReadColumnSliceMultipleKeys() throws Exception { logger.info("Testing Hector read column slice with multiple keys"); HecubaClientManager<Long> cassandraManager = getHecubaClientManager(); HashMap<String, Object> row1 = new HashMap<String, Object>(); /**********************************************************/ /****** TEST CASSANDRA ROWS CONTAINS > 100 COLUMNS ********/ /**********************************************************/ Long key1 = 1234L;//from ww w . j a va 2 s . c om // Insert 200 columns in cassandra for key1 for (int i = 1; i <= 200; i++) { row1.put("column_" + i, "value_" + i); } cassandraManager.updateRow(key1, row1); // Insert 150 columns in cassandra for key2 HashMap<String, Object> row2 = new HashMap<String, Object>(); Long key2 = 5678L; for (int i = 1; i <= 150; i++) { row2.put("column_" + i, "value_" + i); } cassandraManager.updateRow(key2, row2); Set<Long> keys = new HashSet<Long>(); keys.add(key1); keys.add(key2); /** * ___________________________________________________________ | Retrieve all columns for all keys (no of columns < 10000) * ----------------------------------------------------------- */ CassandraResultSet<Long, String> result = cassandraManager.readColumnSliceAllColumns(keys); Set<Long> keysCopy = new HashSet<Long>(keys); int count = 0; assertNotNull(result); /** * NOTE: We are using [while(true) --> break] loop here because CassandraResultSet points to the first row when its created. CassandraResultSet.hasNextResult returns true * if there are any more rows and CassandraResultSet.nextResult () moves the pointer to the next row. So in the loop, we needed the processing --> check break condition --> * move the pointer. */ while (true) { count++; assertEquals(true, keysCopy.remove(result.getKey())); if (key1.equals(result.getKey())) { // Column count should be 200 assertEquals(200, result.getColumnNames().size()); for (String columnName : row1.keySet()) { assertEquals(row1.get(columnName), result.getString(columnName)); } } else if (key2.equals(result.getKey())) { // Column count should be 150 assertEquals(150, result.getColumnNames().size()); for (String columnName : row2.keySet()) { assertEquals(row2.get(columnName), result.getString(columnName)); } } if (!result.hasNextResult()) { break; } result.nextResult(); } assertEquals(keys.size(), count); // Asserts the result set contains exactly same number of rows as is the // keys size assertEquals(0, keysCopy.size()); // Asserts we get both the keys in the result set /*************************************************************************/ /****** TEST CASSANDRA ROWS CONTAINS < 100 COLUMNS + A MISS ROW ********/ /*************************************************************************/ cassandraManager.deleteRow(key1); cassandraManager.deleteRow(key2); long key3 = 9999L; keys.add(key3); row1.clear(); for (int i = 1; i <= 80; i++) { row1.put("column_" + i, "value_" + i); } cassandraManager.updateRow(key1, row1); row2.clear(); for (int i = 1; i <= 60; i++) { row2.put("column_" + i, "value_" + i); } cassandraManager.updateRow(key2, row2); /** * ____________________________________ | Retrieve all columns for all keys ------------------------------------ */ result = cassandraManager.readColumnSliceAllColumns(keys); keysCopy = new HashSet<Long>(keys); count = 0; assertNotNull(result); /** * NOTE: We are using [while(true) --> break] loop here because CassandraResultSet points to the first row when its created. CassandraResultSet.hasNextResult returns true * if there are any more rows and CassandraResultSet.nextResult () moves the pointer to the next row. So in the loop, we needed the processing --> check break condition --> * move the pointer. */ while (true) { if (result.getColumnNames().size() > 0) { // Only count rows that actually contain results count++; } assertEquals(true, keysCopy.remove(result.getKey())); if (result.getKey().equals(key1)) { // Column count should be 80 assertEquals(80, result.getColumnNames().size()); for (String columnName : row1.keySet()) { assertEquals(row1.get(columnName), result.getString(columnName)); } } else if (result.getKey().equals(key2)) { // Column count should be 60 assertEquals(60, result.getColumnNames().size()); for (String columnName : row2.keySet()) { assertEquals(row2.get(columnName), result.getString(columnName)); } } else if (result.getKey().equals(key3)) { // Column count should be 0 since key3 doesn't exist assertEquals(0, result.getColumnNames().size()); } if (!result.hasNextResult()) { break; } result.nextResult(); } assertEquals(2, count); // Asserts 2 rows contained data if (keysCopy.size() == 1) { // key3 did not exist in cassandra so CQL will not return it assertTrue(keysCopy.contains(key3)); } else { assertEquals(0, keysCopy.size()); // Asserts we get all the keys in the result set } }
From source file:knop.psfj.BeadImage.java
/** * Builds the stack list : retrieve every bead from the original image stack * and store them into a ImageStack array. * * A list of bead stack is created and each bead stack is filled while * loading (and browsing) the stack.//from w ww . ja v a2s . c o m */ public void buildStackList() { if (stackList != null) { return; } stackList = new HashMap<Integer, ImageStack>(); setStatus("Retreiving stacks..."); stackList.clear(); long start = System.currentTimeMillis(); // creating an hashmap for storing the different planes final HashMap<Integer, ImageProcessor> planes = new HashMap<Integer, ImageProcessor>(); // an thread that load the images from the disk is created new Thread() { @Override public void run() { for (int i = 0; i != getStackSize(); i++) { planes.put(i, getPlane(i)); } } }.start(); // while the loading thread is on... BeadFrameList frames = getBeadFrameList(); System.out.println(frames.size() + " beads to retrieve !"); // for each plane of the stack for (int i = 0; i != getStackSize(); i++) { // we wait for each plane to loaded while (planes.containsKey(i) == false) { try { Thread.currentThread(); Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } ; } // the plane is loaded !! Let's start doing some processing // (in the mean time, the next thread starts to be loaded // System.out.println("Start processing " + i + " ..."); // getting the plane ImageProcessor sp = planes.get(i); // for each bead frame, for (BeadFrame frame : frames) { final int stackNumber = i; // copy the part of the frame from the plane image ImageProcessor imagePart = copyRoi(sp, frame.getBoundariesAsRectangle()); // if the current plane is the first, a new image stack // corresponding to the bead is created if (stackNumber == 0) { stackList.put(frame.getId(), new ImageStack(imagePart.getWidth(), imagePart.getHeight())); } // adding the slice to the bead stack stackList.get(frame.getId()).addSlice(imagePart); } // System.out.println("Stop processing " + i + ""); setProgress(i, getStackSize()); // freeing some memory planes.put(i, null); planes.put(i, sp.createProcessor(1, 1)); sp = null; } for (Integer id : stackList.keySet()) { frames.getFromId(id).setSubstack(new ImagePlus("", stackList.get(id))); } planes.clear(); stackList.clear(); stackList = null; System.gc(); long end = System.currentTimeMillis(); setStatus("Stacks retreived."); setProgress(100); System.out.println("Stacks retreived in " + (end - start) + " ms."); }
From source file:com.krawler.spring.hrms.rec.job.hrmsRecJobController.java
public ModelAndView getJobApplications(HttpServletRequest request, HttpServletResponse response) { KwlReturnObject result = null, recruitresult = null; JSONObject jobj = new JSONObject(); JSONObject jobj1 = new JSONObject(); JSONArray jarr = new JSONArray(); String hql = ""; int count = 0; boolean isadmin = false; HashMap<String, Object> requestParams = new HashMap<String, Object>(); int type = 0; try {//from ww w.ja va 2 s . c om String Searchjson = request.getParameter("searchJson"); List lst = null; List lst1 = null; String cmpid = sessionHandlerImplObj.getCompanyid(request); String userid = sessionHandlerImplObj.getUserid(request); requestParams.clear(); requestParams.put("userid", userid); if (hrmsCommonDAOObj.isAdmin(userid)) { isadmin = true; } ArrayList params = new ArrayList(); ArrayList filter_name = new ArrayList(); ArrayList order_by = new ArrayList(); ArrayList order_type = new ArrayList(); String ss = request.getParameter("ss"); int statusid = StringUtil.isNullOrEmpty(request.getParameter("statusid")) ? -1 : Integer.parseInt(request.getParameter("statusid")); String tempstatus = statusid == 1 ? "Pending" : (statusid == 2 ? "Shortlisted" : (statusid == 3 ? "In Process" : (statusid == 4 ? "On Hold" : ""))); if (StringUtil.isNullOrEmpty(request.getParameter("userid"))) { int emptype = Integer.parseInt(request.getParameter("employeetype")); type = emptype; int gridst = Integer.parseInt(request.getParameter("gridst")); String[] searchArray = null; String[] searchArray1 = null; if (emptype == 1) {//Internal searchArray = new String[] { "employee.firstName", "employee.lastName", "position.jobid", "position.departmentid.value" }; params.add(0); filter_name.add("employee.deleteflag"); } else if (emptype == 2) { // else added to execute only one condition emptype = 1; searchArray = new String[] { "employee.firstName", "employee.lastName", "position.jobid", "position.departmentid.value" }; searchArray1 = new String[] { "configjobapplicant.col1", "configjobapplicant.col2", "position.jobid", "position.departmentid.value" }; params.add(0); filter_name.add("employee.deleteflag"); params.add(false); filter_name.add("configjobapplicant.deleted"); } else {//External searchArray = new String[] { "configjobapplicant.col1", "configjobapplicant.col2", "position.jobid", "position.departmentid.value" }; params.add(false); filter_name.add("configjobapplicant.deleted"); } if (emptype == 0) { emptype = 4; //configjobapplicant=4 reset to 0 } if (StringUtil.isNullOrEmpty(request.getParameter("status"))) { params.add(gridst); params.add(cmpid); params.add(0); params.add(emptype); //params.add(false); filter_name.add("applicationflag"); filter_name.add("company.companyID"); filter_name.add("delflag"); filter_name.add("employeetype"); //filter_name.add("configjobapplicant.deleted"); } else { if (!tempstatus.equals("")) { params.add(gridst); params.add(cmpid); params.add(0); params.add(tempstatus); params.add(emptype); filter_name.add("applicationflag"); filter_name.add("company.companyID"); filter_name.add("delflag"); filter_name.add("status"); filter_name.add("employeetype"); } else { params.add(gridst); params.add(cmpid); params.add(0); params.add(emptype); filter_name.add("applicationflag"); filter_name.add("company.companyID"); filter_name.add("delflag"); filter_name.add("employeetype"); } } if (!isadmin) { params.add(userid); filter_name.add("position.manager.userID"); } order_by.add("position.departmentid.value"); order_by.add("position.jobid"); order_type.add(""); order_type.add("asc"); requestParams.put("filter_names", filter_name); requestParams.put("filter_values", params); ArrayList params1 = new ArrayList(params); ArrayList filter_name1 = new ArrayList(filter_name); if (filter_name1.contains("employee.deleteflag")) { params1.remove(filter_name1.indexOf("employee.deleteflag")); filter_name1.remove("employee.deleteflag"); } if (filter_name.contains("configjobapplicant.deleted") && !(emptype == 4)) { params.remove(filter_name.indexOf("configjobapplicant.deleted")); filter_name.remove("configjobapplicant.deleted"); } requestParams.put("filter_names1", filter_name1); requestParams.put("filter_values1", params1); requestParams.put("order_by", order_by); requestParams.put("order_type", order_type); requestParams.put("ss", request.getParameter("ss")); requestParams.put("searchcol", searchArray); requestParams.put("searchcol1", searchArray1); requestParams.put("allflag", false); if (!StringUtil.isNullOrEmpty(Searchjson)) { getMyAdvanceSearchparams1(Searchjson, filter_name, (type != 2 ? type : 1)); insertParamAdvanceSearchString1(params, Searchjson, type); getMyAdvanceSearchparams1(Searchjson, filter_name1, (type != 2 ? type : 0)); insertParamAdvanceSearchString1(params1, Searchjson, type); } StringUtil.checkpaging(requestParams, request); result = hrmsRecJobDAOObj.getPositionstatus(requestParams); } else { params.add(request.getParameter("userid")); params.add(cmpid); params.add(0); params.add(false); filter_name.add("configjobapplicant.id"); filter_name.add("company.companyID"); filter_name.add("delflag"); filter_name.add("configjobapplicant.deleted"); order_by.add("position.departmentid.value"); order_by.add("position.jobid"); order_type.add(""); order_type.add("asc"); requestParams.put("filter_names", filter_name); requestParams.put("filter_values", params); requestParams.put("order_by", order_by); requestParams.put("order_type", order_type); requestParams.put("ss", request.getParameter("ss")); requestParams.put("searchcol", new String[] { "position.jobid", "position.position.value" }); requestParams.put("allflag", false); if (!StringUtil.isNullOrEmpty(Searchjson)) { getMyAdvanceSearchparams1(Searchjson, filter_name, type); insertParamAdvanceSearchString1(params, Searchjson, type); } StringUtil.checkpaging(requestParams, request); result = hrmsRecJobDAOObj.getPositionstatus(requestParams); } Allapplications allapps = null; count = result.getRecordTotalCount(); lst = result.getEntityList(); for (int ctr = 0; ctr < lst.size(); ctr++) { // if(isadmin){ allapps = (Allapplications) lst.get(ctr); // }else{ // Recruiter rec=(Recruiter) lst.get(ctr); // allapps = rec.getAllapplication(); // } JSONObject tmpObj = new JSONObject(); tmpObj.put("id", allapps.getId()); tmpObj.put("posid", allapps.getPosition().getPositionid()); tmpObj.put("rejectedbefore", allapps.getRejectedbefore()); tmpObj.put("designationid", allapps.getPosition().getPosition().getId()); tmpObj.put("departmentid", allapps.getPosition().getDepartmentid().getId()); tmpObj.put("department", allapps.getPosition().getDepartmentid().getValue()); tmpObj.put("Department", allapps.getPosition().getDepartmentid().getValue()); tmpObj.put("designation", allapps.getPosition().getPosition().getValue()); tmpObj.put("jobpositionid", allapps.getPosition().getJobid()); tmpObj.put("jobid", allapps.getPosition().getPositionid()); tmpObj.put("JobId", allapps.getPosition().getPosition().getValue()); tmpObj.put("vacancy", allapps.getPosition().getNoofpos()); tmpObj.put("filled", allapps.getPosition().getPositionsfilled()); tmpObj.put("jname", allapps.getPosition().getPosition().getValue()); tmpObj.put("applydt", sessionHandlerImplObj.getDateFormatter(request).format(allapps.getApplydate())); tmpObj.put("interviewdt", (allapps.getInterviewdate() == null ? "" : sessionHandlerImplObj.getDateFormatter(request).format(allapps.getInterviewdate()))); tmpObj.put("joiningdate", (allapps.getJoiningdate() == null ? "" : sessionHandlerImplObj.getDateFormatter(request).format(allapps.getJoiningdate()))); tmpObj.put("status", allapps.getStatus()); tmpObj.put("jobDetails", allapps.getPosition().getDetails()); if (allapps.getConfigjobapplicant() != null) { tmpObj.put("apcntid", allapps.getConfigjobapplicant().getId()); tmpObj.put("cname", allapps.getConfigjobapplicant().getCol1() + " " + allapps.getConfigjobapplicant().getCol2()); tmpObj.put("email", allapps.getConfigjobapplicant().getCol3()); tmpObj.put("fname", allapps.getConfigjobapplicant().getCol1()); tmpObj.put("lname", allapps.getConfigjobapplicant().getCol2()); tmpObj.put("contact", allapps.getConfigjobapplicant().getCol4() != null ? allapps.getConfigjobapplicant().getCol4() : ""); tmpObj.put("addr", allapps.getConfigjobapplicant().getCol6() != null ? allapps.getConfigjobapplicant().getCol6() : ""); tmpObj.put("employeetype", 0); if (!StringUtil.isNullOrEmpty(allapps.getConfigjobapplicant().getCol5())) { tmpObj.put("docid", allapps.getConfigjobapplicant().getCol5()); } // getdocsbyuser(request,allapps.getConfigjobapplicant().getId(),tmpObj); } else { tmpObj.put("apcntid", allapps.getEmployee().getUserID()); tmpObj.put("cname", allapps.getEmployee().getFirstName() + " " + allapps.getEmployee().getLastName()); tmpObj.put("email", allapps.getEmployee().getEmailID()); tmpObj.put("fname", allapps.getEmployee().getFirstName()); tmpObj.put("lname", allapps.getEmployee().getLastName()); tmpObj.put("contact", allapps.getEmployee().getContactNumber()); tmpObj.put("addr", allapps.getEmployee().getAddress()); tmpObj.put("employeetype", 1); } ArrayList recruiterparams = new ArrayList(); recruiterparams.add(allapps.getId()); ArrayList filter_names = new ArrayList(); filter_names.add("allapplication.id"); requestParams.clear(); requestParams.put("filter_names", filter_names); requestParams.put("filter_values", recruiterparams); recruitresult = hrmsRecJobDAOObj.getRecruiters(requestParams); if (StringUtil.checkResultobjList(recruitresult)) { List recruiterlist = recruitresult.getEntityList(); for (int k = 0; k < recruiterlist.size(); k++) { Recruiter r = (Recruiter) recruiterlist.get(k); tmpObj.append("recruiter", r.getRecruit().getFirstName() + " " + r.getRecruit().getLastName()); } } tmpObj.put("callback", (allapps.getCallback() == null ? "" : allapps.getCallback().getValue())); tmpObj.put("interviewplace", allapps.getInterviewplace()); tmpObj.put("interviewcomment", allapps.getInterviewcomment()); tmpObj.put("rank", (allapps.getRank() == null ? "" : allapps.getRank().getValue())); jarr.put(tmpObj); } jobj.put("data", jarr); jobj.put("count", count); jobj1.put("valid", true); jobj1.put("data", jobj.toString()); } catch (Exception e) { e.printStackTrace(); } finally { return new ModelAndView("jsonView", "model", jobj1.toString()); } }
From source file:com.krawler.spring.hrms.common.hrmsCommonController.java
public ModelAndView getEmpProfile(HttpServletRequest request, HttpServletResponse response) { KwlReturnObject result = null;/*from w w w. j a v a 2 s .c o m*/ JSONObject jobj = new JSONObject(); JSONObject jobj1 = new JSONObject(); JSONArray jarr = new JSONArray(); String platformURL = this.getServletContext().getInitParameter("platformURL"); String userid; int count = 0; try { String cmpid = sessionHandlerImplObj.getCompanyid(request); // String hql = "from Empprofile where userID=? "; // List lst = HibernateUtil.executeQuery(session, hql, new Object[]{request.getParameter("userid")}); HashMap<String, Object> requestParams = new HashMap<String, Object>(); requestParams.put("primary", true); requestParams.put("userid", request.getParameter("userid")); result = hrmsCommonDAOObj.getEmpProfile(requestParams); List lst = result.getEntityList(); if (lst.size() != 0) { jarr = kwlCommonTablesDAOObj.getDetailsJson(lst, -1, "com.krawler.hrms.ess.Empprofile"); for (int ctr = 0; ctr < jarr.length(); ctr++) { JSONObject tmpObj = jarr.getJSONObject(ctr); Empprofile extmt = (Empprofile) tmpObj.get("instance"); String image = ""; if (StringUtil.isStandAlone()) { image = extmt.getUserLogin().getUser().getImage(); } else { image = StringUtil.getAppsImagePath(platformURL, extmt.getUserID(), 100); } User u = (User) kwlCommonTablesDAOObj.getObject("com.krawler.common.admin.User", request.getParameter("userid")); Useraccount ua = (Useraccount) kwlCommonTablesDAOObj .getObject("com.krawler.common.admin.Useraccount", extmt.getUserID()); tmpObj.put("fname", extmt.getUserLogin().getUser().getFirstName()); tmpObj.put("lname", extmt.getUserLogin().getUser().getLastName()); tmpObj.put("image", image); tmpObj.put("aboutuser", extmt.getUserLogin().getUser().getAboutUser() == null ? "" : extmt.getUserLogin().getUser().getAboutUser()); String middlename = (extmt.getMiddlename() != null ? extmt.getMiddlename() : ""); tmpObj.put("fullname", extmt.getUserLogin().getUser().getFirstName() + " " + middlename + " " + extmt.getUserLogin().getUser().getLastName()); tmpObj.put("bankacc", ua.getAccno()); // tmpObj.put("empid", extmt.getUserLogin().getUser().getEmployeeid() == null ? "" : hrmsManager.getEmpidFormatEdit(session, request, extmt.getUserLogin().getUser().getEmployeeid())); requestParams.clear(); requestParams.put("companyid", cmpid); requestParams.put("empid", ua.getEmployeeid()); if (ua.getEmployeeIdFormat() == null) { tmpObj.put("empid", ua.getEmployeeid() == null ? "" : profileHandlerDAOObj.getEmpidFormatEdit(requestParams).getEntityList().get(0)); } else { requestParams.put("standardEmpId", profileHandlerDAOObj.getEmpidFormatEdit(requestParams) .getEntityList().get(0).toString()); requestParams.put("employeeIdFormat", ua.getEmployeeIdFormat()); tmpObj.put("empid", profileHandlerDAOObj.getNewEmployeeIdFormat(requestParams)); } tmpObj.put("department", ua.getDepartment() == null ? "" : ua.getDepartment().getId()); tmpObj.put("designationid", ua.getDesignationid() == null ? "" : ua.getDesignationid().getId()); tmpObj.put("costcenter", ua.getCostCenter() == null ? "" : ua.getCostCenter().getId()); tmpObj.put("frequency", u.getFrequency()); tmpObj.put("managername", (extmt.getReportto() == null ? "" : extmt.getReportto().getUserID())); tmpObj.put("precountry", (extmt.getPresentcountry() == null ? "" : extmt.getPresentcountry().getId())); tmpObj.put("permcountry", (extmt.getPermcountry() == null ? "" : extmt.getPermcountry().getId())); tmpObj.put("trainingmon", (extmt.getTrainperiod() == null ? "" : extmt.getTrainperiod().substring(0, Math.max(0, extmt.getTrainperiod().indexOf(","))))); tmpObj.put("trainingyr", (extmt.getTrainperiod() == null ? "" : extmt.getTrainperiod() .substring(Math.max(0, extmt.getTrainperiod().indexOf(",") + 1)))); tmpObj.put("probationmon", (extmt.getProbperiod() == null ? "" : extmt.getProbperiod().substring(0, Math.max(0, extmt.getProbperiod().indexOf(","))))); tmpObj.put("probationyr", (extmt.getProbperiod() == null ? "" : extmt.getProbperiod() .substring(Math.max(0, extmt.getProbperiod().indexOf(",") + 1)))); tmpObj.put("noticemon", (extmt.getNoticeperiod() == null ? "" : extmt.getNoticeperiod().substring(0, Math.max(0, extmt.getNoticeperiod().indexOf(","))))); tmpObj.put("noticeyr", (extmt.getNoticeperiod() == null ? "" : extmt.getNoticeperiod() .substring(Math.max(0, extmt.getNoticeperiod().indexOf(",") + 1)))); tmpObj.put("brachcountry", (extmt.getBranchcountry() == null ? "" : extmt.getBranchcountry().getId())); jarr.put(ctr, tmpObj); } } else { JSONObject tmpObj = new JSONObject(); User u = (User) kwlCommonTablesDAOObj.getObject("com.krawler.common.admin.User", request.getParameter("userid")); Useraccount ua = (Useraccount) kwlCommonTablesDAOObj .getObject("com.krawler.common.admin.Useraccount", u.getUserID()); requestParams.clear(); requestParams.put("companyid", cmpid); requestParams.put("empid", ua.getEmployeeid()); if (ua.getEmployeeIdFormat() == null) { tmpObj.put("empid", ua.getEmployeeid() == null ? "" : profileHandlerDAOObj.getEmpidFormatEdit(requestParams).getEntityList().get(0)); } else { requestParams.put("standardEmpId", profileHandlerDAOObj.getEmpidFormatEdit(requestParams) .getEntityList().get(0).toString()); requestParams.put("employeeIdFormat", ua.getEmployeeIdFormat()); tmpObj.put("empid", profileHandlerDAOObj.getNewEmployeeIdFormat(requestParams)); } String image = ""; if (StringUtil.isStandAlone()) { image = u.getImage(); } else { image = StringUtil.getAppsImagePath(platformURL, u.getUserID(), 100); } tmpObj.put("department", ua.getDepartment() == null ? "" : ua.getDepartment().getId()); tmpObj.put("designationid", ua.getDesignationid() == null ? "" : ua.getDesignationid().getId()); tmpObj.put("costcenter", ua.getCostCenter() == null ? "" : ua.getCostCenter().getId()); tmpObj.put("frequency", u.getFrequency()); tmpObj.put("fname", u.getFirstName()); tmpObj.put("lname", u.getLastName()); tmpObj.put("image", image); tmpObj.put("aboutuser", u.getAboutUser() == null ? "" : u.getAboutUser()); tmpObj.put("fullname", u.getFirstName() + " " + (u.getLastName() == null ? "" : u.getLastName())); tmpObj.put("bankacc", ua.getAccno()); jarr.put(tmpObj); } jobj.put("data", jarr); jobj.put("count", result.getRecordTotalCount()); jobj1.put("data", jobj.toString()); jobj1.put("valid", true); } catch (Exception e) { e.printStackTrace(); } finally { return new ModelAndView("jsonView", "model", jobj1.toString()); } }
From source file:com.krawler.spring.hrms.rec.job.hrmsRecJobController.java
public JSONObject getJobApplicationsJson(HttpServletRequest request, HttpServletResponse response) { KwlReturnObject result = null, recruitresult = null; JSONObject jobj = new JSONObject(); JSONArray jarr = new JSONArray(); String hql = ""; int count = 0; boolean isadmin = false; HashMap<String, Object> requestParams = new HashMap<String, Object>(); int type = 0; try {// ww w . j a v a2 s. co m DateFormat df = sessionHandlerImplObj.getDateFormatter(request); String Searchjson = request.getParameter("searchJson"); List lst = null; List lst1 = null; String cmpid = sessionHandlerImplObj.getCompanyid(request); String userid = sessionHandlerImplObj.getUserid(request); requestParams.clear(); requestParams.put("userid", userid); if (hrmsCommonDAOObj.isAdmin(userid)) { isadmin = true; } ArrayList params = new ArrayList(); ArrayList filter_name = new ArrayList(); ArrayList order_by = new ArrayList(); ArrayList order_type = new ArrayList(); String ss = request.getParameter("ss"); int statusid = StringUtil.isNullOrEmpty(request.getParameter("statusid")) ? -1 : Integer.parseInt(request.getParameter("statusid")); String tempstatus = statusid == 1 ? "Pending" : (statusid == 2 ? "Shortlisted" : (statusid == 3 ? "In Process" : (statusid == 4 ? "On Hold" : ""))); if (StringUtil.isNullOrEmpty(request.getParameter("userid"))) { int emptype = Integer.parseInt(request.getParameter("employeetype")); type = emptype; int gridst = Integer.parseInt(request.getParameter("gridst")); String[] searchArray = null; String[] searchArray1 = null; if (emptype == 1) {//Internal searchArray = new String[] { "employee.firstName", "employee.lastName", "position.jobid", "position.departmentid.value" }; params.add(0); filter_name.add("employee.deleteflag"); } else if (emptype == 2) { // else added to execute only one condition emptype = 1; searchArray = new String[] { "employee.firstName", "employee.lastName", "position.jobid", "position.departmentid.value" }; searchArray1 = new String[] { "configjobapplicant.col1", "configjobapplicant.col2", "position.jobid", "position.departmentid.value" }; params.add(0); filter_name.add("employee.deleteflag"); params.add(false); filter_name.add("configjobapplicant.deleted"); } else {//External searchArray = new String[] { "configjobapplicant.col1", "configjobapplicant.col2", "position.jobid", "position.departmentid.value" }; params.add(false); filter_name.add("configjobapplicant.deleted"); } if (emptype == 0) { emptype = 4; //configjobapplicant=4 reset to 0 } if (StringUtil.isNullOrEmpty(request.getParameter("status"))) { params.add(gridst); params.add(cmpid); params.add(0); params.add(emptype); //params.add(false); filter_name.add("applicationflag"); filter_name.add("company.companyID"); filter_name.add("delflag"); filter_name.add("employeetype"); //filter_name.add("configjobapplicant.deleted"); } else { if (!tempstatus.equals("")) { params.add(gridst); params.add(cmpid); params.add(0); params.add(tempstatus); params.add(emptype); filter_name.add("applicationflag"); filter_name.add("company.companyID"); filter_name.add("delflag"); filter_name.add("status"); filter_name.add("employeetype"); } else { params.add(gridst); params.add(cmpid); params.add(0); params.add(emptype); filter_name.add("applicationflag"); filter_name.add("company.companyID"); filter_name.add("delflag"); filter_name.add("employeetype"); } } if (!isadmin) { params.add(userid); filter_name.add("position.manager.userID"); } order_by.add("position.positionid"); order_type.add("asc"); requestParams.put("filter_names", filter_name); requestParams.put("filter_values", params); ArrayList params1 = new ArrayList(params); ArrayList filter_name1 = new ArrayList(filter_name); if (filter_name1.contains("employee.deleteflag")) { params1.remove(filter_name1.indexOf("employee.deleteflag")); filter_name1.remove("employee.deleteflag"); } if (filter_name.contains("configjobapplicant.deleted") && !(emptype == 4)) { params.remove(filter_name.indexOf("configjobapplicant.deleted")); filter_name.remove("configjobapplicant.deleted"); } requestParams.put("filter_names1", filter_name1); requestParams.put("filter_values1", params1); requestParams.put("order_by", order_by); requestParams.put("order_type", order_type); requestParams.put("ss", request.getParameter("ss")); requestParams.put("searchcol", searchArray); requestParams.put("searchcol1", searchArray1); requestParams.put("allflag", true); if (!StringUtil.isNullOrEmpty(Searchjson)) { getMyAdvanceSearchparams1(Searchjson, filter_name, (type != 2 ? type : 1)); insertParamAdvanceSearchString1(params, Searchjson, type); getMyAdvanceSearchparams1(Searchjson, filter_name1, (type != 2 ? type : 0)); insertParamAdvanceSearchString1(params1, Searchjson, type); } StringUtil.checkpaging(requestParams, request); result = hrmsRecJobDAOObj.getPositionstatus(requestParams); } else { params.add(request.getParameter("userid")); params.add(cmpid); params.add(0); params.add(false); filter_name.add("configjobapplicant.id"); filter_name.add("company.companyID"); filter_name.add("delflag"); filter_name.add("configjobapplicant.deleted"); order_by.add("position.positionid"); order_type.add("asc"); requestParams.put("filter_names", filter_name); requestParams.put("filter_values", params); requestParams.put("order_by", order_by); requestParams.put("order_type", order_type); requestParams.put("ss", request.getParameter("ss")); requestParams.put("searchcol", new String[] { "position.jobid", "position.position.value" }); requestParams.put("allflag", true); if (!StringUtil.isNullOrEmpty(Searchjson)) { getMyAdvanceSearchparams1(Searchjson, filter_name, type); insertParamAdvanceSearchString1(params, Searchjson, type); } StringUtil.checkpaging(requestParams, request); result = hrmsRecJobDAOObj.getPositionstatus(requestParams); } Allapplications allapps = null; count = result.getRecordTotalCount(); lst = result.getEntityList(); for (int ctr = 0; ctr < lst.size(); ctr++) { // if(isadmin){ allapps = (Allapplications) lst.get(ctr); // }else{ // Recruiter rec=(Recruiter) lst.get(ctr); // allapps = rec.getAllapplication(); // } JSONObject tmpObj = new JSONObject(); tmpObj.put("rejectedbefore", (allapps.getRejectedbefore() == 0) ? "No" : "Yes"); tmpObj.put("id", ""); tmpObj.put("posid", allapps.getPosition().getPositionid()); tmpObj.put("designationid", allapps.getPosition().getPosition().getId()); tmpObj.put("departmentid", allapps.getPosition().getDepartmentid().getId()); tmpObj.put("department", allapps.getPosition().getDepartmentid().getValue()); tmpObj.put("Department", allapps.getPosition().getDepartmentid().getValue()); tmpObj.put("designation", allapps.getPosition().getPosition().getValue()); tmpObj.put("jobpositionid", allapps.getPosition().getJobid()); tmpObj.put("jobid", allapps.getPosition().getJobid()); tmpObj.put("JobId", allapps.getPosition().getJobid()); tmpObj.put("vacancy", allapps.getPosition().getNoofpos()); tmpObj.put("filled", allapps.getPosition().getPositionsfilled()); tmpObj.put("jname", allapps.getPosition().getPosition().getValue()); tmpObj.put("applydt", df.format(allapps.getApplydate())); tmpObj.put("interviewdt", (allapps.getInterviewdate() == null ? "" : df.format(allapps.getInterviewdate()))); tmpObj.put("joiningdate", (allapps.getJoiningdate() == null ? "" : df.format(allapps.getJoiningdate()))); tmpObj.put("status", allapps.getStatus()); tmpObj.put("jobDetails", allapps.getPosition().getDetails()); if (allapps.getConfigjobapplicant() != null) { tmpObj.put("apcntid", allapps.getConfigjobapplicant().getId()); tmpObj.put("cname", allapps.getConfigjobapplicant().getCol1() + " " + allapps.getConfigjobapplicant().getCol2()); tmpObj.put("email", allapps.getConfigjobapplicant().getCol3()); tmpObj.put("fname", allapps.getConfigjobapplicant().getCol1()); tmpObj.put("lname", allapps.getConfigjobapplicant().getCol2()); tmpObj.put("contact", allapps.getConfigjobapplicant().getCol4() != null ? allapps.getConfigjobapplicant().getCol4() : ""); tmpObj.put("addr", allapps.getConfigjobapplicant().getCol6() != null ? allapps.getConfigjobapplicant().getCol6() : ""); tmpObj.put("employeetype", 0); if (!StringUtil.isNullOrEmpty(allapps.getConfigjobapplicant().getCol5())) { tmpObj.put("docid", allapps.getConfigjobapplicant().getCol5()); } // getdocsbyuser(request,allapps.getConfigjobapplicant().getId(),tmpObj); } else { tmpObj.put("apcntid", allapps.getEmployee().getUserID()); tmpObj.put("cname", allapps.getEmployee().getFirstName() + " " + allapps.getEmployee().getLastName()); tmpObj.put("email", allapps.getEmployee().getEmailID()); tmpObj.put("fname", allapps.getEmployee().getFirstName()); tmpObj.put("lname", allapps.getEmployee().getLastName() != null ? allapps.getEmployee().getLastName() : ""); tmpObj.put("contact", allapps.getEmployee().getContactNumber() != null ? allapps.getEmployee().getContactNumber() : ""); tmpObj.put("addr", allapps.getEmployee().getAddress() != null ? allapps.getEmployee().getAddress() : ""); tmpObj.put("employeetype", 1); } ArrayList recruiterparams = new ArrayList(); recruiterparams.add(allapps.getId()); ArrayList filter_names = new ArrayList(); filter_names.add("allapplication.id"); requestParams.clear(); requestParams.put("filter_names", filter_names); requestParams.put("filter_values", recruiterparams); recruitresult = hrmsRecJobDAOObj.getRecruiters(requestParams); String recruiter = ""; if (StringUtil.checkResultobjList(recruitresult)) { List recruiterlist = recruitresult.getEntityList(); for (int k = 0; k < recruiterlist.size(); k++) { Recruiter r = (Recruiter) recruiterlist.get(k); recruiter += (r.getRecruit().getFirstName() + " " + r.getRecruit().getLastName()); if (recruiterlist.size() > k + 1) recruiter += ", "; } } tmpObj.put("recruiter", recruiter); tmpObj.put("callback", (allapps.getCallback() == null ? "" : allapps.getCallback().getValue())); tmpObj.put("interviewplace", allapps.getInterviewplace()); tmpObj.put("interviewcomment", allapps.getInterviewcomment()); tmpObj.put("rank", (allapps.getRank() == null ? "" : allapps.getRank().getValue())); jarr.put(tmpObj); } jobj.put("data", jarr); jobj.put("count", count); } catch (Exception e) { e.printStackTrace(); } finally { return jobj; } }
From source file:com.evandroid.musica.fragment.LocalLyricsFragment.java
public void animateUndo(Lyrics[] lyricsArray) { final HashMap<Long, Integer> itemIdTopMap = new HashMap<>(); int firstVisiblePosition = megaListView.getFirstVisiblePosition(); for (int i = 0; i < megaListView.getChildCount(); ++i) { View child = megaListView.getChildAt(i); int position = firstVisiblePosition + i; long itemId = megaListView.getAdapter().getItemId(position); itemIdTopMap.put(itemId, child.getTop()); }// www. j a va 2 s . c om final boolean[] firstAnimation = { true }; // Delete the item from the adapter final int groupPosition = ((LocalAdapter) getExpandableListAdapter()).add(lyricsArray[0]); megaListView.setAdapter(getExpandableListAdapter()); megaListView.post(new Runnable() { @Override public void run() { megaListView.expandGroupWithAnimation(groupPosition); } }); new WriteToDatabaseTask(LocalLyricsFragment.this).execute(LocalLyricsFragment.this, null, lyricsArray); final ViewTreeObserver[] observer = { megaListView.getViewTreeObserver() }; observer[0].addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { public boolean onPreDraw() { observer[0].removeOnPreDrawListener(this); firstAnimation[0] = true; int firstVisiblePosition = megaListView.getFirstVisiblePosition(); for (int i = 0; i < megaListView.getChildCount(); ++i) { final View child = megaListView.getChildAt(i); int position = firstVisiblePosition + i; long itemId = getListView().getAdapter().getItemId(position); Integer formerTop = itemIdTopMap.get(itemId); int newTop = child.getTop(); if (formerTop != null) { if (formerTop != newTop) { int delta = formerTop - newTop; child.setTranslationY(delta); int MOVE_DURATION = 500; child.animate().setDuration(MOVE_DURATION).translationY(0); if (firstAnimation[0]) { child.animate().setListener(new AnimatorActionListener(new Runnable() { public void run() { mBackgroundContainer.hideBackground(); mSwiping = false; getListView().setEnabled(true); } }, AnimatorActionListener.ActionType.END)); firstAnimation[0] = false; } } } else { // Animate new views along with the others. The catch is that they did not // exist in the start state, so we must calculate their starting position // based on neighboring views. int childHeight = child.getHeight() + megaListView.getDividerHeight(); formerTop = newTop - childHeight; int delta = formerTop - newTop; final float z = ((CardView) child).getCardElevation(); ((CardView) child).setCardElevation(0f); child.setTranslationY(delta); final int MOVE_DURATION = 500; child.animate().setDuration(MOVE_DURATION).translationY(0); child.animate().setListener(new AnimatorActionListener(new Runnable() { public void run() { mBackgroundContainer.hideBackground(); mSwiping = false; getListView().setEnabled(true); ObjectAnimator anim = ObjectAnimator.ofFloat(child, "cardElevation", 0f, z); anim.setDuration(200); anim.setInterpolator(new AccelerateInterpolator()); anim.start(); } }, AnimatorActionListener.ActionType.END)); firstAnimation[0] = false; } } if (firstAnimation[0]) { mBackgroundContainer.hideBackground(); mSwiping = false; getListView().setEnabled(true); firstAnimation[0] = false; } itemIdTopMap.clear(); return true; } }); }