List of usage examples for java.lang Boolean booleanValue
@HotSpotIntrinsicCandidate public boolean booleanValue()
From source file:com.glaf.jbpm.action.SqlMapMultiTaskInstanceAction.java
public void execute(ExecutionContext ctx) { logger.debug("-------------------------------------------------------"); logger.debug("---------------MxMyBatisMultiTaskInstanceAction--------"); logger.debug("-------------------------------------------------------"); boolean executable = true; Map<String, Object> params = new java.util.HashMap<String, Object>(); ProcessInstance processInstance = ctx.getProcessInstance(); params.put("processInstanceId", processInstance.getId()); ContextInstance contextInstance = ctx.getContextInstance(); Map<String, Object> variables = contextInstance.getVariables(); if (variables != null && variables.size() > 0) { Set<Entry<String, Object>> entrySet = variables.entrySet(); for (Entry<String, Object> entry : entrySet) { String name = entry.getKey(); Object value = entry.getValue(); if (name != null && value != null && params.get(name) == null) { params.put(name, value); }/*from w w w. ja va2 s. c om*/ } } if (StringUtils.isNotEmpty(expression)) { if (expression.startsWith("#{") && expression.endsWith("}")) { Object value = DefaultExpressionEvaluator.evaluate(expression, params); if (value != null) { if (value instanceof Boolean) { Boolean b = (Boolean) value; executable = b.booleanValue(); } } } } if (!executable) { logger.debug("???false??"); return; } boolean exists = false; /** * ???? */ if (StringUtils.isNotEmpty(queryId)) { if (LogUtils.isDebug()) { logger.debug("queryId:" + queryId); } if (StringUtils.isNotEmpty(deptId)) { String tmp = deptId; Object value = deptId; if (tmp.startsWith("#{") && tmp.endsWith("}")) { value = DefaultExpressionEvaluator.evaluate(tmp, params); } else if (tmp.startsWith("#P{") && tmp.endsWith("}")) { tmp = StringTools.replaceIgnoreCase(tmp, "#P{", ""); tmp = StringTools.replaceIgnoreCase(tmp, "}", ""); value = contextInstance.getVariable(tmp); } params.put("deptId", value); } if (roleIds != null && roleIds.size() > 0) { Task task = null; if (StringUtils.isNotEmpty(taskName)) { Node node = ctx.getNode(); if (node instanceof TaskNode) { TaskNode taskNode = (TaskNode) node; task = taskNode.getTask(taskName); } } if (task == null) { task = ctx.getTask(); } if (task == null) { throw new JbpmException(" task is null"); } Token token = ctx.getToken(); TaskMgmtInstance tmi = ctx.getTaskMgmtInstance(); for (Object roleId : roleIds) { params.put("roleId", roleId); List<String> actorIds = new java.util.ArrayList<String>(); SqlMapContainer container = SqlMapContainer.getContainer(); Collection<?> actors = container.getList(ctx.getJbpmContext().getConnection(), queryId, params); if (actors != null && actors.size() > 0) { Iterator<?> iterator = actors.iterator(); while (iterator.hasNext()) { Object object = iterator.next(); String actorId = null; if (object instanceof String) { actorId = (String) object; } else if (object instanceof User) { User user = (User) object; actorId = user.getActorId(); } if (actorId != null) { actorIds.add(actorId); } } } String startActorId = (String) contextInstance.getVariable(Constant.PROCESS_STARTERID); actorIds.remove(startActorId); if (LogUtils.isDebug()) { logger.debug("actorIds:" + actorIds); } if (actorIds.size() > 0) { exists = true; if (isPooled) { TaskInstance taskInstance = tmi.createTaskInstance(task, token); taskInstance.setCreate(new Date()); if (task != null) { taskInstance.setSignalling(task.isSignalling()); } if (actorIds.size() == 1) { String actorId = actorIds.iterator().next(); taskInstance.setActorId(actorId); } else { int i = 0; String[] pooledIds = new String[actorIds.size()]; Iterator<String> iterator2 = actorIds.iterator(); while (iterator2.hasNext()) { pooledIds[i++] = iterator2.next(); } taskInstance.setPooledActors(pooledIds); } } else { Set<String> userIds = new HashSet<String>(); Iterator<String> iterator = actorIds.iterator(); while (iterator.hasNext()) { String actorId = iterator.next(); if (!userIds.contains(actorId)) { TaskInstance taskInstance = tmi.createTaskInstance(task, token); taskInstance.setActorId(actorId); taskInstance.setCreate(new Date()); if (task != null) { taskInstance.setSignalling(task.isSignalling()); } userIds.add(actorId); } } } if (StringUtils.isNotEmpty(sendMail) && StringUtils.equals(sendMail, "true")) { MailBean mailBean = new MailBean(); mailBean.setContent(content); mailBean.setSubject(subject); mailBean.setTaskContent(taskContent); mailBean.setTaskName(taskName); mailBean.setTemplateId(templateId); mailBean.execute(ctx, actorIds); } } } } if (!exists && leaveNodeIfActorNotAvailable) { contextInstance.setVariable(Constant.IS_AGREE, "true"); if (StringUtils.isNotEmpty(transitionName)) { ctx.leaveNode(transitionName); } else { ctx.leaveNode(); } return; } } }
From source file:de.cimt.talendcomp.connectionpool.BasicConnectionPool.java
public void setEnableJMX(Boolean enableJMX) { if (enableJMX != null) { this.enableJMX = enableJMX.booleanValue(); }//from w w w .ja va 2 s . com }
From source file:net.sourceforge.fenixedu.presentationTier.backBeans.sop.evaluation.WrittenEvaluationsByRoomBackingBean.java
public Map<InfoRoom, List<CalendarLink>> getWrittenEvaluationCalendarLinks() throws FenixServiceException { final Collection<InfoRoom> rooms = getRoomsToDisplayMap(); if (rooms != null) { AcademicInterval interval = getAcademicIntervalObject(); final AcademicInterval otherAcademicInterval; final Boolean includeEntireYear = getIncludeEntireYear(); if (includeEntireYear != null && includeEntireYear.booleanValue()) { otherAcademicInterval = interval.getPreviousAcademicInterval(); } else {/*from w w w. j a v a 2 s .co m*/ otherAcademicInterval = null; } final Map<InfoRoom, List<CalendarLink>> calendarLinksMap = new HashMap<InfoRoom, List<CalendarLink>>(); for (final InfoRoom infoRoom : rooms) { Space room = infoRoom.getRoom(); final List<CalendarLink> calendarLinks = new ArrayList<CalendarLink>(); for (final Occupation roomOccupation : room.getOccupationSet()) { if (roomOccupation instanceof WrittenEvaluationSpaceOccupation) { Collection<WrittenEvaluation> writtenEvaluations = ((WrittenEvaluationSpaceOccupation) roomOccupation) .getWrittenEvaluationsSet(); for (WrittenEvaluation writtenEvaluation : writtenEvaluations) { if (verifyWrittenEvaluationExecutionPeriod(writtenEvaluation, interval, otherAcademicInterval)) { final ExecutionCourse executionCourse = writtenEvaluation .getAssociatedExecutionCoursesSet().iterator().next(); final CalendarLink calendarLink = new CalendarLink(executionCourse, writtenEvaluation, I18N.getLocale()); calendarLink.setLinkParameters( constructLinkParameters(executionCourse, writtenEvaluation)); calendarLinks.add(calendarLink); } } } } calendarLinksMap.put(infoRoom, calendarLinks); } return calendarLinksMap; } else { return null; } }
From source file:er.extensions.ERXExtensions.java
/** * Turn EOAdaptor logging on and off./*from www . ja v a 2 s . com*/ * @param onOff */ public static void setAdaptorLogging(boolean onOff) { Boolean targetState = Boolean.valueOf(onOff); if (NSLog.debugLoggingAllowedForGroups( NSLog.DebugGroupSQLGeneration | NSLog.DebugGroupDatabaseAccess) != targetState.booleanValue()) { // Post a notification to give us a hook to perform other operations necessary to get logging going, e.g. change Logger settings, etc. NSNotificationCenter.defaultCenter() .postNotification(new NSNotification(eoAdaptorLoggingWillChangeNotification, targetState)); if (targetState.booleanValue()) { NSLog.allowDebugLoggingForGroups(NSLog.DebugGroupSQLGeneration | NSLog.DebugGroupDatabaseAccess); } else { NSLog.refuseDebugLoggingForGroups(NSLog.DebugGroupSQLGeneration | NSLog.DebugGroupDatabaseAccess); } } if (adaptorLogger != null) { if (targetState.booleanValue()) { adaptorLogger.info("Adaptor debug on"); } else { adaptorLogger.info("Adaptor debug off"); } } adaptorEnabled = targetState; }
From source file:net.sourceforge.fenixedu.domain.reports.TutorshipProgramReportFile.java
@Override public void renderReport(final Spreadsheet spreadsheet) throws Exception { spreadsheet.setHeader("Nmero"); spreadsheet.setHeader("Sexo"); spreadsheet.setHeader("Mdia"); spreadsheet.setHeader("Mdia Anual"); spreadsheet.setHeader("Nmero Inscries"); spreadsheet.setHeader("Nmero Aprovaes"); spreadsheet.setHeader("Nota de Seriao"); spreadsheet.setHeader("Local de Origem"); final ExecutionYear executionYear = getExecutionYear(); for (final Degree degree : Degree.readNotEmptyDegrees()) { if (checkDegreeType(getDegreeType(), degree)) { if (isActive(degree)) { for (final Registration registration : degree.getRegistrationsSet()) { if (registration.isRegistered(getExecutionYear())) { int enrolmentCounter = 0; int aprovalCounter = 0; BigDecimal bigDecimal = null; double totalCredits = 0; for (final Registration otherRegistration : registration.getStudent() .getRegistrationsSet()) { if (otherRegistration.getDegree() == registration.getDegree()) { for (final StudentCurricularPlan studentCurricularPlan : otherRegistration .getStudentCurricularPlansSet()) { for (final Enrolment enrolment : studentCurricularPlan.getEnrolmentsSet()) { final ExecutionSemester executionSemester = enrolment .getExecutionPeriod(); if (executionSemester.getExecutionYear() == executionYear) { enrolmentCounter++; if (enrolment.isApproved()) { aprovalCounter++; final Grade grade = enrolment.getGrade(); if (grade.isNumeric()) { final double credits = enrolment .getEctsCreditsForCurriculum().doubleValue(); totalCredits += credits; bigDecimal = bigDecimal == null ? grade.getNumericValue() .multiply(new BigDecimal(credits)) : bigDecimal.add(grade.getNumericValue() .multiply(new BigDecimal(credits))); } } } }/*from w ww . j a va 2 s . c o m*/ } } } final Row row = spreadsheet.addRow(); row.setCell(registration.getNumber().toString()); row.setCell(registration.getPerson().getGender().toLocalizedString()); row.setCell(registration.getAverage(executionYear)); if (bigDecimal == null) { row.setCell(""); } else { row.setCell( bigDecimal.divide(new BigDecimal(totalCredits), 5, RoundingMode.HALF_UP)); } row.setCell(Integer.toString(enrolmentCounter)); row.setCell(Integer.toString(aprovalCounter)); row.setCell( registration.getEntryGrade() != null ? registration.getEntryGrade().toString() : StringUtils.EMPTY); Boolean dislocated = null; if (registration.getStudentCandidacy() != null) { dislocated = registration.getStudentCandidacy() .getDislocatedFromPermanentResidence(); } final String dislocatedString = dislocated == null ? "" : (dislocated.booleanValue() ? "Deslocado" : "No Deslocado"); row.setCell(dislocatedString); } } } } } }
From source file:net.solarnetwork.node.setup.web.PluginController.java
@RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseBody/*from ww w. ja v a 2s .co m*/ public Response<PluginDetails> list(@RequestParam(value = "filter", required = false) final String filter, @RequestParam(value = "latestOnly", required = false) final Boolean latestOnly, final Locale locale) { PluginService service = pluginService.service(); if (service == null) { return response(new PluginDetails()); } SimplePluginQuery query = new SimplePluginQuery(); query.setSimpleQuery(filter); query.setLatestVersionOnly(latestOnly == null ? true : latestOnly.booleanValue()); List<Plugin> available = service.availablePlugins(query, locale); List<Plugin> installed = service.installedPlugins(locale); return response(new PluginDetails(available, installed)); }
From source file:net.reichholf.dreamdroid.abstivities.AbstractHttpListActivity.java
/** * @param key/*from w w w. j a v a 2 s.c o m*/ * @param dfault * @return */ public boolean getDataForKey(String key, boolean dfault) { if (mData != null) { Boolean b = (Boolean) mData.get(key); if (b != null) { return b.booleanValue(); } } return dfault; }
From source file:com.sirma.itt.cmf.integration.alfresco3.CMFWorkflowDeployer.java
/** * Deploy./*www . j a v a 2s . c om*/ * * @param nodeRef * the node ref * @param redeploy * the redeploy */ public void deploy(NodeRef nodeRef, boolean redeploy) { // Ignore if the node is a working copy if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY) == false) { Boolean value = (Boolean) nodeService.getProperty(nodeRef, WorkflowModel.PROP_WORKFLOW_DEF_DEPLOYED); if ((value != null) && (value.booleanValue() == true)) { String engineId = (String) nodeService.getProperty(nodeRef, WorkflowModel.PROP_WORKFLOW_DEF_ENGINE_ID); if (!redeploy && workflowService.isDefinitionDeployed(nodeRef)) { if (logger.isDebugEnabled()) logger.debug("Workflow deployer: Definition '" + nodeRef + "' already deployed"); } else { // deploy / re-deploy WorkflowDeployment deployment = workflowService.deployDefinition(nodeRef); logDeployment(nodeRef, deployment); if (deployment != null) { WorkflowDefinition def = deployment.getDefinition(); // Update the meta data for the model Map<QName, Serializable> props = nodeService.getProperties(nodeRef); props.put(WorkflowModel.PROP_WORKFLOW_DEF_NAME, def.getName()); // TODO - ability to return and handle deployment // problems / warnings if (deployment.getProblems().length > 0) { for (String problem : deployment.getProblems()) { if (logger.isWarnEnabled()) logger.warn(problem); } } nodeService.setProperties(nodeRef, props); } } } } else { if (logger.isDebugEnabled()) logger.debug( "Workflow deployer: Definition '" + nodeRef + "' not deployed since it is a working copy"); } }
From source file:br.mdarte.exemplo.academico.cd.CursoDAO.java
/** * Lista todos os objetos./*from w w w. j av a2 s . c o m*/ * * @return Lista de objetos */ public List<AbstractEntity> list(PaginationStrategy paginacao, String propriedade, Boolean desc) throws DAOException { try { Session session = currentSession(); String hql = "from br.mdarte.exemplo.academico.cd.Curso"; if (propriedade != null && !propriedade.equals("")) { String order = desc.booleanValue() ? " desc" : " asc"; hql += " order by " + propriedade + order; } org.hibernate.Query qry = session.createQuery(hql); if (paginacao == null) paginacao = new NoPagination(); paginacao.paginateResult(qry); qry.setCacheable(true); return qry.list(); } catch (HibernateException h) { throw new DAOException(h); } }
From source file:net.solarnetwork.node.control.modbus.toggle.ModbusToggler.java
@Override public InstructionState processInstruction(Instruction instruction) { // look for a parameter name that matches a control ID InstructionState result = null;/*ww w .ja va 2s .c o m*/ log.debug("Inspecting instruction {} against control {}", instruction.getId(), controlId); for (String paramName : instruction.getParameterNames()) { log.trace("Got instruction parameter {}", paramName); if (controlId.equals(paramName)) { // treat parameter value as a boolean String String str = instruction.getParameterValue(controlId); Boolean desiredValue = Boolean.parseBoolean(str); Boolean modbusResult = null; try { modbusResult = setValue(desiredValue); } catch (Exception e) { log.warn("Error handling instruction {} on control {}: {}", instruction.getTopic(), controlId, e.getMessage()); } if (modbusResult != null && modbusResult.booleanValue()) { result = InstructionState.Completed; } else { result = InstructionState.Declined; } } } return result; }