2 * Created by ob0695 on 6/26/2018.
5 * ============LICENSE_START=======================================================
7 * ================================================================================
8 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
9 * ================================================================================
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 * ============LICENSE_END=========================================================
24 import * as _ from "lodash";
25 import {Injectable, Inject} from '@angular/core';
26 import {Observable} from 'rxjs/Observable';
27 import 'rxjs/add/operator/map';
28 import 'rxjs/add/operator/toPromise';
32 InstancePropertiesAPIMap,
33 FilterPropertiesAssignmentData,
38 IAttributeModel, Capability, Requirement
40 import {ArtifactGroupType, COMPONENT_FIELDS} from "app/utils";
41 import {ComponentGenericResponse} from "../responses/component-generic-response";
42 import {InstanceBePropertiesMap} from "../../../models/properties-inputs/property-fe-map";
43 import {API_QUERY_PARAMS} from "app/utils";
44 import {ComponentType, ServerTypeUrl, SERVICE_FIELDS} from "../../../utils/constants";
45 import {SdcConfigToken, ISdcConfig} from "../../config/sdc-config.config";
46 import {IDependenciesServerResponse} from "../responses/dependencies-server-response";
47 import {AutomatedUpgradeGenericResponse} from "../responses/automated-upgrade-response";
48 import {IAutomatedUpgradeRequestObj} from "../../pages/automated-upgrade/automated-upgrade.service";
49 import {ComponentInstance} from "../../../models/componentsInstances/componentInstance";
50 import {CommonUtils} from "../../../utils/common-utils";
51 import {RelationshipModel} from "../../../models/graph/relationship";
52 import {ServiceGenericResponse} from "../responses/service-generic-response";
53 import { HttpClient, HttpParams, HttpHeaders } from "@angular/common/http";
54 import { HttpHelperService } from "../http-hepler.service";
56 Component as TopologyTemplate,
57 FullComponentInstance,
61 import { ConsumptionInput } from "../../components/logic/service-consumption/service-consumption.component";
62 import { ConstraintObject } from "../../components/logic/service-dependencies/service-dependencies.component";
63 import { ComponentMetadata } from "../../../models/component-metadata";
64 import { PolicyInstance } from "../../../models/graph/zones/policy-instance";
65 import { PropertyBEModel } from "../../../models/properties-inputs/property-be-model";
67 /* we need to use this service from now, we will remove component.service when we finish remove the angular1.
68 The service is duplicated since we can not use downgrades service with NGXS*/
71 export class TopologyTemplateService {
75 constructor(protected http: HttpClient, @Inject(SdcConfigToken) sdcConfig: ISdcConfig) {
76 this.baseUrl = sdcConfig.api.root + sdcConfig.api.component_api_root;
79 getFullComponent(componentType: string, uniqueId: string): Observable<Component> {
80 return this.http.get<Component>(this.baseUrl + this.getServerTypeUrl(componentType) + uniqueId);
83 getComponentMetadata(uniqueId: string, type: string): Observable<ComponentGenericResponse> {
84 return this.getComponentDataByFieldsName(type, uniqueId, [COMPONENT_FIELDS.COMPONENT_METADATA]);
87 getComponentInstanceAttributesAndProperties(uniqueId: string, type: string): Observable<ComponentGenericResponse> {
88 return this.getComponentDataByFieldsName(type, uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_PROPERTIES, COMPONENT_FIELDS.COMPONENT_INSTANCES_ATTRIBUTES]);
91 async getComponentAttributes(componentType: string, componentId: string): Promise<ComponentGenericResponse> {
92 return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_ATTRIBUTES]).toPromise();
95 getComponentCompositionData(componentUniqueId: string, componentType: string): Observable<ComponentGenericResponse> {
96 const params: string[] = [COMPONENT_FIELDS.COMPONENT_INSTANCES_RELATION, COMPONENT_FIELDS.COMPONENT_INSTANCES,
97 COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_POLICIES, COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_GROUPS];
98 if (componentType === ComponentType.SERVICE) {
99 params.push(COMPONENT_FIELDS.FORWARDING_PATHS);
101 return this.getComponentDataByFieldsName(componentType, componentUniqueId, params);
104 getComponentResourcePropertiesData(component: Component): Observable<ComponentGenericResponse> {
105 return this.getComponentDataByFieldsName(component.componentType, component.uniqueId,
106 [COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_POLICIES, COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_GROUPS]);
109 getComponentResourceInstances(component: Component): Observable<ComponentGenericResponse> {
110 return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES]);
113 getComponentInputs(component: Component): Observable<ComponentGenericResponse> {
114 return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INPUTS]);
117 getComponentInputsWithProperties(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
118 return this.getComponentDataByFieldsName(componentType, componentId,
119 [COMPONENT_FIELDS.COMPONENT_INPUTS, COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_INSTANCES_PROPERTIES, COMPONENT_FIELDS.COMPONENT_PROPERTIES]);
122 getComponentDeploymentArtifacts(component: Component): Observable<ComponentGenericResponse> {
123 return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_DEPLOYMENT_ARTIFACTS]);
126 getComponentInformationalArtifacts(component: Component): Observable<ComponentGenericResponse> {
127 return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INFORMATIONAL_ARTIFACTS]);
130 getComponentInformationalArtifactsAndInstances(component: Component): Observable<ComponentGenericResponse> {
131 return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INFORMATIONAL_ARTIFACTS, COMPONENT_FIELDS.COMPONENT_INSTANCES]);
134 getComponentToscaArtifacts(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
135 return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_TOSCA_ARTIFACTS]);
138 getComponentProperties(component: Component): Observable<ComponentGenericResponse> {
139 return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_PROPERTIES]);
142 getCapabilitiesAndRequirements(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
143 return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_REQUIREMENTS, COMPONENT_FIELDS.COMPONENT_CAPABILITIES]);
146 getRequirementsAndCapabilitiesWithProperties(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
147 return this.getComponentDataByFieldsName(componentType, componentId,
148 [COMPONENT_FIELDS.COMPONENT_REQUIREMENTS, COMPONENT_FIELDS.COMPONENT_CAPABILITIES, COMPONENT_FIELDS.COMPONENT_CAPABILITIES_PROPERTIES]);
151 getDeploymentGraphData(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
152 return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_RELATION, COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_GROUPS]);
155 createInput(component: Component, inputsToCreate: InstancePropertiesAPIMap, isSelf: boolean): Observable<any> {
156 const inputs = isSelf ? { serviceProperties: inputsToCreate.componentInstanceProperties } : inputsToCreate;
157 return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/create/inputs', inputs);
160 restoreComponent(componentType: string, componentId: string) {
161 return this.http.post(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/restore', {});
164 archiveComponent(componentType: string, componentId: string) {
165 return this.http.post(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/archive', {});
168 deleteInput(component: Component, input: InputBEModel): Observable<InputBEModel> {
169 return this.http.delete<InputBEModel>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/delete/' + input.uniqueId + '/input')
171 return new InputBEModel(res);
175 updateComponentInputs(component: Component, inputs: InputBEModel[]): Observable<InputBEModel[]> {
176 return this.http.post<InputBEModel[]>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/update/inputs', inputs)
178 return res.map((input) => new InputBEModel(input));
182 filterComponentInstanceProperties(component: Component, filterData: FilterPropertiesAssignmentData): Observable<InstanceBePropertiesMap> {// instance-property-be-map
183 let params: HttpParams = new HttpParams();
184 _.forEach(filterData.selectedTypes, (type: string) => {
185 params = params.append('resourceType', type);
188 // tslint:disable-next-line:object-literal-shorthand
189 return this.http.get<InstanceBePropertiesMap>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/filteredproperties/' + filterData.propertyName, {params: params});
192 createServiceProperty(componentId: string, propertyModel: PropertyBEModel): Observable<PropertyBEModel> {
193 const serverObject = {};
194 serverObject[propertyModel.name] = propertyModel;
195 return this.http.post<PropertyBEModel>(this.baseUrl + 'services/' + componentId + '/properties', serverObject)
197 const property: PropertyBEModel = new PropertyBEModel(res);
202 getServiceProperties(componentId: string): Observable<PropertyBEModel[]> {
203 return this.http.get<any>(this.baseUrl + 'services/' + componentId + '/properties')
206 return new Array<PropertyBEModel>();
208 return CommonUtils.initBeProperties(res);
212 updateServiceProperties(componentId: string, properties: PropertyBEModel[]) {
213 return this.http.put<any>( this.baseUrl + 'services/' + componentId + '/properties', properties)
216 return _.map(resJson,
217 (resValue: PropertyBEModel) => new PropertyBEModel(resValue));
221 deleteServiceProperty(componentId: string, property: PropertyBEModel): Observable<string> {
222 return this.http.delete(this.baseUrl + 'services/' + componentId + '/properties/' + property.uniqueId )
223 .map((res: Response) => {
224 return property.uniqueId;
228 getDependencies(componentType: string, componentId: string): Observable<IDependenciesServerResponse[]> {
229 return this.http.get<IDependenciesServerResponse[]>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/dependencies');
232 automatedUpgrade(componentType: string, componentId: string, componentsIdsToUpgrade: IAutomatedUpgradeRequestObj[]): Observable<AutomatedUpgradeGenericResponse> {
233 return this.http.post<AutomatedUpgradeGenericResponse>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/automatedupgrade', componentsIdsToUpgrade);
236 updateComponentInstance(componentMetaDataId: string, componentInstance:ComponentInstance): Observable<ComponentInstance> {
237 return this.http.post<ComponentInstance>(this.baseUrl + 'services/' + componentMetaDataId + '/resourceInstance/' + componentInstance.uniqueId, componentInstance);
240 updateMultipleComponentInstances(componentId: string, componentType: string, instances: ComponentInstance[]): Observable<ComponentInstance[]> {
241 return this.http.post<ComponentInstance[]>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/resourceInstance/multipleComponentInstance', instances)
243 return CommonUtils.initComponentInstances(res);
247 createRelation(componentId: string, componentType: string, link: RelationshipModel): Observable<RelationshipModel> {
248 return this.http.post<RelationshipModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/resourceInstance/associate', link)
250 return new RelationshipModel(res);
254 deleteRelation(componentId: string, componentType: string, link: RelationshipModel): Observable<RelationshipModel> {
255 return this.http.put<RelationshipModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/resourceInstance/dissociate', link)
257 return new RelationshipModel(res);
261 createComponentInstance(componentType: string, componentId: string, componentInstance: ComponentInstance): Observable<ComponentInstance> {
262 return this.http.post<ComponentInstance>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/resourceInstance', componentInstance)
264 return new ComponentInstance(res);
268 deleteComponentInstance(componentType: string, componentId: string, componentInstanceId: string): Observable<ComponentInstance> {
269 return this.http.delete<ComponentInstance>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/resourceInstance/' + componentInstanceId)
271 return new ComponentInstance(res);
275 fetchRelation(componentType: string, componentId: string, linkId: string): Observable<RelationshipModel> {
276 return this.http.get<RelationshipModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/relationId/' + linkId)
278 return new RelationshipModel(res);
282 addOrUpdateArtifact = (componentType: string, componentId: string, artifact: ArtifactModel): Observable<ArtifactModel> => {
283 let headerObj: HttpHeaders = new HttpHeaders();
284 if (artifact.payloadData) {
285 headerObj = headerObj.append('Content-MD5', HttpHelperService.getHeaderMd5(artifact));
288 let artifactID: string = '';
289 if (artifact.uniqueId) {
290 artifactID = '/' + artifact.uniqueId;
292 return this.http.post<ArtifactModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/artifacts' + artifactID, JSON.stringify(artifact), {headers: headerObj}).map(
293 (res) => new ArtifactModel(res)
297 deleteArtifact = (componentId: string, componentType: string, artifactId: string, artifactLabel: string): Observable<ArtifactModel> => {
298 return this.http.delete<ArtifactModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/artifacts/' + artifactId + '?operation=' + artifactLabel)
299 .map((res) => new ArtifactModel(res));
302 downloadArtifact = (componentType: string, componentId: string, artifactId: string): Observable<IFileDownload> => {
303 return this.http.get<IFileDownload>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/artifacts/' + artifactId);
306 // ------------------------------------------------ Properties API --------------------------------------------------//
307 addProperty = (componentType: string, componentId: string, property: PropertyModel):Observable<PropertyModel> => {
308 return this.http.post<PropertyModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/properties', property.convertToServerObject()).map((response) => {
309 return new PropertyModel(response[Object.keys(response)[0]]);
313 updateProperty = (componentType: string, componentId: string, property: PropertyModel): Observable<PropertyModel> => {
314 var propertiesList:PropertyBEModel[] = [property];
315 return this.http.put<PropertyModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/properties', propertiesList)
317 return new PropertyModel(response[Object.keys(response)[0]]);
321 deleteProperty = (componentType: string, componentId: string, propertyId: string): Observable<PropertyModel> => {
322 return this.http.delete<PropertyModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/properties/' + propertyId);
325 // ------------------------------------------------ Attributes API --------------------------------------------------//
326 addAttribute = (componentType: string, componentId: string, attribute: AttributeModel): Observable<AttributeModel> => {
327 return this.http.post<AttributeModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/attributes', attribute.convertToServerObject())
329 return new AttributeModel(response);
333 updateAttribute = (componentType: string, componentId: string, attribute: AttributeModel): Observable<AttributeModel> => {
334 const payload = attribute.convertToServerObject();
336 return this.http.put<AttributeModel>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/attributes/' + attribute.uniqueId, payload)
338 return new AttributeModel(response);
343 addAttributeAsync = async (componentType: string, componentId: string, attribute: AttributeModel): Promise<AttributeModel> => {
344 return this.addAttribute(componentType, componentId, attribute).toPromise();
347 updateAttributeAsync = async (componentType: string, componentId: string, attribute: AttributeModel): Promise<AttributeModel> => {
348 return this.updateAttribute(componentType, componentId, attribute).toPromise();
351 deleteAttributeAsync = async (componentType: string, componentId: string, attribute: AttributeModel): Promise<any> => {
352 return this.http.delete<any>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/attributes/' + attribute.uniqueId, {}).toPromise();
355 getArtifactsByType(componentType: string, componentId: string, artifactsType: ArtifactGroupType) {
356 return this.getComponentDataByFieldsName(componentType, componentId, [this.convertArtifactTypeToUrl(artifactsType)]);
359 getServiceConsumptionData(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
360 return this.getComponentDataByFieldsName(componentType, componentId, [
361 // COMPONENT_FIELDS.COMPONENT_INSTANCES_INTERFACES,
362 COMPONENT_FIELDS.COMPONENT_INSTANCES_PROPERTIES,
363 // COMPONENT_FIELDS.COMPONENT_INSTANCES_INPUTS,
364 COMPONENT_FIELDS.COMPONENT_INPUTS,
365 COMPONENT_FIELDS.COMPONENT_INSTANCES,
366 COMPONENT_FIELDS.COMPONENT_CAPABILITIES
370 getServiceConsumptionInputs(componentMetaDataId: string, serviceInstanceId: string, interfaceId: string, operation: OperationModel): Observable<ConsumptionInput[]> {
371 return this.http.get<ConsumptionInput[]>
372 (this.baseUrl + 'services/' + componentMetaDataId + '/consumption/' + serviceInstanceId + '/interfaces/' + interfaceId + '/operations/' + operation.uniqueId + '/inputs');
375 createOrUpdateServiceConsumptionInputs(componentMetaDataId: string, serviceInstanceId: string, consumptionInputsList: Array<{[id: string]: ConsumptionInput[]}>): Observable<any> {
376 return this.http.post(this.baseUrl + 'services/' + componentMetaDataId + '/consumption/' + serviceInstanceId, consumptionInputsList);
379 getServiceFilterConstraints(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
380 return this.getComponentDataByFieldsName(componentType, componentId, [SERVICE_FIELDS.NODE_FILTER]);
383 getComponentInstanceProperties(componentType: string, componentId: string): Observable<ComponentGenericResponse> {
384 return this.getComponentDataByFieldsName(componentType, componentId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_PROPERTIES]);
387 createServiceFilterConstraints(componentMetaDataId: string, componentInstanceId: string, constraint: ConstraintObject): Observable<any> {
388 return this.http.post<any>(this.baseUrl + 'services/' + componentMetaDataId + '/resourceInstances/' + componentInstanceId + '/nodeFilter', constraint);
391 updateServiceFilterConstraints(componentMetaDataId: string, componentInstanceId: string, constraints: ConstraintObject[]):Observable<any> {
392 return this.http.put<any>(this.baseUrl + 'services/' + componentMetaDataId + '/resourceInstances/' + componentInstanceId + '/nodeFilter', constraints)
395 deleteServiceFilterConstraints(componentMetaDataId: string, componentInstanceId: string, constraintIndex: number): Observable<any>{
396 return this.http.delete<any>(this.baseUrl + 'services/' + componentMetaDataId + '/resourceInstances/' + componentInstanceId + '/nodeFilter/' + constraintIndex)
399 deletePolicy(component: Component, policy: PolicyInstance): Observable<PolicyInstance> {
400 return this.http.put<PolicyInstance>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/policies/' + policy.uniqueId + '/undeclare', policy)
403 createListInput(componentId: string, input: any, isSelf: boolean): Observable<any> {
406 // change componentInstanceProperties -> serviceProperties
408 componentInstInputsMap: {
409 serviceProperties: input.componentInstInputsMap.componentInstanceProperties
411 listInput: input.listInput
416 return this.http.post<any>(this.baseUrl + 'services/' + componentId + '/create/listInput', inputs);
419 createPolicy(component: Component, policiesToCreate: InstancePropertiesAPIMap, isSelf: boolean): Observable<any> {
422 // tslint:disable-next-line:object-literal-key-quotes
423 {'componentPropertiesToPolicies': {
424 ...policiesToCreate.componentInstanceProperties
427 // tslint:disable-next-line:object-literal-key-quotes
428 {'componentInstancePropertiesToPolicies': {
429 ...policiesToCreate.componentInstanceProperties
432 return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/create/policies', policiesList);
435 protected getComponentDataByFieldsName(componentType: string, componentId: string, fields: string[]): Observable<ComponentGenericResponse> {
436 let params: HttpParams = new HttpParams();
437 _.forEach(fields, (field: string): void => {
438 params = params.append(API_QUERY_PARAMS.INCLUDE, field);
440 // tslint:disable-next-line:object-literal-shorthand
441 return this.http.get<ComponentGenericResponse>(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/filteredDataByParams', {params: params})
443 return componentType === ComponentType.SERVICE ? new ServiceGenericResponse().deserialize(res) :
444 new ComponentGenericResponse().deserialize(res);
448 private getServerTypeUrl = (componentType: string): string => {
449 switch (componentType) {
450 case ComponentType.SERVICE:
451 case ComponentType.SERVICE_PROXY:
452 return ServerTypeUrl.SERVICES;
454 return ServerTypeUrl.RESOURCES;
458 private convertArtifactTypeToUrl = (artifactType: ArtifactGroupType): string => {
459 switch (artifactType) {
460 case ArtifactGroupType.TOSCA:
461 return COMPONENT_FIELDS.COMPONENT_TOSCA_ARTIFACTS;
462 case ArtifactGroupType.INFORMATION:
463 return COMPONENT_FIELDS.COMPONENT_INFORMATIONAL_ARTIFACTS;
464 case ArtifactGroupType.DEPLOYMENT:
465 return COMPONENT_FIELDS.COMPONENT_DEPLOYMENT_ARTIFACTS;
466 case ArtifactGroupType.SERVICE_API:
467 return COMPONENT_FIELDS.SERVICE_API_ARTIFACT;
471 // createCapability(component: Component, capabilityData: Capability): Observable<Capability[]> {
472 createCapability(type: string, uniqueId: string, capabilityData: Capability): Observable<Capability[]> {
475 [capabilityData.type]: [capabilityData]
478 return this.http.post<any>(this.baseUrl + type + uniqueId + '/capabilities', capBEObj);
481 updateCapability(type: string, uniqueId: string, capabilityData: Capability): Observable<Capability[]> {
484 [capabilityData.type]: [capabilityData]
487 return this.http.put<any>(this.baseUrl + type + uniqueId + '/capabilities', capBEObj);
490 deleteCapability(component: Component, capId: string): Observable<Capability> {
491 return this.http.delete<Capability>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/capabilities/' + capId);
494 createRequirement(type: string, uniqueId: string, requirementData: Requirement): Observable<any> {
497 [requirementData.capability]: [requirementData]
500 return this.http.post(this.baseUrl + type + uniqueId + '/requirements', reqBEObj);
503 updateRequirement(type: string, uniqueId: string, requirementData: Requirement): Observable<any> {
506 [requirementData.capability]: [requirementData]
509 return this.http.put(this.baseUrl + type + uniqueId + '/requirements', reqBEObj);
512 deleteRequirement(component: Component, reqId: string): Observable<Requirement> {
513 return this.http.delete<Requirement>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/requirements/' + reqId);