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:jp.primecloud.auto.ui.WinServerEdit.java
WinServerEdit(Application ap, Long instanceNo) { apl = ap;// ww w . ja va2 s . co m this.instanceNo = instanceNo; // ??? initData(); // setCaption(ViewProperties.getCaption("window.winServerEdit")); setModal(true); setWidth("600px"); setIcon(Icons.EDITMINI.resource()); VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(false, true, false, true); layout.setSpacing(true); //Tab? basicTab = new BasicTab(); tab.addTab(basicTab, ViewProperties.getCaption("tab.basic"), Icons.BASIC.resource()); layout.addComponent(tab); // ?? basicTab.initValidation(); // ? basicTab.showData(); //Tab? String platformType = platformDto.getPlatform().getPlatformType(); // TODO CLOUD BRANCHING if (PCCConstant.PLATFORM_TYPE_AWS.equals(platformType)) { awsDetailTab = new AWSDetailTab(); tab.addTab(awsDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); layout.addComponent(tab); // ?? awsDetailTab.initValidation(); // ? awsDetailTab.showData(); } else if (PCCConstant.PLATFORM_TYPE_VMWARE.equals(platformType)) { vmwareDetailTab = new VMWareDetailTab(); tab.addTab(vmwareDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); // ?? vmwareDetailTab.initValidation(); // ? vmwareDetailTab.showData(); boolean enableVmwareStaticIp = BooleanUtils.toBoolean(Config.getProperty("ui.enableVmwareEditIp")); if (BooleanUtils.isTrue(enableVmwareStaticIp)) { this.vmwareEditIpTab = new VmwareEditIpTab(); tab.addTab(vmwareEditIpTab, ViewProperties.getCaption("tab.editIp"), Icons.DETAIL.resource()); this.vmwareEditIpTab.showData(); this.vmwareEditIpTab.initValidation(); } layout.addComponent(tab); } else if (PCCConstant.PLATFORM_TYPE_NIFTY.equals(platformType)) { niftyDetailTab = new NiftyDetailTab(); tab.addTab(niftyDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); layout.addComponent(tab); // ?? niftyDetailTab.initValidation(); // ? niftyDetailTab.showData(); } else if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platformType)) { cloudStackDetailTab = new CloudStackDetailTab(); tab.addTab(cloudStackDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); layout.addComponent(tab); // ?? cloudStackDetailTab.initValidation(); // ? cloudStackDetailTab.showData(); } else if (PCCConstant.PLATFORM_TYPE_VCLOUD.equals(platformType)) { // vcloudDetailTab = new VcloudDetailTab(); tab.addTab(vcloudDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); // ?? vcloudDetailTab.initValidation(); // ? vcloudDetailTab.showData(); //? vcloudNetworkTab = new VcloudNetworkTab(); tab.addTab(vcloudNetworkTab, ViewProperties.getCaption("tab.network"), Icons.DETAIL.resource()); vcloudNetworkTab.showData(); layout.addComponent(tab); } else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platformType)) { azureDetailTab = new AzureDetailTab(); tab.addTab(azureDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); layout.addComponent(tab); // ?? azureDetailTab.initValidation(); // ? azureDetailTab.showData(); } else if (PCCConstant.PLATFORM_TYPE_OPENSTACK.equals(platformType)) { openStackDetailTab = new OpenStackDetailTab(); tab.addTab(openStackDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource()); layout.addComponent(tab); // ?? openStackDetailTab.initValidation(); // ? openStackDetailTab.showData(); } // tab.addTab(new UserTab(), "", new ThemeResource("icons/user.png")); // layout.addComponent(tab); // ?? HorizontalLayout okbar = new HorizontalLayout(); okbar.setSpacing(true); okbar.setMargin(false, false, true, false); layout.addComponent(okbar); layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT); // OK Button okButton = new Button(ViewProperties.getCaption("button.ok")); okButton.setDescription(ViewProperties.getCaption("description.editServer.ok")); okButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { okButtonClick(event); } }); okbar.addComponent(okButton); // [Enter]?okButton okButton.setClickShortcut(KeyCode.ENTER); okButton.focus(); Button cancelButton = new Button(ViewProperties.getCaption("button.cancel")); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); okbar.addComponent(cancelButton); }
From source file:com.bstek.dorado.core.pkgs.PackageManager.java
private static void doBuildPackageInfos() throws Exception { Map<String, PackageInfo> packageMap = new HashMap<String, PackageInfo>(); Enumeration<URL> defaultContextFileResources = org.springframework.util.ClassUtils.getDefaultClassLoader() .getResources(PACKAGE_PROPERTIES_LOCATION); while (defaultContextFileResources.hasMoreElements()) { URL url = defaultContextFileResources.nextElement(); InputStream in = null;/*from w w w . j ava 2s.c o m*/ try { URLConnection con = url.openConnection(); con.setUseCaches(false); in = con.getInputStream(); Properties properties = new Properties(); properties.load(in); String packageName = properties.getProperty("name"); if (StringUtils.isEmpty(packageName)) { throw new IllegalArgumentException("Package name undefined."); } PackageInfo packageInfo = new PackageInfo(packageName); packageInfo.setAddonVersion(properties.getProperty("addonVersion")); packageInfo.setVersion(properties.getProperty("version")); String dependsText = properties.getProperty("depends"); if (StringUtils.isNotBlank(dependsText)) { List<Dependence> dependences = new ArrayList<Dependence>(); for (String depends : StringUtils.split(dependsText, "; ")) { if (StringUtils.isNotEmpty(depends)) { Dependence dependence = parseDependence(depends); dependences.add(dependence); } } if (!dependences.isEmpty()) { packageInfo.setDepends(dependences.toArray(new Dependence[0])); } } String license = StringUtils.trim(properties.getProperty("license")); if (StringUtils.isNotEmpty(license)) { if (INHERITED.equals(license)) { packageInfo.setLicense(LICENSE_INHERITED); } else { String[] licenses = StringUtils.split(license); licenses = StringUtils.stripAll(licenses); packageInfo.setLicense(licenses); } } packageInfo.setLoadUnlicensed(BooleanUtils.toBoolean(properties.getProperty("loadUnlicensed"))); packageInfo.setClassifier(properties.getProperty("classifier")); packageInfo.setHomePage(properties.getProperty("homePage")); packageInfo.setDescription(properties.getProperty("description")); packageInfo.setPropertiesLocations(properties.getProperty("propertiesConfigLocations")); packageInfo.setContextLocations(properties.getProperty("contextConfigLocations")); packageInfo.setComponentLocations(properties.getProperty("componentConfigLocations")); packageInfo.setServletContextLocations(properties.getProperty("servletContextConfigLocations")); String configurerClass = properties.getProperty("configurer"); if (StringUtils.isNotBlank(configurerClass)) { Class<?> type = ClassUtils.forName(configurerClass); packageInfo.setConfigurer((PackageConfigurer) type.newInstance()); } String listenerClass = properties.getProperty("listener"); if (StringUtils.isNotBlank(listenerClass)) { Class<?> type = ClassUtils.forName(listenerClass); packageInfo.setListener((PackageListener) type.newInstance()); } String servletContextListenerClass = properties.getProperty("servletContextListener"); if (StringUtils.isNotBlank(servletContextListenerClass)) { Class<?> type = ClassUtils.forName(servletContextListenerClass); packageInfo.setServletContextListener((ServletContextListener) type.newInstance()); } if (packageMap.containsKey(packageName)) { PackageInfo conflictPackageInfo = packageMap.get(packageName); StringBuffer conflictInfo = new StringBuffer(20); conflictInfo.append('[').append(conflictPackageInfo.getName()).append(" - ") .append(conflictPackageInfo.getVersion()).append(']'); conflictInfo.append(" and "); conflictInfo.append('[').append(packageInfo.getName()).append(" - ") .append(packageInfo.getVersion()).append(']'); Exception e = new IllegalArgumentException("More than one package \"" + packageName + "\" found. They are " + conflictInfo.toString()); logger.warn(e, e); } packageMap.put(packageName, packageInfo); } catch (Exception e) { throw new IllegalArgumentException("Error occured during parsing \"" + url.getPath() + "\".", e); } finally { if (in != null) { in.close(); } } } List<PackageInfo> calculatedPackages = new ArrayList<PackageInfo>(); for (PackageInfo packageInfo : packageMap.values()) { calculateDepends(packageInfo, calculatedPackages, packageMap); } packageInfosMap.clear(); for (PackageInfo packageInfo : calculatedPackages) { packageInfosMap.put(packageInfo.getName(), packageInfo); } }
From source file:com.cloud.user.DomainManagerImpl.java
@Override public boolean deleteDomain(DomainVO domain, Boolean cleanup) { GlobalLock lock = getGlobalLock("AccountCleanup"); if (lock == null) { s_logger.debug("Couldn't get the global lock"); return false; }/*from w w w. j a va 2 s . c o m*/ if (!lock.lock(30)) { s_logger.debug("Couldn't lock the db"); return false; } try { // mark domain as inactive s_logger.debug("Marking domain id=" + domain.getId() + " as " + Domain.State.Inactive + " before actually deleting it"); domain.setState(Domain.State.Inactive); _domainDao.update(domain.getId(), domain); try { long ownerId = domain.getAccountId(); if (BooleanUtils.toBoolean(cleanup)) { tryCleanupDomain(domain, ownerId); } else { removeDomainWithNoAccountsForCleanupNetworksOrDedicatedResources(domain); } cleanupDomainOfferings(domain.getId()); CallContext.current().putContextParameter(Domain.class, domain.getUuid()); return true; } catch (Exception ex) { s_logger.error("Exception deleting domain with id " + domain.getId(), ex); if (ex instanceof CloudRuntimeException) { rollbackDomainState(domain); throw (CloudRuntimeException) ex; } else return false; } } finally { lock.unlock(); } }
From source file:edu.mayo.cts2.framework.plugin.service.bioportal.identity.IdentityConverter.java
/** * Cache name and id by virtual id.// w w w .java 2s .co m * * @param virtualId the virtual id */ private void cacheNameAndIdByVirtualId(String virtualId) { try { String xml = this.bioportalRestService.getLatestOntologyVersionByVirtualId(virtualId); Document doc = BioportalRestUtils.getDocument(xml); Node node = TransformUtils.getNamedChildWithPath(doc, "success.data.ontologyBean"); String name = buildName(node); String ontologyId = TransformUtils.getNamedChildText(node, ONTOLOGY_ID); if (BooleanUtils.toBoolean(TransformUtils.getNamedChildText(node, IS_VIEW))) { this.valueSetNameToOntologyId.put(name, ontologyId); this.ontologyIdToValueSetName.put(ontologyId, name); } else { this.codeSystemNameToOntologyId.put(name, ontologyId); this.ontologyIdToCodeSystemName.put(ontologyId, name); } } catch (Exception e) { throw new Cts2RuntimeException(e); } }
From source file:com.tesora.dve.sql.transform.UpdateTransformTest.java
@Test public void testTimestampVariable() throws Throwable { int i = 0;// www . ja va2 s .c o m for (Object[] objects : TimestampVariableTestUtils.getTestValues()) { String value = (String) objects[0]; Boolean nullable = BooleanUtils.toBoolean((Integer) objects[1]); String defaultValue = (String) objects[2]; Boolean onUpdate = BooleanUtils.toBoolean((Integer) objects[3]); Boolean expectedInsertTSVarSet = BooleanUtils.toBoolean((Integer) objects[4]); Boolean expectedUpdateTSVarSet = BooleanUtils.toBoolean((Integer) objects[5]); String tableName = "ts" + i; String testDesc = "testTimestampVariable for table " + tableName; String createTableSQL = TimestampVariableTestUtils.buildCreateTableSQL(tableName, nullable, defaultValue, onUpdate); String insertSQL = TimestampVariableTestUtils.buildInsertTestSQL(tableName, value, 1, Integer.toString(i)); String updateSQL = TimestampVariableTestUtils.buildUpdateTestSQL(tableName, value, 1, Integer.toString(i) + Integer.toString(i)); if (isNoisy()) { SchemaTest.echo(createTableSQL); System.out.println(Functional.joinToString(Arrays.asList(objects), ", ")); } SchemaContext dbSingle = buildSchema(TestName.SINGLE, createTableSQL); tsVarSetTest(dbSingle, insertSQL, InsertIntoValuesStatement.class, expectedInsertTSVarSet, testDesc); tsVarSetTest(dbSingle, updateSQL, UpdateStatement.class, expectedUpdateTSVarSet, testDesc); SchemaContext dbMulti = buildSchema(TestName.MULTI, createTableSQL); tsVarSetTest(dbMulti, insertSQL, InsertIntoValuesStatement.class, expectedInsertTSVarSet, testDesc); tsVarSetTest(dbMulti, updateSQL, UpdateStatement.class, expectedUpdateTSVarSet, testDesc); ++i; } }
From source file:fr.paris.lutece.plugins.directory.modules.gismap.business.RecordsResource.java
/** Retrieve a gismap view property as a boolean value * /*www . java2s . com*/ * @param strViewNumberValue */ private static boolean getViewPropertyAsBoolean(String strPropertyName, String strViewNumberValue) { String strPropertyValue = AppPropertiesService .getProperty(GISMAP_VIEW + strViewNumberValue + PARAMETER + strPropertyName); if (StringUtils.isEmpty(strPropertyValue)) { strPropertyValue = Boolean.FALSE.toString(); AppLogService.info("Could not found the " + GISMAP_VIEW + strViewNumberValue + PARAMETER + strPropertyValue + " property in the property file. Set to " + Boolean.FALSE.toString()); } return BooleanUtils.toBoolean(strPropertyValue); }
From source file:com.haulmont.cuba.web.sys.LinkHandler.java
protected Map<String, Object> getParamsMap(Map<String, String> requestParams) { Map<String, Object> params = new HashMap<>(); String paramsStr = requestParams.get("params"); if (paramsStr == null) return params; String[] entries = paramsStr.split(","); for (String entry : entries) { String[] parts = entry.split(":"); if (parts.length != 2) { log.warn("Invalid parameter: {}", entry); return params; }/* www . j av a 2 s. c o m*/ String name = parts[0]; String value = parts[1]; EntityLoadInfo info = EntityLoadInfo.parse(value); if (info != null) { Entity entity = loadEntityInstance(info); if (entity != null) params.put(name, entity); } else if (Boolean.TRUE.toString().equals(value) || Boolean.FALSE.toString().equals(value)) { params.put(name, BooleanUtils.toBoolean(value)); } else { params.put(name, value); } } return params; }
From source file:com.wineaccess.winepermit.WinePermitHelper.java
/** * @param winePermitPO/*from www . j a v a 2s . co m*/ * @param wineModel * @return * @throws Exception */ private static boolean populateAndSaveDOFromPO(WinePermitPO winePermitPO, WineModel wineModel) throws PersistenceException { boolean isSussess = false; try { wineModel.setSellInMainStates(BooleanUtils.toBoolean(winePermitPO.getIsSellInMainStates())); SellInAltStatesModel sellInAltStatesModel = winePermitPO.getSellInAltStates(); if (winePermitPO.getSellInAltStates() != null && BooleanUtils.toBoolean(winePermitPO.getSellInAltStates().getIsSelected())) { wineModel.setSellInAltStates(true); if (BooleanUtils.toBoolean(sellInAltStatesModel.getIsOptionSelectedKachinaAlt())) { wineModel.setOptionSelectedAltstates( EnumTypes.OptionSelectedAltStatesEnum.KACHINA_ALT.getOptionSelectedaltStates()); } if (sellInAltStatesModel.getOptionSelectedAltStates() != null) { wineModel.setOptionSelectedAltstates(EnumTypes.OptionSelectedAltStatesEnum.PERMIT_FOR_ALT_STATES .getOptionSelectedaltStates()); OptionSelectedAltStates optionSelectedAltStates = sellInAltStatesModel .getOptionSelectedAltStates(); if (StringUtils.isNotBlank(optionSelectedAltStates.getMappedWineryId())) { WineryModel mappedWineryWithPermit = WineryRepository .getWineryById(Long.valueOf(optionSelectedAltStates.getMappedWineryId())); if (mappedWineryWithPermit != null) { wineModel.setMappedWineryWithPermit(mappedWineryWithPermit.getId()); } } List<PermitModel> permitModelList = optionSelectedAltStates.getPermit(); if (permitModelList != null && !permitModelList.isEmpty()) { Map<Long, Long> permitIdsMap = new ConcurrentHashMap<Long, Long>(); List<Object[]> permitIdsList = WinePermitRepository .findWinePermitIdByWineId(wineModel.getId()); for (Object[] ids : permitIdsList) { permitIdsMap.put((Long) ids[0], (Long) ids[1]); } for (PermitModel permitModel : permitModelList) { Long masterDataId = Long.valueOf(permitModel.getMasterDataId()); /*if(BooleanUtils.toBoolean(permitModel.getIsSelected())){*/ WineLicensePermitAltStates wineLicensePermitAltStates = new WineLicensePermitAltStates(); wineLicensePermitAltStates .setIsSelected(BooleanUtils.toBoolean(permitModel.getIsSelected())); if (!StringUtils.isEmpty(permitModel.getPermitDurationInMonths())) wineLicensePermitAltStates.setDtcPermitDurationInMonths( Integer.valueOf(permitModel.getPermitDurationInMonths())); if (!StringUtils.isEmpty(permitModel.getDtcPermitNumber())) wineLicensePermitAltStates.setDtcPermitNumber(permitModel.getDtcPermitNumber()); wineLicensePermitAltStates.setDtcPermitStartDate(permitModel.getDtcPermitStartDate()); wineLicensePermitAltStates.setDtcPermitEndDate(permitModel.getDtcPermitEndDate()); /* }*/ wineLicensePermitAltStates .setWineryPermit(MasterDataRepository.getMasterDataById(masterDataId)); wineLicensePermitAltStates.setWineId(wineModel); wineLicensePermitAltStates.setId(permitIdsMap.get(masterDataId)); WinePermitRepository.saveWineLicensePermitAltStates(wineLicensePermitAltStates); } FulFillModel fulFilModel = optionSelectedAltStates.getFulfill(); WineLicenseFullfillAltStates wineLicenseFullfillAltStates = new WineLicenseFullfillAltStates(); WineLicenseFullfillAltStates permitModelFromDB = WinePermitRepository .findFulfilModelByWineId(wineModel.getId()); if (permitModelFromDB != null) { wineLicenseFullfillAltStates.setId(permitModelFromDB.getId()); } if (fulFilModel != null) { /*if(BooleanUtils.toBoolean(fulFilModel.getIsSelected())){*/ wineLicenseFullfillAltStates .setIsSelected(BooleanUtils.toBoolean(fulFilModel.getIsSelected())); wineLicenseFullfillAltStates .setEscrowContract(BooleanUtils.toBoolean(fulFilModel.getEscrowContract())); wineLicenseFullfillAltStates.setWaPlatformContract( BooleanUtils.toBoolean(fulFilModel.getWaPlatformContract())); wineLicenseFullfillAltStates.setWineryStorageContract( BooleanUtils.toBoolean(fulFilModel.getIsStorageContact())); wineLicenseFullfillAltStates.setWaWillNotFullFill(false); /*}*/ wineLicenseFullfillAltStates.setWineId(wineModel); WinePermitRepository.saveWineFulfilModel(wineLicenseFullfillAltStates); } else if (fulFilModel == null && BooleanUtils.toBoolean(optionSelectedAltStates.getFulfillDirectlyNotWA())) { wineLicenseFullfillAltStates.setWaWillNotFullFill(true); //wineryLicenseFullfillAltStates.setWineryId(wineryModel); WinePermitRepository.saveWineFulfilModel(wineLicenseFullfillAltStates); } } } if (sellInAltStatesModel.getOptionSelectedAltStates() == null) { OptionSelectedAltStates optionSelectedAltStates = new OptionSelectedAltStates(); if (!BooleanUtils.toBoolean(sellInAltStatesModel.getIsOptionSelectedKachinaAlt())) wineModel.setOptionSelectedAltstates( EnumTypes.OptionSelectedAltStatesEnum.NO_PERMIT_FOR_ALT_STATES .getOptionSelectedaltStates()); List<Object[]> permitIdsList = WinePermitRepository.findWinePermitIdByWineId(wineModel.getId()); for (Object[] ids : permitIdsList) { WineLicensePermitAltStates wineLicensePermitAltStates = new WineLicensePermitAltStates(); wineLicensePermitAltStates.setId((Long) ids[1]); wineLicensePermitAltStates.setWineId(wineModel); wineLicensePermitAltStates .setWineryPermit(MasterDataRepository.getMasterDataById((Long) ids[0])); WinePermitRepository.saveWineLicensePermitAltStates(wineLicensePermitAltStates); } WineLicenseFullfillAltStates wineLicenseFullfillAltStates = new WineLicenseFullfillAltStates(); WineLicenseFullfillAltStates permitModelFromDB = WinePermitRepository .findFulfilModelByWineId(wineModel.getId()); if (permitModelFromDB != null) { wineLicenseFullfillAltStates.setId(permitModelFromDB.getId()); } wineLicenseFullfillAltStates.setWineId(wineModel); WinePermitRepository.saveWineFulfilModel(wineLicenseFullfillAltStates); populateNoPermitData(winePermitPO, wineModel); } } else wineModel.setSellInAltStates(false); WineRepository.update(wineModel); isSussess = true; } catch (Exception e) { logger.error("some problem occured" + e); throw new PersistenceException(e); } return isSussess; }
From source file:com.actian.services.dataflow.operators.RunJSONPath.java
public static Boolean[] StringArray2BooleanArray(String[] strings) { List<Boolean> booleans = new ArrayList<Boolean>(); if (strings != null) { for (String s : strings) { booleans.add(BooleanUtils.toBoolean(s)); }/* ww w.j a v a2 s. c om*/ } Boolean[] result = new Boolean[booleans.size()]; return booleans.toArray(result); }
From source file:gr.abiss.calipso.domain.Metadata.java
@SuppressWarnings("unchecked") public void setXmlString(String xmlString) { //init();//ww w . j av a 2s.c om //logger.info("setXmlString: "+xmlString); if (xmlString == null) { return; } Document document = XmlUtils.parse(xmlString); // date formats for (Element e : (List<Element>) document.selectNodes(DATEFORMATS_XPATH)) { String dfKey = e.attribute(NAME).getValue(); String dfExpression = e.attribute(EXPRESSION).getValue(); this.dateFormats.put(dfKey, dfExpression); } // field groups fieldGroups.clear(); for (Element e : (List<Element>) document.selectNodes(FIELD_GROUP_XPATH)) { FieldGroup fieldGroup = new FieldGroup(e); fieldGroups.add(fieldGroup); fieldGroupsById.put(fieldGroup.getId(), fieldGroup); } if (fieldGroups.isEmpty()) { addDefaultFieldGroup(); } // sort by priority TreeSet<FieldGroup> fieldGroupSet = new TreeSet<FieldGroup>(); fieldGroupSet.addAll(fieldGroups); fieldGroups.clear(); fieldGroups.addAll(fieldGroupSet); if (logger.isDebugEnabled()) logger.debug("Loaded fieldGroups:" + fieldGroups); for (Element e : (List<Element>) document.selectNodes(FIELD_XPATH)) { Field field = new Field(e); fields.put(field.getName(), field); fieldsByLabel.put(field.getLabel(), field); // link to full field group object or // of default if none is set //logger.info("field name: "+field.getName().getText()+", group id: "+field.getGroupId()+", group: "+fieldGroupsById.get(field.getGroupId()).getName()); if (field.getGroupId() != null) { FieldGroup fieldGroup = fieldGroupsById.get(field.getGroupId()); if (fieldGroup == null) { logger.warn("Field belongs to undefined field-group element with id: " + field.getGroupId() + ", adding to default group"); fieldGroup = fieldGroupsById.get("default"); } else { fieldGroup.addField(field); } } else { // add field to default group if it does not // belong to any FieldGroup defaultFieldGroup = fieldGroups.get(0); field.setGroup(defaultFieldGroup); defaultFieldGroup.addField(field); } } for (Element e : (List<Element>) document.selectNodes(ROLE_XPATH)) { Role role = new Role(e); roles.put(role.getName(), role); } for (Element e : (List<Element>) document.selectNodes(STATE_XPATH)) { String key = e.attributeValue(STATUS); String value = e.attributeValue(LABEL); states.put(Integer.parseInt(key), value); statesByName.put(value, Integer.parseInt(key)); statesPlugins.put(Integer.parseInt(key), e.attributeValue(PLUGIN)); String sDurations = e.attributeValue(MAX_DURATION); if (StringUtils.isNotBlank(sDurations)) { maxDurations.put(Integer.parseInt(key), NumberUtils.createLong(sDurations)); } String asTypeId = e.attributeValue(ASSET_TYPE_ID); if (StringUtils.isNotBlank(asTypeId)) { assetTypeIdMap.put(Integer.parseInt(key), NumberUtils.createLong(asTypeId)); } String existingAssetTypeId = e.attributeValue(EXISTING_ASSET_TYPE_ID); if (StringUtils.isNotBlank(existingAssetTypeId)) { existingAssetTypeIdsMap.put(Integer.parseInt(key), NumberUtils.createLong(existingAssetTypeId)); } String existingAssetTypeMultiple = e.attributeValue(EXISTING_ASSET_TYPE_MULTIPLE); if (StringUtils.isNotBlank(existingAssetTypeMultiple)) { existingAssetTypeMultipleMap.put(Integer.parseInt(key), BooleanUtils.toBoolean(existingAssetTypeMultiple)); } } fieldOrder.clear(); for (Element e : (List<Element>) document.selectNodes(FIELD_ORDER_XPATH)) { String fieldName = e.attributeValue(NAME); fieldOrder.add(Field.convertToName(fieldName)); } }