|
6 | 6 | import java.util.Set;
|
7 | 7 | import java.util.UUID;
|
8 | 8 |
|
| 9 | +import org.slf4j.Logger; |
| 10 | +import org.slf4j.LoggerFactory; |
| 11 | + |
9 | 12 | import no.nav.abakus.iaygrunnlag.request.Dataset;
|
10 | 13 | import no.nav.foreldrepenger.abakus.domene.iay.arbeidsforhold.ArbeidsforholdInformasjon;
|
11 | 14 | import no.nav.foreldrepenger.abakus.domene.iay.arbeidsforhold.ArbeidsforholdInformasjonBuilder;
|
12 |
| -import no.nav.foreldrepenger.abakus.domene.iay.søknad.OppgittOpptjening; |
13 |
| -import no.nav.foreldrepenger.abakus.domene.iay.søknad.OppgittOpptjeningAggregat; |
14 | 15 | import no.nav.foreldrepenger.abakus.domene.iay.søknad.OppgittOpptjeningBuilder;
|
15 | 16 |
|
16 |
| -import org.slf4j.Logger; |
17 |
| -import org.slf4j.LoggerFactory; |
18 |
| - |
19 | 17 | public class InntektArbeidYtelseGrunnlagBuilder {
|
20 | 18 | private static final Logger LOG = LoggerFactory.getLogger(InntektArbeidYtelseGrunnlagBuilder.class);
|
21 | 19 |
|
@@ -50,9 +48,6 @@ public static InntektArbeidYtelseGrunnlagBuilder kopierDeler(InntektArbeidYtelse
|
50 | 48 | if (skalIkkeKopierMed(dataset, Dataset.OPPGITT_OPPTJENING)) {
|
51 | 49 | kladd.setOppgittOpptjening(null);
|
52 | 50 | }
|
53 |
| - if (skalIkkeKopierMed(dataset, Dataset.OPPGITT_OPPTJENING_V2)) { |
54 |
| - kladd.setOppgittOpptjeningAggregat(null); |
55 |
| - } |
56 | 51 | if (skalIkkeKopierMed(dataset, Dataset.OVERSTYRT_OPPGITT_OPPTJENING)) {
|
57 | 52 | kladd.setOverstyrtOppgittOpptjening(null);
|
58 | 53 | }
|
@@ -145,50 +140,19 @@ public InntektArbeidYtelseGrunnlagBuilder medOppgittOpptjening(OppgittOpptjening
|
145 | 140 | if (kladd.getOppgittOpptjening().isPresent()) {
|
146 | 141 | LOG.info("Erstatter eksisterende oppgitt opptjening");
|
147 | 142 | }
|
148 |
| - if (kladd.getOppgittOpptjeningAggregat().isPresent()) { |
149 |
| - throw new IllegalStateException( |
150 |
| - "Utviklerfeil: Har allerede lagt inn oppgitt oppptjening på aggregat. Kan da ikke legge til oppgitt opptjening utenom aggregat."); |
151 |
| - } |
152 | 143 | kladd.setOppgittOpptjening(builder.build());
|
153 | 144 | }
|
154 | 145 | return this;
|
155 | 146 | }
|
156 | 147 |
|
157 |
| - public InntektArbeidYtelseGrunnlagBuilder leggTilOppgittOpptjening(OppgittOpptjeningBuilder builder) { |
158 |
| - if (builder != null) { |
159 |
| - if (kladd.getOppgittOpptjening().isPresent()) { |
160 |
| - throw new IllegalStateException( |
161 |
| - "Utviklerfeil: Har allerede lagt inn oppgitt opptjening utenom aggregat. Kan da ikke legge til oppgitt opptjening på aggregat i tillegg."); |
162 |
| - } |
163 |
| - OppgittOpptjening oppgittOpptjening = builder.build(); |
164 |
| - if (oppgittOpptjening.getJournalpostId() == null) { |
165 |
| - throw new IllegalStateException("Utviklerfeil: Legg-til krever journalpostId."); |
166 |
| - } |
167 |
| - Optional<OppgittOpptjeningAggregat> gammel = kladd.getOppgittOpptjeningAggregat(); |
168 |
| - OppgittOpptjeningAggregat aggregat = gammel.isPresent() ? OppgittOpptjeningAggregat.oppdater(gammel.get(), |
169 |
| - oppgittOpptjening) : OppgittOpptjeningAggregat.ny(oppgittOpptjening); |
170 |
| - |
171 |
| - kladd.setOppgittOpptjeningAggregat(aggregat); |
172 |
| - } |
173 |
| - return this; |
174 |
| - } |
175 |
| - |
176 | 148 | public InntektArbeidYtelseGrunnlagBuilder medOverstyrtOppgittOpptjening(OppgittOpptjeningBuilder builder) {
|
177 | 149 | if (builder != null) {
|
178 | 150 | kladd.setOverstyrtOppgittOpptjening(builder.build());
|
179 |
| - if (kladd.getOppgittOpptjeningAggregat().isPresent()) { |
180 |
| - throw new IllegalStateException( |
181 |
| - "Sanity check: Har allerede lagt inn oppgitt oppptjening på aggregat. Du vil da sannsynligvis ikke overstyre slik."); |
182 |
| - } |
183 | 151 | }
|
184 | 152 | return this;
|
185 | 153 | }
|
186 | 154 |
|
187 | 155 | public InntektArbeidYtelseGrunnlagBuilder fjernOverstyrtOppgittOpptjening() {
|
188 |
| - if (kladd.getOppgittOpptjeningAggregat().isPresent()) { |
189 |
| - throw new IllegalStateException( |
190 |
| - "Sanity check: Har allerede lagt inn oppgitt oppptjening på aggregat. Du vil da sannsynligvis ikke overstyre slik."); |
191 |
| - } |
192 | 156 | kladd.setOverstyrtOppgittOpptjening(null);
|
193 | 157 | return this;
|
194 | 158 | }
|
|
0 commit comments