List of usage examples for java.lang Boolean booleanValue
@HotSpotIntrinsicCandidate public boolean booleanValue()
From source file:com.jaspersoft.jasperserver.remote.handlers.ReportUnitHandler.java
/** * * The updateResource method for the report unit just set basic options of the report unit and check for a datasource, * the main jrxml and if available the main query. * * * @param resource//w w w. ja va 2s. c o m * @param descriptor * @param options * @throws ServiceException */ @Override public void updateResource(Resource resource, ResourceDescriptor descriptor, Map options) throws ServiceException { super.updateResource(resource, descriptor, options); ReportUnit reportUnit = (ReportUnit) resource; Boolean alwaysPrompt = descriptor .getResourcePropertyValueAsBoolean(ResourceDescriptor.PROP_RU_ALWAYS_PROPMT_CONTROLS); if (alwaysPrompt != null) { reportUnit.setAlwaysPromptControls(alwaysPrompt.booleanValue()); } Integer controlsLayout = descriptor .getResourcePropertyValueAsInteger(ResourceDescriptor.PROP_RU_CONTROLS_LAYOUT); if (controlsLayout != null) { reportUnit.setControlsLayout(controlsLayout.byteValue()); } String controlsView = descriptor .getResourcePropertyValue(ResourceDescriptor.PROP_RU_INPUTCONTROL_RENDERING_VIEW); if (controlsView != null) { reportUnit.setInputControlRenderingView(controlsView); } String renderingView = descriptor .getResourcePropertyValue(ResourceDescriptor.PROP_RU_REPORT_RENDERING_VIEW); if (renderingView != null) { reportUnit.setReportRenderingView(renderingView); } List children = descriptor.getChildren(); for (int i = 0; i < children.size(); ++i) { ResourceDescriptor childResource = (ResourceDescriptor) children.get(i); if (isDataSource(childResource)) { if (childResource.getIsReference()) { reportUnit.setDataSourceReference(childResource.getReferenceUri()); } else { ReportDataSource dataSource = (ReportDataSource) createChildResource(childResource); reportUnit.setDataSource(dataSource); } } else if (ResourceDescriptor.isFileType(childResource.getWsType()) || childResource.getWsType().equals(ResourceDescriptor.TYPE_REFERENCE)) { if (childResource.isMainReport()) { String referenceURI = childResource.getReferenceUri(); if (referenceURI != null && referenceURI.trim().length() > 0) { reportUnit.setMainReportReference(referenceURI); } else { FileResource fileResource = (FileResource) createChildResource(childResource); fileResource.setFileType(childResource.getWsType()); reportUnit.setMainReport(fileResource); } } else { FileResource fileResource = (FileResource) createChildResource(childResource); reportUnit.addResource(fileResource); } } else if (childResource.getWsType().equals(ResourceDescriptor.TYPE_INPUT_CONTROL)) { String referenceURI = childResource.getReferenceUri(); if (referenceURI != null && referenceURI.trim().length() > 0) { reportUnit.addInputControlReference(referenceURI); } else { InputControl ic = (InputControl) createChildResource(childResource); reportUnit.addInputControl(ic); } } } }
From source file:de.hybris.platform.marketplaceintegrationbackoffice.renderer.MarketplaceIntegrationOrderRequestRenderer.java
private void orderRequestDownload(final MarketplaceStoreModel model) { if (null == model.getRequestStartTime()) { NotificationUtils/*from w w w . jav a2 s . c o m*/ .notifyUserVia( Localization.getLocalizedString( "type.Marketplacestore." + MarketplaceStoreModel.REQUESTSTARTTIME + ".name") + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, ""); LOG.warn("Order request start time is not filled!"); return; } else if (null == model.getRequestEndTime()) { NotificationUtils.notifyUserVia(Localization .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.REQUESTENDTIME + ".name") + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, ""); LOG.warn("Order request end time is not filled!"); return; } else if (model.getRequestStartTime().after(model.getRequestEndTime())) { NotificationUtils.notifyUserVia(Labels.getLabel("backoffice.field.timerange.error"), NotificationEvent.Type.WARNING, ""); LOG.warn("start time is greater than end time!"); return; } if (!StringUtils.isBlank(model.getIntegrationId()) && !model.getAuthorized().booleanValue()) { NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"), NotificationEvent.Type.WARNING, ""); LOG.warn("authorization is expired!"); return; } //in order to avoid this value out of date, we only get it from database final Boolean isAuth = ((MarketplaceStoreModel) modelService.get(model.getPk())).getAuthorized(); final String integrationId = ((MarketplaceStoreModel) modelService.get(model.getPk())).getIntegrationId(); model.setIntegrationId(integrationId); model.setAuthorized(isAuth); if (null == isAuth || !isAuth.booleanValue()) { NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.unauthed"), NotificationEvent.Type.WARNING, ""); LOG.warn("marketplace store do not authorized, download refund/return order failed!"); return; } String urlStr = ""; final String logUUID = logUtil.getUUID(); final MarketplaceSellerModel seller = model.getMarketplaceSeller(); final MarketplaceModel marketPlace = seller.getMarketplace(); try { // Configure and open a connection to the site you will send the urlStr = marketPlace.getAdapterUrl() + Config.getParameter(MARKETPLACE_REFUND_SYCHRONIZE_PATH) + Config.getParameter(MARKETPLACE_REFUND_REQUEST_PATH) + integrationId + Config.getParameter(MARKETPLACE_REFUND_REQUEST_LOGUUID) + logUUID; final JSONObject jsonObj = new JSONObject(); jsonObj.put("batchSize", BATCH_SIZE); //set the correct timezone final String configTimezone = model.getMarketplace().getTimezone(); boolean isValidTimezone = false; for (final String vaildTimezone : TimeZone.getAvailableIDs()) { if (vaildTimezone.equals(configTimezone)) { isValidTimezone = true; break; } } if (!isValidTimezone) { final String[] para = { configTimezone == null ? "" : configTimezone, model.getMarketplace().getName() }; NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.wrongtimezone", para), NotificationEvent.Type.WARNING, ""); LOG.warn("wrong timezone or missing timezone configed in market:" + model.getMarketplace().getName()); return; } final SimpleDateFormat format = new SimpleDateFormat(Config.getParameter(BACKOFFICE_FORMAT_DATEFORMAT)); format.setTimeZone(TimeZone.getTimeZone(configTimezone)); final String startTimeWithCorrectZone = format.format(model.getRequestStartTime()).toString(); final String endTimeWithCorrectZone = format.format(model.getRequestEndTime()).toString(); logUtil.addMarketplaceLog("PENDING", integrationId, Labels.getLabel("marketplace.order.requestorder.action"), model.getItemtype(), marketPlace, model, logUUID); jsonObj.put("startCreated", startTimeWithCorrectZone); jsonObj.put("endCreated", endTimeWithCorrectZone); jsonObj.put("productCatalogVersion", model.getCatalogVersion().getCatalog().getId() + ":" + model.getCatalogVersion().getVersion()); jsonObj.put("currency", model.getCurrency().getIsocode()); marketplaceHttpUtil.post(urlStr, jsonObj.toJSONString()); } catch (final HttpClientErrorException httpError) { if (httpError.getStatusCode().is4xxClientError()) { LOG.error("========================================================================="); LOG.error("Order Request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Error Status Code: " + httpError.getStatusCode().toString()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Requested Tmall service URL is not correct!"); LOG.error("-------------------------------------------------------------------------"); LOG.error("Detail error info: " + httpError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.request.post.error"), NotificationEvent.Type.FAILURE, ""); } if (httpError.getStatusCode().is5xxServerError()) { LOG.error("========================================================================="); LOG.error("Order Request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Error Status Code: " + httpError.getStatusCode().toString()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Requested Json Ojbect is not correct!"); LOG.error("-------------------------------------------------------------------------"); LOG.error("Detail error info: " + httpError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"), NotificationEvent.Type.FAILURE, ""); } LOG.error(httpError.toString()); return; } catch (final ResourceAccessException raError) { LOG.error("========================================================================="); LOG.error("Order Request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Order Request server access failed!"); LOG.error("-------------------------------------------------------------------------"); LOG.error("Detail error info: " + raError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.access.error"), NotificationEvent.Type.FAILURE, ""); return; } catch (final HttpServerErrorException serverError) { LOG.error("========================================================================="); LOG.error("Order Request post to Tmall failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Order Request server process failed!"); LOG.error("-------------------------------------------------------------------------"); LOG.error("Detail error info: " + serverError.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"), NotificationEvent.Type.FAILURE, ""); return; } catch (final Exception e) { LOG.error("========================================================================="); LOG.error("Order Request failed!"); LOG.error("Marketplacestore Code: " + model.getName()); LOG.error("Request path: " + urlStr); LOG.error("-------------------------------------------------------------------------"); LOG.error("Failed Reason:"); LOG.error("Order Request server process failed!"); LOG.error("-------------------------------------------------------------------------"); LOG.error("Detail error info: " + e.getMessage()); LOG.error("========================================================================="); NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.fail"), NotificationEvent.Type.FAILURE, ""); return; } NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.success"), NotificationEvent.Type.SUCCESS, ""); }
From source file:com.ikanow.aleph2.distributed_services.utils.TestKafkaUtils.java
License:asdf
/** * Tests sending a topic that doesn't exist for deletion, should * just ignore the request and carry on. * //from ww w. j a v a 2 s .co m */ @Test public void testDeleteNonExistantTopic() { final String topic = "test_delete_topic_dne"; final ZkUtils zk_client = KafkaUtils.getNewZkClient(); assertFalse(KafkaUtils.doesTopicExist(topic, zk_client)); //delete topic just quietly ignores the request KafkaUtils.deleteTopic(topic, zk_client); assertFalse(KafkaUtils.doesTopicExist(topic, zk_client)); //assert that its been kicked from the caches Boolean does_topic_exist = KafkaUtils.known_topics.getIfPresent(topic); if (does_topic_exist != null) { assertFalse(does_topic_exist.booleanValue()); } assertFalse(KafkaUtils.my_topics.containsKey(topic)); }
From source file:com.glaf.jbpm.action.SqlMapTaskInstanceAction.java
public void execute(ExecutionContext ctx) { logger.debug("-------------------------------------------------------"); logger.debug("---------------MyBatis3TaskInstanceAction----------------"); logger.debug("-------------------------------------------------------"); boolean executable = true; Map<String, Object> params = new java.util.HashMap<String, Object>(); 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 ww w. j a va2 s . c o m } } ProcessInstance processInstance = ctx.getProcessInstance(); params.put("processInstanceId", processInstance.getId()); 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; } List<String> actorIds = new java.util.ArrayList<String>(); if (StringUtils.isNotEmpty(dynamicActors)) { String actorId = (String) contextInstance.getVariable(dynamicActors); if (StringUtils.isNotEmpty(actorId)) { StringTokenizer st2 = new StringTokenizer(actorId, ","); while (st2.hasMoreTokens()) { String elem = st2.nextToken(); if (StringUtils.isNotEmpty(elem)) { actorIds.add(elem); } } } } /** * ???? */ if (StringUtils.isNotEmpty(queryId)) { if (LogUtils.isDebug()) { logger.debug("queryId:" + queryId); } params.put("roleId", roleId); params.put("objectId", objectId); params.put("objectValue", objectValue); 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 (StringUtils.isNotEmpty(roleId)) { String tmp = roleId; Object value = roleId; 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("roleId", value); } if (StringUtils.isNotEmpty(objectId)) { String tmp = objectId; Object value = objectId; 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("objectId", value); } if (StringUtils.isNotEmpty(objectValue)) { String tmp = objectValue; Object value = objectValue; 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("objectValue", value); } if (deptIds != null && deptIds.size() > 0) { params.put("deptIds", deptIds); } if (roleIds != null && roleIds.size() > 0) { params.put("roleIds", roleIds); } if (LogUtils.isDebug()) { logger.debug("params:" + params); } 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); } } } } if (LogUtils.isDebug()) { logger.debug("actorIds:" + actorIds); } String startActorId = (String) contextInstance.getVariable(Constant.PROCESS_STARTERID); actorIds.remove(startActorId); if (actorIds.size() == 0) { if (leaveNodeIfActorNotAvailable) { contextInstance.setVariable(Constant.IS_AGREE, "true"); if (StringUtils.isNotEmpty(transitionName)) { ctx.leaveNode(transitionName); } else { ctx.leaveNode(); } return; } } if (actorIds.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(); 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); } } }
From source file:cz.incad.kramerius.processes.impl.DatabaseProcessManager.java
@Override public boolean isAuthTokenClosed(String authToken) { Connection connection = connectionProvider.get(); if (connection == null) throw new NotReadyException("connection not ready"); List<Boolean> flags = new JDBCQueryTemplate<Boolean>(connection) { @Override/* ww w. j av a2s.c o m*/ public boolean handleRow(ResultSet rs, List<Boolean> returnsList) throws SQLException { returnsList.add(rs.getBoolean("token_active")); return super.handleRow(rs, returnsList); } }.executeQuery("select token_active from processes where auth_token=?", authToken); // no flags if (flags.isEmpty()) return true; for (Boolean flag : flags) { if (!flag.booleanValue()) return true; } return false; }
From source file:com.alvexcore.repo.AlvexVersionableAspect.java
/** * On content update policy behaviour/*ww w . j ava 2 s . co m*/ * * If applicable and "cm:autoVersion" is TRUE then version the node on content update (even if no property updates) */ @SuppressWarnings({ "unchecked", "rawtypes" }) public void onContentUpdate(NodeRef nodeRef, boolean newContent) { if (this.nodeService.exists(nodeRef) == true && this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true && this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY) == false) { Map<NodeRef, NodeRef> versionedNodeRefs = (Map) AlfrescoTransactionSupport .getResource(KEY_VERSIONED_NODEREFS); if (versionedNodeRefs == null || versionedNodeRefs.containsKey(nodeRef) == false) { // Determine whether the node is auto versionable (for content updates) or not boolean autoVersion = false; Boolean value = (Boolean) this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION); if (value != null) { // If the value is not null then autoVersion = value.booleanValue(); } // else this means that the default value has not been set and the versionable aspect was applied pre-1.1 if (autoVersion == true) { // Create the auto-version Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(1); versionProperties.put(Version.PROP_DESCRIPTION, I18NUtil.getMessage(MSG_AUTO_VERSION)); createVersionImpl(nodeRef, versionProperties); } } } }
From source file:com.redhat.rhn.manager.errata.ErrataManager.java
/** * update the errata search index./* w ww . j a v a 2 s. co m*/ * @return true if index was updated, false otherwise. */ private static boolean updateSearchIndex() { boolean flag = false; try { XmlRpcClient client = new XmlRpcClient(ConfigDefaults.get().getSearchServerUrl(), true); List args = new ArrayList(); args.add("errata"); Boolean rc = (Boolean) client.invoke("admin.updateIndex", args); flag = rc.booleanValue(); } catch (XmlRpcFault e) { // right now updateIndex doesn't throw any faults. log.error("Errata index not updated. Search server unavailable." + "ErrorCode = " + e.getErrorCode(), e); e.printStackTrace(); } catch (Exception e) { // if the search server is down, folks will know when they // attempt to search. If this call failed the errata in // question won't be searchable immediately, but will get picked // up the next time the search server runs the job (after being // restarted. log.error("Errata index not updated. Search server unavailable.", e); } return flag; }
From source file:com.ge.predix.acs.service.policy.matcher.PolicyMatcherImplTest.java
private void doTestForURITemplateMatch(final String uriTemplate, final String uri, final Boolean uriTemplateExpectedMatch, final String[] varNames, final String[] varValues) { UriTemplate template = new UriTemplate(uriTemplate); Assert.assertEquals(template.matches(uri), uriTemplateExpectedMatch.booleanValue()); Map<String, String> matchedVariables = template.match(uri); for (int i = 0; i < varNames.length; i++) { // skip variable match if name is "n/a" if (varNames[i].equals("n/a")) { continue; }/*from ww w . j a va 2 s . c o m*/ Assert.assertEquals(matchedVariables.get(varNames[i]), varValues[i]); Assert.assertEquals(matchedVariables.get(varNames[i]), varValues[i]); } }
From source file:com.symbian.utils.config.ConfigUtils.java
/** * @param aKey//from ww w .ja v a 2 s . c om * @param aValue * @throws ParseException */ public boolean setPreferenceBoolean(final int aKey, final boolean aValue) throws ParseException { String aKeyLiteal = iPreferenceLiterals[aKey]; Object[] lConfigMap = (Object[]) iConfigMap.get(aKeyLiteal); if (lConfigMap == null) { throw new NullPointerException("Incorrect key: " + aKeyLiteal); } if (!Boolean.class.equals(lConfigMap[2])) { throw new ParseException("This preference " + aKeyLiteal + " cannot use the setPreference() method. It must be of type " + lConfigMap[2].toString()); } LOGGER.finest("Setting Preference " + aKeyLiteal + ": " + aValue); Boolean lCheckedValue = (Boolean) ((CheckSetConfig) lConfigMap[1]).set(aKeyLiteal, new Boolean(aValue)); iSavedConfig.put(aKeyLiteal, lCheckedValue); iPrefrences.putBoolean(aKeyLiteal, lCheckedValue.booleanValue()); return lCheckedValue.booleanValue(); }
From source file:org.kaaproject.kaa.sandbox.web.services.SandboxServiceImpl.java
@Override public boolean showChangeKaaHostDialog() throws SandboxServiceException { if (guiChangeHostEnabled && guiShowChangeHostDialog) { Boolean result = (Boolean) cacheService.getProperty(CHANGE_KAA_HOST_DIALOG_SHOWN_PROPERTY); return result == null || !result.booleanValue(); } else {/* w w w. ja v a2 s . c o m*/ return false; } }