/* * (non-Javadoc) * @see com.sensus.mlc.ecomode.bcf.IEcoModeBCF#fetchLightConsumptionsByLightId(com.sensus.mlc.ecomode.model.request. * InquiryEcoModeRequest) */ @Override public InquiryEcoModeResponse fetchLightConsumptionsByLightId( InquiryEcoModeRequest ecoModeRequest) { InquiryEcoModeResponse response = new InquiryEcoModeResponse(); InternalResultsResponse<Consumption> internalResponse = null; try { ValidationContext context = new ValidationContext(); context.getValidationArguments().put(getSlcActionName(), FETCH_LIGHT_CONSUMPTION); context.putObjectToBeValidated(INQUIRY_ECOMODE_REQUEST_NAME, ecoModeRequest); context.putObjectToBeValidated(INITIAL_DATE.getValue(), ecoModeRequest.getInitialDate()); context.putObjectToBeValidated(END_DATE.getValue(), ecoModeRequest.getEndDate()); checkDefaultsFetchAll(ecoModeRequest); if (getRequestValidationController().validate(context) && getInquiryRequestValidationController().validate(context) && getLightSelectionRequestValidationController().validate(context) && getRangeDateValidationController().validate(context)) { // fetch light consumptions internalResponse = getEcoModeBCL().fetchLightConsumptionsByLightId(ecoModeRequest); } handleOperationStatusAndMessages(response, internalResponse, context.getMessages(), true); } catch (Exception ex) { handleException(LOG, response, ex, SENSUS_MLC_ECOMODEBCLIMPL_DEFAULTEXCEPTION); } return response; }
/* * (non-Javadoc) * @see * com.sensus.mlc.ecomode.bcf.IEcoModeBCF#generateFileCSV(com.sensus.mlc.ecomode.model.request.InquiryEcoModeRequest * ) */ @Override public CSVResponse generateFileCSV(EcoModeCSVRequest ecoModeRequest) { CSVResponse response = new CSVResponse(); CSVInternalResponse internalResponse = null; try { ValidationContext requestContext = new ValidationContext(); ValidationContext context = new ValidationContext(); context.putObjectToBeValidated( INQUIRY_ECOMODE_REQUEST_NAME, ecoModeRequest.getInquiryEcoModeRequest()); context.getValidationArguments().put(getSlcActionName(), FETCH_LIGHT_CONSUMPTION); requestContext.putObjectToBeValidated(ECOMODE_CSV_REQUEST_NAME, ecoModeRequest); context.putObjectToBeValidated( INITIAL_DATE.getValue(), ecoModeRequest.getInquiryEcoModeRequest().getInitialDate()); context.putObjectToBeValidated( END_DATE.getValue(), ecoModeRequest.getInquiryEcoModeRequest().getEndDate()); if (!getRequestValidationController() .validate(requestContext)) // Validate Tenant and UserContext { handleOperationStatusAndMessages( response, internalResponse, requestContext.getMessages(), false); return response; } if (getInquiryRequestValidationController().validate(context) && getLightSelectionRequestValidationController().validate(context) && getRangeDateValidationController().validate(context)) { internalResponse = getEcoModeBCL().generateFileCSV(ecoModeRequest); } handleOperationStatusAndMessages(response, internalResponse, context.getMessages(), false); } catch (Exception ex) { handleException(LOG, response, ex, SENSUS_MLC_ECOMODEBCLIMPL_DEFAULTEXCEPTION); } return response; }