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;
|
||||
|
@ -89,35 +93,43 @@ public class SearchServiceImpl
|
|||
SearchResults results = null;
|
||||
|
||||
results = search.search( "", observableRepos, queryString, limits, null );
|
||||
|
||||
|
||||
List<SearchResultHit> hits = results.getHits();
|
||||
|
||||
for( SearchResultHit hit : hits )
|
||||
{
|
||||
ArtifactDAO artifactDAO = archivaDAO.getArtifactDAO();
|
||||
try
|
||||
|
||||
List<String> versions = hit.getVersions();
|
||||
if( versions != null )
|
||||
{
|
||||
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 );
|
||||
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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch ( ObjectNotFoundException e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
catch ( ArchivaDatabaseException e )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue