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

org.infrastructurebuilder.data.model.DataSet 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;

/**
 * 
 *         
 *         The <dataSet> element is the root of
 * the configuration.
 *         
 *       
 * 
 * @version $Revision$ $Date$
 */
public class DataSet
    implements 
          org.infrastructurebuilder.data.IBDataSetIdentifier
        , 
          java.lang.Comparable
        , java.io.Serializable, java.lang.Cloneable, org.infrastructurebuilder.data.model.DataSetInputLocationTracker
{

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

    /**
     * Declares to which version of project descriptor this
     * configuration conforms.  This value is the api version
     * (major.minor) of ibdata-api and conforms to semantic
     * versioning.
     */
    private String modelVersion = "1.0.0";

    /**
     * Namespace of the dataset.  This defaults to the
     * project.groupId of the building project.
     */
    private String groupId;

    /**
     * Artifact Identifier of the dataset.  This defaults to the
     * project.artifactId of the building project.
     */
    private String artifactId;

    /**
     * Version of the dataset.  This defaults to the
     * project.version of the building project.
     */
    private String version;

    /**
     * UUID identifier of the dataset.  This is the UUID from the
     * Checksums of all the DataStream elements.
     */
    private String uuid;

    /**
     * The full name of the dataset.  This defaults to the
     * project.name of the building project.
     */
    private String dataSetName;

    /**
     * A detailed description of the dataset.  This defaults to the
     * project.description of the building project.
     */
    private String dataSetDescription;

    /**
     * A Date that is very close to the moment when this DataSet
     * was persisted.  It has essentially no relationship to when
     * the streams were read, except that it must be later.
     */
    private java.util.Date creationDate;

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

    /**
     * Describes a path to the dataset.
     */
    private String path;

    /**
     * Additional metadata.
     */
    private Object metadata;

    /**
     * Field modelEncoding.
     */
    private String modelEncoding = "UTF-8";

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

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

    /**
     * Field modelVersionLocation.
     */
    private DataSetInputLocation modelVersionLocation;

    /**
     * Field groupIdLocation.
     */
    private DataSetInputLocation groupIdLocation;

    /**
     * Field artifactIdLocation.
     */
    private DataSetInputLocation artifactIdLocation;

    /**
     * Field versionLocation.
     */
    private DataSetInputLocation versionLocation;

    /**
     * Field uuidLocation.
     */
    private DataSetInputLocation uuidLocation;

    /**
     * Field dataSetNameLocation.
     */
    private DataSetInputLocation dataSetNameLocation;

    /**
     * Field dataSetDescriptionLocation.
     */
    private DataSetInputLocation dataSetDescriptionLocation;

    /**
     * Field creationDateLocation.
     */
    private DataSetInputLocation creationDateLocation;

    /**
     * Field streamsLocation.
     */
    private DataSetInputLocation streamsLocation;

    /**
     * Field pathLocation.
     */
    private DataSetInputLocation pathLocation;

    /**
     * Field metadataLocation.
     */
    private DataSetInputLocation metadataLocation;


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

    /**
     * Method addStream.
     * 
     * @param dataStream
     */
    public void addStream( DataStream dataStream )
    {
        getStreams().add( dataStream );
    } //-- void addStream( DataStream )

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

            if ( this.creationDate != null )
            {
                copy.creationDate = (java.util.Date) this.creationDate.clone();
            }

            if ( this.streams != null )
            {
                copy.streams = new java.util.ArrayList();
                for ( DataStream item : this.streams )
                {
                    copy.streams.add( ( (DataStream) item).clone() );
                }
            }

            if ( this.metadata != null )
            {
                copy.metadata = new org.codehaus.plexus.util.xml.Xpp3Dom( (org.codehaus.plexus.util.xml.Xpp3Dom) this.metadata );
            }

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

            mutatingDataSetCloneHook( copy );

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

    /**
     * Get artifact Identifier of the dataset.  This defaults to
     * the project.artifactId of the building project.
     * 
     * @return String
     */
    public String getArtifactId()
    {
        return this.artifactId;
    } //-- String getArtifactId()

    /**
     * Get a Date that is very close to the moment when this
     * DataSet was persisted.  It has essentially no relationship
     * to when the streams were read, except that it must be later.
     * 
     * @return Date
     */
    public java.util.Date getCreationDate()
    {
        return this.creationDate;
    } //-- java.util.Date getCreationDate()

    /**
     * Get a detailed description of the dataset.  This defaults to
     * the project.description of the building project.
     * 
     * @return String
     */
    public String getDataSetDescription()
    {
        return this.dataSetDescription;
    } //-- String getDataSetDescription()

    /**
     * Get the full name of the dataset.  This defaults to the
     * project.name of the building project.
     * 
     * @return String
     */
    public String getDataSetName()
    {
        return this.dataSetName;
    } //-- String getDataSetName()

    /**
     * Get namespace of the dataset.  This defaults to the
     * project.groupId of the building project.
     * 
     * @return String
     */
    public String getGroupId()
    {
        return this.groupId;
    } //-- String getGroupId()

    /**
     * 
     * 
     * @param key
     * @return DataSetInputLocation
     */
    public DataSetInputLocation getLocation( Object key )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    return this.location;
                }
                case "modelVersion" :
                {
                    return modelVersionLocation;
                }
                case "groupId" :
                {
                    return groupIdLocation;
                }
                case "artifactId" :
                {
                    return artifactIdLocation;
                }
                case "version" :
                {
                    return versionLocation;
                }
                case "uuid" :
                {
                    return uuidLocation;
                }
                case "dataSetName" :
                {
                    return dataSetNameLocation;
                }
                case "dataSetDescription" :
                {
                    return dataSetDescriptionLocation;
                }
                case "creationDate" :
                {
                    return creationDateLocation;
                }
                case "streams" :
                {
                    return streamsLocation;
                }
                case "path" :
                {
                    return pathLocation;
                }
                case "metadata" :
                {
                    return metadataLocation;
                }
                default :
                {
                    return getOtherLocation( key );
                }
                }
            }
            else
            {
                return getOtherLocation( key );
            }
    } //-- DataSetInputLocation getLocation( Object )

    /**
     * Get additional metadata.
     * 
     * @return Object
     */
    public Object getMetadata()
    {
        return this.metadata;
    } //-- Object getMetadata()

    /**
     * Get the modelEncoding field.
     * 
     * @return String
     */
    public String getModelEncoding()
    {
        return this.modelEncoding;
    } //-- String getModelEncoding()

    /**
     * Get declares to which version of project descriptor this
     * configuration conforms.  This value is the api version
     * (major.minor) of ibdata-api and conforms to semantic
     * versioning.
     * 
     * @return String
     */
    public String getModelVersion()
    {
        return this.modelVersion;
    } //-- String getModelVersion()

    /**
     * 
     * 
     * @param key
     * @param location
     */
    public void setLocation( Object key, DataSetInputLocation location )
    {
        if ( key instanceof String )
        {
            switch ( ( String ) key )
            {
                case "" :
                {
                    this.location = location;
                    return;
                }
                case "modelVersion" :
                {
                    modelVersionLocation = location;
                    return;
                }
                case "groupId" :
                {
                    groupIdLocation = location;
                    return;
                }
                case "artifactId" :
                {
                    artifactIdLocation = location;
                    return;
                }
                case "version" :
                {
                    versionLocation = location;
                    return;
                }
                case "uuid" :
                {
                    uuidLocation = location;
                    return;
                }
                case "dataSetName" :
                {
                    dataSetNameLocation = location;
                    return;
                }
                case "dataSetDescription" :
                {
                    dataSetDescriptionLocation = location;
                    return;
                }
                case "creationDate" :
                {
                    creationDateLocation = location;
                    return;
                }
                case "streams" :
                {
                    streamsLocation = location;
                    return;
                }
                case "path" :
                {
                    pathLocation = location;
                    return;
                }
                case "metadata" :
                {
                    metadataLocation = 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 )

    /**
     * Get describes a path to the dataset.
     * 
     * @return String
     */
    public String getPath()
    {
        return this.path;
    } //-- String getPath()

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

        return this.streams;
    } //-- java.util.List getStreams()

    /**
     * Get uUID identifier of the dataset.  This is the UUID from
     * the Checksums of all the DataStream elements.
     * 
     * @return String
     */
    public String getUuid()
    {
        return this.uuid;
    } //-- String getUuid()

    /**
     * Get version of the dataset.  This defaults to the
     * project.version of the building project.
     * 
     * @return String
     */
    public String getVersion()
    {
        return this.version;
    } //-- String getVersion()

    /**
     * Method removeStream.
     * 
     * @param dataStream
     */
    public void removeStream( DataStream dataStream )
    {
        getStreams().remove( dataStream );
    } //-- void removeStream( DataStream )

    /**
     * Set artifact Identifier of the dataset.  This defaults to
     * the project.artifactId of the building project.
     * 
     * @param artifactId
     */
    public void setArtifactId( String artifactId )
    {
        this.artifactId = artifactId;
    } //-- void setArtifactId( String )

    /**
     * Set a Date that is very close to the moment when this
     * DataSet was persisted.  It has essentially no relationship
     * to when the streams were read, except that it must be later.
     * 
     * @param creationDate
     */
    public void setCreationDate( java.util.Date creationDate )
    {
        this.creationDate = creationDate;
    } //-- void setCreationDate( java.util.Date )

    /**
     * Set a detailed description of the dataset.  This defaults to
     * the project.description of the building project.
     * 
     * @param dataSetDescription
     */
    public void setDataSetDescription( String dataSetDescription )
    {
        this.dataSetDescription = dataSetDescription;
    } //-- void setDataSetDescription( String )

    /**
     * Set the full name of the dataset.  This defaults to the
     * project.name of the building project.
     * 
     * @param dataSetName
     */
    public void setDataSetName( String dataSetName )
    {
        this.dataSetName = dataSetName;
    } //-- void setDataSetName( String )

    /**
     * Set namespace of the dataset.  This defaults to the
     * project.groupId of the building project.
     * 
     * @param groupId
     */
    public void setGroupId( String groupId )
    {
        this.groupId = groupId;
    } //-- void setGroupId( String )

    /**
     * Set additional metadata.
     * 
     * @param metadata
     */
    public void setMetadata( Object metadata )
    {
        this.metadata = metadata;
    } //-- void setMetadata( Object )

    /**
     * Set the modelEncoding field.
     * 
     * @param modelEncoding
     */
    public void setModelEncoding( String modelEncoding )
    {
        this.modelEncoding = modelEncoding;
    } //-- void setModelEncoding( String )

    /**
     * Set declares to which version of project descriptor this
     * configuration conforms.  This value is the api version
     * (major.minor) of ibdata-api and conforms to semantic
     * versioning.
     * 
     * @param modelVersion
     */
    public void setModelVersion( String modelVersion )
    {
        this.modelVersion = modelVersion;
    } //-- void setModelVersion( String )

    /**
     * Set describes a path to the dataset.
     * 
     * @param path
     */
    public void setPath( String path )
    {
        this.path = path;
    } //-- void setPath( String )

    /**
     * Set instances of DataStreams.
     * 
     * @param streams
     */
    public void setStreams( java.util.List streams )
    {
        this.streams = streams;
    } //-- void setStreams( java.util.List )

    /**
     * Set uUID identifier of the dataset.  This is the UUID from
     * the Checksums of all the DataStream elements.
     * 
     * @param uuid
     */
    public void setUuid( String uuid )
    {
        this.uuid = uuid;
    } //-- void setUuid( String )

    /**
     * Set version of the dataset.  This defaults to the
     * project.version of the building project.
     * 
     * @param version
     */
    public void setVersion( String version )
    {
        this.version = version;
    } //-- void setVersion( String )

    
            
  // Default constructor (Must do this if you supply a constructor)
  public DataSet() {
  }
  
          
    
            
  // Copy constructor
  public DataSet(DataSet ds) {
    this.setArtifactId(ds.getArtifactId());
    this.setCreationDate(ds.getCreationDate());
    this.setDataSetDescription(ds.getDataSetDescription());
    this.setDataSetName(ds.getDataSetName());
    this.setGroupId(ds.getGroupId());
    this.setMetadata(ds.getMetadata());
    this.setModelVersion(ds.getModelVersion());
    this.setPath(ds.getPath());
    this.setStreams(ds.getStreams().stream().map(DataStream::new).collect(java.util.stream.Collectors.toList()));
    this.setUuid(ds.getUuid());
    this.setVersion(ds.getVersion());
  }
  
          
    
            
            // Clone hooks

  private void mutatingDataSetCloneHook(DataSet ds) {
    if (streams != null)
      ds.getStreams().forEach(s -> s.setPath(org.infrastructurebuilder.data.IBDataModelUtils.relativizePath(ds, s)));
  }

  
          
    
            
  // Hashcode and equals
  @Override
  public int hashCode() {
    return java.util.Objects.hash(artifactId, creationDate, dataSetDescription, dataSetName, groupId, metadata, modelEncoding,
        modelVersion, path, streams, uuid, version);
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    DataSet other = (DataSet) obj;
    return java.util.Objects.equals(artifactId, other.artifactId)
        && java.util.Objects.equals(creationDate, other.creationDate)
        && java.util.Objects.equals(dataSetDescription, other.dataSetDescription)
        && java.util.Objects.equals(dataSetName, other.dataSetName)
        && java.util.Objects.equals(groupId, other.groupId)
        && java.util.Objects.equals(metadata, other.metadata)
        && java.util.Objects.equals(modelEncoding, other.modelEncoding)
        && java.util.Objects.equals(modelVersion, other.modelVersion)
        && java.util.Objects.equals(path, other.path)
        && java.util.Objects.equals(uuid, other.uuid)
        && java.util.Objects.equals(version, other.version)
        && java.util.Objects.equals(streams, other.streams)
        ;
  }

  
          
    
            
  @Override
  public java.util.Optional getName() {
    return java.util.Optional.ofNullable(getDataSetName());
  }

  
          
    
            
  @Override
  public java.util.Optional getDescription() {
    return java.util.Optional.ofNullable(getDataSetDescription());
  }

  
          
    
            
  @Override
  public int compareTo(org.infrastructurebuilder.data.IBDataSetIdentifier that) {
    return IBDataSetIdentifierComparator.compare(this, that);
  }
            
          
    
            
            //
            // ID mapper Work
            //
  @Override
  public java.util.UUID getId() {
     return org.infrastructurebuilder.data.IBDataModelUtils.safeMapUUID.apply(getUuid()).orElse(null);
  }            
          
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy