コード例 #1
0
  @Override
  public Map<String, Source> getSourceMap() {

    Query query = getCurrentSession().createQuery("FROM Source");

    @SuppressWarnings("unchecked")
    List<Source> sources = query.list();

    if (sources == null) return Collections.emptyMap();

    Map<String, Source> sourceMap = new HashMap<String, Source>();
    for (Source source : sources) {
      sourceMap.put(source.getSourceType().toString(), source);
    }

    return sourceMap;
  }
コード例 #2
0
  @Override
  public Map<SourceType, Boolean> getActiveSourceMap() {
    Query query = getCurrentSession().createQuery("FROM Source");

    @SuppressWarnings("unchecked")
    List<Source> sources = query.list();

    if (sources == null) return Collections.emptyMap();

    Map<SourceType, Boolean> activeSourceMap = new HashMap<SourceType, Boolean>();
    for (Source source : sources) {
      activeSourceMap.put(source.getSourceType(), source.isActive());
    }

    if (activeSourceMap.isEmpty()) return Collections.emptyMap();

    return activeSourceMap;
  }