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
This commit is contained in:
Manuel Rego Casasnovas 2012-08-27 17:07:55 +02:00
parent 436b459891
commit 87c0ffb212
4 changed files with 72 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
package org.libreplan.business.common.entities;
import static org.libreplan.business.i18n.I18nHelper._;
/**
* Different values for personal timesheets periodicity.
*
* @author Manuel Rego Casasnovas <rego@igalia.com>
*/
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;
}
}

View file

@ -28,4 +28,15 @@
</update>
</changeSet>
<changeSet id="add-personal_timesheets_periodicity-column-to-configuration"
author="mrego">
<comment>Add personal_timesheets_periodicity column to configuration</comment>
<addColumn tableName="configuration">
<column name="personal_timesheets_periodicity" type="INT" />
</addColumn>
<update tableName="configuration">
<column name="personal_timesheets_periodicity" value="0" />
</update>
</changeSet>
</databaseChangeLog>

View file

@ -82,6 +82,12 @@
<many-to-one name="monthlyTimesheetsTypeOfWorkHours" cascade="none"
column="monthly_timesheets_type_of_work_hours" />
<property name="personalTimesheetsPeriodicity" column="personal_timesheets_periodicity">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">org.libreplan.business.common.entities.PersonalTimesheetsPeriodicityEnum</param>
</type>
</property>
<component name="ldapConfiguration" class="org.libreplan.business.common.entities.LDAPConfiguration">
<property name="ldapHost" column="ldap_host"/>
<property name="ldapPort" column="ldap_port"/>