List of usage examples for java.lang Integer intValue
@HotSpotIntrinsicCandidate public int intValue()
From source file:com.formkiq.core.controller.user.DesignerController.java
/** * User Workflow Edit page.// w w w . j a v a 2s .c om * @param request {@link HttpServletRequest} * @param response {@link HttpServletResponse} * @param execution {@link String} * @return {@link ModelAndView} * @throws Exception Exception */ @RequestMapping(value = { "/edit" }, method = RequestMethod.GET) public ModelAndView edit(final HttpServletRequest request, final HttpServletResponse response, final @RequestParam(name = "execution", required = false) String execution) throws Exception { WebFlow flow = FlowManager.get(request); this.flowEventService.processGetRequest(flow, request); try { Object result = this.flowEventService.processRequest(request); if (result != null && result instanceof ModelAndView) { ModelAndView mav = (ModelAndView) result; if (!mav.getModel().containsKey("flow")) { return mav; } } } catch (FlowEventMethodNotFound e) { // ignore } if (!flow.getSessionKey().equals(execution)) { Pair<String, Integer> split = FlowManager.getExecutionSessionKey(execution); Integer eventId = split.getRight(); if (eventId != null) { flow.setEventId(eventId.intValue()); } } return new ModelAndView("user/designer/edit", "flow", flow); }
From source file:CountedSet.java
/** * Reduces the count associated with this object by 1. If this causes the count * to become 0, then the object is removed form the set. * @param o The object whose count is being reduced. *//*w w w . j a v a 2 s . c o m*/ public void subtract(Object o) { Integer count = (Integer) cset.get(o); if (count != null) { int c = count.intValue() - 1; if (c == 0) { cset.remove(o); } else { cset.put(o, Integer.valueOf(c)); } } }
From source file:com.socialize.test.blackbox.HttpUtilsTest.java
@UsesMocks({ HttpResponse.class, StatusLine.class }) public void testHttpIsAuthErrorFromResponse() { final int code = 69; HttpResponse response = AndroidMock.createMock(HttpResponse.class); StatusLine statusLine = AndroidMock.createMock(StatusLine.class); AndroidMock.expect(response.getStatusLine()).andReturn(statusLine); AndroidMock.expect(statusLine.getStatusCode()).andReturn(69); AndroidMock.replay(response);//from w w w. j a v a 2s .com AndroidMock.replay(statusLine); HttpUtils utils = new HttpUtils() { @Override public boolean isAuthError(int code) { addResult(code); return super.isAuthError(code); } }; utils.isAuthError(response); Integer result = getNextResult(); assertNotNull(result); assertEquals(code, result.intValue()); AndroidMock.verify(response); AndroidMock.verify(statusLine); }
From source file:com.socialize.test.blackbox.HttpUtilsTest.java
@UsesMocks({ SocializeApiError.class }) public void test_isAuthErrorWithException() { int resultCode = 69; String message = "foobar"; SocializeApiError error = AndroidMock.createMock(SocializeApiError.class, resultCode, message); AndroidMock.expect(error.getResultCode()).andReturn(resultCode); AndroidMock.replay(error);//from ww w . j a v a 2s . co m HttpUtils utils = new HttpUtils() { @Override public boolean isAuthError(int code) { addResult(code); return false; } }; utils.isAuthError(error); AndroidMock.verify(error); Integer result = getNextResult(); assertNotNull(result); assertEquals(resultCode, result.intValue()); }
From source file:edu.utah.further.security.impl.services.DatasourceAuthenticatedUserDetailsService.java
@Override public void setContext(final Integer context) { this.dataSourceId = context.intValue(); }
From source file:com.benfante.minimark.po.OpenQuestionFilling.java
@Transient public Integer getCharsLeft() { Integer maxLength = ((OpenQuestion) this.getOriginalQuestion()).getAnswerMaxLength(); if (maxLength != null) { int currLength = this.getAnswer() != null ? this.getAnswer().length() : 0; return maxLength.intValue() - currLength; }/*ww w . j a v a2 s . c o m*/ return null; }
From source file:com.cyclopsgroup.tornado.hibernate.HqlLargeList.java
/** * Overwrite or implement method getSize() * * @see com.cyclopsgroup.waterview.LargeList#getSize() *///from ww w. j av a2 s . c o m public int getSize() throws Exception { String countQuery = "SELECT COUNT(*) " + hql; Session s = hibernate.getSession(dataSource); Query query = s.createQuery(countQuery); HashSet parameterNames = new HashSet(); CollectionUtils.addAll(parameterNames, query.getNamedParameters()); for (Iterator i = parameters.values().iterator(); i.hasNext();) { Parameter p = (Parameter) i.next(); if (parameterNames.contains(p.getName())) { query.setParameter(p.getName(), p.getValue(), p.getType()); } } List result = query.list(); if (result == null || result.isEmpty()) { return -1; } Integer i = (Integer) result.get(0); return i.intValue(); }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.commons.student.ReadStudentListByCurricularCourse.java
private List cleanList(final List<Enrolment> enrolmentList) throws FenixServiceException { if (enrolmentList.isEmpty()) { throw new NonExistingServiceException(); }/*w ww . j a v a 2 s . c om*/ Integer studentNumber = null; final List<InfoEnrolment> result = new ArrayList<InfoEnrolment>(); for (final Enrolment enrolment : enrolmentList) { if (studentNumber == null || studentNumber.intValue() != enrolment.getStudentCurricularPlan() .getRegistration().getNumber().intValue()) { studentNumber = enrolment.getStudentCurricularPlan().getRegistration().getNumber(); result.add(InfoEnrolment.newInfoFromDomain(enrolment)); } } Collections.sort(result, new BeanComparator("infoStudentCurricularPlan.infoStudent.number")); return result; }
From source file:org.iwethey.forums.web.post.ReplyPostController.java
/** * Load a blank user object for the form backing. If the nickname * has been entered already (but the password was wrong) place * it in the Post object.//from www . j a v a 2s . c o m * <p> * @param request The servlet request object. * @return A prepopulated Post object for use in the JSP form. */ @Override protected Object formBackingObject(HttpServletRequest request) throws ServletException { int responseId = RequestUtils.getRequiredIntParameter(request, "postid"); Post respondTo = getPostManager().getPostById(responseId); Integer id = (Integer) WebUtils.getSessionAttribute(request, USER_ID_ATTRIBUTE); User user = getUserManager().getUserById(id.intValue()); Forum forum = respondTo.getForum(); Post post = new Post(); post.setParent(respondTo); post.setForum(forum); post.setThread(respondTo.getThread()); post.setCreatedBy(user); post.setOriginalSignature(user.getSignature()); if (user.getAutofillSubject()) { String subject = respondTo.getSubject(); if (!(subject.startsWith("Re: ") || subject.startsWith("re: "))) { int end = subject.length(); if (end > POST_SUBJECT_LENGTH - 4) { end = POST_SUBJECT_LENGTH - 4; } subject = "Re: " + subject.substring(0, end); } post.setSubject(subject); } return post; }
From source file:com.aurel.track.fieldType.fieldChange.converter.DateSetterConverter.java
/** * Convert the string to object value after load * @param value//from w w w . j av a 2 s .c om * @param setter * @return */ @Override public Object getActualValueFromStoredString(String value, Integer setter) { if (value == null || value.trim().length() == 0 || value.trim().equals("null") || setter == null) { return null; } switch (setter.intValue()) { case FieldChangeSetters.MOVE_BY_DAYS: case FieldChangeSetters.SET_TO_DATE_FIELD_VALUE: Integer intValue = null; try { intValue = Integer.valueOf(value); } catch (Exception e) { LOGGER.info("Converting the " + value + " to Integer from string failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } return intValue; case FieldChangeSetters.SET_TO: return DateTimeUtils.getInstance().parseISODate(value); } return null; }