use of alma.alarmsystem.Alarm in project ACS by ACS-Community.
the class LaserComponent method getMultiplicityChildren.
/* (non-Javadoc)
* @see alma.alarmsystem.CoreServiceOperations#getMultiplicityChildren(java.lang.String)
*/
public Alarm[] getMultiplicityChildren(String parentId) {
Collection alarms = coreService.getMultiplicityChildren(parentId);
Alarm[] als = fromBusinessAlarmCollection(alarms);
return als;
}
use of alma.alarmsystem.Alarm in project ACS by ACS-Community.
the class LaserComponent method getMultiplicityParents.
/* (non-Javadoc)
* @see alma.alarmsystem.CoreServiceOperations#getMultiplicityParents(java.lang.String)
*/
public Alarm[] getMultiplicityParents(String childId) {
Collection alarms = coreService.getMultiplicityParents(childId);
Alarm[] als = fromBusinessAlarmCollection(alarms);
return als;
}
use of alma.alarmsystem.Alarm in project ACS by ACS-Community.
the class LaserComponent method fromBusinessAlarmCollection.
/**
* Helper method.
* @param alarms
* @return
*/
private Alarm[] fromBusinessAlarmCollection(Collection alarms) {
if (alarms == null)
return new Alarm[0];
Alarm[] retVal = new Alarm[alarms.size()];
int pos = 0;
for (Iterator iter = alarms.iterator(); iter.hasNext(); ) {
cern.laser.business.data.Alarm alarm = (cern.laser.business.data.Alarm) iter.next();
retVal[pos++] = fromBusinessAlarm(alarm);
}
return retVal;
}
use of alma.alarmsystem.Alarm in project ACS by ACS-Community.
the class LaserComponent method fromBusinessAlarm.
/**
* Helper method which converts EJB business Alarm to CORBA Alarm structure.
* @param alarm
* @return
*/
private Alarm fromBusinessAlarm(cern.laser.business.data.Alarm alarm) {
cern.laser.business.data.Triplet bt = alarm.getTriplet();
cern.laser.business.data.Location bl = alarm.getLocation();
if (bl.getBuilding() == null) {
bl.setBuilding(new Building("", "", 1, ""));
}
cern.laser.business.data.Status bs = alarm.getStatus();
// Build the properties
Property[] props;
if (alarm.getStatus().getProperties() != null) {
props = new Property[alarm.getStatus().getProperties().size()];
Set keys = alarm.getStatus().getProperties().keySet();
int t = 0;
for (Object key : keys) {
String name = (String) key;
String value = alarm.getStatus().getProperties().getProperty(name);
Any any = corbaServer.getORB().create_any();
any.insert_string(value);
props[t++] = new Property(name, any);
}
} else {
props = new Property[0];
}
Alarm newAlarm = new Alarm(alarm.getAlarmId(), new Triplet(bt.getFaultFamily(), bt.getFaultMember(), bt.getFaultCode().intValue()), getString(alarm.getSystemName()), getString(alarm.getIdentifier()), getString(alarm.getProblemDescription()), alarm.getPriority().intValue(), getString(alarm.getCause()), getString(alarm.getAction()), getString(alarm.getConsequence()), fromBusinessSource(alarm.getSource()), getString(alarm.getHelpURL().toExternalForm()), getString(alarm.getPiquetGSM()), getString(alarm.getPiquetEmail()), fromBusinessResponsiblePerson(alarm.getResponsiblePerson()), new Location(bl.getLocationId(), bl.getFloor(), bl.getRoom(), bl.getPosition(), bl.getMnemonic(), bl.getBuilding().getBuildingNumber(), bl.getBuilding().getSite(), bl.getBuilding().getZone().intValue(), bl.getBuilding().getMap()), fromBusinessCategoryCollection(alarm.getCategories()), new Status(bs.getActive().booleanValue(), bs.getMasked().booleanValue(), bs.getReduced().booleanValue(), new Timestamp(bs.getSourceTimestamp().getTime(), bs.getSourceTimestamp().getNanos()), bs.getSourceHostname(), new Timestamp(bs.getUserTimestamp().getTime(), bs.getUserTimestamp().getNanos()), new Timestamp(bs.getSystemTimestamp().getTime(), bs.getSystemTimestamp().getNanos()), props), alarm.getInstant().booleanValue(), alarm.hasNodeParents(), alarm.hasMultiplicityParents(), alarm.hasNodeChildren(), alarm.hasMultiplicityChildren());
return newAlarm;
}
Aggregations