gov.nih.nci.caarray.domain.file
Class CaArrayFileSet

java.lang.Object
  extended by gov.nih.nci.caarray.domain.file.CaArrayFileSet
All Implemented Interfaces:
java.io.Serializable

public class CaArrayFileSet
extends java.lang.Object
implements java.io.Serializable

Provides functionality to handle multiple CaArrayFiles as a single set.

See Also:
Serialized Form

Constructor Summary
CaArrayFileSet()
          File set.
CaArrayFileSet(CaArrayFileSet baseFileSet)
          Construct a new file set, with the same files and associated project.
CaArrayFileSet(java.lang.Long projectId)
           
CaArrayFileSet(Project p)
           
 
Method Summary
 void add(CaArrayFile file)
          Adds a file to the set.
 void addAll(java.util.Collection<CaArrayFile> fileCollection)
          Adds a collection of files to this set.
 java.util.Set<CaArrayFile> getArrayDataFiles()
          Get a subset of CaArrayFile objects that are array data file types.
 CaArrayFile getFile(java.io.File file)
          Returns the CaArrayFile in the set corresponding to the given file object or null if no match.
 CaArrayFile getFile(java.lang.String name)
          Returns the CaArrayFile in the set with the given name or null if no match.
 java.util.Set<CaArrayFile> getFiles()
          Returns the contained files.
 java.util.Set<CaArrayFile> getFilesByType(FileType ft)
          Get a subset of CaArrayFile objects with file type specified.
 java.lang.Long getProjectId()
           
 FileStatus getStatus()
          Returns the aggregate status of the file set.
 boolean isValidated()
          Returns a value to indicate if the fileset has been validated or not.
 void pullUpValidationMessages()
          Validation messages on files that have parents are copies to the respective parents.
 java.lang.String toString()
          
 void updateStatus(FileStatus status)
          Update the status of each file in this file set to the given status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CaArrayFileSet

public CaArrayFileSet(Project p)
Parameters:
p - project this file set is associated with

CaArrayFileSet

public CaArrayFileSet(java.lang.Long projectId)
Parameters:
projectId - Id of the project that this file set is associated with

CaArrayFileSet

public CaArrayFileSet(CaArrayFileSet baseFileSet)
Construct a new file set, with the same files and associated project.

Parameters:
baseFileSet - file set on which to base the new file set

CaArrayFileSet

public CaArrayFileSet()
File set. Only files not associated with a project can be added.

Method Detail

getProjectId

public java.lang.Long getProjectId()
Returns:
related project system identifier

add

public void add(CaArrayFile file)
Adds a file to the set.

Parameters:
file - the file to add

getFiles

public java.util.Set<CaArrayFile> getFiles()
Returns the contained files.

Returns:
the files.

getFilesByType

public java.util.Set<CaArrayFile> getFilesByType(FileType ft)
Get a subset of CaArrayFile objects with file type specified.

Parameters:
ft - File type must not be null
Returns:
set of CaArrayFile objects

getArrayDataFiles

public java.util.Set<CaArrayFile> getArrayDataFiles()
Get a subset of CaArrayFile objects that are array data file types.

Returns:
set of CaArrayFile objects

getStatus

public FileStatus getStatus()
Returns the aggregate status of the file set.

Returns:
status of the set.

addAll

public void addAll(java.util.Collection<CaArrayFile> fileCollection)
Adds a collection of files to this set.

Parameters:
fileCollection - files to add.

updateStatus

public void updateStatus(FileStatus status)
Update the status of each file in this file set to the given status.

Parameters:
status - the new status which each file in this set should have.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

getFile

public CaArrayFile getFile(java.io.File file)
Returns the CaArrayFile in the set corresponding to the given file object or null if no match.

Parameters:
file - get CaArrayFile for this file.
Returns:
the matching CaArrayFile.

getFile

public CaArrayFile getFile(java.lang.String name)
Returns the CaArrayFile in the set with the given name or null if no match.

Parameters:
name - the name of the file to find
Returns:
the CaArrayFile with given name, or null if no such file exists in this set.

pullUpValidationMessages

public void pullUpValidationMessages()
Validation messages on files that have parents are copies to the respective parents. The parents do not have to be in the set.


isValidated

public boolean isValidated()
Returns a value to indicate if the fileset has been validated or not.

Returns:
a boolean value to indicate if the fileset has been validated or not.