use of no.nav.vedtak.felles.xml.soeknad.v1.ObjectFactory in project BibleMultiConverter by schierlm.
the class USX3 method doExportBook.
@Override
protected void doExportBook(ParatextBook book, File outFile) throws Exception {
ObjectFactory of = new ObjectFactory();
Usx usx = of.createUsx();
usx.setVersion("3.0");
usx.setBook(of.createBook());
usx.getBook().setStyle("id");
usx.getBook().setCode(book.getId().getIdentifier());
usx.getBook().setContent(book.getBibleName());
for (Map.Entry<String, String> attr : book.getAttributes().entrySet()) {
Para para = new Para();
para.setStyle(ParaStyle.fromValue(attr.getKey()));
para.getContent().add(attr.getValue());
usx.getParaOrTableOrChapter().add(para);
}
book.accept(new ParatextBook.ParatextBookContentVisitor<IOException>() {
List<Object> currentContent = null;
Table currentTable = null;
@Override
public void visitChapterStart(ChapterIdentifier location) throws IOException {
Chapter ch = new Chapter();
ch.setStyle("c");
ch.setSid(location.toString());
ch.setNumber(BigInteger.valueOf(location.chapter));
usx.getParaOrTableOrChapter().add(ch);
currentContent = null;
currentTable = null;
}
@Override
public void visitChapterEnd(ChapterIdentifier location) throws IOException {
Chapter ch = new Chapter();
ch.setEid(location.toString());
usx.getParaOrTableOrChapter().add(ch);
currentContent = null;
currentTable = null;
}
@Override
public void visitParagraphStart(ParatextBook.ParagraphKind kind) throws IOException {
if (kind == ParatextBook.ParagraphKind.TABLE_ROW) {
if (currentTable == null) {
currentTable = new Table();
usx.getParaOrTableOrChapter().add(currentTable);
}
Row row = new Row();
row.setStyle("tr");
currentTable.getRow().add(row);
currentContent = currentTable.getRow().get(currentTable.getRow().size() - 1).getVerseOrCell();
} else {
Para para = new Para();
para.setStyle(PARA_KIND_MAP.get(kind));
usx.getParaOrTableOrChapter().add(para);
currentContent = para.getContent();
currentTable = null;
}
}
@Override
public void visitTableCellStart(String tag) throws IOException {
if (currentTable == null) {
System.out.println("WARNING: Table cell outside of table");
return;
}
Row currentRow = currentTable.getRow().get(currentTable.getRow().size() - 1);
Cell cell = new Cell();
cell.setAlign(tag.contains("r") ? CellAlign.END : CellAlign.START);
cell.setStyle(CellStyle.fromValue(tag));
currentRow.getVerseOrCell().add(cell);
currentContent = cell.getContent();
}
@Override
public void visitParatextCharacterContent(ParatextCharacterContent content) throws IOException {
if (currentContent == null)
visitParagraphStart(ParatextBook.ParagraphKind.PARAGRAPH_P);
content.accept(new USX3.USXCharacterContentVisitor(currentContent));
}
});
JAXBContext ctx = JAXBContext.newInstance(ObjectFactory.class.getPackage().getName());
Marshaller m = ctx.createMarshaller();
if (!Boolean.getBoolean("biblemulticonverter.skipxmlvalidation"))
m.setSchema(getSchema());
m.marshal(usx, new UnifiedScriptureXMLWriter(new FileWriter(outFile), "UTF-8"));
}
use of no.nav.vedtak.felles.xml.soeknad.v1.ObjectFactory in project geo-platform by geosdi.
the class QueryRestrictionsBuilderTest method createFilterType.
/**
* @return {@link FilterType}
*/
private FilterType createFilterType() {
FilterType filter = new FilterType();
BBox bbox = new BBox(14.131237640976908, 36.56356461583572, 15.821758881211283, 37.143760728459014);
BBOXType bBoxType = new BBOXType();
PropertyNameType propertyNameType = new PropertyNameType();
propertyNameType.setContent(Arrays.asList("the_geom"));
bBoxType.setPropertyName(propertyNameType);
EnvelopeType envelope = new EnvelopeType();
DirectPositionType lower = new DirectPositionType();
lower.setValue(asList(bbox.getMinX(), bbox.getMinY()));
envelope.setLowerCorner(lower);
DirectPositionType upper = new DirectPositionType();
upper.setValue(asList(bbox.getMaxX(), bbox.getMaxY()));
envelope.setUpperCorner(upper);
envelope.setSrsName("EPSG:4326");
bBoxType.setEnvelope(new ObjectFactory().createEnvelope(envelope));
filter.setSpatialOps(new org.geosdi.geoplatform.xml.filter.v110.ObjectFactory().createBBOX(bBoxType));
return filter;
}
use of no.nav.vedtak.felles.xml.soeknad.v1.ObjectFactory in project cxf by apache.
the class AbstractSequenceTest method testIdentifierEquals.
@Test
public void testIdentifierEquals() {
Identifier id1 = null;
Identifier id2 = null;
assertTrue(AbstractSequence.identifierEquals(id1, id2));
ObjectFactory factory = new ObjectFactory();
id1 = factory.createIdentifier();
id1.setValue("seq1");
assertFalse(AbstractSequence.identifierEquals(id1, id2));
id2 = factory.createIdentifier();
id2.setValue("seq2");
assertFalse(AbstractSequence.identifierEquals(id1, id2));
id2.setValue("seq1");
assertTrue(AbstractSequence.identifierEquals(id1, id2));
}
use of no.nav.vedtak.felles.xml.soeknad.v1.ObjectFactory in project cxf by apache.
the class RMSoapOutInterceptorTest method setUpOutbound.
private void setUpOutbound() {
ObjectFactory factory = new ObjectFactory();
s1 = factory.createSequenceType();
Identifier sid = factory.createIdentifier();
sid.setValue("sequence1");
s1.setIdentifier(sid);
s1.setMessageNumber(ONE);
s2 = factory.createSequenceType();
sid = factory.createIdentifier();
sid.setValue("sequence2");
s2.setIdentifier(sid);
s2.setMessageNumber(TEN);
ack1 = factory.createSequenceAcknowledgement();
SequenceAcknowledgement.AcknowledgementRange r = factory.createSequenceAcknowledgementAcknowledgementRange();
r.setLower(ONE);
r.setUpper(ONE);
ack1.getAcknowledgementRange().add(r);
ack1.setIdentifier(s1.getIdentifier());
ack2 = factory.createSequenceAcknowledgement();
r = factory.createSequenceAcknowledgementAcknowledgementRange();
r.setLower(ONE);
r.setUpper(TEN);
ack2.getAcknowledgementRange().add(r);
ack2.setIdentifier(s2.getIdentifier());
ar1 = factory.createAckRequestedType();
ar1.setIdentifier(s1.getIdentifier());
ar2 = factory.createAckRequestedType();
ar2.setIdentifier(s2.getIdentifier());
}
use of no.nav.vedtak.felles.xml.soeknad.v1.ObjectFactory in project cxf by apache.
the class AbstractTypeTestClient2 method testChoiceWithSubstitutionGroupAbstract.
@Test
public void testChoiceWithSubstitutionGroupAbstract() throws Exception {
if (!shouldRunTest("ChoiceWithSubstitutionGroupAbstract")) {
return;
}
SgDerivedTypeB derivedB = new SgDerivedTypeB();
derivedB.setVarInt(new BigInteger("32"));
derivedB.setVarString("foo");
SgDerivedTypeC derivedC = new SgDerivedTypeC();
derivedC.setVarInt(new BigInteger("32"));
derivedC.setVarFloat(3.14f);
ObjectFactory objectFactory = new ObjectFactory();
JAXBElement<? extends SgBaseTypeA> elementB = objectFactory.createSg03DerivedElementB(derivedB);
JAXBElement<? extends SgBaseTypeA> elementC = objectFactory.createSg03DerivedElementC(derivedC);
ChoiceWithSubstitutionGroupAbstract x = new ChoiceWithSubstitutionGroupAbstract();
x.setSg03AbstractBaseElementA(elementC);
ChoiceWithSubstitutionGroupAbstract yOrig = new ChoiceWithSubstitutionGroupAbstract();
yOrig.setSg03AbstractBaseElementA(elementB);
Holder<ChoiceWithSubstitutionGroupAbstract> y = new Holder<>(yOrig);
Holder<ChoiceWithSubstitutionGroupAbstract> z = new Holder<>();
ChoiceWithSubstitutionGroupAbstract ret;
if (testDocLiteral) {
ret = docClient.testChoiceWithSubstitutionGroupAbstract(x, y, z);
} else if (testXMLBinding) {
ret = xmlClient.testChoiceWithSubstitutionGroupAbstract(x, y, z);
} else {
ret = rpcClient.testChoiceWithSubstitutionGroupAbstract(x, y, z);
}
if (!perfTestOnly) {
assertTrue("testChoiceWithSubstitutionGroupAbstract(): Incorrect value for inout param", equals(x, y.value));
assertTrue("testChoiceWithSubstitutionGroupAbstract(): Incorrect value for out param", equals(yOrig, z.value));
assertTrue("testChoiceWithSubstitutionGroupAbstract(): Incorrect return value", equals(x, ret));
}
}
Aggregations