package schedframe.resources.devices.description; import schedframe.resources.ResourceTypeFactory; import schedframe.resources.utils.ResourceIdGenerator; public class DeviceDescription extends PhysicalResourceDescription{ public DeviceDescription(schemas.Device device) { super(ResourceTypeFactory.createResourceType(device.getClazz())); this.category = device.getType(); initId(device); if (device.getDeviceTypeChoiceSequence() != null) { initProfiles(device.getDeviceTypeChoiceSequence().getProfile()); initLocation(device.getDeviceTypeChoiceSequence().getLocation()); this.parameters = extractParameters(device.getDeviceTypeChoiceSequence().getParameter()); } } private void initId(schemas.Device device){ this.id = device.getName() != null ? device.getName() : type.getName(); if(device.getCount() > 1 || device.getName() == null){ this.id = id + "_" + String.valueOf(ResourceIdGenerator.getId(type.getName())); } } }