Created
February 20, 2011 00:08
-
-
Save magomi/835534 to your computer and use it in GitHub Desktop.
everything is fine now
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
public class CommitSumImpl implements Commits { | |
private static final Logger log = LoggerFactory.getLogger(CommitSumImpl.class); | |
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)) { | |
log.trace("curKey = {}", curKey); | |
Collection<DataSource<?>> dataSources = repository.getData(curKey); | |
for (DataSource<?> curDataSource : dataSources) { | |
log.trace("curDataSource = {}", curDataSource); | |
if (curDataSource instanceof CommitSumImpl) { | |
continue; | |
} | |
if (curDataSource instanceof Commits) { | |
List<Commit> newCommits = ((Commits) curDataSource).getValue(); | |
if (newCommits != null) { | |
ret.addAll(newCommits); | |
} | |
} | |
} | |
} | |
return ret; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment