diff options
author | Carlos Sanchez <csanchez@maestrodev.com> | 2014-11-05 20:11:08 +0100 |
---|---|---|
committer | Carlos Sanchez <carlos@apache.org> | 2014-12-01 16:48:13 +0100 |
commit | e4da1fa6f5a56bbf63bae1de7d1b7dd0ae0375aa (patch) | |
tree | 6477dd5905f983cc3f4cd83580795ab8a7be9ef8 /archiva-modules/archiva-web/archiva-rest/archiva-rest-api | |
parent | d9473241c956359325aa10bdbff4e39be284c559 (diff) | |
download | archiva-e4da1fa6f5a56bbf63bae1de7d1b7dd0ae0375aa.tar.gz archiva-e4da1fa6f5a56bbf63bae1de7d1b7dd0ae0375aa.zip |
[MRM-1390] Add REST methods to search JCR store for generic metadata and properties
Added REST methods:
artifactsByProjectVersionMetadata/{key}/{value}
artifactsByMetadata/{key}/{value}
artifactsByProperty/{key}/{value}
searchArtifacts/{text}
searchArtifacts/{key}/{text}
In JCR implementation When searching into any property (key = nil) we can't do exact searchs
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rest/archiva-rest-api')
-rw-r--r-- | archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java index 5cd0f50b9..777d15d90 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java @@ -231,4 +231,102 @@ public interface BrowseService @RedbackAuthorization(noPermission = true, noRestriction = true) List<Artifact> getArtifacts( @PathParam("r") String repositoryId ) throws ArchivaRestServiceException; + + /** + * Return List of artifacts from this repository with project version level metadata key matching value. If + * repository is not provided the search runs in all repositories. + * + * @param key + * @param value + * @param repositoryId + * @return + * @throws ArchivaRestServiceException + * @since 2.2 + */ + @Path( "artifactsByProjectVersionMetadata/{key}/{value}" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) + @RedbackAuthorization( noPermission = true, noRestriction = true ) + List<Artifact> getArtifactsByProjectVersionMetadata( @PathParam( "key" ) String key, @PathParam( "value" ) String value, + @QueryParam("repositoryId") String repositoryId ) + throws ArchivaRestServiceException; + + /** + * Return List of artifacts from this repository with artifact metadata key matching value. + * If repository is not provided the search runs in all repositories. + * + * @param key + * @param value + * @param repositoryId + * @return + * @throws ArchivaRestServiceException + * @since 2.2 + */ + @Path( "artifactsByMetadata/{key}/{value}" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) + @RedbackAuthorization( noPermission = true, noRestriction = true ) + List<Artifact> getArtifactsByMetadata( @PathParam( "key" ) String key, @PathParam( "value" ) String value, + @QueryParam("repositoryId") String repositoryId ) + throws ArchivaRestServiceException; + + /** + * Return List of artifacts from this repository with property key matching value. + * If repository is not provided the search runs in all repositories. + * + * @param key + * @param value + * @param repositoryId + * @return + * @throws ArchivaRestServiceException + * @since 2.2 + */ + @Path( "artifactsByProperty/{key}/{value}" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) + @RedbackAuthorization( noPermission = true, noRestriction = true ) + List<Artifact> getArtifactsByProperty( @PathParam( "key" ) String key, @PathParam( "value" ) String value, + @QueryParam("repositoryId") String repositoryId ) + throws ArchivaRestServiceException; + + /** + * Search artifacts with any property matching text. If repository is not provided the search runs in all + * repositories. If exact is true only the artifacts whose property match exactly are returned. + * + * @param text + * @param repositoryId + * @param exact + * @return + * @throws ArchivaRestServiceException + * @since 2.2 + */ + @Path( "searchArtifacts/{text}" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) + @RedbackAuthorization( noPermission = true, noRestriction = true ) + List<Artifact> searchArtifacts( @PathParam( "text" ) String text, + @QueryParam( "repositoryId" ) String repositoryId, + @QueryParam( "exact" ) Boolean exact ) + throws ArchivaRestServiceException; + + /** + * Search artifacts with the property specified by key matching text. If repository is not provided the search runs + * in all repositories. If exact is true only the artifacts whose property match exactly are returned. + * + * @param key + * @param text + * @param repositoryId + * @param exact + * @return + * @throws ArchivaRestServiceException + * @since 2.2 + */ + @Path( "searchArtifacts/{key}/{text}" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) + @RedbackAuthorization( noPermission = true, noRestriction = true ) + List<Artifact> searchArtifacts( @PathParam( "key" ) String key, @PathParam( "text" ) String text, + @QueryParam( "repositoryId" ) String repositoryId, + @QueryParam( "exact" ) Boolean exact ) + throws ArchivaRestServiceException; } |