Java Code Examples for org.apache.commons.lang.StringUtils.isNotBlank()

The following are Jave code examples for showing how to use isNotBlank() of the org.apache.commons.lang.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: sc-generator   File: GeneratorController.java   View Source Code Vote up 6 votes
@RequestMapping(value = "/springcloud", method = RequestMethod.GET)
public void generatorSpringCloud(HttpServletResponse response,
                                 @RequestParam(value = "id") Integer id,
                                 @RequestParam(value = "type", defaultValue = "java") String type,
                                 @RequestParam(value = "project", defaultValue = "demo") String project,
                                 @RequestParam(value = "packagePath", defaultValue = "com.example") String packagePath,
                                 @RequestParam(value = "tbls", required = false) List<String> tbls,
                                 @RequestParam(value = "mutilProject", defaultValue = "false") boolean mutilProject,
                                 @RequestParam(value = "swagger", defaultValue = "false") boolean swagger,
                                 @RequestParam(value = "commonPackagePath", required = false) String commonPackagePath,
                                 @RequestParam(value = "language", defaultValue = "java") String language) throws Exception {

    Datasource db = datasourceService.findOne(id);
    AbstractGenerator generator;

    //springcloud暂时只支持 java不支持其他语言
    if (StringUtils.isNotBlank(commonPackagePath)) {
        generator = new SpringCloudBaseGeneratorMybatis(db.getJdbcUrl(), db.getUsername(), db.getPassword(), db.getDriver(), project, packagePath, tbls, commonPackagePath, mutilProject, swagger);
    } else {
        generator = new SpringCloudNoBaseGeneratorMybatis(db.getJdbcUrl(), db.getUsername(), db.getPassword(), db.getDriver(), project, packagePath, tbls, mutilProject, swagger);
    }

    download(response, generator, project);

}
 
Example 2
Project: ureport   File: RowParser.java   View Source Code Vote up 5 votes
@Override
public RowDefinition parse(Element element) {
	RowDefinition row=new RowDefinition();
	row.setRowNumber(Integer.valueOf(element.attributeValue("row-number")));
	String height=element.attributeValue("height");
	if(StringUtils.isNotBlank(height)){
		row.setHeight(Integer.valueOf(height));
	}
	String band=element.attributeValue("band");
	if(StringUtils.isNotBlank(band)){
		row.setBand(Band.valueOf(band));
	}
	return row;
}
 
Example 3
Project: uflo   File: AbstractParser.java   View Source Code Vote up 5 votes
protected NodeDiagram parseDiagram(Element element){
	NodeDiagram diagram=new NodeDiagram();
	String g=element.attributeValue("g");
	String name=element.attributeValue("name");
	String label=element.attributeValue("label");
	diagram.setLabel(label);			
	diagram.setName(name);
	if(StringUtils.isNotBlank(g)){
		String[] info=g.split(",");
		if(info.length!=4){
			throw new IllegalArgumentException("Node "+element.attributeValue("name")+" diagram info is invalide!");
		}
		diagram.setX(Integer.valueOf(info[0]));
		diagram.setY(Integer.valueOf(info[1]));
		diagram.setWidth(Integer.valueOf(info[2]));
		diagram.setHeight(Integer.valueOf(info[3]));			
	}
	String x=element.attributeValue("x");
	String y=element.attributeValue("y");
	String width=element.attributeValue("width");
	String height=element.attributeValue("height");
	if(StringUtils.isNotBlank(x)){
		diagram.setX(Integer.valueOf(x));
	}
	if(StringUtils.isNotBlank(y)){
		diagram.setY(Integer.valueOf(y));
	}
	if(StringUtils.isNotBlank(width)){
		diagram.setWidth(Integer.valueOf(width));
	}
	if(StringUtils.isNotBlank(height)){
		diagram.setHeight(Integer.valueOf(height));
	}
	return diagram;
}
 
Example 4
Project: Hydrograph   File: ExpressionEditorDialog.java   View Source Code Vote up 5 votes
private String getTitle() {
	StringBuffer title=new StringBuffer(Messages.EXPRESSION_EDITOR_TITLE);
	if(StringUtils.isNotBlank(windowTitleSuffix)){
		title.append(Constants.SPACE);
		title.append(Constants.DASH);
		title.append(Constants.SPACE);
		title.append(windowTitleSuffix);
	}
	return title.toString();
}
 
Example 5
Project: Dragonfly   File: HttpClientUtil.java   View Source Code Vote up 5 votes
private static String[] split(String field, String reg) {
    String[] result = null;
    if (StringUtils.isNotBlank(field)) {
        String[] arr = field.split(reg, 2);
        result = new String[2];
        result[0] = arr[0].trim();
        if (arr.length == 2) {
            result[1] = arr[1].trim();
        } else {
            result[1] = "";
        }
    }
    return result;
}
 
Example 6
Project: Hydrograph   File: AdditionalParamDBValidationRule.java   View Source Code Vote up 5 votes
private boolean validatePropertyMap(Map<String, String> additionalParam, String propertyName) {
	if(!additionalParam.containsKey(Constants.ADDITIONAL_DB_CHUNK_SIZE) &&
			(additionalParam.containsKey(Constants.NUMBER_OF_PARTITIONS) || 
			additionalParam.containsKey(Constants.ADDITIONAL_DB_FETCH_SIZE) ||
			additionalParam.containsKey(Constants.ADDITIONAL_PARAMETERS_FOR_DB))){//input
		
		if(StringUtils.isNotBlank(additionalParam.get(Constants.NUMBER_OF_PARTITIONS))){
			if((validatePopertyFields(additionalParam, propertyName, propertyName))	
				&& (additionalParam.containsKey(Constants.ADDITIONAL_DB_FETCH_SIZE) &&
						validateFetchSizeField(additionalParam, propertyName, propertyName)) 
				&& validateAdditionalParam(additionalParam, propertyName, propertyName)){
				return true;
			}
		}else if((additionalParam.containsKey(Constants.ADDITIONAL_DB_FETCH_SIZE) &&
				validateFetchSizeField(additionalParam, propertyName, propertyName)) 
		&& validateAdditionalParam(additionalParam, propertyName, propertyName)){
			return true;
		}
		
		
	}else if(additionalParam.containsKey(Constants.ADDITIONAL_DB_CHUNK_SIZE) || 
			additionalParam.containsKey(Constants.ADDITIONAL_PARAMETERS_FOR_DB)){//output
		if(validateChunkSize(additionalParam, propertyName, propertyName) &&
				validateAdditionalParam(additionalParam, propertyName, propertyName)){
			return true;
		}
	}
	return false;
}
 
Example 7
Project: Hydrograph   File: OutputSparkRedshiftConverter.java   View Source Code Vote up 5 votes
private void setTemporaryDirectoryName(Sparkredshift redshiftOutput) {
	String temporaryDirectoryName =(String) properties.get(PropertyNameConstants.TEMPORARY_DIRECTORY_NAME.value());
	if (StringUtils.isNotBlank(temporaryDirectoryName)) {
		ElementValueStringType temps3Dir = new ElementValueStringType();
		temps3Dir.setValue(temporaryDirectoryName);
		redshiftOutput.setTemps3Dir(temps3Dir);
	}
}
 
Example 8
Project: Hydrograph   File: JobLogger.java   View Source Code Vote up 5 votes
/**
 * 
 * log message
 * 
 * @param message
 */
public void logMessage(String message){
	for(AbstractJobLogger jobLogger: loggers){
		if(StringUtils.isNotBlank(message)){
			message = StringUtils.trim(message);
			jobLogger.log(message);
		}
		logger.debug("Logged message {} on {}", message, jobLogger.getClass().getName());
	}
}
 
Example 9
Project: Hydrograph   File: FilterHelper.java   View Source Code Vote up 5 votes
/**
 * Gets the field name modify listener.
 * 
 * @param tableViewer
 *            the table viewer
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the field name modify listener
 */
public ModifyListener getFieldNameModifyListener(final TableViewer tableViewer, final List<Condition> conditionsList,
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	ModifyListener listener = new ModifyListener() {
		
		@Override
		public void modifyText(ModifyEvent e) {
			CCombo source = (CCombo) e.getSource();
			int index = (int) source.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			String fieldName = source.getText();
			filterConditions.setFieldName(fieldName);
			
			if(StringUtils.isNotBlank(fieldName)){
				String fieldType = fieldsAndTypes.get(fieldName);
				TableItem item = tableViewer.getTable().getItem(index);
				CCombo conditionalCombo = (CCombo) item.getData(FilterConditionsDialog.CONDITIONAL_OPERATORS);
				if(conditionalCombo != null && StringUtils.isNotBlank(fieldType)){
					conditionalCombo.setText(filterConditions.getConditionalOperator());
					conditionalCombo.setItems(FilterHelper.INSTANCE.getTypeBasedOperatorMap().get(fieldType));
					new AutoCompleteField(conditionalCombo, new CComboContentAdapter(), conditionalCombo.getItems());
				}
			}
			validateCombo(source);
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
Example 10
Project: logistimo-web-service   File: MaterialBuilder.java   View Source Code Vote up 5 votes
public Results buildMaterialModelList(Results results,
                                      SecureUserDetails sUser, Long domainId)
    throws ServiceException {
  List materials = results.getResults();
  List<MaterialModel> newInventory = new ArrayList<MaterialModel>(
      materials.size());
  int itemCount = results.getOffset() + 1;
  Map<Long, String> domainNames = new HashMap<>(1);
  UsersService as = null;
  as = Services.getService(UsersServiceImpl.class);
  for (Object material : materials) {
    MaterialModel item = buildMaterialModel((IMaterial) material,
        sUser, itemCount, domainNames);
    if (item != null) {
      if (as != null) {
        try {
          IUserAccount ua;
          if (StringUtils.isNotBlank(item.ludBy)) {
            ua = as.getUserAccount(item.ludBy);
            item.ludByn = ua.getFullName();
          } else if (StringUtils.isNotBlank(item.creBy)) {
            ua = as.getUserAccount(item.creBy);
            item.ludBy = ua.getUserId();
            item.ludByn = ua.getFullName();
          }
        } catch (ObjectNotFoundException e) {
          xLogger.warn("User {0} not found", item.ludBy);
        }
      }
      newInventory.add(item);
      itemCount++;
    }
  }
  return new Results(newInventory, results.getCursor(), results.getNumFound(),
      results.getOffset());
}
 
Example 11
Project: flume-elasticsearch-sink   File: ElasticSearchSink.java   View Source Code Vote up 5 votes
/**
 * builds Index builder
 */
private void buildIndexBuilder(Context context) {
    String indexBuilderClass = DEFAULT_ES_INDEX_BUILDER;
    if (StringUtils.isNotBlank(context.getString(ES_INDEX_BUILDER))) {
        indexBuilderClass = context.getString(ES_INDEX_BUILDER);
    }
    this.indexBuilder = instantiateClass(indexBuilderClass);
    if (this.indexBuilder != null) {
        this.indexBuilder.configure(context);
    }
}
 
Example 12
Project: Hydrograph   File: ExcelFormattingDialog.java   View Source Code Vote up 5 votes
private void populateWidget() {
	
	if(excelFormattingDataStructure !=null){
		List<ExcelConfigurationDataStructure> listOfExcelConfiguration2 = excelFormattingDataStructure.getListOfExcelConfiguration();
		if(listOfExcelConfiguration2 !=null && listOfExcelConfiguration2.size() >0 ){
			draggedFields.clear();
			for(ExcelConfigurationDataStructure excelConfigurationDataStructure :  listOfExcelConfiguration2){
				if(StringUtils.isNotBlank(excelConfigurationDataStructure.getFieldName())){
					draggedFields.add(excelConfigurationDataStructure.getFieldName());
				}
			}
			draggedFields.add(0, "Select");
			combo.setItems(convertToArray(draggedFields));
		}
		if(StringUtils.isNotBlank(excelFormattingDataStructure.getCopyOfField())){
			combo.setText(excelFormattingDataStructure.getCopyOfField());
		}
		if(listOfExcelConfiguration2 !=null){
			this.listOfExcelConfiguration.clear();
			ArrayList tmplist = (ArrayList)this.excelFormattingDataStructure.getListOfExcelConfiguration();
			this.listOfExcelConfiguration.addAll((ArrayList)tmplist.clone());
			targetTableViewer.setInput(listOfExcelConfiguration);
		}
	}
	
	highlightDropFields();
	enableDeleteButton();
}
 
Example 13
Project: Hydrograph   File: XPathSchemaGridCellModifier.java   View Source Code Vote up 5 votes
private boolean isResetNeeded(XPathGridRow xPathGridRow, String property) {
	if(XPathSchemaGridWidget.DATATYPE.equals(property) && StringUtils.isNotBlank(xPathGridRow.getDataTypeValue())){
		if(DataType.INTEGER_CLASS.equals(xPathGridRow.getDataTypeValue()) 
				||DataType.LONG_CLASS.equals(xPathGridRow.getDataTypeValue())
				||DataType.STRING_CLASS.equals(xPathGridRow.getDataTypeValue())
				||DataType.SHORT_CLASS.equals(xPathGridRow.getDataTypeValue())
				||DataType.BOOLEAN_CLASS.equals(xPathGridRow.getDataTypeValue())
				||DataType.FLOAT_CLASS.equals(xPathGridRow.getDataTypeValue())
				||DataType.DOUBLE_CLASS.equals(xPathGridRow.getDataTypeValue())
				||DataType.DATE_CLASS.equals(xPathGridRow.getDataTypeValue())){
			return true;
		}	
	}
	return false;
}
 
Example 14
Project: logistimo-web-service   File: AssetController.java   View Source Code Vote up 5 votes
@RequestMapping(value = "/", method = RequestMethod.GET)
public
@ResponseBody
Results getAssets(@RequestParam(required = false) String q,
                  @RequestParam(required = false) Integer at,
                  @RequestParam(defaultValue = PageParams.DEFAULT_SIZE_STR) int size,
                  @RequestParam(defaultValue = PageParams.DEFAULT_OFFSET_STR) int offset,
                  HttpServletRequest request) {
  SecureUserDetails sUser = SecurityUtils.getUserDetails(request);
  Locale locale = sUser.getLocale();
  ResourceBundle backendMessages = Resources.get().getBundle("BackendMessages", locale);
  String timezone = sUser.getTimezone();
  AssetManagementService ams;
  Results assetResults;
  Navigator
      navigator =
      new Navigator(request.getSession(), "AssetController.getAssets", offset, size, "dummy", 0);
  PageParams pageParams = new PageParams(navigator.getCursor(offset), offset, size);
  long domainId = SessionMgr.getCurrentDomain(request.getSession(), sUser.getUsername());
  try {
    if (StringUtils.isNotBlank(q)) {
      q = AssetUtil.decodeURLParameters(q);
      assetResults = SearchUtil.findAssets(domainId, q, pageParams);
      assetResults.setNumFound(-1);
    } else {
      ams = Services.getService(AssetManagementServiceImpl.class, locale);
      assetResults = ams.getAssetsByDomain(domainId, at, pageParams);
    }
    assetResults.setOffset(offset);
    navigator.setResultParams(assetResults);
  } catch (Exception e) {
    xLogger.severe("Error while getting asset for the domain {0}", domainId, e);
    throw new InvalidServiceException(
        backendMessages.getString("asset.detail.fetch.domain.error"));
  }
  return assetBuilder.buildAssetResults(assetResults, locale, timezone);
}
 
Example 15
Project: Spring-Boot-Server   File: SendMsgService.java   View Source Code Vote up 5 votes
/**
 * 发送短信验证码
 * recNum:发送号码
 * type:类型 1、登录 2、付款识别码
 *
 * @return
 */
public PageData sendMsg(PageData pd) throws Exception {
    String msgType = pd.getString("type");
    if (StringUtils.isNotBlank(msgType) && "1".equals(msgType)) {
        return verificationCode(pd);
    } else if (StringUtils.isNotBlank(msgType) && "2".equals(msgType)) {
        return payIdentifyCode(pd);
    } else {
        return WebResult.requestFailed(400, "参数错误", null);
    }
}
 
Example 16
Project: xxl-job   File: XxlJobServiceImpl.java   View Source Code Vote up 5 votes
@Override
public Map<String, Object> dashboardInfo() {

	int jobInfoCount = xxlJobInfoDao.findAllCount();
	int jobLogCount = xxlJobLogDao.triggerCountByHandleCode(-1);
	int jobLogSuccessCount = xxlJobLogDao.triggerCountByHandleCode(ReturnT.SUCCESS_CODE);

	// executor count
	Set<String> executerAddressSet = new HashSet<String>();
	List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
	if (CollectionUtils.isNotEmpty(groupList)) {
		for (XxlJobGroup group: groupList) {
			List<String> registryList = null;
			if (group.getAddressType() == 0) {
				registryList = JobRegistryMonitorHelper.discover(RegistryConfig.RegistType.EXECUTOR.name(), group.getAppName());
			} else {
				if (StringUtils.isNotBlank(group.getAddressList())) {
					registryList = Arrays.asList(group.getAddressList().split(","));
				}
			}
			if (CollectionUtils.isNotEmpty(registryList)) {
				executerAddressSet.addAll(registryList);
			}
		}
	}
	int executorCount = executerAddressSet.size();

	Map<String, Object> dashboardMap = new HashMap<String, Object>();
	dashboardMap.put("jobInfoCount", jobInfoCount);
	dashboardMap.put("jobLogCount", jobLogCount);
	dashboardMap.put("jobLogSuccessCount", jobLogSuccessCount);
	dashboardMap.put("executorCount", executorCount);
	return dashboardMap;
}
 
Example 17
Project: -Spring-SpringMVC-Mybatis-   File: UpmsUserController.java   View Source Code Vote up 5 votes
@ApiOperation(value = "用户列表")
@RequiresPermissions("upms:user:read")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object list(
        @RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
        @RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
        @RequestParam(required = false, defaultValue = "", value = "search") String search,
        @RequestParam(required = false, value = "sort") String sort,
        @RequestParam(required = false, value = "order") String order) {
    UpmsUserExample upmsUserExample = new UpmsUserExample();
    if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
        upmsUserExample.setOrderByClause(sort + " " + order);
    }
    if (StringUtils.isNotBlank(search)) {
        upmsUserExample.or()
                .andRealnameLike("%" + search + "%");
        upmsUserExample.or()
                .andUsernameLike("%" + search + "%");
    }
    List<UpmsUser> rows = upmsUserService.selectByExampleForOffsetPage(upmsUserExample, offset, limit);
    long total = upmsUserService.countByExample(upmsUserExample);
    Map<String, Object> result = new HashMap<>();
    result.put("rows", rows);
    result.put("total", total);
    return result;
}
 
Example 18
Project: Ins_fb_pictureSpider_WEB   File: Page.java   View Source Code Vote up 4 votes
/**
 * 是否已设置排序字段,无默认值.
 */
public boolean isOrderBySetted() {
    return (StringUtils.isNotBlank(orderBy) && StringUtils.isNotBlank(order));
}
 
Example 19
Project: Hydrograph   File: InputXmlUiConverter.java   View Source Code Vote up 4 votes
@Override
public void prepareUIXML() {
	super.prepareUIXML();
	LOGGER.debug("Fetching Input-Xml-Properties for {}", componentName);
	XmlFile xmlFile = (XmlFile) typeBaseComponent;
	
	String filePath = null;
	if (xmlFile.getPath() != null){
		if(StringUtils.isNotBlank(xmlFile.getPath().getUri())){
			filePath = xmlFile.getPath().getUri();
		} else {
			filePath = getValue(PropertyNameConstants.PATH.value());
		}
	}
	propertyMap.put(PropertyNameConstants.PATH.value(), StringUtils.isNotBlank(filePath)? filePath : "");

	String absolutePath = null;
	if (xmlFile.getAbsoluteXPath() != null) {
		if (StringUtils.isNotBlank(xmlFile.getAbsoluteXPath().getValue())) {
			absolutePath = xmlFile.getAbsoluteXPath().getValue();
		} else {
			absolutePath = getValue(PropertyNameConstants.ABSOLUTE_XPATH.value());
		}
	}
	propertyMap.put(PropertyNameConstants.ABSOLUTE_XPATH.value(), StringUtils.isNotBlank(absolutePath)? absolutePath : "");
	
	String rowTag = null;
	if (xmlFile.getRowTag() != null) {
		if (StringUtils.isNotBlank(xmlFile.getRowTag().getValue())) {
			rowTag = xmlFile.getRowTag().getValue();
		} else {
			rowTag = getValue(PropertyNameConstants.ROW_TAG.value());
		}
	}
	propertyMap.put(PropertyNameConstants.ROW_TAG.value(), StringUtils.isNotBlank(rowTag)? rowTag : "");
	
	String rootTag = null;
	if (xmlFile.getRootTag() != null) {
		if (StringUtils.isNotBlank(xmlFile.getRootTag().getValue())) {
			rootTag = xmlFile.getRootTag().getValue();
		} else {
			rootTag = getValue(PropertyNameConstants.ROOT_TAG.value());
		}
	}
	
	
	propertyMap.put(PropertyNameConstants.ROOT_TAG.value(), StringUtils.isNotBlank(rootTag)? rootTag : "");

	propertyMap.put(PropertyNameConstants.CHAR_SET.value(), getCharSet());
	
	propertyMap.put(PropertyNameConstants.IS_SAFE.value(),
			convertBooleanValue(xmlFile.getSafe(), PropertyNameConstants.IS_SAFE.value()));
	
	uiComponent.setType(UIComponentsConstants.XML.value());
	uiComponent.setCategory(UIComponentsConstants.INPUT_CATEGORY.value());
	
	
	container.getComponentNextNameSuffixes().put(name_suffix, 0);
	container.getComponentNames().add(xmlFile.getId());
	uiComponent.setProperties(propertyMap);
	if(StringUtils.isNotBlank(absolutePath)){
		updateAbsolutePathToEachGridRow(absolutePath
				,(Schema)propertyMap.get(PropertyNameConstants.SCHEMA.value()));
		
	}
}
 
Example 20
Project: logistimo-web-service   File: ExceptionWithCodes.java   View Source Code Vote up 4 votes
default String getLocalisedMessage(Locale locale) {
  if (StringUtils.isNotBlank(getCode())) {
    return ExceptionUtils.constructMessage(getCode(), locale, getArguments());
  }
  return getLocalizedMessage();
}