Class CCRI

java.lang.Object
mc.core.system.base.BaseBean
mc.core.domain.base.AbstractAPI
mc.core.domain.cc.CCRI

@Path("/") @Produces("application/json") public class CCRI extends AbstractAPI
CCRI exposes relevant functions in the CCAPI (content control API) as REST enabled endpoints.
  • Constructor Details

    • CCRI

      public CCRI()
  • Method Details

    • userInsert

      @POST @Path("user") public javax.ws.rs.core.Response userInsert() throws ApplicationException, IOException
      POST: user?data=[json]

      Insert a new user.

      Throws:
      ApplicationException
      IOException
      See Also:
      • CCAPI#userSave()
    • userEdit

      @POST @Path("user/{userKey}") public javax.ws.rs.core.Response userEdit(@PathParam("userKey") String userKey) throws ApplicationException, IOException
      POST: user/{userKey}?data=[json]

      Save data to an existing user.

      Throws:
      ApplicationException
      IOException
      See Also:
      • CCAPI#userSave(User user, DataMap dataMap)
    • userDelete

      @DELETE @Path("user/{userKey}") public void userDelete(@PathParam("userKey") String userKey) throws ApplicationException
      DELETE: user/{userKey}

      Delete an existing user.

      Throws:
      ApplicationException
      See Also:
      • CCAPI.userDelete(User user)
    • userPasswordChange

      @POST @Path("user/{userKey}/password") public void userPasswordChange(@PathParam("userKey") String userKey, @QueryParam("oldPw") String oldPw, @QueryParam("newPw") String newPw, @QueryParam("newPwRepeat") String newPwRepeat) throws ApplicationException
      POST: user/{userKey}/password?oldPw={oldPw}&newPw={newPw}&newPwRepeat={newPw}
      QueryParam: oldPw is mandatory
      QueryParam: newPw is mandatory
      QueryParam: newPwRepeat is mandatory

      Change user password.

      Throws:
      ApplicationException
      See Also:
      • CCAPI#userSave(User user, DataMap dataMap)
    • userGetTerritories

      @GET @Path("user/{userKey}/territories") public javax.ws.rs.core.Response userGetTerritories(@PathParam("userKey") String userKey) throws ApplicationException, IOException
      GET: user/{userKey}/territories

      Get list of territories for a user.

      Throws:
      IOException
      ApplicationException
      See Also:
      • CCAPI.userGetTerritories(User user)
    • userProfileGetValue

      @GET @Path("user/{userKey}/profile/{profileKey}") public javax.ws.rs.core.Response userProfileGetValue(@PathParam("userKey") String userKey, @PathParam("profileKey") String profileKey) throws ApplicationException
      GET: user/{userKey}/profile/{profileKey}

      Get a profile value for a given key.

      Throws:
      ApplicationException
      See Also:
      • CCAPI.userProfileGetValue(User, UserProfileKey, Class)
    • userProfileSetValue

      @POST @Path("user/{userKey}/profile/{profileKey}/{value}") public void userProfileSetValue(@PathParam("userKey") String userKey, @PathParam("profileKey") String profileKey, @PathParam("value") String value) throws ApplicationException, UserException
      POST: user/{userKey}/profile/{profileKey}

      Set a profile value for a given key.

      Throws:
      ApplicationException
      UserException
      See Also:
      • CCAPI.userProfileSetValue(User, UserProfileKey, Object)
    • userGroupInsert

      @POST @Path("userGroup") public javax.ws.rs.core.Response userGroupInsert() throws ApplicationException, IOException
      POST: userGroup?data=[json]

      Create a new user group using json from dataMap.

      Throws:
      ApplicationException
      IOException
      See Also:
      • CCAPI.userGroupSave(UserGroup, DataMap)
    • userGroupEdit

      @POST @Path("userGroup/{userGroupKey}") public javax.ws.rs.core.Response userGroupEdit(@PathParam("userGroupKey") String userGroupKey) throws ApplicationException, IOException
      POST: userGroup/{userGroupKey}?data=[json]

      Save data in json data map to user group.

      Throws:
      ApplicationException
      IOException
      See Also:
      • CCAPI.userGroupSave(UserGroup, DataMap)
    • userGroupDelete

      @DELETE @Path("userGroup/{userGroupKey}") public void userGroupDelete(@PathParam("userGroupKey") String userGroupKey) throws ApplicationException
      DELETE: userGroup/{userGroupKey}

      Delete user group.

      Throws:
      ApplicationException
      See Also:
      • CCAPI#userGroupDelete(User user)
    • userGroupAddUser

      @POST @Path("userGroup/{userGroupKey}/user/{userKey}") public void userGroupAddUser(@PathParam("userGroupKey") String userGroupKey, @PathParam("userKey") String userKey) throws ApplicationException
      POST: userGroup/{userGroupKey}/user/{userKey}

      Add user to group.

      Throws:
      ApplicationException
      See Also:
      • CCAPI.userGroupAddUser(UserGroup, User)
    • userGroupRemoveUser

      @DELETE @Path("userGroup/{userGroupKey}/user/{userKey}") public void userGroupRemoveUser(@PathParam("userGroupKey") String userGroupKey, @PathParam("userKey") String userKey) throws ApplicationException
      DELETE: userGroup/{userGroupKey}/user/{userKey}

      Remove user from group.

      Throws:
      ApplicationException
      See Also:
      • CCAPI.userGroupRemoveUser(UserGroup, User)
    • rightInsert

      @POST @Path("right") public javax.ws.rs.core.Response rightInsert() throws ApplicationException, IOException
      POST: right?data=[json]

      Insert a new right type from the JSON data map.

      Throws:
      ApplicationException
      IOException
      See Also:
      • CCAPI.rightSave(Right right, DataMap dataMap)
    • rightEdit

      @POST @Path("right/{rightKey}") public javax.ws.rs.core.Response rightEdit(@PathParam("rightKey") String rightKey) throws ApplicationException, IOException
      POST: right/{rightKey}?data=[json]

      Save data to a right from the data map.

      Throws:
      ApplicationException
      IOException
      See Also:
      • CCAPI.rightSave(Right right, DataMap dataMap)
    • rightDelete

      @DELETE @Path("right/{rightKey}") public void rightDelete(@PathParam("rightKey") String rightKey) throws ApplicationException
      DELETE: right/{rightKey}

      Delete a right with the given key.

      Throws:
      ApplicationException
      See Also:
      • CCAPI.rightDelete(Right)
    • ceGetPermissions

      @GET @Path("{entityName}/{key}/permissions") public javax.ws.rs.core.Response ceGetPermissions(@PathParam("entityName") String entityName, @PathParam("key") String key) throws ApplicationException, IOException
      GET: {entityName}/{key}/permissions

      Get all permissions for complex entity, not only for current user.

      Throws:
      ApplicationException
      IOException
    • ceSetPermissions

      @POST @Path("{entityName}/{key}/permissions/principal/{principalKey}") public void ceSetPermissions(@PathParam("entityName") String entityName, @PathParam("key") String key, @PathParam("principalKey") String principalKey, @QueryParam("recursive") @DefaultValue("true") boolean recursive) throws ApplicationException, UserException
      POST: {entityName}/{key}/permissions/principal/{principalKey}?recursive=false&data=[permission map as json]

      set permissions for given user or userGroup on object and on all its children. set recursive=false if permission should be set only on object, not on children. deletes existing permissions for principal. The permissions map is passed as json String which should have the format below (remove comments to get valid json). For locale dependent rights list of locale keys should be provided. If list is empty permissions are created for all active locales.

       [
          {   
              "right": "EDIT" //locale independent right
          },
          {   
              "right": "TRANSLATE", //locale dependent right
              "locales": [ "de_DE", "en_US", "fr_FR"]
          },
          {   
              "right": 1, //user defined right, locale dependent, set for all active locales
              "locales": []
          }
       ]
       
       
      Throws:
      ApplicationException
      UserException
      See Also:
      • AspectPermission#setPermissions(ComplexEntity, mc.core.model.cc.Principal, java.util.List, boolean)
    • ceHasPermissionForRight

      public javax.ws.rs.core.Response ceHasPermissionForRight(@PathParam("entityName") String entityName, @PathParam("key") String key, @PathParam("rightKey") String rightKey, @QueryParam("localeKey") String localeKey) throws ApplicationException
      GET: {entityName}/{key}/permissions/right/{rightKey}

      check if logged in user has given right on this object.

      Throws:
      ApplicationException
      See Also:
      • CCAPI.ceHasPermission(ComplexEntity, Right, Locale)
    • ceHasPermissionForRightType

      public javax.ws.rs.core.Response ceHasPermissionForRightType(@PathParam("entityName") String entityName, @PathParam("key") String key, @PathParam("rightTypeKey") String rightTypeKey, @QueryParam("localeKey") String localeKey) throws ApplicationException
      GET: {entityName}/{key}/permissions/righttype/{rightTypeKey}

      check if logged in user has right of given right type on this object.

      Throws:
      ApplicationException
      See Also:
      • CCAPI.ceHasPermission(ComplexEntity, RightType, Locale)
    • ceGetStates

      @GET @Path("{entityName}/{key}/states") public javax.ws.rs.core.Response ceGetStates(@PathParam("entityName") String entityName, @PathParam("key") String key) throws ApplicationException, IOException
      GET: {entityName}/{key}/states

      Get all states for complex entity.

      Throws:
      ApplicationException
      IOException
    • ceIsEditAllowed

      @GET @Path("{entityName}/{key}/editallowed") public javax.ws.rs.core.Response ceIsEditAllowed(@PathParam("entityName") String entityName, @PathParam("key") String key, @QueryParam("localeKey") String localeKey) throws ApplicationException
      GET: {entityName}/{key}/editallowed?localeKey=de_DE

      return true if edit allowed for complex entity, optionally for the locale, otherwise for content locale

      Throws:
      ApplicationException
      See Also:
      • CCAPI.ceIsEditAllowed(IStateManaged, Locale)
    • ceDoStateTransition

      @POST @Path("{entityName}/{key}/statetransition/{stateTransitionTypeKey}") public void ceDoStateTransition(@PathParam("entityName") String entityName, @PathParam("key") String key, @PathParam("stateTransitionTypeKey") String stateTransitionTypeKey, @QueryParam("localeKey") String localeKey, @QueryParam("message") String message) throws UserException, ApplicationException
      POST: {entityName}/{key}/statetransition/{stateTransitionTypeKey}?localeKey=de_DE&message=[label key or plain message]

      execute the transition and change the state of the object, optionally for the locale, otherwise for content locale. Optional message is written in version report.

      Throws:
      UserException
      ApplicationException
      See Also:
      • CCAPI.ceDoStateTransition(IStateManaged, StateTransitionType, Locale, String)
    • ceDoStateTransitionToState

      @POST @Path("{entityName}/{key}/statetransition/to/{toStateTypeKey}") public void ceDoStateTransitionToState(@PathParam("entityName") String entityName, @PathParam("key") String key, @PathParam("toStateTypeKey") String toStateTypeKey, @QueryParam("localeKey") String localeKey, @QueryParam("message") String message) throws UserException, ApplicationException
      POST: {entityName}/{key}/statetransition/to/{toStateTypeKey}?localeKey=de_DE&message=[label key or plain message]

      determine transition from current to given target state (if any), execute the transition and change the state of the object, optionally for the locale, otherwise for content locale. Optional message is written in version report.

      Throws:
      UserException
      ApplicationException
      See Also:
      • CCAPI.ceDoStateTransition(IStateManaged, StateTransitionType, Locale, String)
    • ceInsertDefaultState

      @POST @Path("{entityName}/{key}/stategroup/{stateGroupTypeKey}") public void ceInsertDefaultState(@PathParam("entityName") String entityName, @PathParam("key") String key, @PathParam("stateGroupTypeKey") String stateGroupTypeKey, @QueryParam("localeKey") String localeKey) throws ApplicationException
      POST: {entityName}/{key}/stategroup/{stateGroupTypeKey}?localeKey=de_DE

      set the default state of given group on entity

      Throws:
      ApplicationException
      See Also:
      • CCAPI.ceInsertDefaultState(IStateManaged, StateGroupType, Locale)
    • ceInsertLocaleState

      @POST @Path("{entityName}/{key}/insertstate") public void ceInsertLocaleState(@PathParam("entityName") String entityName, @PathParam("key") String key, @QueryParam("localeKey") String localeKey) throws ApplicationException
      POST: {entityName}/{key}/insertstate?localeKey=de_DE

      set the insert state for each configured state group on entity

      Throws:
      ApplicationException
      See Also:
      • CCAPI.ceInsertLocaleState(IStateManaged, Locale)
    • stateGroupTypeInsert

      @POST @Path("stategrouptype") public javax.ws.rs.core.Response stateGroupTypeInsert() throws UserException, ApplicationException, IOException
      POST: stategrouptype?data=[jsonDataMap]

      Insert a new state group type with data provided in the json data map.

      Throws:
      UserException
      ApplicationException
      IOException
      See Also:
      • CCAPI.stateGroupTypeSave(StateGroupType, DataMap)
    • stateGroupTypeEdit

      @POST @Path("stategrouptype/{key}") public javax.ws.rs.core.Response stateGroupTypeEdit(@PathParam("key") String key) throws UserException, ApplicationException, IOException
      POST: stategrouptype/{key}?data=[jsonDataMap]

      Save changes to a state group type with data provided in the json data map.

      Throws:
      UserException
      ApplicationException
      IOException
      See Also:
      • CCAPI.stateGroupTypeSave(StateGroupType, DataMap)
    • stateGroupTypeDelete

      @DELETE @Path("stategrouptype/{key}") public void stateGroupTypeDelete(@PathParam("key") String key) throws ApplicationException
      DELETE: stategrouptype/{key}

      Delete the state group type if not in use.

      Throws:
      ApplicationException
      See Also:
      • CCAPI#stateGroupTypeDelete(StateGroupType)
    • stateGroupTypeCopy

      @POST @Path("stategrouptype/{key}/copy") public javax.ws.rs.core.Response stateGroupTypeCopy(@PathParam("key") String key) throws ApplicationException, IOException
      POST: stategrouptype/{key}/copy

      Create a copy of the state group type.

      Throws:
      ApplicationException
      IOException
      See Also:
      • CCAPI.stateGroupTypeCopy(StateGroupType)
    • stateTypeInsert

      @POST @Path("statetype") public javax.ws.rs.core.Response stateTypeInsert() throws UserException, ApplicationException, IOException
      POST: statetype?data=[jsonDataMap]

      Insert a new state type with data provided in the json data map.

      Throws:
      UserException
      ApplicationException
      IOException
      See Also:
      • CCAPI.stateTypeSave(StateType, DataMap)
    • stateTypeEdit

      @POST @Path("statetype/{key}") public javax.ws.rs.core.Response stateTypeEdit(@PathParam("key") String key) throws UserException, ApplicationException, IOException
      POST: statetype/{key}?data=[jsonDataMap]

      Save changes to a state type with data provided in the json data map.

      Throws:
      UserException
      ApplicationException
      IOException
      See Also:
      • CCAPI.stateTypeSave(StateType, DataMap)
    • stateTypeDelete

      @DELETE @Path("statetype/{key}") public void stateTypeDelete(@PathParam("key") String key) throws ApplicationException
      DELETE: statetype/{key}

      Delete the state type if not in use.

      Throws:
      ApplicationException
      See Also:
      • CCAPI.stateTypeDelete(StateType)
    • stateTypeSetStateTransitionType

      @POST @Path("statetype/from/{fromStateTypeKey}/to/{toStateTypeKey}") public javax.ws.rs.core.Response stateTypeSetStateTransitionType(@PathParam("fromStateTypeKey") String fromStateTypeKey, @PathParam("toStateTypeKey") String toStateTypeKey, @QueryParam("handler") String handlerClassName, @QueryParam("right") String rightId) throws ApplicationException, ClassNotFoundException, IOException
      POST: statetype/from/{fromStateTypeKey}/to/{toStateTypeKey}?handler=[handlerClassName]&right=[rightId]}

      Save changes to a state type with data provided in the json data map.

      Throws:
      ApplicationException
      ClassNotFoundException
      IOException
      See Also:
      • CCAPI.stateTypeSetStateTransitionType(StateType, StateType, Class, long)
    • stateTransitionTypeDelete

      @DELETE @Path("statetransitiontype/{key}") public void stateTransitionTypeDelete(@PathParam("key") String key) throws ApplicationException
      DELETE: statetransitiontype/{key}

      Delete the state transition type.

      Throws:
      ApplicationException
      See Also:
      • CCAPI.stateTransitionTypeDelete(StateTransitionType)
    • ceGetWatches

      @GET @Path("{entityName}/{key}/watches") public javax.ws.rs.core.Response ceGetWatches(@PathParam("entityName") String entityName, @PathParam("key") String key) throws ApplicationException, IOException
      GET: {entityName}/{key}/watches

      Get all watches for complex entity.

      Throws:
      ApplicationException
      IOException
    • ceGetMemos

      @GET @Path("{entityName}/{key}/memos") public javax.ws.rs.core.Response ceGetMemos(@PathParam("entityName") String entityName, @PathParam("key") String key, @QueryParam("filter") String filterAsJson, @QueryParam("start") int start, @QueryParam("end") @DefaultValue("-1") int end, @QueryParam("resultId") String resultId) throws ApplicationException, IOException
      GET: {entityName}/{key}/memos

      get all memos for complex entity, optionally filtered by search criteria and with paging.

      Parameters:
      entityName - name of entity for which memos should be retrieved
      key - key of entity
      filterAsJson - search filter as json
      start - start index of result. default is 0 if not set. optional
      end - end index of result. get first page if not set. optional
      resultId - resultId from previous search (only stateless session). must be valid if given. optional

      Example: value (json definition) for query param filter to search for all ratings, ordered by date created descending:
      { "criteria" : [{ "field":"vote", "param":0, "negative":true }], "orderBy" : [{"field":"dateCreated", "descending":true}]}

      Throws:
      ApplicationException
      IOException
      See Also:
    • memoInsert

      @POST @Path("memo") public javax.ws.rs.core.Response memoInsert() throws ApplicationException, IOException
      POST: memo?data=[json]

      Insert a new memo (comment or rating) from the JSON data map.

      Throws:
      ApplicationException
      IOException
      See Also:
      • CCAPI.memoSave(Memo, DataMap)
    • memoEdit

      @POST @Path("memo/{memoKey}") public javax.ws.rs.core.Response memoEdit(@PathParam("memoKey") String memoKey) throws ApplicationException, IOException
      POST: memo/{memoKey}?data=[json]

      Save data to a memo (comment or rating) from the data map.

      Throws:
      ApplicationException
      IOException
      See Also:
      • CCAPI.memoSave(Memo, DataMap)
    • memoDelete

      @DELETE @Path("memo/{memoKey}") public void memoDelete(@PathParam("memoKey") String memoKey) throws ApplicationException
      DELETE: /memo/{memoKey}

      Delete a memo (comment or rating) with the given key.

      Throws:
      ApplicationException
      See Also:
      • CCAPI.memoDelete(Memo)
    • userSave

      public User userSave(User user, String newPw, String newPwRepeat, DataMap dataMap) throws ApplicationException, UserException
      Inserts or updates given User by setting its fields from given paramMap. Required user roles:
      • for insert: UserBaseRole.POWERUSER
      • for update of the data or another user: UserBaseRole.POWERUSER
      Parameters:
      user - User mandatory
      newPw - mandatory for insert
      optional for edit
      if not null it is checked against various rules, encoded and set as password for user
      newPwRepeat - optional, if not null is compared with newPw
      dataMap - mandatory, contains values for the User's fields as key-value pairs
      Returns:
      inserted or updated User. If User has been inserted if contains now the newly created id
      Throws:
      UserException - if session user has not role UserBaseRole.POWERUSER
      if one of the various password checks fails.
      UserException
      ApplicationException
    • userDelete

      public void userDelete(User user) throws DeleteTiedElementException, UserException, ApplicationException
      Checks if User is used by another entity. If not removes this User from references in Permissions, Notifications, HotFolder, ImportProfiles and UserGroups, then removes User from database with usage check.
      required user role: UserBaseRole.POWERUSER

      Parameters:
      user - mandatory
      Throws:
      UserException - if session user has not role UserBaseRole.POWERUSER
      ApplicationException
      DeleteTiedElementException - if User is in use
      See Also:
      • for usage of User
    • userPasswordChange

      public void userPasswordChange(User user, String oldPw, String newPw, String newPwRepeat) throws ApplicationException, UserException
      Changes password for user.
      Performs various checks of password:
      • Password not empty and not too short
      • Checks old password against existing password of user
      • Compares the new and new repeated password, must be the same
      Parameters:
      user - mandatory
      oldPw - mandatory
      newPw - mandatory
      newPwRepeat - mandatory
      Throws:
      UserException - with appropriate message key if any of password check fails
      UserException
      ApplicationException
    • userPasswordChange

      public void userPasswordChange(String uid, String newPw, String newPwRepeat) throws ApplicationException, UserException
      Changes password for user with uid (from userGenerateNewPassword generated link).
      Performs various checks of password:
      • Password not empty and not too short
      • The new and new repeated password must be the same
      Parameters:
      uid - mandatory
      newPw - mandatory
      newPwRepeat - mandatory
      Throws:
      UserException - with appropriate message key if any of password check fails
      UserException
      ApplicationException
    • userUnlockAccount

      public void userUnlockAccount(String uid) throws ApplicationException, UserException
      Check validity of link and unlock the user account
      Parameters:
      uid - mandatory
      Throws:
      UserException - the link be expired
      UserException
      ApplicationException
    • userPasswordValidateLink

      public User userPasswordValidateLink(String uid) throws UserException, ApplicationException
      Checks validity from in userGenerateNewPassword generated link.
      Parameters:
      uid - mandatory, from userGenerateNewPassword generated link
      Returns:
      user if valid or null if invalid
      Throws:
      UserException
      ApplicationException
    • userPasswordGenerateNew

      public String userPasswordGenerateNew(String login, String userIP) throws ApplicationException
      Sends link to set new password to user per email if set in profile, else send email to admin, the password must be changed manually in GUI. Set value for key UserProfileKey.PASSWORD_MUST_CHANGE in user profile to true.
      Parameters:
      login - mandatory
      userIP - request IP
      Returns:
      message to user
      Throws:
      ApplicationException
    • userPasswordMustBeChanged

      public boolean userPasswordMustBeChanged(User user)
      Checks if user must change password (expired or first login)
      check value of key UserProfileKey.PASSWORD_MUST_CHANGE in user profile.
      Parameters:
      user - mandatory
      Returns:
      true if user must change password
    • userGetTerritories

      public List<Territory> userGetTerritories(User user)
      Gets the list of territories, that are referenced by the UserGroups, to which belongs the user,
      or all active territories of system.
      Parameters:
      user - mandatory
      Returns:
      the list of territories
    • userProfileGetValue

      public <T extends Serializable> T userProfileGetValue(User user, UserProfile.UserProfileKey key, Class<T> valueClass)
      Returns user profile value for given user with given key as object from type valueClass.
      Parameters:
      user - mandatory
      key - mandatory
      valueClass - mandatory
      Returns:
      instance of Class
    • userProfileGetValueBoolean

      public boolean userProfileGetValueBoolean(User user, UserProfile.UserProfileKey key)
      Convenience variant of userProfileGetValue(User, UserProfileKey, Class) for boolean flags. avoid NPE on autoboxing if Boolean value is not set
      Parameters:
      user - mandatory
      key - UserProfileKey mandatory
      Returns:
      true or false, always false if key is not set
    • userProfileSetValue

      public void userProfileSetValue(User user, UserProfile.UserProfileKey key, Object value)
      Inserts if not exists or updates user profile value for key and given user.
      Parameters:
      user - mandatory
      key - UserProfileKey mandatory
      value - optional, if null the value from key will be deleted
    • userGroupSave

      public UserGroup userGroupSave(UserGroup userGroup, DataMap dataMap) throws UserException, ApplicationException
      Inserts or updates given UserGroup by setting its fields from given paramMap.
      required user role: only UserBaseRole.POWERUSER

      Parameters:
      userGroup - mandatory
      dataMap - mandatory, contains values for the UserGroup's fields as key-value pairs
      Returns:
      inserted or updated UserGroup. If UserGroup has been inserted if contains now the newly created id
      Throws:
      UserException - if user has not role UserBaseRole.POWERUSER
      ApplicationException
    • userGroupDelete

      public void userGroupDelete(UserGroup userGroup) throws DeleteTiedElementException, UserException, ApplicationException
      Checks if UserGroup is used by another entity. If not, removes this UserGroup from references in Permissions, Notifications, HotFolder, ImportProfiles and UserGroups, then removes User from database.
      user role: UserBaseRole.POWERUSER

      Parameters:
      userGroup - mandatory
      Throws:
      UserException - if session user has not role UserBaseRole.POWERUSER
      DeleteTiedElementException - if UserGroup is in use
      ApplicationException
      See Also:
      • for usage of UserGroup
    • userGroupAddUser

      public void userGroupAddUser(UserGroup userGroup, User user) throws UserException, ApplicationException
      Adds user to this UserGroup if not already in this UserGroup.
      user role: UserBaseRole.POWERUSER

      Parameters:
      userGroup - mandatory
      user - mandatory
      Throws:
      UserException - if session user has not role UserBaseRole.POWERUSER
      ApplicationException
    • userGroupRemoveUser

      public void userGroupRemoveUser(UserGroup userGroup, User user) throws UserException, ApplicationException
      Removes user from this UserGroup.
      user role: UserBaseRole.POWERUSER

      Parameters:
      userGroup - mandatory
      user - mandatory
      Throws:
      UserException - if session user has not role UserBaseRole.POWERUSER
      ApplicationException
    • ceSetPermissions

      public void ceSetPermissions(ComplexEntity entity, Principal principal, Map<Right,List<Locale>> permissions) throws ApplicationException, UserException
      Sets permissions for given user or userGroup on object and all its children. deletes existing permissions for principal
      Parameters:
      entity - mandatory: object for which permissions should be set
      principal - User or UserGroup, mandatory
      permissions - mandatory, map with rights and locales (for locale dependent rights)
      Throws:
      UserException - to signal start of workflow
      ApplicationException
    • ceSetPermissions

      public void ceSetPermissions(ComplexEntity entity, Principal principal, Map<Right,List<Locale>> permissions, boolean recursive) throws ApplicationException, UserException
      Set permissions for given user or userGroup on object and optionally on all its children. deletes existing permissions for principal
      Parameters:
      entity - mandatory: object for which permissions should be set
      principal - User or UserGroup, mandatory
      permissions - mandatory, map with rights and locales (for locale dependent rights)
      recursive - also set the permissions on all children
      Throws:
      UserException - to signal start of workflow
      ApplicationException
    • ceHasPermission

      public boolean ceHasPermission(ComplexEntity entity, Right right, Locale locale)
      Checks if session user has given right on this object.
      If right is locale dependent also checks the locale.
      Includes the user rights from user group membership.
      Parameters:
      entity - mandatory: object for which permissions will be checked
      right - mandatory
      locale - mandatory only by locale dependent rights
      Returns:
      true if the user has the right
      Throws:
      ApplicationException
    • ceHasPermission

      public boolean ceHasPermission(ComplexEntity entity, RightType rightType, Locale locale)
      Checks if given user has a permission with given right type or including rightType for given object.
      If rightType is localeDependent compares locales in permissions.
      WARNING: must only be used for RightTypes that are not user defined! For user defined Rights use #hasPermission(ComplexEntity, User, Right, Locale)
      Parameters:
      entity - mandatory, object, for which permissions will be checked
      rightType - optional, must not be user defined, default is READ
      locale - optional, necessary for locale dependent RightType, default is content locale
      Returns:
      true if permission or including permission exists
    • ceGetAllowedRights

      public List<Right> ceGetAllowedRights(ComplexEntity entity)
      Parameters:
      entity - mandatory
      Returns:
      list of rights that are active and allowed for this entity type. If entity is a Collection returns the combined allowed rights for Collection and it's item entity class. Returns empty list for not right managed entity types.
    • ceIsEditAllowed

      public boolean ceIsEditAllowed(IStateManaged entity, Locale locale)
      Checks if object is in edit state for session user for all state groups that require an edit state.
      If state group is language dependent, checks on given locale.
      Parameters:
      entity - mandatory
      locale - optional, default is content locale
      Returns:
      true if the object can be edited by session user
    • ceDoStateTransition

      public void ceDoStateTransition(IStateManaged entity, StateTransitionType stateTransitionType, Locale locale, String message) throws UserException, ApplicationException
      Executes the transition and changes the state of the object.
      Calls on StateTransitionHandler before and after transition, if a handler is configured
      Parameters:
      entity - mandatory
      stateTransitionType - mandatory
      locale - optional, default is contentLocale or undefined locale for locale independent states
      message - optional
      Throws:
      ApplicationException
      UserException
    • ceGetAllowedStateTransitionTypes

      public List<StateTransitionType> ceGetAllowedStateTransitionTypes(ComplexEntity entity, StateGroupType stateGroupType, Locale locale) throws ApplicationException
      returns all stateTransitionTypes for the current User, the specified stateGroup and the locale
      Parameters:
      entity - mandatory
      stateGroupType - mandatory
      locale - optional, default is contentLocale or undefined locale for locale independent states
      Returns:
      list of allowed stateTransitionTypes
      Throws:
      ApplicationException
    • ceInsertDefaultState

      public void ceInsertDefaultState(IStateManaged entity, StateGroupType stateGroupType, Locale locale) throws ApplicationException
      Sets the default state of given group (@see stateGroupType.getDefaultState()) on given entity recursive (if entity is hierarchical entity also sets this state for all children).
      If stateGroup is language dependent and no locale is specified uses content locale.
      Parameters:
      entity - mandatory
      stateGroupType - mandatory
      locale - optional, default is content locale, or undefinedLocale for locale independent states
      Throws:
      ApplicationException
    • ceInsertLocaleState

      public void ceInsertLocaleState(IStateManaged entity, Locale locale) throws ApplicationException
      Sets insert state for each configured stateGroupType in given locale.
      Also inserts first version for given locale
      Parameters:
      entity - mandatory
      locale - optional, default is content locale
      Throws:
      ApplicationException
    • rightSave

      public Right rightSave(Right right, DataMap dataMap) throws UserException, ApplicationException
      Inserts or updates given Right by setting its fields from paramMap. Only user defined rights can be inserted.
      Warning: Right.Field.rightType in paramMap must be set!
      user role: only UserBaseRole.CONFIGADMIN

      Parameters:
      right - mandatory
      dataMap - mandatory, contains values for the Right's fields as key-value pairs
      Returns:
      inserted or updated Right.
      Throws:
      UserException - if user has not role UserBaseRole.CONFIGADMIN
      ApplicationException
    • rightDelete

      public void rightDelete(Right right) throws UserException, ApplicationException
      Removes given Right from database with usage check.
      Parameters:
      right - mandatory
      Throws:
      UserException - if user has not role UserBaseRole.CONFIGADMIN
      ApplicationException
    • stateGroupTypeSave

      public StateGroupType stateGroupTypeSave(StateGroupType stateGroupType, DataMap dataMap) throws UserException, ApplicationException
      inserts or updates given StateGroupType by setting its fields from given paramMap.
      user role: only UserBaseRole.CONFIGADMIN

      Parameters:
      stateGroupType - mandatory
      dataMap - mandatory, contains values for the StateGroupType's fields as key-value pairs
      Returns:
      inserted or updated StateGroupType. If StateGroupType has been inserted if contains now the newly created id
      Throws:
      UserException - if user has not role UserBaseRole.CONFIGADMIN
      ApplicationException
    • stateGroupTypeCopy

      public StateGroupType stateGroupTypeCopy(StateGroupType source) throws UserException, ApplicationException
      Creates a copy of given StateGroupType. Does not copy StateTypes that belong to this StateGroupType.
      user role: only UserBaseRole.CONFIGADMIN

      Parameters:
      source - mandatory
      Returns:
      StateGroupType that is the copy
      Throws:
      ApplicationException
      UserException - if user has not role UserBaseRole.CONFIGADMIN
    • stateGroupTypeDelete

      public void stateGroupTypeDelete(StateGroupType stateGroupType, boolean force) throws UserException, ApplicationException
      Deletes this StateGroupType from database if not any references by ComplexTypeEntities (case force is false)
      or case force is true - delete with state types, the usage in state transition and states by complex entities be deleted too
      user role: only UserBaseRole.CONFIGADMIN

      Parameters:
      stateGroupType - mandatory
      Throws:
      ApplicationException
      UserException - if user has not role UserBaseRole.CONFIGADMIN or StateGroupType is in use
      See Also:
      • for usage of StateGroupType
    • stateTypeSave

      public StateType stateTypeSave(StateType stateType, DataMap dataMap) throws UserException, ApplicationException
      Inserts or updates given StateType by setting its fields from given paramMap.
      user role: only UserBaseRole.CONFIGADMIN

      Parameters:
      stateType - mandatory
      dataMap - mandatory, contains values for the StateType's fields as key-value pairs
      Returns:
      inserted or updated StateGroupType. If StateType has been inserted if contains now the newly created id
      Throws:
      UserException - if user has not role UserBaseRole.CONFIGADMIN
      ApplicationException
    • stateTypeDelete

      public void stateTypeDelete(StateType stateType) throws UserException, DeleteTiedElementException, ApplicationException
      Deletes this StateType from database if not any references by AssetPipeline.
      required user role: only UserBaseRole.CONFIGADMIN

      Parameters:
      stateType - mandatory
      Throws:
      UserException - if user has not role UserBaseRole.CONFIGADMIN
      ApplicationException
      DeleteTiedElementException - if StateType is in use
      See Also:
      • for usage of StateType
    • stateTypeSetStateTransitionType

      public StateTransitionType stateTypeSetStateTransitionType(StateType fromStateType, StateType toStateType, Class<? extends IStateTransitionHandler> handlerClass, long requiredRightId) throws UserException, ApplicationException
      Inserts or update StateTransitionType between given StateTypes (from/to couple is unique and must belong to the same StateGroupType).

      user role: only UserBaseRole.CONFIGADMIN

      Parameters:
      fromStateType - mandatory
      toStateType - mandatory
      handlerClass - optional, Class<? extends IStateTransitionHandler> called on state transition
      requiredRightId - optional, right to set for transition.
      if requiredRightId is Right.USER_DEFINED_RIGHT, the transition right for this from-to-StateType combination is assigned if already exists or created on demand
      Returns:
      StateTransitionType the inserted or updated StateTransitionType
      Throws:
      UserException - if user has not role UserBaseRole.CONFIGADMIN
      ApplicationException
    • stateTransitionTypeDelete

      public void stateTransitionTypeDelete(StateTransitionType stateTransitionType) throws ApplicationException
      Removes StateTransitionType given from database with validate not use check.
      user role: only UserBaseRole.CONFIGADMIN

      Parameters:
      stateTransitionType - mandatory
      Throws:
      UserException - if user has not role UserBaseRole.CONFIGADMIN
      ApplicationException
    • stateTransitionTypeSetParameters

      public void stateTransitionTypeSetParameters(StateTransitionType stateTransitionType, DataMap paramMap) throws ApplicationException
      set additional parameter as json string
      user role: only UserBaseRole.CONFIGADMIN

      Parameters:
      stateTransitionType - mandatory
      Throws:
      UserException - if user has not role UserBaseRole.CONFIGADMIN
      ApplicationException
    • ceWatchAdd

      public void ceWatchAdd(ComplexEntity object, Principal principal, List<Watch.EventType> eventTypes, Locale locale) throws ApplicationException
      Adds a new watch for object and its children (by collections and hrc entities).
      checks if watch not already exists (same object, user, eventType and locale if any)
      Parameters:
      object - mandatory
      principal - mandatory, id of user or userGroup
      eventTypes - must be not empty
      locale - optional, set only if this watch is locale dependent
      Throws:
      ApplicationException
    • watchDelete

      public void watchDelete(Watch watch) throws ApplicationException
      Removes given Watch from database.
      Parameters:
      watch - mandatory
      Throws:
      ApplicationException
    • ceMemoAdd

      public Memo ceMemoAdd(ComplexEntity entity, String text, Memo parent) throws ApplicationException
      Adds Memo to ComplexEntity with giving text as child of parent memo.
      Parameters:
      entity - mandatory
      text - mandatory
      parent - optional, only if not first level memo
      Returns:
      inserted Memo
      Throws:
      ApplicationException
    • ceMemoAdd

      public Memo ceMemoAdd(ComplexEntity entity, int vote) throws ApplicationException
      Add voting Memo to ComplexEntity and recount the average rating for entity.
      Parameters:
      entity - mandatory, entity on which to set vote
      vote - mandatory, must be greater than 0
      Returns:
      inserted Memo
      Throws:
      ApplicationException
    • ceGetRating

      public double ceGetRating(ComplexEntity entity)
      get rating (voting average) for entity.
      Parameters:
      entity - mandatory, entity for which to get rating
      Returns:
      rating value or 0 if entity has no valid rating.
    • memoSave

      public Memo memoSave(Memo memo, DataMap dataMap) throws ApplicationException
      Inserts or updates given Memo (comment or rating) by setting its fields from given dataMap.
      A comment must have a text, a rating must have a vote != 0. If the comment is a reply or the rating is on a comment the id of the original comment must be given as parent in the map. For a rating checks if there is already a rating for the same entity and user, optionally with the same parent. In this case deletes the existing rating.
      Parameters:
      memo - mandatory
      dataMap - mandatory, contains values for the Memo's fields as key-value pairs
      Returns:
      updated Memo
      Throws:
      ApplicationException
    • memoDelete

      public void memoDelete(Memo memo) throws ApplicationException
      Removes given Memo from database.
      Parameters:
      memo - mandatory
      Throws:
      ApplicationException
    • reportGetItems

      public List<ReportItem> reportGetItems(Report report)
      Loads report items for the report transparently. Since mc7.4 report items are stored in lucene index, older report items are still stored in DB.
      Parameters:
      report - mandatory
      Returns:
      List of ReportItem (not persistent if coming from index)