Résultats CPD
Le document suivant contient les résultats de l'inspection CPD CPD 6.13.0.
Duplicatas
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/modules/state/daemon/ChangeStateDaemon.java |
65 |
fr/paris/lutece/plugins/workflow/modules/state/daemon/ChooseStateDaemon.java |
65 |
private IChangeStateTaskService _changeStateTaskService = SpringContextService.getBean( "workflow.changeStateTaskService" );
private IWorkflowService _workflowService = SpringContextService.getBean( WorkflowService.BEAN_SERVICE );
private IResourceWorkflowService _resourceWorkflowService = SpringContextService.getBean( ResourceWorkflowService.BEAN_SERVICE );
private IActionService _actionService = SpringContextService.getBean( ActionService.BEAN_SERVICE );
private ITaskService _taskService = SpringContextService.getBean( TaskService.BEAN_SERVICE );
@Override
public void run( )
{
WorkflowFilter workflowFilter = new WorkflowFilter( );
workflowFilter.setIsEnabled( 1 );
List<Workflow> listWorkflows = _workflowService.getListWorkflowsByFilter( workflowFilter );
for ( Workflow workflow : listWorkflows )
{
ActionFilter filter = new ActionFilter( );
filter.setAutomaticReflexiveAction( true );
filter.setIdWorkflow( workflow.getId( ) );
List<Action> listAutomaticActions = _actionService.getListActionByFilter( filter );
for ( Action action : listAutomaticActions )
{
ResourceWorkflowFilter filt = new ResourceWorkflowFilter( );
filt.setListIdStateBefore( action.getListIdStateBefore( ) );
filt.setIdWorkflow( workflow.getId( ) );
List<ITask> listActionTasks = _taskService.getListTaskByIdAction( action.getId( ), Locale.getDefault( ) );
ITask task = findTaskToExecute( listActionTasks );
if ( task == null )
{
continue;
} |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/business/action/ActionDAO.java |
104 |
fr/paris/lutece/plugins/workflow/business/action/ActionDAO.java |
135 |
daoUtil.setString( ++nPos, action.getName( ) );
daoUtil.setString( ++nPos, action.getDescription( ) );
daoUtil.setInt( ++nPos, action.getWorkflow( ).getId( ) );
daoUtil.setInt( ++nPos, action.getStateAfter( ).getId( ) );
daoUtil.setInt( ++nPos, action.getIcon( ).getId( ) );
daoUtil.setBoolean( ++nPos, action.isAutomaticState( ) );
daoUtil.setBoolean( ++nPos, action.isMassAction( ) );
daoUtil.setInt( ++nPos, action.getOrder( ) );
daoUtil.setBoolean( ++nPos, action.isAutomaticReflexiveAction( ) );
daoUtil.setInt( ++nPos, (action.getAlternativeStateAfter( )!=null?
action.getAlternativeStateAfter( ).getId( ):-1) );
daoUtil.setString( ++nPos, action.getUid( ) );
daoUtil.executeUpdate( ); |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/modules/archive/service/ArchiveService.java |
214 |
fr/paris/lutece/plugins/workflow/modules/state/service/AbstractStateTaskService.java |
105 |
private void doChangeState( ITask task, int nIdResource, String strResourceType, int nIdWorkflow, int newState )
{
Locale locale = I18nService.getDefaultLocale( );
State state = _stateService.findByPrimaryKey( newState );
Action action = _actionService.findByPrimaryKey( task.getAction( ).getId( ) );
if ( state != null && action != null )
{
// Create Resource History
ResourceHistory resourceHistory = new ResourceHistory( );
resourceHistory.setIdResource( nIdResource );
resourceHistory.setResourceType( strResourceType );
resourceHistory.setAction( action );
resourceHistory.setWorkFlow( action.getWorkflow( ) );
resourceHistory.setCreationDate( WorkflowUtils.getCurrentTimestamp( ) );
resourceHistory.setUserAccessCode( USER_AUTO );
_resourceHistoryService.create( resourceHistory );
// Update Resource
ResourceWorkflow resourceWorkflow = _resourceWorkflowService.findByPrimaryKey( nIdResource, strResourceType, nIdWorkflow );
resourceWorkflow.setState( state );
_resourceWorkflowService.update( resourceWorkflow ); |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/business/resource/ResourceHistoryDAO.java |
191 |
fr/paris/lutece/plugins/workflow/business/resource/ResourceWorkflowDAO.java |
347 |
public void deleteByListIdResource( List<Integer> listIdResource, String strResourceType, Integer nIdWorflow )
{
int nlistIdResourceSize = listIdResource.size( );
if ( nlistIdResourceSize > 0 )
{
StringBuilder sbSQL = new StringBuilder( SQL_QUERY_DELETE_BY_LIST_ID_RESOURCE );
for ( int i = 1; i < nlistIdResourceSize; i++ )
{
sbSQL.append( SQL_ADITIONAL_PARAMETER );
}
sbSQL.append( SQL_CLOSE_PARENTHESIS );
try ( DAOUtil daoUtil = new DAOUtil( sbSQL.toString( ), WorkflowUtils.getPlugin( ) ) )
{
daoUtil.setInt( 1, nIdWorflow );
daoUtil.setString( 2, strResourceType );
for ( int i = 0; i < nlistIdResourceSize; i++ )
{
daoUtil.setInt( i + 3, listIdResource.get( i ) );
}
daoUtil.executeUpdate( );
}
}
}
/**
* {@inheritDoc}
*/
@Override
public List<Integer> getListHistoryIdByListIdResourceId( List<Integer> listIdResource, String strResourceType, Integer nIdWorflow ) |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/modules/archive/business/ArchiveResourceDao.java |
52 |
fr/paris/lutece/plugins/workflow/modules/archive/business/ArchiveResourceDao.java |
103 |
try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT, WorkflowUtils.getPlugin( ) ) )
{
int nPos = 0;
daoUtil.setInt( ++nPos, archiveResource.getIdResource( ) );
daoUtil.setInt( ++nPos, archiveResource.getIdTask( ) );
if ( archiveResource.getInitialDate( ) != null )
{
daoUtil.setTimestamp( ++nPos, archiveResource.getInitialDate( ) );
}
else
{
daoUtil.setNull( ++nPos, Types.TIMESTAMP );
}
if ( archiveResource.getArchivalDate( ) != null )
{
daoUtil.setTimestamp( ++nPos, archiveResource.getArchivalDate( ) );
}
else
{
daoUtil.setNull( ++nPos, Types.TIMESTAMP );
}
daoUtil.setBoolean( ++nPos, archiveResource.isArchived( ) );
daoUtil.executeUpdate( ); |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/business/resource/ResourceWorkflowDAO.java |
104 |
fr/paris/lutece/plugins/workflow/business/resource/ResourceWorkflowDAO.java |
132 |
try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT, WorkflowUtils.getPlugin( ) ) )
{
int nPos = 0;
daoUtil.setInt( ++nPos, resourceWorkflow.getIdResource( ) );
daoUtil.setString( ++nPos, resourceWorkflow.getResourceType( ) );
daoUtil.setInt( ++nPos, resourceWorkflow.getState( ).getId( ) );
daoUtil.setInt( ++nPos, resourceWorkflow.getWorkflow( ).getId( ) );
if ( resourceWorkflow.getExternalParentId( ) != null )
{
daoUtil.setInt( ++nPos, resourceWorkflow.getExternalParentId( ) );
}
else
{
daoUtil.setIntNull( ++nPos );
}
daoUtil.setBoolean( ++nPos, resourceWorkflow.isAssociatedWithWorkgroup( ) );
daoUtil.executeUpdate( ); |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/business/task/TaskDAO.java |
238 |
fr/paris/lutece/plugins/workflow/business/task/TaskDAO.java |
271 |
daoUtil.setInt( 3, nIdAction );
daoUtil.executeQuery( );
while ( daoUtil.next( ) )
{
ITask task = null;
Action action = null;
nPos = 0;
task = _taskFactory.newTask( daoUtil.getString( ++nPos ), locale );
task.setId( daoUtil.getInt( ++nPos ) );
action = new Action( );
action.setId( daoUtil.getInt( ++nPos ) );
task.setAction( action );
task.setOrder( daoUtil.getInt( ++nPos ) );
task.setUid( daoUtil.getString( ++nPos ) );
listTask.add( task );
}
}
return listTask;
}
/**
* {@inheritDoc}
*/
@Override
public List<ITask> findTasksAfterOrder( int nOrder, int nIdAction, Locale locale ) |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/business/state/StateDAO.java |
81 |
fr/paris/lutece/plugins/workflow/business/state/StateDAO.java |
115 |
try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT, Statement.RETURN_GENERATED_KEYS, WorkflowUtils.getPlugin( ) ) )
{
int nPos = 0;
daoUtil.setString( ++nPos, state.getName( ) );
daoUtil.setString( ++nPos, state.getDescription( ) );
daoUtil.setInt( ++nPos, state.getWorkflow( ).getId( ) );
daoUtil.setBoolean( ++nPos, state.isInitialState( ) );
daoUtil.setBoolean( ++nPos, state.isRequiredWorkgroupAssigned( ) );
daoUtil.setInt( ++nPos, state.getOrder( ) );
if ( ( state.getIcon( ) == null ) || ( state.getIcon( ).getId( ) == -1 ) ) |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/modules/assignment/business/AssignmentHistoryDAO.java |
102 |
fr/paris/lutece/plugins/workflow/modules/comment/business/CommentValueDAO.java |
94 |
}
/**
* {@inheritDoc}
*/
@Override
public void deleteByHistory( int nIdHistory, int nIdTask, Plugin plugin )
{
try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_DELETE_BY_HISTORY, plugin ) )
{
int nPos = 0;
daoUtil.setInt( ++nPos, nIdHistory );
daoUtil.setInt( ++nPos, nIdTask );
daoUtil.executeUpdate( );
}
}
/**
* {@inheritDoc}
*/
@Override
public void deleteByTask( int nIdTask, Plugin plugin )
{
try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_DELETE_BY_TASK, plugin ) )
{
int nPos = 0;
daoUtil.setInt( ++nPos, nIdTask );
daoUtil.executeUpdate( );
}
}
} |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/modules/choice/web/ChoiceTaskComponent.java |
86 |
fr/paris/lutece/plugins/workflow/modules/confirmaction/web/ConfirmActionTaskComponent.java |
84 |
HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_CONFIG_CHOICE, locale, model );
return template.getHtml( );
}
@Override
public String getDisplayTaskForm( int nIdResource, String strResourceType, HttpServletRequest request, Locale locale, ITask task )
{
Map<String, Object> model = new HashMap<>( );
model.put( MARK_CONFIG, _config.findByPrimaryKey( task.getId( ) ) );
HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_TASK_FORM, locale, model );
return template.getHtml( );
}
@Override
public String getDisplayTaskInformation( int nIdHistory, HttpServletRequest request, Locale locale, ITask task )
{
return null;
}
} |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/modules/archive/web/ArchiveTaskComponent.java |
190 |
fr/paris/lutece/plugins/workflow/modules/state/service/AbstractStateTaskService.java |
75 |
private ReferenceList getListStates( int nIdAction )
{
ReferenceList referenceListStates = new ReferenceList( );
Action action = _actionService.findByPrimaryKey( nIdAction );
if ( ( action != null ) && ( action.getWorkflow( ) != null ) )
{
StateFilter stateFilter = new StateFilter( );
stateFilter.setIdWorkflow( action.getWorkflow( ).getId( ) );
List<State> listStates = _stateService.getListStateByFilter( stateFilter );
referenceListStates.addItem( -1, StringUtils.EMPTY );
referenceListStates.addAll( ReferenceList.convert( listStates, "id", "name", true ) );
}
return referenceListStates;
} |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/business/resource/ResourceWorkflowDAO.java |
353 |
fr/paris/lutece/plugins/workflow/business/resource/ResourceWorkflowDAO.java |
386 |
StringBuilder sbSQL = new StringBuilder( SQL_QUERY_DELETE_BY_LIST_ID_RESOURCE );
for ( int i = 1; i < nlistIdResourceSize; i++ )
{
sbSQL.append( SQL_ADITIONAL_PARAMETER );
}
sbSQL.append( SQL_CLOSE_PARENTHESIS );
try ( DAOUtil daoUtil = new DAOUtil( sbSQL.toString( ), WorkflowUtils.getPlugin( ) ) )
{
daoUtil.setInt( 1, nIdWorflow );
daoUtil.setString( 2, strResourceType );
for ( int i = 0; i < nlistIdResourceSize; i++ )
{
daoUtil.setInt( i + 3, listIdResource.get( i ) );
}
daoUtil.executeUpdate( );
}
}
}
/**
* {@inheritDoc}
*/
@Override
public void removeByListIdResource( List<Integer> listIdResource, String strResourceType, Integer nIdWorflow ) |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/modules/assignment/business/TaskAssignmentConfigDAO.java |
61 |
fr/paris/lutece/plugins/workflow/modules/assignment/business/TaskAssignmentConfigDAO.java |
83 |
try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT, WorkflowUtils.getPlugin( ) ) )
{
int nPos = 0;
daoUtil.setInt( ++nPos, config.getIdTask( ) );
daoUtil.setString( ++nPos, config.getTitle( ) );
daoUtil.setBoolean( ++nPos, config.isMultipleOwner( ) );
daoUtil.setBoolean( ++nPos, config.isNotify( ) );
daoUtil.setString( ++nPos, config.getMessage( ) );
daoUtil.setString( ++nPos, config.getSubject( ) );
daoUtil.setBoolean( ++nPos, config.isUseUserName( ) );
daoUtil.executeUpdate( ); |
Fichier |
Ligne |
fr/paris/lutece/plugins/workflow/business/resource/ResourceHistoryDAO.java |
197 |
fr/paris/lutece/plugins/workflow/business/resource/ResourceWorkflowDAO.java |
386 |
StringBuilder sbSQL = new StringBuilder( SQL_QUERY_DELETE_BY_LIST_ID_RESOURCE );
for ( int i = 1; i < nlistIdResourceSize; i++ )
{
sbSQL.append( SQL_ADITIONAL_PARAMETER );
}
sbSQL.append( SQL_CLOSE_PARENTHESIS );
try ( DAOUtil daoUtil = new DAOUtil( sbSQL.toString( ), WorkflowUtils.getPlugin( ) ) )
{
daoUtil.setInt( 1, nIdWorflow );
daoUtil.setString( 2, strResourceType );
for ( int i = 0; i < nlistIdResourceSize; i++ )
{
daoUtil.setInt( i + 3, listIdResource.get( i ) );
}
daoUtil.executeUpdate( );
}
}
}
/**
* {@inheritDoc}
*/
@Override
public List<Integer> getListHistoryIdByListIdResourceId( List<Integer> listIdResource, String strResourceType, Integer nIdWorflow ) |