001/*
002 * Licensed under the Apache License, Version 2.0 (the "License");
003 * you may not use this file except in compliance with the License.
004 * You may obtain a copy of the License at
005 *
006 *     http://www.apache.org/licenses/LICENSE-2.0
007 *
008 * Unless required by applicable law or agreed to in writing, software
009 * distributed under the License is distributed on an "AS IS" BASIS,
010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
011 * See the License for the specific language governing permissions and
012 * limitations under the License.
013 */
014package org.gbif.api.model.collections;
015
016import org.gbif.api.vocabulary.collections.MasterSourceType;
017
018import java.lang.annotation.Documented;
019import java.lang.annotation.ElementType;
020import java.lang.annotation.Repeatable;
021import java.lang.annotation.Retention;
022import java.lang.annotation.RetentionPolicy;
023import java.lang.annotation.Target;
024
025/**
026 * Annotation to indicate that a field can be populated from external sources.
027 *
028 * <p>This is used in GRSciColl to flag fields whose value comes from other sources rather than
029 * GRSciColl such as IH, datasets or organizations.
030 */
031@Documented
032@Retention(RetentionPolicy.RUNTIME)
033@Target({ElementType.FIELD})
034@Repeatable(value = Sourceables.class)
035public @interface Sourceable {
036
037  MasterSourceType[] masterSources() default {};
038
039  /**
040   * Indicates that only some parts are sourceable. If this field is not set it's assumed that the
041   * whole field is sourceable.
042   *
043   * <p>This applies only to lists or similar. For example, a list of identifiers where only the DOI
044   * identifiers are sourceable would set this field as {DOI}.
045   */
046  String[] sourceableParts() default {};
047
048  /**
049   * Indicates that a field is initially filled from an external source, but it can be overwritten
050   * afterwards.
051   *
052   * <p>E.g.: the names of IH collections.
053   */
054  boolean overridable() default false;
055}