Fixes #2320
authorn.hoffmann <n.hoffmann@localhost>
Mon, 11 Apr 2011 09:12:03 +0000 (09:12 +0000)
committern.hoffmann <n.hoffmann@localhost>
Mon, 11 Apr 2011 09:12:03 +0000 (09:12 +0000)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorInputTypeValues.java

index 5a7fa09083e9f1d6d0c74f9cdc729891fa9c3184..5912e1f98f526d633b1f14eef0aa5c158601a059 100644 (file)
@@ -1,12 +1,12 @@
 // $Id$
 /**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy 
+ * http://www.e-taxonomy.eu
+ 
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
 
 package eu.etaxonomy.taxeditor.bulkeditor.command;
 
@@ -33,94 +33,83 @@ import eu.etaxonomy.taxeditor.bulkeditor.input.ReferenceEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.UserEditorInput;
 
 /**
- * <p>BulkEditorInputTypeValues class.</p>
- *
+ * <p>
+ * BulkEditorInputTypeValues class.
+ * </p>
+ * 
  * @author p.ciardelli
  * @created 20.08.2009
  * @version 1.0
  */
 public class BulkEditorInputTypeValues implements IParameterValues {
 
-       public enum BulkEditorInputType{
-               REFERENCE("Reference", ReferenceEditorInput.ID),
-               NAME("Name", NameEditorInput.ID),
-               AGENT("Authors and Author Teams", AgentEditorInput.ID),
-               OCCURRENCE("Specimens or Observations", OccurrenceEditorInput.ID), 
-               NAME_RELATIONSHIP("Name Relationship", NameRelationshipEditorInput.ID),
-               USER("User", UserEditorInput.ID), 
-               GROUP("Group", GroupEditorInput.ID);
-               
-               
+       public enum BulkEditorInputType {
+               REFERENCE("Reference", ReferenceEditorInput.ID), NAME("Name",
+                               NameEditorInput.ID), AGENT("Authors and Author Teams",
+                               AgentEditorInput.ID), OCCURRENCE("Specimens and Observations",
+                               OccurrenceEditorInput.ID), NAME_RELATIONSHIP(
+                               "Name Relationship", NameRelationshipEditorInput.ID), USER(
+                               "User", UserEditorInput.ID), GROUP("Group", GroupEditorInput.ID);
+
                public String id;
                public String label;
-               
-               BulkEditorInputType(String label, String id){
+
+               BulkEditorInputType(String label, String id) {
                        this.id = id;
                        this.label = label;
                }
-               
-               public static BulkEditorInputType getById(String id){
-                       
-                       for(BulkEditorInputType type : values()){
-                               if(id.equals(type.id)){
+
+               public static BulkEditorInputType getById(String id) {
+
+                       for (BulkEditorInputType type : values()) {
+                               if (id.equals(type.id)) {
                                        return type;
                                }
                        }
-                       
+
                        return null;
                }
-               
-               public static BulkEditorInputType getByType(Class clazz){
+
+               public static BulkEditorInputType getByType(Class clazz) {
                        if (Reference.class.isAssignableFrom(clazz)) {
                                return REFERENCE;
-                       }
-                       else if (TaxonNameBase.class.isAssignableFrom(clazz)) {
+                       } else if (TaxonNameBase.class.isAssignableFrom(clazz)) {
                                return NAME;
-                       }
-                       else if (AgentBase.class.isAssignableFrom(clazz)) {
+                       } else if (AgentBase.class.isAssignableFrom(clazz)) {
                                return AGENT;
-                       }
-                       else if (SpecimenOrObservationBase.class.isAssignableFrom(clazz)){
+                       } else if (SpecimenOrObservationBase.class.isAssignableFrom(clazz)) {
                                return OCCURRENCE;
-                       }
-                       else if (NameRelationship.class.isAssignableFrom(clazz)){
+                       } else if (NameRelationship.class.isAssignableFrom(clazz)) {
                                return NAME_RELATIONSHIP;
-                       }
-                       else if (Group.class.isAssignableFrom(clazz)){
+                       } else if (Group.class.isAssignableFrom(clazz)) {
                                return GROUP;
-                       }
-                       else if (User.class.isAssignableFrom(clazz)){
+                       } else if (User.class.isAssignableFrom(clazz)) {
                                return USER;
                        }
                        return null;
                }
-               
+
                public static BulkEditorInputType getByInput(IEditorInput input) {
                        if (input instanceof ReferenceEditorInput) {
                                return REFERENCE;
-                       }
-                       else if (input instanceof NameEditorInput) {
+                       } else if (input instanceof NameEditorInput) {
                                return NAME;
-                       }
-                       else if (input instanceof AgentEditorInput) {
+                       } else if (input instanceof AgentEditorInput) {
                                return AGENT;
-                       }
-                       else if (input instanceof OccurrenceEditorInput) {
+                       } else if (input instanceof OccurrenceEditorInput) {
                                return OCCURRENCE;
-                       }
-                       else if (input instanceof NameRelationshipEditorInput) {
+                       } else if (input instanceof NameRelationshipEditorInput) {
                                return NAME_RELATIONSHIP;
-                       }
-                       else if(input instanceof UserEditorInput){
+                       } else if (input instanceof UserEditorInput) {
                                return USER;
-                       }
-                       else if(input instanceof GroupEditorInput){
+                       } else if (input instanceof GroupEditorInput) {
                                return GROUP;
                        }
                        return null;
                }
-               
-               public static AbstractBulkEditorInput getInput(BulkEditorInputType inputType){
+
+               public static AbstractBulkEditorInput getInput(
+                               BulkEditorInputType inputType) {
                        switch (inputType) {
                        case REFERENCE:
                                return new ReferenceEditorInput();
@@ -137,27 +126,33 @@ public class BulkEditorInputTypeValues implements IParameterValues {
                        case GROUP:
                                return new GroupEditorInput();
                        default:
-                               throw new IllegalStateException("No input class for the given input type defined.");
+                               throw new IllegalStateException(
+                                               "No input class for the given input type defined.");
                        }
                }
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.eclipse.core.commands.IParameterValues#getParameterValues()
         */
        /**
-        * <p>getParameterValues</p>
-        *
+        * <p>
+        * getParameterValues
+        * </p>
+        * 
         * @return a {@link java.util.Map} object.
         */
+       @Override
        public Map getParameterValues() {
                final Map values = new HashMap();
-               
+
                // TODO user role determines which editor inputs are returned
-               for (BulkEditorInputType inputType : BulkEditorInputType.values()){
+               for (BulkEditorInputType inputType : BulkEditorInputType.values()) {
                        values.put(inputType.label, inputType.id);
-               }               
-               
+               }
+
                return values;
        }
 }