Example usage for org.apache.commons.lang BooleanUtils isTrue

List of usage examples for org.apache.commons.lang BooleanUtils isTrue

Introduction

In this page you can find the example usage for org.apache.commons.lang BooleanUtils isTrue.

Prototype

public static boolean isTrue(Boolean bool) 

Source Link

Document

Checks if a Boolean value is true, handling null by returning false.

 BooleanUtils.isTrue(Boolean.TRUE)  = true BooleanUtils.isTrue(Boolean.FALSE) = false BooleanUtils.isTrue(null)          = false 

Usage

From source file:com.haulmont.timesheets.gui.projectparticipant.ProjectparticipantLookup.java

@Override
public void init(Map<String, Object> params) {
    if (BooleanUtils.isTrue((Boolean) params.get("multiselect"))) {
        projectParticipantsTable.setMultiSelect(true);
    }/*from  w  ww. j  a  v  a 2 s.com*/
    Project project = (Project) params.get("project");
    projectParticipantsDs.refresh(ParamsMap.of("project", project));
}

From source file:com.evolveum.midpoint.wf.util.ApprovalUtils.java

public static boolean isApproved(AbstractWorkItemOutputType result) {
    return BooleanUtils.isTrue(approvalBooleanValue(result));
}

From source file:net.shopxx.service.impl.DeliveryTemplateServiceImpl.java

@Override
@Transactional/*from  w  w  w .  jav a2s . co  m*/
public DeliveryTemplate update(DeliveryTemplate deliveryTemplate) {
    Assert.notNull(deliveryTemplate);

    if (BooleanUtils.isTrue(deliveryTemplate.getIsDefault())) {
        deliveryTemplateDao.setDefault(deliveryTemplate);
    }
    return super.update(deliveryTemplate);
}

From source file:net.shopxx.service.impl.ReceiverServiceImpl.java

@Override
@Transactional/*  w ww. ja  va 2 s  .com*/
public Receiver update(Receiver receiver) {
    Assert.notNull(receiver);

    if (BooleanUtils.isTrue(receiver.getIsDefault())) {
        receiverDao.setDefault(receiver);
    }
    return super.update(receiver);
}

From source file:com.evolveum.midpoint.wf.util.ApprovalUtils.java

private static boolean isApproved(WorkItemOutcomeType outcome) {
    return BooleanUtils.isTrue(approvalBooleanValue(outcome));
}

From source file:gov.nih.nci.cabig.caaers.domain.AbstractMutableRetireableDomainObject.java

@Transient
public boolean isRetired() {
    return BooleanUtils.isTrue(retiredIndicator);
}

From source file:jp.primecloud.auto.tool.management.main.IaasGatewayMain.java

public static void importExecute(CommandLine commandLine) {
    Long userNo = Long.parseLong(commandLine.getOptionValue("userno"));
    Long platformNo = Long.parseLong(commandLine.getOptionValue("platformno"));
    String platformKind = commandLine.getOptionValue("platformkind");
    String keyName = commandLine.getOptionValue("keyname");
    String publicKey = commandLine.getOptionValue("publickey");

    try {/*from w w w .j  a v  a2  s .com*/
        log.info("IaasGatewayScriptFactory");
        String platformSql = "SELECT * FROM PLATFORM WHERE PLATFORM_NO=" + platformNo;
        List<Platform> platforms = SQLMain.selectExecuteWithResult(platformSql, Platform.class);
        Platform platform = platforms.get(0);

        IaasGatewayScriptService scriptService = IaasGatewayScriptFactory.createIaasGatewayScriptService(userNo,
                platformNo, platform.getPlatformName());
        if ("aws".equals(platformKind)) {
            String platformAwsSql = "SELECT * FROM PLATFORM_AWS WHERE PLATFORM_NO=" + platformNo;
            List<PlatformAws> platformAwses = SQLMain.selectExecuteWithResult(platformAwsSql,
                    PlatformAws.class);
            PlatformAws aws = platformAwses.get(0);
            if (BooleanUtils.isTrue(aws.getVpc()) && !scriptService.hasSubnets(aws.getVpcId())) {
                // AWS?VPC??
                // Subnet???VPC??????
                return;
            }
        }
        scriptService.importKeyPair(keyName, publicKey);
    } catch (AutoException e) {
        log.error("????????keyName:" + keyName
                + " platformNo:" + platformNo, e);
        System.out.println("IMPORT_ERROR");
    } catch (Exception e) {
        log.error("????????keyName:" + keyName
                + " platformNo:" + platformNo, e);
        System.out.println("????????");
    } finally {
    }
}

From source file:gov.nih.nci.cabig.caaers.domain.comparator.AdverseEventComprator.java

/**
 * Sort the AE's according to the following
 * a. Descending by Reporting Required (Yes, then No)
 * b. Descending by grade (highest grade 1st)
 * c. Descending by Attribution (definite, probable, possible, unlikely, unrelated)
 * d. Descending by Hospitalization (Yes, then No)
 * e. Ascending by Expected (No, then Yes)
 * Returns 1 if ae2 is greater ae1, 0 if they are equal , -1 if ae1 is greater than ae2.
 *
 * @param ae1 the ae1//ww  w  . j a va  2s. co  m
 * @param ae2 the ae2
 * @return the int
 */
public int compare(AdverseEvent ae1, AdverseEvent ae2) {
    if (ae1 == null && ae2 == null)
        return 0;
    if (ae1 == null)
        return 1;
    if (ae2 == null)
        return -1;

    //if they are equal return 0
    if (ae1 == ae2)
        return 0;

    if (BooleanUtils.isTrue(ae1.getRequiresReporting()) && BooleanUtils.isNotTrue(ae2.getRequiresReporting()))
        return -1;
    if (BooleanUtils.isTrue(ae2.getRequiresReporting()) && BooleanUtils.isNotTrue(ae1.getRequiresReporting()))
        return 1;

    int gradeComparisonResult = CodedEnumUtils.compare(ae2.getGrade(), ae1.getGrade());
    if (gradeComparisonResult != 0)
        return -1 * gradeComparisonResult;

    int attributionComparisonResult = CodedEnumUtils.compare(ae2.getAttributionSummary(),
            ae1.getAttributionSummary());
    if (attributionComparisonResult != 0)
        return -1 * attributionComparisonResult;

    int hospitalizationComparisonResult = CodedEnumUtils.compare(ae2.getHospitalization(),
            ae1.getHospitalization());
    if (hospitalizationComparisonResult != 0)
        return hospitalizationComparisonResult;

    if (BooleanUtils.isTrue(ae1.getExpected()) && BooleanUtils.isNotTrue(ae2.getExpected()))
        return -1;
    if (BooleanUtils.isTrue(ae2.getExpected()) && BooleanUtils.isNotTrue(ae1.getExpected()))
        return 1;

    return 0;
}

From source file:jp.primecloud.auto.process.InstancesProcess.java

public void start(Long farmNo) {
    Farm farm = farmDao.read(farmNo);/*from w ww .  j a  va  2  s  .c om*/
    if (BooleanUtils.isTrue(farm.getComponentProcessing())) {
        // ??????????
        if (log.isDebugEnabled()) {
            String message = MessageUtils.format("Component is being configured.(farmNo={0})", farmNo);
            log.debug(message);
        }
        return;
    }

    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100021", farmNo));
    }

    // 
    farm.setComponentProcessing(true);
    farmDao.update(farm);

    //
    processLogger.writeLogSupport(ProcessLogger.LOG_DEBUG, null, null, "InstanceCoordinate", null);

    try {
        // ????
        List<Long> startInstanceNos = new ArrayList<Long>();
        List<Instance> allInstances = instanceDao.readByFarmNo(farmNo);
        for (Instance instance : allInstances) {
            // ????????????????????
            if (InstanceStatus.fromStatus(instance.getStatus()) == InstanceStatus.RUNNING) {
                if (BooleanUtils.isTrue(instance.getEnabled()) || InstanceCoodinateStatus
                        .fromStatus(instance.getCoodinateStatus()) == InstanceCoodinateStatus.COODINATED) {
                    startInstanceNos.add(instance.getInstanceNo());
                }
            }
        }

        InstancesProcessContext context = new InstancesProcessContext();
        context.setFarmNo(farmNo);
        context.setStartInstanceNos(startInstanceNos);

        // ??
        puppetNodesProcess.configureNodes(context);

    } finally {
        // 
        farm = farmDao.read(farmNo);
        farm.setComponentProcessing(false);
        farmDao.update(farm);
    }

    //
    processLogger.writeLogSupport(ProcessLogger.LOG_DEBUG, null, null, "InstanceCoordinateFinish", null);

    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100022", farmNo));
    }
}

From source file:com.haulmont.cuba.security.listener.UserEntityListener.java

@Override
public void onBeforeUpdate(User entity, EntityManager entityManager) {
    updateLoginLowerCase(entity);/*from   w  w  w  .  j  av  a  2s .  c o  m*/

    //noinspection ConstantConditions
    if (persistenceTools.getDirtyFields(entity).contains("active")
            && BooleanUtils.isTrue((Boolean) persistenceTools.getOldValue(entity, "active"))) {
        events.publish(new UserInvalidationEvent(entity));
    }
}