mirror of https://github.com/apache/archiva.git
add rest method to getObservableRepoIds
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1294221 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0fe74aabaa
commit
48da9ae955
|
@ -0,0 +1,55 @@
|
|||
package org.apache.archiva.rest.api.model;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* jaxrs fail to return List<String> so use this contains for rest services returning that
|
||||
*
|
||||
* @author Olivier Lamy
|
||||
* @since 1.4-M3
|
||||
*/
|
||||
@XmlRootElement( name = "stringList" )
|
||||
public class StringList
|
||||
{
|
||||
private List<String> strings;
|
||||
|
||||
public StringList()
|
||||
{
|
||||
// no op
|
||||
}
|
||||
|
||||
public StringList( List<String> strings )
|
||||
{
|
||||
this.strings = strings;
|
||||
}
|
||||
|
||||
public List<String> getStrings()
|
||||
{
|
||||
return strings == null ? new ArrayList<String>( 0 ) : strings;
|
||||
}
|
||||
|
||||
public void setStrings( List<String> strings )
|
||||
{
|
||||
this.strings = strings;
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ package org.apache.archiva.rest.api.services;
|
|||
import org.apache.archiva.rest.api.model.Artifact;
|
||||
import org.apache.archiva.rest.api.model.GroupIdList;
|
||||
import org.apache.archiva.rest.api.model.SearchRequest;
|
||||
import org.apache.archiva.rest.api.model.StringList;
|
||||
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -88,6 +89,13 @@ public interface SearchService
|
|||
GroupIdList getAllGroupIds( @QueryParam( "selectedRepos" ) List<String> selectedRepos )
|
||||
throws ArchivaRestServiceException;
|
||||
|
||||
@Path( "observablesRepoIds" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
||||
@RedbackAuthorization( noPermission = true, noRestriction = true )
|
||||
StringList getObservablesRepoIds()
|
||||
throws ArchivaRestServiceException;
|
||||
|
||||
/*
|
||||
@Path( "getDependencies" )
|
||||
@GET
|
||||
|
|
|
@ -30,24 +30,14 @@ import org.apache.archiva.rest.api.model.Artifact;
|
|||
import org.apache.archiva.rest.api.model.Dependency;
|
||||
import org.apache.archiva.rest.api.model.GroupIdList;
|
||||
import org.apache.archiva.rest.api.model.SearchRequest;
|
||||
import org.apache.archiva.rest.api.model.StringList;
|
||||
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
|
||||
import org.apache.archiva.rest.api.services.SearchService;
|
||||
import org.apache.archiva.security.AccessDeniedException;
|
||||
import org.apache.archiva.security.ArchivaSecurityException;
|
||||
import org.apache.archiva.security.PrincipalNotFoundException;
|
||||
import org.apache.archiva.security.UserRepositories;
|
||||
import org.apache.commons.collections.ListUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.codehaus.plexus.redback.users.UserManager;
|
||||
import org.codehaus.redback.rest.services.RedbackAuthenticationThreadLocal;
|
||||
import org.codehaus.redback.rest.services.RedbackRequestInformation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.ws.rs.core.Context;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -174,6 +164,15 @@ public class DefaultSearchService
|
|||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
public StringList getObservablesRepoIds()
|
||||
throws ArchivaRestServiceException
|
||||
{
|
||||
return new StringList( getObservableRepos() );
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
// internal
|
||||
//-------------------------------------
|
||||
protected List<Artifact> getArtifacts( SearchResults searchResults )
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue