Class PrimaryDataFileImplementation
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataEntity
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataFile
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.file.implementation.PrimaryDataFileImplementation
-
- All Implemented Interfaces:
java.lang.Comparable<PrimaryDataEntity>
@Entity public class PrimaryDataFileImplementation extends PrimaryDataFile
Implementation ofPrimaryDataFile.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPrimaryDataFileImplementation()Default constructor forPrimaryDataFileImplementationis necessary for PojoInstantiator of HIBERNATE.PrimaryDataFileImplementation(PrimaryDataDirectory path, java.lang.String name)Constructor for PrimaryDataFileImplementation.
-
Method Summary
Modifier and Type Method Description protected booleanexistData()Abstract function to check if the currentPrimaryDataEntityVersionof thisPrimaryDataFilehas stored data.java.lang.StringgetID()Getter for the ID of thisPrimaryDataEntity.PrimaryDataDirectoryImplementationgetParentDirectory()Getter for the parentPrimaryDataDirectoryof thisPrimaryDataEntity.protected java.nio.file.PathgetPathToLocalFile(PrimaryDataEntityVersion version)Load thePathto the local stored file from the file system.protected java.util.Map<java.security.Principal,java.util.List<EdalPermission>>getPermissionsImpl()Abstract function for implementation ofPrimaryDataEntity.getPermissions().protected java.util.SortedSet<PrimaryDataEntityVersionImplementation>getVersionList()Getter for the fieldversionList.protected java.util.SortedSet<PrimaryDataEntityVersion>getVersionsImpl()Abstract function for implementation ofPrimaryDataEntity.getVersions().protected voidmoveImpl(PrimaryDataDirectory destinationDirectory)Abstract function for implementation ofPrimaryDataEntity.move(PrimaryDataDirectory).protected voidreadImpl(java.io.OutputStream outputStream)Abstract function for implementation thePrimaryDataFile.read(OutputStream)function.protected voidsetVersionList(java.util.SortedSet<PrimaryDataEntityVersionImplementation> versionList)Setter for the fieldversionList.protected voidstoreImpl(java.io.InputStream inputStream, PrimaryDataEntityVersion currentVersion)Abstract function for implementation thePrimaryDataFile.store(InputStream)function.protected voidstoreVersion(PrimaryDataEntityVersion publicVersion)Abstract function for storing a newPrimaryDataEntityVersionfor anPrimaryDataEntityobject.-
Methods inherited from class de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataFile
read, setMetaData, store
-
Methods inherited from class de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataEntity
addPublicReference, commitVersion, compareTo, delete, equals, getCurrentVersion, getImplementationProvider, getMetaData, getName, getPath, getPermissions, getPublicReferences, getSubject, getVersionByDate, getVersionByRevisionNumber, getVersions, grantPermission, hashCode, isDirectory, move, reloadOldDataType, rename, revokePermission, setCurrentVersion, setDefaultPermissions, setID, setParentDirectory, switchCurrentVersion, toString
-
-
-
-
Constructor Detail
-
PrimaryDataFileImplementation
protected PrimaryDataFileImplementation()
Default constructor forPrimaryDataFileImplementationis necessary for PojoInstantiator of HIBERNATE.
-
PrimaryDataFileImplementation
public PrimaryDataFileImplementation(PrimaryDataDirectory path, java.lang.String name) throws PrimaryDataFileException, PrimaryDataEntityVersionException, PrimaryDataDirectoryException, MetaDataException
Constructor for PrimaryDataFileImplementation.- Parameters:
path- aPrimaryDataDirectoryobject.name- aStringobject.- Throws:
PrimaryDataFileException- if unable to set data type.PrimaryDataEntityVersionException- if unable to store initial version.PrimaryDataDirectoryException- if no parentPrimaryDataDirectoryis found.MetaDataException- if theMetaDataobject of the parentPrimaryDataDirectoryis not clone-able.
-
-
Method Detail
-
existData
protected boolean existData()
Abstract function to check if the currentPrimaryDataEntityVersionof thisPrimaryDataFilehas stored data.- Specified by:
existDatain classPrimaryDataFile- Returns:
trueif the currentPrimaryDataEntityVersionhas stored data;falseotherwise.
-
getID
public java.lang.String getID()
Getter for the ID of thisPrimaryDataEntity.HIBERNATE : constant length cause it is an
UUID- Overrides:
getIDin classPrimaryDataEntity- Returns:
- the ID of this
PrimaryDataEntity - See Also:
UUID
-
getParentDirectory
public PrimaryDataDirectoryImplementation getParentDirectory() throws PrimaryDataDirectoryException
Getter for the parentPrimaryDataDirectoryof thisPrimaryDataEntity.NOTE: It is not allowed to access the parent
PrimaryDataDirectoryof the rootPrimaryDataDirectory!HIBERNATE : FetchType.EAGER for getPath()
- Overrides:
getParentDirectoryin classPrimaryDataEntity- Returns:
- the parent
PrimaryDataDirectoryof thisPrimaryDataEntity. - Throws:
PrimaryDataDirectoryException- if trying to access the parentPrimaryDataDirectoryof the rootPrimaryDataDirectory.
-
getPathToLocalFile
protected java.nio.file.Path getPathToLocalFile(PrimaryDataEntityVersion version)
Load thePathto the local stored file from the file system.- Parameters:
version- the version information to find the correctPathto the local storedFile.- Returns:
- the loaded
File.
-
getPermissionsImpl
protected java.util.Map<java.security.Principal,java.util.List<EdalPermission>> getPermissionsImpl() throws PrimaryDataEntityException
Abstract function for implementation ofPrimaryDataEntity.getPermissions().- Specified by:
getPermissionsImplin classPrimaryDataEntity- Returns:
- an unmodifiable
Listcontaining allEdalPermission - Throws:
PrimaryDataEntityException- if unable to load all permissions.
-
getVersionList
protected java.util.SortedSet<PrimaryDataEntityVersionImplementation> getVersionList()
Getter for the fieldversionList.- Returns:
- a
SortedSetobject.
-
getVersionsImpl
protected java.util.SortedSet<PrimaryDataEntityVersion> getVersionsImpl()
Abstract function for implementation ofPrimaryDataEntity.getVersions().- Specified by:
getVersionsImplin classPrimaryDataEntity- Returns:
- an unmodifiable
SortedSetcontaining allPrimaryDataEntity.
-
moveImpl
protected void moveImpl(PrimaryDataDirectory destinationDirectory)
Abstract function for implementation ofPrimaryDataEntity.move(PrimaryDataDirectory).- Specified by:
moveImplin classPrimaryDataEntity- Parameters:
destinationDirectory- the newPrimaryDataDirectoryfor thisPrimaryDataEntity.
-
readImpl
protected void readImpl(java.io.OutputStream outputStream) throws PrimaryDataFileExceptionAbstract function for implementation thePrimaryDataFile.read(OutputStream)function.- Specified by:
readImplin classPrimaryDataFile- Parameters:
outputStream- the loaded data.- Throws:
PrimaryDataFileException- if no data is stored.
-
setVersionList
protected void setVersionList(java.util.SortedSet<PrimaryDataEntityVersionImplementation> versionList)
Setter for the fieldversionList.- Parameters:
versionList- aSortedSetobject.
-
storeImpl
protected void storeImpl(java.io.InputStream inputStream, PrimaryDataEntityVersion currentVersion) throws PrimaryDataFileExceptionAbstract function for implementation thePrimaryDataFile.store(InputStream)function.- Specified by:
storeImplin classPrimaryDataFile- Parameters:
inputStream- the data to store in thisPrimaryDataEntityVersioncurrentVersion- the newPrimaryDataEntityVersionto store- Throws:
PrimaryDataFileException- if storing of data fails
-
storeVersion
protected void storeVersion(PrimaryDataEntityVersion publicVersion) throws PrimaryDataEntityVersionException
Abstract function for storing a newPrimaryDataEntityVersionfor anPrimaryDataEntityobject.- Specified by:
storeVersionin classPrimaryDataEntity- Parameters:
publicVersion- the newPrimaryDataEntityVersionto store.- Throws:
PrimaryDataEntityVersionException- if unable to storePrimaryDataEntityVersion.
-
-