using @EnableScheduling
This commit is contained in:
parent
188059e0f3
commit
185047e755
10
README.md
10
README.md
@ -14,7 +14,10 @@ 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.
|
There are several configuration properties available to shape how this extension shares models in your APS installation.
|
||||||
|
|
||||||
| Property | Default | Purpose |
|
| 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.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.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.canReadApps` | | What groups should be granted read permission to App models. |
|
||||||
@ -23,10 +26,11 @@ There are several configuration properties available to shape how this extension
|
|||||||
| `inteligr8.modelShareExtension.groups.canWriteProcesses` | | What groups should be granted write 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.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.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.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. |
|
| `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.
|
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.
|
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.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator;
|
import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A means for injecting packages to scan for the Spring context.
|
* 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
|
* @author brian@inteligr8.com
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@EnableScheduling
|
||||||
@ComponentScan(
|
@ComponentScan(
|
||||||
basePackages = "com.inteligr8.alfresco.activiti.share",
|
basePackages = "com.inteligr8.alfresco.activiti.share",
|
||||||
nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class
|
nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class
|
||||||
|
@ -38,14 +38,23 @@ public class ModelShareExtension implements Bootstrappable {
|
|||||||
public void onBootstrap() {
|
public void onBootstrap() {
|
||||||
this.logger.trace("onBootstrap()");
|
this.logger.trace("onBootstrap()");
|
||||||
|
|
||||||
if (this.enabled) {
|
if (this.enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.logger.info("Model Share Extension enabled");
|
||||||
this.bootstrapped = true;
|
this.bootstrapped = true;
|
||||||
this.logger.info("Model Share Extension initialized");
|
this.logger.info("Model Share Extension initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return this.enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute every 10 minutes
|
// execute every 10 minutes
|
||||||
@Scheduled(fixedRate = 600000)
|
@Scheduled(
|
||||||
|
fixedRateString = "${inteligr8.modelShareExtension.scanIntervalInMillis:600000}",
|
||||||
|
initialDelayString = "${inteligr8.modelShareExtension.scanDelayInMillis:30000}"
|
||||||
|
)
|
||||||
private void scheduled() {
|
private void scheduled() {
|
||||||
if (!this.enabled || !this.bootstrapped)
|
if (!this.enabled || !this.bootstrapped)
|
||||||
return;
|
return;
|
||||||
|
@ -104,7 +104,7 @@ public class ModelShareWorker implements Bootstrappable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBootstrap() {
|
public void onBootstrap() {
|
||||||
this.logger.trace("onBootstrap({})");
|
this.logger.trace("onBootstrap()");
|
||||||
|
|
||||||
this.tenantId = this.tenantService.findTenantId();
|
this.tenantId = this.tenantService.findTenantId();
|
||||||
this.groups = this.toMap(this.findGroups(this.readGroupNames), SharePermission.READ);
|
this.groups = this.toMap(this.findGroups(this.readGroupNames), SharePermission.READ);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user