Commit 8870ade2 authored by Brian Long's avatar Brian Long
Browse files

paging shared models

parent af802523
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -209,18 +209,17 @@ public class ModelShareWorker implements Bootstrappable {
    }
    
    public void shareAllModels() {
        if (this.tenantId != null)
            this.shareAllModels(this.tenantId);
        this.shareAllModels(null);
    }
    
    public void shareAllModels(Long tenantId) {
        this.shareApsFormModels();
        this.shareApsDataModels();
        this.shareApsDecisionTableModels();
        this.shareApsProcessModels();
        this.shareApsAppModels();
        this.shareAllActivitiModels(tenantId);
        
        if (this.tenantId != null) {
            this.shareAllActivitiModels(this.tenantId);
        } else {
            this.shareAllActivitiModels(null);
        }
    }
    
    private void shareApsFormModels() {
@@ -284,7 +283,7 @@ public class ModelShareWorker implements Bootstrappable {
        this.logger.trace("Discovering activiti models with page size: {}", perPage);
        List<org.activiti.engine.repository.Model> models = query.listPage((page-1)*perPage, perPage);
        if (models.isEmpty()) {
        	this.logger.debug("procDef counts: {}", this.services.getRepositoryService().createProcessDefinitionQuery().latestVersion().count());
        	this.logger.debug("No activiti models; procDef count: {}", this.services.getRepositoryService().createProcessDefinitionQuery().latestVersion().count());
        }
        
        while (!models.isEmpty()) {
@@ -361,9 +360,15 @@ public class ModelShareWorker implements Bootstrappable {
            for (ModelShareInfo share : shares)
                map.put(new HashableGroup(share.getGroup()), share.getPermission());
            
            pageable = pageable.next();
            shares = this.shareInfoRepo.findByModelIdOrderByShareDateAsc(model.getId(), pageable);
        }
        
        if (this.logger.isTraceEnabled()) {
            this.logger.trace("Found existing shares: {}", map);
        } else {
            this.logger.debug("Found existing shares: {}", map.size());
        }
        return map;
    }