[
http://jira.nuxeo.org/browse/NXP-3085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=49037#action_49037
]
Olivier Grisel commented on NXP-3085:
-------------------------------------
diff --git
a/nuxeo-platform-versioning-core/src/main/java/org/nuxeo/ecm/platform/versioning/service/VersioningService.java
b/nuxeo-platform-versioning-core/src/main/java/org/nuxeo/ecm/platform/versioning/service/VersioningService.java
---
a/nuxeo-platform-versioning-core/src/main/java/org/nuxeo/ecm/platform/versioning/service/VersioningService.java
+++
b/nuxeo-platform-versioning-core/src/main/java/org/nuxeo/ecm/platform/versioning/service/VersioningService.java
@@ -54,7 +54,7 @@
/**
* Versions management component implementation.
- *
+ *
* @author : <a href="[email protected]">Dragos Mihalache</a>
*/
public class VersioningService extends DefaultComponent implements
@@ -189,9 +189,9 @@
// TODO
}
- public VersionIncEditOptions getVersionIncEditOptions(@NotNull
- DocumentModel docModel) throws VersioningException, ClientException,
- DocumentException {
+ public VersionIncEditOptions getVersionIncEditOptions(
+ @NotNull DocumentModel docModel) throws VersioningException,
+ ClientException, DocumentException {
if (null == docModel.getSessionId()) {
throw new IllegalArgumentException(
"document model is not bound to a core session (null
sessionId)");
@@ -241,20 +241,22 @@
versIncOpts.addInfo("wfvaction = " + wfvaction);
if (wfvaction != null) {
- versIncOpts.clearOptions();
if (wfvaction == VersioningActions.ACTION_CASE_DEPENDENT) {
-
versIncOpts.addOption(VersioningActions.ACTION_NO_INCREMENT);
-
versIncOpts.addOption(VersioningActions.ACTION_INCREMENT_MINOR);
+ if (versIncOpts.getOptions() == null
+ || versIncOpts.getOptions().isEmpty()) {
+
versIncOpts.addOption(VersioningActions.ACTION_NO_INCREMENT);
+
versIncOpts.addOption(VersioningActions.ACTION_INCREMENT_MINOR);
+
versIncOpts.addOption(VersioningActions.ACTION_INCREMENT_MAJOR);
+ }
} else {
+ versIncOpts.clearOptions();
// because LE needs options we add the option received
from
- // WF
- // also the rule is that if wf specified an inc option
+ // WF also the rule is that if wf specified an inc option
// that one is to be added
versIncOpts.addOption(wfvaction);
// set default so it will appear selected
versIncOpts.setDefaultVersioningAction(wfvaction);
}
-
versIncOpts.setVersioningAction(wfvaction);
} else {
log.error("wf action is null");
@@ -269,10 +271,10 @@
/**
* Edit: an increment option is asked to a user who edits a document in
* various lifecycle states.
- *
+ *
* @param lifecycleState
* @return
- *
+ *
* @deprecated parameters are insufficient for a full evaluation. Will be
* removed. Use getVersionIncEditOptions(...)
*/
@@ -292,7 +294,7 @@
/**
* Needed to keep API compatibility (will be deprecated)
- *
+ *
* @param lifecycleState
* @param docType - redundant when docModel is not null
* @param docModel
@@ -354,8 +356,9 @@
// will add options (these are to be displayed to user) only if
// action is ask_user
- if (VersioningActions.ACTION_CASE_DEPENDENT == descriptorAction) {
- log.debug(logPrefix + "Action case_dependent, adding options
");
+ if (VersioningActions.ACTION_CASE_DEPENDENT == descriptorAction
+ || VersioningActions.ACTION_QUERY_WORKFLOW ==
descriptorAction) {
+ log.debug(logPrefix + "adding options ");
final RuleOptionDescriptor[] descOptions =
descriptor.getOptions();
for (RuleOptionDescriptor opt : descOptions) {
@@ -385,18 +388,13 @@
log.warn("Invalid action name: " + opt);
}
}
-
-
editOptions.setVersioningAction(VersioningActions.ACTION_CASE_DEPENDENT);
- editOptions.addInfo("Action case dependent");
-
} else {
log.debug(logPrefix + "descriptorAction = " + descriptorAction
+ "; no option for user specified by rule.");
- // TODO maybe set it in one place, see above
- editOptions.setVersioningAction(descriptorAction);
- editOptions.addInfo("descriptorAction = " + descriptorAction);
}
+ editOptions.setVersioningAction(descriptorAction);
+ editOptions.addInfo("descriptorAction = " + descriptorAction);
// apply only the first matching rule
break;
diff --git
a/nuxeo-platform-versioning-core/src/main/resources/OSGI-INF/VersioningRuleContribs.xml
b/nuxeo-platform-versioning-core/src/main/resources/OSGI-INF/VersioningRuleContribs.xml
---
a/nuxeo-platform-versioning-core/src/main/resources/OSGI-INF/VersioningRuleContribs.xml
+++
b/nuxeo-platform-versioning-core/src/main/resources/OSGI-INF/VersioningRuleContribs.xml
@@ -16,15 +16,12 @@
target="org.nuxeo.ecm.platform.versioning.service.VersioningService"
point="rules">
- <!-- this rule seems obsolete (?) -->
- <versioningRuleWF name="sampleWFRule" workflowStateInitial="assigned"
- workflowStateFinal="inprogress" action="inc_minor">
- </versioningRuleWF>
-
- <!-- this rule seems obsolete (?) -->
+ <!-- rule to point to the worklow variable and default to configurable
+ options is it decides to ask_user -->
<versioningRuleEdit name="sampleEditRuleReview" action="query_workflow"
lifecycleState="review">
-
+ <option value="no_inc" default="true" />
+ <option value="inc_minor" />
</versioningRuleEdit>
<versioningRuleEdit name="sampleEditRuleProject" action="ask_user"
> Make it possible to configure the versioning options of the case_dependent WF
> rule
> ----------------------------------------------------------------------------------
>
> Key: NXP-3085
> URL: http://jira.nuxeo.org/browse/NXP-3085
> Project: Nuxeo Enterprise Platform
> Issue Type: New Feature
> Reporter: Olivier Grisel
> Assignee: Sun Tan
> Priority: Major
> Original Estimate: 1 day
> Remaining Estimate: 1 day
>
> Proposed patch to be attached in the comments
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets
