private String checkRetentionLock(Registry registry, String path, String retentionProperty) throws RegistryException { if (!registry.resourceExists(path)) { return null; } Resource existingResource = registry.get(path); if (CurrentSession.getUser() != null && !CurrentSession.getUser().equals( existingResource.getProperty(CommonConstants.RETENTION_USERNAME_PROP_NAME))) { if (Boolean.parseBoolean(existingResource.getProperty(retentionProperty))) { Date fromDate = CommonUtil.computeDate(existingResource.getProperty( CommonConstants.RETENTION_FROM_DATE_PROP_NAME)); Date toDate = CommonUtil.computeDate(existingResource.getProperty( CommonConstants.RETENTION_TO_DATE_PROP_NAME)); Date now = new Date(); if (now.compareTo(fromDate) > 0 && now.compareTo(toDate) < 0) { //Resource is locked, return the owner's username return existingResource.getProperty(CommonConstants.RETENTION_USERNAME_PROP_NAME); } } } return null; } }
query.setAuthorName(authorName); query.setUpdaterName(updaterName); query.setCreatedAfter(CommonUtil.computeDate(createdAfter)); query.setCreatedBefore(CommonUtil.computeDate(createdBefore)); query.setUpdatedAfter(CommonUtil.computeDate(updatedAfter)); query.setUpdatedBefore(CommonUtil.computeDate(updatedBefore)); query.setCommentWords(commentWords); query.setTags(tags);