Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign Content to workflow if it is checked in and does not have a workflow step #16809

Closed
wezell opened this issue Jul 2, 2019 · 5 comments
Closed

Comments

@wezell
Copy link
Contributor

wezell commented Jul 2, 2019

It is possible in dotCMS to checkin a piece of content without a workflow step. What we need to do in dotCMS when a content object is being checked in is create a Listener on content checkin that will try to automatically assign content to a workflow if it is unassigned.

We will provide a default implementation of this Listener that calls a default Delegate, e.g. AutoAssignWorkflowDelegate

The AutoAssignWorkflowDelegate implementation will work like this:

  1. If the content is already in a workflow step, e.g. findCurrentStep(contentlet).isPresent(), do nothing.
  2. if the content does not belong to a workflow, get the list of possible workflow schemes it can belong to, e.g. the workflow schemes returned by worflowAPI.findAvailableDefaultActionsByContentType(content.getContentType(), content.getModUser)
  3. If the System Workflow scheme is in that list, add the content to the first step of the default workflow, otherwise, add the content to the first step of the first workflow scheme returned by the list.
  4. If no schemes are available to the mod user, add the content to the first step of the System Workflow.

Additionally, we need to allow customers to

  1. Disable the AutoAssignWorkflowDelegate
    or
  2. write custom implementation that can override the the AutoAssignWorkflowDelegate implementation and use another method to auto-assign workflow steps.
@jgambarios jgambarios added this to the Cody Current milestone Jul 2, 2019
jdotcms added a commit that referenced this issue Jul 8, 2019
jgambarios pushed a commit that referenced this issue Aug 14, 2019
* #16252 format source. Introduce format checker on build. Alter style … (#16288)

* #16252 format source. Introduce format checker on build. Alter style files

* #16252 remove unwanted file

* #16252 remove unwanted file

* Updating commit reference for src/main/enterprise

* try different location for checkstyle.xml

* Revert "#16252 format source. Introduce format checker on build. Alter style … (#16288)" (#16291)

This reverts commit 05f9082.

* Updating commit reference for src/main/enterprise

* #16809 first draft for the auto assign workflow delegate

* #16809 made some progress but not there yet

* #16809 now when uploading by webdav it is set to new step

* #16809 just a todos

* #16820 starting the upgrade task for the system actions to workflow actions mappin and auto assign workflow step listener too

* #16820 second part of the API (not 100% done yet) and starting the endpoints for system action mapping to workflow actions

* #16820 part of the code review feedback done

* #16820 rest endpoints done in order to save and get system action mappings

* #16820 latest changes for the Factory

* #16820 deletes a system action

* #16820 adding the search action by schemes id

* #16820 the fire default action is done on the workflow resource + multipart, missing more testing and unit test and the cases besides NEW+EDIT

* #16820 minor fix for findSystemActionsBySchemes

* #16820 starting the default action work on checkin

* #16820 adding fixes and endpoint to determine if an workflow action is being used as a default action

* #16820 now the action on the first step confirm to be deleted if the they are being referred by some content type

* #16820 now the content type may save system actions

* #16820 now the delete action warns when it is on the first step, the references to it, are being removed and addition the first step can not be deleted nor reordered

* #16820 now when get the content type, also get the system action mappings

* #16820 now the save content type is supporting more than one system action mapping

* #16820 minor feedback codacy applied

* #16820 adding refactoring over the response to be indexed by system action name

* #16820 changing a bit the format

* #16820 fixing an issue on saving system action mapping, now supporting more than one on the save type

* #16820 now the create content type is also supporting the ability to add system action mappings

* #16820 minor refactor to rename the systemActionMap to systemActionMappings on the ContentTypeForm

* #16820 refactor some names in order to keep the semathic, added the cache for system action mapping in addition to the support to remove mappings from the update content type

* #16820 including the workflows and system action mappings to the content type

* #16820 logic added when a content type or scheme are deleted, the mapping and cache are removed. In addition the translate action let has the logic to run a workflow as part of the save taking in consideration heuristics for the selection of the action or not

* #16820 avoid to publish if the save default action has a publish actionlet

* Add actions labels

* #16820 now the import also used a smart default action

* #16820 when trying to associated a mapping to a host, bad request is throw

* #16820 now can map on a scheme, only actions that are part of the scheme, otherwise throw Bad Request

* #16820 adding unit test

* #16820 adding unit test for default actions on checkin

* #16820 adding more testing scenarios

* #16820 more unit test

* #16820 minor change over the unit test

* #16820 fixing translate actionlet test

* #16820 fixing unit test and doing refactoring requested

* #16820 adding recursive dependency as lazy

* #16820 unit test for find first step

* #16820 fixes and unit testing for system mappings

* #16820 adding unit test for mapping by system workflow

* #16820 unit test for system actions

* #16820 feedback done and fixes on the unit test

* #16820 adding and fixing unit test

* #16820 Unit test fixing and improvements

* #16820 part of the code review done

* #16820 adding actionlet convenient methods to the workflow action class
@jgambarios
Copy link
Contributor

PR: #16833

@wezell
Copy link
Contributor Author

wezell commented Aug 19, 2019

If you checkin a contentlet of a type that does not have a workflow - instead of setting to the system, we should leave it unassigned.

jgambarios pushed a commit that referenced this issue Aug 27, 2019
* #16252 format source. Introduce format checker on build. Alter style … (#16288)

* #16252 format source. Introduce format checker on build. Alter style files

* #16252 remove unwanted file

* #16252 remove unwanted file

* Updating commit reference for src/main/enterprise

* try different location for checkstyle.xml

* Revert "#16252 format source. Introduce format checker on build. Alter style … (#16288)" (#16291)

This reverts commit 05f9082.

* Updating commit reference for src/main/enterprise

* #16809 first draft for the auto assign workflow delegate

* #16809 made some progress but not there yet

* #16809 now when uploading by webdav it is set to new step

* #16809 just a todos

* #16820 starting the upgrade task for the system actions to workflow actions mappin and auto assign workflow step listener too

* #16820 second part of the API (not 100% done yet) and starting the endpoints for system action mapping to workflow actions

* #16820 part of the code review feedback done

* #16820 rest endpoints done in order to save and get system action mappings

* #16820 latest changes for the Factory

* #16820 deletes a system action

* #16820 adding the search action by schemes id

* #16820 the fire default action is done on the workflow resource + multipart, missing more testing and unit test and the cases besides NEW+EDIT

* #16820 minor fix for findSystemActionsBySchemes

* #16820 starting the default action work on checkin

* #16820 adding fixes and endpoint to determine if an workflow action is being used as a default action

* #16820 now the action on the first step confirm to be deleted if the they are being referred by some content type

* #16820 now the content type may save system actions

* #16820 now the delete action warns when it is on the first step, the references to it, are being removed and addition the first step can not be deleted nor reordered

* #16820 now when get the content type, also get the system action mappings

* #16820 now the save content type is supporting more than one system action mapping

* #16820 minor feedback codacy applied

* #16820 adding refactoring over the response to be indexed by system action name

* #16820 changing a bit the format

* #16820 fixing an issue on saving system action mapping, now supporting more than one on the save type

* #16820 now the create content type is also supporting the ability to add system action mappings

* #16820 minor refactor to rename the systemActionMap to systemActionMappings on the ContentTypeForm

* #16820 refactor some names in order to keep the semathic, added the cache for system action mapping in addition to the support to remove mappings from the update content type

* #16820 including the workflows and system action mappings to the content type

* #16820 logic added when a content type or scheme are deleted, the mapping and cache are removed. In addition the translate action let has the logic to run a workflow as part of the save taking in consideration heuristics for the selection of the action or not

* #16820 avoid to publish if the save default action has a publish actionlet

* Add actions labels

* #16820 now the import also used a smart default action

* #16820 when trying to associated a mapping to a host, bad request is throw

* #16820 now can map on a scheme, only actions that are part of the scheme, otherwise throw Bad Request

* #16820 adding unit test

* #16820 adding unit test for default actions on checkin

* #16820 adding more testing scenarios

* #16820 more unit test

* #16820 minor change over the unit test

* #16820 fixing translate actionlet test

* #16820 fixing unit test and doing refactoring requested

* #16820 adding recursive dependency as lazy

* #16820 unit test for find first step

* #16820 fixes and unit testing for system mappings

* #16820 adding unit test for mapping by system workflow

* #16820 unit test for system actions

* #16820 feedback done and fixes on the unit test

* #16820 adding and fixing unit test

* #16820 Unit test fixing and improvements

* #16820 first draft for handling the publish default action

* #16820 starting the support for workflows on publish

* #16820 Adding logic to handle the default action for publish

* #16820 unit test for equals role

* #16820 part of the code review done

* #16820 adding actionlet convenient methods to the workflow action class

* #16820 now when there is more than 100 in the IN do a partition

* #16820 using WorkflowAction has method instead of calling the WF API

* #16820 now when there is not any default action, it does the default api call, save for NEW AND EDIT, Publish for PUBLISH

* #16820 allowing anonymous user by configuration REST_API_CONTENT_ALLOW_FRONT_END_SAVING

* #16820 the workflow action id was not hydrated

* #16820 reverted the change on the web resource, allow anonymous user will be handle in another way

* #16820 now when you saved a content type, if the mapping relation to delete does not exists wont throw an error

* #16820 now if the content type does not have a workflow, it will be assign to unassign

* #16820 refactoring the cache for system actions

* #16820 fixing WorkflowResourceIntegrationTest

* #16820 fixing ContentletIndexAPIImplTest.java

* #16820 fixing the com.dotcms.publisher.business.PublisherTest

* #16820 fixes for unit test

* #16820 fixes and fixes for the unit test

* #16820 fixing unit test

* #16820 fixed PageResourceTest
@jgambarios
Copy link
Contributor

@fabrizzio-dotCMS
Copy link
Contributor

  • I created a custom CT based on FileAsset
  • Uploaded a file and created and created a piece of content of the specific CT
  • Then created two custom workflows each one had 2 steps and 2 actions.
  • Then I removed System WF and assigned the new Custom WF to the file asset type.
  • At this point, the new piece of content that I created has assigned 2 workflows but isn't on any steps.
  • I fired the checking by moving the file asset into another folder. The file asset gets auto-assigned as expected.

@bryanboza
Copy link
Member

Fixed tested with the provided steps and now it works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants