    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.imaging.formats.jpeg.iptc;
    018
    019public enum IptcTypes implements IptcType {
    020    RECORD_VERSION(0, "Record Version"), OBJECT_TYPE_REFERENCE(3, "Object Type Reference"), OBJECT_ATTRIBUTE_REFERENCE(4, "Object Attribute Reference"),
    021    OBJECT_NAME(5, "Object Name"), EDIT_STATUS(7, "Edit Status"), EDITORIAL_UPDATE(8, "Editorial Update"), URGENCY(10, "Urgency"),
    022    SUBJECT_REFERENCE(12, "Subject Reference"), CATEGORY(15, "Category"), SUPPLEMENTAL_CATEGORY(20, "Supplemental Category"),
    023    FIXTURE_IDENTIFIER(22, "Fixture Identifier"), KEYWORDS(25, "Keywords"), CONTENT_LOCATION_CODE(26, "Content Location Code"),
    024    CONTENT_LOCATION_NAME(27, "Content Location Name"), RELEASE_DATE(30, "Release Date"), RELEASE_TIME(35, "Release Time"),
    025    EXPIRATION_DATE(37, "Expiration Date"), EXPIRATION_TIME(38, "Expiration Time"), SPECIAL_INSTRUCTIONS(40, "Special Instructions"),
    026    ACTION_ADVISED(42, "Action Advised"), REFERENCE_SERVICE(45, "Reference Service"), REFERENCE_DATE(47, "Reference Date"),
    027    REFERENCE_NUMBER(50, "Reference Number"), DATE_CREATED(55, "Date Created"), TIME_CREATED(60, "Time Created"),
    028    DIGITAL_CREATION_DATE(62, "Digital Creation Date"), DIGITAL_CREATION_TIME(63, "Digital Creation Time"), ORIGINATING_PROGRAM(65, "Originating Program"),
    029    PROGRAM_VERSION(70, "Program Version"), OBJECT_CYCLE(75, "Object Cycle"), BYLINE(80, "By-line"), BYLINE_TITLE(85, "By-line Title"), CITY(90, "City"),
    030    SUBLOCATION(92, "Sublocation"), PROVINCE_STATE(95, "Province/State"), COUNTRY_PRIMARY_LOCATION_CODE(100, "Country/Primary Location Code"),
    031    COUNTRY_PRIMARY_LOCATION_NAME(101, "Country/Primary Location Name"), ORIGINAL_TRANSMISSION_REFERENCE(103, "Original Transmission, Reference"),
    032    HEADLINE(105, "Headline"), CREDIT(110, "Credit"), SOURCE(115, "Source"), COPYRIGHT_NOTICE(116, "Copyright Notice"), CONTACT(118, "Contact"),
    033    CAPTION_ABSTRACT(120, "Caption/Abstract"), WRITER_EDITOR(122, "Writer/Editor"), RASTERIZED_CAPTION(125, "Rasterized Caption"), IMAGE_TYPE(130, "ImageType"),
    034    IMAGE_ORIENTATION(131, "Image Orientation"), LANGUAGE_IDENTIFIER(135, "Language Identifier"), AUDIO_TYPE(150, "Audio Type"),
    035    AUDIO_SAMPLING_RATE(151, "Audio Sampling Rate"), AUDIO_SAMPLING_RESOLUTION(152, "Audio Sampling Resolution"), AUDIO_DURATION(153, "Audio Duration"),
    036    AUDIO_OUTCUE(154, "Audio Outcue"), OBJECT_DATA_PREVIEW_FILE_FORMAT(200, "Object Data Preview, File Format"),
    037    OBJECT_DATA_PREVIEW_FILE_FORMAT_VERSION(201, "Object Data Preview, File Format Version"), OBJECT_DATA_PREVIEW_DATA(202, "Object Data Preview Data");
    038
    039    public static IptcType getUnknown(final int type) {
    040        return new IptcType() {
    041            @Override
    042            public String getName() {
    043                return "Unknown";
    044            }
    045
    046            @Override
    047            public int getType() {
    048                return type;
    049            }
    050
    051            @Override
    052            public String toString() {
    053                return "Unknown (" + type + ")";
    054            }
    055        };
    056    }
    057
    058    public final int type;
    059
    060    public final String name;
    061
    062    IptcTypes(final int type, final String name) {
    063        this.type = type;
    064        this.name = name;
    065    }
    066
    067    @Override
    068    public String getName() {
    069        return name;
    070    }
    071
    072    @Override
    073    public int getType() {
    074        return type;
    075    }
    076
    077    @Override
    078    public String toString() {
    079        return name + " (" + type + ")";
    080    }
    081}