Example usage for org.apache.commons.lang StringUtils isNotEmpty

List of usage examples for org.apache.commons.lang StringUtils isNotEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils isNotEmpty.

Prototype

public static boolean isNotEmpty(String str) 

Source Link

Document

Checks if a String is not empty ("") and not null.

Usage

From source file:com.evolveum.midpoint.repo.sql.util.MidPointNamingStrategy.java

@Override
public String logicalColumnName(String columnName, String propertyName) {
    String result;/* w ww .  jav  a 2 s .c o  m*/
    if (StringUtils.isNotEmpty(columnName)) {
        result = columnName;
    } else {
        if (propertyName.startsWith("credentials.") || propertyName.startsWith("activation.")) {
            //credentials and activation are embedded and doesn't need to be qualified
            result = super.propertyToColumnName(propertyName);
        } else {
            result = propertyName.replaceAll("\\.", "_");
        }
    }
    result = fixLength(result);

    LOGGER.trace("logicalColumnName {} {} to {}", columnName, propertyName, result);
    return result;
}

From source file:com.ultrapower.eoms.common.plugin.ecside.table.cell.RadioBoxHeaderCell.java

public String getHtmlDisplay(TableModel model, Column column) {
 
  HtmlBuilder html = new HtmlBuilder();
  String tableId = model.getTable().getTableId();
  String selectableControlName = column.getAlias();

      // w  ww  . jav  a  2  s .  c  o  m
  html.td(2).valign("middle").append(" columnName=\"").append(column.getAlias()).append("\" ");
  if ("true".equalsIgnoreCase(column.getGroup())) {
     html.append(" group=\"true\" ");
  }

  if (StringUtils.isNotEmpty(column.getWidth())) {
     html.width(column.getWidth());
  }
      
  String headerClass=column.getHeaderClass();

  StringBuffer styleClass=new StringBuffer();
  if (StringUtils.isNotEmpty(headerClass)) {
     styleClass.append(headerClass);
  }

  if (StringUtils.isNotEmpty(column.getHeaderStyleClass())) {
     styleClass.append(" ").append(column.getHeaderStyleClass());
  }
      
  html.styleClass(styleClass.toString().trim());
      
         
         
     if (StringUtils.isNotEmpty(column.getHeaderStyle())) {
        html.style(column.getHeaderStyle());
     }
         
         
     html.onmouseover(ECSideConstants.UTIL_FUNCTION_NAME+".lightHeader(this,'"+model.getTable().getTableId()+"');" );
     html.onmouseout(ECSideConstants.UTIL_FUNCTION_NAME+".unlightHeader(this,'"+model.getTable().getTableId()+"');" );

         
         
     html.close();   
         
     String tid = model.getTable().getTableId();


     html.span();
     String cstyle = "columnSeparator";
     html.styleClass(cstyle);
     html.close().append(" ");
     html.spanEnd();

         
     html.div().styleClass("headerTitle").close();
        
    // String value = column.getValueAsString();
   String value="";
    String radioBoxName = column.getAlias();
 
    //if (StringUtils.isNotBlank(value)) {
       html.input("radio").name(radioBoxName).value(value);
       html.title("");
       if (column.getStyleClass()!=null){
          html.styleClass(column.getStyleClass());
       }else{
          html.styleClass("radio");
       }
       html.xclose();          
    //}



      html.divEnd();

      html.tdEnd();
          

      return html.toString();
        



}

From source file:com.alibaba.otter.manager.web.webx.valve.auth.action.ActionProtectedEditor.java

/**
 * ??Pattern,?URL/*from w ww  . j a v  a 2  s . c  o m*/
 */
private List<ActionPatternHolder> convertTextToPatterns(String text) {
    List<ActionPatternHolder> list = new ArrayList<ActionPatternHolder>();
    if (StringUtils.isNotEmpty(text)) {
        BufferedReader br = new BufferedReader(new StringReader(text));
        int counter = 0;
        String line;
        while (true) {
            counter++;
            try {
                line = br.readLine();
            } catch (IOException ioe) {
                throw new IllegalArgumentException(ioe.getMessage());
            }
            if (line == null) {
                break;
            }
            line = StringUtils.trim(line);
            if (StringUtils.isBlank(line)) {
                continue;
            }
            if (logger.isDebugEnabled()) {
                logger.debug("Line " + counter + ": " + line);
            }
            list.add(convertStringToPattern(line));
        }
    }
    return list;
}

From source file:gemlite.core.internal.support.context.GemliteContext.java

public final static GemliteSibingsLoader getCoreLoader() {
    IModuleContext coreContext = contextMap.get(GEMLITE_RUNTIME_MODULE);
    if (coreContext != null) {
        String coreName = coreContext.getModuleName();
        if (StringUtils.isNotEmpty(coreName))
            return loaderMap.get(coreName);
    }/*from   www  .  j  a  v  a 2  s  . c  om*/

    return null;
}

From source file:com.cognifide.slice.util.InjectorNameUtil.java

/**
 * This util provides injector name for a given resource. The name is read from second part of the
 * resource type, i.e. part after /apps/. For instance, for /apps/myapp/someresource, it will return
 * <code>myapp</code> <br>
 * <br>/*from   w  w w .ja  v  a  2s  . c om*/
 * Please note that this method is deprecated and it doesn't support injectors registered for a given path
 * (with use of {@link InjectorRunner#setInjectorPath(String)})
 * 
 * @deprecated use {@link InjectorsRepository#getInjectorNameForResource(String)} instead
 * 
 * @param resourceType resource type to take the injector name from
 * @return injector name, always second part of the resource type
 */
@Deprecated
public static String getFromResourceType(String resourceType) {
    String injectorName = null;
    if (StringUtils.isNotEmpty(resourceType)) {
        Pattern pattern = RESOURCE_TYPE_PATTERN;
        Matcher matcher = pattern.matcher(resourceType);
        if (matcher.matches()) {
            injectorName = matcher.group(2);
        }
    }
    return injectorName;
}

From source file:com.floreantpos.model.dao.ModifierDAO.java

public List<MenuModifier> findModifier(String name, MenuModifierGroup menuModifierGroup) {
    Session session = null;/*from  w  ww.  j  av a2 s .c o m*/
    Criteria criteria = null;

    try {
        session = getSession();
        criteria = session.createCriteria(MenuModifier.class);
        if (StringUtils.isNotEmpty(name)) {
            criteria.add(Restrictions.ilike(MenuModifier.PROP_NAME, name + "%".trim(), MatchMode.ANYWHERE)); //$NON-NLS-1$
        }

        if (menuModifierGroup != null) {

            criteria.add(Restrictions.eq(MenuModifier.PROP_MODIFIER_GROUP, menuModifierGroup));
        }

        return criteria.list();
    } finally {

        session.close();
    }
}

From source file:controllers.CodeHistoryApp.java

@IsAllowed(Operation.READ)
public static Result history(String ownerName, String projectName, String branch, String path)
        throws IOException, UnsupportedOperationException, ServletException, GitAPIException, SVNException {
    Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
    PlayRepository repository = RepositoryService.getRepository(project);

    String pageStr = HttpUtil.getFirstValueFromQuery(request().queryString(), "page");
    int page = 0;
    if (StringUtils.isNotEmpty(pageStr)) {
        page = Integer.parseInt(pageStr);
    }/*w  w  w. ja  v a2 s. com*/

    try {
        List<Commit> commits = repository.getHistory(page, HISTORY_ITEM_LIMIT, branch, path);

        if (commits == null) {
            return notFound(ErrorViews.NotFound.render("error.notfound", project));
        }

        return ok(history.render(project, commits, page, branch, path));
    } catch (NoHeadException e) {
        return notFound(nohead.render(project));
    }
}

From source file:com.qcloud.project.macaovehicle.web.handler.impl.DriverTemplateHandlerImpl.java

@Override
public DriverTemplateVO toVO(DriverTemplate driverTemplate) {

    String json = Json.toJson(driverTemplate);
    DriverTemplateVO vo = Json.toObject(json, DriverTemplateVO.class, true);
    vo.setIdcardBackUid(fileSDKClient.urlToUid(vo.getIdcardBack()));
    vo.setIdcardFaceUid(fileSDKClient.urlToUid(vo.getIdcardFace()));
    vo.setInchImageUid(fileSDKClient.urlToUid(vo.getInchImage()));
    vo.setLicenseImageUid(fileSDKClient.urlToUid(vo.getLicenseImage()));
    vo.setCertificateUid(fileSDKClient.urlToUid(vo.getCertificateUrl()));
    vo.setHealthCardImgUid(fileSDKClient.urlToUid(vo.getHealthCardImg()));
    ///*from  www . j  a v  a  2 s  .com*/
    if (StringUtils.isNotEmpty(vo.getIdcardBack())) {
        vo.setIdcardBack(vo.getIdcardBack());
    }
    if (StringUtils.isNotEmpty(vo.getIdcardFace())) {
        vo.setIdcardFace(vo.getIdcardFace());
    }
    if (StringUtils.isNotEmpty(vo.getInchImage())) {
        vo.setInchImage(vo.getInchImage());
    }
    if (StringUtils.isNotEmpty(vo.getLicenseImage())) {
        vo.setLicenseImage(vo.getLicenseImage());
    }
    if (StringUtils.isNotEmpty(vo.getCertificateUrl())) {
        vo.setCertificateUrl(vo.getCertificateUrl());
    }
    if (StringUtils.isNotEmpty(vo.getHealthCardImg())) {
        vo.setHealthCardImg(vo.getHealthCardImg());
    }
    return vo;
}

From source file:energy.usef.core.adapter.YodaTimeAdapter.java

/**
 * Transforms a String (xsd:date) to a {@link LocalDate}.
 * //w w  w.  j  ava 2  s  .c om
 * @param dateString A String (xsd:date)
 * @return {@link LocalDate}
 */
public static LocalDate parseDate(String dateString) {
    if (StringUtils.isNotEmpty(dateString)) {
        return new LocalDate(dateString);
    }
    return null;
}

From source file:costumetrade.common.wenqian.util.WQSignUtils.java

/**
 * ?//from   www . j  av a2  s . c o m
 * 
 * @param token
 *            ??
 * @param entName
 *            ??????
 * @param adminUser
 *            ??
 * @param adminPhone
 *            ?
 * @param certType
 *            
 * @param licenseCode
 *            ??
 * @param adminIdenCode
 *            ??
 * @return ???(true:? false:)
 */
public static boolean syncUsertowq(String token, String entName, String adminUser, String adminPhone,
        Integer certType, String licenseCode, String adminIdenCode) {
    boolean bool = false;
    try {
        if (StringUtils.isNotEmpty(token)) {
            List<BasicNameValuePair> nvps = new ArrayList<>();
            nvps.add(new BasicNameValuePair("client_id", WQAPIConstants.CLIENT_ID));
            nvps.add(new BasicNameValuePair("access_token", token));
            nvps.add(new BasicNameValuePair("ent_name", entName));// ???
            nvps.add(new BasicNameValuePair("admin_user", adminUser));// ??
            nvps.add(new BasicNameValuePair("admin_phone", adminPhone));// ?
            nvps.add(new BasicNameValuePair("share_id", adminPhone));// 
            nvps.add(new BasicNameValuePair("admin_user", adminUser));
            nvps.add(new BasicNameValuePair("admin_user", adminUser));

            if (certType != null) {
                nvps.add(new BasicNameValuePair("cert_type", String.valueOf(certType)));
            }
            if (StringUtils.isNotEmpty(licenseCode)) {
                nvps.add(new BasicNameValuePair("license_code", licenseCode));
            }
            if (StringUtils.isNotEmpty(adminIdenCode)) {
                nvps.add(new BasicNameValuePair("admin_iden_code", adminIdenCode));
            }

            String response = HttpClientUtils.doPost(WQAPIConstants.sync_user_api,
                    new UrlEncodedFormEntity(nvps, StandardCharsets.UTF_8));
            System.err.println(response);
            JSONObject responseJSON = JSONObject.parseObject(response);
            if (responseJSON.containsKey("error_code")) {
                int errorcode = responseJSON.getIntValue("error_code");
                if (errorcode == WQAPIConstants.success) {
                    bool = true;
                } else {
                    if (errorcode == WQAPIConstants.phone_exist_error
                            || errorcode == WQAPIConstants.company_exist_error
                            || errorcode == WQAPIConstants.user_exist_error) {
                        // ??
                        bool = true;
                    }
                }
            }
        }
    } catch (Exception e) {
        bool = false;
        e.printStackTrace();
    }
    return bool;
}