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

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

Introduction

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

Prototype

public static boolean isNotTrue(Boolean bool) 

Source Link

Document

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

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

Usage

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/*from  ww w. j  a va 2s.  c  om*/
 * @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:gov.nih.nci.cabig.caaers.workflow.handler.NodeSkipActionHandler.java

/**
 * Checks whether this node is applicable (configured in admin page by admin)
 * If applicable, /*from w w  w  .  j a  v  a 2 s  .  c o  m*/
 *   - Identify the assignees of the task and create tasks. 
 * If not applicable,
 *   - The flow will leave the node (to the default transition)
 */
public void execute(ExecutionContext context) throws Exception {

    String workflowDefinitionName = context.getProcessDefinition().getName();
    ProcessInstance pInstance = context.getProcessInstance();
    Token rootToken = pInstance.getRootToken();

    Node currentNode = rootToken == null ? null : rootToken.getNode();
    String taskNodeName = currentNode.getName();

    TaskConfig taskConfig = workflowService.findTaskConfig(workflowDefinitionName, taskNodeName);
    if (taskConfig == null || BooleanUtils.isNotTrue(taskConfig.getApplicable())) {
        //not applicable
        currentNode.leave(context);
    } else {
        //applicable, so create tasks
        List<Person> assignees = workflowService.findTaskAssignees(pInstance, taskNodeName);
        workflowService.createTaskInstances(new CreateTaskJbpmCallback(context, assignees));
    }

}

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

public static void getPlatformNo(String platformName, String platformKind) {
    try {/*from   ww w  .j  a v a 2s  .  c o m*/
        String platformSql = "SELECT * FROM PLATFORM";
        List<Platform> platforms = SQLMain.selectExecuteWithResult(platformSql, Platform.class);
        if (platforms == null || platforms.isEmpty()) {
            System.out.println("NULL");
            return;
        }
        for (Platform platform : platforms) {
            if (StringUtils.equals(platform.getPlatformName(), platformName)) {
                if (BooleanUtils.isNotTrue(platform.getSelectable())) {
                    //???
                    System.out.println("DISABLE");
                    return;
                }

                String platformAwsSql = "SELECT * FROM PLATFORM_AWS WHERE PLATFORM_NO="
                        + platform.getPlatformNo();
                List<PlatformAws> platformAwses = SQLMain.selectExecuteWithResult(platformAwsSql,
                        PlatformAws.class);
                if ("ec2".equals(platformKind) && "aws".equals(platform.getPlatformType())
                        && BooleanUtils.isFalse(platformAwses.get(0).getEuca())) {
                    System.out.println(platform.getPlatformNo().toString());
                    return;
                } else if ("vmware".equals(platformKind) && "vmware".equals(platform.getPlatformType())) {
                    System.out.println(platform.getPlatformNo().toString());
                    return;
                } else if ("eucalyptus".equals(platformKind) && "aws".equals(platform.getPlatformType())
                        && BooleanUtils.isTrue(platformAwses.get(0).getEuca())) {
                    System.out.println(platform.getPlatformNo().toString());
                    return;
                } else if ("nifty".equals(platformKind) && "nifty".equals(platform.getPlatformType())) {
                    System.out.println(platform.getPlatformNo().toString());
                    return;
                } else if ("cloudstack".equals(platformKind)
                        && "cloudstack".equals(platform.getPlatformType())) {
                    System.out.println(platform.getPlatformNo().toString());
                    return;
                } else if ("vcloud".equals(platformKind) && "vcloud".equals(platform.getPlatformType())) {
                    System.out.println(platform.getPlatformNo().toString());
                    return;
                } else if ("azure".equals(platformKind) && "azure".equals(platform.getPlatformType())) {
                    System.out.println(platform.getPlatformNo().toString());
                    return;
                } else if ("openstack".equals(platformKind) && "openstack".equals(platform.getPlatformType())) {
                    System.out.println(platform.getPlatformNo().toString());
                    return;
                }
            }
        }
        System.out.println("OTHER");
    } catch (Exception e) {
        e.printStackTrace();
        log.error(e.getMessage(), e);
    }
}

From source file:jp.primecloud.auto.process.lb.LoadBalancerProcess.java

public void start(Long loadBalancerNo) {
    LoadBalancer loadBalancer = loadBalancerDao.read(loadBalancerNo);
    if (loadBalancer == null) {
        // ?????/*from  w ww. ja  v  a2 s.  c  o m*/
        throw new AutoException("EPROCESS-000010", loadBalancerNo);
    }

    if (BooleanUtils.isNotTrue(loadBalancer.getEnabled())) {
        // ??????
        return;
    }

    LoadBalancerStatus status = LoadBalancerStatus.fromStatus(loadBalancer.getStatus());
    if (status != LoadBalancerStatus.STOPPED && status != LoadBalancerStatus.RUNNING) {
        // ??????????
        if (log.isDebugEnabled()) {
            log.debug(MessageUtils.format("LoadBalancer {1} status is {2}.(loadBalancerNo={0})", loadBalancerNo,
                    loadBalancer.getLoadBalancerName(), status));
        }
        return;
    }

    if (log.isInfoEnabled()) {
        log.info(
                MessageUtils.getMessage("IPROCESS-200001", loadBalancerNo, loadBalancer.getLoadBalancerName()));
    }

    // ?
    if (status == LoadBalancerStatus.RUNNING) {
        status = LoadBalancerStatus.CONFIGURING;
    } else {
        status = LoadBalancerStatus.STARTING;
    }
    loadBalancer.setStatus(status.toString());
    loadBalancerDao.update(loadBalancer);

    // 
    if (status == LoadBalancerStatus.STARTING) {
        processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, null, "LoadBalancerStart",
                new Object[] { loadBalancer.getLoadBalancerName() });
    } else if (status == LoadBalancerStatus.CONFIGURING) {
        processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, null, "LoadBalancerReload",
                new Object[] { loadBalancer.getLoadBalancerName() });
    }

    try {
        // ??
        startLoadBalancer(loadBalancer);

    } catch (RuntimeException e) {
        loadBalancer = loadBalancerDao.read(loadBalancerNo);
        status = LoadBalancerStatus.fromStatus(loadBalancer.getStatus());

        // 
        if (status == LoadBalancerStatus.STARTING) {
            processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, null, "LoadBalancerStartFail",
                    new Object[] { loadBalancer.getLoadBalancerName() });
        } else if (status == LoadBalancerStatus.CONFIGURING) {
            processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, null, "LoadBalancerReloadFail",
                    new Object[] { loadBalancer.getLoadBalancerName() });
        }

        // ?
        loadBalancer = loadBalancerDao.read(loadBalancerNo);
        loadBalancer.setStatus(LoadBalancerStatus.WARNING.toString());
        loadBalancerDao.update(loadBalancer);

        throw e;
    }

    loadBalancer = loadBalancerDao.read(loadBalancerNo);
    status = LoadBalancerStatus.fromStatus(loadBalancer.getStatus());

    // 
    if (status == LoadBalancerStatus.STARTING) {
        processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, null, "LoadBalancerStartFinish",
                new Object[] { loadBalancer.getLoadBalancerName() });
    } else if (status == LoadBalancerStatus.CONFIGURING) {
        processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, null, "LoadBalancerReloadFinish",
                new Object[] { loadBalancer.getLoadBalancerName() });
    }

    // ?
    loadBalancer = loadBalancerDao.read(loadBalancerNo);
    loadBalancer.setStatus(LoadBalancerStatus.RUNNING.toString());
    loadBalancerDao.update(loadBalancer);

    if (log.isInfoEnabled()) {
        log.info(
                MessageUtils.getMessage("IPROCESS-200002", loadBalancerNo, loadBalancer.getLoadBalancerName()));
    }
}

From source file:com.hybris.instore.widgets.listtracker.ListTrackerControllerTest.java

@Test
public void testInitialState() {
    // make sure next/previous nav is not possible
    Assert.assertTrue(/*ww  w  .j  a v  a2  s.  c  o m*/
            BooleanUtils.isNotTrue((Boolean) widgetModel.get(ListTrackerController.MODEL_NEXT_AVAILBLE)));
    Assert.assertTrue(
            BooleanUtils.isNotTrue((Boolean) widgetModel.get(ListTrackerController.MODEL_PREVIOUS_AVAILBLE)));

    // make sure list is null or empty
    Assert.assertTrue(CollectionUtils.isEmpty((Collection) widgetModel.get(ListTrackerController.MODEL_LIST)));
}

From source file:jp.primecloud.auto.api.ListImage.java

/**
 *
 * ?//from   w ww  . j ava  2 s  .com
 * @param userName ??
 * @param farmNo ?
 * @param platformNo ?
 *
 * @return ListImageResponse
 */
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ListImageResponse listImage(@QueryParam(PARAM_NAME_USER) String userName,
        @QueryParam(PARAM_NAME_FARM_NO) String farmNo, @QueryParam(PARAM_NAME_PLATFORM_NO) String platformNo) {

    ListImageResponse response = new ListImageResponse();

    try {
        // ?
        // Key(??)
        ApiValidate.validateUser(userName);
        // FarmNo
        ApiValidate.validateFarmNo(farmNo);
        // PlatformNo
        ApiValidate.validatePlatformNo(platformNo);

        //?
        User user = userDao.readByUsername(userName);

        //?
        Platform platform = platformDao.read(Long.parseLong(platformNo));

        if (platform == null) {
            //????
            throw new AutoApplicationException("EAPI-100000", "Platform", PARAM_NAME_PLATFORM_NO, platformNo);
        }
        if (!platformService.isUseablePlatforms(user.getUserNo(), platform)
                || BooleanUtils.isNotTrue(platform.getSelectable())) {
            //????? or ????
            throw new AutoApplicationException("EAPI-000020", "Platform", PARAM_NAME_PLATFORM_NO, platformNo);
        }

        // ?
        List<Image> images = imageDao.readByPlatformNo(Long.parseLong(platformNo));
        for (Image image : images) {
            //?
            if (BooleanUtils.isTrue(image.getSelectable())) {
                // ?? ????
                ImageResponse imageResponse = new ImageResponse(platform, image);
                response.addImage(imageResponse);
            }
        }

        response.setSuccess(true);
    } catch (Throwable e) {
        String message = "";
        if (e instanceof AutoException || e instanceof AutoApplicationException) {
            message = e.getMessage();
        } else {
            message = MessageUtils.getMessage("EAPI-000000");
        }
        log.error(message, e);
        response.setMessage(message);
        response.setSuccess(false);
    }

    return response;
}

From source file:jp.primecloud.auto.api.component.CreateComponent.java

/**
 *
 * ?// w  ww .j  a  va  2s.c o m
 *
 * @param farmNo ?
 * @param componentName ????
 * @param componentTypeNo ???
 * @param diskSize 
 * @param comment 
 * @return CreateComponentResponse
 */
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public CreateComponentResponse createComponent(@QueryParam(PARAM_NAME_FARM_NO) String farmNo,
        @QueryParam(PARAM_NAME_COMPONENT_NAME) String componentName,
        @QueryParam(PARAM_NAME_COMPONENT_TYPE_NO) String componentTypeNo,
        @QueryParam(PARAM_NAME_DISK_SIZE) String diskSize, @QueryParam(PARAM_NAME_COMMENT) String comment) {

    CreateComponentResponse response = new CreateComponentResponse();

    try {
        // ?
        // farmNo
        ApiValidate.validateFarmNo(farmNo);
        // componentName
        ApiValidate.validateComponentName(componentName);
        // componentTypeNo
        ApiValidate.validateComponentTypeNo(componentTypeNo);
        // diskSize
        ApiValidate.validateDiskSize(diskSize);
        // comments
        ApiValidate.validateComment(comment);

        ComponentType componentType = componentTypeDao.read(Long.parseLong(componentTypeNo));
        if (componentType == null) {
            //??????
            throw new AutoApplicationException("EAPI-100000", "ComponentType", PARAM_NAME_COMPONENT_TYPE_NO,
                    componentTypeNo);
        }
        if (BooleanUtils.isNotTrue(componentType.getSelectable())) {
            //??????
            throw new AutoApplicationException("EAPI-000020", "ComponentType", PARAM_NAME_COMPONENT_TYPE_NO,
                    componentTypeNo);
        }

        // ?
        Long componentNo = componentService.createComponent(Long.parseLong(farmNo), componentName,
                Long.valueOf(componentTypeNo), comment, Integer.parseInt(diskSize));

        response.setComponentNo(componentNo);
        response.setSuccess(true);
    } catch (Throwable e) {
        String message = "";
        if (e instanceof AutoException || e instanceof AutoApplicationException) {
            message = e.getMessage();
        } else {
            message = MessageUtils.getMessage("EAPI-000000");
        }
        log.error(message, e);
        response.setMessage(message);
        response.setSuccess(false);
    }

    return response;
}

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

public void start(Long instanceNo) {
    Instance instance = instanceDao.read(instanceNo);
    if (instance == null) {
        // ????/*from  ww w.  j  a va 2s  .  co m*/
        throw new AutoException("EPROCESS-000002", instanceNo);
    }

    if (BooleanUtils.isNotTrue(instance.getEnabled())) {
        // ?????
        return;
    }

    //??
    Farm farm = farmDao.read(instance.getFarmNo());

    // ?
    LoggingUtils.setInstanceNo(instanceNo);
    LoggingUtils.setInstanceName(instance.getInstanceName());
    LoggingUtils.setInstanceType(processLogger.getInstanceType(instanceNo));
    LoggingUtils.setPlatformNo(instance.getPlatformNo());

    InstanceStatus status = InstanceStatus.fromStatus(instance.getStatus());
    if (status != InstanceStatus.STOPPED && status != InstanceStatus.RUNNING) {
        // ??????????
        if (log.isDebugEnabled()) {
            log.debug(MessageUtils.format("Instance {1} status is {2}.(instanceNo={0})", instanceNo,
                    instance.getInstanceName(), status));
        }
        return;
    }

    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100001", instanceNo, instance.getInstanceName()));
    }

    // ???
    if (status == InstanceStatus.RUNNING) {
        status = InstanceStatus.CONFIGURING;
    } else {
        status = InstanceStatus.STARTING;
    }
    instance.setStatus(status.toString());
    instanceDao.update(instance);

    // 
    if (status == InstanceStatus.STARTING) {
        processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, instance, "InstanceStart", null);
    } else if (status == InstanceStatus.CONFIGURING) {
        processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, instance, "InstanceReload", null);
    }

    Platform platform = platformDao.read(instance.getPlatformNo());
    Image image = imageDao.read(instance.getImageNo());
    try {

        //?? AWS????
        if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatformType())) {
            AwsInstance awsInstance = awsInstanceDao.read(instanceNo);
            // ???EBS?ID????
            ImageAws imageAws = imageAwsDao.read(image.getImageNo());
            if (!imageAws.getEbsImage() || StringUtils.isEmpty(awsInstance.getInstanceId())) {
                // ID????Puppet??
                if (StringUtils.isEmpty(awsInstance.getInstanceId())) {
                    clearPuppetCa(instanceNo);
                }
                // EBS?ID???
            } else {
                // ?????Puppet??
                if (StringUtils.equals(awsInstance.getStatus(), "stopped")) {
                    clearPuppetCa(instanceNo);
                }
            }
        }

        // ?
        // TODO CLOUD BRANCHING
        if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatformType())
                || PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platform.getPlatformType())
                || PCCConstant.PLATFORM_TYPE_VCLOUD.equals(platform.getPlatformType())
                || PCCConstant.PLATFORM_TYPE_AZURE.equals(platform.getPlatformType())
                || PCCConstant.PLATFORM_TYPE_OPENSTACK.equals(platform.getPlatformType())) {
            //IaasGateway
            IaasGatewayWrapper gateway = iaasGatewayFactory.createIaasGateway(farm.getUserNo(),
                    instance.getPlatformNo());
            gateway.startInstance(instanceNo);
        } else if (PCCConstant.PLATFORM_TYPE_VMWARE.equals(platform.getPlatformType())) {
            //**********************************TODO IaasGateway?????

            // VMware??
            vmwareProcess.start(instanceNo);
        } else if (PCCConstant.PLATFORM_TYPE_NIFTY.equals(platform.getPlatformType())) {
            //**********************************TODO IaasGateway?????
            // Nifty??
            niftyProcess.start(instanceNo);
        }

        //? AWS or CloudStack or VCloud or Azure????
        // TODO CLOUD BRANCHING
        if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatformType())
                || PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platform.getPlatformType())
                || PCCConstant.PLATFORM_TYPE_VCLOUD.equals(platform.getPlatformType())
                || PCCConstant.PLATFORM_TYPE_AZURE.equals(platform.getPlatformType())
                || PCCConstant.PLATFORM_TYPE_OPENSTACK.equals(platform.getPlatformType())) {
            // DNS???
            dnsProcess.startDns(platform, instanceNo);
        }

        // ???
        instance = instanceDao.read(instanceNo);
        instanceDao.update(instance);

        // ??
        if (puppetInstanceDao.countByInstanceNo(instanceNo) > 0) {
            puppetNodeProcess.startNode(instanceNo);
        }

        // ???
        instance = instanceDao.read(instanceNo);
        instanceDao.update(instance);

        // ?
        if (zabbixInstanceDao.countByInstanceNo(instanceNo) > 0) {
            zabbixHostProcess.startHost(instanceNo);
        }

    } catch (RuntimeException e) {
        instance = instanceDao.read(instanceNo);
        status = InstanceStatus.fromStatus(instance.getStatus());

        // 
        if (status == InstanceStatus.STARTING) {
            processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, instance, "InstanceStartFail", null);
        } else if (status == InstanceStatus.CONFIGURING) {
            processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, instance, "InstanceReloadFail", null);
        }

        // ?
        instance.setStatus(InstanceStatus.WARNING.toString());
        instanceDao.update(instance);

        throw e;
    }

    instance = instanceDao.read(instanceNo);
    status = InstanceStatus.fromStatus(instance.getStatus());

    // 
    if (status == InstanceStatus.STARTING) {
        processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, instance, "InstanceStartFinish", null);
    } else if (status == InstanceStatus.CONFIGURING) {
        processLogger.writeLogSupport(ProcessLogger.LOG_INFO, null, instance, "InstanceReloadFinish", null);
    }

    // ???
    instance.setStatus(InstanceStatus.RUNNING.toString());
    instanceDao.update(instance);

    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100002", instanceNo, instance.getInstanceName()));
    }
}

From source file:com.evolveum.midpoint.wf.impl.processes.itemApproval.ItemApprovalProcessInterface.java

@Override
public WorkItemResultType extractWorkItemResult(Map<String, Object> variables) {
    Boolean wasCompleted = ActivitiUtil.getVariable(variables, VARIABLE_WORK_ITEM_WAS_COMPLETED, Boolean.class,
            prismContext);//from w  ww . ja v a2s .  co m
    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;
}

From source file:jp.primecloud.auto.api.ListPlatform.java

/**
 *
 * ?//ww  w .  j  a v a 2 s  .  c  o m
 * @param userName ??
 * @param farmNo ?
 *
 * @return ListPlatformResponse
 */
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ListPlatformResponse listPlatform(@QueryParam(PARAM_NAME_USER) String userName,
        @QueryParam(PARAM_NAME_FARM_NO) String farmNo) {

    ListPlatformResponse response = new ListPlatformResponse();

    try {
        // ?
        // Key(??)
        ApiValidate.validateUser(userName);
        // FarmNo
        ApiValidate.validateFarmNo(farmNo);

        //?
        User user = userDao.readByUsername(userName);

        // ?
        List<Platform> platforms = platformDao.readAll();
        for (Platform platform : platforms) {
            if (!platformService.isUseablePlatforms(user.getUserNo(), platform)
                    || BooleanUtils.isNotTrue(platform.getSelectable())) {
                //????? or   ???
                continue;
            }
            PlatformResponse platformResponse = new PlatformResponse(platform);
            // TODO CLOUD BRANCHING
            if (PLATFORM_TYPE_AWS.equals(platform.getPlatformType())) {
                PlatformAwsResponse awsResponse = getAwsDetail(user.getUserNo(), platform.getPlatformNo());
                platformResponse.setAws(awsResponse);
            } else if (PLATFORM_TYPE_CLOUDSTACK.equals(platform.getPlatformType())) {
                PlatformCloudstackResponse csResponse = getCloudstackDetail(user.getUserNo(),
                        platform.getPlatformNo());
                platformResponse.setCloudstack(csResponse);
            } else if (PLATFORM_TYPE_VMWARE.equals(platform.getPlatformType())) {
                PlatformVmwareResponse vmwareResponse = getVmwareDetail(user.getUserNo(),
                        platform.getPlatformNo());
                platformResponse.setVmware(vmwareResponse);
            } else if (PLATFORM_TYPE_NIFTY.equals(platform.getPlatformType())) {
                PlatformNiftyResponse niftyResponse = getNiftyDetail(user.getUserNo(),
                        platform.getPlatformNo());
                platformResponse.setNifty(niftyResponse);
            } else if (PLATFORM_TYPE_VCLOUD.equals(platform.getPlatformType())) {
                PlatformVcloudResponse vcloudResponse = getVcloudDetail(user.getUserNo(),
                        platform.getPlatformNo());
                platformResponse.setVcloud(vcloudResponse);
            } else if (PLATFORM_TYPE_OPENSTACK.equals(platform.getPlatformType())) {
                PlatformOpenstackResponse openstackResponse = getOpenstackDetail(user.getUserNo(),
                        platform.getPlatformNo());
                platformResponse.setOpenstack(openstackResponse);
            } else if (PLATFORM_TYPE_AZURE.equals(platform.getPlatformType())) {
                PlatformAzureResponse azureResponse = getAzureDetail(user.getUserNo(),
                        platform.getPlatformNo());
                platformResponse.setAzure(azureResponse);
            }
            response.addPlatform(platformResponse);
        }

        response.setSuccess(true);
    } catch (Throwable e) {
        String message = "";
        if (e instanceof AutoException || e instanceof AutoApplicationException) {
            message = e.getMessage();
        } else {
            message = MessageUtils.getMessage("EAPI-000000");
        }
        log.error(message, e);
        response.setMessage(message);
        response.setSuccess(false);
    }

    return response;
}