use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.ObjectFactory in project fp-kontrakter by navikt.
the class ParseSoeknadTest method skal_marshalle_til_xml.
@Test
public void skal_marshalle_til_xml() throws Exception {
LocalDate dato = LocalDate.now();
Soeknad søknad = new Soeknad();
søknad.setMottattDato(dato);
Bruker bruker = new Bruker();
bruker.setAktoerId("12345678901");
Brukerroller brukerroller = new Brukerroller();
brukerroller.setKode("MOR");
bruker.setSoeknadsrolle(brukerroller);
søknad.setSoeker(bruker);
søknad.setSoeker(bruker);
Foreldrepenger foreldrepenger = new Foreldrepenger();
foreldrepenger.setAnnenForelder(new UkjentForelder());
Dekningsgrader dekningsgrader = new Dekningsgrader();
dekningsgrader.setKode("100");
Dekningsgrad dekningsgrad = new Dekningsgrad();
dekningsgrad.setDekningsgrad(dekningsgrader);
foreldrepenger.setDekningsgrad(dekningsgrad);
MorsAktivitetsTyper mat = new MorsAktivitetsTyper();
mat.setKode("-");
mat.setKodeverk("MORS_AKTIVITET");
Uttaksperiodetyper utyp = new Uttaksperiodetyper();
utyp.setKode("MØDREKVOTE");
utyp.setKodeverk("UTTAK_PERIODE");
Uttaksperiode uttaksperiode = new Uttaksperiode();
uttaksperiode.setOenskerSamtidigUttak(false);
uttaksperiode.setMorsAktivitetIPerioden(mat);
uttaksperiode.setType(utyp);
uttaksperiode.setFom(dato.minusDays(10));
uttaksperiode.setTom(dato.plusDays(10));
Fordeling fordeling = new Fordeling();
fordeling.setAnnenForelderErInformert(true);
fordeling.getPerioder().add(uttaksperiode);
foreldrepenger.setFordeling(fordeling);
Rettigheter rettigheter = new Rettigheter();
rettigheter.setHarAleneomsorgForBarnet(false);
rettigheter.setHarAnnenForelderRett(true);
rettigheter.setHarOmsorgForBarnetIPeriodene(true);
foreldrepenger.setRettigheter(rettigheter);
Foedsel relasjonTilBarnet = new Foedsel();
relasjonTilBarnet.setAntallBarn(1);
relasjonTilBarnet.setFoedselsdato(dato.minusDays(10));
foreldrepenger.setRelasjonTilBarnet(relasjonTilBarnet);
Medlemskap medlemskap = new Medlemskap();
medlemskap.setBoddINorgeSiste12Mnd(true);
medlemskap.setBorINorgeNeste12Mnd(true);
medlemskap.setINorgeVedFoedselstidspunkt(true);
Periode periode = new Periode();
periode.setFom(dato.minusYears(1));
periode.setTom(dato.plusYears(1));
OppholdNorge oppholdNorge = new OppholdNorge();
oppholdNorge.setPeriode(periode);
medlemskap.getOppholdNorge().add(oppholdNorge);
foreldrepenger.setMedlemskap(medlemskap);
OmYtelse omYtelse = new ObjectFactory().createOmYtelse();
omYtelse.getAny().add(new no.nav.vedtak.felles.xml.soeknad.foreldrepenger.v2.ObjectFactory().createForeldrepenger(foreldrepenger));
søknad.setOmYtelse(omYtelse);
String xml = JaxbHelper.marshalAndValidateJaxb(SøknadConstants.JAXB_CLASS, new no.nav.vedtak.felles.xml.soeknad.v2.ObjectFactory().createSoeknad(søknad), "xsd/soeknad-v2.xsd", new String[] { "xsd/uttak/uttak-v2.xsd", "xsd/foreldrepenger/foreldrepenger-v2.xsd", "xsd/endringssoeknad/endringssoeknad-v2.xsd", "xsd/engangsstoenad/engangsstoenad-v2.xsd" }, SøknadConstants.ADDITIONAL_CLASSES);
assertThat(xml).isNotBlank();
Soeknad søknad2 = JaxbHelper.unmarshalAndValidateXMLWithStAX(Soeknad.class, xml, "xsd/soeknad-v2.xsd", new String[] { "xsd/engangsstoenad/engangsstoenad-v2.xsd", "xsd/foreldrepenger/foreldrepenger-v2.xsd", "xsd/endringssoeknad/endringssoeknad-v2.xsd" }, SøknadConstants.ADDITIONAL_CLASSES);
assertThat(søknad).isEqualToComparingFieldByFieldRecursively(søknad2);
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.ObjectFactory in project fix-orchestra by FIXTradingCommunity.
the class RepositoryCompressor method compress.
private boolean compress(InputStream is, OutputStream os, Predicate<? super MessageType> messagePredicate) {
try {
final Repository inRepository = unmarshal(is);
final Categories categories = inRepository.getCategories();
isCategoryInSection.setCategories(categories.getCategory());
final Repository outRepository = new Repository();
inRepository.copyTo(null, outRepository, AttributeCopyStrategy.INSTANCE);
final ElementOrRefinementContainer metadata = (ElementOrRefinementContainer) inRepository.getMetadata().clone();
final List<JAXBElement<SimpleLiteral>> literals = metadata.getAny();
final ObjectFactory objectFactory = new ObjectFactory();
final SimpleLiteral contributor = new SimpleLiteral();
contributor.getContent().add("RepositoryCompressor");
literals.add(objectFactory.createContributor(contributor));
outRepository.setMetadata(metadata);
if (categories != null) {
outRepository.setCategories((Categories) categories.clone());
}
final Sections sections = inRepository.getSections();
if (sections != null) {
outRepository.setSections((Sections) sections.clone());
}
final Datatypes datatypes = inRepository.getDatatypes();
if (datatypes != null) {
outRepository.setDatatypes((Datatypes) datatypes.clone());
}
final Actors actors = inRepository.getActors();
if (actors != null) {
outRepository.setActors((Actors) actors.clone());
}
final Components components = inRepository.getComponents();
if (components != null) {
final Components inComponents = (Components) components.clone();
componentList = inComponents.getComponent();
}
final Groups groups = inRepository.getGroups();
if (groups != null) {
final Groups inGroups = (Groups) groups.clone();
groupList = inGroups.getGroup();
}
final Messages messages = inRepository.getMessages();
final List<MessageType> messageList;
if (messages != null) {
final Messages inMessages = (Messages) messages.clone();
messageList = inMessages.getMessage();
} else {
messageList = Collections.emptyList();
}
final List<MessageType> filteredMessages = messageList.stream().filter(messagePredicate).collect(Collectors.toList());
filteredMessages.forEach(m -> walk(m.getStructure().getComponentRefOrGroupRefOrFieldRef()));
final List<BigInteger> distinctFieldIds = fieldIdList.stream().distinct().collect(Collectors.toList());
final Fields inFields = (Fields) inRepository.getFields().clone();
final List<FieldType> fieldsWithFlow = inFields.getField().stream().filter(f -> distinctFieldIds.contains(f.getId())).collect(Collectors.toList());
final Fields outFields = new Fields();
outFields.getField().addAll(fieldsWithFlow);
outRepository.setFields(outFields);
final List<String> typeList = fieldsWithFlow.stream().map(FieldType::getType).distinct().collect(Collectors.toList());
final CodeSets inCodeSets = (CodeSets) inRepository.getCodeSets().clone();
final List<CodeSetType> codeSetsWithFlow = inCodeSets.getCodeSet().stream().filter(cs -> typeList.contains(cs.getName())).collect(Collectors.toList());
final CodeSets outCodeSets = new CodeSets();
outCodeSets.getCodeSet().addAll(codeSetsWithFlow);
outRepository.setCodeSets(outCodeSets);
final List<BigInteger> distinctComponentsIds = componentIdList.stream().distinct().collect(Collectors.toList());
final List<ComponentType> componentsWithFlow = componentList.stream().filter(c -> distinctComponentsIds.contains(c.getId())).collect(Collectors.toList());
final Components outComponents = new Components();
outComponents.getComponent().addAll(componentsWithFlow);
outRepository.setComponents(outComponents);
final List<BigInteger> distinctGroupIds = groupIdList.stream().distinct().collect(Collectors.toList());
final List<GroupType> groupWithFlow = groupList.stream().filter(c -> distinctGroupIds.contains(c.getId())).collect(Collectors.toList());
final Groups outGroups = new Groups();
outGroups.getGroup().addAll(groupWithFlow);
outRepository.setGroups(outGroups);
final Messages outMessages = new Messages();
outMessages.getMessage().addAll(filteredMessages);
outRepository.setMessages(outMessages);
marshal(outRepository, os);
return true;
} catch (JAXBException e) {
logger.fatal("RepositoryCompressor failed", e);
return false;
}
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.ObjectFactory in project phoss-smp by phax.
the class MainCreate1MillionEndpoints method main.
public static void main(final String[] args) throws Throwable {
final SMPServerRESTTestRule aRule = new SMPServerRESTTestRule(ClassPathResource.getAsFile("test-smp-server-mongodb.properties").getAbsolutePath());
aRule.before();
try {
// Set the special PhotonSecurityManager factory
PhotonSecurityManager.setFactory(new PhotonSecurityManagerFactoryMongoDB());
final ObjectFactory aObjFactory = new ObjectFactory();
final PeppolDocumentTypeIdentifier aDT = EPredefinedDocumentTypeIdentifier.INVOICE_EN16931_PEPPOL_V30.getAsDocumentTypeIdentifier();
final String sDT = aDT.getURIEncoded();
final PeppolProcessIdentifier aProcID = EPredefinedProcessIdentifier.BIS3_BILLING.getAsProcessIdentifier();
final StopWatch aSWOverall = StopWatch.createdStarted();
for (int i = 639276; i < 1_000_000; ++i) {
final StopWatch aSW = StopWatch.createdStarted();
final PeppolParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("9999:test-philip-" + StringHelper.getLeadingZero(i, 7));
final String sPI = aPI.getURIEncoded();
final ServiceMetadataType aSM = new ServiceMetadataType();
final ServiceInformationType aSI = new ServiceInformationType();
aSI.setParticipantIdentifier(new SimpleParticipantIdentifier(aPI));
aSI.setDocumentIdentifier(aDT);
{
final ProcessListType aPL = new ProcessListType();
final ProcessType aProcess = new ProcessType();
aProcess.setProcessIdentifier(aProcID);
final ServiceEndpointList aSEL = new ServiceEndpointList();
final EndpointType aEndpoint = new EndpointType();
aEndpoint.setEndpointReference(W3CEndpointReferenceHelper.createEndpointReference("http://test.smpserver/as2"));
aEndpoint.setRequireBusinessLevelSignature(false);
aEndpoint.setCertificate("blacert");
aEndpoint.setServiceDescription("Unit test service");
aEndpoint.setTechnicalContactUrl("https://github.com/phax/phoss-smp");
aEndpoint.setTransportProfile(ESMPTransportProfile.TRANSPORT_PROFILE_AS2.getID());
aSEL.addEndpoint(aEndpoint);
aProcess.setServiceEndpointList(aSEL);
aPL.addProcess(aProcess);
aSI.setProcessList(aPL);
}
aSM.setServiceInformation(aSI);
try (final WebScoped aWS = new WebScoped(new MockHttpServletRequest())) {
// Delete old - don't care about the result
if (false)
ClientBuilder.newClient().target(aRule.getFullURL()).path(sPI).path("services").path(sDT).request().header(CHttpHeader.AUTHORIZATION, CREDENTIALS.getRequestValue()).delete();
// Create a new
final Response aResponseMsg = ClientBuilder.newClient().target(aRule.getFullURL()).path(sPI).path("services").path(sDT).request().header(CHttpHeader.AUTHORIZATION, CREDENTIALS.getRequestValue()).put(Entity.xml(aObjFactory.createServiceMetadata(aSM)));
_testResponseJerseyClient(aResponseMsg, 200);
}
aSW.stop();
LOGGER.info(sPI + " took " + aSW.getMillis() + " ms");
}
aSWOverall.stop();
LOGGER.info("Overall process took " + aSWOverall.getMillis() + " ms or " + aSWOverall.getDuration());
} finally {
aRule.after();
}
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.ObjectFactory in project testnorge by navikt.
the class ArbeidsforholdDTO method toXmlElement.
@Override
public XMLArbeidsforhold toXmlElement() {
ObjectFactory factory = new ObjectFactory();
XMLArbeidsforhold xmlArbeidsforhold = factory.createXMLArbeidsforhold();
if (utsettelseAvForeldrepengerListe != null) {
XMLUtsettelseAvForeldrepengerListe xmlUtsettelseAvForeldrepengerListe = factory.createXMLUtsettelseAvForeldrepengerListe();
xmlUtsettelseAvForeldrepengerListe.withUtsettelseAvForeldrepenger(UtsettelseAvForeldrepengerDTO.convert(utsettelseAvForeldrepengerListe));
xmlArbeidsforhold.setUtsettelseAvForeldrepengerListe(factory.createXMLArbeidsforholdUtsettelseAvForeldrepengerListe(xmlUtsettelseAvForeldrepengerListe));
}
if (graderingIForeldrepengerListe != null) {
XMLGraderingIForeldrepengerListe xmlGraderingIForeldrepengerListe = factory.createXMLGraderingIForeldrepengerListe();
xmlGraderingIForeldrepengerListe.withGraderingIForeldrepenger(GraderingIForeldrepengerDTO.convert(graderingIForeldrepengerListe));
xmlArbeidsforhold.setGraderingIForeldrepengerListe(factory.createXMLArbeidsforholdGraderingIForeldrepengerListe(xmlGraderingIForeldrepengerListe));
}
if (avtaltFerieListe != null) {
XMLAvtaltFerieListe xmlAvtaltFerieListe = factory.createXMLAvtaltFerieListe();
xmlAvtaltFerieListe.withAvtaltFerie(PeriodeDTO.convert(avtaltFerieListe));
xmlArbeidsforhold.setAvtaltFerieListe(factory.createXMLArbeidsforholdAvtaltFerieListe(xmlAvtaltFerieListe));
}
if (beregnetInntekt != null) {
xmlArbeidsforhold.setBeregnetInntekt(factory.createXMLArbeidsforholdBeregnetInntekt(beregnetInntekt.toXmlElement()));
}
if (Strings.isNotBlank(arbeidsforholdId)) {
xmlArbeidsforhold.setArbeidsforholdId(factory.createXMLArbeidsforholdArbeidsforholdId(arbeidsforholdId));
}
xmlArbeidsforhold.setFoersteFravaersdag(factory.createXMLArbeidsforholdFoersteFravaersdag(foersteFravaersdag));
return xmlArbeidsforhold;
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.ObjectFactory in project testnorge by navikt.
the class ArbeidsgiverDTO method toXmlElement.
@Override
public XMLArbeidsgiver toXmlElement() {
ObjectFactory factory = new ObjectFactory();
XMLArbeidsgiver xmlArbeidsgiver = factory.createXMLArbeidsgiver();
xmlArbeidsgiver.setVirksomhetsnummer(virksomhetsnummer);
if (kontaktinformasjon != null) {
xmlArbeidsgiver.setKontaktinformasjon(kontaktinformasjon.toXmlElement());
}
return xmlArbeidsgiver;
}
Aggregations