mirror of https://github.com/apache/archiva.git
[MRM-1167]
o fix xmlrpc search service git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@778106 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fa24587f89
commit
302186acd1
|
@ -63,10 +63,10 @@
|
|||
<mainClass>org.apache.archiva.web.xmlrpc.client.SampleClient</mainClass>
|
||||
<arguments>
|
||||
<!--
|
||||
URL: ex. http://127.0.0.1:9091/xmlrpc
|
||||
URL: ex. http://127.0.0.1:8080/archiva/xmlrpc
|
||||
USERNAME & PASSWORD: Archiva credentials
|
||||
-->
|
||||
<argument>http://127.0.0.1:9091/xmlrpc</argument>
|
||||
<argument>http://127.0.0.1:8080/archiva/xmlrpc</argument>
|
||||
<argument>admin</argument>
|
||||
<argument>${password}</argument>
|
||||
</arguments>
|
||||
|
|
|
@ -40,6 +40,8 @@ import org.apache.maven.archiva.database.browsing.RepositoryBrowsing;
|
|||
import org.apache.maven.archiva.database.constraints.ArtifactsByChecksumConstraint;
|
||||
import org.apache.maven.archiva.model.ArchivaArtifact;
|
||||
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* SearchServiceImpl
|
||||
|
@ -49,6 +51,8 @@ import org.apache.maven.archiva.model.ArchivaProjectModel;
|
|||
public class SearchServiceImpl
|
||||
implements SearchService
|
||||
{
|
||||
private Logger log = LoggerFactory.getLogger( SearchServiceImpl.class );
|
||||
|
||||
private RepositorySearch search;
|
||||
|
||||
private XmlRpcUserRepositories xmlRpcUserRepositories;
|
||||
|
@ -91,33 +95,41 @@ public class SearchServiceImpl
|
|||
results = search.search( "", observableRepos, queryString, limits, null );
|
||||
|
||||
List<SearchResultHit> hits = results.getHits();
|
||||
|
||||
for( SearchResultHit hit : hits )
|
||||
{
|
||||
ArtifactDAO artifactDAO = archivaDAO.getArtifactDAO();
|
||||
try
|
||||
{
|
||||
ArchivaArtifact pomArtifact = artifactDAO.getArtifact(
|
||||
hit.getGroupId(), hit.getArtifactId(), hit.getVersion(), "", "pom", hit.getRepositoryId() );
|
||||
|
||||
if( pomArtifact != null )
|
||||
{
|
||||
Artifact artifact = new Artifact( pomArtifact.getModel().getRepositoryId(), pomArtifact.getGroupId(), pomArtifact.getArtifactId(), pomArtifact.getVersion(),
|
||||
pomArtifact.getType() );
|
||||
//pomArtifact.getType(), pomArtifact.getModel().getWhenGathered() );
|
||||
artifacts.add( artifact );
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch ( ObjectNotFoundException e )
|
||||
List<String> versions = hit.getVersions();
|
||||
if( versions != null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
catch ( ArchivaDatabaseException e )
|
||||
{
|
||||
continue;
|
||||
for( String version : versions )
|
||||
{
|
||||
for( String repo : observableRepos )
|
||||
{
|
||||
try
|
||||
{
|
||||
ArchivaArtifact pomArtifact = artifactDAO.getArtifact(
|
||||
hit.getGroupId(), hit.getArtifactId(), version, null, "pom", repo );
|
||||
if( pomArtifact != null )
|
||||
{
|
||||
Artifact artifact = new Artifact( pomArtifact.getModel().getRepositoryId(), pomArtifact.getGroupId(), pomArtifact.getArtifactId(), pomArtifact.getVersion(),
|
||||
pomArtifact.getType() );
|
||||
//pomArtifact.getType(), pomArtifact.getModel().getWhenGathered() );
|
||||
artifacts.add( artifact );
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch( ObjectNotFoundException e )
|
||||
{
|
||||
log.debug( "Unable to find pom artifact : " + e.getMessage() );
|
||||
}
|
||||
catch( ArchivaDatabaseException e )
|
||||
{
|
||||
log.debug( "Error occurred while getting pom artifact from database : " + e.getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue