org.apache.commons.lang3.BooleanUtils Java Examples
The following examples show how to use
org.apache.commons.lang3.BooleanUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebGroupBox.java From cuba with Apache License 2.0 | 6 votes |
@Override public boolean saveSettings(Element element) { if (!isSettingsEnabled()) { return false; } if (!settingsChanged) { return false; } Element groupBoxElement = element.element("groupBox"); if (groupBoxElement != null) { element.remove(groupBoxElement); } groupBoxElement = element.addElement("groupBox"); groupBoxElement.addAttribute("expanded", BooleanUtils.toStringTrueFalse(isExpanded())); return true; }
Example #2
Source File: SystemResourceImpl.java From apiman with Apache License 2.0 | 6 votes |
/** * @see ISystemResource#exportData(java.lang.String) */ @Override public Response exportData(String download) throws NotAuthorizedException { securityContext.checkAdminPermissions(); if (BooleanUtils.toBoolean(download)) { try { DownloadBean dbean = downloadManager.createDownload(DownloadType.exportJson, "/system/export"); //$NON-NLS-1$ return Response.ok(dbean, MediaType.APPLICATION_JSON).build(); } catch (StorageException e) { throw new SystemErrorException(e); } } else { return exportData(); } }
Example #3
Source File: ActionClean.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
private List<String> list(Business business, Boolean cleanWork, Boolean cleanWorkCompleted, Boolean cleanCms) throws Exception { EntityManager em = business.entityManagerContainer().get(Entry.class); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<String> cq = cb.createQuery(String.class); Root<Entry> root = cq.from(Entry.class); Predicate p = cb.disjunction(); if (BooleanUtils.isTrue(cleanWork)) { p = cb.or(p, cb.equal(root.get(Entry_.type), Entry.TYPE_WORK)); } if (BooleanUtils.isTrue(cleanWorkCompleted)) { p = cb.or(p, cb.equal(root.get(Entry_.type), Entry.TYPE_WORKCOMPLETED)); } if (BooleanUtils.isTrue(cleanCms)) { p = cb.or(p, cb.equal(root.get(Entry_.type), Entry.TYPE_CMS)); } cq.select(root.get(Entry_.id)).where(p); List<String> os = em.createQuery(cq).setMaxResults(BATCHSIZE).getResultList(); return os; }
Example #4
Source File: JavaJerseyServerCodegen.java From TypeScript-Microservices with MIT License | 6 votes |
@Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { super.postProcessModelProperty(model, property); if("null".equals(property.example)) { property.example = null; } //Add imports for Jackson if(!BooleanUtils.toBoolean(model.isEnum)) { model.imports.add("JsonProperty"); if(BooleanUtils.toBoolean(model.hasEnums)) { model.imports.add("JsonValue"); } } }
Example #5
Source File: V2Base.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
protected <O extends AbstractWo, W extends RelateFilterWi> void relate(Business business, List<O> wos, W wi) throws Exception { if (!wi.isEmptyRelate()) { List<String> jobs = ListTools.extractProperty(wos, TaskCompleted.job_FIELDNAME, String.class, true, true); if (BooleanUtils.isTrue(wi.getRelateWork())) { this.relateWork(business, wos, jobs); } if (BooleanUtils.isTrue(wi.getRelateWorkCompleted())) { this.relateWorkCompleted(business, wos, jobs); } if (BooleanUtils.isTrue(wi.getRelateTask())) { this.relateTask(business, wos, jobs); } if (BooleanUtils.isTrue(wi.getRelateRead())) { this.relateRead(business, wos, jobs); } if (BooleanUtils.isTrue(wi.getRelateReadCompleted())) { this.relateReadCompleted(business, wos, jobs); } if (BooleanUtils.isTrue(wi.getRelateReview())) { this.relateReview(business, wos, jobs); } } }
Example #6
Source File: QuerydslUtilsBeanImpl.java From gvnix with GNU General Public License v3.0 | 6 votes |
/** * {@inheritDoc} */ @Override public <T> BooleanExpression createBooleanExpression( PathBuilder<T> entityPath, String fieldName, Object searchObj, String operator) { Boolean value = BooleanUtils.toBooleanObject((String) searchObj); if (value != null) { if (StringUtils.equalsIgnoreCase(operator, OPERATOR_GOE)) { return entityPath.getBoolean(fieldName).goe(value); } else if (StringUtils.equalsIgnoreCase(operator, "gt")) { return entityPath.getBoolean(fieldName).gt(value); } else if (StringUtils.equalsIgnoreCase(operator, OPERATOR_LOE)) { return entityPath.getBoolean(fieldName).loe(value); } else if (StringUtils.equalsIgnoreCase(operator, "lt")) { return entityPath.getBoolean(fieldName).lt(value); } } return entityPath.get(fieldName).eq(searchObj); }
Example #7
Source File: SettingsDAOImpl.java From examples-javafx-repos1 with Apache License 2.0 | 6 votes |
@Override public void load() throws IOException { File f = new File(getAbsolutePath()); if( f.exists() ) { if( logger.isDebugEnabled() ) { logger.debug("[LOAD] " + f.getName() + " exists; loading"); } FileReader fr = new FileReader(f); Properties props = new Properties(); props.load(fr); settings.setRoundUp(BooleanUtils.toBoolean(props.getProperty("oldscores.roundUp"))); fr.close(); } else { if( logger.isDebugEnabled() ) { logger.debug("[LOAD " + f.getName() + " does not exist"); } } }
Example #8
Source File: ActionComplexAppointFormMobile.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, String formFlag) throws Exception { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { ActionResult<Wo> result = new ActionResult<>(); Business business = new Business(emc); WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); if (null == workCompleted) { throw new ExceptionEntityNotExist(id, WorkCompleted.class); } Wo wo = this.get(business, effectivePerson, workCompleted, Wo.class); wo.setForm(this.getForm(business, formFlag)); WorkCompletedControl control = wo.getControl(); if (BooleanUtils.isNotTrue(control.getAllowVisit())) { throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), id); } result.setData(wo); return result; } }
Example #9
Source File: ActionMode.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception { ActionResult<Wo> result = new ActionResult<>(); Wo wo = new Wo(); if (BooleanUtils.isTrue(Config.person().getCodeLogin())) { wo.setCodeLogin(true); } else { wo.setCodeLogin(false); } if (BooleanUtils.isTrue(Config.person().getBindLogin())) { wo.setBindLogin(true); } else { wo.setBindLogin(false); } if (BooleanUtils.isTrue(Config.person().getFaceLogin())) { wo.setFaceLogin(true); } else { wo.setFaceLogin(false); } if (BooleanUtils.isTrue(Config.person().getCaptchaLogin())) { wo.setCaptchaLogin(true); } else { wo.setCaptchaLogin(false); } result.setData(wo); return result; }
Example #10
Source File: MonetaConfiguration.java From moneta with Apache License 2.0 | 6 votes |
protected void gatherTopicAttributes(XMLConfiguration config, Topic topic, int i) { String readOnlyStr; topic.setTopicName(config.getString("Topics.Topic(" + i + ")[@name]")); topic.setPluralName(config.getString("Topics.Topic(" + i + ")[@pluralName]")); topic.setDataSourceName(config.getString("Topics.Topic(" + i + ")[@dataSource]")); topic.setSchemaName(config.getString("Topics.Topic(" + i + ")[@schema]")); topic.setCatalogName(config.getString("Topics.Topic(" + i + ")[@catalog]")); topic.setTableName(config.getString("Topics.Topic(" + i + ")[@table]")); readOnlyStr = config.getString("Topics.Topic(" + i + ")[@readOnly]"); Boolean bValue = BooleanUtils.toBooleanObject(readOnlyStr); if (bValue != null) { topic.setReadOnly(bValue); } }
Example #11
Source File: CategoryAttrsFrame.java From cuba with Apache License 2.0 | 6 votes |
protected void initDataTypeColumn() { categoryAttrsTable.removeGeneratedColumn("dataType"); categoryAttrsTable.addGeneratedColumn("dataType", new Table.ColumnGenerator<CategoryAttribute>() { @Override public Component generateCell(CategoryAttribute attribute) { Label dataTypeLabel = factory.createComponent(Label.class); String labelContent; if (BooleanUtils.isTrue(attribute.getIsEntity())) { Class clazz = attribute.getJavaClassForEntity(); if (clazz != null) { MetaClass metaClass = metadata.getSession().getClass(clazz); labelContent = messageTools.getEntityCaption(metaClass); } else { labelContent = "classNotFound"; } } else { labelContent = getMessage(attribute.getDataType().name()); } dataTypeLabel.setValue(labelContent); return dataTypeLabel; } }); }
Example #12
Source File: Scheduling.java From cuba with Apache License 2.0 | 6 votes |
@Override public String printActiveScheduledTasks() { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); StringBuilder sb = new StringBuilder(); List<ScheduledTask> tasks = scheduling.getActiveTasks(); for (ScheduledTask task : tasks) { sb.append(task).append(", lastStart="); if (task.getLastStartTime() != null) { sb.append(dateFormat.format(task.getLastStartTime())); if (BooleanUtils.isTrue(task.getSingleton())) sb.append(" on ").append(task.getLastStartServer()); } else { sb.append("<never>"); } sb.append("\n"); } return sb.toString(); }
Example #13
Source File: AuthorizePipe.java From bird-java with MIT License | 6 votes |
@Override protected Mono<Void> doExecute(ServerWebExchange exchange, PipeChain chain, RouteDefinition routeDefinition) { BirdSession session = authorizeManager.parseSession(exchange); if(StringUtils.equalsIgnoreCase(routeDefinition.getRpcType(), RpcTypeEnum.DUBBO.getName())){ if(BooleanUtils.isNotTrue(routeDefinition.getAnonymous())){ if(session == null){ return jsonResult(exchange,JsonResult.error(CommonErrorCode.UNAUTHORIZED,"需登录后才能访问")); }else { String[] permissions = StringUtils.split(routeDefinition.getPermissions(),","); if(!authorizeManager.checkPermissions(session,permissions,BooleanUtils.isTrue(routeDefinition.getCheckAll()))){ return jsonResult(exchange,JsonResult.error(CommonErrorCode.UNAUTHORIZED,"当前用户权限不足")); } } } } SessionContext.setSession(session); return chain.execute(exchange); }
Example #14
Source File: WorkLogTree.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
public WorkLogTree(List<WorkLog> list) throws Exception { for (WorkLog o : list) { this.nodes().add(new Node(o)); } List<String> froms = ListTools.extractProperty(list, WorkLog.fromActivityToken_FIELDNAME, String.class, true, true); List<String> arriveds = ListTools.extractProperty(list, WorkLog.arrivedActivityToken_FIELDNAME, String.class, true, true); List<String> values = ListUtils.subtract(froms, arriveds); WorkLog begin = list.stream() .filter(o -> BooleanUtils.isTrue(o.getConnected()) && values.contains(o.getFromActivityToken())) .findFirst().orElse(null); if (null == begin) { throw new ExceptionBeginNotFound(); } root = this.find(begin); // for (Node o : nodes) { // this.associate(); // } this.associate(); }
Example #15
Source File: JavaMSF4JServerCodegen.java From TypeScript-Microservices with MIT License | 6 votes |
@Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { super.postProcessModelProperty(model, property); if("null".equals(property.example)) { property.example = null; } //Add imports for Jackson if(!BooleanUtils.toBoolean(model.isEnum)) { model.imports.add("JsonProperty"); if(BooleanUtils.toBoolean(model.hasEnums)) { model.imports.add("JsonValue"); } } }
Example #16
Source File: ListEditorPopupWindow.java From cuba with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") protected TextField createTextField(Datatype datatype) { TextField textField = uiComponents.create(TextField.class); textField.setDatatype(datatype); if (!BooleanUtils.isFalse(editable)) { FilterHelper.ShortcutListener shortcutListener = new FilterHelper.ShortcutListener("add", new KeyCombination(KeyCombination.Key.ENTER)) { @Override public void handleShortcutPressed() { _addValue(textField); } }; filterHelper.addShortcutListener(textField, shortcutListener); } return textField; }
Example #17
Source File: ChannelSoftwareHandler.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * Returns whether the channel may be managed by the given user. * @param loggedInUser The current user * @param channelLabel The label for the channel in question * @param login The login for the user in question * @return whether the channel may be managed by the given user. * @throws FaultException thrown if * - The loggedInUser doesn't have permission to perform this action * - The login, sessionKey, or channelLabel is invalid * * @xmlrpc.doc Returns whether the channel may be managed by the given user. * @xmlrpc.param #session_key() * @xmlrpc.param #param_desc("string", "channelLabel", "label of the channel") * @xmlrpc.param #param_desc("string", "login", "login of the target user") * @xmlrpc.returntype #param_desc("int", "status", "1 if manageable, 0 if not") */ public int isUserManageable(User loggedInUser, String channelLabel, String login) throws FaultException { User target = XmlRpcUserHelper.getInstance().lookupTargetUser( loggedInUser, login); Channel channel = lookupChannelByLabel(loggedInUser.getOrg(), channelLabel); if (!channel.isCustom()) { throw new InvalidChannelException( "Manageable flag is relevant for custom channels only."); } //Verify permissions if (!(UserManager.verifyChannelAdmin(loggedInUser, channel) || loggedInUser.hasRole(RoleFactory.CHANNEL_ADMIN))) { throw new PermissionCheckFailureException(); } boolean flag = ChannelManager.verifyChannelManage(target, channel.getId()); return BooleanUtils.toInteger(flag); }
Example #18
Source File: AgsBrokerDefinitionAdaptor.java From geoportal-server-harvester with Apache License 2.0 | 6 votes |
/** * Creates instance of the adaptor. * @param def broker definition * @throws InvalidDefinitionException if invalid broker definition */ public AgsBrokerDefinitionAdaptor(EntityDefinition def) throws InvalidDefinitionException { super(def); this.credAdaptor =new CredentialsDefinitionAdaptor(def); this.botsAdaptor = new BotsBrokerDefinitionAdaptor(def); if (StringUtils.trimToEmpty(def.getType()).isEmpty()) { def.setType(AgsConnector.TYPE); } else if (!AgsConnector.TYPE.equals(def.getType())) { throw new InvalidDefinitionException("Broker definition doesn't match"); } else { try { hostUrl = new URL(get(P_HOST_URL)); } catch (MalformedURLException ex) { throw new InvalidDefinitionException(String.format("Invalid %s: %s", P_HOST_URL,get(P_HOST_URL)), ex); } enableLayers = BooleanUtils.toBoolean(get(P_ENABLE_LAYERS)); emitXml = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_EMIT_XML)), true); emitJson = BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(get(P_EMIT_JSON)), false); } }
Example #19
Source File: HttpToken.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
public EffectivePerson who(HttpServletRequest request, HttpServletResponse response, String key) throws Exception { EffectivePerson effectivePerson = this.who(this.getToken(request), key); effectivePerson.setRemoteAddress(this.remoteAddress(request)); effectivePerson.setUserAgent(this.userAgent(request)); effectivePerson.setUri(request.getRequestURI()); /* 加入调试标记 */ Object debugger = request.getHeader(HttpToken.X_Debugger); if (null != debugger && BooleanUtils.toBoolean(Objects.toString(debugger))) { effectivePerson.setDebugger(true); } else { effectivePerson.setDebugger(false); } setAttribute(request, effectivePerson); setToken(request, response, effectivePerson); return effectivePerson; }
Example #20
Source File: ActionGetWithWorkCompletedFromData.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
ActionResult<JsonElement> execute(EffectivePerson effectivePerson, String id) throws Exception { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { ActionResult<JsonElement> result = new ActionResult<>(); Business business = new Business(emc); WorkCompleted workCompleted = emc.find(id, WorkCompleted.class); if (null == workCompleted) { throw new ExceptionEntityNotExist(id, WorkCompleted.class); } WoControl control = business.getControl(effectivePerson, workCompleted, WoControl.class); if (BooleanUtils.isNotTrue(control.getAllowVisit())) { throw new ExceptionWorkCompletedAccessDenied(effectivePerson.getDistinguishedName(), workCompleted.getTitle(), workCompleted.getId()); } result.setData(XGsonBuilder.convert(workCompleted.getProperties().getData(), JsonElement.class)); return result; } }
Example #21
Source File: AbstractMessageFactory.java From sailfish-core with Apache License 2.0 | 6 votes |
@Override public IMessage createMessage(MsgMetaData metaData) { if (metaData.getMsgNamespace().equals(namespace)) { metaData.setDictionaryURI(dictionaryURI); metaData.setProtocol(getProtocol()); if (dictionary != null) { //FIXME: Remove this check after removing init(String namespace, SailfishURI dictionaryURI) method IMessageStructure messageStructure = dictionary.getMessages().get(metaData.getMsgName()); if (messageStructure != null) { Boolean isAdmin = getAttributeValue(messageStructure, ATTRIBUTE_IS_ADMIN); metaData.setAdmin(BooleanUtils.toBoolean(isAdmin)); } } } IMessage message = new MapMessage(metaData); createComplexFields(message); return message; }
Example #22
Source File: ExternalDataSources.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
public String log(String name) { int idx = 0; for (ExternalDataSource o : this) { idx++; if (BooleanUtils.isTrue(o.getEnable())) { String n = "s" + ("" + (1000 + idx)).substring(1); if (StringUtils.equals(n, name)) { String value = o.getLogLevel().toString(); return "DefaultLevel=WARN, Tool=" + value + ", Enhance=" + value + ", METADATA=" + value + ", Runtime=" + value + ", Query=" + value + ", DataCache=" + value + ", JDBC=" + value + ", SQL=" + value; } } } return "DefaultLevel=WARN, Tool=WARN, Enhance=WARN, METADATA=WARN, Runtime=WARN, Query=WARN, DataCache=WARN, JDBC=ERROR, SQL=WARN"; }
Example #23
Source File: ActionOauthGet.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
ActionResult<Wo> execute(EffectivePerson effectivePerson, String name) throws Exception { ActionResult<Wo> result = new ActionResult<>(); OauthClient oauthClient = null; if (ListTools.isNotEmpty(Config.token().getOauthClients())) { for (OauthClient o : Config.token().getOauthClients()) { if (BooleanUtils.isTrue(o.getEnable()) && StringUtils.equals(o.getName(), name)) { oauthClient = o; } } } if (null == oauthClient) { throw new ExceptionOauthNotExist(name); } Wo wo = new Wo(); wo.setName(oauthClient.getName()); wo.setRedirectUri(oauthClient.getAuthAddress()); wo.setAuthAddress(oauthClient.getAuthAddress()); wo.setAuthMethod(oauthClient.getAuthMethod()); wo.setIcon(oauthClient.getIcon()); String authParameter = this.fillAuthParameter(oauthClient.getAuthParameter(), oauthClient); logger.debug("auth parameter:{}.", authParameter); wo.setAuthParameter(authParameter); result.setData(wo); return result; }
Example #24
Source File: HttpMockServiceImpl.java From AnyMock with Apache License 2.0 | 6 votes |
private HttpInterfaceBO loadHttpInterfaceBO(HttpInterfaceKeyBO httpInterfaceKeyBO) { logger.info("Loading HTTP interface from redis..."); HttpInterfaceBO httpInterfaceBO = httpInterfaceCacheManager.get(httpInterfaceKeyBO); if (httpInterfaceBO == null) { logger.info("Loading HTTP interface from DB..."); httpInterfaceBO = httpInterfaceDao.queryByKey(httpInterfaceKeyBO); if (httpInterfaceBO == null) { throw new BizException(ResultCode.NOT_FOUND_HTTP_INTERFACE); } httpInterfaceCacheManager.set(httpInterfaceBO); } if (BooleanUtils.isNotTrue(httpInterfaceBO.getStart())) { throw new BizException(ResultCode.HTTP_INTERFACE_NOT_OPEN); } return httpInterfaceBO; }
Example #25
Source File: PropertyConverter.java From commons-configuration with Apache License 2.0 | 6 votes |
/** * Convert the specified object into a Boolean. Internally the * {@code org.apache.commons.lang.BooleanUtils} class from the * <a href="https://commons.apache.org/lang/">Commons Lang</a> * project is used to perform this conversion. This class accepts some more * tokens for the boolean value of <b>true</b>, e.g. {@code yes} and * {@code on}. Please refer to the documentation of this class for more * details. * * @param value the value to convert * @return the converted value * @throws ConversionException thrown if the value cannot be converted to a boolean */ public static Boolean toBoolean(final Object value) throws ConversionException { if (value instanceof Boolean) { return (Boolean) value; } else if (value instanceof String) { final Boolean b = BooleanUtils.toBooleanObject((String) value); if (b == null) { throw new ConversionException("The value " + value + " can't be converted to a Boolean object"); } return b; } else { throw new ConversionException("The value " + value + " can't be converted to a Boolean object"); } }
Example #26
Source File: ComCompanyServiceImpl.java From openemm with GNU Affero General Public License v3.0 | 6 votes |
private void setupSettings(ComCompany company, CompanySettingsDto settingsDto) { company.setSalutationExtended(BooleanUtils.toInteger(settingsDto.isHasExtendedSalutation())); company.setStatAdmin(settingsDto.getExecutiveAdministrator()); company.setContactTech(settingsDto.getTechnicalContacts()); /* update export notify admin field if HasDataExportNotify checkbox true, otherwise set export notify admin value 0 */ if (settingsDto.isHasDataExportNotify()) { company.setExportNotifyAdmin(settingsDto.getExecutiveAdministrator()); } else { company.setExportNotifyAdmin(0); } company.setSecretKey(RandomStringUtils.randomAscii(32)); company.setSector(settingsDto.getSector()); company.setBusiness(settingsDto.getBusiness()); }
Example #27
Source File: ActionCreateWithWorkPath4.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, String path0, String path1, String path2, String path3, String path4, JsonElement jsonElement) throws Exception { ActionResult<Wo> result = new ActionResult<>(); Work work = null; try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { Business business = new Business(emc); work = emc.find(id, Work.class); if (null == work) { throw new ExceptionEntityNotExist(id, Work.class); } WoControl control = business.getControl(effectivePerson, work, WoControl.class); if (BooleanUtils.isNotTrue(control.getAllowSave())) { throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), work.getId()); } } Wo wo = ThisApplication.context().applications() .postQuery(x_processplatform_service_processing.class, Applications.joinQueryUri("data", "work", work.getId(), path0, path1, path2, path3, path4), jsonElement, work.getJob()) .getData(Wo.class); result.setData(wo); return result; }
Example #28
Source File: DefaultAuthorizationUtility.java From blackduck-alert with Apache License 2.0 | 5 votes |
@Override public void updateRoleName(Long roleId, String roleName) throws AlertDatabaseConstraintException { Optional<RoleEntity> foundRole = roleRepository.findById(roleId); if (foundRole.isPresent()) { RoleEntity roleEntity = foundRole.get(); if (BooleanUtils.isFalse(roleEntity.getCustom())) { throw new AlertDatabaseConstraintException("Cannot update the existing role '" + foundRole.get().getRoleName() + "' to '" + roleName + "' because it is not a custom role"); } RoleEntity updatedEntity = new RoleEntity(roleName, true); updatedEntity.setId(roleEntity.getId()); roleRepository.save(updatedEntity); } }
Example #29
Source File: BoolFilter.java From jinjava with Apache License 2.0 | 5 votes |
@Override public Object filter(Object var, JinjavaInterpreter interpreter, String... args) { if (var == null) { return false; } final String str = var.toString(); return str.equals("1") ? Boolean.TRUE : BooleanUtils.toBoolean(str); }
Example #30
Source File: DynamicAttributesCondition.java From cuba with Apache License 2.0 | 5 votes |
public DynamicAttributesCondition(Element element, String messagesPack, String filterComponentName, com.haulmont.chile.core.model.MetaClass metaClass) { super(element, messagesPack, filterComponentName, metaClass); propertyPath = element.attributeValue("propertyPath"); MessageTools messageTools = AppBeans.get(MessageTools.NAME); locCaption = isBlank(caption) ? element.attributeValue("locCaption") : messageTools.loadString(messagesPack, caption); entityAlias = element.attributeValue("entityAlias"); text = element.getText(); join = element.attributeValue("join"); categoryId = UUID.fromString(element.attributeValue("category")); String categoryAttributeValue = element.attributeValue("categoryAttribute"); if (!Strings.isNullOrEmpty(categoryAttributeValue)) { categoryAttributeId = UUID.fromString(categoryAttributeValue); } else { //for backward compatibility List<Element> paramElements = element.elements("param"); for (Element paramElement : paramElements) { if (BooleanUtils.toBoolean(paramElement.attributeValue("hidden", "false"), "true", "false")) { categoryAttributeId = UUID.fromString(paramElement.getText()); String paramName = paramElement.attributeValue("name"); text = text.replace(":" + paramName, "'" + categoryAttributeId + "'"); } } } isCollection = Boolean.parseBoolean(element.attributeValue("isCollection")); resolveParam(element); }