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
|
* @author Olivier Lamy
|
||||||
* @since 1.4-M4
|
* @since 1.4-M4
|
||||||
*/
|
*/
|
||||||
@Service( "redbackRuntimeConfigurationAdmin#default" )
|
@Service("redbackRuntimeConfigurationAdmin#default")
|
||||||
public class DefaultRedbackRuntimeConfigurationAdmin
|
public class DefaultRedbackRuntimeConfigurationAdmin
|
||||||
extends AbstractRepositoryAdmin
|
extends AbstractRepositoryAdmin
|
||||||
implements RedbackRuntimeConfigurationAdmin, UserConfiguration
|
implements RedbackRuntimeConfigurationAdmin, UserConfiguration
|
||||||
|
@ -64,13 +64,19 @@ public class DefaultRedbackRuntimeConfigurationAdmin
|
||||||
private ArchivaConfiguration archivaConfiguration;
|
private ArchivaConfiguration archivaConfiguration;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named( value = "userConfiguration#redback" )
|
@Named(value = "userConfiguration#redback")
|
||||||
private UserConfiguration userConfiguration;
|
private UserConfiguration userConfiguration;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named( value = "cache#users" )
|
@Named(value = "cache#users")
|
||||||
private Cache usersCache;
|
private Cache usersCache;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public DefaultRedbackRuntimeConfigurationAdmin( ArchivaConfiguration archivaConfiguration )
|
||||||
|
{
|
||||||
|
this.archivaConfiguration = archivaConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initialize()
|
public void initialize()
|
||||||
throws UserConfigurationException
|
throws UserConfigurationException
|
||||||
|
@ -383,19 +389,16 @@ public class DefaultRedbackRuntimeConfigurationAdmin
|
||||||
{
|
{
|
||||||
redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
|
redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
|
||||||
}
|
}
|
||||||
res.setLdapConfiguration(
|
res.setLdapConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getLdapConfiguration(),
|
||||||
getModelMapper().map( redbackRuntimeConfiguration.getLdapConfiguration(),
|
org.apache.archiva.configuration.LdapConfiguration.class ) );
|
||||||
org.apache.archiva.configuration.LdapConfiguration.class ) );
|
|
||||||
|
|
||||||
if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
|
if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
|
||||||
{
|
{
|
||||||
redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
|
redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.setUsersCacheConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getUsersCacheConfiguration(),
|
||||||
res.setUsersCacheConfiguration(
|
org.apache.archiva.configuration.CacheConfiguration.class ) );
|
||||||
getModelMapper().map( redbackRuntimeConfiguration.getUsersCacheConfiguration(),
|
|
||||||
org.apache.archiva.configuration.CacheConfiguration.class ) );
|
|
||||||
|
|
||||||
List<LdapGroupMapping> ldapGroupMappings = redbackRuntimeConfiguration.getLdapGroupMappings();
|
List<LdapGroupMapping> ldapGroupMappings = redbackRuntimeConfiguration.getLdapGroupMappings();
|
||||||
|
|
||||||
|
|
|
@ -263,6 +263,9 @@
|
||||||
org.sonatype.aether.util,
|
org.sonatype.aether.util,
|
||||||
org.sonatype.aether.util.artifact,
|
org.sonatype.aether.util.artifact,
|
||||||
org.modelmapper,
|
org.modelmapper,
|
||||||
|
org.modelmapper.config,
|
||||||
|
org.modelmapper.convention,
|
||||||
|
org.modelmapper.spi,
|
||||||
org.apache.archiva.maven2.model,
|
org.apache.archiva.maven2.model,
|
||||||
org.sonatype.aether.util.graph.selector,
|
org.sonatype.aether.util.graph.selector,
|
||||||
org.apache.archiva.metadata.model.maven2,
|
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.Artifact;
|
||||||
import org.apache.archiva.maven2.model.TreeEntry;
|
import org.apache.archiva.maven2.model.TreeEntry;
|
||||||
import org.modelmapper.ModelMapper;
|
import org.modelmapper.ModelMapper;
|
||||||
|
import org.modelmapper.convention.MatchingStrategies;
|
||||||
import org.sonatype.aether.graph.DependencyNode;
|
import org.sonatype.aether.graph.DependencyNode;
|
||||||
import org.sonatype.aether.graph.DependencyVisitor;
|
import org.sonatype.aether.graph.DependencyVisitor;
|
||||||
|
|
||||||
|
@ -48,8 +49,8 @@ public class TreeDependencyNodeVisitor
|
||||||
|
|
||||||
public boolean visitEnter( DependencyNode dependencyNode )
|
public boolean visitEnter( DependencyNode dependencyNode )
|
||||||
{
|
{
|
||||||
TreeEntry entry = new TreeEntry(
|
TreeEntry entry =
|
||||||
getModelMapper().map( dependencyNode.getDependency().getArtifact(), Artifact.class ) );
|
new TreeEntry( getModelMapper().map( dependencyNode.getDependency().getArtifact(), Artifact.class ) );
|
||||||
entry.getArtifact().setScope( dependencyNode.getDependency().getScope() );
|
entry.getArtifact().setScope( dependencyNode.getDependency().getScope() );
|
||||||
entry.setParent( currentEntry );
|
entry.setParent( currentEntry );
|
||||||
currentEntry = entry;
|
currentEntry = entry;
|
||||||
|
@ -75,6 +76,11 @@ public class TreeDependencyNodeVisitor
|
||||||
private static class ModelMapperHolder
|
private static class ModelMapperHolder
|
||||||
{
|
{
|
||||||
private static ModelMapper MODEL_MAPPER = new ModelMapper();
|
private static ModelMapper MODEL_MAPPER = new ModelMapper();
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
MODEL_MAPPER.getConfiguration().setMatchingStrategy( MatchingStrategies.STRICT );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ModelMapper getModelMapper()
|
protected ModelMapper getModelMapper()
|
||||||
|
|
Loading…
Reference in New Issue