Example usage for org.springframework.util StringUtils isEmpty

List of usage examples for org.springframework.util StringUtils isEmpty

Introduction

In this page you can find the example usage for org.springframework.util StringUtils isEmpty.

Prototype

public static boolean isEmpty(@Nullable Object str) 

Source Link

Document

Check whether the given object (possibly a String ) is empty.

Usage

From source file:ph.fingra.statisticsweb.service.MemberServiceImpl.java

public void update(Member member) {
    if (!StringUtils.isEmpty(member.getPassword())) {
        member.setPassword(passwordEncoder.encode(member.getPassword()));
    }/*from w  w  w  .  ja v a2s .co  m*/
    memberDao.update(member);
    UserDetails newPrincipal = new FingraphUser(get(member.getMemberid()));
    Authentication currentAuth = SecurityContextHolder.getContext().getAuthentication();
    UsernamePasswordAuthenticationToken newAuth = new UsernamePasswordAuthenticationToken(newPrincipal,
            currentAuth.getCredentials(), newPrincipal.getAuthorities());
    newAuth.setDetails(currentAuth.getDetails());
    SecurityContextHolder.getContext().setAuthentication(newAuth);
}

From source file:org.lightadmin.logging.configurer.LoggingConfigurerSettings.java

public void setBackToSiteUrl(String backToSiteUrl) {
    if (!StringUtils.isEmpty(backToSiteUrl)) {
        this.backToSiteUrl = backToSiteUrl;
    }
}

From source file:org.psikeds.resolutionengine.rules.RuleStack.java

public Rule addRule(final Rule r) {
    final String rid = (r == null ? null : r.getRuleID());
    return (StringUtils.isEmpty(rid) ? null : this.put(rid, r));
}

From source file:uk.ac.kcl.iop.brc.core.pipeline.dncpipeline.service.PythonServiceTest.java

@Test
@Ignore//from  ww w  .  j  a  v a2  s  .  c o m
public void shouldNotReturnEmptyWhenHTMLIsBad() throws IOException {
    File file = new File(getClass().getClassLoader().getResource("pythonfiles/ignoretags.py").getPath());
    String filePath = file.getAbsolutePath();
    String htmlPath = getClass().getClassLoader().getResource("pythontestres/testempty.html").getPath();
    String jsonPath = getClass().getClassLoader().getResource("pythontestres/testJson.json").getPath();

    String result = pythonService.runFile(Arrays.asList(filePath, htmlPath, jsonPath));

    assertFalse(StringUtils.isEmpty(result));
}

From source file:com.ddubyat.develop.jhawtcode.util.PropertyUtil.java

/**
 * Internal check to see if dynamic code execution is enabled
 * @return true if enabled or false if disabled
 */// w ww  .  ja v a2s. co m
public Boolean canHawtTheCode() {
    if (isCanHawt != null) {
        return isCanHawt;
    }

    String enableProp = System.getProperty("jhawtcode.enabled");
    log.trace("Check for jhawtenabled: {}", enableProp);
    if (enableProp != null && !StringUtils.isEmpty(enableProp)
            && enableProp.equalsIgnoreCase("ICERTIFYTHISISNOTPROD")) {
        isCanHawt = Boolean.TRUE;
        String licProp = System.getProperty("jhawtcode.license");
        if (!StringUtils.isEmpty(licProp)) {
            try {
                String email = licProp.split(":")[0];
                String licenseCode = licProp.split(":")[1];
                if (validLicense(email, licenseCode)) {
                    license = email;
                }
            } catch (Exception e) {
                license = "Unlicensed";
            }
        }
        printLicense();
    } else {
        isCanHawt = Boolean.FALSE;
    }

    return isCanHawt;
}

From source file:org.jdal.ui.bind.ControlInitializerSupport.java

/**
 * @param entities/*w ww .  ja v  a  2s  . c  o m*/
 * @param sortProperty
 */
protected void sort(List entities, String sortProperty) {
    if (!StringUtils.isEmpty(sortProperty))
        Collections.sort(entities, new PropertyComparator(sortProperty));
}

From source file:com.github.tddts.jet.config.spring.postprocessor.LoadContentAnnotationBeanPostProcessor.java

@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    Pair<Class<?>, Object> typeObjectPair = SpringUtil.checkForDinamicProxy(bean);
    Class<?> type = typeObjectPair.getLeft();
    Object target = typeObjectPair.getRight();

    try {//from  w  w  w.ja v  a  2  s .  co  m

        for (Field field : type.getDeclaredFields()) {
            if (field.isAnnotationPresent(LoadContent.class) && String.class.equals(field.getType())) {

                field.setAccessible(true);
                String fileName = getFileName(target, field);

                if (!StringUtils.isEmpty(fileName)) {
                    field.set(target, Util.loadContent(fileName));
                }
            }
        }
    } catch (Exception e) {
        throw new BeanInitializationException(e.getMessage(), e);
    }

    return bean;
}

From source file:com.mengka.diamond.server.service.AdminService.java

public synchronized boolean login(String userName, String password) {
    String user = this.properties.getProperty("user");
    String pwd = this.properties.getProperty("password");
    if (StringUtils.isEmpty(user) || StringUtils.isEmpty(pwd)) {
        log.error("admin?config??");
        return false;
    }//from  w  w w  .  ja  va2 s .  co m
    if (user != null && user.equals(userName))
        return pwd.equals(password);
    else
        return false;
}

From source file:org.apache.crunch.dotfile.DotfileService.java

private boolean isEligableFilename(String fileName, String wildCard) {

    if (StringUtils.isEmpty(wildCard)) {
        return fileName.endsWith(DOT);
    }//  w ww.jav  a  2s  . c om

    return fileName.contains(wildCard) && fileName.endsWith(DOT);
}