Skip to content

Commit

Permalink
Merge branch '2036-async-grant' into 4.2.3 #2036
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Jan 6, 2016
2 parents 36ad26c + 1770995 commit 8a42890
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import edu.harvard.iq.dataverse.authorization.RoleAssignee;
import edu.harvard.iq.dataverse.authorization.users.User;
import edu.harvard.iq.dataverse.authorization.RoleAssignmentSet;
import edu.harvard.iq.dataverse.search.IndexAsync;
import edu.harvard.iq.dataverse.search.IndexResponse;
import edu.harvard.iq.dataverse.search.IndexServiceBean;
import edu.harvard.iq.dataverse.search.SolrIndexServiceBean;
Expand Down Expand Up @@ -36,6 +37,7 @@ public class DataverseRoleServiceBean implements java.io.Serializable {
@EJB RoleAssigneeServiceBean roleAssigneeService;
@EJB IndexServiceBean indexService;
@EJB SolrIndexServiceBean solrIndexService;
@EJB IndexAsync indexAsync;

public DataverseRole save( DataverseRole aRole ) {
if ( aRole.getId() == null ) {
Expand Down Expand Up @@ -67,8 +69,7 @@ public RoleAssignment save( RoleAssignment assignment ) {
/**
* @todo update permissionModificationTime here.
*/
IndexResponse indexDefinitionPountResult = indexDefinitionPoint(assignment.getDefinitionPoint());
logger.fine("output from indexing operations: " + indexDefinitionPountResult);
indexAsync.indexRole(assignment);
return assignment;
}

Expand Down Expand Up @@ -134,8 +135,7 @@ public void revoke( RoleAssignment ra ) {
/**
* @todo update permissionModificationTime here.
*/
IndexResponse indexDefinitionPointResult = indexDefinitionPoint(ra.getDefinitionPoint());
logger.fine("indexing operation results: " + indexDefinitionPointResult);
indexAsync.indexRole(ra);
}

public RoleAssignmentSet roleAssignments( User user, Dataverse dv ) {
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/search/IndexAsync.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package edu.harvard.iq.dataverse.search;

import edu.harvard.iq.dataverse.RoleAssignment;
import java.util.logging.Logger;
import javax.ejb.Asynchronous;
import javax.ejb.EJB;
import javax.ejb.Stateless;

@Stateless
public class IndexAsync {

private static final Logger logger = Logger.getLogger(IndexAsync.class.getCanonicalName());

@EJB
SolrIndexServiceBean solrIndexService;

@Asynchronous
public void indexRole(RoleAssignment roleAssignment) {
IndexResponse indexResponse = solrIndexService.indexPermissionsOnSelfAndChildren(roleAssignment.getDefinitionPoint());
logger.fine("output from indexing operations: " + indexResponse);
}

}

0 comments on commit 8a42890

Please sign in to comment.