Class PrimaryDataDirectory
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataEntity
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataDirectory
-
- All Implemented Interfaces:
java.lang.Comparable<PrimaryDataEntity>
- Direct Known Subclasses:
PrimaryDataDirectoryImplementation
public abstract class PrimaryDataDirectory extends PrimaryDataEntity
Abstract PrimaryDataDirectory class.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PATH_SEPARATOR
The standard path separator
-
Constructor Summary
Constructors Modifier Constructor Description protected
PrimaryDataDirectory()
Constructor for PrimaryDataDirectory.protected
PrimaryDataDirectory(PrimaryDataDirectory path, java.lang.String name)
Constructor for PrimaryDataDirectory.
-
Method Summary
Modifier and Type Method Description PrimaryDataDirectory
createPrimaryDataDirectory(java.lang.String path)
Create an new subPrimaryDataDirectory
in the currentPrimaryDataDirectory
.PrimaryDataFile
createPrimaryDataFile(java.lang.String name)
Create an newPrimaryDataFile
in the currentPrimaryDataDirectory
using the same implementation as thisPrimaryDataDirectory
.boolean
exist(java.lang.String path)
Check if aPrimaryDataEntity
exists with the same path in thisPrimaryDataDirectory
.protected abstract boolean
existImpl(java.lang.String path)
Abstract function for implementation ofexist(String)
java.util.List<PrimaryDataEntity>
getAllPublishedEntities()
Convenience and free function to get onlyPrimaryDataEntity
s with publishedPublicReference
objects.PrimaryDataEntity
getPrimaryDataEntity(java.lang.String name)
Get a specifiedPrimaryDataEntity
in thisPrimaryDataDirectory
by name.protected abstract PrimaryDataEntity
getPrimaryDataEntityImpl(java.lang.String name)
Abstract function for the implementation ofgetPrimaryDataEntity(String)
.static PrimaryDataDirectory
getRootDirectory(java.util.List<java.lang.Class<? extends java.security.Principal>> supportedPrincipals)
The initial step to connect to a EDAL file service.java.util.List<PrimaryDataEntity>
listPrimaryDataEntities()
protected abstract java.util.List<PrimaryDataEntity>
listPrimaryDataEntitiesImpl(java.util.Calendar currentVersionDate, java.util.Calendar nextVersionDate)
Abstract function for the implementation oflistPrimaryDataEntities()
.java.util.List<PrimaryDataEntity>
searchByDublinCoreElement(EnumDublinCoreElements element, UntypedData data, boolean fuzzy, boolean recursiveIntoSubdirectories)
A convenience method for search only for a specificEnumDublinCoreElements
andUntypedData
in thisPrimaryDataDirectory
.protected abstract java.util.List<PrimaryDataEntity>
searchByDublinCoreElementImpl(EnumDublinCoreElements element, UntypedData data, boolean fuzzy, boolean recursiveIntoSubdirectories)
Abstract function for implementation ofsearchByDublinCoreElement(EnumDublinCoreElements, UntypedData, boolean, boolean)
.java.util.List<PrimaryDataEntity>
searchByKeyword(java.lang.String keyword, boolean fuzzy, boolean recursiveIntoSubdirectories)
Function to get allPrimaryDataEntity
s containing the keyword.protected abstract java.util.List<? extends PrimaryDataEntity>
searchByKeywordImpl(java.lang.String keyword, boolean fuzzy, boolean recursiveIntoSubdirectories)
Abstract function for the implementation ofsearchByKeyword(String, boolean, boolean)
java.util.List<PrimaryDataEntity>
searchByMetaData(MetaData query, boolean fuzzy, boolean recursiveIntoSubdirectories)
The method search in the currentPrimaryDataDirectory
byMetaData
.protected abstract java.util.List<PrimaryDataEntity>
searchByMetaDataImpl(MetaData query, boolean fuzzy, boolean recursiveIntoSubdirectories)
Abstract function for implementation ofsearchByMetaData(MetaData, boolean, boolean)
.java.util.List<PrimaryDataEntity>
searchByPublicationStatus(PublicationStatus publicationStatus)
protected abstract java.util.List<? extends PrimaryDataEntity>
searchByPublicationStatusImpl(PublicationStatus publicationStatus)
Abstract function for the implementation ofsearchByPublicationStatus(PublicationStatus)
.void
setMetaData(MetaData newMetadata)
Setter for theMetaData
object of thisPrimaryDataEntity
object.-
Methods inherited from class de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataEntity
addPublicReference, commitVersion, compareTo, delete, equals, getCurrentVersion, getID, getImplementationProvider, getMetaData, getName, getParentDirectory, getPath, getPermissions, getPermissionsImpl, getPublicReferences, getSubject, getVersionByDate, getVersionByRevisionNumber, getVersions, getVersionsImpl, grantPermission, hashCode, isDirectory, move, moveImpl, reloadOldDataType, rename, revokePermission, setCurrentVersion, setDefaultPermissions, setID, setParentDirectory, storeVersion, switchCurrentVersion, toString
-
-
-
-
Field Detail
-
PATH_SEPARATOR
public static final java.lang.String PATH_SEPARATOR
The standard path separator- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PrimaryDataDirectory
protected PrimaryDataDirectory()
Constructor for PrimaryDataDirectory.
-
PrimaryDataDirectory
protected PrimaryDataDirectory(PrimaryDataDirectory path, java.lang.String name) throws PrimaryDataEntityVersionException, PrimaryDataDirectoryException, MetaDataException
Constructor for PrimaryDataDirectory.- Parameters:
path
- aPrimaryDataDirectory
object.name
- aString
object.- Throws:
PrimaryDataEntityVersionException
- if can not set currentPrimaryDataEntityVersion
.PrimaryDataDirectoryException
- if no parentPrimaryDataDirectory
is found.MetaDataException
- if unable to set theMetaData
object of thePrimaryDataDirectory
.
-
-
Method Detail
-
getRootDirectory
public static PrimaryDataDirectory getRootDirectory(java.util.List<java.lang.Class<? extends java.security.Principal>> supportedPrincipals) throws PrimaryDataDirectoryException
The initial step to connect to a EDAL file service.NOTE: no PrimaryDataObject can be accessed outside a root directory object !
- Parameters:
supportedPrincipals
- the supportedPrincipal
s- Returns:
- the root EDAL
PrimaryDataDirectory
object, which is a container for access all managedPrimaryDataEntity
objects - Throws:
PrimaryDataDirectoryException
- if unable to mount system.
-
createPrimaryDataDirectory
public PrimaryDataDirectory createPrimaryDataDirectory(java.lang.String path) throws PrimaryDataDirectoryException
Create an new subPrimaryDataDirectory
in the currentPrimaryDataDirectory
.NOTE: It is not allowed to create a new sub
PrimaryDataDirectory
when the currentVersion of thisPrimaryDataDirectory
is marked as deleted !NOTE: It is not allowed to create a new sub
PrimaryDataDirectory
when there is already aPrimaryDataEntity
with the same name !- Parameters:
path
- the name of the newPrimaryDataDirectory
.- Returns:
- the new
PrimaryDataDirectory
object.
null
if failed - Throws:
PrimaryDataDirectoryException
- if the currentPrimaryDataEntityVersion
of thisPrimaryDataDirectory
is marked as deleted or if there is already aPrimaryDataEntity
with the same name.
-
createPrimaryDataFile
public PrimaryDataFile createPrimaryDataFile(java.lang.String name) throws PrimaryDataDirectoryException
Create an newPrimaryDataFile
in the currentPrimaryDataDirectory
using the same implementation as thisPrimaryDataDirectory
.NOTE: It is not allowed to create a new
PrimaryDataFile
when the currentVersion of thisPrimaryDataDirectory
is marked as deleted !NOTE: It is not allowed to create a new
PrimaryDataFile
when there is already aPrimaryDataEntity
with the same name !- Parameters:
name
- of the newPrimaryDataFile
object.- Returns:
- the new
PrimaryDataFile
.
null
if failed - Throws:
PrimaryDataDirectoryException
- if the currentPrimaryDataEntityVersion
of thisPrimaryDataDirectory
is marked as deleted or if there is already aPrimaryDataEntity
with the same name.
-
exist
public boolean exist(java.lang.String path) throws PrimaryDataDirectoryException
Check if aPrimaryDataEntity
exists with the same path in thisPrimaryDataDirectory
.- Parameters:
path
- the name of thePrimaryDataEntity
to check.- Returns:
true
if there is already a PrimartyDataEntity with the same path;
false
otherwise- Throws:
PrimaryDataDirectoryException
- if unable to load allPrimaryDataEntity
objects in thisPrimaryDataDirectory
to check if the name already exists.
-
existImpl
protected abstract boolean existImpl(java.lang.String path) throws PrimaryDataDirectoryException
Abstract function for implementation ofexist(String)
- Parameters:
path
- the name of thePrimaryDataEntity
to check.- Returns:
true
if there is already a PrimartyDataEntity with the same path;
false
otherwise- Throws:
PrimaryDataDirectoryException
- if unable to load allPrimaryDataEntity
objects in thisPrimaryDataDirectory
to check if the name already exists.
-
getAllPublishedEntities
public java.util.List<PrimaryDataEntity> getAllPublishedEntities() throws PrimaryDataDirectoryException
Convenience and free function to get onlyPrimaryDataEntity
s with publishedPublicReference
objects.- Returns:
- a
List
of allPrimaryDataEntity
with aPublicReference
. - Throws:
PrimaryDataDirectoryException
- if unable to load objcts.
-
getPrimaryDataEntity
public PrimaryDataEntity getPrimaryDataEntity(java.lang.String name) throws PrimaryDataDirectoryException
Get a specifiedPrimaryDataEntity
in thisPrimaryDataDirectory
by name.- Parameters:
name
- name of thePrimaryDataEntity
in thisPrimaryDataDirectory
.- Returns:
- the found
PrimaryDataEntity
object. - Throws:
PrimaryDataDirectoryException
- if no suchPrimaryDataEntity
exists.
-
getPrimaryDataEntityImpl
protected abstract PrimaryDataEntity getPrimaryDataEntityImpl(java.lang.String name) throws PrimaryDataDirectoryException
Abstract function for the implementation ofgetPrimaryDataEntity(String)
.- Parameters:
name
- name of thePrimaryDataEntity
in thisPrimaryDataDirectory
.- Returns:
- the found
PrimaryDataEntity
object. - Throws:
PrimaryDataDirectoryException
- if no suchPrimaryDataEntity
exists.
-
listPrimaryDataEntities
public java.util.List<PrimaryDataEntity> listPrimaryDataEntities() throws PrimaryDataDirectoryException
- Returns:
- a
List
containing allPrimaryDataEntity
- Throws:
PrimaryDataDirectoryException
- if unable to load allPrimaryDataEntity
objects in thisPrimaryDataDirectory
.
-
listPrimaryDataEntitiesImpl
protected abstract java.util.List<PrimaryDataEntity> listPrimaryDataEntitiesImpl(java.util.Calendar currentVersionDate, java.util.Calendar nextVersionDate) throws PrimaryDataDirectoryException
Abstract function for the implementation oflistPrimaryDataEntities()
.- Parameters:
currentVersionDate
- the date of the currentPrimaryDataEntityVersion
nextVersionDate
- the date of the nextPrimaryDataEntityVersion
- Returns:
- a
List
containing allPrimaryDataEntity
- Throws:
PrimaryDataDirectoryException
- if unable to load allPrimaryDataEntity
objects in thisPrimaryDataDirectory
.
-
searchByDublinCoreElement
public java.util.List<PrimaryDataEntity> searchByDublinCoreElement(EnumDublinCoreElements element, UntypedData data, boolean fuzzy, boolean recursiveIntoSubdirectories) throws PrimaryDataDirectoryException
A convenience method for search only for a specificEnumDublinCoreElements
andUntypedData
in thisPrimaryDataDirectory
. The caller function ensure that the result is an unmodifiableList
containing all foundPrimaryDataEntity
objects- Parameters:
element
- theEnumDublinCoreElements
for query.data
-UntypedData
parameter for search.fuzzy
-true
: exact search;
false
: fuzzy search.recursiveIntoSubdirectories
-true
: include also all sub directories recursively;
false
: search only in the current.PrimaryDataDirectory
object- Returns:
- an unmodifiable
List
ofPrimaryDataEntity
that match the parameter. - Throws:
PrimaryDataDirectoryException
- if unable to findPrimaryDataEntity
object or if there are too much results.
-
searchByDublinCoreElementImpl
protected abstract java.util.List<PrimaryDataEntity> searchByDublinCoreElementImpl(EnumDublinCoreElements element, UntypedData data, boolean fuzzy, boolean recursiveIntoSubdirectories) throws PrimaryDataDirectoryException
Abstract function for implementation ofsearchByDublinCoreElement(EnumDublinCoreElements, UntypedData, boolean, boolean)
.- Parameters:
element
- theEnumDublinCoreElements
for querydata
-UntypedData
parameter for searchfuzzy
-true
: exact search;false
: fuzzy searchrecursiveIntoSubdirectories
-true
: include also all sub directories recursively;false
: search only in the currentPrimaryDataDirectory
object- Returns:
- an unmodifiable
List
ofPrimaryDataEntity
that match the parameter - Throws:
PrimaryDataDirectoryException
- if unable to findPrimaryDataEntity
object or if there are too much results.
-
searchByMetaData
public final java.util.List<PrimaryDataEntity> searchByMetaData(MetaData query, boolean fuzzy, boolean recursiveIntoSubdirectories) throws PrimaryDataDirectoryException, MetaDataException
The method search in the currentPrimaryDataDirectory
byMetaData
.- Parameters:
query
- aMetaData
object for query.fuzzy
-true
: fuzzy search;
false
: exact search.recursiveIntoSubdirectories
-true
: include also all subPrimaryDataDirectory
recursively;
false
search only in the currentPrimaryDataDirectory
object.- Returns:
- a unmodifiable
List
ofPrimaryDataEntity
that match theMetaData
parameter. - Throws:
PrimaryDataDirectoryException
- if unable to findPrimaryDataEntity
object or if there are too much results.MetaDataException
- if there are non valid values for someMetaData
elements.
-
searchByMetaDataImpl
protected abstract java.util.List<PrimaryDataEntity> searchByMetaDataImpl(MetaData query, boolean fuzzy, boolean recursiveIntoSubdirectories) throws PrimaryDataDirectoryException, MetaDataException
Abstract function for implementation ofsearchByMetaData(MetaData, boolean, boolean)
.- Parameters:
query
- aMetaData
object.fuzzy
-true
: fuzzy search;false
: exact searchrecursiveIntoSubdirectories
-true
: include also all subPrimaryDataDirectory
recursively;false
search only in the currentPrimaryDataDirectory
object- Returns:
- a unmodifiable
List
ofPrimaryDataEntity
that match theMetaData
parameter - Throws:
PrimaryDataDirectoryException
- if unable to findPrimaryDataEntity
object or if there are too much results.MetaDataException
- if there are non valid values for someMetaData
elements.
-
searchByPublicationStatus
public java.util.List<PrimaryDataEntity> searchByPublicationStatus(PublicationStatus publicationStatus) throws PrimaryDataDirectoryException
Function to get allPrimaryDataEntity
s in thisPrimaryDataDirectory
, which have aPublicReference
. Filtered by thePublicationStatus
.- Parameters:
publicationStatus
- thePublicationStatus
of the searchedPrimaryDataEntity
.- Returns:
- a
List
of allPrimaryDataEntity
with aPublicReference
. - Throws:
PrimaryDataDirectoryException
- if unable to search forPublicationStatus
-
searchByPublicationStatusImpl
protected abstract java.util.List<? extends PrimaryDataEntity> searchByPublicationStatusImpl(PublicationStatus publicationStatus) throws PrimaryDataDirectoryException
Abstract function for the implementation ofsearchByPublicationStatus(PublicationStatus)
.- Parameters:
publicationStatus
- thePublicationStatus
of the searchedPrimaryDataEntity
.- Returns:
- a
List
of allPrimaryDataEntity
with aPublicReference
. - Throws:
PrimaryDataDirectoryException
- if unable to search forPublicationStatus
-
searchByKeyword
public java.util.List<PrimaryDataEntity> searchByKeyword(java.lang.String keyword, boolean fuzzy, boolean recursiveIntoSubdirectories) throws PrimaryDataDirectoryException
Function to get allPrimaryDataEntity
s containing the keyword.- Parameters:
keyword
- the term to search over all elements.fuzzy
-true
: fuzzy search;false
: exact searchrecursiveIntoSubdirectories
-true
: include also all subPrimaryDataDirectory
recursively;false
search only in the currentPrimaryDataDirectory
object- Returns:
- a unmodifiable
List
ofPrimaryDataEntity
that match the keyword. - Throws:
PrimaryDataDirectoryException
- if unable to search for the keyword.
-
searchByKeywordImpl
protected abstract java.util.List<? extends PrimaryDataEntity> searchByKeywordImpl(java.lang.String keyword, boolean fuzzy, boolean recursiveIntoSubdirectories) throws PrimaryDataDirectoryException
Abstract function for the implementation ofsearchByKeyword(String, boolean, boolean)
- Parameters:
keyword
- the term to search over all elements.fuzzy
-true
: fuzzy search;false
: exact searchrecursiveIntoSubdirectories
-true
: include also all subPrimaryDataDirectory
recursively;false
search only in the currentPrimaryDataDirectory
object- Returns:
- a unmodifiable
List
ofPrimaryDataEntity
that match the keyword. - Throws:
PrimaryDataDirectoryException
- if unable to search for the keyword.
-
setMetaData
public void setMetaData(MetaData newMetadata) throws PrimaryDataEntityVersionException, MetaDataException
Setter for theMetaData
object of thisPrimaryDataEntity
object. Create a newPrimaryDataEntityVersion
with a newMetaData
set.Check before if the
EnumDublinCoreElements.TYPE
is aMetaData.DIRECTORY
object.Check before if the
EnumDublinCoreElements.FORMAT
is aMetaData.EMPTY
object.- Overrides:
setMetaData
in classPrimaryDataEntity
- Parameters:
newMetadata
- the newMetaData
object to set.- Throws:
PrimaryDataEntityVersionException
- if unable to storePrimaryDataEntityVersion
.MetaDataException
- if there are non valid value for element in theMetaData
object.
-
-