@Test public void testGetDocumentsWithoutLockWithFilter() throws Exception { Resource resourceFile = new ClassPathResource("/solrResponseCaseFile.json"); String jsonContent = new String(Files.readAllBytes(resourceFile.getFile().toPath())); String filter = "fq=status_s:OPEN"; expect(executeSolrQueryMock.getResultsByPredefinedQuery(authMock, SolrCore.ADVANCED_SEARCH, "{!join from=parent_ref_s to=id}object_type_s:OBJECT_LOCK AND parent_type_s:CASE_FILE AND creator_lcs:auditUser", 0, 1, "", "fq=status_s:OPEN")).andReturn(jsonContent); replay(mocks); String result = acmObjectLockService.getDocumentsWithLock("CASE_FILE", authMock, authMock.getName(), 0, 1, "", filter); verify(mocks); SearchResults results = new SearchResults(); assertEquals(248, results.getNumFound(result)); assertEquals(1, results.getDocuments(result).length()); }
@Override public String getDocumentsWithLock(String objectType, Authentication auth, String lockHeldByUser, int firstRow, int maxRows, String sort, String fqParams) throws MuleException { StringBuilder query = new StringBuilder(); query.append("{!join from=parent_ref_s to=id}object_type_s:OBJECT_LOCK "); if (!StringUtils.isEmpty(objectType)) { query.append(" AND "); query.append("parent_type_s").append(":").append(objectType); } if (lockHeldByUser != null && !StringUtils.isEmpty(lockHeldByUser)) { query.append(" AND "); query.append("creator_lcs").append(":").append(lockHeldByUser); } log.debug("executing query for documents with lock: {}", query.toString()); return executeQuery(query.toString(), auth, firstRow, maxRows, sort, fqParams); }
AcmObjectLockServiceImpl implements AcmObjectLockService, ApplicationEventPublisherAware { @Override public String getDocumentsWithLock(String objectType, Authentication auth, String lockHeldByUser, int firstRow, int maxRows, String sort, String fqParams) throws MuleException { StringBuilder query = new StringBuilder(); query.append("{!join from=parent_ref_s to=id}object_type_s:OBJECT_LOCK "); if (!StringUtils.isEmpty(objectType)) { query.append(" AND "); query.append("parent_type_s").append(":").append(objectType); } if (lockHeldByUser != null && !StringUtils.isEmpty(lockHeldByUser)) { query.append(" AND "); query.append("creator_lcs").append(":").append(lockHeldByUser); } log.debug("executing query for documents with lock: {}", query.toString()); return executeQuery(query.toString(), auth, firstRow, maxRows, sort, fqParams); } }
AcmObjectLockServiceImpl implements AcmObjectLockService, ApplicationEventPublisherAware { @Override public String getDocumentsWithLock(String objectType, Authentication auth, String lockHeldByUser, int firstRow, int maxRows, String sort, String fqParams) throws MuleException { StringBuilder query = new StringBuilder(); query.append("{!join from=parent_ref_s to=id}object_type_s:OBJECT_LOCK "); if (!StringUtils.isEmpty(objectType)) { query.append(" AND "); query.append("parent_type_s").append(":").append(objectType); } if (lockHeldByUser != null && !StringUtils.isEmpty(lockHeldByUser)) { query.append(" AND "); query.append("creator_lcs").append(":").append(lockHeldByUser); } log.debug("executing query for documents with lock: {}", query.toString()); return executeQuery(query.toString(), auth, firstRow, maxRows, sort, fqParams); }  }
AcmObjectLockServiceImpl implements AcmObjectLockService, ApplicationEventPublisherAware { @Override public String getDocumentsWithLock(String objectType, Authentication auth, String lockHeldByUser, int firstRow, int maxRows, String sort, String fqParams) throws MuleException { StringBuilder query = new StringBuilder(); query.append("{!join from=parent_ref_s to=id}object_type_s:OBJECT_LOCK "); if (!StringUtils.isEmpty(objectType)) { query.append(" AND "); query.append("parent_type_s").append(":").append(objectType); } if (lockHeldByUser != null && !StringUtils.isEmpty(lockHeldByUser)) { query.append(" AND "); query.append("creator_lcs").append(":").append(lockHeldByUser); } log.debug("executing query for documents with lock: {}", query.toString()); return executeQuery(query.toString(), auth, firstRow, maxRows, sort, fqParams); }  @Override AcmObjectLock findLock(Long objectId, String objectType); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) AcmObjectLock createLock(Long objectId, String objectType, String lockType, Long expiry, Authentication auth); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) AcmObjectLock createLock(Long objectId, String objectType, String lockType, Long expiry, Boolean lockInDB, String userId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) AcmObjectLock createLock(Long objectId, String objectType, String lockType, Long expiry, String userId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) AcmObjectLock createLock(Long objectId, String objectType, String lockType, Long expiry, Boolean lockInDB, Authentication auth); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) void removeLock(Long objectId, String objectType, String lockType, String userId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) void removeLock(Long objectId, String objectType, String lockType, Authentication auth); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) void removeExpiredLocks(); @Transactional(propagation = Propagation.REQUIRES_NEW) @Override void removeLock(AcmObjectLock objectLock); @Override String getDocumentsWithoutLock(String objectType, Authentication auth, int firstRow, int maxRows, String sort, String fqParams); @Override String getDocumentsWithLock(String objectType, Authentication auth, String lockHeldByUser, int firstRow, int maxRows,
            String sort, String fqParams); @Override String getObjectLocks(String parentObjectType, Authentication auth, String objectId, String creator, int firstRow, int maxRows,
            String sort, String fqParams); void setAcmObjectLockDao(AcmObjectLockDao acmObjectLockDao); ExecuteSolrQuery getExecuteSolrQuery(); void setExecuteSolrQuery(ExecuteSolrQuery executeSolrQuery); ApplicationEventPublisher getApplicationEventPublisher(); @Override void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher); }
AcmObjectLockServiceImpl implements AcmObjectLockService, ApplicationEventPublisherAware { @Override public String getDocumentsWithLock(String objectType, Authentication auth, String lockHeldByUser, int firstRow, int maxRows, String sort, String fqParams) throws MuleException { StringBuilder query = new StringBuilder(); query.append("{!join from=parent_ref_s to=id}object_type_s:OBJECT_LOCK "); if (!StringUtils.isEmpty(objectType)) { query.append(" AND "); query.append("parent_type_s").append(":").append(objectType); } if (lockHeldByUser != null && !StringUtils.isEmpty(lockHeldByUser)) { query.append(" AND "); query.append("creator_lcs").append(":").append(lockHeldByUser); } log.debug("executing query for documents with lock: {}", query.toString()); return executeQuery(query.toString(), auth, firstRow, maxRows, sort, fqParams); }  @Override AcmObjectLock findLock(Long objectId, String objectType); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) AcmObjectLock createLock(Long objectId, String objectType, String lockType, Long expiry, Authentication auth); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) AcmObjectLock createLock(Long objectId, String objectType, String lockType, Long expiry, Boolean lockInDB, String userId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) AcmObjectLock createLock(Long objectId, String objectType, String lockType, Long expiry, String userId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) AcmObjectLock createLock(Long objectId, String objectType, String lockType, Long expiry, Boolean lockInDB, Authentication auth); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) void removeLock(Long objectId, String objectType, String lockType, String userId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) void removeLock(Long objectId, String objectType, String lockType, Authentication auth); @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) void removeExpiredLocks(); @Transactional(propagation = Propagation.REQUIRES_NEW) @Override void removeLock(AcmObjectLock objectLock); @Override String getDocumentsWithoutLock(String objectType, Authentication auth, int firstRow, int maxRows, String sort, String fqParams); @Override String getDocumentsWithLock(String objectType, Authentication auth, String lockHeldByUser, int firstRow, int maxRows,
            String sort, String fqParams); @Override String getObjectLocks(String parentObjectType, Authentication auth, String objectId, String creator, int firstRow, int maxRows,
            String sort, String fqParams); void setAcmObjectLockDao(AcmObjectLockDao acmObjectLockDao); ExecuteSolrQuery getExecuteSolrQuery(); void setExecuteSolrQuery(ExecuteSolrQuery executeSolrQuery); ApplicationEventPublisher getApplicationEventPublisher(); @Override void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher);  }