public void removeTargetedResourceType(ResourceType resourceType) { getExplicitlyTargetedResourceTypes().remove(resourceType); resourceType.getExplicitlyTargetingBundleTypes().remove(this); }
public void addTargetedResourceType(ResourceType resourceType) { getExplicitlyTargetedResourceTypes().add(resourceType); resourceType.getExplicitlyTargetingBundleTypes().add(this); }
private void persistNewType(ResourceType resourceType) { log.info("Persisting new ResourceType [" + toConciseString(resourceType) + "]..."); // If the type didn't exist then we'll persist here which will cascade through // all child types as well as plugin and resource configs and their delegate types and // metric and operation definitions and their dependent types, // but first do some validity checking. // Ensure that the new type has any built-in metrics (like Availability Type) MeasurementMetadataManagerBean.getMetricDefinitions(resourceType); //Ensure any explicitly targeted resource types of a bundle type are refreshed with their //persisted counterparts (which should have been persisted before persisting the type //due to the dependency graph ordering) if (resourceType.getBundleType() != null && !resourceType.getBundleType().getExplicitlyTargetedResourceTypes().isEmpty()) { Set<ResourceType> existingTypes = new HashSet<ResourceType>( resourceType.getBundleType().getExplicitlyTargetedResourceTypes().size()); for (ResourceType targetedType : resourceType.getBundleType().getExplicitlyTargetedResourceTypes()) { ResourceType existingType = resourceTypeManager.getResourceTypeByNameAndPlugin(targetedType.getName(), targetedType.getPlugin()); existingTypes.add(existingType); } resourceType.getBundleType().getExplicitlyTargetedResourceTypes().clear(); resourceType.getBundleType().getExplicitlyTargetedResourceTypes().addAll(existingTypes); } entityManager.merge(resourceType); }
newBundleType.getExplicitlyTargetedResourceTypes().size()); if (!newBundleType.getExplicitlyTargetedResourceTypes().isEmpty()) { for (ResourceType targetType : newBundleType.getExplicitlyTargetedResourceTypes()) { ResourceType existingTargetType = resourceTypeMgr .getResourceTypeByNameAndPlugin(targetType.getName(), targetType.getPlugin()); newBundleType.getExplicitlyTargetedResourceTypes().clear(); newBundleType.getExplicitlyTargetedResourceTypes().addAll(targetedResourceTypes);
Set<ResourceType> targetedResourceTypes = bundle.getBundleType().getExplicitlyTargetedResourceTypes();