Search in sources :

Example 6 with Threshold

use of alma.alarmsystem.alarmmessage.generated.Threshold in project ACS by ACS-Community.

the class ACSAlarmDAOImpl method addThreshold.

public void addThreshold(ReductionDefinitions rds, Threshold th) {
    if (th == null)
        throw new IllegalArgumentException("Null Threshold argument");
    //alma.alarmsystem.alarmmessage.generated.ReductionDefinitions rds = getReductionRules();
    alma.alarmsystem.alarmmessage.generated.Threshold[] tmp = rds.getThresholds().getThreshold();
    for (int i = 0; i < tmp.length; i++) {
        alma.alarmsystem.alarmmessage.generated.AlarmDefinition p1 = th.getAlarmDefinition();
        alma.alarmsystem.alarmmessage.generated.AlarmDefinition p2 = tmp[i].getAlarmDefinition();
        String n1 = new String(p1.getFaultFamily() + ":" + p1.getFaultMember() + ":" + p1.getFaultCode());
        String n2 = new String(p2.getFaultFamily() + ":" + p2.getFaultMember() + ":" + p2.getFaultCode());
        if (n1.compareTo(n2) == 0)
            throw new IllegalStateException("Threshold entry already exists");
    }
    rds.getThresholds().addThreshold(th);
    //Reflect the changes into the AlarmDAO
    alma.alarmsystem.alarmmessage.generated.AlarmDefinition in = th.getAlarmDefinition();
    Alarm p = getAlarm(in.getFaultFamily() + ":" + in.getFaultMember() + ":" + in.getFaultCode());
    p.setMultiplicityThreshold(th.getValue());
//flushReductionRules(rds);
}
Also used : Alarm(cern.laser.business.data.Alarm) AlarmDefinition(alma.alarmsystem.alarmmessage.generated.AlarmDefinition) Threshold(alma.alarmsystem.alarmmessage.generated.Threshold)

Aggregations

Threshold (alma.alarmsystem.alarmmessage.generated.Threshold)6 Alarm (cern.laser.business.data.Alarm)5 AlarmDefinition (alma.alarmsystem.alarmmessage.generated.AlarmDefinition)4 Child (alma.alarmsystem.alarmmessage.generated.Child)3 Parent (alma.alarmsystem.alarmmessage.generated.Parent)3 ReductionDefinitions (alma.alarmsystem.alarmmessage.generated.ReductionDefinitions)3 ReductionLinkType (alma.alarmsystem.alarmmessage.generated.ReductionLinkType)3 ReductionLinkDefinitionListType (alma.alarmsystem.alarmmessage.generated.ReductionLinkDefinitionListType)2 Thresholds (alma.alarmsystem.alarmmessage.generated.Thresholds)2 ValidationException (org.exolab.castor.xml.ValidationException)2 CDBRecordDoesNotExistEx (alma.cdbErrType.CDBRecordDoesNotExistEx)1 LaserObjectNotFoundException (cern.laser.business.LaserObjectNotFoundException)1 AlarmImpl (cern.laser.business.data.AlarmImpl)1 ACSAlarmDAOImpl (cl.utfsm.acs.acg.dao.ACSAlarmDAOImpl)1 LinkSpec (com.cosylab.acs.laser.dao.utils.LinkSpec)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 MalformedURLException (java.net.MalformedURLException)1 ArrayList (java.util.ArrayList)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1