From 87c0ffb212004e38c7ea4535e163d61b9d155152 Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Mon, 27 Aug 2012 17:07:55 +0200 Subject: [PATCH] Add new field in Configuration class to store the timesheets periodicity * Add new field personalTimesheetsPeriodicity in Configuration * Configure Hibernate mapping * Create new enum PersonalTimesheetsPeriodicityEnum * Configure Liquibase changelog to add the new column FEA: ItEr77S07PersonalTimesheetsPeriodictyConfiguration --- .../common/entities/Configuration.java | 10 +++++ .../PersonalTimesheetsPeriodicityEnum.java | 45 +++++++++++++++++++ .../src/main/resources/db.changelog-1.3.xml | 11 +++++ .../common/entities/Configuration.hbm.xml | 6 +++ 4 files changed, 72 insertions(+) create mode 100644 libreplan-business/src/main/java/org/libreplan/business/common/entities/PersonalTimesheetsPeriodicityEnum.java diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/entities/Configuration.java b/libreplan-business/src/main/java/org/libreplan/business/common/entities/Configuration.java index 59cbd304b..0705bf6c5 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/common/entities/Configuration.java +++ b/libreplan-business/src/main/java/org/libreplan/business/common/entities/Configuration.java @@ -111,6 +111,7 @@ public class Configuration extends BaseEntity { private TypeOfWorkHours monthlyTimesheetsTypeOfWorkHours; + private PersonalTimesheetsPeriodicityEnum personalTimesheetsPeriodicity = PersonalTimesheetsPeriodicityEnum.MONTHLY; public void setDefaultCalendar(BaseCalendar defaultCalendar) { this.defaultCalendar = defaultCalendar; @@ -460,4 +461,13 @@ public class Configuration extends BaseEntity { monthlyTimesheetsTypeOfWorkHours = typeOfWorkHours; } + public PersonalTimesheetsPeriodicityEnum getPersonalTimesheetsPeriodicity() { + return personalTimesheetsPeriodicity; + } + + public void setPersonalTimesheetsPeriodicity( + PersonalTimesheetsPeriodicityEnum personalTimesheetsPeriodicity) { + this.personalTimesheetsPeriodicity = personalTimesheetsPeriodicity; + } + } diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/entities/PersonalTimesheetsPeriodicityEnum.java b/libreplan-business/src/main/java/org/libreplan/business/common/entities/PersonalTimesheetsPeriodicityEnum.java new file mode 100644 index 000000000..139b97180 --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/common/entities/PersonalTimesheetsPeriodicityEnum.java @@ -0,0 +1,45 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2012 Igalia, S.L. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.libreplan.business.common.entities; + +import static org.libreplan.business.i18n.I18nHelper._; + +/** + * Different values for personal timesheets periodicity. + * + * @author Manuel Rego Casasnovas + */ +public enum PersonalTimesheetsPeriodicityEnum { + + MONTHLY(_("Monthly")), + TWICE_MONTHLY(_("Twice-monthly")), + WEEKLY(_("Weekly")); + + private String name; + + private PersonalTimesheetsPeriodicityEnum(String name) { + this.name = name; + } + + public String getName() { + return name; + } + +} diff --git a/libreplan-business/src/main/resources/db.changelog-1.3.xml b/libreplan-business/src/main/resources/db.changelog-1.3.xml index a798dedb3..0a2ba45eb 100644 --- a/libreplan-business/src/main/resources/db.changelog-1.3.xml +++ b/libreplan-business/src/main/resources/db.changelog-1.3.xml @@ -28,4 +28,15 @@ + + Add personal_timesheets_periodicity column to configuration + + + + + + + + diff --git a/libreplan-business/src/main/resources/org/libreplan/business/common/entities/Configuration.hbm.xml b/libreplan-business/src/main/resources/org/libreplan/business/common/entities/Configuration.hbm.xml index 7da305270..b9c37346c 100644 --- a/libreplan-business/src/main/resources/org/libreplan/business/common/entities/Configuration.hbm.xml +++ b/libreplan-business/src/main/resources/org/libreplan/business/common/entities/Configuration.hbm.xml @@ -82,6 +82,12 @@ + + + org.libreplan.business.common.entities.PersonalTimesheetsPeriodicityEnum + + +