generated from pagopa/template-payments-java-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b1bf65
commit c6786ef
Showing
8 changed files
with
239 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/it/gov/pagopa/pu/bff/exception/UnparsableEntityException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package it.gov.pagopa.pu.bff.exception; | ||
|
||
public class UnparsableEntityException extends RuntimeException{ | ||
|
||
public UnparsableEntityException (String message){ | ||
super(message); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...pu/bff/mapper/CollectionModelTaxonomyCodeDTOEmbeddedToCollectionModelTaxonomyCodeDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package it.gov.pagopa.pu.bff.mapper; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import it.gov.pagopa.pu.bff.dto.generated.CollectionModelTaxonomyCodeDTO; | ||
import it.gov.pagopa.pu.bff.exception.UnparsableEntityException; | ||
import it.gov.pagopa.pu.p4pa_organization.dto.generated.CollectionModelTaxonomyCodeDTOEmbedded; | ||
import it.gov.pagopa.pu.p4pa_organization.dto.generated.TaxonomyCodeDTO; | ||
import java.util.List; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class CollectionModelTaxonomyCodeDTOEmbeddedToCollectionModelTaxonomyCodeDTO { | ||
|
||
private final ObjectMapper objectMapper; | ||
|
||
public CollectionModelTaxonomyCodeDTOEmbeddedToCollectionModelTaxonomyCodeDTO(ObjectMapper objectMapper){ | ||
this.objectMapper = objectMapper; | ||
} | ||
|
||
public CollectionModelTaxonomyCodeDTO map( | ||
CollectionModelTaxonomyCodeDTOEmbedded input){ | ||
try{ | ||
List<TaxonomyCodeDTO> modifiedList = input.getTaxonomyCodeDTOes().stream() | ||
.map(dto -> { | ||
dto.setOrganizationTypeDescription(dto.getOrganizationType() + ". " + dto.getOrganizationTypeDescription()); | ||
dto.setMacroAreaDescription(dto.getMacroAreaCode()+". "+dto.getMacroAreaName()); | ||
dto.setServiceTypeDescription(dto.getServiceTypeCode()+". "+dto.getServiceType()); | ||
return dto; | ||
}).toList(); | ||
CollectionModelTaxonomyCodeDTOEmbedded modifiedEmbedded = new CollectionModelTaxonomyCodeDTOEmbedded(); | ||
modifiedEmbedded.setTaxonomyCodeDTOes(modifiedList); | ||
String result = objectMapper.writeValueAsString(modifiedEmbedded); | ||
return objectMapper.readValue(result, CollectionModelTaxonomyCodeDTO.class); | ||
} catch (JsonProcessingException e) { | ||
throw new UnparsableEntityException(e.getMessage()); | ||
} | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
...ModelTaxonomyCollectionReasonDTOEmbeddedToCollectionModelTaxonomyCollectionReasonDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package it.gov.pagopa.pu.bff.mapper; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import it.gov.pagopa.pu.bff.dto.generated.CollectionModelTaxonomyCollectionReasonDTO; | ||
import it.gov.pagopa.pu.bff.exception.UnparsableEntityException; | ||
import it.gov.pagopa.pu.p4pa_organization.dto.generated.CollectionModelTaxonomyCollectionReasonDTOEmbedded; | ||
import it.gov.pagopa.pu.p4pa_organization.dto.generated.TaxonomyCollectionReasonDTO; | ||
import java.util.List; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class CollectionModelTaxonomyCollectionReasonDTOEmbeddedToCollectionModelTaxonomyCollectionReasonDTO { | ||
|
||
private final ObjectMapper objectMapper; | ||
|
||
public CollectionModelTaxonomyCollectionReasonDTOEmbeddedToCollectionModelTaxonomyCollectionReasonDTO(ObjectMapper objectMapper){ | ||
this.objectMapper = objectMapper; | ||
} | ||
|
||
public CollectionModelTaxonomyCollectionReasonDTO map( | ||
CollectionModelTaxonomyCollectionReasonDTOEmbedded input){ | ||
try{ | ||
List<TaxonomyCollectionReasonDTO> modifiedList = input.getTaxonomyCollectionReasonDTOes().stream() | ||
.map(dto -> { | ||
dto.setOrganizationTypeDescription(dto.getOrganizationType() + ". " + dto.getOrganizationTypeDescription()); | ||
dto.setMacroAreaDescription(dto.getMacroAreaCode()+". "+dto.getMacroAreaName()); | ||
dto.setServiceTypeDescription(dto.getServiceTypeCode()+". "+dto.getServiceType()); | ||
return dto; | ||
}).toList(); | ||
CollectionModelTaxonomyCollectionReasonDTOEmbedded modifiedEmbedded = new CollectionModelTaxonomyCollectionReasonDTOEmbedded(); | ||
modifiedEmbedded.setTaxonomyCollectionReasonDTOes(modifiedList); | ||
String result = objectMapper.writeValueAsString(modifiedEmbedded); | ||
return objectMapper.readValue(result, CollectionModelTaxonomyCollectionReasonDTO.class); | ||
} catch (JsonProcessingException e) { | ||
throw new UnparsableEntityException(e.getMessage()); | ||
} | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
...ectionModelTaxonomyMacroAreaCodeDTOEmbeddedToCollectionModelTaxonomyMacroAreaCodeDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package it.gov.pagopa.pu.bff.mapper; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import it.gov.pagopa.pu.bff.dto.generated.CollectionModelTaxonomyMacroAreaCodeDTO; | ||
import it.gov.pagopa.pu.bff.exception.UnparsableEntityException; | ||
import it.gov.pagopa.pu.p4pa_organization.dto.generated.CollectionModelTaxonomyMacroAreaCodeDTOEmbedded; | ||
import it.gov.pagopa.pu.p4pa_organization.dto.generated.TaxonomyMacroAreaCodeDTO; | ||
import java.util.List; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class CollectionModelTaxonomyMacroAreaCodeDTOEmbeddedToCollectionModelTaxonomyMacroAreaCodeDTO { | ||
private final ObjectMapper objectMapper; | ||
|
||
public CollectionModelTaxonomyMacroAreaCodeDTOEmbeddedToCollectionModelTaxonomyMacroAreaCodeDTO(ObjectMapper objectMapper){ | ||
this.objectMapper = objectMapper; | ||
} | ||
|
||
public CollectionModelTaxonomyMacroAreaCodeDTO map( | ||
CollectionModelTaxonomyMacroAreaCodeDTOEmbedded input){ | ||
try{ | ||
List<TaxonomyMacroAreaCodeDTO> modifiedList = input.getTaxonomyMacroAreaCodeDTOes().stream() | ||
.map(dto -> { | ||
dto.setOrganizationTypeDescription(dto.getOrganizationType() + ". " + dto.getOrganizationTypeDescription()); | ||
dto.setMacroAreaDescription(dto.getMacroAreaCode()+". "+dto.getMacroAreaName()); | ||
return dto; | ||
}).toList(); | ||
CollectionModelTaxonomyMacroAreaCodeDTOEmbedded modifiedEmbedded = new CollectionModelTaxonomyMacroAreaCodeDTOEmbedded(); | ||
modifiedEmbedded.setTaxonomyMacroAreaCodeDTOes(modifiedList); | ||
String macroAreaCode = objectMapper.writeValueAsString(modifiedEmbedded); | ||
return objectMapper.readValue(macroAreaCode, CollectionModelTaxonomyMacroAreaCodeDTO.class); | ||
} catch (JsonProcessingException e) { | ||
throw new UnparsableEntityException(e.getMessage()); | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...ModelTaxonomyOrganizationTypeDTOEmbeddedToCollectionModelTaxonomyOrganizationTypeDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package it.gov.pagopa.pu.bff.mapper; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import it.gov.pagopa.pu.bff.dto.generated.CollectionModelTaxonomyOrganizationTypeDTO; | ||
import it.gov.pagopa.pu.bff.exception.UnparsableEntityException; | ||
import it.gov.pagopa.pu.p4pa_organization.dto.generated.CollectionModelTaxonomyOrganizationTypeDTOEmbedded; | ||
import it.gov.pagopa.pu.p4pa_organization.dto.generated.TaxonomyOrganizationTypeDTO; | ||
import java.util.List; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class CollectionModelTaxonomyOrganizationTypeDTOEmbeddedToCollectionModelTaxonomyOrganizationTypeDTO { | ||
|
||
private final ObjectMapper objectMapper; | ||
|
||
public CollectionModelTaxonomyOrganizationTypeDTOEmbeddedToCollectionModelTaxonomyOrganizationTypeDTO(ObjectMapper objectMapper) { | ||
this.objectMapper = objectMapper; | ||
} | ||
|
||
public CollectionModelTaxonomyOrganizationTypeDTO map( | ||
CollectionModelTaxonomyOrganizationTypeDTOEmbedded input) { | ||
try { | ||
// Modify the list of DTOs | ||
List<TaxonomyOrganizationTypeDTO> modifiedList = input.getTaxonomyOrganizationTypeDTOes().stream() | ||
.map(dto -> { | ||
dto.setOrganizationTypeDescription(dto.getOrganizationType() + ". " + dto.getOrganizationTypeDescription()); | ||
return dto; | ||
}) | ||
.toList(); | ||
|
||
// Create a new embedded object with the modified list | ||
CollectionModelTaxonomyOrganizationTypeDTOEmbedded modifiedEmbedded = new CollectionModelTaxonomyOrganizationTypeDTOEmbedded(); | ||
modifiedEmbedded.setTaxonomyOrganizationTypeDTOes(modifiedList); | ||
|
||
// Convert the modified embedded object to JSON and back to CollectionModel | ||
String orgTypesJson = objectMapper.writeValueAsString(modifiedEmbedded); | ||
return objectMapper.readValue(orgTypesJson, CollectionModelTaxonomyOrganizationTypeDTO.class); | ||
} catch (JsonProcessingException e) { | ||
throw new UnparsableEntityException(e.getMessage()); | ||
} | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
...onModelTaxonomyServiceTypeCodeDTOEmbeddedToCollectionModelTaxonomyServiceTypeCodeDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package it.gov.pagopa.pu.bff.mapper; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import it.gov.pagopa.pu.bff.dto.generated.CollectionModelTaxonomyServiceTypeCodeDTO; | ||
import it.gov.pagopa.pu.bff.exception.UnparsableEntityException; | ||
import it.gov.pagopa.pu.p4pa_organization.dto.generated.CollectionModelTaxonomyServiceTypeCodeDTOEmbedded; | ||
import it.gov.pagopa.pu.p4pa_organization.dto.generated.TaxonomyServiceTypeCodeDTO; | ||
import java.util.List; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class CollectionModelTaxonomyServiceTypeCodeDTOEmbeddedToCollectionModelTaxonomyServiceTypeCodeDTO { | ||
|
||
private final ObjectMapper objectMapper; | ||
|
||
public CollectionModelTaxonomyServiceTypeCodeDTOEmbeddedToCollectionModelTaxonomyServiceTypeCodeDTO(ObjectMapper objectMapper){ | ||
this.objectMapper = objectMapper; | ||
} | ||
|
||
public CollectionModelTaxonomyServiceTypeCodeDTO map( | ||
CollectionModelTaxonomyServiceTypeCodeDTOEmbedded input){ | ||
try{ | ||
List<TaxonomyServiceTypeCodeDTO> modifiedList = input.getTaxonomyServiceTypeCodeDTOes().stream() | ||
.map(dto -> { | ||
dto.setOrganizationTypeDescription(dto.getOrganizationType() + ". " + dto.getOrganizationTypeDescription()); | ||
dto.setMacroAreaDescription(dto.getMacroAreaCode()+". "+dto.getMacroAreaName()); | ||
dto.setServiceTypeDescription(dto.getServiceTypeCode()+". "+dto.getServiceType()); | ||
return dto; | ||
}).toList(); | ||
CollectionModelTaxonomyServiceTypeCodeDTOEmbedded modifiedEmbedded = new CollectionModelTaxonomyServiceTypeCodeDTOEmbedded(); | ||
modifiedEmbedded.setTaxonomyServiceTypeCodeDTOes(modifiedList); | ||
String result = objectMapper.writeValueAsString(modifiedEmbedded); | ||
return objectMapper.readValue(result, CollectionModelTaxonomyServiceTypeCodeDTO.class); | ||
} catch (JsonProcessingException e) { | ||
throw new UnparsableEntityException(e.getMessage()); | ||
} | ||
} | ||
|
||
} |
65 changes: 24 additions & 41 deletions
65
src/main/java/it/gov/pagopa/pu/bff/service/taxonomy/TaxonomyServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,68 @@ | ||
package it.gov.pagopa.pu.bff.service.taxonomy; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import it.gov.pagopa.pu.bff.connector.organization.client.TaxonomyClient; | ||
import it.gov.pagopa.pu.bff.dto.generated.CollectionModelTaxonomyCodeDTO; | ||
import it.gov.pagopa.pu.bff.dto.generated.CollectionModelTaxonomyCollectionReasonDTO; | ||
import it.gov.pagopa.pu.bff.dto.generated.CollectionModelTaxonomyMacroAreaCodeDTO; | ||
import it.gov.pagopa.pu.bff.dto.generated.CollectionModelTaxonomyOrganizationTypeDTO; | ||
import it.gov.pagopa.pu.bff.dto.generated.CollectionModelTaxonomyServiceTypeCodeDTO; | ||
import it.gov.pagopa.pu.p4pa_organization.dto.generated.CollectionModelTaxonomyOrganizationTypeDTOEmbedded; | ||
import lombok.Setter; | ||
import it.gov.pagopa.pu.bff.mapper.CollectionModelTaxonomyCodeDTOEmbeddedToCollectionModelTaxonomyCodeDTO; | ||
import it.gov.pagopa.pu.bff.mapper.CollectionModelTaxonomyCollectionReasonDTOEmbeddedToCollectionModelTaxonomyCollectionReasonDTO; | ||
import it.gov.pagopa.pu.bff.mapper.CollectionModelTaxonomyMacroAreaCodeDTOEmbeddedToCollectionModelTaxonomyMacroAreaCodeDTO; | ||
import it.gov.pagopa.pu.bff.mapper.CollectionModelTaxonomyOrganizationTypeDTOEmbeddedToCollectionModelTaxonomyOrganizationTypeDTO; | ||
import it.gov.pagopa.pu.bff.mapper.CollectionModelTaxonomyServiceTypeCodeDTOEmbeddedToCollectionModelTaxonomyServiceTypeCodeDTO; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class TaxonomyServiceImpl implements TaxonomyService{ | ||
|
||
private final TaxonomyClient taxonomyClient; | ||
private final ObjectMapper objectMapper; | ||
|
||
public TaxonomyServiceImpl(TaxonomyClient taxonomyClient,ObjectMapper objectMapper){ | ||
private final CollectionModelTaxonomyOrganizationTypeDTOEmbeddedToCollectionModelTaxonomyOrganizationTypeDTO collectionModelTaxonomyOrganizationTypeDTOEmbeddedToCollectionModelTaxonomyOrganizationTypeDTO; | ||
private final CollectionModelTaxonomyMacroAreaCodeDTOEmbeddedToCollectionModelTaxonomyMacroAreaCodeDTO collectionModelTaxonomyMacroAreaCodeDTOEmbeddedToCollectionModelTaxonomyMacroAreaCodeDTO; | ||
private final CollectionModelTaxonomyCollectionReasonDTOEmbeddedToCollectionModelTaxonomyCollectionReasonDTO collectionModelTaxonomyCollectionReasonDTOEmbeddedToCollectionModelTaxonomyCollectionReasonDTO; | ||
private final CollectionModelTaxonomyServiceTypeCodeDTOEmbeddedToCollectionModelTaxonomyServiceTypeCodeDTO collectionModelTaxonomyServiceTypeCodeDTOEmbeddedToCollectionModelTaxonomyServiceTypeCodeDTO; | ||
private final CollectionModelTaxonomyCodeDTOEmbeddedToCollectionModelTaxonomyCodeDTO collectionModelTaxonomyCodeDTOEmbeddedToCollectionModelTaxonomyCodeDTO; | ||
public TaxonomyServiceImpl(TaxonomyClient taxonomyClient,CollectionModelTaxonomyOrganizationTypeDTOEmbeddedToCollectionModelTaxonomyOrganizationTypeDTO collectionModelTaxonomyOrganizationTypeDTOEmbeddedToCollectionModelTaxonomyOrganizationTypeDTO,CollectionModelTaxonomyMacroAreaCodeDTOEmbeddedToCollectionModelTaxonomyMacroAreaCodeDTO collectionModelTaxonomyMacroAreaCodeDTOEmbeddedToCollectionModelTaxonomyMacroAreaCodeDTO,CollectionModelTaxonomyCollectionReasonDTOEmbeddedToCollectionModelTaxonomyCollectionReasonDTO collectionModelTaxonomyCollectionReasonDTOEmbeddedToCollectionModelTaxonomyCollectionReasonDTO,CollectionModelTaxonomyServiceTypeCodeDTOEmbeddedToCollectionModelTaxonomyServiceTypeCodeDTO collectionModelTaxonomyServiceTypeCodeDTOEmbeddedToCollectionModelTaxonomyServiceTypeCodeDTO,CollectionModelTaxonomyCodeDTOEmbeddedToCollectionModelTaxonomyCodeDTO collectionModelTaxonomyCodeDTOEmbeddedToCollectionModelTaxonomyCodeDTO){ | ||
this.taxonomyClient = taxonomyClient; | ||
this.objectMapper = objectMapper; | ||
this.collectionModelTaxonomyOrganizationTypeDTOEmbeddedToCollectionModelTaxonomyOrganizationTypeDTO = collectionModelTaxonomyOrganizationTypeDTOEmbeddedToCollectionModelTaxonomyOrganizationTypeDTO; | ||
this.collectionModelTaxonomyMacroAreaCodeDTOEmbeddedToCollectionModelTaxonomyMacroAreaCodeDTO = collectionModelTaxonomyMacroAreaCodeDTOEmbeddedToCollectionModelTaxonomyMacroAreaCodeDTO; | ||
this.collectionModelTaxonomyCollectionReasonDTOEmbeddedToCollectionModelTaxonomyCollectionReasonDTO = collectionModelTaxonomyCollectionReasonDTOEmbeddedToCollectionModelTaxonomyCollectionReasonDTO; | ||
this.collectionModelTaxonomyServiceTypeCodeDTOEmbeddedToCollectionModelTaxonomyServiceTypeCodeDTO = collectionModelTaxonomyServiceTypeCodeDTOEmbeddedToCollectionModelTaxonomyServiceTypeCodeDTO; | ||
this.collectionModelTaxonomyCodeDTOEmbeddedToCollectionModelTaxonomyCodeDTO = collectionModelTaxonomyCodeDTOEmbeddedToCollectionModelTaxonomyCodeDTO; | ||
} | ||
@Override | ||
public CollectionModelTaxonomyCollectionReasonDTO getCollectionReason ( | ||
String organizationType, | ||
String macroAreaCode, String serviceTypeCode, String accessToken) | ||
{ | ||
try { | ||
String collectionReason = objectMapper.writeValueAsString(taxonomyClient.getCollectionReason(organizationType,macroAreaCode,serviceTypeCode,accessToken).getEmbedded()); | ||
return objectMapper.readValue(collectionReason,CollectionModelTaxonomyCollectionReasonDTO.class); | ||
} catch (JsonProcessingException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
String macroAreaCode, String serviceTypeCode, String accessToken){ | ||
return collectionModelTaxonomyCollectionReasonDTOEmbeddedToCollectionModelTaxonomyCollectionReasonDTO.map(taxonomyClient.getCollectionReason(organizationType,macroAreaCode,serviceTypeCode,accessToken).getEmbedded()); | ||
} | ||
|
||
@Override | ||
public CollectionModelTaxonomyMacroAreaCodeDTO getMacroArea ( | ||
String organizationType, | ||
String accessToken) { | ||
try { | ||
String macroArea = objectMapper.writeValueAsString(taxonomyClient.getMacroArea(organizationType,accessToken).getEmbedded()); | ||
return objectMapper.readValue(macroArea,CollectionModelTaxonomyMacroAreaCodeDTO.class); | ||
} catch (JsonProcessingException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return collectionModelTaxonomyMacroAreaCodeDTOEmbeddedToCollectionModelTaxonomyMacroAreaCodeDTO.map(taxonomyClient.getMacroArea(organizationType,accessToken).getEmbedded()); | ||
} | ||
|
||
@Override | ||
public CollectionModelTaxonomyOrganizationTypeDTO getOrganizationTypes ( | ||
String accessToken) { | ||
try { | ||
String orgTypes = objectMapper.writeValueAsString(taxonomyClient.getOrganizationType(accessToken).getEmbedded()); | ||
return objectMapper.readValue(orgTypes,CollectionModelTaxonomyOrganizationTypeDTO.class); | ||
} catch (JsonProcessingException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return collectionModelTaxonomyOrganizationTypeDTOEmbeddedToCollectionModelTaxonomyOrganizationTypeDTO | ||
.map(taxonomyClient.getOrganizationType(accessToken).getEmbedded()); | ||
} | ||
|
||
@Override | ||
public CollectionModelTaxonomyServiceTypeCodeDTO getServiceType ( | ||
String organizationType, | ||
String macroAreaCode, String accessToken) { | ||
try { | ||
String serviceType = objectMapper.writeValueAsString(taxonomyClient.getServiceType(organizationType,macroAreaCode,accessToken).getEmbedded()); | ||
return objectMapper.readValue(serviceType,CollectionModelTaxonomyServiceTypeCodeDTO.class); | ||
} catch (JsonProcessingException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return collectionModelTaxonomyServiceTypeCodeDTOEmbeddedToCollectionModelTaxonomyServiceTypeCodeDTO.map(taxonomyClient.getServiceType(organizationType,macroAreaCode,accessToken).getEmbedded()); | ||
} | ||
|
||
@Override | ||
public CollectionModelTaxonomyCodeDTO getTaxonomyCode ( | ||
String organizationType, | ||
String macroAreaCode, String serviceTypeCode, String collectionReason, | ||
String accessToken) { | ||
try { | ||
String taxonomyCode = objectMapper.writeValueAsString(taxonomyClient.getTaxonomyCode(organizationType,macroAreaCode,serviceTypeCode,collectionReason,accessToken).getEmbedded()); | ||
return objectMapper.readValue(taxonomyCode,CollectionModelTaxonomyCodeDTO.class); | ||
} catch (JsonProcessingException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return collectionModelTaxonomyCodeDTOEmbeddedToCollectionModelTaxonomyCodeDTO.map(taxonomyClient.getTaxonomyCode(organizationType,macroAreaCode,serviceTypeCode,collectionReason,accessToken).getEmbedded()); | ||
} | ||
} |