de.espirit.firstspirit.access.packagepool
Interface Package

All Superinterfaces:
Comparable<Package>, Lockable
All Known Subinterfaces:
ContentPackage, TemplatePackage

public interface Package
extends Lockable, Comparable<Package>

The Package object needs to be locked for modifying operations. Use Lockable.isLocked() and Lockable.lock() to manage the locking of the packge.
All changes to the package needs to be commited by calling Lockable.save() to make the changes persistent on the server.
To rollback changes to a package, call Lockable.refresh() instead of Lockable.save()

Since:
3.1.185

Field Summary
static int CONTENT_PACKAGE
           
static int TEMPLATE_PACKAGE
           
static byte WF_ACTUALIZE
           
static byte WF_CONFLICT
           
static byte WF_ERROR
           
static byte WF_OK
           
static byte WF_RELEASE
           
 
Method Summary
 void addAuthorisedUser(User user)
          Adds the given user to the list of authorised User's of this package.
 void addPublishUser(User user)
          Adds the given user to the list of User's which have the permission 'publish' for this package.
 void addResponsibleUser(User user)
          Adds the given user to the list of responsible User's of this package.
 void addStartNode(IDProvider storeElement)
          Add a start node.
 boolean containsStartNode(IDProvider node)
          Checks if the given start node is existing in the underlying start node list of this package.
 PackageVersion createVersion(String tag, String comment)
          Create a new version.
 PackageVersion createVersion(String tag, String comment, boolean update)
          Creates a new version.
 void delete()
           
 Map<Class<? extends PackagePoolItem>,Boolean> getAllNameSpaceEnhancements()
          Get all defined NameSpaceEnhancement Settings for this package.
 Map<Class<? extends PackagePoolItem>,Boolean> getAllOverwriteDuringImportSettings()
          Get all defined OverwriteDuringImport Settings for this package.
 List<User> getAuthorisedUsers()
          Gets an unmodifiable list of authorised User's of this package.
 String getComment()
          Returns the comment of this package.
 Set<String> getCustomEventNames()
          Returns a Set of all defined custom event names of this package.
 String getCustomEventScriptName(String eventName)
          Returns the name of the script which is mapped to the specified custom event.
 Map<String,String> getCustomEventScripts()
          Returns a read-only map of all defined custom events.
 long getId()
          Gets the id of this package.
 String getName()
          Returns the name of this package.
 Project getPublisher()
          Gets the publisher Project of this package.
 List<User> getPublishUsers()
          Gets an unmodifiable list of User's which have the permission 'publish' for this package.
 List<User> getResponsibleUsers()
          Gets an unmodifiable list of responsible User's of this package.
 Collection<IDProvider> getStartNodes()
          Returns a read-only List of StoreElement's of start nodes existing in this package.
 Collection<IDProvider> getStartNodes(Store.Type storeType)
          Returns a read-only List of StoreElement's of start nodes existing in this package from the given Store type.
 int getType()
          Returns the type of this package.
 int getVersion()
          Gets the version of this package.
 List<PackageVersion> getVersions()
          Returns a readonly list of PackageVersion's existing for this package.
 String getWorkflowName(byte type)
          Gets the name of the Workflow which is mapped to the given event type.
 boolean isAvailable()
          This flag indicates if the package is available.
 boolean isReadOnly()
          Read only packages: Content in subscribing may not be changed.
 boolean isValidNodeType(StoreElement node)
           
 boolean overwriteDuringImport()
          Indicates how to handle package pool items which causes an uid conflict during import of this package.
 boolean overwriteDuringImport(Class<? extends PackagePoolItem> clazz)
          Indicates how to handle package pool items of the given clazz which causes an uid conflict during import of this package.
 void publishPackage()
          Publish this package.
 void publishPackage(PublishGroup publishGroup)
          Publish this package for the specified group.
 void removeAuthorisedUser(User user)
          Removes the given user from the list of authorised User's of this package.
 void removeCustomEvent(String eventName)
          Removes the given custom event name from the list of custom events.
 void removePublishUser(User user)
          Removes the given user from the list of User's which have the permission 'publish' for this package.
 void removeResponsibleUser(User user)
          Removes the given user from the list of responsible User's of this package.
 void removeStartNode(IDProvider storeElement)
          Removes the given StoreElement from the list of start nodes.
 void removeVersion(PackageVersion version)
          Removes the given PackageVersion from this package.
 void setAvailable(boolean available)
          Set this package available / not available.
 void setComment(String comment)
          Sets the comment for this package.
 void setCustomScriptName(String eventName, String scriptName)
          Map the script specified by the given script name to the given custom event name.
 void setLocked(boolean lock)
          Deprecated. since 4.0.17 - use Lockable.lock() or Lockable.unlock()
 void setName(String name)
          Sets the name for this package.
 void setOverwriteDuringImport(boolean overwrite)
          Defines how to handle elements which causes an uid conflict during import of this package.
 void setOverwriteDuringImport(boolean overwrite, Class<? extends PackagePoolItem>... clazz)
          Set overwrite handling for specified types.
 void setReadOnly(boolean value)
          Read only packages: Content in subscribing may not be changed.
 void setUseNameSpaceEnhancement(boolean enhanceNameSpace)
          Set use name space enhancement.
 void setUseNameSpaceEnhancement(boolean useEnhancement, Class<? extends PackagePoolItem>... clazz)
          Set use name space enhancement for specified types.
 void setWorkflow(byte type, Workflow workflow)
          Map the given workflow to the given event type.
 Subscription subscribePackage(Project subscriber)
          Creates a new Subscription to this package from the given Project.
 Subscription subscribePackage(Project subscriber, PublishGroup publishGroup)
          Creates a new Subscription to this package from the given Project and with the given PublishGroup.
 boolean useNameSpaceEnhancement()
          Indicates whether the uid of elements which are added to this package will be enhanced with '@PACKAGE_NAME' or not.
 boolean useNameSpaceEnhancement(Class<? extends PackagePoolItem> clazz)
          Indicates whether the uid of an element of the given clazz should be enhanced with '@PACKAGE_NAME' or not during PackagePoolItem.addToPackage(Package).
 
Methods inherited from interface de.espirit.firstspirit.access.Lockable
isChanged, isLocked, lock, refresh, save, unlock
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

CONTENT_PACKAGE

static final int CONTENT_PACKAGE
Since:
3.1.158
See Also:
Constant Field Values

TEMPLATE_PACKAGE

static final int TEMPLATE_PACKAGE
Since:
3.1.158
See Also:
Constant Field Values

WF_OK

static final byte WF_OK
Since:
3.1.158
See Also:
Constant Field Values

WF_ERROR

static final byte WF_ERROR
Since:
3.1.158
See Also:
Constant Field Values

WF_CONFLICT

static final byte WF_CONFLICT
Since:
3.1.158
See Also:
Constant Field Values

WF_RELEASE

static final byte WF_RELEASE
Since:
3.1.158
See Also:
Constant Field Values

WF_ACTUALIZE

static final byte WF_ACTUALIZE
Since:
3.1.158
See Also:
Constant Field Values
Method Detail

getId

long getId()
Gets the id of this package. The id is the unique identifier of the package.

Returns:
long the id of the package
Since:
3.1.158

getName

String getName()
Returns the name of this package.

Returns:
String name
Since:
3.1.158

setName

void setName(String name)
Sets the name for this package.

Parameters:
name - String the new name
Since:
3.1.158

getComment

String getComment()
Returns the comment of this package.

Returns:
String comment
Since:
3.1.158

setComment

void setComment(String comment)
Sets the comment for this package.

Parameters:
comment - String the new comment
Since:
3.1.158

getType

int getType()
Returns the type of this package.

Returns:
Package.CONTENT_PACKAGE or Package.TEMPLATE_PACKAGE
Since:
3.1.158

isValidNodeType

boolean isValidNodeType(StoreElement node)
Returns:
true if the type of the specified node is a valid content type for this package, false otherwise. Only nodes wich implement PackagePoolItem may be a valid.
Since:
3.1.158

getStartNodes

Collection<IDProvider> getStartNodes()
Returns a read-only List of StoreElement's of start nodes existing in this package.

Returns:
a list of start nodes (StoreElement
Since:
3.1.158

containsStartNode

boolean containsStartNode(IDProvider node)
Checks if the given start node is existing in the underlying start node list of this package.

Parameters:
node - to check against
Returns:
true if the given node is existing, false otherwise
Since:
4.0.17

getStartNodes

Collection<IDProvider> getStartNodes(Store.Type storeType)
Returns a read-only List of StoreElement's of start nodes existing in this package from the given Store type.

Parameters:
storeType -
Returns:
a list of start nodes (StoreElement) for the specified store (maybe empty)
Since:
4.0.17

addStartNode

void addStartNode(IDProvider storeElement)
Add a start node.

Parameters:
storeElement -
Throws:
IllegalArgumentException - if the provided store element does not belong to the publisher project or e.g. a template node is added to a content package
Since:
4.0.17

removeStartNode

void removeStartNode(IDProvider storeElement)
Removes the given StoreElement from the list of start nodes.

Parameters:
storeElement - the StoreElement to remove
Since:
4.0.17

getVersion

int getVersion()
Gets the version of this package. Every call of Lockable.save() increases this version if the package was changed.

Returns:
the current version of this package
Since:
3.1.158

getVersions

List<PackageVersion> getVersions()
Returns a readonly list of PackageVersion's existing for this package.

Returns:
List of PackageVersion's
Since:
3.1.158

createVersion

PackageVersion createVersion(String tag,
                             String comment)
Create a new version. Ensure to call Lockable.save() for this package to create version zip on the server.

Parameters:
tag - the tag for the new version
comment - the comment for the new version
Returns:
the new version
Since:
3.1.158

createVersion

PackageVersion createVersion(String tag,
                             String comment,
                             boolean update)
Creates a new version. Ensure to call Lockable.save() for this package to create version zip on the server. If update == true the version zip creation during Lockable.save() will ignore not released elements.
Attention: This method is preliminary api and may change in the future

Parameters:
tag - the tag for the new version
comment - the comment for the new version
update - indicates whether the created version should be an update version
Returns:
the new version
Since:
4.2.455

removeVersion

void removeVersion(PackageVersion version)
Removes the given PackageVersion from this package.

Parameters:
version - the PackageVersion to remove
Since:
3.1.158

subscribePackage

Subscription subscribePackage(Project subscriber)
Creates a new Subscription to this package from the given Project.
The Subscription is created with the default PublishGroup. To create a subscription with a different publishgroup use Package.subscribePackage(Project, PublishGroup)

Parameters:
subscriber - the Project which subscribes the package
Returns:
Subscription the new subscription
Since:
3.1.158

subscribePackage

Subscription subscribePackage(Project subscriber,
                              PublishGroup publishGroup)
Creates a new Subscription to this package from the given Project and with the given PublishGroup.

Parameters:
subscriber - the Project which subscribes the package
publishGroup - the PublishGroup to create the subscription for
Returns:
Subscription the new subscription
Since:
3.1.158

publishPackage

void publishPackage(PublishGroup publishGroup)
Publish this package for the specified group.
Starts the import of all Subscription's of this package which uses the given PublishGroup.

Since:
3.1.158

publishPackage

void publishPackage()
Publish this package.
Starts the import of all Subscription's of this package on the server.

Since:
3.1.158

getPublisher

@Nullable
Project getPublisher()
Gets the publisher Project of this package.
If the project has been deleted or deactivated this method will return null.

Returns:
Project master project
Since:
3.1.158

isReadOnly

boolean isReadOnly()
Read only packages: Content in subscribing may not be changed.

Since:
3.1.158
See Also:
Package.setReadOnly(boolean)

setReadOnly

void setReadOnly(boolean value)
Read only packages: Content in subscribing may not be changed.

Since:
3.1.158
See Also:
Package.isReadOnly()

isAvailable

boolean isAvailable()
This flag indicates if the package is available. Only available packages could be subscribed by other projects.

Returns:
true if this package is available, false otherwise.
Since:
3.1.158

setAvailable

void setAvailable(boolean available)
Set this package available / not available.

Parameters:
available - true to activate, false to deactivate the package
Since:
3.1.158

getPublishUsers

List<User> getPublishUsers()
Gets an unmodifiable list of User's which have the permission 'publish' for this package.

Returns:
List of publish User's
Since:
3.1.158

addPublishUser

void addPublishUser(User user)
Adds the given user to the list of User's which have the permission 'publish' for this package.

Parameters:
user - the user to add
Since:
3.1.158

removePublishUser

void removePublishUser(User user)
Removes the given user from the list of User's which have the permission 'publish' for this package.

Parameters:
user - the user to remove
Since:
3.1.158

getResponsibleUsers

List<User> getResponsibleUsers()
Gets an unmodifiable list of responsible User's of this package.

Returns:
List of responsible User's
Since:
3.1.158

addResponsibleUser

void addResponsibleUser(User user)
Adds the given user to the list of responsible User's of this package.

Parameters:
user - the user to add
Since:
3.1.158

removeResponsibleUser

void removeResponsibleUser(User user)
Removes the given user from the list of responsible User's of this package.

Parameters:
user - the user to remove
Since:
3.1.158

getAuthorisedUsers

List<User> getAuthorisedUsers()
Gets an unmodifiable list of authorised User's of this package.

Returns:
List of authorised User's
Since:
3.1.158

addAuthorisedUser

void addAuthorisedUser(User user)
Adds the given user to the list of authorised User's of this package.

Parameters:
user - the user to add
Since:
3.1.158

removeAuthorisedUser

void removeAuthorisedUser(User user)
Removes the given user from the list of authorised User's of this package.

Parameters:
user - the user to remove
Since:
3.1.158

getWorkflowName

String getWorkflowName(byte type)
Gets the name of the Workflow which is mapped to the given event type.

Parameters:
type - Package.WF_OK, Package.WF_ERROR, Package.WF_CONFLICT, Package.WF_RELEASE, Package.WF_ACTUALIZE
Returns:
null if no workflow is defined for this type, else the node id of the workflow node
Since:
3.1.158

setWorkflow

void setWorkflow(byte type,
                 Workflow workflow)
Map the given workflow to the given event type. The given workflow needs to exist in the target project.

Parameters:
type - Package.WF_OK, Package.WF_ERROR, Package.WF_CONFLICT, Package.WF_RELEASE, Package.WF_ACTUALIZE
workflow - the workflow to map to the event type
Since:
3.1.158

getCustomEventNames

Set<String> getCustomEventNames()
Returns a Set of all defined custom event names of this package.

Returns:
Set of String's
Since:
3.1.158

getCustomEventScripts

Map<String,String> getCustomEventScripts()
Returns a read-only map of all defined custom events.
Key: String custom event name
Value: String the name of the script which is started when the event is triggered

Returns:
read-only map of all defined custom events
Since:
3.1.158

setCustomScriptName

void setCustomScriptName(String eventName,
                         String scriptName)
Map the script specified by the given script name to the given custom event name.

Parameters:
eventName - the custom event name to map the script to
scriptName - the name of the script to map to the custom event
Since:
3.1.158

removeCustomEvent

void removeCustomEvent(String eventName)
Removes the given custom event name from the list of custom events.

Parameters:
eventName - the custom event name to remove
Since:
3.1.158

getCustomEventScriptName

String getCustomEventScriptName(String eventName)
Returns the name of the script which is mapped to the specified custom event.

Parameters:
eventName - the name of the custom event
Returns:
String the name of the script which is bind to the specified event or null if no binding is defined
Since:
3.1.158

delete

void delete()
Since:
3.1.158 Deletes this package. Requires a lock to this package

setLocked

@Deprecated
void setLocked(boolean lock)
               throws LockException
Deprecated. since 4.0.17 - use Lockable.lock() or Lockable.unlock()

Throws:
LockException
Since:
3.1.158

useNameSpaceEnhancement

boolean useNameSpaceEnhancement()
Indicates whether the uid of elements which are added to this package will be enhanced with '@PACKAGE_NAME' or not. This flag is used as fallback if there is no special type setting for the element which is added.

Returns:
true (default) if elements should be enhanced with '@PACKAGE_NAME' during add to package, false otherwise
Since:
4.1.10
See Also:
Package.setUseNameSpaceEnhancement(boolean), Package.setUseNameSpaceEnhancement(boolean, Class[])

setUseNameSpaceEnhancement

void setUseNameSpaceEnhancement(boolean enhanceNameSpace)
Set use name space enhancement. Use true to enable name space enhancement with '@PACKAGE_NAME' for the uid of elements which are added to this package. For type specific settings use Package.setUseNameSpaceEnhancement(boolean, Class[])

Since:
4.1.10
See Also:
Package.useNameSpaceEnhancement(), Package.setUseNameSpaceEnhancement(boolean, Class[])

useNameSpaceEnhancement

boolean useNameSpaceEnhancement(Class<? extends PackagePoolItem> clazz)
Indicates whether the uid of an element of the given clazz should be enhanced with '@PACKAGE_NAME' or not during PackagePoolItem.addToPackage(Package). This method also regards inheritance of the given class and the fallback setting Package.useNameSpaceEnhancement() if there is no special setting for the given clazz.

Inheritance example:
If namespace enhancement is set to false for Template.class a call to useNameSpaceEnhancement(TableTemplate.class) delivers false cause TableTemplate inherites interface Template

Returns:
true if elements should be enhanced with '@PACKAGE_NAME', false otherwise
Since:
4.1.10
See Also:
Package.useNameSpaceEnhancement(), Package.setUseNameSpaceEnhancement(boolean, Class[])

setUseNameSpaceEnhancement

void setUseNameSpaceEnhancement(boolean useEnhancement,
                                Class<? extends PackagePoolItem>... clazz)
Set use name space enhancement for specified types.

Since:
4.1.10
See Also:
Package.useNameSpaceEnhancement(Class)

getAllNameSpaceEnhancements

Map<Class<? extends PackagePoolItem>,Boolean> getAllNameSpaceEnhancements()
Get all defined NameSpaceEnhancement Settings for this package.

Returns:
a Map containg all defined namespace enhancements settings for this package
Since:
4.1.10
See Also:
Package.useNameSpaceEnhancement()

overwriteDuringImport

boolean overwriteDuringImport()
Indicates how to handle package pool items which causes an uid conflict during import of this package.
Returns true if package pool items should be overwritten, false otherwise.

Returns:
true if elements with uid conflict should be overwritten during import, false (default) otherwise
Since:
4.1.10

setOverwriteDuringImport

void setOverwriteDuringImport(boolean overwrite)
Defines how to handle elements which causes an uid conflict during import of this package.
If true existing elements in target project with the same uid will be overwritten with the package pool item of this package.
If false (default) existing elements will be retained and the package pool item of this package will inserted with an unified uid

Since:
4.1.10
See Also:
Package.overwriteDuringImport()

overwriteDuringImport

boolean overwriteDuringImport(Class<? extends PackagePoolItem> clazz)
Indicates how to handle package pool items of the given clazz which causes an uid conflict during import of this package.
Returns true if package pool items should be overwritten, false otherwise. This method also regards inheritance of the given class and the fallback setting Package.overwriteDuringImport() if there is no special setting for the given clazz.

Inheritance example:
If overwrite during import is set to false for Template.class a call to overwriteDuringImport(TableTemplate.class) delivers false cause TableTemplate inherites interface Template

Returns:
true if elements with uid conflict should be overwritten during import, false otherwise
Since:
4.1.10
See Also:
Package.overwriteDuringImport(), Package.setOverwriteDuringImport(boolean, Class[])

setOverwriteDuringImport

void setOverwriteDuringImport(boolean overwrite,
                              Class<? extends PackagePoolItem>... clazz)
Set overwrite handling for specified types.

Since:
4.1.10
See Also:
), )

getAllOverwriteDuringImportSettings

Map<Class<? extends PackagePoolItem>,Boolean> getAllOverwriteDuringImportSettings()
Get all defined OverwriteDuringImport Settings for this package.

Returns:
a Map containg all defined overwrite during import settings for this package
Since:
4.1.10
See Also:
Package.overwriteDuringImport()


Copyright © 2012 e-Spirit AG. All Rights Reserved. Build 4.2.480