Example usage for org.springframework.util Assert hasLength

List of usage examples for org.springframework.util Assert hasLength

Introduction

In this page you can find the example usage for org.springframework.util Assert hasLength.

Prototype

@Deprecated
public static void hasLength(@Nullable String text) 

Source Link

Document

Assert that the given String is not empty; that is, it must not be null and not the empty String.

Usage

From source file:org.jcf.graphicMessage.GraphicObjectFactory.java

/**
 * creating new PointImpl object with new id and new Location
 * @param nikName Nikname inside room//  w  ww  .  j a v  a  2  s  .c o m
 * @param room name of the room
 * @param loc Location instance
 * @return new created PointImpl object
 */
public static Point createPoint(String nikName, String room, Location loc) {
    Assert.hasLength(nikName);
    Assert.hasLength(room);
    Assert.notNull(loc);

    Id id = IdFactory.getNextId(room, nikName);
    Point p = new PointImpl(id);
    p.addLocation(loc);
    return p;
}

From source file:com.github.qwazer.markdown.confluence.gradle.plugin.ConfluenceGradleTask.java

protected static void validate(ConfluenceConfig config) {
    Assert.notNull(config);//from w  w  w . ja  v a2 s . c  o  m
    Assert.hasLength(config.getRestApiUrl());
    Assert.hasLength(config.getSpaceKey());
    Assert.notNull(config.getPages());

    for (ConfluenceConfig.Page page : config.getPages()) {
        Assert.hasLength(page.getParentTitle());
        Assert.hasLength(page.getTitle());
        Assert.notNull(page.getSrcFile());
        Assert.isTrue(!page.getParentTitle().equals(page.getTitle()),
                String.format("Page with title %s cannot be parent of itself ", page.getTitle()));
    }
    validateNoDuplicates(config.getPages());
}

From source file:com.smhdemo.common.report.service.ChartService.java

@Override
public Long addChart(Chart vo) {
    Assert.notNull(vo);// w w  w  .  ja va 2 s. c  o  m
    Assert.hasLength(vo.getChartSql());

    Set<Parameter> parameters = ChartAnalysisUtil.analysisSql(vo.getChartSql());
    vo.setParameters(parameters);

    chartDao.persist(vo);
    return vo.getId();
}

From source file:com.graphaware.importer.cache.BaseCaches.java

/**
 * {@inheritDoc}/*from ww  w .ja v  a2 s. com*/
 */
@Override
public void createCache(String cacheName, Class<?> keyType, Class<?> valueType) {
    Assert.hasLength(cacheName);
    Assert.notNull(keyType);
    Assert.notNull(valueType);

    if (caches.containsKey(cacheName)) {
        throw new IllegalStateException("Cache " + cacheName + " has already been created");
    }

    caches.put(cacheName, doCreateCache(cacheName, keyType, valueType));
}

From source file:com.graphaware.importer.config.BaseImportConfig.java

/**
 * Construct a new config.//from w ww . j  a  v a2 s .  c om
 *
 * @param graphDir  directory where the database will be stored. Must not be <code>null</code> or empty.
 * @param outputDir directory where other files produced by the import will be stored. Must not be <code>null</code> or empty.
 * @param props     path to Neo4j properties used during the import. Must not be <code>null</code> or empty.
 */
protected BaseImportConfig(String graphDir, String outputDir, String props) {
    Assert.hasLength(graphDir);
    Assert.hasLength(outputDir);
    Assert.hasLength(props);

    this.graphDir = graphDir;
    this.outputDir = outputDir;
    this.props = props;
}

From source file:com.acc.storefront.filters.btg.support.impl.DefaultUrlParsingStrategy.java

@Override
public void afterPropertiesSet() {
    if (urlPathHelper == null) {
        urlPathHelper = new UrlPathHelper();
    }/*from  ww w.  ja  va 2  s .  c  om*/
    Assert.hasLength(regex);
    pattern = Pattern.compile(regex);
}

From source file:com.sshdemo.common.report.manage.service.ChartReportService.java

@Override
public Long addChartReport(ChartReport chartReport) {
    Assert.notNull(chartReport);/*from www.  j av a2s.co m*/
    Assert.hasLength(chartReport.getChartSql());

    Set<Parameter> parameters = ChartAnalysisUtil.analysisSql(chartReport.getChartSql());
    chartReport.setParameters(parameters);

    chartReportDAO.persist(chartReport);
    return chartReport.getId();
}

From source file:com.graphaware.importer.data.access.DbDataReader.java

/**
 * Construct a new reader.//from   ww  w  .  ja v a2 s  .co  m
 *
 * @param dbHost   db host. Must not be <code>null</code> or empty.
 * @param dbPort   db port. Must not be <code>null</code> or empty.
 * @param user     db user. Must not be <code>null</code>.
 * @param password db password. Must not be <code>null</code>.
 */
public DbDataReader(String dbHost, String dbPort, String user, String password) {
    Assert.hasLength(dbHost);
    Assert.hasLength(dbPort);
    Assert.notNull(user);
    Assert.notNull(password);

    this.dbHost = dbHost;
    this.dbPort = dbPort;
    this.user = user;
    this.password = password;
}

From source file:com.smhdemo.common.report.service.ChartService.java

@Override
public Long updChart(Chart vo) {
    Assert.notNull(vo);/*from w  w  w  .  j a va  2 s.  com*/
    Assert.hasLength(vo.getChartSql());

    Chart entity = chartDao.get(vo.getId());

    entity.setName(vo.getName());
    entity.setBaseDS(vo.getBaseDS());
    entity.setType(vo.getType());
    entity.setShowTooltips(vo.getShowTooltips());
    entity.setChartTitle(vo.getChartTitle());
    entity.setFontName(vo.getFontName());
    entity.setFontSize(vo.getFontSize());
    entity.setFontStyle(vo.getFontStyle());
    entity.setHorizAxisLabel(vo.getHorizAxisLabel());
    entity.setVertAxisLabel(vo.getVertAxisLabel());
    entity.setDataFontName(vo.getDataFontName());
    entity.setDataFontSize(vo.getDataFontSize());
    entity.setDataFontStyle(vo.getDataFontStyle());
    entity.setAxisFontName(vo.getAxisFontName());
    entity.setAxisFontSize(vo.getAxisFontSize());
    entity.setAxisFontStyle(vo.getAxisFontStyle());
    entity.setAxisTickFontName(vo.getAxisTickFontName());
    entity.setAxisTickFontSize(vo.getAxisTickFontSize());
    entity.setAxisTickFontStyle(vo.getAxisTickFontStyle());
    entity.setTickLabelRotate(vo.getTickLabelRotate());
    entity.setShowLegend(vo.getShowLegend());
    entity.setLegendPosition(vo.getLegendPosition());
    entity.setLegendFontName(vo.getLegendFontName());
    entity.setLegendFontSize(vo.getLegendFontSize());
    entity.setLegendFontStyle(vo.getLegendFontStyle());
    entity.setChartHeight(vo.getChartHeight());
    entity.setChartWidth(vo.getChartWidth());
    entity.setBgColorB(vo.getBgColorB());
    entity.setBgColorG(vo.getBgColorG());
    entity.setBgColorR(vo.getBgColorR());
    entity.setRemark(vo.getRemark());
    entity.setUpdateDate(new Date(Calendar.getInstance().getTime().getTime()));

    if (!entity.getChartSql().equals(vo.getChartSql())) {
        entity.setChartSql(vo.getChartSql());
        Set<Parameter> oldParameters = entity.getParameters();
        oldParameters.clear();
        Set<Parameter> newParameters = ChartAnalysisUtil.analysisSql(vo.getChartSql());
        for (Parameter newParameter : newParameters) {
            oldParameters.add(newParameter);
        }
        entity.setParameters(oldParameters);
    }
    chartDao.merge(entity);
    return vo.getId();
}

From source file:tomekkup.helenos.ClusterConfiguration.java

public Map<String, ?> toParametersMap() {
    Assert.hasLength(hosts);
    Assert.hasLength(clusterName);/*from   www  .  j a  v a 2  s . co  m*/

    Map<String, Object> map = new HashMap<String, Object>(3);
    map.put("alias", alias);
    map.put("hosts", hosts);
    map.put("clustername", clusterName);
    map.put("active", active);
    return map;
}