Package nl.topicus.onderwijs.dashboard.modules.standard

Source Code of nl.topicus.onderwijs.dashboard.modules.standard.CommitSumImpl

package nl.topicus.onderwijs.dashboard.modules.standard;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import nl.topicus.onderwijs.dashboard.datasources.Commits;
import nl.topicus.onderwijs.dashboard.datatypes.Commit;
import nl.topicus.onderwijs.dashboard.keys.Key;
import nl.topicus.onderwijs.dashboard.modules.DataSource;
import nl.topicus.onderwijs.dashboard.modules.DashboardRepository;
import nl.topicus.onderwijs.dashboard.web.WicketApplication;

public class CommitSumImpl implements Commits {
  public CommitSumImpl() {
  }

  @Override
  public List<Commit> getValue() {
    List<Commit> ret = new ArrayList<Commit>();
    DashboardRepository repository = WicketApplication.get().getRepository();
    for (Key curKey : repository.getKeys(Key.class)) {
      Collection<DataSource<?>> dataSources = repository.getData(curKey);
      for (DataSource<?> curDataSource : dataSources) {
        if (curDataSource instanceof CommitSumImpl)
          continue;
        if (curDataSource instanceof Commits) {
          List<Commit> newCommits = ((Commits) curDataSource)
              .getValue();
          if (newCommits != null)
            ret.addAll(newCommits);
        }
      }
    }
    return ret;
  }

}
TOP

Related Classes of nl.topicus.onderwijs.dashboard.modules.standard.CommitSumImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.