
com.opentext.ia.sdk.sip.TemplatePdiAssembler Maven / Gradle / Ivy
/*
* Copyright (c) 2016-2017 by OpenText Corporation. All Rights Reserved.
*/
package com.opentext.ia.sdk.sip;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
/**
* Assemble a PDI using a {@linkplain Template}.
* @param The type of domain objects to assemble
*/
public class TemplatePdiAssembler extends PdiAssembler {
private final Template template;
/**
* Create an instance that doesn't validate the PDI.
* @param template The template to use
*/
public TemplatePdiAssembler(Template template) {
this(template, null);
}
/**
* Create an instance.
* @param template The template to use
* @param validator Optional validator to check the assembled product
*/
public TemplatePdiAssembler(Template template, Validator validator) {
super(validator);
this.template = template;
}
@Override
protected final void start(PrintWriter writer) throws IOException {
template.writeHeader(writer);
}
@Override
protected final void add(D domainObject, Map contentInfo, PrintWriter writer)
throws IOException {
template.writeRow(domainObject, contentInfo, writer);
}
@Override
protected final void end(PrintWriter writer) throws IOException {
template.writeFooter(writer);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy