From 8cde179bb3de0bbe09ebe24351c42464e7236dc1 Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Tue, 17 Nov 2009 12:36:15 +0100 Subject: [PATCH] ItEr35S08CUAsignacionCalendarioLaboralRecursoItEr25S09: Added DAO for Configuration entity. --- .../common/daos/ConfigurationDAO.java | 49 +++++++++++++++++++ .../common/daos/IConfigurationDAO.java | 37 ++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 navalplanner-business/src/main/java/org/navalplanner/business/common/daos/ConfigurationDAO.java create mode 100644 navalplanner-business/src/main/java/org/navalplanner/business/common/daos/IConfigurationDAO.java diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/common/daos/ConfigurationDAO.java b/navalplanner-business/src/main/java/org/navalplanner/business/common/daos/ConfigurationDAO.java new file mode 100644 index 000000000..0080b4a37 --- /dev/null +++ b/navalplanner-business/src/main/java/org/navalplanner/business/common/daos/ConfigurationDAO.java @@ -0,0 +1,49 @@ +/* + * This file is part of ###PROJECT_NAME### + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * 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.navalplanner.business.common.daos; + +import java.util.List; + +import org.navalplanner.business.common.entities.Configuration; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Repository; + +/** + * DAO for {@link Configuration}. + * + * @author Manuel Rego Casasnovas + */ +@Repository +@Scope(BeanDefinition.SCOPE_SINGLETON) +public class ConfigurationDAO extends GenericDAOHibernate + implements IConfigurationDAO { + + @Override + public Configuration getConfiguration() { + List list = list(Configuration.class); + if (list.isEmpty()) { + return null; + } + return list.get(0); + } + +} diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/common/daos/IConfigurationDAO.java b/navalplanner-business/src/main/java/org/navalplanner/business/common/daos/IConfigurationDAO.java new file mode 100644 index 000000000..a7371b762 --- /dev/null +++ b/navalplanner-business/src/main/java/org/navalplanner/business/common/daos/IConfigurationDAO.java @@ -0,0 +1,37 @@ +/* + * This file is part of ###PROJECT_NAME### + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * 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.navalplanner.business.common.daos; + +import org.navalplanner.business.common.entities.Configuration; + +/** + * DAO interface for {@link ConfigurationDAO}. + * + * @author Manuel Rego Casasnovas + */ +public interface IConfigurationDAO extends IGenericDAO { + + /** + * @return The application configuration. + */ + Configuration getConfiguration(); + +}