use of org.kitodo.api.docket.DocketData in project kitodo-production by kitodo.
the class ExportXmlLog method startMultipleExport.
/**
* This method exports the production metadata for al list of processes as a
* single file to a given stream.
*
* @param docketDataList
* a list of Docket data
* @param outputStream
* The output stream, to write the docket to.
*/
void startMultipleExport(Iterable<DocketData> docketDataList, OutputStream outputStream) {
Document answer = new Document();
Element root = new Element("processes");
answer.setRootElement(root);
Namespace xmlns = Namespace.getNamespace(NAMESPACE);
Namespace xsi = Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
root.addNamespaceDeclaration(xsi);
root.setNamespace(xmlns);
Attribute attSchema = new Attribute("schemaLocation", NAMESPACE + " XML-logfile.xsd", xsi);
root.setAttribute(attSchema);
for (DocketData docketData : docketDataList) {
Document doc = createDocument(docketData, false);
Element processRoot = doc.getRootElement();
processRoot.detach();
root.addContent(processRoot);
}
XMLOutputter outp = new XMLOutputter(Format.getPrettyFormat());
try {
outp.output(answer, outputStream);
} catch (IOException e) {
logger.error("Generating XML Output failed.", e);
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
logger.error("Closing the output stream failed.", e);
}
}
}
}
use of org.kitodo.api.docket.DocketData in project kitodo-production by kitodo.
the class DocketDataGenerator method createDocketData.
public DocketData createDocketData(String processID, String signatur, String docType) {
DocketData docketdata = new DocketData();
docketdata.setCreationDate("01.01.2100");
docketdata.setProcessId(processID);
docketdata.setProcessName("ProcessTitle");
docketdata.setProjectName("projectTitle");
docketdata.setRulesetName("RulesetTitle");
docketdata.setComment("A comment");
List<Property> templateProperties = new ArrayList<>();
Property propertyForDocket = new Property();
propertyForDocket.setId(12345);
propertyForDocket.setTitle("Signatur");
propertyForDocket.setValue(signatur);
templateProperties.add(propertyForDocket);
docketdata.setTemplateProperties(templateProperties);
List<Property> workpieceProperties = new ArrayList<>();
Property workpiecePropertyForDocket = new Property();
workpiecePropertyForDocket.setId(12345);
workpiecePropertyForDocket.setTitle("docType");
workpiecePropertyForDocket.setValue(docType);
workpieceProperties.add(workpiecePropertyForDocket);
docketdata.setWorkpieceProperties(workpieceProperties);
List<org.kitodo.api.docket.Property> processProperties = new ArrayList<>();
org.kitodo.api.docket.Property processPropertyForDocket = new org.kitodo.api.docket.Property();
processPropertyForDocket.setId(12345);
processPropertyForDocket.setTitle("digitalCollection");
processPropertyForDocket.setValue("Musik");
processProperties.add(processPropertyForDocket);
docketdata.setProcessProperties(processProperties);
return docketdata;
}
use of org.kitodo.api.docket.DocketData in project kitodo-production by kitodo.
the class ProcessService method getDocketData.
/**
* Creates the DocketData for a given Process.
*
* @param process
* The process to create the docket data for.
* @return The DocketData for the process.
*/
private DocketData getDocketData(Process process) {
DocketData docketdata = new DocketData();
docketdata.setCreationDate(process.getCreationDate().toString());
docketdata.setProcessId(process.getId().toString());
docketdata.setProcessName(process.getTitle());
docketdata.setProjectName(process.getProject().getTitle());
docketdata.setRulesetName(process.getRuleset().getTitle());
docketdata.setComment(process.getWikiField());
if (!process.getTemplates().isEmpty()) {
docketdata.setTemplateProperties(getDocketDataForProperties(process.getTemplates()));
}
if (!process.getWorkpieces().isEmpty()) {
docketdata.setWorkpieceProperties(getDocketDataForProperties(process.getWorkpieces()));
}
docketdata.setProcessProperties(getDocketDataForProperties(process.getProperties()));
return docketdata;
}
Aggregations