| name | mottatteopplysninger |
| description | Received application data (MottatteOpplysninger) patterns for A1 applications, SED-based cases, and exception requests. Use when working with application forms, person/employer data, work locations, or modifying MottatteOpplysningerData subclasses. Triggers: "mottatteopplysninger", "søknad data", "application form", "MottatteOpplysningerData".
|
MottatteOpplysninger Domain
MottatteOpplysninger stores received application data for a Behandling. Data is persisted as JSON and deserialized to type-specific subclasses.
Architecture
┌─────────────────────────────────────────────────────────────────────┐
│ MottatteOpplysninger (Entity) │
│ - id, behandling, type, versjon, jsonData, originalData │
│ - mottatteOpplysningerData (Transient - deserialized from JSON) │
└──────────────────────────────────┬──────────────────────────────────┘
│
┌──────────────────────┴──────────────────────┐
│ MottatteOpplysningerKonverterer │
│ - Maps type → class for deserialization │
│ - Triggered by MottatteOpplysningerListener│
└──────────────────────┬──────────────────────┘
│
┌──────────────────────────────────┴──────────────────────────────────┐
│ MottatteOpplysningerData (Base) │
│ - soeknadsland, periode, personOpplysninger │
│ - arbeidPaaLand, foretakUtland, maritimtArbeid, luftfartBaser │
│ - juridiskArbeidsgiverNorge, selvstendigArbeid, bosted, oppholdUtl │
└─────────────────────────────────────────────────────────────────────┘
│ │ │ │
▼ ▼ ▼ ▼
┌─────────┐ ┌───────────┐ ┌─────────────┐ ┌──────────────┐
│ Soeknad │ │SedGrunnlag│ │Anmodning- │ │SøknadNorge- │
│ (EØS) │ │ (SED) │ │EllerAttest │ │EllerUtenforEØS│
└─────────┘ └───────────┘ └─────────────┘ └──────────────┘
Type Mapping
| Mottatteopplysningertyper | Class | Use Case |
|---|
SØKNAD_A1_YRKESAKTIVE_EØS | Soeknad | A1 for occupationally active (employed or self-employed) in EEA |
SØKNAD_A1_UTSENDTE_ARBEIDSTAKERE_EØS | Soeknad | A1 for posted workers |
SØKNAD_YRKESAKTIVE_NORGE_ELLER_UTENFOR_EØS | SøknadNorgeEllerUtenforEØS | FTRL/bilateral |
SØKNAD_IKKE_YRKESAKTIV | SøknadIkkeYrkesaktiv | Non-occupationally active |
SED | SedGrunnlag | From SED documents |
ANMODNING_ELLER_ATTEST | AnmodningEllerAttest | Exception requests (anmodning) and incoming attests |
Key Files
| File | Purpose |
|---|
domain/.../MottatteOpplysninger.java | JPA entity |
domain/.../MottatteOpplysningerData.java | Base data class |
domain/.../MottatteOpplysningerKonverterer.java | JSON ↔ Object conversion |
domain/.../jpa/MottatteOpplysningerListener.java | JPA lifecycle hooks |
service/.../MottatteOpplysningerService.kt | Business logic |
frontend-api/.../MottatteOpplysningerController.java | REST endpoints |
Data Structure
Base Fields (MottatteOpplysningerData)
soeknadsland: Soeknadsland
periode: Periode
personOpplysninger: OpplysningerOmBrukeren
arbeidPaaLand: ArbeidPaaLand
foretakUtland: List<ForetakUtland>
maritimtArbeid: List<MaritimtArbeid>
luftfartBaser: List<LuftfartBase>
juridiskArbeidsgiverNorge: JuridiskArbeidsgiverNorge
selvstendigArbeid: SelvstendigArbeid
bosted: Bosted
oppholdUtland: OppholdUtland
Soeknad Extensions
loennOgGodtgjoerelse: LoennOgGodtgjoerelse
arbeidsgiversBekreftelse: ArbeidsgiversBekreftelse
utenlandsoppdraget: Utenlandsoppdraget
arbeidssituasjonOgOevrig: ArbeidssituasjonOgOevrig
SedGrunnlag Extensions
overgangsregelbestemmelser: List<Overgangsregelbestemmelser>
ytterligereInformasjon: String?
AnmodningEllerAttest Extensions
avsenderland: Land_iso2?
lovvalgsland: Land_iso2?
Common Patterns
Creating MottatteOpplysninger
mottatteOpplysningerService.opprettSøknadEllerAnmodningEllerAttest(
behandling, periode, soeknadsland
)
mottatteOpplysningerService.opprettSedGrunnlag(behandlingId, sedGrunnlag)
mottatteOpplysningerService.opprettSøknadUtsendteArbeidstakereEøs(
behandlingID, originalData, soeknad, eksternReferanseID
)
Accessing Data
val mottatteOpplysninger = mottatteOpplysningerService.hentMottatteOpplysninger(behandlingId)
val data = mottatteOpplysninger.mottatteOpplysningerData
when (data) {
is Soeknad -> data.loennOgGodtgjoerelse
is SedGrunnlag -> data.overgangsregelbestemmelser
is AnmodningEllerAttest -> data.avsenderland
}
Updating Data
mottatteOpplysningerService.oppdaterMottatteOpplysninger(behandlingId, jsonNode)
val mo = hentMottatteOpplysninger(behandlingId)
mo.mottatteOpplysningerData.periode = newPeriode
mottatteOpplysningerService.oppdaterMottatteOpplysninger(mo)
Serialization Notes
- Uses Jackson 3.x (
tools.jackson) with only KotlinModule registered (.addModule(new KotlinModule.Builder().build()))
@JsonIgnoreProperties(ignoreUnknown = true) on base class
- Converter uses
EnumMap<Mottatteopplysningertyper, Class> for type mapping
- JPA listener auto-converts on load/persist
Helper Methods
hentAlleOrganisasjonsnumre()
hentUtenlandskeArbeidsstederLandkode()
hentUtenlandskeArbeidsgivereUuid()
hentFnrMedfølgendeBarn()
hentMedfølgendeBarn()
hentMedfølgendeEktefelle()
Testing
Test factories (Kotlin DSL builders):
domain/src/test/kotlin/.../MottatteOpplysningerTestFactory.kt – mottatteOpplysningerForTest { ... }
domain/src/test/kotlin/.../SoeknadTestFactory.kt – soeknadForTest { ... }
val mottatteOpplysninger = mottatteOpplysningerForTest {
type = Mottatteopplysningertyper.SØKNAD_A1_YRKESAKTIVE_EØS
mottatteOpplysningerData = soeknadForTest {
periode(fom = LocalDate.now(), tom = LocalDate.now().plusMonths(12))
landkoder("DE")
fysiskeArbeidssted { landkode = "DE" }
utenlandskIdent(ident = "12345", landkode = "DE")
}
}
val mo = mottatteOpplysningerForTest { soeknad { landkoder("DE") } }
Note: OpplysningerOmBrukeren has no fnr; it exposes utenlandskIdent, medfolgendeFamilie and foedestedOgLand.