use of pcgen.persistence.lst.CampaignLoader in project pcgen by PCGen.
the class CampaignFileLoader method initCampaigns.
/**
* Goes through the campaigns in {@link #campaignFiles campaignFiles} and loads
* data associated with dependent campaigns.
*/
private static void initCampaigns() {
// This may modify the globals list; need a local copy so
// the iteration doesn't fail.
Iterable<Campaign> initialCampaigns = new ArrayList<>(Globals.getCampaignList());
CampaignLoader campaignLoader = new CampaignLoader();
for (final Campaign c : initialCampaigns) {
campaignLoader.initRecursivePccFiles(c);
}
}
use of pcgen.persistence.lst.CampaignLoader in project pcgen by PCGen.
the class CampaignFileLoader method loadCampaigns.
/**
* Passes the campaign PCC files referenced by {@link #campaignFiles campaignFiles} to a {@link pcgen.persistence.lst.CampaignLoader CampaignLoader},
* which will load the data within into the {@link pcgen.rules.context.LoadContext LoadContext} of the {@link pcgen.core.Campaign Campaign}.
*/
private void loadCampaigns() {
int progress = 0;
CampaignLoader campaignLoader = new CampaignLoader();
while (!campaignFiles.isEmpty()) {
// Pull the first URI from the list
URI uri = campaignFiles.poll();
// Do not load campaign if already loaded
if (Globals.getCampaignByURI(uri, false) == null) {
try {
// Pass this URI to campaign loader
campaignLoader.loadCampaignLstFile(uri);
} catch (PersistenceLayerException ex) {
// LATER: This is not an appropriate way to deal with this exception.
// Deal with it this way because of the way the loading takes place. XXX
Logging.errorPrint("PersistanceLayer", ex);
}
}
progress++;
setProgress(progress);
}
}
Aggregations