return response;
}
private Configuration createReferencedConfigurationFromResource(BundleResourceDeployment resourceDeployment) {
ResourceContainer rc = inventoryManager.getResourceContainer(resourceDeployment.getResource());
Set<ResourceTypeBundleConfiguration.BundleDestinationSpecification> specs = rc.getResource().getResourceType()
.getResourceTypeBundleConfiguration().getBundleDestinationSpecifications();
String specName = resourceDeployment.getBundleDeployment().getDestination()
.getDestinationSpecificationName();
for (ResourceTypeBundleConfiguration.BundleDestinationSpecification spec : specs) {
if (specName.equals(spec.getName())) {
ResourceTypeBundleConfiguration.BundleDestinationDefinition def =
(ResourceTypeBundleConfiguration.BundleDestinationDefinition) spec;
Resource resource = rc.getResource();
Configuration transferred = new Configuration();
Configuration pluginConfiguration = resource.getPluginConfiguration();
Configuration resourceConfiguration = InventoryManager.getResourceConfiguration(resource);
for (ResourceTypeBundleConfiguration.BundleDestinationDefinition.ConfigRef refProp :
def.getReferencedConfiguration()) {
switch (refProp.getContext()) {
case PLUGIN_CONFIGURATION:
switch (refProp.getType()) {
case LIST:
PropertyList list = pluginConfiguration.getList(refProp.getName()).deepCopy(false);
list.setName(refProp.getTargetName());
transferred.put(list);
break;
case MAP:
PropertyMap map = pluginConfiguration.getMap(refProp.getName()).deepCopy(false);
map.setName(refProp.getTargetName());
transferred.put(map);
break;
case SIMPLE:
PropertySimple simple = pluginConfiguration.getSimple(refProp.getName()).deepCopy(false);
simple.setName(refProp.getTargetName());
transferred.put(simple);
break;
case FULL:
for (Property p : pluginConfiguration.getProperties()) {
Property copy = p.deepCopy(false);
if (refProp.getTargetName() != null) {
copy.setName(refProp.getTargetName() + copy.getName());
}
transferred.put(copy);
}
break;
}
break;
case RESOURCE_CONFIGURATION:
switch (refProp.getType()) {
case LIST:
PropertyList list = resourceConfiguration.getList(refProp.getName()).deepCopy(false);
list.setName(refProp.getTargetName());
transferred.put(list);
break;
case MAP:
PropertyMap map = resourceConfiguration.getMap(refProp.getName()).deepCopy(false);
map.setName(refProp.getTargetName());
transferred.put(map);
break;
case SIMPLE:
PropertySimple simple = resourceConfiguration.getSimple(refProp.getName()).deepCopy(false);
simple.setName(refProp.getTargetName());
transferred.put(simple);
break;
case FULL:
for (Property p : resourceConfiguration.getProperties()) {
Property copy = p.deepCopy(false);
if (refProp.getTargetName() != null) {
copy.setName(refProp.getTargetName() + copy.getName());
}
transferred.put(copy);
}
break;
}
break;
case MEASUREMENT_TRAIT:
if (refProp.getType() ==
ResourceTypeBundleConfiguration.BundleDestinationDefinition.ConfigRef.Type.FULL) {
Set<MeasurementScheduleRequest> schedules = rc.getMeasurementSchedule();
for (MeasurementScheduleRequest schedule : schedules) {
if (schedule.getDataType() != DataType.TRAIT) {
String value = measurementManager.getTraitValue(rc, schedule.getName());
String name = schedule.getName();
if (refProp.getTargetName() != null) {