stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mariangela Hills (JIRA)" <j...@apache.org>
Subject [jira] [Created] (STRATOS-966) Inconsistency in parameter definition in REST API coding
Date Sat, 15 Nov 2014 00:37:33 GMT
Mariangela Hills created STRATOS-966:
----------------------------------------

             Summary: Inconsistency in parameter definition in REST API coding
                 Key: STRATOS-966
                 URL: https://issues.apache.org/jira/browse/STRATOS-966
             Project: Stratos
          Issue Type: Improvement
          Components: REST API
    Affects Versions: 4.1.0 M4
            Reporter: Mariangela Hills


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)

Mime
View raw message