Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Sonatype Nexus (TM) Open Source Version Copyright (c) 2007-2012 Sonatype, Inc. All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions. This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0, which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html. Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the Eclipse Foundation. All other trademarks are the property of their respective owners.
 
 package org.sonatype.nexus.rest.global;
 
 
The base class for global configuration resources.

Author(s):
cstamas
 
 {
     public static final String SECURITY_OFF = "off";
 
     public static final String SECURITY_SIMPLE = "simple";
 
     public static final String SECURITY_CUSTOM = "custom";
 
     @Requirement
     private NexusEmailer nexusEmailer;
 
     @Requirement
 
     @Requirement
 
     @Requirement
 
     @Requirement
 
     @Requirement
 
     protected NexusEmailer getNexusEmailer()
     {
         return ;
     }
 
     {
         return ;
     }
 
     {
         return ;
     }
 
     {
         return ;
     }
 
     {
        return ;
    }
    {
        return ;
    }
    public static SmtpSettings convertNexusEmailer nexusEmailer )
    {
        if ( nexusEmailer == null )
        {
            return null;
        }
        SmtpSettings result = new SmtpSettings();
        result.setHostnexusEmailer.getSMTPHostname() );
        result.setPortnexusEmailer.getSMTPPort() );
        result.setSslEnablednexusEmailer.isSMTPSslEnabled() );
        result.setTlsEnablednexusEmailer.isSMTPTlsEnabled() );
        result.setUsernamenexusEmailer.getSMTPUsername() );
        if ( !StringUtils.isEmptynexusEmailer.getSMTPPassword() ) )
        {
            result.setPassword );
        }
        result.setSystemEmailAddressnexusEmailer.getSMTPSystemEmailAddress().getMailAddress() );
        return result;
    }
    public static ErrorReportingSettings convertErrorReportingManager errorReportingManager )
    {
        ErrorReportingSettings result = new ErrorReportingSettings();
        result.setJiraUsernameerrorReportingManager.getJIRAUsername() );
        if ( StringUtils.isEmptyerrorReportingManager.getJIRAPassword() ) )
        {
            result.setJiraPassworderrorReportingManager.getJIRAPassword() );
        }
        else
        {
            result.setJiraPassword );
        }
        result.setUseGlobalProxytrue );
        result.setReportErrorsAutomaticallyerrorReportingManager.isEnabled() );
        return result;
    }
    
    public static SystemNotificationSettings convertNotificationManager manager )
    {
        if ( manager == null )
        {
            return null;
        }
        
        SystemNotificationSettings settings = new SystemNotificationSettings();
        settings.setEnabledmanager.isEnabled() );
        
        
        if ( target == null )
        {
            return settings;
        }
        
        settings.getRoles().addAlltarget.getTargetRoles() );
        
        StringBuffer sb = new StringBuffer();
        
        for ( String email : target.getExternalTargets() )
        {
            sb.appendemail ).append"," );
        }
        
        // drop last comma
        if ( sb.length() > 0 )
        {
            sb.setLengthsb.length() - 1 );
        }
        
        settings.setEmailAddressessb.toString() );
        
        return settings;
    }

    
Externalized Nexus object to DTO's conversion.

Parameters:
resource
    {
        if ( settings == null )
        {
            return null;
        }
        RemoteConnectionSettings result = new RemoteConnectionSettings();
        result.setConnectionTimeoutsettings.getConnectionTimeout() / 1000 );
        result.setRetrievalRetryCountsettings.getRetrievalRetryCount() );
        result.setQueryStringsettings.getQueryString() );
        result.setUserAgentStringsettings.getUserAgentCustomizationString() );
        return result;
    }

    
Externalized Nexus object to DTO's conversion.

Parameters:
resource
    public static RemoteHttpProxySettings convertGlobalHttpProxySettings settings )
    {
        if ( settings == null || !settings.isEnabled() )
        {
            return null;
        }
        RemoteHttpProxySettings result = new RemoteHttpProxySettings();
        result.setProxyHostnamesettings.getHostname() );
        result.setProxyPortsettings.getPort() );
        result.setAuthenticationconvertsettings.getProxyAuthentication() ) );
        result.setNonProxyHostsnew ArrayList<String>( settings.getNonProxyHosts() ) );
        return result;
    }
    public static RestApiSettings convertGlobalRestApiSettings settings )
    {
        if ( settings == null || !settings.isEnabled() )
        {
            return null;
        }
        RestApiSettings result = new RestApiSettings();
        result.setBaseUrlsettings.getBaseUrl() );
        result.setForceBaseUrlsettings.isForceBaseUrl() );
        result.setUiTimeoutsettings.getUITimeout() / 1000 );
        return result;
    }

    
Externalized Nexus object to DTO's conversion.

Parameters:
resource
    public static AuthenticationSettings convertRemoteAuthenticationSettings settings )
    {
        if ( settings == null )
        {
            return null;
        }
        AuthenticationSettings auth = new AuthenticationSettings();
        if ( settings instanceof ClientSSLRemoteAuthenticationSettings )
        {
            // huh?
        }
        else if ( settings instanceof NtlmRemoteAuthenticationSettings )
        {
            NtlmRemoteAuthenticationSettings up = (NtlmRemoteAuthenticationSettingssettings;
            auth.setUsernameup.getUsername() );
            auth.setPassword );
            auth.setNtlmHostup.getNtlmHost() );
            auth.setNtlmDomainup.getNtlmDomain() );
        }
        else if ( settings instanceof UsernamePasswordRemoteAuthenticationSettings )
        {
            auth.setUsernameup.getUsername() );
            auth.setPassword );
        }
        return auth;
    }
    // ==

    
Externalized Nexus object to DTO's conversion.

Parameters:
resource
    public static RemoteConnectionSettings convertCRemoteConnectionSettings settings )
    {
        if ( settings == null )
        {
            return null;
        }
        RemoteConnectionSettings result = new RemoteConnectionSettings();
        result.setConnectionTimeoutsettings.getConnectionTimeout() / 1000 );
        result.setRetrievalRetryCountsettings.getRetrievalRetryCount() );
        result.setQueryStringsettings.getQueryString() );
        result.setUserAgentStringsettings.getUserAgentCustomizationString() );
        return result;
    }

    
Externalized Nexus object to DTO's conversion.

Parameters:
resource
    public static RemoteHttpProxySettings convertCRemoteHttpProxySettings settings )
    {
        if ( settings == null )
        {
            return null;
        }
        RemoteHttpProxySettings result = new RemoteHttpProxySettings();
        result.setProxyHostnamesettings.getProxyHostname() );
        result.setProxyPortsettings.getProxyPort() );
        result.setAuthenticationconvertsettings.getAuthentication() ) );
        result.setNonProxyHostssettings.getNonProxyHosts() );
        return result;
    }
    public static RestApiSettings convertCRestApiSettings settings )
    {
        if ( settings == null )
        {
            return null;
        }
        RestApiSettings result = new RestApiSettings();
        result.setBaseUrlsettings.getBaseUrl() );
        result.setForceBaseUrlsettings.isForceBaseUrl() );
        result.setUiTimeoutsettings.getUiTimeout() / 1000 );
        return result;
    }

    
Externalized Nexus object to DTO's conversion.

Parameters:
resource
    public static AuthenticationSettings convertCRemoteAuthentication settings )
    {
        if ( settings == null )
        {
            return null;
        }
        AuthenticationSettings auth = new AuthenticationSettings();
        auth.setUsernamesettings.getUsername() );
        auth.setPassword );
        auth.setNtlmHostsettings.getNtlmHost() );
        auth.setNtlmDomainsettings.getNtlmDomain() );
        // auth.setPrivateKey( settings.getPrivateKey() );
        // auth.setPassphrase( settings.getPassphrase() );
        return auth;
    }
    public static SmtpSettings convertCSmtpConfiguration settings )
    {
        if ( settings == null )
        {
            return null;
        }
        SmtpSettings result = new SmtpSettings();
        result.setHostsettings.getHostname() );
        result.setPassword );
        result.setPortsettings.getPort() );
        result.setSslEnabledsettings.isSslEnabled() );
        result.setSystemEmailAddresssettings.getSystemEmailAddress() );
        result.setTlsEnabledsettings.isTlsEnabled() );
        result.setUsernamesettings.getUsername() );
        return result;
    }
New to GrepCode? Check out our FAQ X