org.apache.commons.lang3.StringUtils Java Examples
The following examples show how to use
org.apache.commons.lang3.StringUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SonosService.java From airsonic-advanced with GNU General Public License v3.0 | 11 votes |
protected SortedSet<Integer> parsePlaylistIndices(String indices) { // Comma-separated, may include ranges: 1,2,4-7 SortedSet<Integer> result = new TreeSet<Integer>(); for (String part : StringUtils.split(indices, ',')) { if (StringUtils.isNumeric(part)) { result.add(Integer.parseInt(part)); } else { int dashIndex = part.indexOf('-'); int from = Integer.parseInt(part.substring(0, dashIndex)); int to = Integer.parseInt(part.substring(dashIndex + 1)); for (int i = from; i <= to; i++) { result.add(i); } } } return result; }
Example #2
Source File: TestFullRestore.java From hbase with Apache License 2.0 | 7 votes |
/** * Verify that multiple tables are restored to new tables. * * @throws Exception if doing the backup, restoring it or an operation on the tables fails */ @Test public void testFullRestoreMultipleCommand() throws Exception { LOG.info("create full backup image on multiple tables: command-line"); List<TableName> tables = Lists.newArrayList(table2, table3); String backupId = fullTableBackup(tables); assertTrue(checkSucceeded(backupId)); TableName[] restore_tableset = new TableName[] { table2, table3 }; TableName[] tablemap = new TableName[] { table2_restore, table3_restore }; // restore <backup_root_path> <backup_id> <tables> [tableMapping] String[] args = new String[] { BACKUP_ROOT_DIR, backupId, "-t", StringUtils.join(restore_tableset, ","), "-m", StringUtils.join(tablemap, ",") }; // Run backup int ret = ToolRunner.run(conf1, new RestoreDriver(), args); assertTrue(ret == 0); Admin hba = TEST_UTIL.getAdmin(); assertTrue(hba.tableExists(table2_restore)); assertTrue(hba.tableExists(table3_restore)); TEST_UTIL.deleteTable(table2_restore); TEST_UTIL.deleteTable(table3_restore); hba.close(); }
Example #3
Source File: StringUtilities.java From StatsAgg with Apache License 2.0 | 6 votes |
public static List<String> getListOfStringsFromDelimitedString(String newlineDelimitedString, char delimiter) { if ((newlineDelimitedString == null) || newlineDelimitedString.isEmpty()) { return new ArrayList<>(); } String[] stringArray = org.apache.commons.lang.StringUtils.split(newlineDelimitedString, delimiter); if (stringArray.length == 0) return new ArrayList<>(); List<String> stringList = new ArrayList<>(); stringList.addAll(Arrays.asList(stringArray)); return stringList; }
Example #4
Source File: HBase_1_1_2_ClientService.java From nifi with Apache License 2.0 | 6 votes |
@Override public void deleteCells(String tableName, List<DeleteRequest> deletes) throws IOException { List<Delete> deleteRequests = new ArrayList<>(); for (int index = 0; index < deletes.size(); index++) { DeleteRequest req = deletes.get(index); Delete delete = new Delete(req.getRowId()) .addColumn(req.getColumnFamily(), req.getColumnQualifier()); if (!StringUtils.isEmpty(req.getVisibilityLabel())) { delete.setCellVisibility(new CellVisibility(req.getVisibilityLabel())); } deleteRequests.add(delete); } batchDelete(tableName, deleteRequests); }
Example #5
Source File: LogicalPlanConfiguration.java From Bats with Apache License 2.0 | 6 votes |
/** * Get the application alias name for an application class if one is available. * The path for the application class is specified as a parameter. If an alias was specified * in the configuration file or configuration opProps for the application class it is returned * otherwise null is returned. * * @param appPath The path of the application class in the jar * @return The alias name if one is available, null otherwise */ public String getAppAlias(String appPath) { String appAlias; if (appPath.endsWith(CLASS_SUFFIX)) { appPath = appPath.replace("/", KEY_SEPARATOR).substring(0, appPath.length() - CLASS_SUFFIX.length()); } appAlias = stramConf.appAliases.get(appPath); if (appAlias == null) { try { ApplicationAnnotation an = Thread.currentThread().getContextClassLoader().loadClass(appPath).getAnnotation(ApplicationAnnotation.class); if (an != null && StringUtils.isNotBlank(an.name())) { appAlias = an.name(); } } catch (ClassNotFoundException e) { // ignore } } return appAlias; }
Example #6
Source File: Mapper4ORM.java From S-mall-ssm with GNU General Public License v3.0 | 6 votes |
/** * 写入时,处理所有 Enum 的填充 * * @param object 被填充的对象 * @throws Exception 反射异常 */ public void fillEnumOnWriting(Object object) throws Exception { if (object == null) { return; } Class clazz = object.getClass(); // 获取所有 ManyToOne注解的Filed List<Field> result = getFieldsEquals(clazz, Enumerated.class); for (Field field : result) { //获取Enum对应的,String类型的变量名 String varName = field.getAnnotation(Enumerated.class).var(); //获取 Enum Enum enumObj = (Enum) clazz. getMethod("get" + StringUtils.capitalize(field.getName())).invoke(object); // 转成 String,插回 varName String enumString = enumObj.name(); clazz.getMethod("set" + StringUtils.capitalize(varName), String.class) .invoke(object, enumString); } }
Example #7
Source File: BlockImageNode.java From swagger2markup with Apache License 2.0 | 6 votes |
@Override public void processPositionalAttributes() { String attr1 = pop("1", "alt"); if (StringUtils.isNotBlank(attr1)) { attrs.add(attr1); } String attr2 = pop("2", "width"); if (StringUtils.isNotBlank(attr2)) { attrs.add(attr2); } String attr3 = pop("3", "height"); if (StringUtils.isNotBlank(attr3)) { attrs.add(attr3); } }
Example #8
Source File: ReflectUtils.java From RuoYi-Vue with MIT License | 6 votes |
/** * 调用Setter方法, 仅匹配方法名。 * 支持多级,如:对象名.对象名.方法 */ public static <E> void invokeSetter(Object obj, String propertyName, E value) { Object object = obj; String[] names = StringUtils.split(propertyName, "."); for (int i = 0; i < names.length; i++) { if (i < names.length - 1) { String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]); object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); } else { String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]); invokeMethodByName(object, setterMethodName, new Object[] { value }); } } }
Example #9
Source File: ZKScheduleManager.java From uncode-schedule with GNU General Public License v2.0 | 6 votes |
private TaskDefine getTaskDefine(Runnable task){ TaskDefine taskDefine = new TaskDefine(); if(task instanceof org.springframework.scheduling.support.ScheduledMethodRunnable){ taskDefine.setType(TaskDefine.TASK_TYPE_QS); taskDefine.setStartTime(new Date()); org.springframework.scheduling.support.ScheduledMethodRunnable springScheduledMethodRunnable = (org.springframework.scheduling.support.ScheduledMethodRunnable)task; Method targetMethod = springScheduledMethodRunnable.getMethod(); String[] beanNames = applicationcontext.getBeanNamesForType(targetMethod.getDeclaringClass()); if(null != beanNames && StringUtils.isNotEmpty(beanNames[0])){ taskDefine.setTargetBean(beanNames[0]); taskDefine.setTargetMethod(targetMethod.getName()); LOGGER.info("----------------------name:" + taskDefine.stringKey()); } } return taskDefine; }
Example #10
Source File: HBaseTableInfo.java From DDMQ with Apache License 2.0 | 6 votes |
@Override public boolean validate() throws ConfigException { if (StringUtils.isEmpty(hbaseTable)) { throw new ConfigException("hbaseTable is empty"); } if (StringUtils.isEmpty(columnFamily)) { throw new ConfigException("columnFamily is empty"); } if (StringUtils.isEmpty(nameSpace)) { throw new ConfigException("nameSpace is empty"); } if (CollectionUtils.isEmpty(columns)) { throw new ConfigException("columns is empty"); } for (HBaseColumnInfo column : columns) { if (!column.validate()) { throw new ConfigException("column is invalid"); } } if (keyCol != null && !keyCol.validate()) { throw new ConfigException("keyCol is invalid"); } return true; }
Example #11
Source File: TestInspectorImpl.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
private static InspectorImpl initInspector(String urlPrefix) { SCBEngine scbEngine = SCBBootstrap.createSCBEngineForTest(); scbEngine.getTransportManager().clearTransportBeforeInit(); if (StringUtils.isNotEmpty(urlPrefix)) { Map<String, Transport> transportMap = Deencapsulation.getField(scbEngine.getTransportManager(), "transportMap"); transportMap.put(RESTFUL, new ServletRestTransport()); ClassLoaderScopeContext.setClassLoaderScopeProperty(DefinitionConst.URL_PREFIX, urlPrefix); } scbEngine.run(); SwaggerProducer producer = CoreMetaUtils .getSwaggerProducer(scbEngine.getProducerMicroserviceMeta().findSchemaMeta("inspector")); InspectorImpl inspector = (InspectorImpl) producer.getProducerInstance(); return new InspectorImpl(scbEngine, inspector.getInspectorConfig(), new LinkedHashMap<>(schemas)); }
Example #12
Source File: NumberDatatype.java From cuba with Apache License 2.0 | 6 votes |
/** * Creates non-localized format. */ protected NumberFormat createFormat() { if (formatPattern != null) { DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols(); if (!StringUtils.isBlank(decimalSeparator)) formatSymbols.setDecimalSeparator(decimalSeparator.charAt(0)); if (!StringUtils.isBlank(groupingSeparator)) formatSymbols.setGroupingSeparator(groupingSeparator.charAt(0)); return new DecimalFormat(formatPattern, formatSymbols); } else { return NumberFormat.getNumberInstance(); } }
Example #13
Source File: RecordPermissionsRest.java From mobi with GNU Affero General Public License v3.0 | 6 votes |
/** * Iterates over the JSONArray of users or groups and adds an AllOf with a single Match to the provided AnyOf. * * @param array The JSONArray of users or groups to iterate over * @param attributeDesignator the AttributeDesignatorType to apply to the MatchType * @param anyOfArray the AnyOfType to add the AllOf statement to */ private void addUsersOrGroupsToAnyOf(JSONArray array, AttributeDesignatorType attributeDesignator, AnyOfType... anyOfArray) { for (int i = 0; i < array.size(); i++) { String value = array.optString(i); if (StringUtils.isEmpty(value)) { throw new IllegalArgumentException("Invalid JSON representation of a Policy." + " User or group not set properly."); } AttributeValueType userAttrVal = createAttributeValue(XSD.STRING, value); MatchType userMatch = createMatch(XACML.STRING_EQUALS, attributeDesignator, userAttrVal); AllOfType userAllOf = new AllOfType(); userAllOf.getMatch().add(userMatch); for (AnyOfType anyOf : anyOfArray) { anyOf.getAllOf().add(userAllOf); } } }
Example #14
Source File: AndroidConfig.java From MixPush with Apache License 2.0 | 6 votes |
/** * check androidConfig's parameters * * @param notification whcic is in message */ public void check(Notification notification) { if (this.collapseKey != null) { ValidatorUtils.checkArgument((this.collapseKey >= -1 && this.collapseKey <= 100), "Collapse Key should be [-1, 100]"); } if (this.urgency != null) { ValidatorUtils.checkArgument(StringUtils.equals(this.urgency, Urgency.HIGH.getValue()) || StringUtils.equals(this.urgency, Urgency.NORMAL.getValue()), "urgency shouid be [HIGH, NORMAL]"); } if (StringUtils.isNotEmpty(this.ttl)) { ValidatorUtils.checkArgument(this.ttl.matches(AndroidConfig.TTL_PATTERN), "The TTL's format is wrong"); } if (this.fastAppTargetType != null) { ValidatorUtils.checkArgument(this.fastAppTargetType == 1 || this.fastAppTargetType == 2, "Invalid fast app target type[one of 1 or 2]"); } if (null != this.notification) { this.notification.check(notification); } }
Example #15
Source File: MetaServiceImpl.java From Jantent with MIT License | 6 votes |
@Override public void saveMeta(String type, String name, Integer mid) { if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(name)) { MetaVoExample metaVoExample = new MetaVoExample(); metaVoExample.createCriteria().andTypeEqualTo(type).andNameEqualTo(name); List<MetaVo> metaVos = metaDao.selectByExample(metaVoExample); MetaVo metas; if (metaVos.size() != 0) { throw new TipException("已经存在该项"); } else { metas = new MetaVo(); metas.setName(name); if (null != mid) { MetaVo original = metaDao.selectByPrimaryKey(mid); metas.setMid(mid); metaDao.updateByPrimaryKeySelective(metas); // 更新原有文章的categories contentService.updateCategory(original.getName(),name); } else { metas.setType(type); metaDao.insertSelective(metas); } } } }
Example #16
Source File: AbstractRestController.java From konker-platform with Apache License 2.0 | 6 votes |
protected Location getLocation(Tenant tenant, Application application, String locationName) throws BadServiceResponseException, NotFoundResponseException { if (StringUtils.isBlank(locationName)) { return null; } ServiceResponse<Location> applicationResponse = locationSearchService.findByName(tenant, application, locationName, true); if (!applicationResponse.isOk()) { if (applicationResponse.getResponseMessages().containsKey(LocationService.Messages.LOCATION_NOT_FOUND.getCode())) { throw new NotFoundResponseException(applicationResponse); } else { Set<String> validationsCode = new HashSet<>(); for (LocationService.Validations value : LocationService.Validations.values()) { validationsCode.add(value.getCode()); } throw new BadServiceResponseException( applicationResponse, validationsCode); } } return applicationResponse.getResult(); }
Example #17
Source File: BlackDuckIntegrationTest.java From synopsys-detect with Apache License 2.0 | 6 votes |
@BeforeAll public static void setup() { logger = new BufferedIntLogger(); Assumptions.assumeTrue(StringUtils.isNotBlank(System.getenv().get(TEST_BLACKDUCK_URL_KEY))); Assumptions.assumeTrue(StringUtils.isNotBlank(System.getenv().get(TEST_BLACKDUCK_USERNAME_KEY))); Assumptions.assumeTrue(StringUtils.isNotBlank(System.getenv().get(TEST_BLACKDUCK_PASSWORD_KEY))); final BlackDuckServerConfigBuilder blackDuckServerConfigBuilder = BlackDuckServerConfig.newBuilder(); blackDuckServerConfigBuilder.setProperties(System.getenv().entrySet()); blackDuckServerConfigBuilder.setUrl(System.getenv().get(TEST_BLACKDUCK_URL_KEY)); blackDuckServerConfigBuilder.setUsername(System.getenv().get(TEST_BLACKDUCK_USERNAME_KEY)); blackDuckServerConfigBuilder.setPassword(System.getenv().get(TEST_BLACKDUCK_PASSWORD_KEY)); blackDuckServerConfigBuilder.setTrustCert(true); blackDuckServerConfigBuilder.setTimeoutInSeconds(5 * 60); blackDuckServicesFactory = blackDuckServerConfigBuilder.build().createBlackDuckServicesFactory(logger); blackDuckService = blackDuckServicesFactory.createBlackDuckService(); projectService = blackDuckServicesFactory.createProjectService(); projectBomService = blackDuckServicesFactory.createProjectBomService(); codeLocationService = blackDuckServicesFactory.createCodeLocationService(); reportService = blackDuckServicesFactory.createReportService(120 * 1000); previousShouldExit = Application.shouldExit(); Application.setShouldExit(false); }
Example #18
Source File: WrapInQueryTask.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
private QueryFilter getQueryFilterWithViewConfig( TaskView taskView ) { QueryFilter queryFilter = new QueryFilter(); //组织查询条件对象 if( StringUtils.isNotEmpty( taskView.getProject() )) { queryFilter.addEqualsTerm( new EqualsTerm( "project", taskView.getProject() ) ); } //筛选条件_是否已完成:-1-全部, 1-是,0-否. if( taskView.getWorkCompleted() == 1 ) { queryFilter.addIsTrueTerm( new IsTrueTerm("completed")); }else if( taskView.getWorkCompleted() == 0 ) { queryFilter.addIsFalseTerm( new IsFalseTerm("completed")); } //筛选条件_是否已超时:-1-全部, 1-是,0-否. if( taskView.getWorkOverTime() == 1 ) { queryFilter.addIsTrueTerm( new IsTrueTerm("overtime")); }else if( taskView.getWorkOverTime() == 0 ) { queryFilter.addIsFalseTerm( new IsFalseTerm("overtime")); } //只查询我作为负责人的任务 if( taskView.getIsExcutor() ) { queryFilter.addEqualsTerm( new EqualsTerm( "executor", taskView.getOwner() ) ); } if( ListTools.isNotEmpty( taskView.getChoosePriority() )) { queryFilter.addInTerm( new InTerm("priority", new ArrayList<>(taskView.getChoosePriority())) ); } if( ListTools.isNotEmpty( taskView.getChooseWorkTag() )) { //需要换成In符合条件的任务ID } return queryFilter; }
Example #19
Source File: HistoryEventLoop.java From WeEvent with Apache License 2.0 | 5 votes |
public HistoryEventLoop(IBlockChain blockChain, Subscription subscription, Long lastBlock) throws BrokerException { super("[email protected]" + subscription.getUuid()); this.blockChain = blockChain; this.subscription = subscription; // if offset is block height, filter next block directly if (lastBlock != 0 && !StringUtils.isNumeric(this.subscription.getOffset())) { this.dispatchTargetBlock(lastBlock, this.subscription.getOffset()); } this.lastBlock = lastBlock; log.info("HistoryEventLoop initialized with last block: {}, {}", this.lastBlock, this.subscription); }
Example #20
Source File: MiscIssuesRecorderITest.java From warnings-ng-plugin with MIT License | 5 votes |
/** * Runs the CheckStyle parser without specifying a pattern: the default pattern should be used. */ @Test public void shouldUseDefaultFileNamePattern() { FreeStyleProject project = createFreeStyleProject(); copySingleFileToWorkspace(project, "checkstyle.xml", "checkstyle-result.xml"); enableWarnings(project, createTool(new CheckStyle(), StringUtils.EMPTY)); AnalysisResult result = scheduleBuildAndAssertStatus(project, Result.SUCCESS); assertThat(result).hasTotalSize(6); }
Example #21
Source File: StringValueListPersistChecker.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
private void fileName(Field field, List<String> values, JpaObject jpa, CheckPersist checkPersist, CheckPersistType checkPersistType) throws Exception { if (checkPersist.fileNameString()) { for (String str : ListTools.nullToEmpty(values)) { if (StringUtils.isNotEmpty(str)) { if (!StringTools.isFileName(str)) { throw new Exception("check persist stringValueList fileName error, class:" + jpa.getClass().getName() + ", field:" + field.getName() + ", values:" + StringUtils.join(values, ",") + "value:" + str + "."); } } } } }
Example #22
Source File: MollieWebhookPaymentManager.java From alf.io with GNU General Public License v3.0 | 5 votes |
@Override public Optional<TransactionWebhookPayload> parseTransactionPayload(String body, String signature, Map<String, String> additionalInfo) { try(var reader = new StringReader(body)) { Properties properties = new Properties(); properties.load(reader); return Optional.ofNullable(StringUtils.trimToNull(properties.getProperty("id"))) .map(paymentId -> new MollieWebhookPayload(paymentId, additionalInfo.get("eventName"), additionalInfo.get("reservationId"))); } catch(Exception e) { log.warn("got exception while trying to decode Mollie Webhook Payload", e); } return Optional.empty(); }
Example #23
Source File: CobblerDistroDeleteCommand.java From uyuni with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public ValidatorError store() { //Upgrade Scenario where a cobbler id will be null if (StringUtils.isBlank(tree.getCobblerId())) { return null; } CobblerConnection con = CobblerXMLRPCHelper.getConnection(user); Distro dis = Distro.lookupById(con, tree.getCobblerId()); if (dis == null) { log.warn("No cobbler distro associated with this Tree."); return null; } if (!dis.remove()) { return new ValidatorError("cobbler.distro.remove_failed"); } if (tree.getCobblerXenId() != null) { dis = Distro.lookupById(con, tree.getCobblerXenId()); if (dis == null) { log.warn("No cobbler distro associated with this Tree."); return null; } if (!dis.remove()) { return new ValidatorError("cobbler.distro.remove_failed"); } } return new CobblerSyncCommand(user).store(); }
Example #24
Source File: EmployeeLogicServiceImpl.java From bamboobsc with Apache License 2.0 | 5 votes |
private void createEmployeeOrganization(EmployeeVO employee, List<String> organizationOid) throws ServiceException, Exception { if (employee==null || StringUtils.isBlank(employee.getEmpId()) || organizationOid==null || organizationOid.size() < 1 ) { return; } for (String oid : organizationOid) { OrganizationVO organization = this.findOrganizationData(oid); EmployeeOrgaVO empOrg = new EmployeeOrgaVO(); empOrg.setEmpId(employee.getEmpId()); empOrg.setOrgId(organization.getOrgId()); this.employeeOrgaService.saveObject(empOrg); } }
Example #25
Source File: SearchFactory.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public Long getAppInfoDocumentCount( String appId, String docStatus, String targetCategoryId) throws Exception { if( appId == null ){ return null; } if( StringUtils.isEmpty(docStatus) ){ docStatus = "published"; } EntityManager em = this.entityManagerContainer().get( Document.class ); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Long> cq = cb.createQuery( Long.class ); Root<Document> root = cq.from( Document.class ); Predicate p = cb.equal( root.get( Document_.docStatus), docStatus ); if( targetCategoryId != null && !targetCategoryId.isEmpty()){ p = cb.and(p, cb.equal( root.get( Document_.categoryId), targetCategoryId )); }else{ p = cb.and(p, cb.equal( root.get( Document_.appId), appId)); } cq.select(cb.count(root)).where(p); return em.createQuery(cq).getSingleResult(); }
Example #26
Source File: AbstractSelectTreeViewer2.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Algorithm to convert a model (List of {@link TmfTreeDataModel}) to the tree. * * @param start * queried start time * @param end * queried end time * @param model * model to convert * @return the resulting {@link TmfTreeViewerEntry}. */ protected ITmfTreeViewerEntry modelToTree(long start, long end, List<ITmfTreeDataModel> model) { TmfTreeViewerEntry root = new TmfTreeViewerEntry(StringUtils.EMPTY); Map<Long, TmfTreeViewerEntry> map = new HashMap<>(); map.put(-1L, root); for (ITmfTreeDataModel entry : model) { TmfGenericTreeEntry<ITmfTreeDataModel> viewerEntry = new TmfGenericTreeEntry<>(entry); map.put(entry.getId(), viewerEntry); TmfTreeViewerEntry parent = map.get(entry.getParentId()); if (parent != null && !parent.getChildren().contains(viewerEntry)) { parent.addChild(viewerEntry); } } return root; }
Example #27
Source File: PutInSession.java From iaf with Apache License 2.0 | 5 votes |
@Override public void configure() throws ConfigurationException { super.configure(); if (StringUtils.isEmpty(getSessionKey())) { throw new ConfigurationException(getLogPrefix(null) + "attribute sessionKey must be specified"); } }
Example #28
Source File: ParamsConfig.java From gocd with Apache License 2.0 | 5 votes |
public void setConfigAttributes(Object attributes) { if (attributes != null) { this.clear(); for (Map attributeMap : (List<Map>) attributes) { String name = (String) attributeMap.get(ParamConfig.NAME); String value = (String) attributeMap.get(ParamConfig.VALUE); if (StringUtils.isBlank(name) && StringUtils.isBlank(value)) { continue; } this.add(new ParamConfig(name, value)); } } }
Example #29
Source File: Size.java From kubernetes-elastic-agents with Apache License 2.0 | 5 votes |
public static Size parse(String size) { if (StringUtils.isBlank(size)) { throw new IllegalArgumentException(); } final Matcher matcher = SIZE_PATTERN.matcher(size); checkArgument(matcher.matches(), "Invalid size: " + size); final double count = Double.parseDouble(matcher.group(1)); final SizeUnit unit = SUFFIXES.get(matcher.group(2)); if (unit == null) { throw new IllegalArgumentException("Invalid size: " + size + ". Wrong size unit"); } return new Size(count, unit); }
Example #30
Source File: DepartmentReportContentQueryAction.java From bamboobsc with Apache License 2.0 | 5 votes |
private void getContent() throws ControllerException, AuthorityException, ServiceException, Exception { this.checkFields(); Context context = this.getChainContext(); SimpleChain chain = new SimpleChain(); ChainResultObj resultObj = chain.getResultFromResource("organizationReportHtmlContentChain", context); this.body = String.valueOf( resultObj.getValue() ); this.message = resultObj.getMessage(); if ( !StringUtils.isBlank(this.body) && this.body.startsWith("<!-- BSC_PROG003D0003Q -->") ) { this.success = IS_YES; } }