paging shared models

This commit is contained in:
2024-09-04 11:11:47 -04:00
parent af8025237b
commit 8870ade2d7

View File

@@ -209,18 +209,17 @@ public class ModelShareWorker implements Bootstrappable {
} }
public void shareAllModels() { public void shareAllModels() {
if (this.tenantId != null)
this.shareAllModels(this.tenantId);
this.shareAllModels(null);
}
public void shareAllModels(Long tenantId) {
this.shareApsFormModels(); this.shareApsFormModels();
this.shareApsDataModels(); this.shareApsDataModels();
this.shareApsDecisionTableModels(); this.shareApsDecisionTableModels();
this.shareApsProcessModels(); this.shareApsProcessModels();
this.shareApsAppModels(); this.shareApsAppModels();
this.shareAllActivitiModels(tenantId);
if (this.tenantId != null) {
this.shareAllActivitiModels(this.tenantId);
} else {
this.shareAllActivitiModels(null);
}
} }
private void shareApsFormModels() { private void shareApsFormModels() {
@@ -284,7 +283,7 @@ public class ModelShareWorker implements Bootstrappable {
this.logger.trace("Discovering activiti models with page size: {}", perPage); this.logger.trace("Discovering activiti models with page size: {}", perPage);
List<org.activiti.engine.repository.Model> models = query.listPage((page-1)*perPage, perPage); List<org.activiti.engine.repository.Model> models = query.listPage((page-1)*perPage, perPage);
if (models.isEmpty()) { 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()) { while (!models.isEmpty()) {
@@ -361,9 +360,15 @@ public class ModelShareWorker implements Bootstrappable {
for (ModelShareInfo share : shares) for (ModelShareInfo share : shares)
map.put(new HashableGroup(share.getGroup()), share.getPermission()); map.put(new HashableGroup(share.getGroup()), share.getPermission());
pageable = pageable.next();
shares = this.shareInfoRepo.findByModelIdOrderByShareDateAsc(model.getId(), pageable); 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; return map;
} }