Search in sources :

Example 16 with FaultState

use of cern.laser.source.alarmsysteminterface.FaultState in project ACS by ACS-Community.

the class FaultStateHelper method marshal.

/**
   * Marshal a FaultState into a generated FaultState for XML transport.
   * 
   * @param state The FaultState instance
   * @return The generated FaultState
   */
public static cern.laser.source.alarmsysteminterface.impl.message.FaultState marshal(FaultState state) {
    cern.laser.source.alarmsysteminterface.impl.message.FaultState generated = new cern.laser.source.alarmsysteminterface.impl.message.FaultState();
    generated.setFamily(state.getFamily());
    generated.setMember(state.getMember());
    generated.setCode(state.getCode());
    generated.setDescriptor(state.getDescriptor());
    generated.setUserTimestamp(IsoDateFormat.formatDate(new Date(state.getUserTimestamp().getTime())));
    cern.laser.source.alarmsysteminterface.impl.message.Properties properties = new cern.laser.source.alarmsysteminterface.impl.message.Properties();
    Enumeration names = state.getUserProperties().propertyNames();
    while (names.hasMoreElements()) {
        String name = (String) names.nextElement();
        Property property = new Property();
        property.setName(name);
        property.setValue(state.getUserProperties().getProperty(name));
        properties.addProperty(property);
    }
    generated.setUserProperties(properties);
    return generated;
}
Also used : Enumeration(java.util.Enumeration) FaultState(cern.laser.source.alarmsysteminterface.FaultState) Properties(java.util.Properties) Date(java.util.Date) Property(cern.laser.source.alarmsysteminterface.impl.message.Property)

Aggregations

FaultState (cern.laser.source.alarmsysteminterface.FaultState)16 ASIMessage (cern.laser.source.alarmsysteminterface.impl.message.ASIMessage)9 Timestamp (java.sql.Timestamp)6 ACSFaultState (alma.alarmsystem.source.ACSFaultState)3 FaultStateImpl (cern.laser.source.alarmsysteminterface.impl.FaultStateImpl)3 ACSJMSTextMessage (com.cosylab.acs.jms.ACSJMSTextMessage)3 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 Alarm (cern.laser.business.data.Alarm)2 Source (cern.laser.business.data.Source)2 FaultStates (cern.laser.source.alarmsysteminterface.impl.message.FaultStates)2 Property (cern.laser.source.alarmsysteminterface.impl.message.Property)2 ParseException (java.text.ParseException)2 Enumeration (java.util.Enumeration)2 Iterator (java.util.Iterator)2 Properties (java.util.Properties)2 Vector (java.util.Vector)2 DummyContainerServices (alma.acs.container.testsupport.DummyContainerServices)1 LaserCoreFaultState (alma.alarmsystem.core.alarms.LaserCoreFaultState)1 LaserRuntimeException (cern.laser.business.LaserRuntimeException)1