List of usage examples for org.apache.commons.lang BooleanUtils toBoolean
public static boolean toBoolean(String str)
Converts a String to a boolean (optimised for performance).
'true'
, 'on'
or 'yes'
(case insensitive) will return true
.
From source file:com.tesora.dve.tools.DVEAnalyzerCLI.java
/** * Perform static analysis of a database. In order to run the database(s) * must have been set.//from www . j ava2s . co m * * @throws PEException * @throws SQLException */ public void cmd_static(Scanner scanner) throws PEException, SQLException { checkConnection(); checkDatabase(); final Boolean analyze = BooleanUtils.toBoolean(scan(scanner)); println("... Connecting to " + url + " as " + user + "/" + password); final DBHelper dbHelper = new DBHelper(url, user, password).connect(); println("... Starting static analysis for '" + databasesToString() + "'"); report = StaticAnalyzer.doStatic(dbNative, options, url, user, password, databases, dbHelper, analyze); println("... Static anlysis complete for '" + databasesToString() + "'"); }
From source file:com.cloud.hypervisor.guru.VMwareGuru.java
/** * Decide in which cases nested virtualization should be enabled based on (1){@code globalNestedV}, (2){@code globalNestedVPerVM}, (3){@code localNestedV}<br/> * Nested virtualization should be enabled when one of this cases: * <ul>/*from w w w .java 2 s . c o m*/ * <li>(1)=TRUE, (2)=TRUE, (3) is NULL (missing)</li> * <li>(1)=TRUE, (2)=TRUE, (3)=TRUE</li> * <li>(1)=TRUE, (2)=FALSE</li> * <li>(1)=FALSE, (2)=TRUE, (3)=TRUE</li> * </ul> * In any other case, it shouldn't be enabled * @param globalNestedV value of {@code 'vmware.nested.virtualization'} global config * @param globalNestedVPerVM value of {@code 'vmware.nested.virtualization.perVM'} global config * @param localNestedV value of {@code 'nestedVirtualizationFlag'} key in vm details if present, null if not present * @return "true" for cases in which nested virtualization is enabled, "false" if not */ protected Boolean shouldEnableNestedVirtualization(Boolean globalNestedV, Boolean globalNestedVPerVM, String localNestedV) { if (globalNestedV == null || globalNestedVPerVM == null) { return false; } boolean globalNV = globalNestedV.booleanValue(); boolean globalNVPVM = globalNestedVPerVM.booleanValue(); if (globalNVPVM) { return (localNestedV == null && globalNV) || BooleanUtils.toBoolean(localNestedV); } return globalNV; }
From source file:info.magnolia.cms.gui.dialog.DialogControlImpl.java
/** * True if a value is required. Set it in the configuration * @return/*from w ww . ja v a 2 s . c om*/ */ public boolean isRequired() { if (BooleanUtils.toBoolean(this.getConfigValue("required"))) { return true; } return false; }
From source file:de.fhg.iais.asc.commons.AscConfiguration.java
/** * @see {@link Map#get(Object)} and {@link Strings#toBoolean(Object, boolean)} * @param key/*from w w w . j a v a 2 s .c o m*/ * @param dv Default value * @return boolean */ public boolean get(String key, boolean dv) { Object o = this.propertiesMap.get(key); return o == null ? dv : BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBoolean(o.toString()), dv); }
From source file:com.photon.maven.plugins.android.standalonemojos.ManifestUpdateMojo.java
public void updateManifest(File manifestFile) throws IOException, ParserConfigurationException, SAXException, TransformerException, MojoFailureException { Document doc = readManifest(manifestFile); Element manifestElement = doc.getDocumentElement(); boolean dirty = false; if (StringUtils.isEmpty(parsedVersionName)) { // default to ${project.version} parsedVersionName = project.getVersion(); }//from w w w. ja va2s . c om Attr versionNameAttrib = manifestElement.getAttributeNode(ATTR_VERSION_NAME); if (versionNameAttrib == null || !StringUtils.equals(parsedVersionName, versionNameAttrib.getValue())) { getLog().info("Setting " + ATTR_VERSION_NAME + " to " + parsedVersionName); manifestElement.setAttribute(ATTR_VERSION_NAME, parsedVersionName); dirty = true; } if ((parsedVersionCodeAutoIncrement && parsedVersionCode != null) || (parsedVersionCodeUpdateFromVersion && parsedVersionCode != null) || (parsedVersionCodeAutoIncrement && parsedVersionCodeUpdateFromVersion)) { throw new MojoFailureException("versionCodeAutoIncrement, versionCodeUpdateFromVersion and versionCode " + "are mutual exclusive. They cannot be specified at the same time. " + "Please specify either versionCodeAutoIncrement, versionCodeUpdateFromVersion or versionCode!"); } if (parsedVersionCodeAutoIncrement) { Attr versionCode = manifestElement.getAttributeNode(ATTR_VERSION_CODE); int currentVersionCode = 0; if (versionCode != null) { currentVersionCode = NumberUtils.toInt(versionCode.getValue(), 0); } currentVersionCode++; manifestElement.setAttribute(ATTR_VERSION_CODE, String.valueOf(currentVersionCode)); dirty = true; } if (parsedVersionCodeUpdateFromVersion) { String verString = project.getVersion(); getLog().debug("Generating versionCode for " + verString); ArtifactVersion artifactVersion = new DefaultArtifactVersion(verString); String verCode = Integer.toString(artifactVersion.getMajorVersion()) + Integer.toString(artifactVersion.getMinorVersion()) + Integer.toString(artifactVersion.getIncrementalVersion()); getLog().info("Setting " + ATTR_VERSION_CODE + " to " + verCode); manifestElement.setAttribute(ATTR_VERSION_CODE, verCode); dirty = true; } if (parsedVersionCode != null) { Attr versionCodeAttr = manifestElement.getAttributeNode(ATTR_VERSION_CODE); int currentVersionCode = 0; if (versionCodeAttr != null) { currentVersionCode = NumberUtils.toInt(versionCodeAttr.getValue(), 0); } if (currentVersionCode != parsedVersionCode) { getLog().info("Setting " + ATTR_VERSION_CODE + " to " + parsedVersionCode); manifestElement.setAttribute(ATTR_VERSION_CODE, String.valueOf(parsedVersionCode)); dirty = true; } } if (!StringUtils.isEmpty(parsedSharedUserId)) { Attr sharedUserIdAttrib = manifestElement.getAttributeNode(ATTR_SHARED_USER_ID); if (sharedUserIdAttrib == null || !StringUtils.equals(parsedSharedUserId, sharedUserIdAttrib.getValue())) { getLog().info("Setting " + ATTR_SHARED_USER_ID + " to " + parsedSharedUserId); manifestElement.setAttribute(ATTR_SHARED_USER_ID, parsedSharedUserId); dirty = true; } } if (parsedDebuggable != null) { NodeList appElems = manifestElement.getElementsByTagName(ELEM_APPLICATION); // Update all application nodes. Not sure whether there will ever be more than one. for (int i = 0; i < appElems.getLength(); ++i) { Node node = appElems.item(i); getLog().info("Testing if node " + node.getNodeName() + " is application"); if (node.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) node; Attr debuggableAttrib = element.getAttributeNode(ATTR_DEBUGGABLE); if (debuggableAttrib == null || parsedDebuggable != BooleanUtils.toBoolean(debuggableAttrib.getValue())) { getLog().info("Setting " + ATTR_DEBUGGABLE + " to " + parsedDebuggable); element.setAttribute(ATTR_DEBUGGABLE, String.valueOf(parsedDebuggable)); dirty = true; } } } } if (dirty) { if (!manifestFile.delete()) { getLog().warn("Could not remove old " + manifestFile); } getLog().info("Made changes to manifest file, updating " + manifestFile); writeManifest(manifestFile, doc); } else { getLog().info("No changes found to write to manifest file"); } }
From source file:gov.nih.nci.cabig.caaers.grid.CaaersStudyConsumer.java
/** * This method will find out the Sponsor Identifier * @param studyDto/*from w w w. j a va 2s . c om*/ * @return */ // String findFundingSponsorIdentifier(gov.nih.nci.cabig.ccts.domain.Study studyDto){ // // return findOrganizationIdentifier(studyDto, OrganizationAssignedIdentifier.SPONSOR_IDENTIFIER_TYPE); // } void populateStudyDetails(gov.nih.nci.cabig.ccts.domain.Study studyDto, gov.nih.nci.cabig.caaers.domain.Study study, String coppaIdentifier) throws StudyCreationException, InvalidStudyException { logger.info("Populating study details.."); study.setShortTitle(studyDto.getShortTitleText()); study.setDataEntryStatus(false); //Commented below lines due to deprecated study fields. //study.setLongTitle(studyDto.getLongTitleText()); //study.setPrecis(studyDto.getPrecisText()); //study.setDescription(studyDto.getDescriptionText()); //study.setStatus(gov.nih.nci.cabig.caaers.domain.Study.STATUS_ACTIVE); //study.setAdeersReporting(Boolean.FALSE); //study.setMultiInstitutionIndicator(BooleanUtils.toBoolean(studyDto.getMultiInstitutionIndicator())); study.setPhaseCode(studyDto.getPhaseCode()); study.addStudyTherapy(StudyTherapyType.DRUG_ADMINISTRATION); study.setBlindedIndicator(BooleanUtils.toBoolean(studyDto.getBlindedIndicator())); if (coppaIdentifier != null) { study.setExternalId(coppaIdentifier); } //fixed by srini , bug Id CAAERS-1038 AeTerminology aet = createCtcV3Terminology(study); study.setAeTerminology(aet); // populate study coordinating center and study funding sponsor StudyOrganizationType[] studyOrgTypes = studyDto.getStudyOrganization(); populateStudyOrganizations(study, studyOrgTypes); // populate study identifiers IdentifierType[] identifierTypes = studyDto.getIdentifier(); populateIdentifiers(study, identifierTypes); }
From source file:edu.mayo.cts2.framework.plugin.service.lexevs.service.entity.EntityTransform.java
protected List<Designation> toDesignation(Presentation... presentations) { List<Designation> returnList = new ArrayList<Designation>(); for (Presentation presentation : presentations) { Designation designation = new Designation(); DesignationRole role;/*from w w w . ja v a 2s . c om*/ if (BooleanUtils.toBoolean(presentation.isIsPreferred())) { role = DesignationRole.PREFERRED; } else { role = DesignationRole.ALTERNATIVE; } designation.setValue(ModelUtils.toTsAnyType(presentation.getValue().getContent())); designation.setDesignationRole(role); LanguageReference lref = new LanguageReference(); lref.setContent(presentation.getLanguage()); designation.setLanguage(lref); if (presentation.getSource().length > 0) { designation.setAssertedInCodeSystemVersion(presentation.getSource()[0].getContent()); } returnList.add(designation); } return returnList; }
From source file:com.wineaccess.winerypermit.WineryPermitHelper.java
/** * @param wineryPermitPO//from w w w . j a v a2 s .co m */ private void validateWineryPermitPO(WineryPermitPO wineryPermitPO) { response = new FailureResponse(); Boolean isSellInMainStates = BooleanUtils.toBoolean(wineryPermitPO.getIsSellInMainStates()); SellInAltStatesModel isSellInAltStates = wineryPermitPO.getSellInAltStates(); if (BooleanUtils.isNotTrue(isSellInMainStates) && isSellInAltStates == null) { response.addError(new WineaccessError(SystemErrorCode.PERMIT_NO_OPTION_SELECTED_ERROR, SystemErrorCode.PERMIT_NO_OPTION_SELECTED_ERROR_TEXT)); } if (BooleanUtils.isNotTrue(isSellInMainStates) && isSellInAltStates != null && !BooleanUtils.toBoolean(isSellInAltStates.getIsSelected())) { response.addError(new WineaccessError(SystemErrorCode.PERMIT_NO_OPTION_SELECTED_ERROR, SystemErrorCode.PERMIT_NO_OPTION_SELECTED_ERROR_TEXT)); } else if (isSellInAltStates != null) { validateSellInAltModel(isSellInAltStates, wineryPermitPO.getWineryId()); } }
From source file:jp.primecloud.auto.service.impl.LoadBalancerServiceImpl.java
/** * {@inheritDoc}/* w w w . j a va 2 s . c o m*/ */ @Override public List<LoadBalancerDto> getLoadBalancers(Long farmNo) { // ? if (farmNo == null) { throw new AutoApplicationException("ECOMMON-000003", "farmNo"); } List<LoadBalancer> loadBalancers = loadBalancerDao.readByFarmNo(farmNo); // ??? List<Long> loadBalancerNos = new ArrayList<Long>(); for (LoadBalancer loadBalancer : loadBalancers) { loadBalancerNos.add(loadBalancer.getLoadBalancerNo()); } // (AWS)? List<PlatformAws> platformAwss = platformAwsDao.readAll(); Map<Long, PlatformAws> platformAwsMap = new LinkedHashMap<Long, PlatformAws>(); for (PlatformAws platformAws : platformAwss) { platformAwsMap.put(platformAws.getPlatformNo(), platformAws); } // (VMWare)? List<PlatformVmware> platformVmwares = platformVmwareDao.readAll(); Map<Long, PlatformVmware> platformVmwareMap = new LinkedHashMap<Long, PlatformVmware>(); for (PlatformVmware platformVmware : platformVmwares) { platformVmwareMap.put(platformVmware.getPlatformNo(), platformVmware); } // (Nifty)? List<PlatformNifty> platformNifties = platformNiftyDao.readAll(); Map<Long, PlatformNifty> platformNiftyMap = new LinkedHashMap<Long, PlatformNifty>(); for (PlatformNifty platformNifty : platformNifties) { platformNiftyMap.put(platformNifty.getPlatformNo(), platformNifty); } // (CloudStack)? List<PlatformCloudstack> platformCloudstacks = platformCloudstackDao.readAll(); Map<Long, PlatformCloudstack> platformCloudstackMap = new LinkedHashMap<Long, PlatformCloudstack>(); for (PlatformCloudstack platformCloudstack : platformCloudstacks) { platformCloudstackMap.put(platformCloudstack.getPlatformNo(), platformCloudstack); } // (Vcloud)? List<PlatformVcloud> platformVclouds = platformVcloudDao.readAll(); Map<Long, PlatformVcloud> platformVcloudMap = new LinkedHashMap<Long, PlatformVcloud>(); for (PlatformVcloud platformVcloud : platformVclouds) { platformVcloudMap.put(platformVcloud.getPlatformNo(), platformVcloud); } // (Azure)? List<PlatformAzure> platformAzures = platformAzureDao.readAll(); Map<Long, PlatformAzure> platformAzureMap = new LinkedHashMap<Long, PlatformAzure>(); for (PlatformAzure platformAzure : platformAzures) { platformAzureMap.put(platformAzure.getPlatformNo(), platformAzure); } // ? List<Platform> platforms = platformDao.readAll(); // PlatformDto? Map<Long, PlatformDto> platformDtoMap = new LinkedHashMap<Long, PlatformDto>(); for (Platform platform : platforms) { PlatformDto platformDto = new PlatformDto(); platformDto.setPlatform(platform); platformDto.setPlatformAws(platformAwsMap.get(platform.getPlatformNo())); platformDto.setPlatformCloudstack(platformCloudstackMap.get(platform.getPlatformNo())); platformDto.setPlatformVmware(platformVmwareMap.get(platform.getPlatformNo())); platformDto.setPlatformNifty(platformNiftyMap.get(platform.getPlatformNo())); platformDto.setPlatformVcloud(platformVcloudMap.get(platform.getPlatformNo())); platformDto.setPlatformAzure(platformAzureMap.get(platform.getPlatformNo())); platformDtoMap.put(platform.getPlatformNo(), platformDto); } // (AWS)? List<ImageAws> imageAwses = imageAwsDao.readAll(); Map<Long, ImageAws> imageAwsMap = new LinkedHashMap<Long, ImageAws>(); for (ImageAws imageAws : imageAwses) { imageAwsMap.put(imageAws.getImageNo(), imageAws); } // (Cloudstack)? List<ImageCloudstack> imageCloudstacks = imageCloudstackDao.readAll(); Map<Long, ImageCloudstack> imageCloudstackMap = new LinkedHashMap<Long, ImageCloudstack>(); for (ImageCloudstack imageCloudstack : imageCloudstacks) { imageCloudstackMap.put(imageCloudstack.getImageNo(), imageCloudstack); } // (VMWare)? List<ImageVmware> imageVmwares = imageVmwareDao.readAll(); Map<Long, ImageVmware> imageVmwareMap = new LinkedHashMap<Long, ImageVmware>(); for (ImageVmware imageVmware : imageVmwares) { imageVmwareMap.put(imageVmware.getImageNo(), imageVmware); } // (Nifty)? List<ImageNifty> imageNifties = imageNiftyDao.readAll(); Map<Long, ImageNifty> imageNiftyMap = new LinkedHashMap<Long, ImageNifty>(); for (ImageNifty imageNifty : imageNifties) { imageNiftyMap.put(imageNifty.getImageNo(), imageNifty); } // (VCloud)? List<ImageVcloud> imageVclouds = imageVcloudDao.readAll(); Map<Long, ImageVcloud> imageVcloudMap = new LinkedHashMap<Long, ImageVcloud>(); for (ImageVcloud imageVcloud : imageVclouds) { imageVcloudMap.put(imageVcloud.getImageNo(), imageVcloud); } // (Azure)? List<ImageAzure> imageAzures = imageAzureDao.readAll(); Map<Long, ImageAzure> imageAzureMap = new LinkedHashMap<Long, ImageAzure>(); for (ImageAzure imageAzure : imageAzures) { imageAzureMap.put(imageAzure.getImageNo(), imageAzure); } // ? List<Image> images = imageDao.readAll(); // ImageDto? Map<Long, ImageDto> imageDtoMap = new LinkedHashMap<Long, ImageDto>(); for (Image image : images) { ImageDto imageDto = new ImageDto(); imageDto.setImage(image); imageDto.setImageAws(imageAwsMap.get(image.getImageNo())); imageDto.setImageVmware(imageVmwareMap.get(image.getImageNo())); imageDto.setImageCloudstack(imageCloudstackMap.get(image.getImageNo())); imageDto.setImageNifty(imageNiftyMap.get(image.getImageNo())); imageDto.setImageVcloud(imageVcloudMap.get(image.getImageNo())); imageDto.setImageAzure(imageAzureMap.get(image.getImageNo())); imageDtoMap.put(image.getImageNo(), imageDto); } // AWS?? List<AwsLoadBalancer> awsLoadBalancers = awsLoadBalancerDao.readInLoadBalancerNos(loadBalancerNos); Map<Long, AwsLoadBalancer> awsLoadBalancerMap = new LinkedHashMap<Long, AwsLoadBalancer>(); for (AwsLoadBalancer awsLoadBalancer : awsLoadBalancers) { awsLoadBalancerMap.put(awsLoadBalancer.getLoadBalancerNo(), awsLoadBalancer); } // CloudStack?? List<CloudstackLoadBalancer> cloudstackLoadBalancers = cloudstackLoadBalancerDao .readInLoadBalancerNos(loadBalancerNos); Map<Long, CloudstackLoadBalancer> cloudstackLoadBalancerMap = new LinkedHashMap<Long, CloudstackLoadBalancer>(); for (CloudstackLoadBalancer cloudstackLoadBalancer : cloudstackLoadBalancers) { cloudstackLoadBalancerMap.put(cloudstackLoadBalancer.getLoadBalancerNo(), cloudstackLoadBalancer); } // ???? List<ComponentLoadBalancer> componentLoadBalancers = componentLoadBalancerDao .readInLoadBalancerNos(loadBalancerNos); Map<Long, ComponentLoadBalancer> componentLoadBalancerMap = new LinkedHashMap<Long, ComponentLoadBalancer>(); for (ComponentLoadBalancer componentLoadBalancer : componentLoadBalancers) { componentLoadBalancerMap.put(componentLoadBalancer.getLoadBalancerNo(), componentLoadBalancer); } // ? List<LoadBalancerListener> allListeners = loadBalancerListenerDao.readInLoadBalancerNos(loadBalancerNos); Map<Long, List<LoadBalancerListener>> listenersMap = new LinkedHashMap<Long, List<LoadBalancerListener>>(); for (LoadBalancerListener listener : allListeners) { List<LoadBalancerListener> listeners = listenersMap.get(listener.getLoadBalancerNo()); if (listeners == null) { listeners = new ArrayList<LoadBalancerListener>(); listenersMap.put(listener.getLoadBalancerNo(), listeners); } listeners.add(listener); } // ?? List<LoadBalancerHealthCheck> allHealthChecks = loadBalancerHealthCheckDao .readInLoadBalancerNos(loadBalancerNos); Map<Long, LoadBalancerHealthCheck> healthCheckMap = new LinkedHashMap<Long, LoadBalancerHealthCheck>(); for (LoadBalancerHealthCheck healthCheck : allHealthChecks) { healthCheckMap.put(healthCheck.getLoadBalancerNo(), healthCheck); } // ? List<AutoScalingConf> autoScalingConfs = autoScalingConfDao.readInLoadBalancerNos(loadBalancerNos); Map<Long, AutoScalingConf> autoScalingConfMap = new LinkedHashMap<Long, AutoScalingConf>(); for (AutoScalingConf autoScalingConf : autoScalingConfs) { autoScalingConfMap.put(autoScalingConf.getLoadBalancerNo(), autoScalingConf); } // ?? List<LoadBalancerInstance> allLbInstances = loadBalancerInstanceDao.readInLoadBalancerNos(loadBalancerNos); Map<Long, List<LoadBalancerInstance>> lbInstancesMap = new LinkedHashMap<Long, List<LoadBalancerInstance>>(); for (LoadBalancerInstance lbInstance : allLbInstances) { List<LoadBalancerInstance> lbInstances = lbInstancesMap.get(lbInstance.getLoadBalancerNo()); if (lbInstances == null) { lbInstances = new ArrayList<LoadBalancerInstance>(); lbInstancesMap.put(lbInstance.getLoadBalancerNo(), lbInstances); } lbInstances.add(lbInstance); } // ? Set<Long> targetInstanceNos = new HashSet<Long>(); for (LoadBalancerInstance lbInstance : allLbInstances) { targetInstanceNos.add(lbInstance.getInstanceNo()); } List<Instance> targetInstances = instanceDao.readInInstanceNos(targetInstanceNos); Map<Long, Instance> targetInstanceMap = new HashMap<Long, Instance>(); for (Instance targetInstance : targetInstances) { targetInstanceMap.put(targetInstance.getInstanceNo(), targetInstance); } List<LoadBalancerDto> dtos = new ArrayList<LoadBalancerDto>(); for (LoadBalancer loadBalancer : loadBalancers) { Long loadBalancerNo = loadBalancer.getLoadBalancerNo(); AwsLoadBalancer awsLoadBalancer = awsLoadBalancerMap.get(loadBalancerNo); CloudstackLoadBalancer cloudstackLoadBalancer = cloudstackLoadBalancerMap.get(loadBalancerNo); ComponentLoadBalancer componentLoadBalancer = componentLoadBalancerMap .get(loadBalancer.getLoadBalancerNo()); List<LoadBalancerListener> listeners = listenersMap.get(loadBalancerNo); if (listeners == null) { listeners = new ArrayList<LoadBalancerListener>(); } LoadBalancerHealthCheck healthCheck = healthCheckMap.get(loadBalancerNo); AutoScalingConfDto autoScalingConfDto = null; if (BooleanUtils.toBoolean(Config.getProperty("autoScaling.useAutoScaling"))) { autoScalingConfDto = new AutoScalingConfDto(); AutoScalingConf autoScalingConf = autoScalingConfMap.get(loadBalancerNo); autoScalingConfDto.setAutoScalingConf(autoScalingConf); autoScalingConfDto.setPlatform(platformDtoMap.get(autoScalingConf.getPlatformNo())); autoScalingConfDto.setImage(imageDtoMap.get(autoScalingConf.getImageNo())); } List<LoadBalancerInstance> lbInstances = lbInstancesMap.get(loadBalancerNo); if (lbInstances == null) { lbInstances = new ArrayList<LoadBalancerInstance>(); } // ?????? ComponentLoadBalancerDto componentLoadBalancerDto = null; if (componentLoadBalancer != null) { Component component = componentDao.read(componentLoadBalancer.getComponentNo()); List<Long> instanceNos = new ArrayList<Long>(); List<ComponentInstance> componentInstances = componentInstanceDao .readByComponentNo(componentLoadBalancer.getComponentNo()); for (ComponentInstance componentInstance : componentInstances) { instanceNos.add(componentInstance.getInstanceNo()); } List<Instance> instances = instanceDao.readInInstanceNos(instanceNos); // IP String ipAddress = null; if (!instances.isEmpty()) { Boolean showPublicIp = BooleanUtils.toBooleanObject(Config.getProperty("ui.showPublicIp")); if (BooleanUtils.isTrue(showPublicIp)) { //ui.showPublicIp = true ???URL?PublicIp ipAddress = instances.get(0).getPublicIp(); } else { //ui.showPublicIp = false ???URL?PrivateIp ipAddress = instances.get(0).getPrivateIp(); } } componentLoadBalancerDto = new ComponentLoadBalancerDto(); componentLoadBalancerDto.setComponentLoadBalancer(componentLoadBalancer); componentLoadBalancerDto.setComponent(component); componentLoadBalancerDto.setInstances(instances); componentLoadBalancerDto.setIpAddress(ipAddress); } // Collections.sort(listeners, Comparators.COMPARATOR_LOAD_BALANCER_LISTENER); Collections.sort(lbInstances, Comparators.COMPARATOR_LOAD_BALANCER_INSTANCE); // TODO: ???????????????? // ?? LoadBalancerStatus status = LoadBalancerStatus.fromStatus(loadBalancer.getStatus()); if (BooleanUtils.isTrue(loadBalancer.getEnabled())) { if (status == LoadBalancerStatus.STOPPED) { status = LoadBalancerStatus.STARTING; } else if (status == LoadBalancerStatus.RUNNING && BooleanUtils.isTrue(loadBalancer.getConfigure())) { status = LoadBalancerStatus.CONFIGURING; } } else { if (status == LoadBalancerStatus.RUNNING || status == LoadBalancerStatus.WARNING) { status = LoadBalancerStatus.STOPPING; } } loadBalancer.setStatus(status.toString()); // ? for (LoadBalancerListener listener : listeners) { LoadBalancerListenerStatus status2 = LoadBalancerListenerStatus.fromStatus(listener.getStatus()); if (BooleanUtils.isTrue(loadBalancer.getEnabled()) && BooleanUtils.isTrue(listener.getEnabled())) { if (status2 == LoadBalancerListenerStatus.STOPPED) { status2 = LoadBalancerListenerStatus.STARTING; } else if (status2 == LoadBalancerListenerStatus.RUNNING && BooleanUtils.isTrue(listener.getConfigure())) { status2 = LoadBalancerListenerStatus.CONFIGURING; } } else { if (status2 == LoadBalancerListenerStatus.RUNNING || status2 == LoadBalancerListenerStatus.WARNING) { status2 = LoadBalancerListenerStatus.STOPPING; } } listener.setStatus(status2.toString()); } LoadBalancerDto dto = new LoadBalancerDto(); dto.setLoadBalancer(loadBalancer); dto.setPlatform(platformDtoMap.get(loadBalancer.getPlatformNo())); dto.setAwsLoadBalancer(awsLoadBalancer); dto.setCloudstackLoadBalancer(cloudstackLoadBalancer); dto.setComponentLoadBalancerDto(componentLoadBalancerDto); dto.setLoadBalancerListeners(listeners); dto.setLoadBalancerHealthCheck(healthCheck); dto.setLoadBalancerInstances(lbInstances); dto.setAutoScalingConf(autoScalingConfDto); dtos.add(dto); } // Collections.sort(dtos, Comparators.COMPARATOR_LOAD_BALANCER_DTO); return dtos; }
From source file:com.wineaccess.winerypermit.WineryPermitHelper.java
/** * @param sellInAltStatesModel//from ww w.j a va 2 s .co m * @param string */ private void validateSellInAltModel(SellInAltStatesModel sellInAltStatesModel, String wineryId) { Boolean isOptionSelectedKachinaAlt = BooleanUtils .toBoolean(sellInAltStatesModel.getIsOptionSelectedKachinaAlt()); OptionSelectedAltStates optionSelectedAltStates = sellInAltStatesModel.getOptionSelectedAltStates(); Boolean isOptionSelectedNoPermit = BooleanUtils .toBoolean(sellInAltStatesModel.getIsOptionSelectedNoPermit()); Boolean isSelectedAltStates = BooleanUtils.toBoolean(sellInAltStatesModel.getIsSelected()); if (BooleanUtils.isTrue(isSelectedAltStates) && BooleanUtils.isNotTrue(isOptionSelectedKachinaAlt) && optionSelectedAltStates == null && BooleanUtils.isNotTrue(isOptionSelectedNoPermit)) { response.addError(new WineaccessError(SystemErrorCode.PERMIT_NO_OPTION_SELECTED_WINERY_LICENCES_ERROR, SystemErrorCode.PERMIT_NO_OPTION_SELECTED_WINERY_LICENCES_ERROR_TEXT)); } else if ((BooleanUtils.isTrue(isOptionSelectedKachinaAlt) && optionSelectedAltStates != null) || BooleanUtils.isTrue(isOptionSelectedKachinaAlt) && BooleanUtils.isTrue(isOptionSelectedNoPermit) || BooleanUtils.isTrue(isOptionSelectedNoPermit) && optionSelectedAltStates != null) { response.addError(new WineaccessError(SystemErrorCode.PERMIT_MORE_THAN_ONE_OPTION_SELECTED_ERROR, SystemErrorCode.PERMIT_MORE_THAN_ONE_OPTION_SELECTED_ERROR_TEXT)); } else { if (optionSelectedAltStates != null) { validateoptionSelectedAltstates(optionSelectedAltStates, wineryId); } } }