/* * (non-Javadoc) * @see * com.sensus.mlc.ecomode.bcf.IEcoModeBCF#importEcoModeBaselineFromFileCSV(com.sensus.mlc.ecomode.model.request. * InquiryEcoModeRequest) */ @Override public EcoModeResponse importEcoModeBaselineFromFileCSV(EcoModeRequest ecoModeRequest) { EcoModeResponse response = new EcoModeResponse(); InternalResponse internalResponse = null; try { ValidationContext context = new ValidationContext(); context.getValidationArguments().put(getSlcActionName(), IMPORT_CSV_FILE); context.putObjectToBeValidated(ECOMODE_REQUEST_NAME, ecoModeRequest); context.putObjectToBeValidated(CSV_FILE.getValue(), ecoModeRequest.getEcoModeCSVImport()); if (getRequestValidationController().validate(context) && getCsvFileValidationController().validate(context)) { // Import eco mode baseline internalResponse = getEcoModeBCL().importEcoModeBaselineFromFileCSV(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#upsertEcoMode(com.sensus.mlc.ecomode.model.request.InquiryEcoModeRequest) */ @Override public EcoModeResponse upsertEcoMode(EcoModeRequest ecoModeRequest) { EcoModeResponse response = new EcoModeResponse(); InternalResultsResponse<Light> internalResponse = null; try { ValidationContext context = new ValidationContext(); context.getValidationArguments().put(getSlcActionName(), UPSERT_ECOMODE); context.putObjectToBeValidated(ECOMODE_REQUEST_NAME, ecoModeRequest); context.putObjectToBeValidated(LIGHT_LIST.getValue(), ecoModeRequest.getLights()); if (getRequestValidationController().validate(context) && getLightListValidationController().validate(context)) { // upsert EcoMode internalResponse = getEcoModeBCL().upsertEcoMode(ecoModeRequest); } handleOperationStatusAndMessages(response, internalResponse, context.getMessages(), true); } catch (Exception ex) { handleException(LOG, response, ex, SENSUS_MLC_ECOMODEBCLIMPL_DEFAULTEXCEPTION); } return response; }