001/* 
002 * Copyright 2018 Leibniz-Institut für Analytische Wissenschaften – ISAS – e.V..
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package uk.ac.ebi.pride.jmztab2.model;
017
018/**
019 * Define all elements used in metadata.
020 *
021 * @author qingwei
022 * @author nilshoffmann
023 * @since 23/05/13
024 * 
025 */
026public enum MetadataElement {
027    MZTAB                             ("mzTab"),
028    TITLE                             ("title"),
029    DESCRIPTION                       ("description"),
030    SAMPLE_PROCESSING                 ("sample_processing"),
031    INSTRUMENT                        ("instrument"),
032    SOFTWARE                          ("software"),
033    PUBLICATION                       ("publication"),
034    CONTACT                           ("contact"),
035    URI                               ("uri"),
036    EXTERNAL_STUDY_URI                ("external_study_uri"),
037    DERIVATIZATION_AGENT              ("derivatization_agent"),
038    QUANTIFICATION_METHOD             ("quantification_method"),
039    SMALL_MOLECULE                    ("small_molecule"),
040    SMALL_MOLECULE_FEATURE            ("small_molecule_feature"),
041    MS_RUN                            ("ms_run"),
042    CUSTOM                            ("custom"),
043    SAMPLE                            ("sample"),
044    ASSAY                             ("assay"),
045    STUDY_VARIABLE                    ("study_variable"),
046    CV                                ("cv"),
047    COLUNIT                           ("colunit"),
048    COLUNIT_SMALL_MOLECULE            ("colunit-small_molecule"),
049    COLUNIT_SMALL_MOLECULE_FEATURE    ("colunit-small_molecule_feature"),
050    COLUNIT_SMALL_MOLECULE_EVIDENCE   ("colunit-small_molecule_evidence"),
051    ID_CONFIDENCE_MEASURE             ("id_confidence_measure"),
052    DATABASE                          ("database"),
053    SMALLMOLECULE_QUANTIFICATION_UNIT ("small_molecule-quantification_unit"),
054    SMALLMOLECULE_FEATURE_QUANTIFICATION_UNIT ("small_molecule_feature-quantification_unit"),
055    SMALLMOLECULE_IDENTIFICATION_RELIABILITY ("small_molecule-identification_reliability");
056
057    private final String name;
058
059    MetadataElement(String name) {
060        this.name = name;
061    }
062
063    /**
064     * <p>Getter for the field <code>name</code>.</p>
065     *
066     * @return element name.
067     */
068    public String getName() {
069        return name;
070    }
071
072    /** {@inheritDoc} */
073    @Override
074    public String toString() {
075        return name;
076    }
077
078    /**
079     * Find element by name with case-insensitive match. If not find, return null.
080     *
081     * @param name a {@link java.lang.String} object.
082     * @return a {@link uk.ac.ebi.pride.jmztab2.model.MetadataElement} object.
083     */
084    public static MetadataElement findElement(String name) {
085        if (name == null) {
086            return null;
087        }
088
089        MetadataElement element;
090        try {
091            element = MetadataElement.valueOf(name.trim().toUpperCase());
092        } catch (IllegalArgumentException e) {
093            element = null;
094        }
095
096        return element;
097    }
098}