use of no.seres.xsd.nav.inntektsmelding_m._20181211.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;
}
use of no.seres.xsd.nav.inntektsmelding_m._20181211.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;
}
use of no.seres.xsd.nav.inntektsmelding_m._20181211.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()));
}
use of no.seres.xsd.nav.inntektsmelding_m._20181211.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);
}
use of no.seres.xsd.nav.inntektsmelding_m._20181211.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);
}
Aggregations