Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void process(Request request, TreeNode<Resource> resultNode, String href)
Map<String, Object> mpackInfo = mapInfo.get("MpackInfo");

int idx = href.indexOf("stacks/");
Long mpackId = (Long)mpackInfo.get("mpack_id");
Long mpackId = (Long)mpackInfo.get("id");
href = href.substring(0, idx) + "mpacks/" + mpackId;
resultNode.setProperty("href", href);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public MpacksService() {
response = MpackResponseWrapper.class, responseContainer = RESPONSE_CONTAINER_LIST)
@ApiImplicitParams({
@ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
paramType = PARAM_TYPE_QUERY, defaultValue = MpackResourceProvider.MPACK_ID),
paramType = PARAM_TYPE_QUERY, defaultValue = MpackResourceProvider.MPACK_RESOURCE_ID),
@ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION, dataType = DATA_TYPE_STRING,
paramType = PARAM_TYPE_QUERY),
@ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE,
Expand Down Expand Up @@ -123,13 +123,13 @@ public Response createMpacks(String body, @Context HttpHeaders headers, @Context
}

/***
* Handles: GET /mpacks/{mpack_id}
* Return a specific mpack given an mpack_id
* Handles: GET /mpacks/{id}
* Return a specific mpack given an id
*
* @param
*/
@GET
@Path("{mpack_id}")
@Path("{id}")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Returns information about a specific mpack that is registered with this Ambari instance",
response = MpackResponseWrapper.class)
Expand All @@ -145,14 +145,14 @@ public Response createMpacks(String body, @Context HttpHeaders headers, @Context
@ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
})
public Response getMpack(String body, @Context HttpHeaders headers, @Context UriInfo ui,
@PathParam("mpack_id") String mpackId) {
@PathParam("id") String id) {

return handleRequest(headers, body, ui, Request.Type.GET,
createMpackResource(mpackId));
createMpackResource(id));
}

@DELETE
@Path("{mpack_id}")
@Path("{id}")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Deletes a selected management pack")
@ApiImplicitParams({
Expand All @@ -166,19 +166,19 @@ public Response getMpack(String body, @Context HttpHeaders headers, @Context Uri
@ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
@ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
})
public Response deleteMpack(String body, @Context HttpHeaders headers, @Context UriInfo ui, @PathParam("mpack_id") String mpackId) {
public Response deleteMpack(String body, @Context HttpHeaders headers, @Context UriInfo ui, @PathParam("id") String id) {
return handleRequest(headers, body, ui, Request.Type.DELETE,
createMpackResource(mpackId));
createMpackResource(id));
}

/**
* Create an mpack resource instance
* @param mpackId
* @param id
* @return ResourceInstance
*/
private ResourceInstance createMpackResource(String mpackId) {
private ResourceInstance createMpackResource(String id) {
return createResource(Resource.Type.Mpack,
Collections.singletonMap(Resource.Type.Mpack, mpackId));
Collections.singletonMap(Resource.Type.Mpack, id));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public RootClusterSettingService() {
response = ReadOnlyConfigurationResponse.ReadOnlyConfigurationResponseSwagger.class, responseContainer = RESPONSE_CONTAINER_LIST)
@ApiImplicitParams({
@ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
paramType = PARAM_TYPE_QUERY, defaultValue = MpackResourceProvider.MPACK_ID),
paramType = PARAM_TYPE_QUERY, defaultValue = MpackResourceProvider.MPACK_RESOURCE_ID),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one was an error. Mpackid will not come in the context of clustersettings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mradha25 you are right. I just did a find an replace. @swapanshridhar can you check this and fix it in your next patch?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jayush Sure. Vl take care.

@ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION, dataType = DATA_TYPE_STRING,
paramType = PARAM_TYPE_QUERY),
@ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@
*/
public class MpackRequest {

private Long mpackId;
private Long id;
private Long registryId;
private String mpackName;
private String mpackVersion;
private String mpackUri;
private Long registryId;

public MpackRequest(Long mpackId) {
this.setMpackId(mpackId);
public MpackRequest(Long id) {
this.setId(id);
}

public MpackRequest() {
}

public Long getMpackId() {
return mpackId;
public Long getId() {
return id;
}

public void setMpackId(Long mpackId) {
this.mpackId = mpackId;
public void setId(Long id) {
this.id = id;
}

public String getMpackName() {
Expand Down Expand Up @@ -82,7 +82,7 @@ public void setRegistryId(Long registryId) {
@Override
public int hashCode() {
int result = 1;
result = 31 + getMpackId().hashCode();
result = 31 + getId().hashCode();
return result;
}

Expand All @@ -96,11 +96,11 @@ public boolean equals(Object obj) {
}
MpackRequest mpackRequest = (MpackRequest) obj;

if (mpackId == null) {
if (mpackRequest.mpackId != null) {
if (id == null) {
if (mpackRequest.id != null) {
return false;
}
} else if (!mpackId.equals(mpackRequest.mpackId)) {
} else if (!id.equals(mpackRequest.id)) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,86 +27,93 @@
*/
public class MpackResponse {

private Long mpackId;
private String mpackVersion;
private Long id;
private String mpackId;
private String mpackName;
private String mpackVersion;
private String mpackUri;
private Long registryId;
private String stackId;
private String description;

public MpackResponse(Mpack mpack) {
this.id = mpack.getResourceId();
this.mpackId = mpack.getMpackId();
this.mpackName = mpack.getName();
this.mpackVersion = mpack.getVersion();
this.mpackUri = mpack.getMpackUri();
this.mpackName = mpack.getName();
this.registryId = mpack.getRegistryId();
this.stackId = mpack.getStackId();
this.description = mpack.getDescription();
}

public String getMpackVersion() {
return mpackVersion;
public Long getId() {
return id;
}

public String getMpackUri() {
return mpackUri;
public void setId(Long id) {
this.id = id;
}

public Long getMpackId() {
return mpackId;
public Long getRegistryId() {
return registryId;
}

public String getStackId() {
return stackId;
public void setRegistryId(Long registryId) {
this.registryId = registryId;
}

public void setStackId(String stackId) {
this.stackId = stackId;
public String getMpackId() {
return mpackId;
}

public void setMpackId(String mpackId) {
this.mpackId = mpackId;
}

public String getMpackName() {
return mpackName;
}

public Long getRegistryId() {
return registryId;
public void setMpackName(String mpackName) {
this.mpackName = mpackName;
}

public void setMpackVersion(String mpackVersion) {
this.mpackVersion = mpackVersion;
public String getDescription() {
return description;
}

public void setMpackName(String mpackName) {
this.mpackName = mpackName;
public void setDescription(String description) {
this.description = description;
}

public void setMpackUri(String mpackUri) {
this.mpackUri = mpackUri;
public String getMpackVersion() {
return mpackVersion;
}

public void setRegistryId(Long registryId) {
this.registryId = registryId;
public void setMpackVersion(String mpackVersion) {
this.mpackVersion = mpackVersion;
}

public void setMpackId(Long mpackId) {
this.mpackId = mpackId;
public String getMpackUri() {
return mpackUri;
}


public String getDescription() {
return description;
public void setMpackUri(String mpackUri) {
this.mpackUri = mpackUri;
}

public void setDescription(String description) {
this.description = description;
public String getStackId() {
return stackId;
}

public void setStackId(String stackId) {
this.stackId = stackId;
}

@Override
public int hashCode() {
int result = 1;
result = 31 + getMpackId().hashCode();
result = 31 + getId().hashCode();
return result;
}

Expand All @@ -119,7 +126,7 @@ public boolean equals(Object obj) {
return true;
}
MpackResponse MpackResponse = (MpackResponse) obj;
return getMpackId().equals(MpackResponse.getMpackId());
return getId().equals(MpackResponse.getId());
}

public interface MpackResponseWrapper extends ApiModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@
*/
public class RegistryMpackResponse {
private Long registryId;
private String mpackId;
private String mpackName;
private String mpackDisplayName;
private String mpackDescription;
private String mpackLogoUrl;
private String mpackLogoUri;

/**
* Constructor
* @param registryId registry id
* @param mpackId mpack id
* @param mpackName mpack name
* @param mpackDisplayName mpack Display Name
* @param mpackDescription mpack description
* @param mpackLogoUrl mpack logo url
* @param mpackLogoUri mpack logo uri
*/
public RegistryMpackResponse(Long registryId, String mpackName, String mpackDisplayName, String mpackDescription, String mpackLogoUrl) {
public RegistryMpackResponse(Long registryId, String mpackId, String mpackName, String mpackDescription, String mpackLogoUri) {
this.registryId = registryId;
this.mpackName = mpackName;
this.mpackDisplayName = mpackDisplayName;
this.mpackId = mpackId;
this.mpackDescription = mpackDescription;
this.mpackLogoUrl = mpackLogoUrl;
this.mpackLogoUri = mpackLogoUri;
}

/**
Expand All @@ -55,6 +55,15 @@ public Long getRegistryId() {
return registryId;
}

/**
* Get mpack id
* @return mpack id
*/
public String getMpackId() {
return mpackId;
}


/**
* Get mpack name
* @return mpack name
Expand All @@ -63,12 +72,6 @@ public String getMpackName() {
return mpackName;
}

/**
* Get mpack summary
* @return
*/
public String getMpackDisplayName() {return mpackDisplayName;}

/**
* Get mpack description
* @return mpack description
Expand All @@ -78,11 +81,11 @@ public String getMpackDescription() {
}

/**
* Get mpack logo url
* @return mpack logo url
* Get mpack logo uri
* @return mpack logo uri
*/
public String getMpackLogoUrl() {
return mpackLogoUrl;
public String getMpackLogoUri() {
return mpackLogoUri;
}

/**
Expand Down
Loading