Author: tchemit Date: 2008-02-16 14:56:40 +0000 (Sat, 16 Feb 2008) New Revision: 1017 Removed: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities/EntitiesAction.java Log: utilisation EntityHelper dans module storage Deleted: trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities/EntitiesAction.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities/EntitiesAction.java 2008-02-16 14:56:00 UTC (rev 1016) +++ trunk/simexplorer-is/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/entities/EntitiesAction.java 2008-02-16 14:56:40 UTC (rev 1017) @@ -1,76 +0,0 @@ -/* -* ##% 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.entities; - -import fr.cemagref.simexplorer.is.entities.data.Component; -import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication; -import fr.cemagref.simexplorer.is.entities.data.ExplorationData; -import fr.cemagref.simexplorer.is.entities.data.Library; -import fr.cemagref.simexplorer.is.entities.data.Result; -import fr.cemagref.simexplorer.is.entities.data.LoggableElement; -import fr.cemagref.simexplorer.is.entities.metadata.MetaData; -import fr.cemagref.simexplorer.is.ui.swing.model.LoggableElementTreeNode; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Une énumération pour définir les actions possibles sur les entités du projet. - * - * @author chemit - */ -public enum EntitiesAction { - - DOWNLOAD(ExplorationApplication.class, Result.class, Library.class), - EXPORT(ExplorationApplication.class, Result.class, Library.class), - IMPORT(ExplorationApplication.class, Library.class), - DELETE(ExplorationApplication.class, ExplorationData.class, Component.class); - - private List<Class<?>> classes; - private List<String> types; - - private EntitiesAction(Class<?>... classes) { - this.classes = Arrays.asList(classes); - this.types = new ArrayList<String>(classes.length); - for (Class<?> aClass : classes) { - this.types.add(aClass.getSimpleName()); - } - } - - public boolean accept(LoggableElementTreeNode node) { - return node != null && node.getUserObject() != null && accept(node.getUserObject().getClass()); - } - - public boolean accept(LoggableElement sNode) { - return sNode!=null && accept(sNode.getClass()); - } - - public boolean accept(MetaData metaData) { - return metaData!=null && accept(metaData.getType()); - } - - private boolean accept(Class<?> klass) { - return classes.contains(klass); - } - - private boolean accept(String type) { - return types.contains(type); - } -}