You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by "Lahiru Sandaruwan (JIRA)" <ji...@apache.org> on 2015/04/30 14:32:06 UTC

[jira] [Updated] (STRATOS-966) Inconsistency in parameter definition in REST API coding

     [ https://issues.apache.org/jira/browse/STRATOS-966?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lahiru Sandaruwan updated STRATOS-966:
--------------------------------------
    Fix Version/s: 4.1.0 Beta2

> Inconsistency in parameter definition in REST API coding
> --------------------------------------------------------
>
>                 Key: STRATOS-966
>                 URL: https://issues.apache.org/jira/browse/STRATOS-966
>             Project: Stratos
>          Issue Type: Sub-task
>          Components: REST API
>    Affects Versions: 4.1.0 M4
>            Reporter: Mariangela Hills
>             Fix For: 4.1.0 Beta2
>
>
> When going through the code I noticed that there is inconsistency at times in the code. For example, in [1] and [2] tenantdomain and domain appear to be the same parameter, but it has been referred to by two names.
> [1]
> @DELETE
>     @Path("/tenant/{tenantDomain}")
>     @Consumes("application/json")
>     @Produces("application/json")
>     @AuthorizationAction("/permission/protected/manage/monitor/tenants")
>     @SuperTenantService(true)
>     public Response deleteTenant(@PathParam("tenantDomain") String tenantDomain) throws RestAPIException {
>         TenantManager tenantManager = ServiceHolder.getTenantManager();
>         int tenantId = 0;
>         try {
>             tenantId = tenantManager.getTenantId(tenantDomain);
>         } catch (org.wso2.carbon.user.api.UserStoreException e) {
>             String msg = "Error in deleting tenant " + tenantDomain;
>             log.error(msg, e);
>             //throw new RestAPIException(msg);
>             return Response.status(Response.Status.NOT_FOUND).build();
>         }
>         try {
>             //TODO: billing related info cleanup
>             TenantMgtUtil.deleteTenantRegistryData(tenantId);
>             TenantMgtUtil.deleteTenantUMData(tenantId);
>             tenantManager.deleteTenant(tenantId);
>             log.info("Deleted tenant with domain: " + tenantDomain + " and tenant id: " + tenantId +
>                     " from the system.");
>         } catch (Exception e) {
>             String msg = "Error deleting tenant with domain: " + tenantDomain + " and tenant id: " +
>                     tenantId + ".";
>             log.error(msg, e);
>             throw new RestAPIException(msg);
>         }
>         return Response.noContent().build();
>     }
> [2]
> @GET
>     @Path("tenant/search/{domain}")
>     @Consumes("application/json")
>     @Produces("application/json")
>     @AuthorizationAction("/permission/protected/manage/monitor/tenants")
>     @SuperTenantService(true)
>     public TenantInfoBean[] retrievePartialSearchTenants(@PathParam("domain") String domain) throws RestAPIException {
>         List<TenantInfoBean> tenantList = null;
>         try {
>             tenantList = searchPartialTenantsDomains(domain);
>         } catch (Exception e) {
>             String msg = "Error in getting information for tenant " + domain;
>             log.error(msg, e);
>             throw new RestAPIException(msg);
>         }
>         return tenantList.toArray(new TenantInfoBean[tenantList.size()]);
>     }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)