diff --git a/libreplan-business/src/main/java/org/libreplan/business/resources/entities/Worker.java b/libreplan-business/src/main/java/org/libreplan/business/resources/entities/Worker.java index d23894dfd..23ea4aee8 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/resources/entities/Worker.java +++ b/libreplan-business/src/main/java/org/libreplan/business/resources/entities/Worker.java @@ -3,7 +3,7 @@ * * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e * Desenvolvemento Tecnolóxico de Galicia - * Copyright (C) 2010-2011 Igalia, S.L. + * Copyright (C) 2010-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 @@ -27,6 +27,7 @@ import org.hibernate.validator.AssertTrue; import org.hibernate.validator.NotEmpty; import org.libreplan.business.common.Registry; import org.libreplan.business.common.exceptions.InstanceNotFoundException; +import org.libreplan.business.users.entities.User; /** * This class models a worker. @@ -35,6 +36,7 @@ import org.libreplan.business.common.exceptions.InstanceNotFoundException; * * @author Fernando Bellas Permuy * @author Susana Montes Pedreira + * @author Manuel Rego Casasnovas */ public class Worker extends Resource { @@ -90,6 +92,8 @@ public class Worker extends Resource { private String nif; + private User user; + /** * Constructor for hibernate. Do not use! */ @@ -202,4 +206,12 @@ public class Worker extends Resource { return firstName + " " + surname; } + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + } diff --git a/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java b/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java index ed26b4725..d8eca3f72 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java +++ b/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java @@ -3,7 +3,7 @@ * * Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e * Desenvolvemento Tecnolóxico de Galicia - * Copyright (C) 2010-2011 Igalia, S.L. + * Copyright (C) 2010-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 @@ -30,6 +30,7 @@ import org.libreplan.business.common.BaseEntity; import org.libreplan.business.common.IHumanIdentifiable; import org.libreplan.business.common.Registry; import org.libreplan.business.common.exceptions.InstanceNotFoundException; +import org.libreplan.business.resources.entities.Worker; import org.libreplan.business.scenarios.entities.Scenario; import org.libreplan.business.settings.entities.Language; import org.libreplan.business.users.daos.IUserDAO; @@ -41,7 +42,7 @@ import org.libreplan.business.users.daos.IUserDAO; * @author Jacobo Aragunde Perez * @author Cristina Alvarino Perez * @author Ignacio Diaz Teijido - * + * @author Manuel Rego Casasnovas */ public class User extends BaseEntity implements IHumanIdentifiable{ @@ -74,6 +75,8 @@ public class User extends BaseEntity implements IHumanIdentifiable{ private String lastName = ""; + private Worker worker; + /** * Necessary for Hibernate. Please, do not call it. */ @@ -292,4 +295,12 @@ public class User extends BaseEntity implements IHumanIdentifiable{ return "LDAP"; } + public Worker getWorker() { + return worker; + } + + public void setWorker(Worker worker) { + this.worker = worker; + } + } diff --git a/libreplan-business/src/main/resources/db.changelog-1.2.xml b/libreplan-business/src/main/resources/db.changelog-1.2.xml index 4444d9dbf..f31e78b37 100644 --- a/libreplan-business/src/main/resources/db.changelog-1.2.xml +++ b/libreplan-business/src/main/resources/db.changelog-1.2.xml @@ -451,4 +451,16 @@ + + Add column and constraints needed for relationship between worker and user + + + + + + + diff --git a/libreplan-business/src/main/resources/org/libreplan/business/resources/entities/Resources.hbm.xml b/libreplan-business/src/main/resources/org/libreplan/business/resources/entities/Resources.hbm.xml index 7190bc125..fdcc97690 100644 --- a/libreplan-business/src/main/resources/org/libreplan/business/resources/entities/Resources.hbm.xml +++ b/libreplan-business/src/main/resources/org/libreplan/business/resources/entities/Resources.hbm.xml @@ -59,6 +59,10 @@ + + diff --git a/libreplan-business/src/main/resources/org/libreplan/business/users/entities/Users.hbm.xml b/libreplan-business/src/main/resources/org/libreplan/business/users/entities/Users.hbm.xml index 3517bffda..a3e3f3d11 100644 --- a/libreplan-business/src/main/resources/org/libreplan/business/users/entities/Users.hbm.xml +++ b/libreplan-business/src/main/resources/org/libreplan/business/users/entities/Users.hbm.xml @@ -59,6 +59,10 @@ + + +