List of usage examples for java.lang Boolean booleanValue
@HotSpotIntrinsicCandidate public boolean booleanValue()
From source file:com.duroty.application.bookmark.actions.UpdateBookmarkAction.java
protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionMessages errors = new ActionMessages(); try {/* w w w .j a v a2 s. c o m*/ DynaActionForm _form = (DynaActionForm) form; Bookmark bookmarkInstance = getBookmarkInstance(request); BookmarkObj bookmarkObj = new BookmarkObj(); bookmarkObj.setIdint(_form.getString("idint")); bookmarkObj.setUrl(_form.getString("url")); bookmarkObj.setTitle(_form.getString("title")); bookmarkObj.setComments(_form.getString("comments")); bookmarkObj.setKeywords(_form.getString("keywords")); Boolean flagged = (Boolean) _form.get("flagged"); if (flagged == null) { flagged = new Boolean(false); } bookmarkObj.setFlagged(flagged.booleanValue()); if (!StringUtils.isBlank(_form.getString("comments"))) { bookmarkObj.setNotebook(true); } else { bookmarkObj.setNotebook(false); } bookmarkInstance.updateBookmark(bookmarkObj); } catch (Exception ex) { String errorMessage = ExceptionUtilities.parseMessage(ex); if (errorMessage == null) { errorMessage = "NullPointerException"; } errors.add("general", new ActionMessage(ExceptionCode.ERROR_MESSAGES_PREFIX + "general", errorMessage)); request.setAttribute("exception", errorMessage); doTrace(request, DLog.ERROR, getClass(), errorMessage); } finally { } if (errors.isEmpty()) { doTrace(request, DLog.INFO, getClass(), "OK"); return mapping.findForward(Constants.ACTION_SUCCESS_FORWARD); } else { saveErrors(request, errors); return mapping.findForward(Constants.ACTION_FAIL_FORWARD); } }
From source file:piazza.services.ingest.test.ControllerTests.java
/** * Test updating a Service// ww w . j av a 2 s . com */ @Test public void testServiceUpdate() throws Exception { // Mock Service mockService = new Service(); mockService.setUrl("http://test.com/service"); mockService.setContractUrl("http://test.com/contract"); mockService.setMethod("GET"); mockService.setResourceMetadata(new ResourceMetadata()); mockService.setServiceId("123456"); mockService.getResourceMetadata().setName("Test Service"); ServiceContainer mockContainer = new ServiceContainer(mockService); Mockito.doReturn(mockContainer).when(template).findOne(Mockito.eq("pzservices"), Mockito.eq("ServiceContainer"), Mockito.eq("123456"), Mockito.any()); Mockito.doReturn(new Boolean(true)).when(template).index(Mockito.eq("pzservices"), Mockito.eq("ServiceContainer"), Mockito.any()); Mockito.doReturn(true).when(template).delete(Mockito.eq("pzservices"), Mockito.eq("ServiceContainer"), Mockito.any(ServiceContainer.class)); // Test Boolean isSuccess = controller.updateServiceDocById(mockService); // Verify Assert.assertTrue(isSuccess.booleanValue()); }
From source file:CSVXMLReader.java
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { Boolean featureValue = (Boolean) this.featureMap.get(name); return (featureValue == null) ? false : featureValue.booleanValue(); }
From source file:com.duroty.application.bookmark.utils.BookmarkDefaultAction.java
/** * DOCUMENT ME!//from w ww. j ava2 s. c om * * @param request DOCUMENT ME! * * @return DOCUMENT ME! * * @throws NamingException DOCUMENT ME! * @throws RemoteException DOCUMENT ME! * @throws CreateException DOCUMENT ME! */ protected Bookmark getBookmarkInstance(HttpServletRequest request) throws NamingException, RemoteException, CreateException { BookmarkHome home = null; Boolean localServer = new Boolean(Configuration.properties.getProperty(Configuration.LOCAL_WEB_SERVER)); if (localServer.booleanValue()) { home = BookmarkUtil.getHome(); } else { Hashtable environment = getContextProperties(request); home = BookmarkUtil.getHome(environment); } return home.create(); }
From source file:com.aurel.track.fieldType.runtime.matchers.run.AccountingTimeMatcherRT.java
/** * Whether the value matches or not//from w ww . j a va2 s . c om * * @param attributeValue * @return */ @Override public boolean match(Object attributeValue) { Boolean nullMatch = nullMatcher(attributeValue); if (nullMatch != null) { return nullMatch.booleanValue(); } if (attributeValue == null || matchValue == null) { return false; } AccountingTimeTO attributeValueAccountingTime = null; AccountingTimeTO matcherValueAccountingTime = null; try { attributeValueAccountingTime = (AccountingTimeTO) attributeValue; } catch (Exception e) { LOGGER.error("Converting the attribute value " + attributeValue + " of type " + attributeValue.getClass().getName() + " to AccountingTimeTO failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); return false; } try { matcherValueAccountingTime = (AccountingTimeTO) matchValue; } catch (Exception e) { LOGGER.warn("Converting the matcher value " + matchValue + " of type " + matchValue.getClass().getName() + " to AccountingTimeTO failed with " + e.getMessage(), e); return false; } Double attributeValueDouble = attributeValueAccountingTime.getValue(); Double matcherValueDouble = matcherValueAccountingTime.getValue(); if (attributeValueDouble == null || matcherValueDouble == null) { return false; } Integer attributeValueUnit = attributeValueAccountingTime.getUnit(); Integer matcherValueUnit = matcherValueAccountingTime.getUnit(); if (attributeValueUnit == null) { attributeValueUnit = TIMEUNITS.HOURS; } if (matcherValueUnit == null) { matcherValueUnit = TIMEUNITS.HOURS; } if (!attributeValueUnit.equals(matcherValueUnit)) { if (attributeValueUnit.intValue() != TIME_UNIT.HOUR) { attributeValueDouble = AccountingBL.transformToTimeUnits(attributeValueDouble, this.getHourPerWorkday(), attributeValueUnit, TIME_UNIT.HOUR).doubleValue(); } if (matcherValueUnit.intValue() != TIME_UNIT.HOUR) { matcherValueDouble = AccountingBL.transformToTimeUnits(matcherValueDouble, this.getHourPerWorkday(), matcherValueUnit, TIME_UNIT.HOUR).doubleValue(); } } switch (relation) { case MatchRelations.EQUAL: return (Double.doubleToRawLongBits(attributeValueDouble.doubleValue()) - Double.doubleToRawLongBits(matcherValueDouble.doubleValue()) == 0); case MatchRelations.NOT_EQUAL: return (Double.doubleToRawLongBits(attributeValueDouble.doubleValue()) - Double.doubleToRawLongBits(matcherValueDouble.doubleValue()) != 0); case MatchRelations.GREATHER_THAN: return attributeValueDouble.doubleValue() > matcherValueDouble.doubleValue(); case MatchRelations.GREATHER_THAN_EQUAL: return attributeValueDouble.doubleValue() >= matcherValueDouble.doubleValue(); case MatchRelations.LESS_THAN: return attributeValueDouble.doubleValue() < matcherValueDouble.doubleValue(); case MatchRelations.LESS_THAN_EQUAL: return attributeValueDouble.doubleValue() <= matcherValueDouble.doubleValue(); default: return false; } }
From source file:es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.GestorSubmanifiestosControllerImpl.java
public final void navegarSubmanifiesto(ActionMapping mapping, es.pode.empaquetador.presentacion.avanzado.submanifiestos.gestor.NavegarSubmanifiestoForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { boolean encontrado = false; String identificador = form.getIdentifier(); EmpaquetadorSession sesEmpaq = this.getEmpaquetadorSession(request); List subman = sesEmpaq.getSubmanifestPath(); // ultimo ODE OdeVO ode = (OdeVO) subman.get(subman.size() - 1); Integer index = subman.size() - 1; String identificadorOde = index == 0 ? sesEmpaq.getIdLocalizador() : ode.getIdentifier(); // cojo los hijos del ultimo ODE OdeVO[] hijos = ode.getSubmanifiestos(); // los recorro viendo si coinciden for (int i = 0; (encontrado == false && i < hijos.length); i++) { if (hijos[i].getIdentifier().equals(identificador)) { encontrado = true;//from w w w . j av a 2 s .c o m Boolean nuevoOde = this.getSrvGestorManifestService().crearReferenciaEnCache(identificadorOde, identificador); if (nuevoOde.booleanValue() == false) { throw new ValidatorException("{portal_empaquetado_gestorSubman.exception}"); } else { subman.add(hijos[i]); } } } if (encontrado == false) { // recorro el sesEmpaq.getSubmanifestPath(); for (int i = 0; (i < subman.size() && !encontrado); i++) { OdeVO submanifiesto = (OdeVO) subman.get(i); if (submanifiesto.getIdentifier().equals(identificador)) { // Voy a borrar a partir del identificador encontrado encontrado = true; for (int j = i + 1; j < subman.size(); j++) { OdeVO elemento = (OdeVO) subman.get(j); this.getSrvGestorManifestService().descargarManifest(elemento.getIdentifier()); subman.remove(j); } } } sesEmpaq.setSubmanifestPath(subman); } }
From source file:net.sourceforge.fenixedu.domain.Professorship.java
@Atomic public static Professorship create(Boolean responsibleFor, ExecutionCourse executionCourse, Person person, Double hours) throws MaxResponsibleForExceed, InvalidCategory { for (final Professorship otherProfessorship : executionCourse.getProfessorshipsSet()) { if (person == otherProfessorship.getPerson()) { throw new DomainException("error.teacher.already.associated.to.professorship"); }/*from w ww . j a va2 s . c om*/ } if (responsibleFor == null || executionCourse == null || person == null) { throw new NullPointerException(); } Professorship professorShip = new Professorship(); professorShip.setHours((hours == null) ? new Double(0.0) : hours); professorShip.setExecutionCourse(executionCourse); professorShip.setPerson(person); professorShip.setCreator(AccessControl.getPerson()); if (responsibleFor.booleanValue() && professorShip.getPerson().getTeacher() != null) { ResponsibleForValidator.getInstance().validateResponsibleForList(professorShip.getPerson().getTeacher(), professorShip.getExecutionCourse(), professorShip); professorShip.setResponsibleFor(Boolean.TRUE); } else { professorShip.setResponsibleFor(Boolean.FALSE); } if (person.getTeacher() != null) { executionCourse.moveSummariesFromTeacherToProfessorship(person.getTeacher(), professorShip); } ProfessorshipManagementLog.createLog(professorShip.getExecutionCourse(), Bundle.MESSAGING, "log.executionCourse.professorship.added", professorShip.getPerson().getPresentationName(), professorShip.getExecutionCourse().getNome(), professorShip.getExecutionCourse().getDegreePresentationString()); return professorShip; }
From source file:com.benfante.minimark.controllers.AssessmentFillingController.java
private boolean resultIsPrintable(AssessmentFilling assessmentFilling) { boolean result = false; final Boolean allowStudentPrint = assessmentFilling.getAssessment().getAllowStudentPrint(); if (allowStudentPrint != null && allowStudentPrint.booleanValue() == true) { result = true;//from w w w. j a v a 2 s. co m } return result; }
From source file:org.esupportail.dining.web.controllers.EditAdminController.java
@RequestMapping public ModelAndView renderEditAdminView(HttpServletRequest request) throws Exception { ModelMap model = new ModelMap(); User user = this.authenticator.getUser(); model.put("user", user); // try {//from w ww . ja v a2s. co m /* Get all area in the current feed */ try { Set<String> areaList = new HashSet<String>(); for (Restaurant r : this.feed.getFeed().getRestaurants()) { areaList.add(r.getArea()); } model.put("areaList", areaList); } catch (Exception e) { // Here we go if the URL isn't set. } String[] areanames = null; List<FeedInformation> feedInfoList = new ArrayList<FeedInformation>(); ResultSet results = null; try { results = this.dc.executeQuery("SELECT * FROM PATHFLUX"); while (results.next()) { FeedInformation feedInfo = new FeedInformation(results.getInt("id"), results.getString("name"), results.getString("areaname"), results.getString("urlflux"), results.getBoolean("is_default")); feedInfoList.add(feedInfo); } } catch (SQLException e) { // URL isn't set yet... } try { for (FeedInformation fi : feedInfoList) { if (fi.isDefault()) { String areaname = fi.getAreaname(); areanames = (areaname == null ? "" : areaname).split(","); } } } catch (Exception e) { // URL may be set be default area is not } model.put("feedList", feedInfoList); model.put("defaultArea", areanames); /* Action urlFeed set urlError if form URL was not well-formed */ String hasError = request.getParameter("urlError"); if (hasError != null) { model.put("urlError", hasError); } /* Action setDefaultArea set urlError if form URL was not well-formed */ String areaSubmit = request.getParameter("areaSubmit"); if (areaSubmit != null) { model.put("areaSubmit", areaSubmit); } /* From ForceFeedUpdate */ if (request.getParameter("update") != null) { Boolean isUpdated = new Boolean(request.getParameter("update")); if (isUpdated.booleanValue()) { model.put("updateFeed", "The feed has been correctly updated"); } else { model.put("updateFeed", "The feed is already up to date"); } } return new ModelAndView("editadmin", model); }
From source file:org.slc.sli.dashboard.web.controller.ConfigController.java
/** * Controller for client side data pulls without id. * The 'params' parameter contains a map of url query parameters. The parameters are matched * to the attributes in the JSON config files. * * e.g. /s/c/cfg?type=LAYOUT&id=school *///from w ww .j av a 2 s .c om @RequestMapping(value = "/s/c/cfg", method = RequestMethod.GET) @ResponseBody public Collection<Config> handleConfigSearch(@RequestParam Map<String, String> params, final HttpServletRequest request, HttpServletResponse response) { String token = SecurityUtil.getToken(); // check user is an admin Boolean isAdmin = SecurityUtil.isAdmin(); if (isAdmin != null && isAdmin.booleanValue()) { return configManager.getConfigsByAttribute(token, userEdOrgManager.getUserEdOrg(token), params); } else { response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return null; } }