All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infrastructurebuilder.data.model.DataStreamProvenance Maven / Gradle / Ivy

The newest version!
// =================== DO NOT EDIT THIS FILE ====================
// Generated by Modello 1.11,
// any modifications will be overwritten.
// ==============================================================

package org.infrastructurebuilder.data.model;

/**
 * Class DataStreamProvenance.
 * 
 * @version $Revision$ $Date$
 */
public class DataStreamProvenance
    implements 
          org.infrastructurebuilder.data.IBDataProvenance
        , java.io.Serializable, java.lang.Cloneable, org.infrastructurebuilder.data.model.DataSetInputLocationTracker
{

      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * UUID identifier of the datastream that this metadata
     * references.
     */
    private Dependency originator;

    /**
     *  Originating URL.
     */
    private String url;

    /**
     * Field transformations.
     */
    private java.util.List transformations;

    /**
     * Field locations.
     */
    private java.util.Map locations;

    /**
     * Field location.
     */
    private DataSetInputLocation location;

    /**
     * Field originatorLocation.
     */
    private DataSetInputLocation originatorLocation;

    /**
     * Field urlLocation.
     */
    private DataSetInputLocation urlLocation;

    /**
     * Field transformationsLocation.
     */
    private DataSetInputLocation transformationsLocation;


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Method addTransformation.
     * 
     * @param string
     */
    public void addTransformation( String string )
    {
        getTransformations().add( string );
    } //-- void addTransformation( String )

    /**
     * Method clone.
     * 
     * @return DataStreamProvenance
     */
    public DataStreamProvenance clone()
    {
        try
        {
            DataStreamProvenance copy = (DataStreamProvenance) super.clone();

            if ( this.originator != null )
            {
                copy.originator = (Dependency) this.originator.clone();
            }

            if ( this.transformations != null )
            {
                copy.transformations = new java.util.ArrayList();
                copy.transformations.addAll( this.transformations );
            }

            if ( copy.locations != null )
            {
                copy.locations = new java.util.LinkedHashMap( copy.locations );
            }

            mutatingDataStreamProvenanceCloneHook( copy );

            return copy;
        }
        catch ( java.lang.Exception ex )
        {
            throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
                + " does not support clone()" ).initCause( ex );
        }
    } //-- DataStreamProvenance clone()

    /**
     * 
     * 
     * @param key
     * @return DataSetInputLocation
     */
    public DataSetInputLocation getLocation( Object key )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    return this.location;
                }
                case "originator" :
                {
                    return originatorLocation;
                }
                case "url" :
                {
                    return urlLocation;
                }
                case "transformations" :
                {
                    return transformationsLocation;
                }
                default :
                {
                    return getOtherLocation( key );
                }
                }
            }
            else
            {
                return getOtherLocation( key );
            }
    } //-- DataSetInputLocation getLocation( Object )

    /**
     * Get uUID identifier of the datastream that this metadata
     * references.
     * 
     * @return Dependency
     */
    public Dependency getOriginator()
    {
        return this.originator;
    } //-- Dependency getOriginator()

    /**
     * 
     * 
     * @param key
     * @param location
     */
    public void setLocation( Object key, DataSetInputLocation location )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    this.location = location;
                    return;
                }
                case "originator" :
                {
                    originatorLocation = location;
                    return;
                }
                case "url" :
                {
                    urlLocation = location;
                    return;
                }
                case "transformations" :
                {
                    transformationsLocation = location;
                    return;
                }
                default :
                {
                    setOtherLocation( key, location );
                    return;
                }
                }
            }
            else
            {
                setOtherLocation( key, location );
            }
    } //-- void setLocation( Object, DataSetInputLocation )

    /**
     * 
     * 
     * @param key
     * @param location
     */
    public void setOtherLocation( Object key, DataSetInputLocation location )
    {
        if ( location != null )
        {
            if ( this.locations == null )
            {
                this.locations = new java.util.LinkedHashMap();
            }
            this.locations.put( key, location );
        }
    } //-- void setOtherLocation( Object, DataSetInputLocation )

    /**
     * 
     * 
     * @param key
     * @return DataSetInputLocation
     */
    private DataSetInputLocation getOtherLocation( Object key )
    {
        return ( locations != null ) ? locations.get( key ) : null;
    } //-- DataSetInputLocation getOtherLocation( Object )

    /**
     * Method getTransformations.
     * 
     * @return List
     */
    public java.util.List getTransformations()
    {
        if ( this.transformations == null )
        {
            this.transformations = new java.util.ArrayList();
        }

        return this.transformations;
    } //-- java.util.List getTransformations()

    /**
     * Get originating URL.
     * 
     * @return String
     */
    public String getUrl()
    {
        return this.url;
    } //-- String getUrl()

    /**
     * Method removeTransformation.
     * 
     * @param string
     */
    public void removeTransformation( String string )
    {
        getTransformations().remove( string );
    } //-- void removeTransformation( String )

    /**
     * Set uUID identifier of the datastream that this metadata
     * references.
     * 
     * @param originator
     */
    public void setOriginator( Dependency originator )
    {
        this.originator = originator;
    } //-- void setOriginator( Dependency )

    /**
     * Set list of structured data for a given field.
     * 
     * @param transformations
     */
    public void setTransformations( java.util.List transformations )
    {
        this.transformations = transformations;
    } //-- void setTransformations( java.util.List )

    /**
     * Set originating URL.
     * 
     * @param url
     */
    public void setUrl( String url )
    {
        this.url = url;
    } //-- void setUrl( String )

    
            

            // Default constructor (required because we're making a new one)
  public DataStreamProvenance() {
  }
            
          
    
            
            // Copy constructor
  public DataStreamProvenance(org.infrastructurebuilder.data.IBDataProvenance o) {
  }
            
          
    
            
            // Clone hooks

  public void mutatingDataStreamProvenanceCloneHook(DataStreamProvenance s) {
  }

  
          
    
            
            // HASH


  @Override
  public int hashCode() {
    return java.util.Objects.hash(originator, transformations, url);
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    DataStreamProvenance other = (DataStreamProvenance) obj;
    return java.util.Objects.equals(originator, other.originator)
        && java.util.Objects.equals(transformations, other.transformations)
        && java.util.Objects.equals(url, other.url);
  }

  @Override
  public String toString() {
    return "DataStreamProvenance [originator=" + originator + ", url=" + url + ", transformations=" + transformations
        + "]";
  }

  // Implement required methods
  @Override
  public java.util.Optional getOriginalSourceArtifact() {
    return java.util.Optional.ofNullable(getOriginator()).map(Dependency::asGAV);
  }

  @Override
  public java.util.Optional getOriginalURL() {
    return java.util.Optional.ofNullable(getUrl());
  }

  @Override
  public java.util.Optional> getTransformationList() {
    return java.util.Optional.ofNullable(this.transformations);
  }

    
          
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy