Fork me on GitHub

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/appcenter/modules/fastdeployapplication/business/fastaction/ansible/DumpAction.java 107
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ansible/DumpWithOptionsAction.java 109
        	DumpParameters dumpActionParameters=new DumpParameters(strDataBase,strDiskRequiredFreeSpace!=null?new Integer( strDiskRequiredFreeSpace ):null);
            
            AWXJobResult jobResult= AWXService.getService( ).launchJob( this.getTechnicalCode( ),new AWXParameters( serverApplicationInstance.getHostName( ), dumpActionParameters) );
            
            if(jobResult==null && commandResult != null)
            {
                
           
               DeploymentUtils.addTechnicalError( commandResult, getDefaultErrorMessage( jobResult,  serverApplicationInstance.getHostName( )));
                
            }
            else
            {
               if(jobResult.isRunning( ))
               {
                   
                   jobResult= refreshJobInformations(jobResult.getUrl( ));
                   
               }
               
               if(jobResult.isFailed( ))
               {
                   
                   DeploymentUtils.addTechnicalError( commandResult, getDefaultErrorMessage( jobResult,  serverApplicationInstance.getHostName( )));

               }
               else
               {
                   
               
               strResult= BooleanUtils.toStringTrueFalse(!jobResult.isFailed( ));
                commandResult.getResultInformations( ).put(
                        ConstanteUtils.MARK_DUMP_FILE_URL,
                        			DeploymentUtils.getDownloadUrl(serverApplicationInstance, data, strDataBase, strDumpFileName) );

            }
        }
        }

        return strResult;
    }

    @Override
    public boolean canRunAction( FastDeployApplicationData data, ServerApplicationInstance serverApplicationInstance, CommandResult commandResult,
            ActionParameter... parameter )
    {
        String strDataBase = null;
        String strDoDump = null;
        for ( int i = 0; i < parameter.length; i++ )
        {

            if ( parameter [i].getName( ).equals( ConstanteUtils.PARAM_CODE_DATABASE ) )
            {

                strDataBase = parameter [i].getValue( );
            }

            if ( parameter [i].getName( ).equals( ConstanteUtils.PARAM_DO_DUMP ) )
            {

                strDoDump = parameter [i].getValue( );
            }
        }

        return !StringUtils.isEmpty( strDataBase ) && !StringUtils.equals( strDoDump, "false" );
    
    }
   
    @Override
    public String getTemplateFormAction(  FastDeployApplicationData data, ServerApplicationInstance serverApplicationInstance, Locale locale )
    {

        HashMap model = new HashMap( );

        model.put( ConstanteUtils.MARK_DATABASE_LIST,
                DeploymentUtils.getSimpleReferenceList( DeploymentFactory.getInstance( ).getDatabaseService( FastDeployApplicationData.APPLICATION_TYPE_ANSIBLE ).getDatabases( data.getApplicationCode( ), serverApplicationInstance, locale,true ) ) );
Fichier Ligne
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ansible/DumpAction.java 182
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ansible/DumpWithOptionsAction.java 182
                DeploymentUtils.getSimpleReferenceList( DeploymentFactory.getInstance( ).getDatabaseService( FastDeployApplicationData.APPLICATION_TYPE_ANSIBLE ).getDatabases( data.getApplicationCode( ), serverApplicationInstance, locale,true ) ) );

        model.put( ConstanteUtils.MARK_DISK_REQUIRED_FREESPACE, AppPropertiesService.getProperty( ConstanteUtils.PROPERTY_DEPLOY_SCRIT_WITH_DUMP_DISK_REQUIRED_FREESPACE));
        
        HtmlTemplate template = AppTemplateService.getTemplate( ConstanteUtils.TEMPLATE_FORM_ACTION_DUMP, locale, model );

        return template.getHtml( );
    }
    
    @Override
    public boolean isDisplayFormAction( FastDeployApplicationData data, ServerApplicationInstance serverApplicationInstance )
    {
       
        return true;
    }
    
        @Override
    public <T extends AbstractWorkflowDeployContext> ActionParameter [ ] getActionParameters( T context )
    {

        List<ActionParameter> listActionParameters = new ArrayList<ActionParameter>( );
        ActionParameter actionParameter;
       
        actionParameter = new ActionParameter( );
        actionParameter.setName( ConstanteUtils.PARAM_DO_DUMP );
        actionParameter.setValue( Boolean.toString( ( ( WorkflowDeployScriptContext ) context ).getDoDump( ) ) );
        listActionParameters.add( actionParameter );

        actionParameter = new ActionParameter( );
        actionParameter.setName( ConstanteUtils.PARAM_CODE_DATABASE );
        actionParameter.setValue( ((WorkflowDeployScriptContext)context).getDatabaseName( ) );
        listActionParameters.add( actionParameter );
        
        
        if(context.getDiskRequiredFreespace( )!=null)
        {
            actionParameter = new ActionParameter( );
            actionParameter.setName( ConstanteUtils.PARAM_DISK_REQUIRED_FREE_SPACE );
            actionParameter.setValue(Integer.toString( context.getDiskRequiredFreespace( ) ));
            listActionParameters.add( actionParameter );
        }
        
        return listActionParameters.toArray( new ActionParameter [ listActionParameters.size( )] );
    }
    
}
Fichier Ligne
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ActionHistoryDAO.java 186
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ActionHistoryDAO.java 223
        DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECTALL, plugin );
        daoUtil.executeQuery( );

        while ( daoUtil.next( ) )
        {
            ActionHistory actionHistory = new ActionHistory( );
            int nIndex = 1;

            actionHistory.setId( daoUtil.getInt( nIndex++ ) );
            actionHistory.setIdUserFront( daoUtil.getString( nIndex++ ) );
            actionHistory.setCode( daoUtil.getString( nIndex++ ) );
            actionHistory.setI18nKeyName( daoUtil.getString( nIndex++ ) );
            actionHistory.setServerType( daoUtil.getString( nIndex++ ) );
            actionHistory.setServerCode( daoUtil.getString( nIndex++ ) );
            actionHistory.setServerName( daoUtil.getString( nIndex++ ) );
            actionHistory.setIdApplication( daoUtil.getInt( nIndex++ ) );
            actionHistory.setCodeEnvironment( daoUtil.getString( nIndex++ ) );
            actionHistory.setActionData( daoUtil.getString( nIndex++ ) );
            actionHistory.setCreationDate( daoUtil.getTimestamp( nIndex++ ) );
            actionHistory.setStatus( daoUtil.getBoolean( nIndex++ ) );

            actionHistoryList.add( actionHistory );
        }

        daoUtil.free( );
        return actionHistoryList;
    }
Fichier Ligne
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ActionHistoryDAO.java 119
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ActionHistoryDAO.java 191
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ActionHistoryDAO.java 228
            actionHistory = new ActionHistory( );
            int nIndex = 1;

            actionHistory.setId( daoUtil.getInt( nIndex++ ) );
            actionHistory.setIdUserFront( daoUtil.getString( nIndex++ ) );
            actionHistory.setCode( daoUtil.getString( nIndex++ ) );
            actionHistory.setI18nKeyName( daoUtil.getString( nIndex++ ) );
            actionHistory.setServerType( daoUtil.getString( nIndex++ ) );
            actionHistory.setServerCode( daoUtil.getString( nIndex++ ) );
            actionHistory.setServerName( daoUtil.getString( nIndex++ ) );
            actionHistory.setIdApplication( daoUtil.getInt( nIndex++ ) );
            actionHistory.setCodeEnvironment( daoUtil.getString( nIndex++ ) );
            actionHistory.setActionData( daoUtil.getString( nIndex++ ) );
            actionHistory.setCreationDate( daoUtil.getTimestamp( nIndex++ ) );
            actionHistory.setStatus( daoUtil.getBoolean( nIndex++ ) );
Fichier Ligne
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ActionHistoryDAO.java 90
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ActionHistoryDAO.java 161
        daoUtil.setString( nIndex++, actionHistory.getIdUserFront( ) );
        daoUtil.setString( nIndex++, actionHistory.getCode( ) );
        daoUtil.setString( nIndex++, actionHistory.getI18nKeyName( ) );
        daoUtil.setString( nIndex++, actionHistory.getServerType( ) );
        daoUtil.setString( nIndex++, actionHistory.getServerCode( ) );
        daoUtil.setString( nIndex++, actionHistory.getServerName( ) );
        daoUtil.setInt( nIndex++, actionHistory.getIdApplication( ) );
        daoUtil.setString( nIndex++, actionHistory.getCodeEnvironment( ) );
        daoUtil.setString( nIndex++, actionHistory.getActionData( ) );
        daoUtil.setTimestamp( nIndex++, actionHistory.getCreationDate( ) );
        daoUtil.setBoolean( nIndex++, actionHistory.getStatus( ) );

        daoUtil.executeUpdate( );
Fichier Ligne
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ansible/DumpAction.java 75
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ansible/DumpWithOptionsAction.java 78
    @Override
    public String run( FastDeployApplicationData data, ServerApplicationInstance serverApplicationInstance, CommandResult commandResult, ActionParameter... parameter )
    {

        String strResult = null;

        String strDataBase = null;
        String strDiskRequiredFreeSpace=null;
        if(parameter!=null && parameter.length>0)
        {	
        	for ( int i = 0; i < parameter.length; i++ )
        	{

	            if ( parameter [i].getName( ).equals( ConstanteUtils.PARAM_CODE_DATABASE ) )
	            {
	
	                strDataBase = parameter [i].getValue( );
	            }
	            else if(parameter [i].getName( ).equals( ConstanteUtils.PARAM_DISK_REQUIRED_FREE_SPACE ) )
	            {
	                
	                strDiskRequiredFreeSpace=parameter [i].getValue( );
	            }
        	}
        }
        

        if ( !StringUtils.isEmpty( strDataBase ) )
        {
        	
        	String strDumpFileName=strDataBase+".sql";
Fichier Ligne
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ansible/DumpAction.java 143
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ansible/DumpWithOptionsAction.java 143
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/cloudmgr/DumpAction.java 125
        }
        }

        return strResult;
    }

    @Override
    public boolean canRunAction( FastDeployApplicationData data, ServerApplicationInstance serverApplicationInstance, CommandResult commandResult,
            ActionParameter... parameter )
    {
        String strDataBase = null;
        String strDoDump = null;
        for ( int i = 0; i < parameter.length; i++ )
        {

            if ( parameter [i].getName( ).equals( ConstanteUtils.PARAM_CODE_DATABASE ) )
            {

                strDataBase = parameter [i].getValue( );
            }

            if ( parameter [i].getName( ).equals( ConstanteUtils.PARAM_DO_DUMP ) )
            {

                strDoDump = parameter [i].getValue( );
            }
        }

        return !StringUtils.isEmpty( strDataBase ) && !StringUtils.equals( strDoDump, "false" );
    
    }
   
    @Override
    public String getTemplateFormAction(  FastDeployApplicationData data, ServerApplicationInstance serverApplicationInstance, Locale locale )
Fichier Ligne
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ansible/InitAppContextAction.java 18
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/cloudmgr/InitAppContextAction.java 58
public class InitAppContextAction extends DefaultAction
{

    
    @Override
    public String run(  FastDeployApplicationData data, ServerApplicationInstance serverApplicationInstance, CommandResult commandResult, ActionParameter... parameter )
    {

        String strResult = "true";
        HashMap model = new HashMap( );
        model.put( ConstanteUtils.MARK_APPLICATION,  data);
        IFtpService ftpService=DeploymentFactory.getInstance( ).getFtpService( data.getApplicationType( ) );
        
        HtmlTemplate templateInitAppContext = AppTemplateService.getTemplate( ConstanteUtils.TEMPLATE_INIT_APP_CONTEXT, Locale.FRENCH, model );

        InputStream iTemplateInitAppContext = new ByteArrayInputStream( templateInitAppContext.getHtml( ).getBytes( ) );

        ftpService.uploadFile( data.getWebApp( ) + ".xml", iTemplateInitAppContext, serverApplicationInstance.getFtpInfo( ),
                serverApplicationInstance.getFtpDirectoryContext( ), commandResult, false );

        return strResult;
    }
   
   
   
}
Fichier Ligne
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/service/ansible/ServerApplicationService.java 123
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/service/cloudmgr/ServerApplicationService.java 151
        ftpInfo.setUserPassword( AppPropertiesService.getProperty( ConstanteUtils.PROPERTY_DEPLOYMENT_SERVER_APPLICATION_FTP_USER_PASSWORD_ANSIBLE ) );

        serverApplicationInstance.setFtpInfo( ftpInfo );
    }

    private ServerApplicationInstance newServerApplicationInstance( String strBeanName, Locale locale )
    {
        return (ServerApplicationInstance) SpringContextService.getBean( strBeanName );
    }

    private Integer getStatus( FastDeployApplicationData data, ServerApplicationInstance serverApplicationInstance )
    {
        if ( ( serverApplicationInstance != null ) && ( serverApplicationInstance.getListServerApplicationAction( ) != null ) )
        {
            for ( IAction action : serverApplicationInstance.getListServerApplicationAction( ) )
            {
                if ( action.isUsedForStatus( ) )
                {
                    boolean bResultOk = _actionService.executeAction( data, action, serverApplicationInstance, null );

                    return new Integer( new Boolean( bResultOk ) ? 1 : 0 );
                }
            }
        }

        return 1;
Fichier Ligne
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ansible/ExecuteSqlAction.java 150
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/cloudmgr/ExecuteSqlAction.java 138
                	  }

                }
                    
                
               
 
        
        
        }
        }

        return strResult;
    }
    
    @Override
    public <T extends AbstractWorkflowDeployContext> ActionParameter [ ] getActionParameters( T context )
    {

        List<ActionParameter> listActionParameters = new ArrayList<ActionParameter>( );
        ActionParameter actionParameter;
       
        actionParameter = new ActionParameter( );
        actionParameter.setName( ConstanteUtils.PARAM_CODE_DATABASE );
        actionParameter.setValue( ((WorkflowDeployScriptContext)context).getDatabaseName( ) );
        listActionParameters.add( actionParameter );
        
        actionParameter = new ActionParameter( );
        actionParameter.setName( ConstanteUtils.PARAM_SCRIPT_NAME );
        actionParameter.setValue( ((WorkflowDeployScriptContext)context).getScriptFileItemName( ) );
        listActionParameters.add( actionParameter );
Fichier Ligne
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ansible/DumpAction.java 196
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/ansible/DumpWithOptionsAction.java 195
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/business/fastaction/cloudmgr/DumpAction.java 176
    }
    
        @Override
    public <T extends AbstractWorkflowDeployContext> ActionParameter [ ] getActionParameters( T context )
    {

        List<ActionParameter> listActionParameters = new ArrayList<ActionParameter>( );
        ActionParameter actionParameter;
       
        actionParameter = new ActionParameter( );
        actionParameter.setName( ConstanteUtils.PARAM_DO_DUMP );
        actionParameter.setValue( Boolean.toString( ( ( WorkflowDeployScriptContext ) context ).getDoDump( ) ) );
        listActionParameters.add( actionParameter );

        actionParameter = new ActionParameter( );
        actionParameter.setName( ConstanteUtils.PARAM_CODE_DATABASE );
        actionParameter.setValue( ((WorkflowDeployScriptContext)context).getDatabaseName( ) );
        listActionParameters.add( actionParameter );
Fichier Ligne
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/util/vcs/GitUtils.java 140
fr/paris/lutece/plugins/appcenter/modules/fastdeployapplication/util/vcs/GitUtils.java 196
            repository.getConfig( ).save( );

            checkout( git, strBranch, strTagName, commandResult );
        }
        catch( InvalidRemoteException e )
        {

            DeploymentUtils.addTechnicalError( commandResult, e.getMessage( ), e );

        }
        catch( TransportException e )
        {
            DeploymentUtils.addTechnicalError( commandResult, e.getMessage( ), e );

        }
        catch( IOException e )
        {
            DeploymentUtils.addTechnicalError( commandResult, e.getMessage( ), e );
        }
        catch( GitAPIException e )
        {
            DeploymentUtils.addTechnicalError( commandResult, e.getMessage( ), e );
        }
        finally
        {
            repository.close( );
        }
        return git;