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

LUT-28182 : add a confirmation as a notification when a manual workfl… #31

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class ResourceHistory
private Timestamp _tCreationDate;
private String _strUserAccessCode;
private ResourceUserHistory _resourceUserHistory;
private int status;

/**
* return the id of the resource history
Expand Down Expand Up @@ -219,4 +220,25 @@ public void setResourceUserHistory( ResourceUserHistory resourceUserHistory )
{
this._resourceUserHistory = resourceUserHistory;
}

/**
* return the status
*
* @return the status
*/
public int getStatus( )
{
return status;
}

/**
* Sets the status
*
* @param status
* the status to set
*/
public void setStatus( int status )
{
this.status = status;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import fr.paris.lutece.api.user.User;
import fr.paris.lutece.plugins.workflowcore.business.action.Action;
import fr.paris.lutece.plugins.workflowcore.business.resource.ResourceHistory;
import fr.paris.lutece.plugins.workflowcore.business.resource.ResourceWorkflow;
import fr.paris.lutece.plugins.workflowcore.business.state.State;
import fr.paris.lutece.plugins.workflowcore.business.workflow.Workflow;
Expand Down Expand Up @@ -270,11 +271,42 @@ void doProcessAction( int nIdResource, String strResourceType, int nIdAction, In
* @param the
* user the user
*/
@Deprecated
default void doProcessAction( int nIdResource, String strResourceType, int nIdAction, Integer nExternalParentId, HttpServletRequest request, Locale locale,
boolean bIsAutomatic, String strUserAccessCode, User user )
{
doProcessAction( nIdResource, strResourceType, nIdAction, nExternalParentId, request, locale, bIsAutomatic, strUserAccessCode );
}

/**
* Proceed action given in parameter
*
* @param nIdResource
* the resource id
* @param strResourceType
* the resource type
* @param nIdAction
* the action id
* @param nExternalParentId
* the external parent id*
* @param request
* the request
* @param locale
* locale
* @param bIsAutomatic
* true if action is automatic
* @param strUserAccessCode
* the user access code
* @param user
* the user
* @param actionHistoryResourceList
* the history of action performed on a resource
*/
default void doProcessAction( int nIdResource, String strResourceType, int nIdAction, Integer nExternalParentId, HttpServletRequest request, Locale locale,
boolean bIsAutomatic, String strUserAccessCode, User user, List<ResourceHistory> actionHistoryResourceList )
{
doProcessAction( nIdResource, strResourceType, nIdAction, nExternalParentId, request, locale, bIsAutomatic, strUserAccessCode );
}

/**
* Proceed automatic reflexive actions of state given in parameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;

import fr.paris.lutece.api.user.User;
import fr.paris.lutece.plugins.workflowcore.business.action.Action;
Expand Down Expand Up @@ -455,7 +456,7 @@ public boolean isDisplayTasksForm( int nIdAction, Locale locale )
*/
@Override
public void doProcessAction( int nIdResource, String strResourceType, int nIdAction, Integer nIdExternalParent, HttpServletRequest request, Locale locale,
boolean bIsAutomatic, String strUserAccessCode, User user )
boolean bIsAutomatic, String strUserAccessCode, User user, List<ResourceHistory> actionHistoryResourceList )
{
Action action = _actionService.findByPrimaryKey( nIdAction );

Expand Down Expand Up @@ -530,6 +531,15 @@ public void doProcessAction( int nIdResource, String strResourceType, int nIdAct
resourceWorkflow.setExternalParentId( nIdExternalParent );
_resourceWorkflowService.update( resourceWorkflow );

if ( actionHistoryResourceList != null )
{
if ( !isSuccess )
{
resourceHistory.setStatus( NumberUtils.INTEGER_MINUS_ONE );
}
actionHistoryResourceList.add( resourceHistory );
}

if ( ( resourceWorkflow.getState( ) != null ) && !action.isAutomaticReflexiveAction( ) )
{
final State nextState = resourceWorkflow.getState( );
Expand All @@ -549,12 +559,22 @@ public void doProcessAction( int nIdResource, String strResourceType, int nIdAct

if ( CollectionUtils.isNotEmpty( listAction ) && ( listAction.get( 0 ) != null ) )
{
doProcessAction( nIdResource, strResourceType, listAction.get( 0 ).getId( ), nIdExternalParent, request, locale, true, null, user );
doProcessAction( nIdResource, strResourceType, listAction.get( 0 ).getId( ), nIdExternalParent, request, locale, true, null, user, actionHistoryResourceList );
}
}

}

/**
* {@inheritDoc}
*/
@Override
public void doProcessAction( int nIdResource, String strResourceType, int nIdAction, Integer nIdExternalParent, HttpServletRequest request, Locale locale,
boolean bIsAutomatic, String strUserAccessCode, User user )
{
doProcessAction( nIdResource, strResourceType, nIdAction, nIdExternalParent, request, locale, bIsAutomatic, strUserAccessCode, null, null );
}

/**
* {@inheritDoc}
*/
Expand Down