@Override public SettingsVO selectFinanacialSettings(int communityId) throws DbException { DataSet dataSet = dbSession.executeQuery(SELECT_FINANCIAL_SETTINGS_BY_COMMUNITY_ID, communityId); SettingsVO settingsVO = new SettingsVO(); settingsVO.setBasicMaintenanceChargeEnabled( stringToBoolean( StringUtil.getStringValue( dataSet.getIntValue(0, "BASIC_MAINTENANCE_CHARGES_ENABLED")))); settingsVO.setBasicMaintenanceChargeType( ChargeType.getChargeType((dataSet.getIntValue(0, "MAINTENANCE_CHARGE_TYPE")))); settingsVO.setMonthlyMaintenanceRate(dataSet.getDoubleValue(0, "MONTHLY_MAINTENANCE_RATE")); settingsVO.setLatePaymentPenaltyEnabled( stringToBoolean( StringUtil.getStringValue(dataSet.getIntValue(0, "LATE_PAYMENT_PENALTY_ENABLED")))); settingsVO.setLatePaymentChargeType( ChargeType.getChargeType((dataSet.getIntValue(0, "LATE_PAYMENT_PENALTY_CHARGE_TYPE")))); settingsVO.setLatePaymentPenaltyAmount( dataSet.getDoubleValue(0, "LATE_PAYMENT_PENALTY_AMOUNT")); settingsVO.setLatePaymentMinimumBalance( dataSet.getDoubleValue(0, "LATE_PAYMENT_MINIMUM_BALANCE")); settingsVO.setLatePaymentCalculationDay(dataSet.getIntValue(0, "LATE_PAYMENT_CALCULATION_DAY")); settingsVO.setLatePaymentDisplayDay(dataSet.getIntValue(0, "LATE_PAYMENT_DISPLAY_DAY")); settingsVO.setLatePaymentReminderDays(dataSet.getIntValue(0, "LATE_PAYMENT_REMINDER_DAYS")); settingsVO.setChequeBouncePenaltyEnabled( stringToBoolean( StringUtil.getStringValue(dataSet.getIntValue(0, "CHEQUE_BOUNCE_PENALTY_ENABLED")))); settingsVO.setChequePenaltyChargeType( ChargeType.getChargeType((dataSet.getIntValue(0, "CHEQUE_BOUNCE_PENALTY_CHARGE_TYPE")))); settingsVO.setChequeBouncePenaltyAmount( dataSet.getDoubleValue(0, "CHEQUE_BOUNCE_PENALTY_AMOUNT")); return settingsVO; }
@Override public SettingsVO selectSystemSettings(int communityId) throws DbException { DataSet dataSet = dbSession.executeQuery(SELECT_SYSTEM_SETTINGS_BY_COMMUNITY_ID, communityId); SettingsVO settingsVO = new SettingsVO(); settingsVO.setBillGenerationDay(dataSet.getIntValue(0, "BILL_GENERATION_DAY")); settingsVO.setAutoBillGenerationEnabled( stringToBoolean( StringUtil.getStringValue(dataSet.getIntValue(0, "AUTO_BILL_GENERATION_ENABLED")))); settingsVO.setCommunicationEnabled( stringToBoolean( StringUtil.getStringValue(dataSet.getIntValue(0, "COMMUNICATION_ENABLED")))); /* SMS related stuff */ settingsVO.setSmsEnabled( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "SMS_ENABLED")))); settingsVO.setSmsGatewayType( GatewayType.getGatewayType(dataSet.getIntValue(0, "SMS_GATEWAY_TYPE"))); settingsVO.setSmsGatewayUsername(dataSet.getStringValue(0, "SMS_GATEWAY_USERNAME")); settingsVO.setSmsGatewayPassword(dataSet.getStringValue(0, "SMS_GATEWAY_PASSWORD")); settingsVO.setSmsGatewaySource(dataSet.getStringValue(0, "SMS_GATEWAY_SOURCE")); /* Email related stuff */ settingsVO.setEmailEnabled( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "EMAIL_ENABLED")))); settingsVO.setEmailGatewayType( GatewayType.getGatewayType(dataSet.getIntValue(0, "EMAIL_GATEWAY_TYPE"))); settingsVO.setEmailServerUsername(dataSet.getStringValue(0, "EMAIL_SERVER_USERNAME")); settingsVO.setEmailServerPassword(dataSet.getStringValue(0, "EMAIL_SERVER_PASSWORD")); settingsVO.setEmailServer(dataSet.getStringValue(0, "EMAIL_SERVER")); settingsVO.setEmailServerPort(dataSet.getIntValue(0, "EMAIL_SERVER_PORT")); settingsVO.setLastBillGeneratedDate(dataSet.getDateValue(0, "LAST_BILL_GENERATED_DATE")); settingsVO.setNextBillGenerationDate(dataSet.getDateValue(0, "NEXT_BILL_GENERATION_DATE")); settingsVO.setNextLatePaymentGenerationDate( dataSet.getDateValue(0, "NEXT_LATE_PAYMENT_GENERATION_DATE")); settingsVO.setLatePaymentReminderSent( stringToBoolean( StringUtil.getStringValue(dataSet.getIntValue(0, "LATE_PAYMENT_REMINDER_SENT")))); return settingsVO; }
@Override public SettingsVO selectCommunicationSettings(int communityId) throws DbException { SettingsVO settingsVO = new SettingsVO(); /* Check if communication, SMS and email communication are enabled */ DataSet dataSet = dbSession.executeQuery(SELECT_SYSTEM_SETTINGS_BY_COMMUNITY_ID, communityId); settingsVO.setCommunicationEnabled( stringToBoolean( StringUtil.getStringValue(dataSet.getIntValue(0, "COMMUNICATION_ENABLED")))); settingsVO.setSmsEnabled( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "SMS_ENABLED")))); settingsVO.setEmailEnabled( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "EMAIL_ENABLED")))); /* Get communication information */ dataSet = dbSession.executeQuery(SELECT_COMMUNICATION_SETTINGS_BY_COMMUNITY_ID, communityId); settingsVO.setBillGenerationSms( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "BILL_GENERATION_SMS")))); settingsVO.setBillGenerationEmail( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "BILL_GENERATION_MAIL")))); settingsVO.setLatePaymentReminderSms( stringToBoolean( StringUtil.getStringValue(dataSet.getIntValue(0, "LATE_PAYMENT_REMINDER_SMS")))); settingsVO.setLatePaymentReminderEmail( stringToBoolean( StringUtil.getStringValue(dataSet.getIntValue(0, "LATE_PAYMENT_REMINDER_MAIL")))); settingsVO.setLatePaymentSms( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "LATE_PAYMENT_SMS")))); settingsVO.setLatePaymentEmail( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "LATE_PAYMENT_MAIL")))); settingsVO.setPaymentSms( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "PAYMENTS_SMS")))); settingsVO.setPaymentEmail( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "PAYMENTS_MAIL")))); settingsVO.setBirthdaySms( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "BIRTHDAY_SMS")))); settingsVO.setBirthdayEmail( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "BIRTHDAY_MAIL")))); settingsVO.setAnniversarySms( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "ANNIVERSARY_SMS")))); settingsVO.setAnniversaryEmail( stringToBoolean(StringUtil.getStringValue(dataSet.getIntValue(0, "ANNIVERSARY_MAIL")))); return settingsVO; }