using @EnableScheduling
This commit is contained in:
parent
188059e0f3
commit
185047e755
30
README.md
30
README.md
@ -13,20 +13,24 @@ You can install this like any JAR extension. It just needs to be put in the web
|
||||
|
||||
There are several configuration properties available to shape how this extension shares models in your APS installation.
|
||||
|
||||
| Property | Default | Purpose |
|
||||
| -------------------------------------------------------- | ------- | ------- |
|
||||
| `inteligr8.modelShareExtension.groups.canRead` | | What groups should be granted read permission to models of all types. |
|
||||
| `inteligr8.modelShareExtension.groups.canWrite` | | What groups should be granted write permission to models of all types. |
|
||||
| `inteligr8.modelShareExtension.groups.canReadApps` | | What groups should be granted read permission to App models. |
|
||||
| `inteligr8.modelShareExtension.groups.canWriteApps` | | What groups should be granted write permission to App models. |
|
||||
| `inteligr8.modelShareExtension.groups.canReadProcesses` | | What groups should be granted read permission to Process models. |
|
||||
| `inteligr8.modelShareExtension.groups.canWriteProcesses` | | What groups should be granted write permission to Process models. |
|
||||
| `inteligr8.modelShareExtension.groups.canReadForms` | | What groups should be granted read permission to Form models. |
|
||||
| `inteligr8.modelShareExtension.groups.canWriteForms` | | What groups should be granted write permission to Form models. |
|
||||
| `inteligr8.modelShareExtension.shareAllModelsOnStartup` | `false` | Set to `true` to perform a startup scanning of models, sharing them according to the configuration. |
|
||||
| `inteligr8.modelShareExtension.modelChunkSize` | `50` | When querying for all models, how many models should be queried per page. |
|
||||
| `inteligr8.modelShareExtension.shareChunkSize` | `20` | When querying all user/group share permissions on a single model, how many records should be queried per page. |
|
||||
| Property | Default | Purpose |
|
||||
| -------------------------------------------------------- | -------- | ------- |
|
||||
| `inteligr8.modelShareExtension.enabled` | `true` | Enablement; `false` will disable all the behaviors of this extension. |
|
||||
| `inteligr8.modelShareExtension.scanDelayInMillis` | `30000` | The delay before the first scan for all models to share. |
|
||||
| `inteligr8.modelShareExtension.scanIntervalInMillis` | `600000` | The interval between scans for all models to share. |
|
||||
| `inteligr8.modelShareExtension.groups.canRead` | | What groups should be granted read permission to models of all types. |
|
||||
| `inteligr8.modelShareExtension.groups.canWrite` | | What groups should be granted write permission to models of all types. |
|
||||
| `inteligr8.modelShareExtension.groups.canReadApps` | | What groups should be granted read permission to App models. |
|
||||
| `inteligr8.modelShareExtension.groups.canWriteApps` | | What groups should be granted write permission to App models. |
|
||||
| `inteligr8.modelShareExtension.groups.canReadProcesses` | | What groups should be granted read permission to Process models. |
|
||||
| `inteligr8.modelShareExtension.groups.canWriteProcesses` | | What groups should be granted write permission to Process models. |
|
||||
| `inteligr8.modelShareExtension.groups.canReadForms` | | What groups should be granted read permission to Form models. |
|
||||
| `inteligr8.modelShareExtension.groups.canWriteForms` | | What groups should be granted write permission to Form models. |
|
||||
| `inteligr8.modelShareExtension.modelChunkSize` | `50` | When querying for all models, how many models should be queried per page. |
|
||||
| `inteligr8.modelShareExtension.shareChunkSize` | `25` | When querying all user/group share permissions on a single model, how many records should be queried per page. |
|
||||
|
||||
You can specify these at startup as JVM system properties.
|
||||
|
||||
When specifying groups, use commas to separate each entry. You can also prefix each group with "sys:" or "org:" to target a specific system or organizational/functional group. The extension will query by group name and then external ID in each case.
|
||||
|
||||
Any specification of a specific group permission (e.g. `canReadApps`) will override any specification for the same group in the generic `canRead` or `canWrite` property.
|
||||
|
@ -17,6 +17,7 @@ package com.activiti.extension.conf;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* A means for injecting packages to scan for the Spring context.
|
||||
@ -24,6 +25,7 @@ import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGe
|
||||
* @author brian@inteligr8.com
|
||||
*/
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
@ComponentScan(
|
||||
basePackages = "com.inteligr8.alfresco.activiti.share",
|
||||
nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class
|
||||
|
@ -38,14 +38,23 @@ public class ModelShareExtension implements Bootstrappable {
|
||||
public void onBootstrap() {
|
||||
this.logger.trace("onBootstrap()");
|
||||
|
||||
if (this.enabled) {
|
||||
this.bootstrapped = true;
|
||||
this.logger.info("Model Share Extension initialized");
|
||||
}
|
||||
if (this.enabled)
|
||||
return;
|
||||
|
||||
this.logger.info("Model Share Extension enabled");
|
||||
this.bootstrapped = true;
|
||||
this.logger.info("Model Share Extension initialized");
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
// execute every 10 minutes
|
||||
@Scheduled(fixedRate = 600000)
|
||||
@Scheduled(
|
||||
fixedRateString = "${inteligr8.modelShareExtension.scanIntervalInMillis:600000}",
|
||||
initialDelayString = "${inteligr8.modelShareExtension.scanDelayInMillis:30000}"
|
||||
)
|
||||
private void scheduled() {
|
||||
if (!this.enabled || !this.bootstrapped)
|
||||
return;
|
||||
|
@ -104,8 +104,8 @@ public class ModelShareWorker implements Bootstrappable {
|
||||
|
||||
@Override
|
||||
public void onBootstrap() {
|
||||
this.logger.trace("onBootstrap({})");
|
||||
|
||||
this.logger.trace("onBootstrap()");
|
||||
|
||||
this.tenantId = this.tenantService.findTenantId();
|
||||
this.groups = this.toMap(this.findGroups(this.readGroupNames), SharePermission.READ);
|
||||
this.toMap(this.groups, this.findGroups(this.writeGroupNames), SharePermission.WRITE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user