Class AbstractBasketDO<T extends BasketItem<E>,E extends ComplexEntity>

All Implemented Interfaces:
IBaseDO<Basket>
Direct Known Subclasses:
AssetBasketDO, NodeBasketDO

public abstract class AbstractBasketDO<T extends BasketItem<E>,E extends ComplexEntity> extends AbstractSimpleEntityDO<Basket>
  • Constructor Details

    • AbstractBasketDO

      public AbstractBasketDO()
  • Method Details

    • getUserRole

      public User.UserBaseRole getUserRole()
      Description copied from interface: IBaseDO
      get at least needed user base role for the entity class
      Specified by:
      getUserRole in interface IBaseDO<T extends BasketItem<E>>
      Overrides:
      getUserRole in class AbstractSimpleEntityDO<Basket>
    • getObjectTypes

      public abstract List<? extends ComplexTypeEntity> getObjectTypes(Basket basket)
    • assertItemObjectClass

      public void assertItemObjectClass(Basket basket)
    • insert

      public Basket insert() throws ApplicationException
      inserts empty basket, sets current user as owner, sets a default name containing current date and sets this basket active.
      Returns:
      inserted basket
      Throws:
      ApplicationException
    • insert

      public Basket insert(Basket basket) throws ApplicationException
      inserts new basket, sets current user as owner, by empty name sets a default name containing current date and sets this basket active if active flag of given basket is true.
      Parameters:
      basket - optional. if null a new basket with active flag "false" will be created
      Returns:
      inserted basket
      Throws:
      ApplicationException
    • setTransientInfo

      public Basket setTransientInfo(Basket basket) throws ApplicationException
      TO OVERRIDE by specific info, see AssetBasketDO
      Parameters:
      basket -
      Returns:
      basket with transient information
      Throws:
      ApplicationException
    • newBasket

      public Basket newBasket(List<E> ceObjectList) throws ApplicationException
      Throws:
      ApplicationException
    • edit

      public Basket edit(Basket basket) throws ApplicationException
      Throws:
      ApplicationException
    • delete

      public void delete(Basket basket, boolean force) throws ApplicationException
      deletes Basket from database if own, else only shared link for current user be deleted
      Overrides:
      delete in class AbstractBaseDO<Basket>
      Parameters:
      basket - mandatory
      force - if true delete without usage check, which can result in db constraints error unless references are taken care of
      Throws:
      ApplicationException
    • removeObject

      public boolean removeObject(Basket basket, E ceObject) throws ApplicationException
      removes object from given basket, but only if basket unlocked
      Throws:
      ApplicationException
    • removeObject

      public void removeObject(Basket basket, List<E> ceObjectList) throws ApplicationException
      removes object list from given basket, but only if basket unlocked
      Throws:
      ApplicationException
    • addObject

      public void addObject(Basket basket, E ceObject) throws ApplicationException
      Throws:
      ApplicationException
    • addObject

      public int addObject(Basket basket, List<E> ceObjectList) throws ApplicationException
      Throws:
      ApplicationException
    • getVisibleBasketItems

      public List<BasketItem> getVisibleBasketItems(Basket basket)
      get list of basket items (only visible!)
      Parameters:
      basket - mandatory
      Returns:
      list of basket items only visible
    • isObjectInBasket

      public boolean isObjectInBasket(Basket basket, long ceObjectId)
      check existence of BasketItem with @param ceObjectId
      WARNINIG: the visibility be not checked!
      Parameters:
      basket - mandatory
      ceObjectId -
      Returns:
    • getBasketItem

      public BasketItem getBasketItem(Basket basket, long ceObjectId)
      get BasketItem with @param ceObjectId or null if not in basket
      WARNINIG: the visibility be not checked!
      Parameters:
      basket - mandatory
      ceObjectId -
      Returns:
    • getObjectIdsInBasket

      public List<Long> getObjectIdsInBasket(Basket basket)
      get all objects in basket as id list
      WARNINIG: don't use for load, only for check, the visibility be not filtered!
      Parameters:
      basket - mandatory
      Returns:
      all objects in basket as id list
    • getItemObjects

      public List<E> getItemObjects(Basket basket)
      get only visible objects in basket
      Parameters:
      basket - mandatory
      Returns:
      list of objects from basket or empty list if basket is empty
    • getItemObjects

      public List<E> getItemObjects(Basket basket, mc.core.system.search.SearchFilter sf)
      get only visible objects in basket according filter
      Parameters:
      basket - mandatory
      sf - optional. if not null use this filter for search and adding criteria basket to it
      Returns:
      list of objects from basket according search filter
      See Also:
    • getItemObjectCount

      public int getItemObjectCount(Basket basket)
      count of objects from basket (only visible!)
      Parameters:
      basket - mandatory
      Returns:
      count of objects from basket (only visible!)
    • addReceiver

      public void addReceiver(Basket basket, Principal principal, String receiverEmailOrList, Locale javaLocale) throws ApplicationException
      add new basket receiver with generated external key and by internal user with @principal if basket-principal combination not exist
      by external user with email if basket-email combination not exist
      send email an external user with link for download. Either principal or receiverEmail must not be null.
      Parameters:
      basket - mandatory
      principal - optional, user or user group
      receiverEmailOrList - address of external user, can also be a list of addresses separated by ";"
      javaLocale - define the template language for mail and error page by external user if not set, the sessionData.getUiJavaLocale() be used as default.
      Throws:
      ApplicationException
    • reSend

      public void reSend(Basket basket, BasketReceiver basketReceiver, Locale javaLocale) throws ApplicationException
      re-send this basket to the basket receiver: send again email by external user or notification by internal user
      Parameters:
      basket - mandatory
      basketReceiver - mandatory
      javaLocale - define the template language for mail and error page by external user if not set, the sessionData.getUiJavaLocale() be used as default.
      Throws:
      ApplicationException
    • removeReceiver

      public void removeReceiver(Basket basket, BasketReceiver basketReceiver) throws ApplicationException
      Throws:
      ApplicationException
    • getBasketReceiver

      public BasketReceiver getBasketReceiver(Basket basket, Principal principal, String receiverEmail) throws ApplicationException
      Throws:
      ApplicationException
    • getBasketReceiver

      public BasketReceiver getBasketReceiver(Basket basket, Principal principal) throws ApplicationException
      Throws:
      ApplicationException
    • copy

      public Basket copy(Basket source) throws ApplicationException
      copy Basket with all objects but without shared data
      and set it to active
      Overrides:
      copy in class AbstractEntityBaseDO<Basket>
      Parameters:
      source - mandatory
      Throws:
      ApplicationException
    • toggleLock

      public void toggleLock(Basket basket) throws ApplicationException
      Throws:
      ApplicationException
    • setActive

      public void setActive(Basket basket) throws ApplicationException
      sets this basket active for the session user.
      Sets currently active basket, if exists, for this user to inactive
      Allowed only for own non locked baskets
      Parameters:
      basket - mandatory
      Throws:
      ApplicationException
    • activeForUser

      public Basket activeForUser() throws ApplicationException
      Returns:
      the current active Basket for session user, if no Basket exists creates one and inserts in database.
      Throws:
      ApplicationException
    • getAllForUser

      public List<Basket> getAllForUser(User owner)
      Returns:
      All Baskets which given user owns.
    • buildSearchFilterForSharedBaskets

      public mc.core.system.search.SearchFilter buildSearchFilterForSharedBaskets(boolean onlyFullControl)
      return search filter for shared basket: the ceClass is the class of basket item objects receiver is current user or his group criteria for shared is true criteria for valid from : shareValidFrom <= today <= shareValidUntil
    • getShareUri

      public String getShareUri(BasketReceiver bReceiver, Locale javaLocale)
      See Also:
      • AssetAPI#assetBasketGetShareUri(BasketReceiver, java.util.Locale)
    • exportDCM

      public void exportDCM(Basket basket, Locale locale, EntityProfile profile) throws ApplicationException, UserException
      Throws:
      ApplicationException
      UserException
    • importDCM

      public void importDCM(Basket basket, Locale locale, InputStream is, String filename) throws ApplicationException
      Throws:
      ApplicationException