use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.
the class FunctionTokenTest method classSetUp.
@BeforeClass
public static void classSetUp() throws URISyntaxException {
testCampaign = new CampaignSourceEntry(new Campaign(), new URI("file:/Test%20Case"));
classSetUpFired = true;
}
use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.
the class VariableToken method parseTokenWithSeparator.
@Override
protected ParseResult parseTokenWithSeparator(LoadContext context, Campaign campaign, String value) {
CampaignSourceEntry cse = context.getCampaignSourceEntry(campaign, value);
if (cse == null) {
//Error
return ParseResult.INTERNAL_ERROR;
}
if (!cse.getIncludeItems().isEmpty()) {
return new ParseResult.Fail(getTokenName() + " does not support Include");
}
if (!cse.getExcludeItems().isEmpty()) {
return new ParseResult.Fail(getTokenName() + " does not support Exclude");
}
if (!cse.getPrerequisites().isEmpty()) {
return new ParseResult.Fail(getTokenName() + " does not support Prerequisites");
}
context.getObjectContext().addToList(campaign, ListKey.FILE_VARIABLE, cse);
return ParseResult.SUCCESS;
}
use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.
the class VariableToken method unparse.
@Override
public String[] unparse(LoadContext context, Campaign campaign) {
Changes<CampaignSourceEntry> cseChanges = context.getObjectContext().getListChanges(campaign, ListKey.FILE_VARIABLE);
Collection<CampaignSourceEntry> added = cseChanges.getAdded();
if (added == null) {
//empty indicates no token
return null;
}
Set<String> set = new TreeSet<>();
for (CampaignSourceEntry cse : added) {
set.add(cse.getLSTformat());
}
return set.toArray(new String[set.size()]);
}
use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.
the class DynamicToken method unparse.
@Override
public String[] unparse(LoadContext context, Campaign campaign) {
Changes<CampaignSourceEntry> cseChanges = context.getObjectContext().getListChanges(campaign, ListKey.FILE_DYNAMIC);
Collection<CampaignSourceEntry> added = cseChanges.getAdded();
if (added == null) {
//empty indicates no token
return null;
}
Set<String> set = new TreeSet<>();
for (CampaignSourceEntry cse : added) {
set.add(cse.getLSTformat());
}
return set.toArray(new String[set.size()]);
}
use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.
the class LogoToken method parseTokenWithSeparator.
@Override
protected ParseResult parseTokenWithSeparator(LoadContext context, Campaign campaign, String value) {
CampaignSourceEntry cse = context.getCampaignSourceEntry(campaign, value);
if (cse == null) {
//Error
return ParseResult.INTERNAL_ERROR;
}
if (!cse.getIncludeItems().isEmpty()) {
return new ParseResult.Fail(getTokenName() + " does not allow INCLUDE: " + value, context);
}
if (!cse.getExcludeItems().isEmpty()) {
return new ParseResult.Fail(getTokenName() + " does not allow EXCLUDE: " + value, context);
}
context.getObjectContext().addToList(campaign, ListKey.FILE_LOGO, cse);
return ParseResult.SUCCESS;
}
Aggregations