Author: tchemit Date: 2008-02-14 06:25:10 +0000 (Thu, 14 Feb 2008) New Revision: 948 Added: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableBean.java Log: introduction d'un bean qui encapsule un LoggableElement + sa provenance (utilis?\195?\169 dans l'historique de l'onglet detail afin de pouvoir g?\195?\169rer dans l'historique les deux provenances de LE) Added: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableBean.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableBean.java (rev 0) +++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/model/LoggableBean.java 2008-02-14 06:25:10 UTC (rev 948) @@ -0,0 +1,106 @@ +/* +* ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, +* Tony Chemit, Gabriel Landais +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package fr.cemagref.simexplorer.is.ui.swing.model; + +import fr.cemagref.simexplorer.is.entities.data.LoggableElement; +import fr.cemagref.simexplorer.is.entities.metadata.MetaData; +import fr.cemagref.simexplorer.is.entities.metadata.Version; +import fr.cemagref.simexplorer.is.attachment.Attachment; + +import java.util.Date; +import java.util.Map; +import java.util.List; + +/** + * Un bean pour encapsuler un LoggableElement et sa provenance (local ou remote) + * + * @author chemit + */ +public class LoggableBean { + + protected boolean remote; + + protected LoggableElement element; + + public LoggableBean(LoggableElement element, boolean remote) { + this.element = element; + this.remote = remote; + } + + public LoggableElement getElement() { + return element; + } + + public boolean isRemote() { + return remote; + } + + public MetaData getMetaData() { + return getElement().getMetaData(); + } + + @Override + public String toString() { + return getElement().toString(); + } + + public String getDescription() { + return getMetaData().getDescription(); + } + + public Date getCreationDate() { + return getMetaData().getCreationDate(); + } + + public String getName() { + return getMetaData().getName(); + } + + public String getType() { + return getMetaData().getType(); + } + + public String getUuid() { + return getMetaData().getUuid(); + } + + public Version getVersion() { + return getMetaData().getVersion(); + } + + public boolean isLatest() { + return getMetaData().isLatest(); + } + + public String getHash() { + return getMetaData().getHash(); + } + + public Map<String, String> getDescriptors() { + return getMetaData().getDescriptors(); + } + + public List<Attachment> getAttachments() { + return getMetaData().getAttachments(); + } + + public Attachment getAttachment(Integer attachmentIndex) { + return getMetaData().getAttachment(attachmentIndex); + } +}