@Test public void testUnlockObject() throws Exception { final String user = "user"; expect(mockAuthentication.getName()).andReturn(user).anyTimes(); objectLockingManagerMock.releaseObjectLock(1123l, "CASE_FILE", "OBJECT_LOCK", true, user, null); expectLastCall(); session.setAttribute("acm_ip_address", "127.0.0.1"); replayAll(); MvcResult result = mockMvc.perform(delete("/api/v1/plugin/CASE_FILE/1123/lock").session(session).principal(mockAuthentication)) .andExpect(status().isOk()).andReturn(); verifyAll(); }
@PreAuthorize("hasPermission(#objectId, #objectType, 'unlock')") @RequestMapping(value = { "/api/v1/plugin/{objectType}/{objectId}/lock", "/api/latest/plugin/{objectType}/{objectId}/lock" }, method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.OK) public void unlockObject(@PathVariable(value = "objectType") String objectType, @PathVariable(value = "objectId") Long objectId, @RequestParam(value = "lockType", required = false, defaultValue = "OBJECT_LOCK") String lockType, @RequestParam(value = "lockId", required = false) Long lockId, Authentication auth) throws MuleException, IOException, AcmObjectLockException { objectLockingManager.releaseObjectLock(objectId, objectType, lockType, true, auth.getName(), lockId); }
AcmObjectLockAPIController { @PreAuthorize("hasPermission(#objectId, #objectType, 'unlock')") @RequestMapping(value = { "/api/v1/plugin/{objectType}/{objectId}/lock", "/api/latest/plugin/{objectType}/{objectId}/lock" }, method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.OK) public void unlockObject(@PathVariable(value = "objectType") String objectType, @PathVariable(value = "objectId") Long objectId, @RequestParam(value = "lockType", required = false, defaultValue = "OBJECT_LOCK") String lockType, @RequestParam(value = "lockId", required = false) Long lockId, Authentication auth) throws MuleException, IOException, AcmObjectLockException { objectLockingManager.releaseObjectLock(objectId, objectType, lockType, true, auth.getName(), lockId); } }
AcmObjectLockAPIController { @PreAuthorize("hasPermission(#objectId, #objectType, 'unlock')") @RequestMapping(value = { "/api/v1/plugin/{objectType}/{objectId}/lock", "/api/latest/plugin/{objectType}/{objectId}/lock" }, method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.OK) public void unlockObject(@PathVariable(value = "objectType") String objectType, @PathVariable(value = "objectId") Long objectId, @RequestParam(value = "lockType", required = false, defaultValue = "OBJECT_LOCK") String lockType, @RequestParam(value = "lockId", required = false) Long lockId, Authentication auth) throws MuleException, IOException, AcmObjectLockException { objectLockingManager.releaseObjectLock(objectId, objectType, lockType, true, auth.getName(), lockId); }  }
AcmObjectLockAPIController { @PreAuthorize("hasPermission(#objectId, #objectType, 'unlock')") @RequestMapping(value = { "/api/v1/plugin/{objectType}/{objectId}/lock", "/api/latest/plugin/{objectType}/{objectId}/lock" }, method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.OK) public void unlockObject(@PathVariable(value = "objectType") String objectType, @PathVariable(value = "objectId") Long objectId, @RequestParam(value = "lockType", required = false, defaultValue = "OBJECT_LOCK") String lockType, @RequestParam(value = "lockId", required = false) Long lockId, Authentication auth) throws MuleException, IOException, AcmObjectLockException { objectLockingManager.releaseObjectLock(objectId, objectType, lockType, true, auth.getName(), lockId); }  @PreAuthorize("hasPermission(#objectId, #objectType, 'lock')") @RequestMapping(value = { "/api/v1/plugin/{objectType}/{objectId}/lock", "/api/latest/plugin/{objectType}/{objectId}/lock" }, method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody AcmObjectLock lockObject(@PathVariable(value = "objectType") String objectType, @PathVariable(value = "objectId") Long objectId,
            @RequestParam(value = "lockType", required = false, defaultValue = "OBJECT_LOCK") String lockType,
            @RequestParam(value = "lockInDB", required = false, defaultValue = "true") boolean lockInDB, Authentication authentication); @PreAuthorize("hasPermission(#objectId, #objectType, 'unlock')") @RequestMapping(value = { "/api/v1/plugin/{objectType}/{objectId}/lock", "/api/latest/plugin/{objectType}/{objectId}/lock" }, method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.OK) void unlockObject(@PathVariable(value = "objectType") String objectType, @PathVariable(value = "objectId") Long objectId,
            @RequestParam(value = "lockType", required = false, defaultValue = "OBJECT_LOCK") String lockType,
            @RequestParam(value = "lockId", required = false) Long lockId, Authentication auth); @RequestMapping(value = { "/api/v1/plugin/objects/{objectType}/locked", "/api/latest/plugin/objects/{objectType}/locked" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody String listObjectsWithLock(@PathVariable(value = "objectType") String objectType,
            @RequestParam(value = "firstRow", defaultValue = "0", required = false) int firstRow,
            @RequestParam(value = "maxRows", defaultValue = "1000", required = false) int maxRows,
            @RequestParam(value = "sort", defaultValue = "", required = false) String sort, Authentication authentication); @RequestMapping(value = { "/api/v1/plugin/locks/{objectType}", "/api/latest/plugin/locks/{objectType}" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody String listLocks(@RequestParam(value = "parentObjectId", required = false, defaultValue = "") String objectId,
            @RequestParam(value = "creator", required = false, defaultValue = "") String creator,
            @PathVariable(value = "objectType") String objectType,
            @RequestParam(value = "firstRow", defaultValue = "0", required = false) int firstRow,
            @RequestParam(value = "maxRows", defaultValue = "1000", required = false) int maxRows,
            @RequestParam(value = "sort", defaultValue = "", required = false) String sort, Authentication authentication); @PreAuthorize("hasPermission(#objectIds, #objectType, 'unlock')") @RequestMapping(value = { "/api/latest/plugin/locks/{objectType}/lock", "/api/v1/plugin/locks/{objectType}/lock" }, method = RequestMethod.DELETE) @ResponseBody String releaseMultipleLocks(@PathVariable(value = "objectType") String objectType,
            @RequestParam(value = "parentObjectIds") List<Long> objectIds,
            @RequestParam(value = "lockType", required = false, defaultValue = "OBJECT_LOCK") String lockType, Authentication auth); void setObjectLockingManager(AcmObjectLockingManager objectLockingManager); AcmObjectLockService getObjectLockService(); void setObjectLockService(AcmObjectLockService objectLockService); }
AcmObjectLockAPIController { @PreAuthorize("hasPermission(#objectId, #objectType, 'unlock')") @RequestMapping(value = { "/api/v1/plugin/{objectType}/{objectId}/lock", "/api/latest/plugin/{objectType}/{objectId}/lock" }, method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.OK) public void unlockObject(@PathVariable(value = "objectType") String objectType, @PathVariable(value = "objectId") Long objectId, @RequestParam(value = "lockType", required = false, defaultValue = "OBJECT_LOCK") String lockType, @RequestParam(value = "lockId", required = false) Long lockId, Authentication auth) throws MuleException, IOException, AcmObjectLockException { objectLockingManager.releaseObjectLock(objectId, objectType, lockType, true, auth.getName(), lockId); }  @PreAuthorize("hasPermission(#objectId, #objectType, 'lock')") @RequestMapping(value = { "/api/v1/plugin/{objectType}/{objectId}/lock", "/api/latest/plugin/{objectType}/{objectId}/lock" }, method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody AcmObjectLock lockObject(@PathVariable(value = "objectType") String objectType, @PathVariable(value = "objectId") Long objectId,
            @RequestParam(value = "lockType", required = false, defaultValue = "OBJECT_LOCK") String lockType,
            @RequestParam(value = "lockInDB", required = false, defaultValue = "true") boolean lockInDB, Authentication authentication); @PreAuthorize("hasPermission(#objectId, #objectType, 'unlock')") @RequestMapping(value = { "/api/v1/plugin/{objectType}/{objectId}/lock", "/api/latest/plugin/{objectType}/{objectId}/lock" }, method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.OK) void unlockObject(@PathVariable(value = "objectType") String objectType, @PathVariable(value = "objectId") Long objectId,
            @RequestParam(value = "lockType", required = false, defaultValue = "OBJECT_LOCK") String lockType,
            @RequestParam(value = "lockId", required = false) Long lockId, Authentication auth); @RequestMapping(value = { "/api/v1/plugin/objects/{objectType}/locked", "/api/latest/plugin/objects/{objectType}/locked" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody String listObjectsWithLock(@PathVariable(value = "objectType") String objectType,
            @RequestParam(value = "firstRow", defaultValue = "0", required = false) int firstRow,
            @RequestParam(value = "maxRows", defaultValue = "1000", required = false) int maxRows,
            @RequestParam(value = "sort", defaultValue = "", required = false) String sort, Authentication authentication); @RequestMapping(value = { "/api/v1/plugin/locks/{objectType}", "/api/latest/plugin/locks/{objectType}" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody String listLocks(@RequestParam(value = "parentObjectId", required = false, defaultValue = "") String objectId,
            @RequestParam(value = "creator", required = false, defaultValue = "") String creator,
            @PathVariable(value = "objectType") String objectType,
            @RequestParam(value = "firstRow", defaultValue = "0", required = false) int firstRow,
            @RequestParam(value = "maxRows", defaultValue = "1000", required = false) int maxRows,
            @RequestParam(value = "sort", defaultValue = "", required = false) String sort, Authentication authentication); @PreAuthorize("hasPermission(#objectIds, #objectType, 'unlock')") @RequestMapping(value = { "/api/latest/plugin/locks/{objectType}/lock", "/api/v1/plugin/locks/{objectType}/lock" }, method = RequestMethod.DELETE) @ResponseBody String releaseMultipleLocks(@PathVariable(value = "objectType") String objectType,
            @RequestParam(value = "parentObjectIds") List<Long> objectIds,
            @RequestParam(value = "lockType", required = false, defaultValue = "OBJECT_LOCK") String lockType, Authentication auth); void setObjectLockingManager(AcmObjectLockingManager objectLockingManager); AcmObjectLockService getObjectLockService(); void setObjectLockService(AcmObjectLockService objectLockService);  }