public abstract class PrimaryDataEntity extends Object implements Comparable<PrimaryDataEntity>
Super class for PrimaryDataDirectory and PrimaryDataFile.
| Modifier | Constructor and Description |
|---|---|
protected |
PrimaryDataEntity()
Constructor for PrimaryDataEntity.
|
protected |
PrimaryDataEntity(PrimaryDataDirectory path,
String name)
Construct a
PrimaryDataEntity object. |
| Modifier and Type | Method and Description |
|---|---|
void |
addPublicReference(PersistentIdentifier identifierType)
Add a public identifier to the currentVersion of this
PrimaryDataEntity. |
protected void |
commitVersion(PrimaryDataEntityVersion version)
Internal function to commit a
PrimaryDataEntityVersion to the
storage back-end. |
int |
compareTo(PrimaryDataEntity other)
Compares PrimaryDataEntity based on toLowerCase(getName());
|
void |
delete()
Delete the
PrimaryDataEntity object by generation of new
PrimaryDataEntityVersion and set the isDeleted flag to
true. |
boolean |
equals(Object obj) |
PrimaryDataEntityVersion |
getCurrentVersion()
Getter for the current
PrimaryDataEntityVersion. |
String |
getID()
Getter for the ID of this
PrimaryDataEntity. |
protected ImplementationProvider |
getImplementationProvider()
Getter for the current
ImplementationProvider. |
MetaData |
getMetaData()
|
String |
getName()
Getter for the name of this
PrimaryDataEntity . |
PrimaryDataDirectory |
getParentDirectory()
Getter for the parent
PrimaryDataDirectory of this
PrimaryDataEntity . |
String |
getPath()
Getter for the path of this
PrimaryDataEntity as String. |
Map<Principal,List<de.ipk_gatersleben.bit.bi.edal.primary_data.security.EdalPermission>> |
getPermissions()
Getter for a
List containing all EdalPermission objects. |
protected abstract Map<Principal,List<de.ipk_gatersleben.bit.bi.edal.primary_data.security.EdalPermission>> |
getPermissionsImpl()
Abstract function for implementation of
getPermissions(). |
List<PublicReference> |
getPublicReferences()
Getter for a
List of all stored PublicReferences of the
current PrimaryDataEntityVersion of this
PrimaryDataEntity. |
protected Subject |
getSubject()
Getter for the current
Subject. |
PrimaryDataEntityVersion |
getVersionByDate(Calendar date)
Convenience function to get a
PrimaryDataEntityVersion of this
PrimaryDataEntity by the revision date. |
PrimaryDataEntityVersion |
getVersionByRevisionNumber(long revisionNumber)
Convenience function to get a
PrimaryDataEntityVersion of this
PrimaryDataEntity by the revision number. |
SortedSet<PrimaryDataEntityVersion> |
getVersions()
|
protected abstract SortedSet<PrimaryDataEntityVersion> |
getVersionsImpl()
Abstract function for implementation of
getVersions(). |
void |
grantPermission(Principal principal,
GrantableMethods.Methods method)
Grant a
EdalPermission to a Principal and check before
grant if the method exists. |
int |
hashCode() |
boolean |
isDirectory()
Check if the
PrimaryDataEntity is a PrimaryDataDirectory
or not. |
void |
move(PrimaryDataDirectory destinationDirectory)
Move this
PrimaryDataEntity to another
PrimaryDataDirectory. |
protected abstract void |
moveImpl(PrimaryDataDirectory destinationDirectory)
Abstract function for implementation of
move(PrimaryDataDirectory). |
protected UntypedData |
reloadOldDataType(EnumDublinCoreElements element)
Internal function to reload a data type of the old
MetaData for
the current version, after the user set a wrong value. |
void |
rename(String name)
Rename the current
PrimaryDataEntity. |
void |
revokePermission(Principal principal,
GrantableMethods.Methods method)
Revoke a
EdalPermission to a Principal and check before
revoke if the method exists. |
protected void |
setCurrentVersion(PrimaryDataEntityVersion version)
Setter for the current
PrimaryDataEntityVersion. |
protected void |
setDefaultPermissions()
Set initial and default
EdalPermission for this
PrimaryDataEntity. |
protected void |
setID(String id)
Setter for the ID of the current
PrimaryDataEntity |
void |
setMetaData(MetaData newMetadata)
Setter for the
MetaData object of this PrimaryDataEntity
object. |
protected void |
setParentDirectory(PrimaryDataDirectory parentDirectory)
Setter for the parent
PrimaryDataDirectory of this
PrimaryDataEntity. |
protected abstract void |
storeVersion(PrimaryDataEntityVersion newVersion)
Abstract function for storing a new
PrimaryDataEntityVersion for
an PrimaryDataEntity object. |
void |
switchCurrentVersion(PrimaryDataEntityVersion version)
Switch the current
PrimaryDataEntityVersion with this
PrimaryDataEntityVersion. |
String |
toString() |
protected PrimaryDataEntity()
protected PrimaryDataEntity(PrimaryDataDirectory path, String name) throws PrimaryDataEntityVersionException, PrimaryDataDirectoryException, MetaDataException
PrimaryDataEntity object.
Set the PrimaryDataEntityVersion to the latest one.
If it is an initial PrimaryDataEntityVersion , a new default
MetaData object is instantiated
name - the name for this objectpath - the parent PrimaryDataDirectory of this
PrimaryDataEntity.PrimaryDataEntityVersionException - if unable to set current PrimaryDataEntityVersion.PrimaryDataDirectoryException - if no parent PrimaryDataDirectory is found.MetaDataException - if the MetaData object of the parent
PrimaryDataDirectory is not clone-able.public void addPublicReference(PersistentIdentifier identifierType) throws PrimaryDataEntityException
PrimaryDataEntity.identifierType - the type of the new Identifier.PrimaryDataEntityException - if unable to add the PublicReference to this
PrimaryDataEntity.protected void commitVersion(PrimaryDataEntityVersion version) throws PrimaryDataEntityVersionException
PrimaryDataEntityVersion to the
storage back-end. Use the CREATED EdalDate of the current
PrimaryDataEntityVersion and remove the UPDATED EdalDate
to add a new one.version - the PrimaryDataEntityVersion to store.PrimaryDataEntityVersionException - if unable to store the PrimaryDataEntityVersion.public int compareTo(PrimaryDataEntity other)
Compares PrimaryDataEntity based on toLowerCase(getName());
compareTo in interface Comparable<PrimaryDataEntity>public final void delete()
throws PrimaryDataEntityVersionException,
PrimaryDataDirectoryException
PrimaryDataEntity object by generation of new
PrimaryDataEntityVersion and set the isDeleted flag to
true.
NOTE: It is not allowed delete the root PrimaryDataDirectory!
NOTE: It is not allowed delete a non-current PrimaryDataEntityVersion!
PrimaryDataEntityVersionException - if trying to delete the root PrimaryDataDirectoryPrimaryDataDirectoryException - if trying to delete a non-current
PrimaryDataEntityVersion.public PrimaryDataEntityVersion getCurrentVersion()
PrimaryDataEntityVersion.PrimaryDataEntityVersionpublic String getID()
PrimaryDataEntity.PrimaryDataEntityUUIDprotected ImplementationProvider getImplementationProvider()
ImplementationProvider.ImplementationProvider from current threadpublic MetaData getMetaData()
MetaData object of the current
PrimaryDataEntityVersion of this
PrimaryDataEntity.public final String getName()
PrimaryDataEntity .this.getMetaData().getElementValue(EnumDublinCoreElements.TITLE)
public PrimaryDataDirectory getParentDirectory() throws PrimaryDataDirectoryException
PrimaryDataDirectory of this
PrimaryDataEntity .
NOTE: It is not allowed to access the parent PrimaryDataDirectory of the root PrimaryDataDirectory!
PrimaryDataDirectory of this
PrimaryDataEntity.PrimaryDataDirectoryException - if trying to access the parent PrimaryDataDirectory
of the root PrimaryDataDirectory.public String getPath()
PrimaryDataEntity as String.PrimaryDataEntity object as
Stringpublic Map<Principal,List<de.ipk_gatersleben.bit.bi.edal.primary_data.security.EdalPermission>> getPermissions() throws PrimaryDataEntityException
List containing all EdalPermission objects.List containing all
EdalPermissionPrimaryDataEntityException - if unable to load all permissions.protected abstract Map<Principal,List<de.ipk_gatersleben.bit.bi.edal.primary_data.security.EdalPermission>> getPermissionsImpl() throws PrimaryDataEntityException
getPermissions().List containing all
EdalPermissionPrimaryDataEntityException - if unable to load all permissions.public List<PublicReference> getPublicReferences()
List of all stored PublicReferences of the
current PrimaryDataEntityVersion of this
PrimaryDataEntity.List with all stored PublicReferences of the
current PrimaryDataEntityVersion of this
PrimaryDataEntity.protected Subject getSubject()
Subject.Subject from current thread.public PrimaryDataEntityVersion getVersionByDate(Calendar date) throws PrimaryDataEntityVersionException
PrimaryDataEntityVersion of this
PrimaryDataEntity by the revision date.date - the date of the PrimaryDataEntityVersionPrimaryDataEntityVersionPrimaryDataEntityVersionException - if there are only older PrimaryDataEntityVersion
stored for this PrimaryDataEntitypublic PrimaryDataEntityVersion getVersionByRevisionNumber(long revisionNumber) throws PrimaryDataEntityVersionException
PrimaryDataEntityVersion of this
PrimaryDataEntity by the revision number.revisionNumber - the number of the PrimaryDataEntityVersionPrimaryDataEntityVersionPrimaryDataEntityVersionException - if there is no PrimaryDataEntityVersion with this
version stored.public SortedSet<PrimaryDataEntityVersion> getVersions()
SortedSet containing all
PrimaryDataEntityprotected abstract SortedSet<PrimaryDataEntityVersion> getVersionsImpl()
getVersions().SortedSet containing all
PrimaryDataEntity.public void grantPermission(Principal principal, GrantableMethods.Methods method) throws PrimaryDataEntityException
EdalPermission to a Principal and check before
grant if the method exists.principal - to grant this methodmethod - Enum for a the methodPrimaryDataEntityException - if can not found method to grant.public boolean isDirectory()
PrimaryDataEntity is a PrimaryDataDirectory
or not.true when it is a PrimaryDataDirectory;false otherwise.public void move(PrimaryDataDirectory destinationDirectory) throws PrimaryDataDirectoryException
PrimaryDataEntity to another
PrimaryDataDirectory.
NOTE: It is not allowed to move the root PrimaryDataDirectory!
destinationDirectory - the new parent PrimaryDataDirectory for this
PrimaryDataEntity.PrimaryDataDirectoryException - if trying to move the root PrimaryDataDirectory.protected abstract void moveImpl(PrimaryDataDirectory destinationDirectory)
move(PrimaryDataDirectory).destinationDirectory - the new PrimaryDataDirectory for this
PrimaryDataEntity.public final void rename(String name) throws PrimaryDataEntityVersionException, PrimaryDataDirectoryException
PrimaryDataEntity.
NOTE: Can not rename if another PrimaryDataEntity with this name already exists!
name - the new name for this PrimaryDataEntity.PrimaryDataEntityVersionException - if unable to set the new PrimaryDataEntityVersion.PrimaryDataDirectoryException - if an PrimaryDataEntity with this name already
exists.public void revokePermission(Principal principal, GrantableMethods.Methods method) throws PrimaryDataEntityException
EdalPermission to a Principal and check before
revoke if the method exists.
NOTE: Can not revoke
grantPermission(Principal, de.ipk_gatersleben.bit.bi.edal.aspectj.security.GrantableMethods.Methods)
method for your own PrimaryDataEntity!
principal - to revoke this method.method - Enum for a the method.PrimaryDataEntityException - if trying to revoke the EdalPermission for
grantPermission(Principal, de.ipk_gatersleben.bit.bi.edal.aspectj.security.GrantableMethods.Methods)
of your own PrimaryDataEntity.protected void setCurrentVersion(PrimaryDataEntityVersion version)
PrimaryDataEntityVersion.version - the new current PrimaryDataEntityVersion object.protected final void setDefaultPermissions()
throws PrimaryDataEntityException
EdalPermission for this
PrimaryDataEntity.PrimaryDataEntityException - if unable to set the permissions.protected void setID(String id)
PrimaryDataEntityid - the ID to setprotected UntypedData reloadOldDataType(EnumDublinCoreElements element) throws MetaDataException
MetaData for
the current version, after the user set a wrong value.element - the Element to reload from the old MetaDataMetaDataException - if unable to reload the old MetaData.public void setMetaData(MetaData newMetadata) throws PrimaryDataEntityVersionException, MetaDataException
MetaData object of this PrimaryDataEntity
object.
Create a new PrimaryDataEntityVersion with a new MetaData
set.newMetadata - the new MetaData object to set.PrimaryDataEntityVersionException - if unable to store PrimaryDataEntityVersion.MetaDataException - if there are non valid value for element in the
MetaData object.protected void setParentDirectory(PrimaryDataDirectory parentDirectory)
PrimaryDataDirectory of this
PrimaryDataEntity.parentDirectory - the parent PrimaryDataDirectory to setprotected abstract void storeVersion(PrimaryDataEntityVersion newVersion) throws PrimaryDataEntityVersionException
PrimaryDataEntityVersion for
an PrimaryDataEntity object.newVersion - the new PrimaryDataEntityVersion to store.PrimaryDataEntityVersionException - if unable to store PrimaryDataEntityVersion.public void switchCurrentVersion(PrimaryDataEntityVersion version) throws PrimaryDataEntityVersionException
PrimaryDataEntityVersion with this
PrimaryDataEntityVersion.
NOTE: Can not switch when the current PrimaryDataEntityVersion is marked as deleted !
NOTE: Can not switch when the PrimaryDataEntityVersion not in the SortedSet of this PrimaryDataEntity !
version - the new PrimaryDataEntityVersion to set as current
PrimaryDataEntityVersion.PrimaryDataEntityVersionException - if requested PrimaryDataEntityVersion is not
available or marked as deleted.Copyright © 2015 Leibniz Institute of Plant Genetics and Crop Plant Research (IPK). All rights reserved.