Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Remove redundant annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
seanf committed Sep 17, 2013
1 parent d3a5396 commit 39cd442
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 91 deletions.
Expand Up @@ -71,9 +71,6 @@ public class AccountService implements AccountResource
private Session session;

@Override
@GET
@Produces(
{MediaTypes.APPLICATION_ZANATA_ACCOUNT_XML, MediaTypes.APPLICATION_ZANATA_ACCOUNT_JSON})
public Response get()
{
log.debug("HTTP GET {0}", request.getRequestURL());
Expand All @@ -90,9 +87,6 @@ public Response get()
}

@Override
@PUT
@Consumes(
{MediaTypes.APPLICATION_ZANATA_ACCOUNT_XML, MediaTypes.APPLICATION_ZANATA_ACCOUNT_JSON})
public Response put(Account account)
{
log.debug("HTTP PUT {0} : \n{1}", request.getRequestURL(), account);
Expand Down
Expand Up @@ -72,7 +72,6 @@
*/
@Name("asynchronousProcessResourceService")
@Path(AsynchronousProcessResource.SERVICE_PATH)
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Transactional
@Slf4j
@IgnoreInterfacePath
Expand Down
23 changes: 0 additions & 23 deletions zanata-war/src/main/java/org/zanata/rest/service/FileService.java
Expand Up @@ -77,8 +77,6 @@

@Name("fileService")
@Path(FileResource.FILE_RESOURCE)
@Produces( { MediaType.APPLICATION_OCTET_STREAM })
@Consumes( { MediaType.APPLICATION_OCTET_STREAM })
@IgnoreInterfacePath
public class FileService implements FileResource
{
Expand Down Expand Up @@ -113,10 +111,6 @@ public class FileService implements FileResource
private FilePersistService filePersistService;

@Override
@GET
@Path(ACCEPTED_TYPES_RESOURCE)
@Produces( MediaType.TEXT_PLAIN )
// /file/accepted_types
public Response acceptedFileTypes()
{
StringSet acceptedTypes = new StringSet("");
Expand All @@ -125,10 +119,6 @@ public Response acceptedFileTypes()
}

@Override
@POST
@Path(SOURCE_UPLOAD_TEMPLATE)
@Consumes( MediaType.MULTIPART_FORM_DATA)
@Produces( MediaType.APPLICATION_XML)
public Response uploadSourceFile( @PathParam("projectSlug") String projectSlug,
@PathParam("iterationSlug") String iterationSlug,
@QueryParam("docId") String docId,
Expand All @@ -139,10 +129,6 @@ public Response uploadSourceFile( @PathParam("projectSlug") String projectSlug,
}

@Override
@POST
@Path(TRANSLATION_UPLOAD_TEMPLATE)
@Consumes( MediaType.MULTIPART_FORM_DATA)
@Produces( MediaType.APPLICATION_XML)
public Response uploadTranslationFile( @PathParam("projectSlug") String projectSlug,
@PathParam("iterationSlug") String iterationSlug,
@PathParam("locale") String localeId,
Expand All @@ -155,9 +141,6 @@ public Response uploadTranslationFile( @PathParam("projectSlug") String projectS
}

@Override
@GET
@Path(SOURCE_DOWNLOAD_TEMPLATE)
// /file/source/{projectSlug}/{iterationSlug}/{fileType}?docId={docId}
public Response downloadSourceFile( @PathParam("projectSlug") String projectSlug,
@PathParam("iterationSlug") String iterationSlug,
@PathParam("fileType") String fileType,
Expand Down Expand Up @@ -211,9 +194,6 @@ else if ("pot".equals(fileType) || FILE_TYPE_OFFLINE_PO_TEMPLATE.equals(fileType
}

@Override
@GET
@Path(FILE_DOWNLOAD_TEMPLATE)
// /file/translation/{projectSlug}/{iterationSlug}/{locale}/{fileType}?docId={docId}
public Response downloadTranslationFile( @PathParam("projectSlug") String projectSlug,
@PathParam("iterationSlug") String iterationSlug,
@PathParam("locale") String locale,
Expand Down Expand Up @@ -307,9 +287,6 @@ else if (FILETYPE_TRANSLATED_APPROVED.equals(fileType) || FILETYPE_TRANSLATED_AP
}

@Override
@GET
@Path(DOWNLOAD_TEMPLATE)
// /file/download/{downloadId}
public Response download( @PathParam("downloadId") String downloadId )
{
// TODO scan (again) for virus
Expand Down
Expand Up @@ -64,8 +64,6 @@ public class GlossaryService implements GlossaryResource
Log log = Logging.getLog(GlossaryService.class);

@Override
@GET
@Produces({ MediaTypes.APPLICATION_ZANATA_GLOSSARY_XML, MediaTypes.APPLICATION_ZANATA_GLOSSARY_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getEntries()
{
ResponseBuilder response = request.evaluatePreconditions();
Expand All @@ -83,9 +81,6 @@ public Response getEntries()
}

@Override
@GET
@Path("/{locale}")
@Produces({ MediaTypes.APPLICATION_ZANATA_GLOSSARY_XML, MediaTypes.APPLICATION_ZANATA_GLOSSARY_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response get(@PathParam("locale")
LocaleId locale)
{
Expand All @@ -104,8 +99,6 @@ public Response get(@PathParam("locale")
}

@Override
@PUT
@Consumes({ MediaTypes.APPLICATION_ZANATA_GLOSSARY_XML, MediaTypes.APPLICATION_ZANATA_GLOSSARY_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Restrict("#{s:hasPermission('', 'glossary-insert')}")
public Response put(Glossary glossary)
{
Expand All @@ -125,8 +118,6 @@ public Response put(Glossary glossary)
}

@Override
@DELETE
@Path("/{locale}")
@Restrict("#{s:hasPermission('', 'glossary-delete')}")
public Response deleteGlossary(@PathParam("locale") LocaleId targetLocale)
{
Expand All @@ -143,7 +134,6 @@ public Response deleteGlossary(@PathParam("locale") LocaleId targetLocale)
}

@Override
@DELETE
@Restrict("#{s:hasPermission('', 'glossary-delete')}")
public Response deleteGlossaries()
{
Expand Down
Expand Up @@ -120,8 +120,6 @@ public String getIterationSlug()
}

@Override
@HEAD
@Produces( { MediaTypes.APPLICATION_ZANATA_PROJECT_ITERATION_XML, MediaTypes.APPLICATION_ZANATA_PROJECT_ITERATION_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response head()
{
EntityTag etag = eTagUtils.generateETagForIteration(projectSlug, iterationSlug);
Expand All @@ -136,8 +134,6 @@ public Response head()
}

@Override
@GET
@Produces( { MediaTypes.APPLICATION_ZANATA_PROJECT_ITERATION_XML, MediaTypes.APPLICATION_ZANATA_PROJECT_ITERATION_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response get()
{

Expand All @@ -158,8 +154,6 @@ public Response get()
}

@Override
@PUT
@Consumes( { MediaTypes.APPLICATION_ZANATA_PROJECT_ITERATION_XML, MediaTypes.APPLICATION_ZANATA_PROJECT_ITERATION_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response put(ProjectIteration projectIteration)
{

Expand Down
Expand Up @@ -90,8 +90,6 @@ public String getProjectSlug()
}

@Override
@HEAD
@Produces({ MediaTypes.APPLICATION_ZANATA_PROJECT_XML, MediaTypes.APPLICATION_ZANATA_PROJECT_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response head()
{
EntityTag etag = eTagUtils.generateTagForProject(projectSlug);
Expand All @@ -104,8 +102,6 @@ public Response head()
}

@Override
@GET
@Produces({ MediaTypes.APPLICATION_ZANATA_PROJECT_XML, MediaTypes.APPLICATION_ZANATA_PROJECT_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response get()
{
try
Expand All @@ -129,8 +125,6 @@ public Response get()
}

@Override
@PUT
@Consumes({ MediaTypes.APPLICATION_ZANATA_PROJECT_XML, MediaTypes.APPLICATION_ZANATA_PROJECT_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response put(Project project)
{
ResponseBuilder response;
Expand Down
Expand Up @@ -75,9 +75,6 @@ public class ProjectsService implements ProjectsResource
MediaType accept;

@Override
@GET
@Produces( { MediaTypes.APPLICATION_ZANATA_PROJECTS_XML, MediaTypes.APPLICATION_ZANATA_PROJECTS_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Wrapped(element = "projects", namespace = Namespaces.ZANATA_API)
public Response get()
{
Query query = session.createQuery("from HProject p");
Expand Down
Expand Up @@ -81,8 +81,6 @@
*/
@Name("sourceDocResourceService")
@Path(SourceDocResourceService.SERVICE_PATH)
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Transactional
@IgnoreInterfacePath
public class SourceDocResourceService implements SourceDocResource
Expand Down Expand Up @@ -125,7 +123,6 @@ public class SourceDocResourceService implements SourceDocResource


@Override
@HEAD
public Response head()
{
HProjectIteration hProjectIteration = retrieveAndCheckIteration(false);
Expand All @@ -139,8 +136,6 @@ public Response head()
}

@Override
@GET
@Wrapped(element = "resources", namespace = Namespaces.ZANATA_API)
public Response get(@QueryParam("ext") Set<String> extensions)
{
HProjectIteration hProjectIteration = retrieveAndCheckIteration(false);
Expand Down Expand Up @@ -175,7 +170,6 @@ public Response get(@QueryParam("ext") Set<String> extensions)


@Override
@POST
@Restrict("#{s:hasPermission(sourceDocResourceService.securedIteration, 'import-template')}")
public Response post(Resource resource, @QueryParam("ext") Set<String> extensions, @QueryParam("copyTrans") @DefaultValue("true") boolean copytrans)
{
Expand Down Expand Up @@ -213,9 +207,6 @@ public Response post(Resource resource, @QueryParam("ext") Set<String> extension
}

@Override
@GET
@Path(RESOURCE_SLUG_TEMPLATE)
// /r/{id}
public Response getResource(@PathParam("id") String idNoSlash, @QueryParam("ext") Set<String> extensions)
{
log.debug("start get resource");
Expand Down Expand Up @@ -259,10 +250,7 @@ public Response getResource(@PathParam("id") String idNoSlash, @QueryParam("ext"
}

@Override
@PUT
@Path(RESOURCE_SLUG_TEMPLATE)
@Restrict("#{s:hasPermission(sourceDocResourceService.securedIteration, 'import-template')}")
// /r/{id}
public Response putResource(@PathParam("id") String idNoSlash, Resource resource, @QueryParam("ext") Set<String> extensions, @QueryParam("copyTrans") @DefaultValue("true") boolean copytrans)
{
log.debug("start put resource");
Expand Down Expand Up @@ -292,10 +280,7 @@ public Response putResource(@PathParam("id") String idNoSlash, Resource resource
}

@Override
@DELETE
@Path(RESOURCE_SLUG_TEMPLATE)
@Restrict("#{s:hasPermission(sourceDocResourceService.securedIteration, 'import-template')}")
// /r/{id}
public Response deleteResource(@PathParam("id") String idNoSlash)
{
String id = URIHelper.convertFromDocumentURIId(idNoSlash);
Expand All @@ -315,9 +300,6 @@ public Response deleteResource(@PathParam("id") String idNoSlash)
}

@Override
@GET
@Path(RESOURCE_SLUG_TEMPLATE + "/meta")
// /r/{id}/meta
public Response getResourceMeta(@PathParam("id") String idNoSlash, @QueryParam("ext") Set<String> extensions)
{
log.debug("start to get resource meta");
Expand Down Expand Up @@ -350,10 +332,7 @@ public Response getResourceMeta(@PathParam("id") String idNoSlash, @QueryParam("
}

@Override
@PUT
@Path(RESOURCE_SLUG_TEMPLATE + "/meta")
@Restrict("#{s:hasPermission(sourceDocResourceService.securedIteration, 'import-template')}")
// /r/{id}/meta
public Response putResourceMeta(@PathParam("id") String idNoSlash, ResourceMeta messageBody, @QueryParam("ext") Set<String> extensions)
{
log.debug("start to put resource meta");
Expand Down
Expand Up @@ -76,9 +76,7 @@
* This service allows clients to push and pull both source documents and translations.
*/
@Name("translatedDocResourceService")
@Path(TranslatedDocResourceService.SERVICE_PATH)
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Path(TranslatedDocResource.SERVICE_PATH)
@Transactional
@IgnoreInterfacePath
public class TranslatedDocResourceService implements TranslatedDocResource
Expand Down Expand Up @@ -150,9 +148,6 @@ public class TranslatedDocResourceService implements TranslatedDocResource
private LocaleService localeServiceImpl;

@Override
@GET
@Path(RESOURCE_SLUG_TEMPLATE + "/translations/{locale}")
// /r/{id}/translations/{locale}
public Response getTranslations(
@PathParam("id") String idNoSlash,
@PathParam("locale") LocaleId locale,
Expand Down Expand Up @@ -207,10 +202,7 @@ public Response getTranslations(
}

@Override
@DELETE
@Path(RESOURCE_SLUG_TEMPLATE + "/translations/{locale}")
@Restrict("#{s:hasPermission(translatedDocResourceService.securedIteration.project, 'modify-translation')}")
// /r/{id}/translations/{locale}
public Response deleteTranslations(@PathParam("id") String idNoSlash, @PathParam("locale") LocaleId locale)
{
String id = URIHelper.convertFromDocumentURIId(idNoSlash);
Expand Down Expand Up @@ -247,9 +239,6 @@ public Response deleteTranslations(@PathParam("id") String idNoSlash, @PathParam
}

@Override
@PUT
@Path(RESOURCE_SLUG_TEMPLATE + "/translations/{locale}")
// /r/{id}/translations/{locale}
public Response putTranslations(@PathParam("id") String idNoSlash, @PathParam("locale") LocaleId locale, TranslationsResource messageBody, @QueryParam("ext") Set<String> extensions, @QueryParam("merge") @DefaultValue("auto") String merge)
{
// check security (cannot be on @Restrict as it refers to method parameters)
Expand Down
Expand Up @@ -32,8 +32,6 @@ public VersionService()
}

@Override
@GET
@Produces({ MediaTypes.APPLICATION_ZANATA_VERSION_JSON, MediaTypes.APPLICATION_ZANATA_VERSION_XML })
public Response get()
{
return Response.ok(version).build();
Expand Down
Expand Up @@ -64,7 +64,6 @@
* href="mailto:camunoz@redhat.com">camunoz@redhat.com</a>
*/
@Path("/stats")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Name("statisticsServiceImpl")
@Scope(ScopeType.STATELESS)
public class StatisticsServiceImpl implements StatisticsResource
Expand Down

0 comments on commit 39cd442

Please sign in to comment.