Interface IPersistencePolicy


public interface IPersistencePolicy
Persistence policy class.
Version:
$Revision$ $Date$
Author:
Stepan Roh, Polarion Software
See Also:
  • Method Details

    • getSecurityService

      @NotNull ISecurityService getSecurityService()
      Convenience method.
      Returns:
      The platform's ISecurityService.
    • canReadInstances

      boolean canReadInstances(@Nullable String prototypeName, @Nullable IContextId contextId)
      Security check if the current user can read instances of given prototype in given context (project).
      Parameters:
      prototypeName -
      contextId -
      Returns:
      true if the current user can read instances of the prototype in the specified context
    • checkCanReadInstances

      void checkCanReadInstances(@Nullable String prototypeName, @Nullable IContextId contextId)
      Similar to canReadInstances(String,IContextId), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      prototypeName -
      contextId -
      Throws:
      PermissionDeniedException - if permission is denied
    • canReadInstances

      boolean canReadInstances(@Nullable String userId, @Nullable String prototypeName, @Nullable IContextId contextId)
      Security check if the specified user can read instances of given prototype in given context (project).
      Parameters:
      prototypeName -
      contextId -
      Returns:
      true if the specified user can read instances of the prototype in the specified context
      Since:
      3.5.0
    • canModifyInstances

      boolean canModifyInstances(@Nullable String prototypeName, @Nullable IContextId contextId)
      Security check if the current user can modify instances of given prototype in given context (project).
      Parameters:
      prototypeName -
      contextId -
      Returns:
      true if the current user can modify instances of the prototype in the specified context
    • checkCanModifyInstances

      void checkCanModifyInstances(@Nullable String prototypeName, @Nullable IContextId contextId)
      Similar to canModifyInstances(String,IContextId), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      prototypeName -
      contextId -
      Throws:
      PermissionDeniedException - if permission is denied
    • canCreateInstances

      boolean canCreateInstances(@Nullable String prototypeName, @Nullable IContextId contextId)
      Security check if the current user can create instances of given prototype in given context (project).
      Parameters:
      prototypeName -
      contextId -
      Returns:
      true if the current user can create instances of the prototype in the specified context
    • checkCanCreateInstances

      void checkCanCreateInstances(@Nullable String prototypeName, @Nullable IContextId contextId)
      Similar to canCreateInstances(String,IContextId), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      prototypeName -
      contextId -
      Throws:
      PermissionDeniedException - if permission is denied
    • canDeleteInstances

      boolean canDeleteInstances(@Nullable String prototypeName, @Nullable IContextId contextId)
      Security check if the current user can delete instances of given prototype in given context (project).
      Parameters:
      prototypeName -
      contextId -
      Returns:
      true if the current user can read the prototype in the specified context
    • checkCanDeleteInstances

      void checkCanDeleteInstances(@Nullable String prototypeName, @Nullable IContextId contextId)
      Similar to canDeleteInstances(String,IContextId), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      prototypeName -
      contextId -
      Throws:
      PermissionDeniedException - if permission is denied
    • canReadInstance

      boolean canReadInstance(@NotNull IPObject instance)
      Security check if the current user can read the instance. This method can only restrict the access more than method with prototypeName and context as parameters.
      Parameters:
      instance -
      Returns:
      true if the current user can read the instance
    • checkCanReadInstance

      void checkCanReadInstance(@NotNull IPObject instance)
      Similar to canReadInstance(IPObject), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      instance -
      Throws:
      PermissionDeniedException - if permission is denied
    • canReadInstance

      boolean canReadInstance(@Nullable String userId, @NotNull IPObject instance)
      Security check if the specified user can read the instance. This method can only restrict the access more than method with prototypeName and context as parameters.
      Parameters:
      instance -
      Returns:
      true if the specified user can read the instance
      Since:
      3.5.0
    • canModifyInstance

      boolean canModifyInstance(@NotNull IPObject instance)
      Security check if the current user can modify the instance. This method can only restrict the access more than method with prototypeName and context as parameters.
      Parameters:
      instance -
      Returns:
      true if the current user can modify the instance
    • checkCanModifyInstance

      void checkCanModifyInstance(@NotNull IPObject instance)
      Similar to canModifyInstance(IPObject), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      instance -
      Throws:
      PermissionDeniedException - if permission is denied
    • canCreateInstance

      boolean canCreateInstance(@NotNull IPObject instance)
      Security check if the current user can create the instance. This method can only restrict the access more than method with prototypeName and context as parameters.
      Parameters:
      instance -
      Returns:
      true if the current user can create the instance
    • checkCanCreateInstance

      void checkCanCreateInstance(@NotNull IPObject instance)
      Similar to canCreateInstance(IPObject), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      instance -
      Throws:
      PermissionDeniedException - if permission is denied
    • canDeleteInstance

      boolean canDeleteInstance(@NotNull IPObject instance)
      Security check if the current user can delete the instance. This method can only restrict the access more than method with prototypeName and context as parameters.
      Parameters:
      instance -
      Returns:
      true if the current user can delete the instance
    • checkCanDeleteInstance

      void checkCanDeleteInstance(@NotNull IPObject instance)
      Similar to canDeleteInstance(IPObject), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      instance -
      Throws:
      PermissionDeniedException - if permission is denied
    • canReadKey

      boolean canReadKey(@Nullable String prototypeName, @Nullable String key, @Nullable IContextId contextId)
      Security check if the current user can read value of given key in instances of given prototype in given context (project).
      Parameters:
      prototypeName -
      key -
      contextId -
      Returns:
      true if the current user can read the value of key for the specified prototype in specified context
    • checkCanReadKey

      void checkCanReadKey(@Nullable String prototypeName, @Nullable String key, @Nullable IContextId contextId)
      Similar to canReadKey(String,String,IContextId), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      prototypeName -
      contextId -
      Throws:
      PermissionDeniedException - if permission is denied
    • canModifyKey

      boolean canModifyKey(@Nullable String prototypeName, @Nullable String key, @Nullable IContextId contextId)
      Security check if the current user can modify value of given key in instances of given prototype in given context (project).
      Parameters:
      prototypeName -
      key -
      contextId -
      Returns:
      true if the current user can modify the value of key for the specified prototype in specified context
    • checkCanModifyKey

      void checkCanModifyKey(@Nullable String prototypeName, @Nullable String key, @Nullable IContextId contextId)
      Similar to canModifyKey(String,String,IContextId), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      prototypeName -
      contextId -
      Throws:
      PermissionDeniedException - if permission is denied
    • canAddElementToKey

      boolean canAddElementToKey(@Nullable String prototypeName, @Nullable String key, @Nullable IContextId contextId)
      Security check if the current user can add elements to list value of given key in instances of given prototype in given context (project).
      Parameters:
      prototypeName -
      key -
      contextId -
      Returns:
      true if the current user can add values to the list at key for the specified prototype in specified context
    • checkCanAddElementToKey

      void checkCanAddElementToKey(@Nullable String prototypeName, @Nullable String key, @Nullable IContextId contextId)
      Similar to canAddElementToKey(String,String,IContextId), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      prototypeName -
      contextId -
      Throws:
      PermissionDeniedException - if permission is denied
    • canRemoveElementFromKey

      boolean canRemoveElementFromKey(@Nullable String prototypeName, @Nullable String key, @Nullable IContextId contextId)
      Security check if the current user can remove elements from list value of given key in instances of given prototype in given context (project).
      Parameters:
      prototypeName -
      key -
      contextId -
      Returns:
      true if the current user can remove values from the list at key for the specified prototype in specified context
    • checkCanRemoveElementFromKey

      void checkCanRemoveElementFromKey(@Nullable String prototypeName, @Nullable String key, @Nullable IContextId contextId)
      Similar to canRemoveElementFromKey(String,String,IContextId), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      prototypeName -
      contextId -
      Throws:
      PermissionDeniedException - if permission is denied
    • canReadKey

      boolean canReadKey(@NotNull IPObject instance, @Nullable String key)
      Security check if the current user can read value of given key in the instance. This method can only restrict the access more than method with prototypeName and context as parameters.
      Parameters:
      instance -
      key -
      Returns:
      true if the current user can read the value at key for the specified instance
    • checkCanReadKey

      void checkCanReadKey(@NotNull IPObject instance, @Nullable String key)
      Similar to canReadKey(IPObject,String), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      instance -
      key -
      Throws:
      PermissionDeniedException - if permission is denied
    • canModifyKey

      boolean canModifyKey(@NotNull IPObject instance, @Nullable String key)
      Security check if the current user can modify value of given key in the instances. This method can only restrict the access more than method with prototypeName and context as parameters.
      Parameters:
      instance -
      key -
      Returns:
      true if the current user can modify the value at key for the specified instance
    • checkCanModifyKey

      void checkCanModifyKey(@NotNull IPObject instance, @Nullable String key)
      Similar to canModifyKey(IPObject,String), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      instance -
      key -
      Throws:
      PermissionDeniedException - if permission is denied
    • canAddElementToKey

      boolean canAddElementToKey(@NotNull IPObject instance, @Nullable String key)
      Security check if the current user can add elements to the list value of given key in the instance. This method can only restrict the access more than method with prototypeName and context as parameters.
      Parameters:
      instance -
      key -
      Returns:
      true if the current user can add values to the list at key for the specified instance
    • checkCanAddElementToKey

      void checkCanAddElementToKey(@NotNull IPObject instance, @Nullable String key)
      Similar to canAddElementToKey(IPObject,String), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      instance -
      key -
      Throws:
      PermissionDeniedException - if permission is denied
    • canRemoveElementFromKey

      boolean canRemoveElementFromKey(@NotNull IPObject instance, @Nullable String key)
      Security check if the current user can remove elements from the list value of given key in instance. This method can only restrict the access more than method with prototypeName and context as parameters.
      Parameters:
      instance -
      key -
      Returns:
      true if the current user can remove values from the list at key for the specified instance
    • checkCanRemoveElementFromKey

      void checkCanRemoveElementFromKey(@NotNull IPObject instance, @Nullable String key)
      Similar to canRemoveElementFromKey(IPObject,String), with the difference that instead of returning false, it will throw PermissionDeniedException
      Parameters:
      instance -
      key -
      Throws:
      PermissionDeniedException - if permission is denied
    • preEvaluateCustomSets

      void preEvaluateCustomSets(@Nullable Iterable<IPObject> instances)
      Internal API, do not use.

      Pre-evaluates custom sets for first 20 instances from the given Iterable.
      It is meant for improving performance of evaluating the custom sets permissions.
      Not persisted instances are ignored.
      The instances should be sorted by prototype and context for best efficiency.
      Since:
      3.10.1