public interface VersionService<E extends VersionedModel<V>,V extends VersionModel<E>>
VersionServiceListener| Modifier and Type | Method and Description |
|---|---|
E |
checkout(E publishedVersionedModel,
int version)
Checks out the previous version for the versionedModel and saves it as a
draft.
|
E |
create()
Creates a new draft
VersionedModel. |
E |
delete(E publishedVersionedModel)
Deletes the
VersionedModel. |
E |
deleteDraft(E draftVersionedModel)
Deletes the
VersionedModel if it is a draft. |
V |
deleteVersion(V versionModel)
Deletes the
VersionModel if it is not the latest version. |
E |
fetchDraft(E versionedModel)
Fetches the draft if it exists, otherwise returns
null. |
E |
fetchDraft(long primaryKey)
Fetches the draft if it exists, otherwise returns
null. |
V |
fetchLatestVersion(E versionedModel)
Fetches the latest version model if it exists, otherwise returns
null if the versioned model has never been published. |
E |
fetchPublished(E versionedModel)
Fetches the published versioned model if it exists, otherwise returns
null if the versioned model has never been published. |
E |
fetchPublished(long primaryKey)
Fetches the published versioned model if it exists, otherwise returns
null. |
E |
getDraft(E versionedModel)
If the versioned model is a draft it is returned, otherwise fetches the
draft and lazily creates a new draft if it does not exist adding it to
the database.
|
E |
getDraft(long primaryKey)
Lazily creates a new draft adding it to the database if it does not exist
otherwise the existing versioned model already exists it is returned.
|
V |
getVersion(E versionedModel,
int version)
Gets the
VersionModel for the VersionedModel with the
given version. |
List<V> |
getVersions(E versionedModel)
Gets the list of
VersionModel for the VersionedModel. |
E |
publishDraft(E draftVersionedModel)
Publishes the draft and creates a new version model for the new version.
|
void |
registerListener(VersionServiceListener<E,V> versionServiceListener)
Registers the
VersionServiceListener. |
void |
unregisterListener(VersionServiceListener<E,V> versionServiceListener)
Unregisters the
VersionServiceListener. |
E |
updateDraft(E draftVersionedModel)
Updates the draft.
|
E checkout(E publishedVersionedModel, int version) throws PortalException
VersionServiceListener that have been
registered.publishedVersionedModel - the published versioned modelversion - the versionVersionModel being checkout outIllegalArgumentException - if the versioned model already has a
draftPortalException - if the version does not existE create()
VersionedModel. Does not add the versioned
model to the database.E delete(E publishedVersionedModel) throws PortalException
VersionedModel. Related draft if it exists and
versions are also deleted. Notifies any VersionServiceListener
that have been registered.publishedVersionedModel - the published versioned modelIllegalArgumentException - if the versioned model is a draft,
delete drafts by calling deleteDraft(VersionedModel)PortalException - if a portal exception occurredE deleteDraft(E draftVersionedModel) throws PortalException
VersionedModel if it is a draft. Notifies any
VersionServiceListener that have been registered.draftVersionedModel - the draft versioned modelIllegalArgumentException - if the versioned model is not a draft,
delete published versioned models by calling delete(
VersionedModel)PortalException - if a portal exception occurredV deleteVersion(V versionModel) throws PortalException
VersionModel if it is not the latest version.
Notifies any VersionServiceListener that have been registered.versionModel - the version modelIllegalArgumentException - if the version model is the latest
versionPortalException - if a portal exception occurredE fetchDraft(E versionedModel)
null.versionedModel - the draft or published versioned modelnull or the draft versioned model if it existsE fetchDraft(long primaryKey)
null.primaryKey - of the draft or published versioned modelnull or the draft versioned model if it existsV fetchLatestVersion(E versionedModel)
null if the versioned model has never been published.versionedModel - the versioned modelnull or the latest version model if it existsE fetchPublished(E versionedModel)
null if the versioned model has never been published.versionedModel - the versioned modelnull or the published versioned model if it existsE fetchPublished(long primaryKey)
null.versionedModel - the versioned modelnull or the published versioned model if it existsE getDraft(E versionedModel) throws PortalException
VersionServiceListener that have been registered are notified.versionedModel - the versioned modelPortalException - if a portal exception occurredE getDraft(long primaryKey) throws PortalException
VersionServiceListener that
have been registered are notified.primaryKey - of the draft or published versioned modelPortalException - no draft or published versioned model exists with
the primary keyV getVersion(E versionedModel, int version) throws PortalException
VersionModel for the VersionedModel with the
given version.versionedModel - the versioned modelversion - the versionPortalException - if the version does not existList<V> getVersions(E versionedModel)
VersionModel for the VersionedModel.
Sorted by highest to lowest version.versionedModel - the versioned modelE publishDraft(E draftVersionedModel) throws PortalException
VersionServiceListener that have been registered.draftVersionedModel - the draft version modelIllegalArgumentException - if the versionedModel is not a draftPortalException - if a portal exception occurredvoid registerListener(VersionServiceListener<E,V> versionServiceListener)
VersionServiceListener.versionServiceListener - to be registeredvoid unregisterListener(VersionServiceListener<E,V> versionServiceListener)
VersionServiceListener.versionServiceListener - to be unregisteredE updateDraft(E draftVersionedModel) throws PortalException
VersionServiceListener that have
been registered.draftVersionedModel - the draft version modelIllegalArgumentException - if the versioned model is not a draftPortalException - if a portal exception occurred