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.StringPATH_SEPARATORThe standard path separator
-
Constructor Summary
Constructors Modifier Constructor Description protectedPrimaryDataDirectory()Constructor for PrimaryDataDirectory.protectedPrimaryDataDirectory(PrimaryDataDirectory path, java.lang.String name)Constructor for PrimaryDataDirectory.
-
Method Summary
Modifier and Type Method Description PrimaryDataDirectorycreatePrimaryDataDirectory(java.lang.String path)Create an new subPrimaryDataDirectoryin the currentPrimaryDataDirectory.PrimaryDataFilecreatePrimaryDataFile(java.lang.String name)Create an newPrimaryDataFilein the currentPrimaryDataDirectoryusing the same implementation as thisPrimaryDataDirectory.booleanexist(java.lang.String path)Check if aPrimaryDataEntityexists with the same path in thisPrimaryDataDirectory.protected abstract booleanexistImpl(java.lang.String path)Abstract function for implementation ofexist(String)java.util.List<PrimaryDataEntity>getAllPublishedEntities()Convenience and free function to get onlyPrimaryDataEntitys with publishedPublicReferenceobjects.PrimaryDataEntitygetPrimaryDataEntity(java.lang.String name)Get a specifiedPrimaryDataEntityin thisPrimaryDataDirectoryby name.protected abstract PrimaryDataEntitygetPrimaryDataEntityImpl(java.lang.String name)Abstract function for the implementation ofgetPrimaryDataEntity(String).static PrimaryDataDirectorygetRootDirectory(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 specificEnumDublinCoreElementsandUntypedDatain 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 allPrimaryDataEntitys 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 currentPrimaryDataDirectorybyMetaData.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).voidsetMetaData(MetaData newMetadata)Setter for theMetaDataobject of thisPrimaryDataEntityobject.-
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- aPrimaryDataDirectoryobject.name- aStringobject.- Throws:
PrimaryDataEntityVersionException- if can not set currentPrimaryDataEntityVersion.PrimaryDataDirectoryException- if no parentPrimaryDataDirectoryis found.MetaDataException- if unable to set theMetaDataobject 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 supportedPrincipals- Returns:
- the root EDAL
PrimaryDataDirectoryobject, which is a container for access all managedPrimaryDataEntityobjects - Throws:
PrimaryDataDirectoryException- if unable to mount system.
-
createPrimaryDataDirectory
public PrimaryDataDirectory createPrimaryDataDirectory(java.lang.String path) throws PrimaryDataDirectoryException
Create an new subPrimaryDataDirectoryin the currentPrimaryDataDirectory.NOTE: It is not allowed to create a new sub
PrimaryDataDirectorywhen the currentVersion of thisPrimaryDataDirectoryis marked as deleted !NOTE: It is not allowed to create a new sub
PrimaryDataDirectorywhen there is already aPrimaryDataEntitywith the same name !- Parameters:
path- the name of the newPrimaryDataDirectory.- Returns:
- the new
PrimaryDataDirectoryobject.
nullif failed - Throws:
PrimaryDataDirectoryException- if the currentPrimaryDataEntityVersionof thisPrimaryDataDirectoryis marked as deleted or if there is already aPrimaryDataEntitywith the same name.
-
createPrimaryDataFile
public PrimaryDataFile createPrimaryDataFile(java.lang.String name) throws PrimaryDataDirectoryException
Create an newPrimaryDataFilein the currentPrimaryDataDirectoryusing the same implementation as thisPrimaryDataDirectory.NOTE: It is not allowed to create a new
PrimaryDataFilewhen the currentVersion of thisPrimaryDataDirectoryis marked as deleted !NOTE: It is not allowed to create a new
PrimaryDataFilewhen there is already aPrimaryDataEntitywith the same name !- Parameters:
name- of the newPrimaryDataFileobject.- Returns:
- the new
PrimaryDataFile.
nullif failed - Throws:
PrimaryDataDirectoryException- if the currentPrimaryDataEntityVersionof thisPrimaryDataDirectoryis marked as deleted or if there is already aPrimaryDataEntitywith the same name.
-
exist
public boolean exist(java.lang.String path) throws PrimaryDataDirectoryExceptionCheck if aPrimaryDataEntityexists with the same path in thisPrimaryDataDirectory.- Parameters:
path- the name of thePrimaryDataEntityto check.- Returns:
trueif there is already a PrimartyDataEntity with the same path;
falseotherwise- Throws:
PrimaryDataDirectoryException- if unable to load allPrimaryDataEntityobjects in thisPrimaryDataDirectoryto check if the name already exists.
-
existImpl
protected abstract boolean existImpl(java.lang.String path) throws PrimaryDataDirectoryExceptionAbstract function for implementation ofexist(String)- Parameters:
path- the name of thePrimaryDataEntityto check.- Returns:
trueif there is already a PrimartyDataEntity with the same path;
falseotherwise- Throws:
PrimaryDataDirectoryException- if unable to load allPrimaryDataEntityobjects in thisPrimaryDataDirectoryto check if the name already exists.
-
getAllPublishedEntities
public java.util.List<PrimaryDataEntity> getAllPublishedEntities() throws PrimaryDataDirectoryException
Convenience and free function to get onlyPrimaryDataEntitys with publishedPublicReferenceobjects.- Returns:
- a
Listof allPrimaryDataEntitywith aPublicReference. - Throws:
PrimaryDataDirectoryException- if unable to load objcts.
-
getPrimaryDataEntity
public PrimaryDataEntity getPrimaryDataEntity(java.lang.String name) throws PrimaryDataDirectoryException
Get a specifiedPrimaryDataEntityin thisPrimaryDataDirectoryby name.- Parameters:
name- name of thePrimaryDataEntityin thisPrimaryDataDirectory.- Returns:
- the found
PrimaryDataEntityobject. - Throws:
PrimaryDataDirectoryException- if no suchPrimaryDataEntityexists.
-
getPrimaryDataEntityImpl
protected abstract PrimaryDataEntity getPrimaryDataEntityImpl(java.lang.String name) throws PrimaryDataDirectoryException
Abstract function for the implementation ofgetPrimaryDataEntity(String).- Parameters:
name- name of thePrimaryDataEntityin thisPrimaryDataDirectory.- Returns:
- the found
PrimaryDataEntityobject. - Throws:
PrimaryDataDirectoryException- if no suchPrimaryDataEntityexists.
-
listPrimaryDataEntities
public java.util.List<PrimaryDataEntity> listPrimaryDataEntities() throws PrimaryDataDirectoryException
- Returns:
- a
Listcontaining allPrimaryDataEntity - Throws:
PrimaryDataDirectoryException- if unable to load allPrimaryDataEntityobjects 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 currentPrimaryDataEntityVersionnextVersionDate- the date of the nextPrimaryDataEntityVersion- Returns:
- a
Listcontaining allPrimaryDataEntity - Throws:
PrimaryDataDirectoryException- if unable to load allPrimaryDataEntityobjects 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 specificEnumDublinCoreElementsandUntypedDatain thisPrimaryDataDirectory. The caller function ensure that the result is an unmodifiableListcontaining all foundPrimaryDataEntityobjects- Parameters:
element- theEnumDublinCoreElementsfor query.data-UntypedDataparameter for search.fuzzy-true: exact search;
false: fuzzy search.recursiveIntoSubdirectories-true: include also all sub directories recursively;
false: search only in the current.PrimaryDataDirectoryobject- Returns:
- an unmodifiable
ListofPrimaryDataEntitythat match the parameter. - Throws:
PrimaryDataDirectoryException- if unable to findPrimaryDataEntityobject 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- theEnumDublinCoreElementsfor querydata-UntypedDataparameter for searchfuzzy-true: exact search;false: fuzzy searchrecursiveIntoSubdirectories-true: include also all sub directories recursively;false: search only in the currentPrimaryDataDirectoryobject- Returns:
- an unmodifiable
ListofPrimaryDataEntitythat match the parameter - Throws:
PrimaryDataDirectoryException- if unable to findPrimaryDataEntityobject 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 currentPrimaryDataDirectorybyMetaData.- Parameters:
query- aMetaDataobject for query.fuzzy-true: fuzzy search;
false: exact search.recursiveIntoSubdirectories-true: include also all subPrimaryDataDirectoryrecursively;
falsesearch only in the currentPrimaryDataDirectoryobject.- Returns:
- a unmodifiable
ListofPrimaryDataEntitythat match theMetaDataparameter. - Throws:
PrimaryDataDirectoryException- if unable to findPrimaryDataEntityobject or if there are too much results.MetaDataException- if there are non valid values for someMetaDataelements.
-
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- aMetaDataobject.fuzzy-true: fuzzy search;false: exact searchrecursiveIntoSubdirectories-true: include also all subPrimaryDataDirectoryrecursively;falsesearch only in the currentPrimaryDataDirectoryobject- Returns:
- a unmodifiable
ListofPrimaryDataEntitythat match theMetaDataparameter - Throws:
PrimaryDataDirectoryException- if unable to findPrimaryDataEntityobject or if there are too much results.MetaDataException- if there are non valid values for someMetaDataelements.
-
searchByPublicationStatus
public java.util.List<PrimaryDataEntity> searchByPublicationStatus(PublicationStatus publicationStatus) throws PrimaryDataDirectoryException
Function to get allPrimaryDataEntitys in thisPrimaryDataDirectory, which have aPublicReference. Filtered by thePublicationStatus.- Parameters:
publicationStatus- thePublicationStatusof the searchedPrimaryDataEntity.- Returns:
- a
Listof allPrimaryDataEntitywith 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- thePublicationStatusof the searchedPrimaryDataEntity.- Returns:
- a
Listof allPrimaryDataEntitywith 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 allPrimaryDataEntitys containing the keyword.- Parameters:
keyword- the term to search over all elements.fuzzy-true: fuzzy search;false: exact searchrecursiveIntoSubdirectories-true: include also all subPrimaryDataDirectoryrecursively;falsesearch only in the currentPrimaryDataDirectoryobject- Returns:
- a unmodifiable
ListofPrimaryDataEntitythat 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 subPrimaryDataDirectoryrecursively;falsesearch only in the currentPrimaryDataDirectoryobject- Returns:
- a unmodifiable
ListofPrimaryDataEntitythat match the keyword. - Throws:
PrimaryDataDirectoryException- if unable to search for the keyword.
-
setMetaData
public void setMetaData(MetaData newMetadata) throws PrimaryDataEntityVersionException, MetaDataException
Setter for theMetaDataobject of thisPrimaryDataEntityobject. Create a newPrimaryDataEntityVersionwith a newMetaDataset.Check before if the
EnumDublinCoreElements.TYPEis aMetaData.DIRECTORYobject.Check before if the
EnumDublinCoreElements.FORMATis aMetaData.EMPTYobject.- Overrides:
setMetaDatain classPrimaryDataEntity- Parameters:
newMetadata- the newMetaDataobject to set.- Throws:
PrimaryDataEntityVersionException- if unable to storePrimaryDataEntityVersion.MetaDataException- if there are non valid value for element in theMetaDataobject.
-
-