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:org.psikeds.resolutionengine.rules.EventStack.java

public Event addEvent(final Event e) {
    final String eid = (e == null ? null : e.getEventID());
    return (StringUtils.isEmpty(eid) ? null : this.put(eid, e));
}

From source file:com.graphaware.importer.integration.inserter.PersonImporter.java

@Override
public void processObject(Person person) {
    //for testing purposes, let's say people with empty names are invalid.
    if (StringUtils.isEmpty(person.getName())) {
        throw new RuntimeException("Person has empty name");
    }//from  www . jav a 2  s.  c  om

    personCache.put(person.getId(), context.inserter().createNode(person.getProperties(), label("Person")));
    context.inserter().createRelationship(personCache.get(person.getId()),
            locationCache.get(person.getLocation()), withName("LIVES_IN"),
            Collections.<String, Object>emptyMap());
}

From source file:au.com.ors.rest.bean.JobApplication.java

public String toString() {
    StringBuilder sbUser = new StringBuilder();
    if (!StringUtils.isEmpty(_appId)) {
        sbUser.append("_appId=").append(_appId).append(",");
    }//from  w w  w .j a  va  2  s . c om

    if (!StringUtils.isEmpty(_jobId)) {
        sbUser.append("_jobId=").append(_jobId).append(",");
    }

    if (!StringUtils.isEmpty(driverLicenseNumber)) {
        sbUser.append("driverLicenseNumber=").append(driverLicenseNumber).append(",");
    }

    if (!StringUtils.isEmpty(fullName)) {
        sbUser.append("fullName=").append(fullName).append(",");
    }

    if (!StringUtils.isEmpty(postCode)) {
        sbUser.append("postCode=").append(postCode).append(",");
    }

    if (!StringUtils.isEmpty(textCoverLetter)) {
        sbUser.append("textCoverLetter=true").append(",");
    } else {
        sbUser.append("textCoverLetter=false").append(",");
    }

    if (!StringUtils.isEmpty(textBriefResume)) {
        sbUser.append("textBriefResume=true").append(",");
    } else {
        sbUser.append("textBriefResume=false").append(",");
    }

    if (!StringUtils.isEmpty(status)) {
        sbUser.append("status=" + status);
    }

    return sbUser.toString();
}

From source file:nz.gate5a.schoolstories.importer.NceaQualificationCreator.java

private Long makeLong(String value) {
    if (StringUtils.isEmpty(value)) {
        return null;
    }
    return Long.valueOf(value);
}

From source file:org.terasoluna.gfw.functionaltest.app.ScreenCapture.java

public void saveForced(WebDriver webDriver, String subTitle) {

    TakesScreenshot takesScreenshot = null;
    if (webDriver instanceof TakesScreenshot) {
        takesScreenshot = (TakesScreenshot) webDriver;
    }/*from   w  ww .  j  a  va 2s.c o  m*/
    if (takesScreenshot == null) {
        logger.warn("WebDriver is not supported screenshot. WebDeiver is {}.", webDriver);
        return;
    }

    if (StringUtils.isEmpty(subTitle)) {
        subTitle = "";
    } else {
        subTitle = "-" + subTitle;
    }

    File screenshotFile = takesScreenshot.getScreenshotAs(OutputType.FILE);

    int sequenceNo = sequence.incrementAndGet();
    String evidenceFile = String.format("screen_capture_%03d%s.png", sequenceNo, subTitle);

    try {
        FileUtils.copyFile(screenshotFile, new File(evidenceSavingDirectory, evidenceFile));
    } catch (IOException e) {
        logger.error(e.toString());
    }

}

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

public Relation addRelation(final Relation r) {
    final String rid = (r == null ? null : r.getRelationID());
    return (StringUtils.isEmpty(rid) ? null : this.put(rid, r));
}

From source file:com.jeanchampemont.notedown.utils.UserLocaleResolver.java

@Override
public Locale resolveLocale(HttpServletRequest request) {
    if (SecurityContextHolder.getContext().getAuthentication() == null) {
        return acceptHeaderLocaleResolver.resolveLocale(request);
    }//from   w  w  w . ja v a 2s.  com
    String email = SecurityContextHolder.getContext().getAuthentication().getName();
    Optional<User> user = userService.getUserByEmail(email);
    if (!user.isPresent() || StringUtils.isEmpty(user.get().getLocale())) {
        return acceptHeaderLocaleResolver.resolveLocale(request);
    }
    return user.map(u -> Locale.forLanguageTag(u.getLocale())).get();
}

From source file:com.vcredit.lrh.backend.RabbitConfiguration.java

@Bean
public SimpleMessageListenerContainer scheduleTaskContainer(ConnectionFactory connectionFactory) {
    if (!StringUtils.isEmpty(rabbitMQProperties.getScheduleTaskQueue())) {
        MessageListenerAdapter listener1 = new MessageListenerAdapter(scheduleTaskMessageReceiver,
                "receiveMessage");
        SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
        container.setConnectionFactory(connectionFactory);
        container.setQueueNames(rabbitMQProperties.getScheduleTaskQueue());
        container.setMessageListener(listener1);
        return container;
    } else {//from   www.  j  a  v a 2 s  . c  o  m
        return null;
    }
}

From source file:org.bigtester.ate.TestProjectRunner.java

/**
 * Run test.//from ww w.j av a 2  s  . com
 *
 * @param testProjectXml the test project xml
 * @throws DatabaseUnitException the database unit exception
 * @throws SQLException the SQL exception
 * @throws IOException 
 * @throws ClassNotFoundException 
 * @throws ParseException 
 */
public static void runTest(@Nullable final String testProjectXml)
        throws DatabaseUnitException, SQLException, IOException, ClassNotFoundException, ParseException {
    ApplicationContext context;
    if (StringUtils.isEmpty(testProjectXml)) {
        context = new ClassPathXmlApplicationContext("testproject.xml");
    } else {
        context = new FileSystemXmlApplicationContext(testProjectXml);

    }

    TestProject testplan = GlobalUtils.findTestProjectBean(context);
    testplan.setAppCtx(context);

    TestDatabaseInitializer dbinit = (TestDatabaseInitializer) context
            .getBean(GlobalConstants.BEAN_ID_GLOBAL_DBINITIALIZER);

    dbinit.setSingleInitXmlFile(testplan.getGlobalInitXmlFile());

    //TODO add db initialization handler
    dbinit.initializeGlobalDataFile(context);

    runTest(context);

    ((ConfigurableApplicationContext) context).close();
}

From source file:com.reactivetechnologies.platform.datagrid.core.HazelcastClusterServiceFactoryBean.java

@PostConstruct
private void setUp() {
    if (StringUtils.isEmpty(entityBasePkg))
        throw new BeanCreationException("'entityBasePkg' not specified in factory bean");
}