Java 类org.apache.commons.lang.BooleanUtils 实例源码

项目:lodsve-framework    文件:PropertyConverter.java   
/**
 * Convert the specified object into a Boolean. Internally the
 * {@code org.apache.commons.lang.BooleanUtils} class from the <a
 * href="http://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(Object value) throws ConversionException {
    if (value instanceof Boolean) {
        return (Boolean) value;
    } else if (value instanceof String) {
        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");
    }
}
项目:cuba    文件:ExcelExporter.java   
protected int createHierarhicalRow(TreeTable table, List<Table.Column> columns,
                                   Boolean exportExpanded, int rowNumber, Object itemId) {
    HierarchicalDatasource hd = table.getDatasource();
    createRow(table, columns, 0, ++rowNumber, itemId);
    if (BooleanUtils.isTrue(exportExpanded) && !table.isExpanded(itemId) && !hd.getChildren(itemId).isEmpty()) {
        return rowNumber;
    } else {
        final Collection children = hd.getChildren(itemId);
        if (children != null && !children.isEmpty()) {
            for (Object id : children) {
                if (BooleanUtils.isTrue(exportExpanded) && !table.isExpanded(id) && !hd.getChildren(id).isEmpty()) {
                    createRow(table, columns, 0, ++rowNumber, id);
                    continue;
                }
                rowNumber = createHierarhicalRow(table, columns, exportExpanded, rowNumber, id);
            }
        }
    }
    return rowNumber;
}
项目:cuba    文件:Scheduling.java   
@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();
}
项目:engerek    文件:ShadowManager.java   
public String addNewProposedShadow(ProvisioningContext ctx, PrismObject<ShadowType> shadow, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException, ObjectAlreadyExistsException, SecurityViolationException {
    ResourceConsistencyType consistency = ctx.getResource().getConsistency();
    if (consistency == null) {
        return null;
    }
    if (!BooleanUtils.isTrue(consistency.isUseProposedShadows())) {
        return null;
    }

    PrismObject<ShadowType> repoShadow = createRepositoryShadow(ctx, shadow);
    repoShadow.asObjectable().setLifecycleState(SchemaConstants.LIFECYCLE_PROPOSED);
    addPendingOperationAdd(repoShadow, shadow, task.getTaskIdentifier());

    ConstraintsChecker.onShadowAddOperation(repoShadow.asObjectable());
    String oid = repositoryService.addObject(repoShadow, null, result);
    LOGGER.trace("Draft shadow added to the repository: {}", repoShadow);
    return oid;
}
项目:engerek    文件:SecurityEnforcerImpl.java   
private <O extends ObjectType> boolean matchesOrgRelation(PrismObject<O> object, ObjectReferenceType subjectParentOrgRef,
        OrgRelationObjectSpecificationType specOrgRelation, String autzHumanReadableDesc, String desc) throws SchemaException {
    if (!MiscSchemaUtil.compareRelation(specOrgRelation.getSubjectRelation(), subjectParentOrgRef.getRelation())) {
        return false;
    }
    if (BooleanUtils.isTrue(specOrgRelation.isIncludeReferenceOrg()) && subjectParentOrgRef.getOid().equals(object.getOid())) {
        return true;
    }
    if (specOrgRelation.getScope() == null) {
        return repositoryService.isDescendant(object, subjectParentOrgRef.getOid());
    }
    switch (specOrgRelation.getScope()) {
        case ALL_DESCENDANTS:
            return repositoryService.isDescendant(object, subjectParentOrgRef.getOid());
        case DIRECT_DESCENDANTS:
            return hasParentOrgRef(object, subjectParentOrgRef.getOid());
        case ALL_ANCESTORS:
            return repositoryService.isAncestor(object, subjectParentOrgRef.getOid());
        default:
            throw new UnsupportedOperationException("Unknown orgRelation scope "+specOrgRelation.getScope());
    }
}
项目:cuba    文件:EntityDiffManager.java   
protected EntityPropertyDiff getDynamicAttributeDifference(Object firstValue,
                                                           Object secondValue,
                                                           MetaProperty metaProperty,
                                                           CategoryAttribute categoryAttribute) {
    Range range = metaProperty.getRange();
    if (range.isDatatype() || range.isEnum()) {
        if (!Objects.equals(firstValue, secondValue)) {
            return new EntityBasicPropertyDiff(firstValue, secondValue, metaProperty);
        }
    } else if (range.isClass()) {
        if (BooleanUtils.isTrue(categoryAttribute.getIsCollection())) {
            return getDynamicAttributeCollectionDiff(firstValue, secondValue, metaProperty);
        } else {
            if (!Objects.equals(firstValue, secondValue)) {
                return new EntityClassPropertyDiff(firstValue, secondValue, metaProperty);
            }
        }
    }
    return null;
}
项目:mesh    文件:ParameterProvider.java   
/**
 * Convert the provides object to a string representation.
 * 
 * @param value
 * @return String representation of value
 */
default String convertToStr(Object value) {
    if (value instanceof String[]) {
        String stringVal = "";
        String[] values = (String[]) value;
        for (int i = 0; i < values.length; i++) {
            stringVal += values[i];
            if (i != values.length - 1) {
                stringVal += ',';
            }
        }
        return stringVal;
    } else if (value instanceof Integer) {
        return Integer.toString((int) value);
    } else if (value instanceof Boolean) {
        return BooleanUtils.toStringTrueFalse((Boolean) value);
    } else {
        return value.toString();
    }
}
项目:communote-server    文件:CommunoteIntegrationTest.java   
/**
 * Drop and recreates the databaseName from the template files.
 *
 * @param skipDatabaseCreation
 *            If set to true, the databaseName creation will be skipped (Default: false).
 *
 * @throws Exception
 *             Exception.
 */
@Parameters({ "skipDatabaseCreation" })
@BeforeClass(dependsOnMethods = { "setupIntegrationTest" }, groups = GROUP_INTEGRATION_TEST_SETUP)
public void setupDatabase(@Optional("false") String skipDatabaseCreation) throws Exception {
    if (BooleanUtils.toBoolean(skipDatabaseCreation)) {
        return;
    }
    LOGGER.info("Using the following JDBC URL for the test database: " + jdbcURL);
    try {
        DatabaseUtils.recreateDatabase(jdbcTempURL, suUsername, suPassword, databaseName,
                databaseType, username);
        initializeDatabaseSchemaAndContent();
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
        throw e;
    }
}
项目:engerek    文件:ChangeExecutor.java   
private boolean evaluateScriptCondition(OperationProvisioningScriptType script,
        ExpressionVariables variables, Task task, OperationResult result) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException {
    ExpressionType condition = script.getCondition();
    if (condition == null) {
        return true;
    }

    PrismPropertyValue<Boolean> conditionOutput = ExpressionUtil.evaluateCondition(variables, condition, expressionFactory, " condition for provisioning script ", task, result);
    if (conditionOutput == null) {
        return true;
    }

    Boolean conditionOutputValue = conditionOutput.getValue();

    return BooleanUtils.isNotFalse(conditionOutputValue);

}
项目:cuba    文件:FilterDelegateImpl.java   
protected String getFilterCaption(FilterEntity filterEntity) {
    String name;
    if (filterEntity != null) {
        if (filterEntity.getCode() == null)
            name = InstanceUtils.getInstanceName(filterEntity);
        else {
            name = messages.getMainMessage(filterEntity.getCode());
        }
        AbstractSearchFolder folder = filterEntity.getFolder();
        if (folder != null) {
            if (!StringUtils.isBlank(folder.getTabName()))
                name = messages.getMainMessage(folder.getTabName());
            else if (!StringUtils.isBlank(folder.getName())) {
                name = messages.getMainMessage(folder.getName());
            }
            if (BooleanUtils.isTrue(filterEntity.getIsSet()))
                name = getMainMessage("filter.setPrefix") + " " + name;
            else
                name = getMainMessage("filter.folderPrefix") + " " + name;
        }
    } else
        name = "";
    return name;
}
项目:engerek    文件:ItemApprovalProcessInterface.java   
@Override
public WorkItemResultType extractWorkItemResult(Map<String, Object> variables) {
    Boolean wasCompleted = ActivitiUtil.getVariable(variables, VARIABLE_WORK_ITEM_WAS_COMPLETED, Boolean.class, prismContext);
    if (BooleanUtils.isNotTrue(wasCompleted)) {
        return null;
    }
    WorkItemResultType result = new WorkItemResultType(prismContext);
    result.setOutcome(ActivitiUtil.getVariable(variables, FORM_FIELD_OUTCOME, String.class, prismContext));
    result.setComment(ActivitiUtil.getVariable(variables, FORM_FIELD_COMMENT, String.class, prismContext));
    String additionalDeltaString = ActivitiUtil.getVariable(variables, FORM_FIELD_ADDITIONAL_DELTA, String.class, prismContext);
    boolean isApproved = ApprovalUtils.isApproved(result);
    if (isApproved && StringUtils.isNotEmpty(additionalDeltaString)) {
        try {
            ObjectDeltaType additionalDelta = prismContext.parserFor(additionalDeltaString).parseRealValue(ObjectDeltaType.class);
            ObjectTreeDeltasType treeDeltas = new ObjectTreeDeltasType();
            treeDeltas.setFocusPrimaryDelta(additionalDelta);
            result.setAdditionalDeltas(treeDeltas);
        } catch (SchemaException e) {
            LoggingUtils.logUnexpectedException(LOGGER, "Couldn't parse delta received from the activiti form:\n{}", e, additionalDeltaString);
            throw new SystemException("Couldn't parse delta received from the activiti form: " + e.getMessage(), e);
        }
    }
    return result;
   }
项目:cuba    文件:BackgroundWorkWindow.java   
@Override
public void init(Map<String, Object> params) {
    @SuppressWarnings("unchecked")
    BackgroundTask<T, V> task = (BackgroundTask<T, V>) params.get("task");
    String title = (String) params.get("title");
    if (title != null) {
        setCaption(title);
    }

    String message = (String) params.get("message");
    if (message != null) {
        text.setValue(message);
    }

    Boolean cancelAllowedNullable = (Boolean) params.get("cancelAllowed");
    cancelAllowed = BooleanUtils.isTrue(cancelAllowedNullable);
    cancelButton.setVisible(cancelAllowed);

    getDialogOptions().setCloseable(cancelAllowed);

    BackgroundTask<T, V> wrapperTask = new LocalizedTaskWrapper<>(task, this);

    taskHandler = backgroundWorker.handle(wrapperTask);
    taskHandler.execute();
}
项目:cuba    文件:EntityLog.java   
protected Set<String> getAllAttributes(Entity entity) {
    if (entity == null) {
        return null;
    }
    Set<String> attributes = new HashSet<>();
    MetaClass metaClass = metadata.getClassNN(entity.getClass());
    for (MetaProperty metaProperty : metaClass.getProperties()) {
        Range range = metaProperty.getRange();
        if (range.isClass() && range.getCardinality().isMany()) {
            continue;
        }
        attributes.add(metaProperty.getName());
    }
    Collection<CategoryAttribute> categoryAttributes = dynamicAttributes.getAttributesForMetaClass(metaClass);
    if (categoryAttributes != null) {
        for (CategoryAttribute categoryAttribute : categoryAttributes) {
            if (BooleanUtils.isNotTrue(categoryAttribute.getIsCollection())) {
                attributes.add(
                        DynamicAttributesUtils.getMetaPropertyPath(metaClass, categoryAttribute).getMetaProperty().getName());
            }
        }
    }
    return attributes;
}
项目:engerek    文件:AbstractWebserviceTest.java   
private void checkAuditEnabled(SystemConfigurationType configurationType) throws FaultMessage {
    LoggingConfigurationType loggingConfig = configurationType.getLogging();
       AuditingConfigurationType auditConfig = loggingConfig.getAuditing();
       if (auditConfig == null) {
        auditConfig = new AuditingConfigurationType();
        auditConfig.setEnabled(true);
        loggingConfig.setAuditing(auditConfig);
       } else {
        if (BooleanUtils.isTrue(auditConfig.isEnabled())) {
            return;
        }
        auditConfig.setEnabled(true);
       }

       ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(SystemConfigurationType.class, 
            SystemObjectsType.SYSTEM_CONFIGURATION.value(), "logging", ModificationTypeType.REPLACE, loggingConfig);

    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, null);

    assertSuccess(deltaOpList);
}
项目:sampler    文件:StyleTableFrame.java   
@Override
public void init(Map<String, Object> params) {
    customerTable.setStyleProvider((entity, property) -> {
        if (property == null) {
            if (BooleanUtils.isTrue(entity.getActive())) {
                return "active-customer";
            }
        } else if (property.equals("grade")) {
            switch (entity.getGrade()) {
                case PREMIUM:
                    return "premium-grade";
                case HIGH:
                    return "high-grade";
                case STANDARD:
                    return "standard-grade";
                default:
                    return null;
            }
        }
        return null;
    });
}
项目:cuba    文件:Scheduling.java   
protected Integer getServerPriority(ScheduledTask task, String serverId) {
    String permittedServers = task.getPermittedServers();

    if (StringUtils.isBlank(permittedServers)) {
        if (BooleanUtils.isTrue(task.getSingleton()) && !clusterManager.isMaster())
            return null;
        else
            return 0;
    }

    String[] parts = permittedServers.trim().split("[,;]");
    for (int i = 0; i < parts.length; i++) {
        if (serverId.equals(parts[i].trim())) {
            return i + 1;
        }
    }

    return null;
}
项目:cuba    文件:QueriesController.java   
@GetMapping("/{entityName}/{queryName}")
public ResponseEntity<String> executeQueryGet(@PathVariable String entityName,
                           @PathVariable String queryName,
                           @RequestParam(required = false) Integer limit,
                           @RequestParam(required = false) Integer offset,
                           @RequestParam(required = false) String view,
                           @RequestParam(required = false) Boolean returnNulls,
                           @RequestParam(required = false) Boolean dynamicAttributes,
                           @RequestParam(required = false) Boolean returnCount,
                           @RequestParam(required = false) String modelVersion,
                           @RequestParam Map<String, String> params) {
    String resultJson = queriesControllerManager.executeQueryGet(entityName, queryName, limit, offset, view, returnNulls, dynamicAttributes, modelVersion, params);
    ResponseEntity.BodyBuilder responseBuilder = ResponseEntity.status(HttpStatus.OK);
    if (BooleanUtils.isTrue(returnCount)) {
        String count = queriesControllerManager.getCountGet(entityName, queryName, modelVersion, params);
        responseBuilder.header("X-Total-Count", count);
    }
    return responseBuilder.body(resultJson);
}
项目:cuba    文件:QueriesController.java   
@PostMapping("/{entityName}/{queryName}")
public ResponseEntity<String> executeQueryPost(@PathVariable String entityName,
                           @PathVariable String queryName,
                           @RequestParam(required = false) Integer limit,
                           @RequestParam(required = false) Integer offset,
                           @RequestParam(required = false) String view,
                           @RequestParam(required = false) Boolean returnNulls,
                           @RequestParam(required = false) Boolean dynamicAttributes,
                           @RequestParam(required = false) Boolean returnCount,
                           @RequestParam(required = false) String modelVersion,
                           @RequestBody String paramsJson) {

    String resultJson = queriesControllerManager.executeQueryPost(entityName, queryName, limit, offset, view, returnNulls, dynamicAttributes, modelVersion, paramsJson);
    ResponseEntity.BodyBuilder responseBuilder = ResponseEntity.status(HttpStatus.OK);
    if (BooleanUtils.isTrue(returnCount)) {
        String count = queriesControllerManager.getCountPost(entityName, queryName, modelVersion, paramsJson);
        responseBuilder.header("X-Total-Count", count);
    }
    return responseBuilder.body(resultJson);
}
项目:cuba    文件:EntityLogBrowser.java   
protected boolean allowLogProperty(MetaProperty metaProperty, CategoryAttribute categoryAttribute) {
    if (systemAttrsList.contains(metaProperty.getName())) {
        return false;
    }
    Range range = metaProperty.getRange();
    if (range.isClass() && metadata.getTools().hasCompositePrimaryKey(range.asClass()) &&
            !HasUuid.class.isAssignableFrom(range.asClass().getJavaClass())) {
        return false;
    }
    if (range.isClass() && range.getCardinality().isMany()) {
        return false;
    }
    if (categoryAttribute != null &&
            BooleanUtils.isTrue(categoryAttribute.getIsCollection())) {
        return false;
    }
    return true;
}
项目:cuba    文件:RunnerBean.java   
protected void registerExecutionFinish(ScheduledTask task, ScheduledExecution execution, Object result) {
    if ((!BooleanUtils.isTrue(task.getLogFinish()) && !BooleanUtils.isTrue(task.getSingleton()) && task.getSchedulingType() != SchedulingType.FIXED_DELAY)
            || execution == null)
        return;

    log.trace("{}: registering execution finish", task);
    Transaction tx = persistence.createTransaction();
    try {
        EntityManager em = persistence.getEntityManager();
        execution = em.merge(execution);
        execution.setFinishTime(timeSource.currentTimestamp());
        if (result != null)
            execution.setResult(result.toString());

        tx.commit();
    } finally {
        tx.end();
    }
}
项目:cuba    文件:CategoryEditor.java   
protected void initIsDefaultCheckbox() {
    isDefault.setValue(BooleanUtils.isTrue(category.getIsDefault()));
    isDefault.addValueChangeListener(e -> {
        if (Boolean.TRUE.equals(e.getValue())) {
            LoadContext<Category> lc = new LoadContext<>(Category.class)
                    .setView("category.defaultEdit");
            lc.setQueryString("select c from sys$Category c where c.entityType = :entityType and not c.id = :id")
                    .setParameter("entityType", category.getEntityType())
                    .setParameter("id", category.getId());
            List<Category> result = dataManager.loadList(lc);
            for (Category cat : result) {
                cat.setIsDefault(false);
            }
            CommitContext commitCtx = new CommitContext(result);
            dataManager.commit(commitCtx);
            category.setIsDefault(true);
        } else if (Boolean.FALSE.equals(e.getValue())) {
            category.setIsDefault(false);
        }
    });
}
项目:Uranium    文件:BoolSetting.java   
@Override
public void setValue(String value)
{
    this.value = BooleanUtils.toBooleanObject(value);
    this.value = this.value == null ? def : this.value;
    config.set(path, this.value);
}
项目:poppynotes    文件:NotesServiceImpl.java   
@Override
public void update(UpdateNote note) throws NoteNotFoundException, AccessingOtherUsersNotesException {
    assertNoteExisting(note.getId());
    assertCorrectNoteUser(findNoteById(note.getId()).getUserId(), note.getUserId());

    if(BooleanUtils.isTrue(note.getArchived())) {
        dao.delete(note.getId());
        archivedDao.save(mapArchived(note));
    } else {
        archivedDao.delete(note.getId());
        dao.save(map(note));
    }
}
项目:poppynotes    文件:NoteServiceTest.java   
@Test
public void testFindNote_withValidUserId_shouldReturnCorrect()
        throws NoteNotFoundException, AccessingOtherUsersNotesException {
    Note note = dao.findAll().stream().findFirst().get();

    CompleteNote readNote = service.findNote(note.getId(), 1l);

    assertFalse("read from normal notes, should not be set archived", BooleanUtils.isTrue(readNote.getArchived()));
    assertEquals("check content equals", note.getContent(), readNote.getContent());
    assertEquals("check last edit date equals", note.getLastEdit(), readNote.getLastEdit());
    assertEquals("check title equals", note.getTitle(), readNote.getTitle());
    assertEquals("check user ID equals", note.getUserId(), readNote.getUserId());
    assertEquals("check init vector equals", note.getInitVector(), readNote.getInitVector());
}
项目:otter-G    文件:NodeOp.java   
public void execute(@Param("nid") Long nid, @Param("command") String command, @Param("value") String value) {
    try {
        if (StringUtils.equalsIgnoreCase(command, OFFLINE)) {
            List<Channel> channels = channelService.listByNodeId(nid, ChannelStatus.START);
            for (Channel channel : channels) {// 重启一下对应的channel
                boolean result = arbitrateManageService.channelEvent().restart(channel.getId());
                if (result) {
                    channelService.notifyChannel(channel.getId());// 推送一下配置
                }
            }
        } else if (StringUtils.equalsIgnoreCase(command, ONLINE)) {
            // doNothing,自动会加入服务列表
        } else if (StringUtils.endsWithIgnoreCase(command, THREAD)) {
            nodeRemoteService.setThreadPoolSize(nid, Integer.valueOf(value));
        } else if (StringUtils.endsWithIgnoreCase(command, PROFILE)) {
            nodeRemoteService.setProfile(nid, BooleanUtils.toBoolean(value));
        } else {
            returnError("please add specfy the 'command' param.");
            return;
        }

        returnSuccess();
    } catch (Exception e) {
        String errorMsg = String.format("error happens while [%s] with node id [%d]", command, nid);
        log.error(errorMsg, e);
        returnError(errorMsg);
    }
}
项目:dubbo-mock    文件:TestBase.java   
public ReferenceConfig<TestAbcService> getRef(Class<TestAbcService> interfaceClass, RegistryConfig tempRegistry) {
    if (BooleanUtils.isTrue(reference.isInit())) {
        return reference;
    }
    reference.setInterface(interfaceClass); // 弱类型接口名 
    com.alibaba.dubbo.config.RegistryConfig rc = new com.alibaba.dubbo.config.RegistryConfig();
    rc.setProtocol(tempRegistry.getRegistryProtocol());
    rc.setAddress(tempRegistry.getRegistryAddress());
    rc.setTimeout(tempRegistry.getRegistryTimeout());
    reference.setRegistry(rc);
    reference.setApplication(new ApplicationConfig("test"));
    return reference;
}
项目:fastdfs-quickstart    文件:Constants.java   
public static final Boolean isStandAlone() {
  if (standAlone == null) {
    String standAloneValue = configure.get("filecloud.stand-alone");
    if (StringUtils.isNotBlank(standAloneValue)) {
      standAlone = BooleanUtils.toBoolean(standAloneValue.trim());
    } else {
      standAlone = false;
    }
  }
  return standAlone;
}
项目:fastdfs-quickstart    文件:Constants.java   
public static Boolean limitSuffix() {
  if (limitSuffix == null) {
    String limitSuffixValue = configure.get("filecloud.limit-file-suffix");
    if (StringUtils.isNotBlank(limitSuffixValue) && BooleanUtils.toBoolean(limitSuffixValue) == true) {
      limitSuffix = true;
    } else {
      limitSuffix = false;
    }
  }
  return limitSuffix;
}
项目:sample-login-restrictions    文件:LoginEventListener.java   
/**
 * @return True if user limit is not exceeded
 */
protected boolean checkConcurrentUsers() {
    long notSystemSessionCount = userSessions.getUserSessionInfo().stream()
            .filter(s -> BooleanUtils.isFalse(s.getSystem()))
            .count();

    return notSystemSessionCount < licenseConfig.getConcurrentSessionsLimit();
}
项目:apache-archiva    文件:DefaultRuntimeInfoService.java   
@Override
public ApplicationRuntimeInfo getApplicationRuntimeInfo( String locale )
    throws ArchivaRestServiceException
{
    ApplicationRuntimeInfo applicationRuntimeInfo = new ApplicationRuntimeInfo();
    applicationRuntimeInfo.setBuildNumber( this.archivaRuntimeInfo.getBuildNumber() );
    applicationRuntimeInfo.setTimestamp( this.archivaRuntimeInfo.getTimestamp() );
    applicationRuntimeInfo.setVersion( this.archivaRuntimeInfo.getVersion() );
    applicationRuntimeInfo.setBaseUrl( getBaseUrl( httpServletRequest ) );

    SimpleDateFormat sfd = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssz",
                                                 new Locale( StringUtils.isEmpty( locale ) ? "en" : locale ) );
    applicationRuntimeInfo.setTimestampStr( sfd.format( new Date( archivaRuntimeInfo.getTimestamp() ) ) );

    CookieInformation cookieInformation = new CookieInformation();

    RedbackRuntimeConfiguration redbackRuntimeConfiguration =
        redbackRuntimeConfigurationService.getRedbackRuntimeConfiguration();

    cookieInformation.setDomain(
        redbackRuntimeConfiguration.getConfigurationProperties().get( UserConfigurationKeys.REMEMBER_ME_DOMAIN ) );
    cookieInformation.setPath(
        redbackRuntimeConfiguration.getConfigurationProperties().get( UserConfigurationKeys.REMEMBER_ME_PATH ) );
    cookieInformation.setSecure(
        redbackRuntimeConfiguration.getConfigurationProperties().get( UserConfigurationKeys.REMEMBER_ME_SECURE ) );
    cookieInformation.setTimeout(
        redbackRuntimeConfiguration.getConfigurationProperties().get( UserConfigurationKeys.REMEMBER_ME_TIMEOUT ) );
    cookieInformation.setRememberMeEnabled( BooleanUtils.toBoolean(
        redbackRuntimeConfiguration.getConfigurationProperties().get(
            UserConfigurationKeys.REMEMBER_ME_ENABLED ) ) );

    applicationRuntimeInfo.setCookieInformation( cookieInformation );

    return applicationRuntimeInfo;
}
项目:Camel    文件:DockerHelper.java   
/**
 * Attempts to locate a given property name within a URI parameter or the message header.
 * A found value in a message header takes precedence over a URI parameter. Returns a
 * default value if given
 *
 * @param name
 * @param configuration
 * @param message
 * @param clazz
 * @param defaultValue
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> T getProperty(String name, DockerConfiguration configuration, Message message, Class<T> clazz, T defaultValue) {
    // First attempt to locate property from Message Header, then fallback to Endpoint property

    if (message != null) {
        T headerProperty = message.getHeader(name, clazz);

        if (headerProperty != null) {
            return headerProperty;
        }
    }

    Object prop = configuration.getParameters().get(transformFromHeaderName(name));

    if (prop != null) {

        if (prop.getClass().isAssignableFrom(clazz)) {
            return (T) prop;
        } else if (Integer.class == clazz) {
            return (T) Integer.valueOf((String) prop);
        } else if (Boolean.class == clazz) {
            return (T) BooleanUtils.toBooleanObject((String) prop, "true", "false", "null");
        }
    } else if (defaultValue != null) {
        return defaultValue;
    }

    return null;


}
项目:cuba    文件:Param.java   
protected CheckBox createUnaryField(final ValueProperty valueProperty) {
    CheckBox field = componentsFactory.createComponent(CheckBox.class);
    field.addValueChangeListener(e -> {
        Object newValue = BooleanUtils.isTrue((Boolean) e.getValue()) ? true : null;
        _setValue(newValue, valueProperty);
    });
    field.setValue(_getValue(valueProperty));
    field.setAlignment(Component.Alignment.MIDDLE_LEFT);
    return field;
}
项目:linkbinder    文件:ImageTextDetectionServiceImpl.java   
@Override
public boolean canUse() {
    boolean result = BooleanUtils.toBoolean(SystemConfig.getValue(Constants.KEY_GOOGLE_VISION_USE));
    if (!result) {
        log.warn("画像抽出機能は利用できません。設定を確認してください");
    }
    return result;
}
项目:sample-timesheets    文件:ProjectparticipantLookup.java   
@Override
public void init(Map<String, Object> params) {
    if (BooleanUtils.isTrue((Boolean) params.get("multiselect"))) {
        projectParticipantsTable.setMultiSelect(true);
    }
    Project project = (Project) params.get("project");
    projectParticipantsDs.refresh(ParamsMap.of("project", project));
}
项目:ThermosRebased    文件:BoolSetting.java   
@Override
public void setValue(String value)
{
    this.value = BooleanUtils.toBooleanObject(value);
    this.value = this.value == null ? def : this.value;
    config.set(path, this.value);
}
项目:engerek    文件:ApprovalSchemaBuilder.java   
private void sortFragments(List<Fragment> fragments) {
    fragments.forEach(f -> {
        if (f.compositionStrategy != null && BooleanUtils.isTrue(f.compositionStrategy.isMergeable())
                && f.compositionStrategy.getOrder() == null) {
            throw new IllegalStateException("Mergeable composition strategy with no order: "
                    + f.compositionStrategy + " in " + f.policyRule);
        }
    });

    // relying on the fact that the sort algorithm is stable
    fragments.sort((f1, f2) -> {
        ApprovalCompositionStrategyType s1 = f1.compositionStrategy;
        ApprovalCompositionStrategyType s2 = f2.compositionStrategy;
        Integer o1 = s1 != null ? s1.getOrder() : null;
        Integer o2 = s2 != null ? s2.getOrder() : null;
        if (o1 == null || o2 == null) {
            return MiscUtil.compareNullLast(o1, o2);
        }
        int c = Integer.compare(o1, o2);
        if (c != 0) {
            return c;
        }
        // non-mergeable first
        boolean m1 = BooleanUtils.isTrue(s1.isMergeable());
        boolean m2 = BooleanUtils.isTrue(s2.isMergeable());
        if (m1 && !m2) {
            return 1;
        } else if (!m1 && m2) {
            return -1;
        } else {
            return 0;
        }
    });
}
项目:engerek    文件:AbstractSearchExpressionEvaluator.java   
private ObjectSearchStrategyType getSearchStrategy() {
    SearchObjectExpressionEvaluatorType evaluator = getExpressionEvaluatorType();
    if (evaluator.getSearchStrategy() != null) {
        return evaluator.getSearchStrategy();
    }
    if (BooleanUtils.isTrue(evaluator.isSearchOnResource())) {
        return ObjectSearchStrategyType.ON_RESOURCE;
    }
    return ObjectSearchStrategyType.IN_REPOSITORY;
}
项目:cuba    文件:DynamicAttributesConditionFrame.java   
protected void fillOperationSelect(CategoryAttribute categoryAttribute) {
    Class clazz = DynamicAttributesUtils.getAttributeClass(categoryAttribute);
    OpManager opManager = AppBeans.get(OpManager.class);
    EnumSet<Op> availableOps = BooleanUtils.isTrue(categoryAttribute.getIsCollection()) ?
            opManager.availableOpsForCollectionDynamicAttribute() : opManager.availableOps(clazz);
    List<Op> ops = new LinkedList<>(availableOps);
    operationLookup.setOptionsList(ops);
    Op operator = condition.getOperator();
    if (operator != null) {
        operationLookup.setValue(operator);
    }
}
项目:engerek    文件:NavigatorPanel.java   
private void initFirst() {
    WebMarkupContainer first = new WebMarkupContainer(ID_FIRST);
    first.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return isFirstEnabled() ? "" : "disabled";
        }
    }));
    add(first);
    AjaxLink firstLink = new AjaxLink(ID_FIRST_LINK) {

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
        }

        @Override
        public void onClick(AjaxRequestTarget target) {
            firstPerformed(target);
        }
    };
    firstLink.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return BooleanUtils.isTrue(showPageListingModel.getObject()) && isFirstEnabled();
        }
    });
    first.add(firstLink);
}
项目:sampler    文件:SamplerFoldersPane.java   
private void createMenuHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);
    header.setWidth("100%");

    Label label = new Label(messages.getMessage(getClass(), "LeftPanel.caption"));
    label.setStyleName("cuba-folders-pane-caption");
    header.addComponent(label);
    header.setExpandRatio(label, 1);

    // NOTE: For development convenience only
    if (BooleanUtils.toBoolean(AppContext.getProperty("sampler.developerMode"))) {
        Button refresh = createButton("Refresh", event -> resetAllMenuItems());
        refresh.setDescription("Reload all menu items");
        header.addComponent(refresh);
        header.setComponentAlignment(refresh, MIDDLE_RIGHT);
    }

    Button collapseAll = createButton("LeftPanel.collapseAll", event -> collapseAll());
    header.addComponent(collapseAll);
    header.setComponentAlignment(collapseAll, MIDDLE_RIGHT);

    Button expandAll = createButton("LeftPanel.expandAll", event -> expandAll());
    header.addComponent(expandAll);
    header.setComponentAlignment(expandAll, MIDDLE_RIGHT);

    menuLayout.addComponent(header);
}