    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(
    021            0, "Record Version"),
    022    OBJECT_TYPE_REFERENCE(
    023            3, "Object Type Reference"),
    024    OBJECT_ATTRIBUTE_REFERENCE(
    025            4, "Object Attribute Reference"),
    026    OBJECT_NAME(
    027            5, "Object Name"),
    028    EDIT_STATUS(
    029            7, "Edit Status"),
    030    EDITORIAL_UPDATE(
    031            8, "Editorial Update"),
    032    URGENCY(
    033            10, "Urgency"),
    034    SUBJECT_REFERENCE(
    035            12, "Subject Reference"),
    036    CATEGORY(
    037            15, "Category"),
    038    SUPPLEMENTAL_CATEGORY(
    039            20, "Supplemental Category"),
    040    FIXTURE_IDENTIFIER(
    041            22, "Fixture Identifier"),
    042    KEYWORDS(
    043            25, "Keywords"),
    044    CONTENT_LOCATION_CODE(
    045            26, "Content Location Code"),
    046    CONTENT_LOCATION_NAME(
    047            27, "Content Location Name"),
    048    RELEASE_DATE(
    049            30, "Release Date"),
    050    RELEASE_TIME(
    051            35, "Release Time"),
    052    EXPIRATION_DATE(
    053            37, "Expiration Date"),
    054    EXPIRATION_TIME(
    055            38, "Expiration Time"),
    056    SPECIAL_INSTRUCTIONS(
    057            40, "Special Instructions"),
    058    ACTION_ADVISED(
    059            42, "Action Advised"),
    060    REFERENCE_SERVICE(
    061            45, "Reference Service"),
    062    REFERENCE_DATE(
    063            47, "Reference Date"),
    064    REFERENCE_NUMBER(
    065            50, "Reference Number"),
    066    DATE_CREATED(
    067            55, "Date Created"),
    068    TIME_CREATED(
    069            60, "Time Created"),
    070    DIGITAL_CREATION_DATE(
    071            62, "Digital Creation Date"),
    072    DIGITAL_CREATION_TIME(
    073            63, "Digital Creation Time"),
    074    ORIGINATING_PROGRAM(
    075            65, "Originating Program"),
    076    PROGRAM_VERSION(
    077            70, "Program Version"),
    078    OBJECT_CYCLE(
    079            75, "Object Cycle"),
    080    BYLINE(
    081            80, "By-line"),
    082    BYLINE_TITLE(
    083            85, "By-line Title"),
    084    CITY(
    085            90, "City"),
    086    SUBLOCATION(
    087            92, "Sublocation"),
    088    PROVINCE_STATE(
    089            95, "Province/State"),
    090    COUNTRY_PRIMARY_LOCATION_CODE(
    091            100, "Country/Primary Location Code"),
    092    COUNTRY_PRIMARY_LOCATION_NAME(
    093            101, "Country/Primary Location Name"),
    094    ORIGINAL_TRANSMISSION_REFERENCE(
    095            103, "Original Transmission, Reference"),
    096    HEADLINE(
    097            105, "Headline"),
    098    CREDIT(
    099            110, "Credit"),
    100    SOURCE(
    101            115, "Source"),
    102    COPYRIGHT_NOTICE(
    103            116, "Copyright Notice"),
    104    CONTACT(
    105            118, "Contact"),
    106    CAPTION_ABSTRACT(
    107            120, "Caption/Abstract"),
    108    WRITER_EDITOR(
    109            122, "Writer/Editor"),
    110    RASTERIZED_CAPTION(
    111            125, "Rasterized Caption"),
    112    IMAGE_TYPE(
    113            130, "ImageType"),
    114    IMAGE_ORIENTATION(
    115            131, "Image Orientation"),
    116    LANGUAGE_IDENTIFIER(
    117            135, "Language Identifier"),
    118    AUDIO_TYPE(
    119            150, "Audio Type"),
    120    AUDIO_SAMPLING_RATE(
    121            151, "Audio Sampling Rate"),
    122    AUDIO_SAMPLING_RESOLUTION(
    123            152, "Audio Sampling Resolution"),
    124    AUDIO_DURATION(
    125            153, "Audio Duration"),
    126    AUDIO_OUTCUE(
    127            154, "Audio Outcue"),
    128    OBJECT_DATA_PREVIEW_FILE_FORMAT(
    129            200, "Object Data Preview, File Format"),
    130    OBJECT_DATA_PREVIEW_FILE_FORMAT_VERSION(
    131            201, "Object Data Preview, File Format Version"),
    132    OBJECT_DATA_PREVIEW_DATA(
    133            202, "Object Data Preview Data");
    134
    135    public final int type;
    136    public final String name;
    137
    138    IptcTypes(final int type, final String name) {
    139        this.type = type;
    140        this.name = name;
    141    }
    142
    143    @Override
    144    public String getName() {
    145        return name;
    146    }
    147
    148    @Override
    149    public int getType() {
    150        return type;
    151    }
    152
    153    @Override
    154    public String toString() {
    155        return name + " (" + type + ")";
    156    }
    157
    158    public static IptcType getUnknown(final int type) {
    159        return new IptcType() {
    160            @Override
    161            public String getName() {
    162                return "Unknown";
    163            }
    164
    165            @Override
    166            public int getType() {
    167                return type;
    168            }
    169
    170            @Override
    171            public String toString() {
    172                return "Unknown (" + type + ")";
    173            }
    174        };
    175    }
    176}