List of usage examples for org.apache.commons.lang StringUtils isNotEmpty
public static boolean isNotEmpty(String str)
Checks if a String is not empty ("") and not null.
From source file:com.bstek.dorado.data.config.xml.DataResolverParser.java
@Override protected void initDefinition(ObjectDefinition definition, Element element, ParseContext context) throws Exception { super.initDefinition(definition, element, context); DataResolverDefinition dataResolver = (DataResolverDefinition) definition; String interceptor = (String) dataResolver.removeProperty(XmlConstants.ATTRIBUTE_INTERCEPTOR); if (StringUtils.isNotEmpty(interceptor)) { dataResolver.setInterceptor(interceptor); }//from w ww . j av a 2 s . co m }
From source file:io.sightly.tck.tests.TestBuilder.java
/** * Creates a JUnit tests from a JSON test description. Examples of such files can be found in the {@code * src/main/resources/testfiles/definitions} folder. * * @param testDescription a JSON object encapsulating a test description * @return the list of tests//ww w. j ava 2s . c o m */ public static List<TestCase> getTests(JSONObject testDescription) { String serverURL = System.getProperty(Constants.SYS_PROP_SERVER_URL); String user = System.getProperty(Constants.SYS_PROP_USER); String password = System.getProperty(Constants.SYS_PROP_PASS); Client client; if (StringUtils.isNotEmpty(user) && StringUtils.isNotEmpty(password)) { client = new Client(user, password); } else { client = new Client(); } ArrayList<TestCase> tests = new ArrayList<TestCase>(); if (testDescription != null) { int expectedStatusCode = 200; String expectedMarkupPath = null; if (testDescription.has(JSON_EXPECTED_MARKUP)) { expectedMarkupPath = testDescription.getString(JSON_EXPECTED_MARKUP); } String suite = testDescription.getString(JSON_SUITE); String suiteUrl = null; if (testDescription.has(JSON_URL)) { suiteUrl = testDescription.getString(JSON_URL); } String suiteMethod = null; if (testDescription.has(JSON_METHOD)) { suiteMethod = testDescription.getString(JSON_METHOD); } JSONArray groups = testDescription.getJSONArray(JSON_GROUPS); if (testDescription.has(JSON_EXPECTED_STATUS_CODE)) { expectedStatusCode = testDescription.getInt(JSON_EXPECTED_STATUS_CODE); } for (int i = 0; i < groups.length(); i++) { JSONObject group = groups.getJSONObject(i); String groupName = group.getString(JSON_GROUP_NAME); JSONArray groupCases = group.getJSONArray(JSON_GROUP_CASES); if (group.has(JSON_EXPECTED_MARKUP)) { expectedMarkupPath = group.getString(JSON_EXPECTED_MARKUP); } String groupMethod = null; if (group.has(JSON_METHOD)) { groupMethod = group.getString(JSON_METHOD); } String groupURL = null; if (group.has(JSON_URL)) { groupURL = group.getString(JSON_URL); } if (group.has(JSON_EXPECTED_STATUS_CODE)) { expectedStatusCode = group.getInt(JSON_EXPECTED_STATUS_CODE); } String contentURL = serverURL + (StringUtils.isEmpty(groupURL) ? suiteUrl : groupURL); String method = StringUtils.isEmpty(groupMethod) ? suiteMethod : groupMethod; for (int j = 0; j < groupCases.length(); j++) { JSONObject testCase = groupCases.getJSONObject(j); tests.add(buildTestCase(client, expectedStatusCode, contentURL, suite, groupName, method, testCase, expectedMarkupPath)); } } } return tests; }
From source file:com.zb.jcseg.solr.JcsegTokenizerFactory.java
/** * set the mode arguments in the schema.xml configuration file to change the segment mode for jcseg . <br /> * //from w ww . ja v a2 s. c o m * @see TokenizerFactory#TokenizerFactory(Map<String, String) */ public JcsegTokenizerFactory(Map<String, String> args) { super(args); String _mode = getOriginalArgs().get("mode"); String dicPath = getOriginalArgs().get("dicPath"); if (_mode == null) { mode = JcsegTaskConfig.COMPLEX_MODE; } else { _mode = _mode.toLowerCase(); if ("simple".equals(_mode)) { mode = JcsegTaskConfig.SIMPLE_MODE; } else mode = JcsegTaskConfig.COMPLEX_MODE; } // initialize the task config and the dictionary config = new JcsegTaskConfig(); if (StringUtils.isNotEmpty(dicPath)) { config.setLexPath(dicPath); } dic = JcsegDictionaryFactory.createDefaultDictionary(config); }
From source file:jp.co.nemuzuka.controller.IndexController.java
@NoSessionCheck @Override//from ww w . j a va 2s . c om protected Navigation execute() throws Exception { if (userService.isUserAdmin()) { //????MemberModel?????? User currentUser = userService.getCurrentUser(); memberService.checkAndCreateMember(currentUser.getEmail(), currentUser.getNickname(), Authority.admin); } else if (StringUtils.isNotEmpty((String) sessionScope(USE_TRIAL_USER))) { //??????trial???MemberModel?????? User currentUser = userService.getCurrentUser(); memberService.checkAndCreateMember(currentUser.getEmail(), currentUser.getEmail(), Authority.normal); } if (isSmartPhone(request.getHeader("User-Agent")) == true) { return forward("/mobile/bts/"); } return forward("/bts/"); }
From source file:com.haulmont.cuba.gui.xml.layout.loaders.RelatedEntitiesLoader.java
@Override public void loadComponent() { assignFrame(resultComponent);/*from www .j a va 2 s . c om*/ loadCaption(resultComponent, element); loadIcon(resultComponent, element); loadWidth(resultComponent, element); loadStyleName(resultComponent, element); loadEnable(resultComponent, element); loadVisible(resultComponent, element); loadAlign(resultComponent, element); String openType = element.attributeValue("openType"); if (StringUtils.isNotEmpty(openType)) { resultComponent.setOpenType(OpenType.valueOf(openType)); } String exclude = element.attributeValue("exclude"); if (StringUtils.isNotBlank(exclude)) { resultComponent.setExcludePropertiesRegex(exclude); } for (Object routeObject : element.elements("property")) { Element routeElement = (Element) routeObject; String property = routeElement.attributeValue("name"); if (StringUtils.isEmpty(property)) { throw new GuiDevelopmentException("Name attribute for related entities property is not specified", context.getFullFrameId(), "componentId", resultComponent.getId()); } String caption = loadResourceString(routeElement.attributeValue("caption")); String filterCaption = loadResourceString(routeElement.attributeValue("filterCaption")); String screen = routeElement.attributeValue("screen"); if (StringUtils.isNotEmpty(screen)) { WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME); if (windowConfig.findWindowInfo(screen) == null) { throw new GuiDevelopmentException("Screen for custom route in related entities not found", context.getFullFrameId(), "componentId", resultComponent.getId()); } } resultComponent.addPropertyOption(property, screen, caption, filterCaption); } String listComponent = element.attributeValue("for"); if (StringUtils.isEmpty(listComponent)) { throw new GuiDevelopmentException("'for' attribute of related entities is not specified", context.getFullFrameId(), "componentId", resultComponent.getId()); } context.addPostInitTask((context1, window) -> { if (resultComponent.getListComponent() == null) { Component bindComponent = resultComponent.getFrame().getComponent(listComponent); if (!(bindComponent instanceof ListComponent)) { throw new GuiDevelopmentException("Specify 'for' attribute: id of table or tree", context1.getFullFrameId(), "componentId", resultComponent.getId()); } resultComponent.setListComponent((ListComponent) bindComponent); } }); loadFocusable(resultComponent, element); loadTabIndex(resultComponent, element); }
From source file:com.intel.cosbench.controller.tasklet.AbstractHttpTasklet.java
private static HttpPost prepareRequest(String content, String url) { HttpPost POST = new HttpPost(url); try {/*from w w w. j av a2 s .co m*/ if (StringUtils.isNotEmpty(content)) POST.setEntity(new StringEntity(content)); } catch (Exception e) { throw new UnexpectedException(e); // will not happen } if (content != null && content.length() > 0) if (!content.startsWith("<?xml")) LOGGER.debug("[ >> ] - {} -> {}", content, url); else LOGGER.debug("[ >> ] - [xml-content] -> {}", url); else LOGGER.debug("[ >> ] - [empty-body] -> {}", url); return POST; // HTTP request prepared }
From source file:com.adobe.cq.wcm.core.components.testing.MockContentPolicyMapping.java
@Override public ContentPolicy getPolicy() { ValueMap valueMap = contentPolicyResource.adaptTo(ValueMap.class); if (valueMap.containsKey("cq:policy")) { String policyPath = valueMap.get("cq:policy", StringUtils.EMPTY); if (StringUtils.isNotEmpty(policyPath)) { policyPath = "/conf/coretest/settings/wcm/policies/" + policyPath; Resource policyResource = contentPolicyResource.getResourceResolver().getResource(policyPath); if (policyResource != null) { return new MockContentPolicy(policyResource); }//w w w. ja v a 2 s. c o m } } return null; }
From source file:com.fantasia.workflow.KpiFlowService.java
public void process(Map<String, Object> params) { String processId = params.get("processId").toString(); String orderId = params.get("orderId").toString(); String taskId = params.get("taskId").toString(); String nextOperator = ""; if (StringUtils.isEmpty(orderId) && StringUtils.isEmpty(taskId)) { facets.startAndExecute(processId, DbcContext.getUser().getUserName(), params); } else {/*from w ww . j a v a 2s .c o m*/ int method = 0; switch (method) { case 0:// facets.execute(taskId, DbcContext.getUser().getUserName(), params); break; case -1://?? facets.executeAndJump(taskId, DbcContext.getUser().getUserName(), params, ""); break; case 1:// if (StringUtils.isNotEmpty(nextOperator)) { facets.transferMajor(taskId, DbcContext.getUser().getUserName(), nextOperator.split(",")); } break; case 2://?? if (StringUtils.isNotEmpty(nextOperator)) { facets.transferAidant(taskId, DbcContext.getUser().getUserName(), nextOperator.split(",")); } break; default: facets.execute(taskId, DbcContext.getUser().getUserName(), params); break; } } String ccOperator = ""; if (StringUtils.isNotEmpty(ccOperator)) { facets.getEngine().order().createCCOrder(orderId, ccOperator.split(",")); } }
From source file:com.acube.security.service.UserServiceImpl.java
@Override public void updateUser(User user) { if (StringUtils.isNotEmpty(user.getIpAddress())) { userRepository.updateAssignableIpAddress(user);// ip assignYn = 'N' userRepository.usedIpAddress(user); // ? IP? } else {/*from w ww . ja v a2 s .c om*/ userRepository.updateAssignableIpAddress(user);// ip assignYn = 'N' } userRepository.updateUser(user); }
From source file:com.photon.phresco.framework.param.impl.IosThemesBundleFilterImpl.java
@Override public PossibleValues getValues(Map<String, Object> paramMap) throws PhrescoException { String rootModulePath = ""; String subModuleName = ""; PossibleValues possibleValues = new PossibleValues(); ApplicationInfo applicationInfo = (ApplicationInfo) paramMap.get(KEY_APP_INFO); String rootModule = (String) paramMap.get(KEY_ROOT_MODULE); if (StringUtils.isNotEmpty(rootModule)) { rootModulePath = Utility.getProjectHome() + rootModule; subModuleName = applicationInfo.getAppDirName(); } else {//from www . j a va 2 s . c o m rootModulePath = Utility.getProjectHome() + applicationInfo.getAppDirName(); } File file = new File(getResourcesPath(rootModulePath, subModuleName).toString()); if (file.exists()) { File[] listFiles = file.listFiles(new BundleFileNameFilter(".bundle")); if (!ArrayUtils.isEmpty(listFiles)) { for (File listFile : listFiles) { Value value = new Value(); value.setValue(listFile.getName()); possibleValues.getValue().add(value); } } } return possibleValues; }