use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindOrganisationResponse in project open-smart-grid-platform by OSGP.
the class FindOrganizationsSteps method theGetOrganizationResponseContains.
@Then("^the get organization response contains$")
public void theGetOrganizationResponseContains(final Map<String, String> expectedResult) {
final FindOrganisationResponse response = (FindOrganisationResponse) ScenarioContext.current().get(PlatformCommonKeys.RESPONSE);
final Organisation organisation = response.getOrganisation();
final Organisation expected = this.createOrganisation(expectedResult);
assertThat(this.organisationMatches(expected, organisation)).as("Expected organization \"" + expected.getOrganisationIdentification() + "\" was not found as the organization in the response").isTrue();
}
use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindOrganisationResponse in project open-smart-grid-platform by OSGP.
the class DeviceManagementEndpoint method findOrganisation.
@PayloadRoot(localPart = "FindOrganisationRequest", namespace = DEVICE_MANAGEMENT_NAMESPACE)
@ResponsePayload
public FindOrganisationResponse findOrganisation(@OrganisationIdentification final String organisationIdentification, @RequestPayload final FindOrganisationRequest request) throws OsgpException {
LOGGER.info("Find organisation for organisation: {}.", organisationIdentification);
final FindOrganisationResponse response = new FindOrganisationResponse();
try {
final Organisation organisation = this.deviceManagementService.findOrganisation(organisationIdentification, request.getOrganisationIdentification());
response.setOrganisation(this.deviceManagementMapper.map(organisation, org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.Organisation.class));
} catch (final ConstraintViolationException e) {
throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations()));
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations