MCPcopy Create free account
hub / github.com/PCGen/pcgen / exportParty

Method exportParty

code/src/java/pcgen/system/BatchExporter.java:160–195  ·  view source on GitHub ↗

Export a party sheet for the party to the output file using the pre-registered template. If the output file is null then a default file will be used based on the party file name and the type of export template in use. If the output file exists it will be overwritten. This method will load the re

(String partyFilename, String outputFile)

Source from the content-addressed store, hash-verified

158 * @return true if the export was successful, false if it failed in some way.
159 */
160 boolean exportParty(String partyFilename, String outputFile)
161 {
162 File file = new File(partyFilename);
163 if (!PCGFile.isPCGenPartyFile(file))
164 {
165 Logging.errorPrint("Invalid party file specified: " + file.getAbsolutePath());
166 return false;
167 }
168 String outFilename = outputFile;
169 if (outFilename == null)
170 {
171 outFilename = generateOutputFilename(partyFilename);
172 }
173 Logging.log(Logging.INFO, "Started export of party " + file.getAbsolutePath() + " using "
174 + exportTemplateFilename + " to " + outFilename);
175
176 // Load data
177 SourceSelectionFacade sourcesForCharacter = CharacterManager.getRequiredSourcesForParty(file, uiDelegate);
178 SourceFileLoader loader = new SourceFileLoader(uiDelegate, sourcesForCharacter.getCampaigns(), sourcesForCharacter.getGameMode().get().getName());
179 loader.run();
180
181 // Load party
182 PartyFacade party = CharacterManager.openParty(file, uiDelegate, loader.getDataSetFacade());
183
184 // Export party
185 File templateFile = new File(exportTemplateFilename);
186 File outFile = new File(outFilename);
187 if (isPdf)
188 {
189 return exportPartyToPDF(party, outFile, templateFile);
190 }
191 else
192 {
193 return exportPartyToNonPDF(party, outFile, templateFile);
194 }
195 }
196
197 /**
198 * Write a PDF character sheet for the character to the output file. The

Callers 2

exportPartyToPDFMethod · 0.95
startupWithoutGUIMethod · 0.95

Calls 15

isPCGenPartyFileMethod · 0.95
errorPrintMethod · 0.95
logMethod · 0.95
getCampaignsMethod · 0.95
getGameModeMethod · 0.95
runMethod · 0.95
openPartyMethod · 0.95
getDataSetFacadeMethod · 0.95
exportPartyToPDFMethod · 0.95
exportPartyToNonPDFMethod · 0.95

Tested by

no test coverage detected