test_class.declarator: alienDao
test_class.modifier: @Resource(name = "alien-es-dao")
      private
test_class.original_string: @Resource(name = "alien-es-dao")
      private IGenericSearchDAO alienDao;
test_class.type: IGenericSearchDAO
test_class.var_name: alienDao
test_class.declarator: serviceResourceService
test_class.modifier: @Inject
      private
test_class.original_string: @Inject
      private ServiceResourceService serviceResourceService;
test_class.type: ServiceResourceService
test_class.var_name: serviceResourceService
test_class.file: alien4cloud-core/src/test/java/org/alien4cloud/alm/service/ServiceResourceServiceTest.java
test_class.identifier: ServiceResourceServiceTest
test_case.body: @Test
      public void testReportArchiveUsage() {
          ServiceResource serviceResource = new ServiceResource();
          serviceResource.setId("service1");
          serviceResource.setName("service name 1");
          serviceResource.setDependency(new CSARDependency("org.alien4cloud.archives:my-archive", "1.0.0-SNAPSHOT"));
  
          alienDao.save(serviceResource);
  
          ArchiveUsageRequestEvent archiveUsageRequestEvent = new ArchiveUsageRequestEvent(this, "org.alien4cloud.archives:my-archive", "1.0.0-SNAPSHOT");
          serviceResourceService.reportArchiveUsage(archiveUsageRequestEvent);
          Assert.assertEquals(1, archiveUsageRequestEvent.getUsages().size());
          Assert.assertEquals("service1", archiveUsageRequestEvent.getUsages().get(0).getResourceId());
          Assert.assertEquals("serviceresource", archiveUsageRequestEvent.getUsages().get(0).getResourceType());
          Assert.assertEquals("service name 1", archiveUsageRequestEvent.getUsages().get(0).getResourceName());
  
          archiveUsageRequestEvent = new ArchiveUsageRequestEvent(this, "org.alien4cloud.archives:other-archive", "1.0.0-SNAPSHOT");
          serviceResourceService.reportArchiveUsage(archiveUsageRequestEvent);
          Assert.assertEquals(0, archiveUsageRequestEvent.getUsages().size());
  
          archiveUsageRequestEvent = new ArchiveUsageRequestEvent(this, "org.alien4cloud.archives:my-archive", "1.0.1-SNAPSHOT");
          serviceResourceService.reportArchiveUsage(archiveUsageRequestEvent);
          Assert.assertEquals(0, archiveUsageRequestEvent.getUsages().size());
      }
test_case.class_method_signature: ServiceResourceServiceTest.testReportArchiveUsage()
test_case.full_signature: @Test public void testReportArchiveUsage()
test_case.identifier: testReportArchiveUsage
test_case.invocations: setId setName setDependency save reportArchiveUsage assertEquals size getUsages assertEquals getResourceId get getUsages assertEquals getResourceType get getUsages assertEquals getResourceName get getUsages reportArchiveUsage assertEquals size getUsages reportArchiveUsage assertEquals size getUsages
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReportArchiveUsage()
focal_class.declarator: alienDAO
focal_class.modifier: @Resource(name = "alien-es-dao")
      private
focal_class.original_string: @Resource(name = "alien-es-dao")
      private IGenericSearchDAO alienDAO;
focal_class.type: IGenericSearchDAO
focal_class.var_name: alienDAO
focal_class.declarator: nodeInstanceService
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private NodeInstanceService nodeInstanceService;
focal_class.type: NodeInstanceService
focal_class.var_name: nodeInstanceService
focal_class.declarator: toscaTypeSearchService
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private IToscaTypeSearchService toscaTypeSearchService;
focal_class.type: IToscaTypeSearchService
focal_class.var_name: toscaTypeSearchService
focal_class.declarator: publisher
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private ApplicationEventPublisher publisher;
focal_class.type: ApplicationEventPublisher
focal_class.var_name: publisher
focal_class.file: alien4cloud-core/src/main/java/org/alien4cloud/alm/service/ServiceResourceService.java
focal_class.identifier: ServiceResourceService
focal_class.class_method_signature: ServiceResourceService.create(String serviceName, String serviceVersion, String serviceNodeType, String serviceNodeVersion)
focal_class.full_signature: public String create(String serviceName, String serviceVersion, String serviceNodeType, String serviceNodeVersion)
focal_class.identifier: create
focal_class.modifiers: public
focal_class.parameters: (String serviceName, String serviceVersion, String serviceNodeType, String serviceNodeVersion)
focal_class.return: String
focal_class.signature: String create(String serviceName, String serviceVersion, String serviceNodeType, String serviceNodeVersion)
focal_class.class_method_signature: ServiceResourceService.create(String serviceName, String serviceVersion, String serviceNodeType, String serviceNodeVersion, String environmentId)
focal_class.full_signature: public String create(String serviceName, String serviceVersion, String serviceNodeType, String serviceNodeVersion, String environmentId)
focal_class.identifier: create
focal_class.modifiers: public
focal_class.parameters: (String serviceName, String serviceVersion, String serviceNodeType, String serviceNodeVersion, String environmentId)
focal_class.return: String
focal_class.signature: String create(String serviceName, String serviceVersion, String serviceNodeType, String serviceNodeVersion, String environmentId)
focal_class.class_method_signature: ServiceResourceService.list(int from, int count)
focal_class.full_signature: public GetMultipleDataResult<ServiceResource> list(int from, int count)
focal_class.identifier: list
focal_class.modifiers: public
focal_class.parameters: (int from, int count)
focal_class.return: GetMultipleDataResult<ServiceResource>
focal_class.signature: GetMultipleDataResult<ServiceResource> list(int from, int count)
focal_class.class_method_signature: ServiceResourceService.search(String searchText, Map<String, String[]> filters, String sortField, boolean desc, int from,
              int count)
focal_class.full_signature: public FacetedSearchResult<ServiceResource> search(String searchText, Map<String, String[]> filters, String sortField, boolean desc, int from,
              int count)
focal_class.identifier: search
focal_class.modifiers: public
focal_class.parameters: (String searchText, Map<String, String[]> filters, String sortField, boolean desc, int from,
              int count)
focal_class.return: FacetedSearchResult<ServiceResource>
focal_class.signature: FacetedSearchResult<ServiceResource> search(String searchText, Map<String, String[]> filters, String sortField, boolean desc, int from,
              int count)
focal_class.class_method_signature: ServiceResourceService.getOrFail(String id)
focal_class.full_signature: public ServiceResource getOrFail(String id)
focal_class.identifier: getOrFail
focal_class.modifiers: public
focal_class.parameters: (String id)
focal_class.return: ServiceResource
focal_class.signature: ServiceResource getOrFail(String id)
focal_class.class_method_signature: ServiceResourceService.update(String resourceId, String name, String version, String description, String nodeType, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes)
focal_class.full_signature: public void update(String resourceId, String name, String version, String description, String nodeType, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes)
focal_class.identifier: update
focal_class.modifiers: public
focal_class.parameters: (String resourceId, String name, String version, String description, String nodeType, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes)
focal_class.return: void
focal_class.signature: void update(String resourceId, String name, String version, String description, String nodeType, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes)
focal_class.class_method_signature: ServiceResourceService.duplicate(String serviceId)
focal_class.full_signature: public String duplicate(String serviceId)
focal_class.identifier: duplicate
focal_class.modifiers: public
focal_class.parameters: (String serviceId)
focal_class.return: String
focal_class.signature: String duplicate(String serviceId)
focal_class.class_method_signature: ServiceResourceService.patch(String resourceId, String name, String version, String description, String nodeType, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes)
focal_class.full_signature: public void patch(String resourceId, String name, String version, String description, String nodeType, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes)
focal_class.identifier: patch
focal_class.modifiers: public
focal_class.parameters: (String resourceId, String name, String version, String description, String nodeType, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes)
focal_class.return: void
focal_class.signature: void patch(String resourceId, String name, String version, String description, String nodeType, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes)
focal_class.class_method_signature: ServiceResourceService.update(String resourceId, String name, String version, String description, String nodeTypeStr, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes, boolean patch)
focal_class.full_signature: private void update(String resourceId, String name, String version, String description, String nodeTypeStr, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes, boolean patch)
focal_class.identifier: update
focal_class.modifiers: private
focal_class.parameters: (String resourceId, String name, String version, String description, String nodeTypeStr, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes, boolean patch)
focal_class.return: void
focal_class.signature: void update(String resourceId, String name, String version, String description, String nodeTypeStr, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues,
              String[] locations, Map<String, String> capabilitiesRelationshipTypes, Map<String, String> requirementsRelationshipTypes, boolean patch)
focal_class.class_method_signature: ServiceResourceService.validateRelationshipTypes(ServiceResource serviceResource, final NodeType nodeType)
focal_class.full_signature: private void validateRelationshipTypes(ServiceResource serviceResource, final NodeType nodeType)
focal_class.identifier: validateRelationshipTypes
focal_class.modifiers: private
focal_class.parameters: (ServiceResource serviceResource, final NodeType nodeType)
focal_class.return: void
focal_class.signature: void validateRelationshipTypes(ServiceResource serviceResource, final NodeType nodeType)
focal_class.class_method_signature: ServiceResourceService.updateLocations(ServiceResource serviceResource, String[] locations)
focal_class.full_signature: private void updateLocations(ServiceResource serviceResource, String[] locations)
focal_class.identifier: updateLocations
focal_class.modifiers: private
focal_class.parameters: (ServiceResource serviceResource, String[] locations)
focal_class.return: void
focal_class.signature: void updateLocations(ServiceResource serviceResource, String[] locations)
focal_class.class_method_signature: ServiceResourceService.failUpdateIfManaged(ServiceResource serviceResource, boolean patch, String name, String version, String nodeTypeStr, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues)
focal_class.full_signature: private void failUpdateIfManaged(ServiceResource serviceResource, boolean patch, String name, String version, String nodeTypeStr, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues)
focal_class.identifier: failUpdateIfManaged
focal_class.modifiers: private
focal_class.parameters: (ServiceResource serviceResource, boolean patch, String name, String version, String nodeTypeStr, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues)
focal_class.return: void
focal_class.signature: void failUpdateIfManaged(ServiceResource serviceResource, boolean patch, String name, String version, String nodeTypeStr, String nodeTypeVersion,
              Map<String, AbstractPropertyValue> nodeProperties, Map<String, Capability> nodeCapabilities, Map<String, String> nodeAttributeValues)
focal_class.class_method_signature: ServiceResourceService.save(ServiceResource serviceResource, boolean ensureUniqueness)
focal_class.full_signature: public synchronized void save(ServiceResource serviceResource, boolean ensureUniqueness)
focal_class.identifier: save
focal_class.modifiers: public synchronized
focal_class.parameters: (ServiceResource serviceResource, boolean ensureUniqueness)
focal_class.return: void
focal_class.signature: void save(ServiceResource serviceResource, boolean ensureUniqueness)
focal_class.class_method_signature: ServiceResourceService.save(ServiceResource serviceResource)
focal_class.full_signature: public synchronized void save(ServiceResource serviceResource)
focal_class.identifier: save
focal_class.modifiers: public synchronized
focal_class.parameters: (ServiceResource serviceResource)
focal_class.return: void
focal_class.signature: void save(ServiceResource serviceResource)
focal_class.class_method_signature: ServiceResourceService.delete(String id)
focal_class.full_signature: public synchronized void delete(String id)
focal_class.identifier: delete
focal_class.modifiers: public synchronized
focal_class.parameters: (String id)
focal_class.return: void
focal_class.signature: void delete(String id)
focal_class.class_method_signature: ServiceResourceService.failIdUsed(String id)
focal_class.full_signature: private void failIdUsed(String id)
focal_class.identifier: failIdUsed
focal_class.modifiers: private
focal_class.parameters: (String id)
focal_class.return: void
focal_class.signature: void failIdUsed(String id)
focal_class.class_method_signature: ServiceResourceService.handleLocationDeleted(AfterLocationDeleted event)
focal_class.full_signature: @EventListener public synchronized void handleLocationDeleted(AfterLocationDeleted event)
focal_class.identifier: handleLocationDeleted
focal_class.modifiers: @EventListener public synchronized
focal_class.parameters: (AfterLocationDeleted event)
focal_class.return: void
focal_class.signature: void handleLocationDeleted(AfterLocationDeleted event)
focal_class.class_method_signature: ServiceResourceService.searchByLocation(String locationId)
focal_class.full_signature: public List<ServiceResource> searchByLocation(String locationId)
focal_class.identifier: searchByLocation
focal_class.modifiers: public
focal_class.parameters: (String locationId)
focal_class.return: List<ServiceResource>
focal_class.signature: List<ServiceResource> searchByLocation(String locationId)
focal_class.class_method_signature: ServiceResourceService.getByNodeTypes(String nodeType, String nodeTypeVersion)
focal_class.full_signature: public ServiceResource[] getByNodeTypes(String nodeType, String nodeTypeVersion)
focal_class.identifier: getByNodeTypes
focal_class.modifiers: public
focal_class.parameters: (String nodeType, String nodeTypeVersion)
focal_class.return: ServiceResource[]
focal_class.signature: ServiceResource[] getByNodeTypes(String nodeType, String nodeTypeVersion)
focal_class.class_method_signature: ServiceResourceService.isLocationAuthorized(String serviceId, String locationId)
focal_class.full_signature: public void isLocationAuthorized(String serviceId, String locationId)
focal_class.identifier: isLocationAuthorized
focal_class.modifiers: public
focal_class.parameters: (String serviceId, String locationId)
focal_class.return: void
focal_class.signature: void isLocationAuthorized(String serviceId, String locationId)
focal_class.class_method_signature: ServiceResourceService.reportArchiveUsage(ArchiveUsageRequestEvent event)
focal_class.full_signature: @EventListener public void reportArchiveUsage(ArchiveUsageRequestEvent event)
focal_class.identifier: reportArchiveUsage
focal_class.modifiers: @EventListener public
focal_class.parameters: (ArchiveUsageRequestEvent event)
focal_class.return: void
focal_class.signature: void reportArchiveUsage(ArchiveUsageRequestEvent event)
focal_method.body: @EventListener
      public void reportArchiveUsage(ArchiveUsageRequestEvent event) {
          ServiceResource[] serviceResources = alienDAO.buildQuery(ServiceResource.class)
                  .setFilters(fromKeyValueCouples("dependency.name", event.getArchiveName(), "dependency.version", event.getArchiveVersion())).prepareSearch()
                  .search(0, Integer.MAX_VALUE).getData();
          for (ServiceResource serviceResource : serviceResources) {
              Usage usage = new Usage(serviceResource.getName(), ServiceResource.class.getSimpleName().toLowerCase(), serviceResource.getId(), "");
              event.addUsage(usage);
          }
      }
focal_method.class_method_signature: ServiceResourceService.reportArchiveUsage(ArchiveUsageRequestEvent event)
focal_method.full_signature: @EventListener public void reportArchiveUsage(ArchiveUsageRequestEvent event)
focal_method.identifier: reportArchiveUsage
focal_method.invocations: getData search prepareSearch setFilters buildQuery fromKeyValueCouples getArchiveName getArchiveVersion getName toLowerCase getSimpleName getId addUsage
focal_method.modifiers: @EventListener public
focal_method.parameters: (ArchiveUsageRequestEvent event)
focal_method.return: void
focal_method.signature: void reportArchiveUsage(ArchiveUsageRequestEvent event)