Search in sources :

Example 1 with Alarm

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;
}
Also used : Alarm(alma.alarmsystem.Alarm) Collection(java.util.Collection)

Example 2 with Alarm

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;
}
Also used : Alarm(alma.alarmsystem.Alarm) Collection(java.util.Collection)

Example 3 with Alarm

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;
}
Also used : Alarm(alma.alarmsystem.Alarm) Iterator(java.util.Iterator)

Example 4 with Alarm

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;
}
Also used : Building(cern.laser.business.data.Building) Status(alma.alarmsystem.Status) Set(java.util.Set) Triplet(alma.alarmsystem.Triplet) Any(org.omg.CORBA.Any) Timestamp(alma.alarmsystem.Timestamp) Alarm(alma.alarmsystem.Alarm) Property(org.omg.CosPropertyService.Property) Location(alma.alarmsystem.Location)

Aggregations

Alarm (alma.alarmsystem.Alarm)4 Collection (java.util.Collection)2 Location (alma.alarmsystem.Location)1 Status (alma.alarmsystem.Status)1 Timestamp (alma.alarmsystem.Timestamp)1 Triplet (alma.alarmsystem.Triplet)1 Building (cern.laser.business.data.Building)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1 Any (org.omg.CORBA.Any)1 Property (org.omg.CosPropertyService.Property)1