Revision 1207,
969 bytes
checked in by wojtekp, 11 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Line | |
---|
1 | package schedframe.resources.devices.description; |
---|
2 | |
---|
3 | import schedframe.resources.ResourceTypeFactory; |
---|
4 | import schedframe.resources.utils.ResourceIdGenerator; |
---|
5 | |
---|
6 | public class DeviceDescription extends PhysicalResourceDescription{ |
---|
7 | |
---|
8 | |
---|
9 | public DeviceDescription(schemas.Device device) { |
---|
10 | |
---|
11 | super(ResourceTypeFactory.createResourceType(device.getClazz())); |
---|
12 | this.category = device.getType(); |
---|
13 | |
---|
14 | initId(device); |
---|
15 | |
---|
16 | if (device.getDeviceTypeChoiceSequence() != null) { |
---|
17 | initProfiles(device.getDeviceTypeChoiceSequence().getProfile()); |
---|
18 | initLocation(device.getDeviceTypeChoiceSequence().getLocation()); |
---|
19 | this.parameters = extractParameters(device.getDeviceTypeChoiceSequence().getParameter()); |
---|
20 | } |
---|
21 | } |
---|
22 | |
---|
23 | private void initId(schemas.Device device){ |
---|
24 | this.id = device.getName() != null ? device.getName() : type.getName(); |
---|
25 | if(device.getCount() > 1 || device.getName() == null){ |
---|
26 | this.id = id + "_" + String.valueOf(ResourceIdGenerator.getId(type.getName())); |
---|
27 | } |
---|
28 | } |
---|
29 | |
---|
30 | |
---|
31 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.