Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add common dateDayMonthYear class #152

Open
wants to merge 3 commits into
base: feature/map-pscs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@
import org.mapstruct.Mappings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.annotation.RequestScope;
import org.springframework.web.util.UriTemplate;
import uk.gov.companieshouse.api.ApiClient;
import uk.gov.companieshouse.api.error.ApiErrorResponseException;
import uk.gov.companieshouse.api.handler.exception.URIValidationException;
import uk.gov.companieshouse.api.model.officerappointments.OfficerAppointmentsApi;
import uk.gov.companieshouse.api.model.officers.CompanyOfficerApi;
import uk.gov.companieshouse.document.generator.common.descriptions.RetrieveApiEnumerationDescription;
import uk.gov.companieshouse.document.generator.company.report.exception.MapperException;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.common.DateDayMonthYear;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.currentappointments.items.CurrentOfficer;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.currentappointments.items.DateOfBirth;
import uk.gov.companieshouse.document.generator.company.report.service.CompanyReportApiClientService;

import java.time.LocalDate;
Expand Down Expand Up @@ -64,7 +59,7 @@ protected void formatOfficerDateOfBirth(CompanyOfficerApi companyOfficerApi,

if (companyOfficerApi.getDateOfBirth() != null) {

DateOfBirth dob = new DateOfBirth();
DateDayMonthYear dob = new DateDayMonthYear();
String monthString = getNameOfMonth(companyOfficerApi);

dob.setYear(companyOfficerApi.getDateOfBirth().getYear());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import org.mapstruct.Mappings;
import org.springframework.web.context.annotation.RequestScope;
import uk.gov.companieshouse.api.model.company.CompanyProfileApi;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.common.DateDayMonthYear;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.keyfilingdates.KeyFilingDates;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.keyfilingdates.items.AccountingReferenceDate;

@RequestScope
@Mapper(componentModel = "spring")
Expand Down Expand Up @@ -91,7 +91,7 @@ private void formatConfirmationStatementLastMadeUpTo(CompanyProfileApi companyPr
}

private void formatAccountingReferenceDate(CompanyProfileApi companyProfileApi, @MappingTarget KeyFilingDates keyFilingDates) {
AccountingReferenceDate accountingReferenceDate = new AccountingReferenceDate();
DateDayMonthYear accountingReferenceDate = new DateDayMonthYear();
String monthString = getNameOfMonth(companyProfileApi);

accountingReferenceDate.setDay(companyProfileApi.getAccounts().getAccountingReferenceDate().getDay());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import uk.gov.companieshouse.api.model.psc.PscApi;
import uk.gov.companieshouse.document.generator.common.descriptions.RetrieveApiEnumerationDescription;
import uk.gov.companieshouse.document.generator.company.report.exception.MapperException;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.common.DateOfBirth;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.common.DateDayMonthYear;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.pscs.items.NaturesOfControl;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.pscs.items.Psc;

Expand Down Expand Up @@ -66,7 +66,7 @@ protected void setCeasedOnDate(PscApi pscApi, @MappingTarget Psc psc) {
protected void setDateOfBirth(PscApi pscApi, @MappingTarget Psc psc) {

if (pscApi != null && pscApi.getDateOfBirth() != null) {
DateOfBirth dob = new DateOfBirth();
DateDayMonthYear dob = new DateDayMonthYear();
String monthString = getNameOfMonth(pscApi);

dob.setYear(pscApi.getDateOfBirth().getYear());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.registrationinformation.items.Status;

import java.io.IOException;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import com.fasterxml.jackson.annotation.JsonProperty;

public class DateOfBirth {
public class DateDayMonthYear {

@JsonProperty("day")
private String day;

@JsonProperty("month")
private String month;
Expand All @@ -26,4 +29,11 @@ public void setYear(Long year) {
this.year = year;
}

public String getDay() {
return day;
}

public void setDay(String day) {
this.day = day;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.LocalDate;
import uk.gov.companieshouse.api.model.common.Address;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.common.DateDayMonthYear;


public class CurrentOfficer {
Expand All @@ -23,7 +24,7 @@ public class CurrentOfficer {
private String resigned;

@JsonProperty("date_of_birth")
private DateOfBirth dateOfBirth;
private DateDayMonthYear dateOfBirth;

@JsonProperty("nationality")
private String nationality;
Expand Down Expand Up @@ -170,11 +171,11 @@ public void setAppointed(String appointed) {
this.appointed = appointed;
}

public DateOfBirth getDateOfBirth() {
public DateDayMonthYear getDateOfBirth() {
return dateOfBirth;
}

public void setDateOfBirth(DateOfBirth dateOfBirth) {
public void setDateOfBirth(DateDayMonthYear dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.keyfilingdates.items.AccountingReferenceDate;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.common.DateDayMonthYear;

@JsonInclude(Include.NON_NULL)
public class KeyFilingDates {

@JsonProperty("accounting_reference_date")
private AccountingReferenceDate accountingReferenceDate;
private DateDayMonthYear accountingReferenceDate;

@JsonProperty("last_accounts_made_up_to")
private String lastAccountsMadeUpTo;
Expand All @@ -29,11 +29,11 @@ public class KeyFilingDates {
@JsonProperty("last_members_list")
private String lastMembersList;

public AccountingReferenceDate getAccountingReferenceDate() {
public DateDayMonthYear getAccountingReferenceDate() {
return accountingReferenceDate;
}

public void setAccountingReferenceDate(AccountingReferenceDate accountingReferenceDate) {
public void setAccountingReferenceDate(DateDayMonthYear accountingReferenceDate) {
this.accountingReferenceDate = accountingReferenceDate;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import java.time.LocalDate;

@JsonInclude(Include.NON_NULL)
public class PreviousNames {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.common.Address;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.common.DateOfBirth;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.common.DateDayMonthYear;
import uk.gov.companieshouse.document.generator.company.report.mapping.model.document.items.common.Identification;

public class Psc {
Expand All @@ -18,7 +18,7 @@ public class Psc {
private String countryOfResidence;

@JsonProperty("date_of_birth")
private DateOfBirth dateOfBirth;
private DateDayMonthYear dateOfBirth;

@JsonProperty("name")
private String name;
Expand Down Expand Up @@ -51,11 +51,11 @@ public void setCountryOfResidence(String countryOfResidence) {
this.countryOfResidence = countryOfResidence;
}

public DateOfBirth getDateOfBirth() {
public DateDayMonthYear getDateOfBirth() {
return dateOfBirth;
}

public void setDateOfBirth(DateOfBirth dateOfBirth) {
public void setDateOfBirth(DateDayMonthYear dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}

Expand Down