added header for swagger
This commit is contained in:
parent
b4c9cfeee6
commit
e0a50f2a72
|
@ -47,8 +47,14 @@ import org.glassfish.jersey.media.multipart.FormDataParam;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
|
||||
@Path("items")
|
||||
@ManagedBy(StorageHubAppllicationManager.class)
|
||||
@RequestHeaders({
|
||||
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
||||
})
|
||||
public class ACLManager extends Impersonable {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ACLManager.class);
|
||||
|
|
|
@ -73,8 +73,14 @@ import org.glassfish.jersey.media.multipart.FormDataParam;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
|
||||
@Path("groups")
|
||||
@ManagedBy(StorageHubAppllicationManager.class)
|
||||
@RequestHeaders({
|
||||
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
||||
})
|
||||
public class GroupManager {
|
||||
|
||||
|
||||
|
|
|
@ -55,9 +55,15 @@ import org.glassfish.jersey.media.multipart.FormDataParam;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
|
||||
|
||||
|
||||
@Path("items")
|
||||
@RequestHeaders({
|
||||
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
||||
})
|
||||
public class ItemSharing extends Impersonable{
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ItemSharing.class);
|
||||
|
|
|
@ -38,9 +38,13 @@ import org.glassfish.jersey.media.multipart.FormDataParam;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
|
||||
@Path("items")
|
||||
@ManagedBy(StorageHubAppllicationManager.class)
|
||||
@RequestHeaders({
|
||||
@RequestHeader(name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"), })
|
||||
public class ItemsCreator extends Impersonable {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ItemsCreator.class);
|
||||
|
@ -64,7 +68,8 @@ public class ItemsCreator extends Impersonable{
|
|||
String toReturn = null;
|
||||
try {
|
||||
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
|
||||
ItemsParameterBuilder<FolderCreationParameters> builder = FolderCreationParameters.builder().name(name).description(description).hidden(hidden).on(id).with(ses).author(currentUser);
|
||||
ItemsParameterBuilder<FolderCreationParameters> builder = FolderCreationParameters.builder().name(name)
|
||||
.description(description).hidden(hidden).on(id).with(ses).author(currentUser);
|
||||
toReturn = itemHandler.create(builder.build());
|
||||
} catch (StorageHubException she) {
|
||||
log.error(she.getErrorMessage(), she);
|
||||
|
@ -88,8 +93,7 @@ public class ItemsCreator extends Impersonable{
|
|||
@Path("/{id}/create/EXTERNALFOLDER")
|
||||
public Response createExternalFolder(@PathParam("id") String id, @FormParam("name") String name,
|
||||
@FormParam("description") String description, @FormParam("hidden") boolean hidden,
|
||||
@FormParam("pluginName") String pluginName,
|
||||
@FormParam("parameters") String pluginParameters) {
|
||||
@FormParam("pluginName") String pluginName, @FormParam("parameters") String pluginParameters) {
|
||||
InnerMethodName.instance.set("createItem(EXTERNALFOLDER)");
|
||||
log.info("create folder item called");
|
||||
Session ses = null;
|
||||
|
@ -98,7 +102,8 @@ public class ItemsCreator extends Impersonable{
|
|||
// TODO
|
||||
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
|
||||
ItemsParameterBuilder<FolderCreationParameters> builder = FolderCreationParameters.builder().name(name)
|
||||
.description(description).onRepository(pluginName).withParameters(null).hidden(hidden).on(id).with(ses).author(currentUser);
|
||||
.description(description).onRepository(pluginName).withParameters(null).hidden(hidden).on(id)
|
||||
.with(ses).author(currentUser);
|
||||
toReturn = itemHandler.create(builder.build());
|
||||
} catch (StorageHubException she) {
|
||||
log.error(she.getErrorMessage(), she);
|
||||
|
@ -120,7 +125,8 @@ public class ItemsCreator extends Impersonable{
|
|||
@POST
|
||||
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
||||
@Path("/{id}/create/URL")
|
||||
public Response createURL(@PathParam("id") String id, @FormParam("name") String name, @FormParam("description") String description, @FormParam("value") URL value) {
|
||||
public Response createURL(@PathParam("id") String id, @FormParam("name") String name,
|
||||
@FormParam("description") String description, @FormParam("value") URL value) {
|
||||
InnerMethodName.instance.set("createItem(URL)");
|
||||
log.info("create url called");
|
||||
Session ses = null;
|
||||
|
@ -128,7 +134,8 @@ public class ItemsCreator extends Impersonable{
|
|||
try {
|
||||
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
|
||||
|
||||
ItemsParameterBuilder<URLCreationParameters> builder = URLCreationParameters.builder().name(name).description(description).url(value).on(id).with(ses).author(currentUser);
|
||||
ItemsParameterBuilder<URLCreationParameters> builder = URLCreationParameters.builder().name(name)
|
||||
.description(description).url(value).on(id).with(ses).author(currentUser);
|
||||
|
||||
toReturn = itemHandler.create(builder.build());
|
||||
} catch (StorageHubException she) {
|
||||
|
@ -148,7 +155,6 @@ public class ItemsCreator extends Impersonable{
|
|||
return Response.ok(toReturn).build();
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/{id}/create/GCUBEITEM")
|
||||
|
@ -160,7 +166,8 @@ public class ItemsCreator extends Impersonable{
|
|||
|
||||
try {
|
||||
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
|
||||
ItemsParameterBuilder<GCubeItemCreationParameters> builder = GCubeItemCreationParameters.builder().item(item).on(id).with(ses).author(currentUser);
|
||||
ItemsParameterBuilder<GCubeItemCreationParameters> builder = GCubeItemCreationParameters.builder()
|
||||
.item(item).on(id).with(ses).author(currentUser);
|
||||
|
||||
toReturn = itemHandler.create(builder.build());
|
||||
} catch (StorageHubException she) {
|
||||
|
@ -179,13 +186,11 @@ public class ItemsCreator extends Impersonable{
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
@Path("/{id}/create/FILE")
|
||||
public String createFileItem(@PathParam("id") String id, @FormDataParam("name") String name,
|
||||
@FormDataParam("description") String description,
|
||||
@FormDataParam("file") InputStream stream,
|
||||
@FormDataParam("description") String description, @FormDataParam("file") InputStream stream,
|
||||
@FormDataParam("file") FormDataContentDisposition fileDetail) {
|
||||
InnerMethodName.instance.set("createItem(FILE)");
|
||||
|
||||
|
@ -194,8 +199,9 @@ public class ItemsCreator extends Impersonable{
|
|||
try {
|
||||
|
||||
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
|
||||
ItemsParameterBuilder<FileCreationParameters> builder = FileCreationParameters.builder().name(name).description(description).stream(stream).fileDetails(fileDetail)
|
||||
.on(id).with(ses).author(currentUser);
|
||||
ItemsParameterBuilder<FileCreationParameters> builder = FileCreationParameters.builder().name(name)
|
||||
.description(description).stream(stream).fileDetails(fileDetail).on(id).with(ses)
|
||||
.author(currentUser);
|
||||
|
||||
toReturn = itemHandler.create(builder.build());
|
||||
|
||||
|
@ -218,17 +224,11 @@ public class ItemsCreator extends Impersonable{
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@POST
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
@Path("/{id}/create/ARCHIVE")
|
||||
public String uploadArchive(@PathParam("id") String id, @FormDataParam("parentFolderName") String parentFolderName,
|
||||
@FormDataParam("file") InputStream stream,
|
||||
@FormDataParam("file") FormDataContentDisposition fileDetail){
|
||||
@FormDataParam("file") InputStream stream, @FormDataParam("file") FormDataContentDisposition fileDetail) {
|
||||
InnerMethodName.instance.set("createItem(ARCHIVE)");
|
||||
|
||||
Session ses = null;
|
||||
|
@ -236,8 +236,9 @@ public class ItemsCreator extends Impersonable{
|
|||
try {
|
||||
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
|
||||
|
||||
ItemsParameterBuilder<ArchiveStructureCreationParameter> builder = ArchiveStructureCreationParameter.builder().parentName(parentFolderName).stream(stream).fileDetails(fileDetail)
|
||||
.on(id).with(ses).author(currentUser);
|
||||
ItemsParameterBuilder<ArchiveStructureCreationParameter> builder = ArchiveStructureCreationParameter
|
||||
.builder().parentName(parentFolderName).stream(stream).fileDetails(fileDetail).on(id).with(ses)
|
||||
.author(currentUser);
|
||||
|
||||
toReturn = itemHandler.create(builder.build());
|
||||
|
||||
|
@ -258,7 +259,4 @@ public class ItemsCreator extends Impersonable{
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -94,9 +94,15 @@ import org.gcube.smartgears.utils.InnerMethodName;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
|
||||
|
||||
@Path("items")
|
||||
@ManagedBy(StorageHubAppllicationManager.class)
|
||||
@RequestHeaders({
|
||||
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
||||
})
|
||||
public class ItemsManager extends Impersonable{
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ItemsManager.class);
|
||||
|
|
|
@ -63,8 +63,14 @@ import org.gcube.smartgears.utils.InnerMethodName;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
|
||||
@Path("messages")
|
||||
@ManagedBy(StorageHubAppllicationManager.class)
|
||||
@RequestHeaders({
|
||||
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
||||
})
|
||||
public class MessageManager extends Impersonable{
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MessageManager.class);
|
||||
|
|
|
@ -58,8 +58,14 @@ import org.gcube.smartgears.utils.InnerMethodName;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
|
||||
@Path("users")
|
||||
@ManagedBy(StorageHubAppllicationManager.class)
|
||||
@RequestHeaders({
|
||||
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
||||
})
|
||||
public class UserManager {
|
||||
|
||||
private static final String INFRASTRUCTURE_MANAGER_ROLE = "Infrastructure-Manager";
|
||||
|
|
|
@ -55,10 +55,16 @@ import org.gcube.smartgears.utils.InnerMethodName;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
|
||||
|
||||
|
||||
@Path("/")
|
||||
@ManagedBy(StorageHubAppllicationManager.class)
|
||||
@RequestHeaders({
|
||||
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
||||
})
|
||||
public class WorkspaceManager extends Impersonable{
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(WorkspaceManager.class);
|
||||
|
|
|
@ -40,7 +40,13 @@ import org.glassfish.jersey.media.multipart.FormDataParam;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
|
||||
@Path("admin/script")
|
||||
@RequestHeaders({
|
||||
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
||||
})
|
||||
public class ScriptManager {
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue