Search in sources :

Example 31 with Alarm

use of cern.laser.business.data.Alarm in project ACS by ACS-Community.

the class CoreServiceImpl method getMultiplicityParents.

/*
   * (non-Javadoc)
   * 
   * @see cern.laser.business.ejb.CoreServiceSessionEJB#getMultiplicityParents(java.lang.Integer)
   */
public Collection getMultiplicityParents(String childId) {
    Collection result = null;
    try {
        Alarm child = alarmCache.getReference(childId);
        String[] parents = child.getMultiplicityParents();
        result = new ArrayList(parents.length);
        for (int i = 0; i < parents.length; i++) {
            Alarm alarm = alarmCache.getReference(parents[i]);
            result.add(alarm);
        }
    } catch (AlarmCacheException onf) {
        LOGGER.warn("multiplicity child " + childId + " not found");
        result = new ArrayList();
    } catch (Exception e) {
        LOGGER.error("unable to get multiplicity parents for child " + childId, e);
    //throw new EJBException("unable to get multiplicity parents for child " + childId, e);
    }
    return result;
}
Also used : Alarm(cern.laser.business.data.Alarm) ArrayList(java.util.ArrayList) Collection(java.util.Collection) AlarmCacheException(cern.laser.business.cache.AlarmCacheException) LaserRuntimeException(cern.laser.business.LaserRuntimeException) LaserProcessingException(cern.laser.business.LaserProcessingException) AlarmCacheException(cern.laser.business.cache.AlarmCacheException)

Example 32 with Alarm

use of cern.laser.business.data.Alarm in project ACS by ACS-Community.

the class CoreServiceImpl method getActiveMultiplicityChildren.

public Collection getActiveMultiplicityChildren(String parentId) {
    Collection result = null;
    try {
        Alarm parent = alarmCache.getReference(parentId);
        String[] children = parent.getMultiplicityChildren();
        result = new ArrayList(children.length);
        for (int i = 0; i < children.length; i++) {
            Alarm alarm = alarmCache.getReference(children[i]);
            if (alarm.getStatus().getActive().booleanValue())
                result.add(alarm);
        }
    } catch (AlarmCacheException onf) {
        LOGGER.warn("multiplicity parent " + parentId + " not found");
        result = new ArrayList();
    }
    return result;
}
Also used : Alarm(cern.laser.business.data.Alarm) ArrayList(java.util.ArrayList) Collection(java.util.Collection) AlarmCacheException(cern.laser.business.cache.AlarmCacheException)

Example 33 with Alarm

use of cern.laser.business.data.Alarm in project ACS by ACS-Community.

the class CoreServiceImpl method getActiveNodeChildren.

/*
   * (non-Javadoc)
   * 
   * @see cern.laser.business.ejb.CoreServiceSessionEJB#getActiveNodeChildren(java.lang.Integer)
   */
public Collection getActiveNodeChildren(String parentId) {
    Collection result = null;
    try {
        Alarm parent = alarmCache.getReference(parentId);
        String[] children = parent.getNodeChildren();
        result = new ArrayList(children.length);
        for (int i = 0; i < children.length; i++) {
            Alarm alarm = alarmCache.getReference(children[i]);
            if (alarm.getStatus().getActive().booleanValue())
                result.add(alarm);
        }
    } catch (AlarmCacheException onf) {
        LOGGER.warn("node parent " + parentId + " not found");
        result = new ArrayList();
    }
    return result;
}
Also used : Alarm(cern.laser.business.data.Alarm) ArrayList(java.util.ArrayList) Collection(java.util.Collection) AlarmCacheException(cern.laser.business.cache.AlarmCacheException)

Example 34 with Alarm

use of cern.laser.business.data.Alarm in project ACS by ACS-Community.

the class CoreServiceImpl method getAlarmsByResponsiblePerson.

/*
   * (non-Javadoc)
   * 
   * @see cern.laser.business.ejb.CoreServiceSessionEJB#getAlarmsByResponsiblePerson(java.lang.Integer)
   */
public Collection getAlarmsByResponsiblePerson(Integer responsibleId) {
    Collection result = null;
    try {
        String[] alarm_ids = responsiblePersonDAO.getAlarms(responsibleId);
        result = new ArrayList(alarm_ids.length);
        for (int i = 0; i < alarm_ids.length; i++) {
            Alarm alarm = alarmCache.getReference(alarm_ids[i]);
            result.add(alarm);
        }
    } catch (Exception e) {
        LOGGER.error("unable to get alarms by responsible person " + responsibleId, e);
    //throw new EJBException("unable to get alarms by responsible person " + responsibleId, e);
    }
    return result;
}
Also used : Alarm(cern.laser.business.data.Alarm) ArrayList(java.util.ArrayList) Collection(java.util.Collection) LaserRuntimeException(cern.laser.business.LaserRuntimeException) LaserProcessingException(cern.laser.business.LaserProcessingException) AlarmCacheException(cern.laser.business.cache.AlarmCacheException)

Example 35 with Alarm

use of cern.laser.business.data.Alarm in project ACS by ACS-Community.

the class ReductionsView method fillMRParentWidgets.

private void fillMRParentWidgets(String ff, String fm, int fc) {
    ReductionRule mrr = _reductionManager.getMRParentByTriplet(ff, fm, fc);
    Alarm parent = null;
    // This should happen only when creating a new rule...
    if (mrr == null) {
        parent = _alarmManager.getAlarm(ff + ":" + fm + ":" + fc);
        _MRParentErrorMessageLabel.setText("No Reduction Rule for this triplet.");
    } else {
        parent = mrr.getParent();
        if (mrr.getChildrenCount() < mrr.getThreshold())
            _MRParentErrorMessageLabel.setText("You need to have at least threshold (" + mrr.getThreshold() + ") childs for this triplet.");
    }
    _MRParentFFCombo.removeAll();
    _MRParentChFFCombo.removeAll();
    _MRParentChFFCombo.add("Any");
    _MRParentChFFCombo.select(0);
    List<FaultFamily> ffList = _alarmManager.getAllAlarms();
    List<String> tmp = new ArrayList<String>();
    List<FaultFamily> sortedFFList = new ArrayList<FaultFamily>();
    for (FaultFamily tff : ffList) tmp.add(tff.getName());
    Collections.sort(tmp, IGNORE_CASE_ORDER);
    for (String sff : tmp) sortedFFList.add(_alarmManager.getFaultFamily(sff));
    ffList = sortedFFList;
    FaultFamily ffs = null;
    int i = -1;
    for (Iterator<FaultFamily> iterator = ffList.iterator(); iterator.hasNext(); ) {
        FaultFamily fft = iterator.next();
        if (fft.getFaultCodeCount() > 0 && fft.getFaultMemberCount() > 0)
            _MRParentFFCombo.add(fft.getName());
        _MRParentChFFCombo.add(fft.getName());
        if (parent != null && fft.getName().compareTo(parent.getTriplet().getFaultFamily()) == 0) {
            i = _MRParentFFCombo.getItemCount() - 1;
            ffs = fft;
        }
    }
    _MRParentFFCombo.select(i);
    _MRParentFMCombo.removeAll();
    if (ffs != null) {
        i = -1;
        FaultMember[] fml = ffs.getFaultMember();
        List<FaultMember> fmList = Arrays.asList(fml);
        tmp = new ArrayList<String>();
        List<FaultMember> sortedFMList = new ArrayList<FaultMember>();
        for (FaultMember tfm : fmList) tmp.add(tfm.getName());
        Collections.sort(tmp, IGNORE_CASE_ORDER);
        for (String sfm : tmp) for (FaultMember tfm : fmList) if (sfm.compareTo(tfm.getName()) == 0)
            sortedFMList.add(tfm);
        fmList = sortedFMList;
        for (FaultMember fmt : fmList) {
            _MRParentFMCombo.add(fmt.getName());
            if (fmt.getName().compareTo(parent.getTriplet().getFaultMember()) == 0)
                i = _MRParentFMCombo.getItemCount() - 1;
        }
        _MRParentFMCombo.select(i);
    }
    _MRParentFCCombo.removeAll();
    if (ffs != null) {
        i = -1;
        FaultCode[] fcl = ffs.getFaultCode();
        List<FaultCode> fcList = Arrays.asList(fcl);
        tmp = new ArrayList<String>();
        List<FaultCode> sortedFCList = new ArrayList<FaultCode>();
        for (FaultCode tfc : fcList) tmp.add(Integer.toString(tfc.getValue()));
        Collections.sort(tmp);
        for (String sfc : tmp) for (FaultCode tfc : fcList) if (sfc.compareTo(Integer.toString(tfc.getValue())) == 0)
            sortedFCList.add(tfc);
        fcList = sortedFCList;
        for (FaultCode fct : fcList) {
            _MRParentFCCombo.add(Integer.toString(fct.getValue()));
            if (fct.getValue() == parent.getTriplet().getFaultCode())
                i = _MRParentFCCombo.getItemCount() - 1;
        }
        _MRParentFCCombo.select(i);
    }
    _MRParentThresholdText.setText("");
    if (mrr != null)
        _MRParentThresholdText.setText(Integer.toString(mrr.getThreshold()));
    _MRParentChFMCombo.removeAll();
    _MRParentChFMCombo.add("Any");
    _MRParentChFMCombo.select(0);
    _MRParentChFCCombo.removeAll();
    _MRParentChFCCombo.add("Any");
    _MRParentChFCCombo.select(0);
    if (ff.isEmpty() && fm.isEmpty() && fc == 0) {
        if (!_MRParentFFCombo.getText().isEmpty() && !_MRParentFMCombo.getText().isEmpty() && !_MRParentFCCombo.getText().isEmpty())
            fillMRParentChAlarmList(_MRParentFFCombo.getText(), _MRParentFMCombo.getText(), Integer.parseInt(_MRParentFCCombo.getText()));
    } else
        fillMRParentChAlarmList(ff, fm, fc);
//_updateNRParentFF.setEnabled(true);
}
Also used : FaultMember(alma.acs.alarmsystem.generated.FaultMember) FaultCode(alma.acs.alarmsystem.generated.FaultCode) ArrayList(java.util.ArrayList) ReductionRule(cl.utfsm.acs.acg.core.ReductionRule) Point(org.eclipse.swt.graphics.Point) FaultFamily(alma.acs.alarmsystem.generated.FaultFamily) Alarm(cern.laser.business.data.Alarm)

Aggregations

Alarm (cern.laser.business.data.Alarm)91 AlarmCacheException (cern.laser.business.cache.AlarmCacheException)24 LaserRuntimeException (cern.laser.business.LaserRuntimeException)21 ArrayList (java.util.ArrayList)21 Category (cern.laser.business.data.Category)16 Collection (java.util.Collection)14 AlarmImpl (cern.laser.business.data.AlarmImpl)13 LaserDefinitionNotValidException (cern.laser.business.definition.LaserDefinitionNotValidException)12 AdminUser (cern.laser.business.data.AdminUser)11 AlarmDefinition (alma.alarmsystem.alarmmessage.generated.AlarmDefinition)10 LaserDefinitionDuplicationException (cern.laser.business.definition.LaserDefinitionDuplicationException)10 LaserDefinitionNotFoundException (cern.laser.business.definition.LaserDefinitionNotFoundException)10 Iterator (java.util.Iterator)10 LaserProcessingException (cern.laser.business.LaserProcessingException)9 LaserDefinitionNotAllowedException (cern.laser.business.definition.LaserDefinitionNotAllowedException)9 LaserObjectNotFoundException (cern.laser.business.LaserObjectNotFoundException)7 ReductionRule (cl.utfsm.acs.acg.core.ReductionRule)7 FaultCode (alma.acs.alarmsystem.generated.FaultCode)6 FaultFamily (alma.acs.alarmsystem.generated.FaultFamily)6 FaultMember (alma.acs.alarmsystem.generated.FaultMember)6