aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java4
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java5
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityTypeOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperation.java4
-rw-r--r--catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/req-and-capabilities.service.ts2
-rw-r--r--catalog-ui/src/app/ng2/services/tosca-types.service.ts12
6 files changed, 18 insertions, 11 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java
index be9b519e18..c070d89fd4 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java
@@ -566,9 +566,9 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic {
.equals(capabilityDefinition.getUniqueId()));
}
- public Either<Map<String, CapabilityTypeDefinition>, ResponseFormat> getAllCapabilityTypes() {
+ public Either<Map<String, CapabilityTypeDefinition>, ResponseFormat> getAllCapabilityTypes(String modelName) {
Either<Map<String, CapabilityTypeDefinition>, JanusGraphOperationStatus> capabilityTypeCacheAll = capabilityTypeOperation
- .getAllCapabilityTypes();
+ .getAllCapabilityTypes(modelName);
if (capabilityTypeCacheAll.isRight()) {
JanusGraphOperationStatus operationStatus = capabilityTypeCacheAll.right().value();
if (JanusGraphOperationStatus.NOT_FOUND == operationStatus) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java
index cafcbfd211..c3c42e27f5 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java
@@ -184,7 +184,8 @@ public class TypesFetchServlet extends AbstractValidationsServlet {
@ApiResponse(responseCode = "404", description = "Capability types not found")})
@PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
public Response getAllCapabilityTypesServlet(@Context final HttpServletRequest request,
- @HeaderParam(value = Constants.USER_ID_HEADER) String userId) {
+ @HeaderParam(value = Constants.USER_ID_HEADER) String userId,
+ @Parameter(description = "model", required = false) @QueryParam("model") String modelName) {
Wrapper<Response> responseWrapper = new Wrapper<>();
Wrapper<User> userWrapper = new Wrapper<>();
try {
@@ -193,7 +194,7 @@ public class TypesFetchServlet extends AbstractValidationsServlet {
if (responseWrapper.isEmpty()) {
String url = request.getMethod() + " " + request.getRequestURI();
log.debug("Start handle request of {} | modifier id is {}", url, userId);
- Either<Map<String, CapabilityTypeDefinition>, ResponseFormat> allDataTypes = capabilitiesBusinessLogic.getAllCapabilityTypes();
+ Either<Map<String, CapabilityTypeDefinition>, ResponseFormat> allDataTypes = capabilitiesBusinessLogic.getAllCapabilityTypes(modelName);
if (allDataTypes.isRight()) {
log.info("Failed to get all capability types. Reason - {}", allDataTypes.right().value());
Response errorResponse = buildErrorResponse(allDataTypes.right().value());
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityTypeOperation.java
index 88485d7c74..0e7faf7fc1 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/ICapabilityTypeOperation.java
@@ -46,5 +46,5 @@ public interface ICapabilityTypeOperation {
public Either<CapabilityTypeDefinition, StorageOperationStatus> getCapabilityType(String uniqueId, boolean inTransaction);
- Either<Map<String, CapabilityTypeDefinition>, JanusGraphOperationStatus> getAllCapabilityTypes();
+ Either<Map<String, CapabilityTypeDefinition>, JanusGraphOperationStatus> getAllCapabilityTypes(String modelName);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperation.java
index 0763559af5..f4073baa3d 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperation.java
@@ -409,11 +409,11 @@ public class CapabilityTypeOperation extends AbstractOperation implements ICapab
return getCapabilityType(uniqueId, true);
}
- public Either<Map<String, CapabilityTypeDefinition>, JanusGraphOperationStatus> getAllCapabilityTypes() {
+ public Either<Map<String, CapabilityTypeDefinition>, JanusGraphOperationStatus> getAllCapabilityTypes(String modelName) {
Map<String, CapabilityTypeDefinition> capabilityTypes = new HashMap<>();
Either<Map<String, CapabilityTypeDefinition>, JanusGraphOperationStatus> result = Either.left(capabilityTypes);
Either<List<CapabilityTypeData>, JanusGraphOperationStatus> getAllCapabilityTypes = janusGraphGenericDao
- .getByCriteria(NodeTypeEnum.CapabilityType, null, CapabilityTypeData.class);
+ .getByCriteriaForModel(NodeTypeEnum.CapabilityType, null, modelName, CapabilityTypeData.class);
if (getAllCapabilityTypes.isRight()) {
JanusGraphOperationStatus status = getAllCapabilityTypes.right().value();
if (status != JanusGraphOperationStatus.NOT_FOUND) {
diff --git a/catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/req-and-capabilities.service.ts b/catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/req-and-capabilities.service.ts
index f9b98c6b96..f999c2e627 100644
--- a/catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/req-and-capabilities.service.ts
+++ b/catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/req-and-capabilities.service.ts
@@ -44,7 +44,7 @@ export class ReqAndCapabilitiesService {
if (!this.capabilitiesListUpdated){
// -- COMMON for both --
this.capabilityTypesList = [];
- let capabilityTypesResult = await this.toscaTypesServiceNg2.fetchCapabilityTypes();
+ let capabilityTypesResult = await this.toscaTypesServiceNg2.fetchCapabilityTypes(this.workspaceService.metadata.model);
Object.keys(capabilityTypesResult).forEach(key => {this.capabilityTypesList.push(capabilityTypesResult[key])})
this.capabilitiesListUpdated = true;
}
diff --git a/catalog-ui/src/app/ng2/services/tosca-types.service.ts b/catalog-ui/src/app/ng2/services/tosca-types.service.ts
index 2fc2e7a089..fc728111bd 100644
--- a/catalog-ui/src/app/ng2/services/tosca-types.service.ts
+++ b/catalog-ui/src/app/ng2/services/tosca-types.service.ts
@@ -40,15 +40,21 @@ export class ToscaTypesServiceNg2 {
}
async fetchRelationshipTypes(modelName: string): Promise<RelationshipTypesMap> {
- return this.http.get<RelationshipTypesMap>(this.baseUrl + 'relationshipTypes', {params: {model: modelName}}).toPromise();
+ if(modelName) {
+ return this.http.get<RelationshipTypesMap>(this.baseUrl + 'relationshipTypes', {params: {model: modelName}}).toPromise();
+ }
+ return this.http.get<RelationshipTypesMap>(this.baseUrl + 'relationshipTypes').toPromise();
}
async fetchNodeTypes(): Promise<NodeTypesMap> {
return this.http.get<NodeTypesMap>(this.baseUrl + 'nodeTypes').toPromise();
}
- async fetchCapabilityTypes(): Promise<CapabilityTypesMap> {
+ async fetchCapabilityTypes(modelName: string): Promise<CapabilityTypesMap> {
+ if(modelName) {
+ return this.http.get<CapabilityTypesMap>(this.baseUrl + 'capabilityTypes', {params: {model: modelName}}).toPromise();
+ }
return this.http.get<CapabilityTypesMap>(this.baseUrl + 'capabilityTypes').toPromise();
- }
+ }
}