Search in sources :

Example 1 with Action

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Action in project open-smart-grid-platform by OSGP.

the class ActionMapperService method mapAllActions.

public List<ActionRequest> mapAllActions(final List<? extends Action> actionList) throws FunctionalException {
    final List<ActionRequest> actionRequestList = new ArrayList<>();
    for (final Action action : actionList) {
        final ConfigurableMapper mapper = CLASS_TO_MAPPER_MAP.get(action.getClass());
        final Class<? extends ActionRequest> clazz = CLASS_MAP.get(action.getClass());
        if (mapper != null) {
            actionRequestList.add(this.getActionRequestWithDefaultMapper(action, mapper, clazz));
        } else {
            throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.DOMAIN_SMART_METERING, new AssertionError("No mapper defined for class: " + action.getClass().getName()));
        }
    }
    return actionRequestList;
}
Also used : Action(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Action) ActionRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ActionRequest) ArrayList(java.util.ArrayList) ConfigurableMapper(ma.glasnost.orika.impl.ConfigurableMapper) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)

Example 2 with Action

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Action in project open-smart-grid-platform by OSGP.

the class BundleSteps method assertSameOrder.

private void assertSameOrder(final BundleRequest bundleRequest, final BundleResponse bundleResponse) {
    final int actionsSize = bundleRequest.getActions().getActionList().size();
    for (int i = 0; i < actionsSize; i++) {
        final Action action = bundleRequest.getActions().getActionList().get(i);
        final Response response = bundleResponse.getAllResponses().getResponseList().get(i);
        assertThat(response.getClass()).isEqualTo(REQUEST_RESPONSE_MAP.get(action.getClass()));
    }
}
Also used : BundleAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleAsyncResponse) ActualMeterReadsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ActualMeterReadsResponse) GetConfigurationObjectResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetConfigurationObjectResponse) BundleResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse) ReadAlarmRegisterResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ReadAlarmRegisterResponse) GetMbusEncryptionKeyStatusResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetMbusEncryptionKeyStatusResponse) ActionResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ActionResponse) ScanMbusChannelsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ScanMbusChannelsResponse) AdministrativeStatusResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.AdministrativeStatusResponse) AssociationLnObjectsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.AssociationLnObjectsResponse) FindEventsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.FindEventsResponse) Response(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Response) FaultResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.FaultResponse) Action(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Action)

Aggregations

Action (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Action)2 ArrayList (java.util.ArrayList)1 ConfigurableMapper (ma.glasnost.orika.impl.ConfigurableMapper)1 ActionResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ActionResponse)1 ActualMeterReadsResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ActualMeterReadsResponse)1 AdministrativeStatusResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.AdministrativeStatusResponse)1 AssociationLnObjectsResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.AssociationLnObjectsResponse)1 BundleAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleAsyncResponse)1 BundleResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse)1 FaultResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.FaultResponse)1 FindEventsResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.FindEventsResponse)1 GetConfigurationObjectResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetConfigurationObjectResponse)1 GetMbusEncryptionKeyStatusResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetMbusEncryptionKeyStatusResponse)1 ReadAlarmRegisterResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ReadAlarmRegisterResponse)1 ScanMbusChannelsResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ScanMbusChannelsResponse)1 Response (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Response)1 ActionRequest (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ActionRequest)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1