Search in sources :

Example 36 with ObjectFactory

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project RouteConverter by cpesch.

the class GoPal5RouteFormat method createDestination.

private Tour.Destination createDestination(GoPalPosition position) {
    ObjectFactory objectFactory = new ObjectFactory();
    Tour.Destination destination = objectFactory.createTourDestination();
    Tour.Destination.Coordinates coordinates = objectFactory.createTourDestinationCoordinates();
    if (position.getX() != null)
        coordinates.setMercatorx(position.getX());
    if (position.getY() != null)
        coordinates.setMercatory(position.getY());
    if (position.getLongitude() != null)
        coordinates.setLongitude(formatPosition(position.getLongitude()));
    if (position.getLatitude() != null)
        coordinates.setLatitude(formatPosition(position.getLatitude()));
    destination.setCoordinates(coordinates);
    Tour.Destination.City city = objectFactory.createTourDestinationCity();
    city.setName(position.getCity());
    city.setSuburb(position.getSuburb());
    destination.setCity(city);
    Tour.Destination.Country country = objectFactory.createTourDestinationCountry();
    if (position.getCountry() != null)
        country.setCode(position.getCountry());
    destination.setCountry(country);
    Tour.Destination.State state = objectFactory.createTourDestinationState();
    if (position.getState() != null)
        state.setName(position.getState());
    destination.setState(state);
    Tour.Destination.HouseNumber houseNumber = objectFactory.createTourDestinationHouseNumber();
    if (position.getHouseNumber() != null) {
        houseNumber.setValue(position.getHouseNumber());
        houseNumber.setType("middle_of_street");
    }
    destination.setHouseNumber(houseNumber);
    Tour.Destination.Street street = objectFactory.createTourDestinationStreet();
    street.setName(position.getStreet());
    if (position.getHouseNumber() != null)
        street.setHouseNumberAvailable("no");
    destination.setStreet(street);
    Tour.Destination.SideStreet sideStreet = objectFactory.createTourDestinationSideStreet();
    sideStreet.setName(position.getSideStreet());
    destination.setSideStreet(sideStreet);
    Tour.Destination.Zip zip = objectFactory.createTourDestinationZip();
    zip.setCode(position.getZipCode());
    destination.setZip(zip);
    return destination;
}
Also used : ObjectFactory(slash.navigation.gopal.binding5.ObjectFactory) Tour(slash.navigation.gopal.binding5.Tour)

Example 37 with ObjectFactory

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project RouteConverter by cpesch.

the class GoPal7RouteFormat method createRouteOptions.

private Tour.RouteOptions createRouteOptions(GoPalRoute route) {
    Tour.RouteOptions options = route.getOptions(Tour.RouteOptions.class);
    if (options == null) {
        ObjectFactory objectFactory = new ObjectFactory();
        options = objectFactory.createTourRouteOptions();
        Tour.RouteOptions.NaviMode naviMode = objectFactory.createTourRouteOptionsNaviMode();
        // bicycle, car, motorbike, pedestrian
        naviMode.setValue(preferences.get(VERSION_PREFIX + "naviMode", "motorbike"));
        options.setNaviMode(naviMode);
        Tour.RouteOptions.OptimizationMode optimizationMode = objectFactory.createTourRouteOptionsOptimizationMode();
        // fast, short
        optimizationMode.setValue(preferences.get(VERSION_PREFIX + "optimizationMode", "short"));
        options.setOptimizationMode(optimizationMode);
        Tour.RouteOptions.TTIBypass bypass = objectFactory.createTourRouteOptionsTTIBypass();
        // automatic, disabled, manual
        bypass.setCalculation(preferences.get(VERSION_PREFIX + "ttiBypass", "automatic"));
        bypass.setMode("avoid");
        options.setTTIBypass(bypass);
        Tour.RouteOptions.RoadUsageTypes usageTypes = objectFactory.createTourRouteOptionsRoadUsageTypes();
        Tour.RouteOptions.RoadUsageTypes.CarTrains carTrains = objectFactory.createTourRouteOptionsRoadUsageTypesCarTrains();
        // avoid, use, prohibit
        carTrains.setMode(preferences.get(VERSION_PREFIX + "carTrains", "use"));
        usageTypes.setCarTrains(carTrains);
        Tour.RouteOptions.RoadUsageTypes.Ferries ferries = objectFactory.createTourRouteOptionsRoadUsageTypesFerries();
        // avoid, use, prohibit
        ferries.setMode(preferences.get(VERSION_PREFIX + "ferries", "avoid"));
        usageTypes.setFerries(ferries);
        Tour.RouteOptions.RoadUsageTypes.IPDRoads ipdRoads = objectFactory.createTourRouteOptionsRoadUsageTypesIPDRoads();
        // avoid, use, prohibit
        ipdRoads.setMode(preferences.get(VERSION_PREFIX + "ipdRoads", "use"));
        usageTypes.setIPDRoads(ipdRoads);
        Tour.RouteOptions.RoadUsageTypes.MotorWays motorWays = objectFactory.createTourRouteOptionsRoadUsageTypesMotorWays();
        // avoid, use, prohibit
        motorWays.setMode(preferences.get(VERSION_PREFIX + "motorWays", "avoid"));
        usageTypes.setMotorWays(motorWays);
        Tour.RouteOptions.RoadUsageTypes.SeasonalRestrictedRoads seasonalRestrictedRoads = objectFactory.createTourRouteOptionsRoadUsageTypesSeasonalRestrictedRoads();
        // avoid, use, prohibit
        seasonalRestrictedRoads.setMode(preferences.get(VERSION_PREFIX + "seasonalRestrictedRoads", "use"));
        usageTypes.setSeasonalRestrictedRoads(seasonalRestrictedRoads);
        Tour.RouteOptions.RoadUsageTypes.SpecialChargeRoads specialChargeRoads = objectFactory.createTourRouteOptionsRoadUsageTypesSpecialChargeRoads();
        // avoid, use, prohibit
        specialChargeRoads.setMode(preferences.get(VERSION_PREFIX + "specialChargeRoads", "avoid"));
        usageTypes.setSpecialChargeRoads(specialChargeRoads);
        Tour.RouteOptions.RoadUsageTypes.TimeRestrictedRoads timeRestrictedRoads = objectFactory.createTourRouteOptionsRoadUsageTypesTimeRestrictedRoads();
        // avoid, use, prohibit
        timeRestrictedRoads.setMode(preferences.get(VERSION_PREFIX + "timeRestrictedRoads", "use"));
        usageTypes.setTimeRestrictedRoads(timeRestrictedRoads);
        Tour.RouteOptions.RoadUsageTypes.TollRoads tollRoads = objectFactory.createTourRouteOptionsRoadUsageTypesTollRoads();
        // avoid, use, prohibit
        tollRoads.setMode(preferences.get(VERSION_PREFIX + "tollRoads", "avoid"));
        usageTypes.setTollRoads(tollRoads);
        Tour.RouteOptions.RoadUsageTypes.TrafficFlowInfo trafficFlowInfo = objectFactory.createTourRouteOptionsRoadUsageTypesTrafficFlowInfo();
        // avoid, use, prohibit
        trafficFlowInfo.setMode(preferences.get(VERSION_PREFIX + "trafficFlowInfo", "use"));
        usageTypes.setTrafficFlowInfo(trafficFlowInfo);
        Tour.RouteOptions.RoadUsageTypes.Tunnels tunnels = objectFactory.createTourRouteOptionsRoadUsageTypesTunnels();
        // avoid, use, prohibit
        tunnels.setMode(preferences.get(VERSION_PREFIX + "tunnels", "use"));
        usageTypes.setTunnels(tunnels);
        Tour.RouteOptions.RoadUsageTypes.UnpavedRoads unpavedRoads = objectFactory.createTourRouteOptionsRoadUsageTypesUnpavedRoads();
        // avoid, use, prohibit
        unpavedRoads.setMode(preferences.get(VERSION_PREFIX + "unpavedRoads", "avoid"));
        usageTypes.setUnpavedRoads(unpavedRoads);
        options.setRoadUsageTypes(usageTypes);
        Tour.RouteOptions.TravelSpeeds travelSpeeds = objectFactory.createTourRouteOptionsTravelSpeeds();
        Tour.RouteOptions.TravelSpeeds.Bicycle bicycle = objectFactory.createTourRouteOptionsTravelSpeedsBicycle();
        // Km/h
        bicycle.setSpeed(formatSpeed(preferences.getDouble(VERSION_PREFIX + "bicycleSpeed", 14.4)));
        bicycle.setUnit(ROUTE_OPTIONS_SPEED_UNIT);
        travelSpeeds.setBicycle(bicycle);
        Tour.RouteOptions.TravelSpeeds.Pedestrian pedestrian = objectFactory.createTourRouteOptionsTravelSpeedsPedestrian();
        // Km/h
        pedestrian.setSpeed(formatSpeed(preferences.getDouble(VERSION_PREFIX + "pedestrianSpeed", 3.6)));
        pedestrian.setUnit(ROUTE_OPTIONS_SPEED_UNIT);
        travelSpeeds.setPedestrian(pedestrian);
        Tour.RouteOptions.TravelSpeeds.Vehicle vehicle = objectFactory.createTourRouteOptionsTravelSpeedsVehicle();
        // Km/h
        vehicle.setSpeed(formatSpeed(preferences.getDouble(VERSION_PREFIX + "vehicleSpeed", 80.0)));
        vehicle.setUnit(ROUTE_OPTIONS_SPEED_UNIT);
        Tour.RouteOptions.TravelSpeeds.Vehicle.MotorWay motorWay = objectFactory.createTourRouteOptionsTravelSpeedsVehicleMotorWay();
        // Km/h
        motorWay.setSpeed(formatSpeed(preferences.getDouble(VERSION_PREFIX + "vehicleSpeedMotorWay", 120.0)));
        motorWay.setUnit(ROUTE_OPTIONS_SPEED_UNIT);
        vehicle.setMotorWay(motorWay);
        Tour.RouteOptions.TravelSpeeds.Vehicle.PedestrianArea pedestrianArea = objectFactory.createTourRouteOptionsTravelSpeedsVehiclePedestrianArea();
        // Km/h
        pedestrianArea.setSpeed(formatSpeed(preferences.getDouble(VERSION_PREFIX + "vehicleSpeedPedestrianArea", 7.2)));
        pedestrianArea.setUnit(ROUTE_OPTIONS_SPEED_UNIT);
        vehicle.setPedestrianArea(pedestrianArea);
        travelSpeeds.setVehicle(vehicle);
        options.setTravelSpeeds(travelSpeeds);
    }
    return options;
}
Also used : ObjectFactory(slash.navigation.gopal.binding5.ObjectFactory) Tour(slash.navigation.gopal.binding5.Tour)

Example 38 with ObjectFactory

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project RouteConverter by cpesch.

the class GoPal7RouteFormat method createStart.

private Tour.Start createStart(GoPalPosition position) {
    ObjectFactory objectFactory = new ObjectFactory();
    Tour.Start start = objectFactory.createTourStart();
    Tour.Start.Coordinates coordinates = objectFactory.createTourStartCoordinates();
    if (position.getX() != null)
        coordinates.setMercatorx(position.getX());
    if (position.getY() != null)
        coordinates.setMercatory(position.getY());
    if (position.getLongitude() != null)
        coordinates.setLongitude(formatPosition(position.getLongitude()));
    if (position.getLatitude() != null)
        coordinates.setLatitude(formatPosition(position.getLatitude()));
    start.setCoordinates(coordinates);
    Tour.Start.City city = objectFactory.createTourStartCity();
    city.setName(position.getCity());
    city.setSuburb(position.getSuburb());
    start.setCity(city);
    Tour.Start.Country country = objectFactory.createTourStartCountry();
    country.setCode(formatCountry(position));
    start.setCountry(country);
    Tour.Start.State state = objectFactory.createTourStartState();
    if (position.getState() != null)
        state.setName(position.getState());
    start.setState(state);
    Tour.Start.HouseNumber houseNumber = objectFactory.createTourStartHouseNumber();
    if (position.getHouseNumber() != null) {
        houseNumber.setValue(position.getHouseNumber());
        houseNumber.setType("middle_of_street");
    }
    start.setHouseNumber(houseNumber);
    Tour.Start.Street street = objectFactory.createTourStartStreet();
    street.setName(position.getStreet());
    if (position.getHouseNumber() != null)
        street.setHouseNumberAvailable("no");
    start.setStreet(street);
    Tour.Start.SideStreet sideStreet = objectFactory.createTourStartSideStreet();
    sideStreet.setName(position.getSideStreet());
    start.setSideStreet(sideStreet);
    Tour.Start.Zip zip = objectFactory.createTourStartZip();
    zip.setCode(position.getZipCode());
    start.setZip(zip);
    return start;
}
Also used : ObjectFactory(slash.navigation.gopal.binding5.ObjectFactory) Tour(slash.navigation.gopal.binding5.Tour)

Example 39 with ObjectFactory

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project peppol-commons by phax.

the class SMPExtensionConverterTest method testConvertFromExtensionType.

@Test
public void testConvertFromExtensionType() {
    // Try converting an empty extension
    assertNull(SMPExtensionConverter.convertToString((ExtensionType) null));
    assertNull(SMPExtensionConverter.convertToString(new ObjectFactory().createExtensionType()));
}
Also used : ObjectFactory(com.helger.xsds.peppol.smp1.ObjectFactory) ExtensionType(com.helger.xsds.peppol.smp1.ExtensionType) Test(org.junit.Test)

Example 40 with ObjectFactory

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.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);
    rettigheter.setHarMorUforetrygd(false);
    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.v3.ObjectFactory().createForeldrepenger(foreldrepenger));
    søknad.setOmYtelse(omYtelse);
    String xml = JaxbHelper.marshalAndValidateJaxb(SøknadConstants.JAXB_CLASS, new no.nav.vedtak.felles.xml.soeknad.v3.ObjectFactory().createSoeknad(søknad), "xsd/soeknad-v3.xsd", new String[] { "xsd/uttak/uttak-v3.xsd", "xsd/foreldrepenger/foreldrepenger-v3.xsd", "xsd/endringssoeknad/endringssoeknad-v3.xsd", "xsd/engangsstoenad/engangsstoenad-v3.xsd" }, SøknadConstants.ADDITIONAL_CLASSES);
    assertThat(xml).isNotBlank();
    Soeknad søknad2 = JaxbHelper.unmarshalAndValidateXMLWithStAX(Soeknad.class, xml, "xsd/soeknad-v3.xsd", new String[] { "xsd/engangsstoenad/engangsstoenad-v3.xsd", "xsd/foreldrepenger/foreldrepenger-v3.xsd", "xsd/endringssoeknad/endringssoeknad-v3.xsd" }, SøknadConstants.ADDITIONAL_CLASSES);
    assertThat(søknad).isEqualToComparingFieldByFieldRecursively(søknad2);
}
Also used : OmYtelse(no.nav.vedtak.felles.xml.soeknad.v3.OmYtelse) UkjentForelder(no.nav.vedtak.felles.xml.soeknad.felles.v3.UkjentForelder) LocalDate(java.time.LocalDate) Foedsel(no.nav.vedtak.felles.xml.soeknad.felles.v3.Foedsel) MorsAktivitetsTyper(no.nav.vedtak.felles.xml.soeknad.kodeverk.v3.MorsAktivitetsTyper) Rettigheter(no.nav.vedtak.felles.xml.soeknad.felles.v3.Rettigheter) Medlemskap(no.nav.vedtak.felles.xml.soeknad.felles.v3.Medlemskap) ObjectFactory(no.nav.vedtak.felles.xml.soeknad.v3.ObjectFactory) Foreldrepenger(no.nav.vedtak.felles.xml.soeknad.foreldrepenger.v3.Foreldrepenger) Brukerroller(no.nav.vedtak.felles.xml.soeknad.kodeverk.v3.Brukerroller) Fordeling(no.nav.vedtak.felles.xml.soeknad.uttak.v3.Fordeling) Periode(no.nav.vedtak.felles.xml.soeknad.felles.v3.Periode) Bruker(no.nav.vedtak.felles.xml.soeknad.felles.v3.Bruker) Uttaksperiode(no.nav.vedtak.felles.xml.soeknad.uttak.v3.Uttaksperiode) Dekningsgrader(no.nav.vedtak.felles.xml.soeknad.kodeverk.v3.Dekningsgrader) Dekningsgrad(no.nav.vedtak.felles.xml.soeknad.foreldrepenger.v3.Dekningsgrad) OppholdNorge(no.nav.vedtak.felles.xml.soeknad.felles.v3.OppholdNorge) Uttaksperiodetyper(no.nav.vedtak.felles.xml.soeknad.kodeverk.v3.Uttaksperiodetyper) Soeknad(no.nav.vedtak.felles.xml.soeknad.v3.Soeknad) Test(org.junit.jupiter.api.Test)

Aggregations

JAXBElement (javax.xml.bind.JAXBElement)35 Test (org.junit.Test)29 ArrayList (java.util.ArrayList)26 Marshaller (javax.xml.bind.Marshaller)24 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)20 StringWriter (java.io.StringWriter)19 JAXBContext (javax.xml.bind.JAXBContext)19 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)18 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)17 ObjectFactory (no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory)16 QName (javax.xml.namespace.QName)15 BigInteger (java.math.BigInteger)13 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)13 XStream (com.thoughtworks.xstream.XStream)12 ByteArrayInputStream (java.io.ByteArrayInputStream)12 GetRecordsResponseType (net.opengis.cat.csw.v_2_0_2.GetRecordsResponseType)12 SearchResultsType (net.opengis.cat.csw.v_2_0_2.SearchResultsType)12 ObjectFactory (slash.navigation.kml.binding22.ObjectFactory)12 ObjectFactory (com.opensymphony.xwork2.ObjectFactory)11 ElementSetNameType (net.opengis.cat.csw.v_2_0_2.ElementSetNameType)11