mirror of https://github.com/apache/archiva.git
use strict matching for model mapper
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1556158 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
59743128e8
commit
2d840d9ffe
|
@ -52,7 +52,7 @@ import java.util.Set;
|
|||
* @author Olivier Lamy
|
||||
* @since 1.4-M4
|
||||
*/
|
||||
@Service( "redbackRuntimeConfigurationAdmin#default" )
|
||||
@Service("redbackRuntimeConfigurationAdmin#default")
|
||||
public class DefaultRedbackRuntimeConfigurationAdmin
|
||||
extends AbstractRepositoryAdmin
|
||||
implements RedbackRuntimeConfigurationAdmin, UserConfiguration
|
||||
|
@ -64,13 +64,19 @@ public class DefaultRedbackRuntimeConfigurationAdmin
|
|||
private ArchivaConfiguration archivaConfiguration;
|
||||
|
||||
@Inject
|
||||
@Named( value = "userConfiguration#redback" )
|
||||
@Named(value = "userConfiguration#redback")
|
||||
private UserConfiguration userConfiguration;
|
||||
|
||||
@Inject
|
||||
@Named( value = "cache#users" )
|
||||
@Named(value = "cache#users")
|
||||
private Cache usersCache;
|
||||
|
||||
@Inject
|
||||
public DefaultRedbackRuntimeConfigurationAdmin( ArchivaConfiguration archivaConfiguration )
|
||||
{
|
||||
this.archivaConfiguration = archivaConfiguration;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void initialize()
|
||||
throws UserConfigurationException
|
||||
|
@ -383,19 +389,16 @@ public class DefaultRedbackRuntimeConfigurationAdmin
|
|||
{
|
||||
redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
|
||||
}
|
||||
res.setLdapConfiguration(
|
||||
getModelMapper().map( redbackRuntimeConfiguration.getLdapConfiguration(),
|
||||
org.apache.archiva.configuration.LdapConfiguration.class ) );
|
||||
res.setLdapConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getLdapConfiguration(),
|
||||
org.apache.archiva.configuration.LdapConfiguration.class ) );
|
||||
|
||||
if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
|
||||
{
|
||||
redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
|
||||
}
|
||||
|
||||
|
||||
res.setUsersCacheConfiguration(
|
||||
getModelMapper().map( redbackRuntimeConfiguration.getUsersCacheConfiguration(),
|
||||
org.apache.archiva.configuration.CacheConfiguration.class ) );
|
||||
res.setUsersCacheConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getUsersCacheConfiguration(),
|
||||
org.apache.archiva.configuration.CacheConfiguration.class ) );
|
||||
|
||||
List<LdapGroupMapping> ldapGroupMappings = redbackRuntimeConfiguration.getLdapGroupMappings();
|
||||
|
||||
|
|
|
@ -263,6 +263,9 @@
|
|||
org.sonatype.aether.util,
|
||||
org.sonatype.aether.util.artifact,
|
||||
org.modelmapper,
|
||||
org.modelmapper.config,
|
||||
org.modelmapper.convention,
|
||||
org.modelmapper.spi,
|
||||
org.apache.archiva.maven2.model,
|
||||
org.sonatype.aether.util.graph.selector,
|
||||
org.apache.archiva.metadata.model.maven2,
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.archiva.dependency.tree.maven2;
|
|||
import org.apache.archiva.maven2.model.Artifact;
|
||||
import org.apache.archiva.maven2.model.TreeEntry;
|
||||
import org.modelmapper.ModelMapper;
|
||||
import org.modelmapper.convention.MatchingStrategies;
|
||||
import org.sonatype.aether.graph.DependencyNode;
|
||||
import org.sonatype.aether.graph.DependencyVisitor;
|
||||
|
||||
|
@ -48,8 +49,8 @@ public class TreeDependencyNodeVisitor
|
|||
|
||||
public boolean visitEnter( DependencyNode dependencyNode )
|
||||
{
|
||||
TreeEntry entry = new TreeEntry(
|
||||
getModelMapper().map( dependencyNode.getDependency().getArtifact(), Artifact.class ) );
|
||||
TreeEntry entry =
|
||||
new TreeEntry( getModelMapper().map( dependencyNode.getDependency().getArtifact(), Artifact.class ) );
|
||||
entry.getArtifact().setScope( dependencyNode.getDependency().getScope() );
|
||||
entry.setParent( currentEntry );
|
||||
currentEntry = entry;
|
||||
|
@ -75,6 +76,11 @@ public class TreeDependencyNodeVisitor
|
|||
private static class ModelMapperHolder
|
||||
{
|
||||
private static ModelMapper MODEL_MAPPER = new ModelMapper();
|
||||
|
||||
static
|
||||
{
|
||||
MODEL_MAPPER.getConfiguration().setMatchingStrategy( MatchingStrategies.STRICT );
|
||||
}
|
||||
}
|
||||
|
||||
protected ModelMapper getModelMapper()
|
||||
|
|
Loading…
Reference in New Issue