Search in sources :

Example 1 with Contact

use of alma.acs.tmcdb.Contact in project ACS by ACS-Community.

the class HibernateWDALAlarmPluginImpl method loadEpilogue.

/* (non-Javadoc)
	 * @see com.cosylab.cdb.jdal.hibernate.plugin.HibernateWDALPlugin#loadEpilogue(org.hibernate.Session, alma.acs.tmcdb.Configuration, java.util.Map)
	 */
@SuppressWarnings("unchecked")
public static void loadEpilogue(Session session, Configuration config, Map<String, Object> rootMap, Logger m_logger) {
    try {
        DOMConfigurationAccessor conf = new DOMConfigurationAccessor();
        conf.setSession(session);
        Map<String, Object> alarmsRoot = new RootMap<String, Object>();
        Map<String, Object> administrativeRoot = new RootMap<String, Object>();
        alarmsRoot.put("Administrative", administrativeRoot);
        administrativeRoot.put("AlarmSystemConfiguration", new AlarmSystemConfiguration());
        Categories categoriesMap = new Categories(session, config, conf, rootMap, m_logger);
        administrativeRoot.put("Categories", categoriesMap);
        conf.put(Categories.CATEGORY_DEFINITION_PATH, categoriesMap);
        // categories
        int counter = 0;
        List<AlarmCategory> categories = session.createCriteria(AlarmCategory.class).add(Restrictions.eq("configuration", config)).list();
        for (AlarmCategory category : categories) {
            ArrayList<String> families = new ArrayList<String>();
            for (FaultFamily family : category.getFaultFamilies()) families.add(family.getFamilyName());
            categoriesMap.put("category" + String.valueOf(counter++), new alma.TMCDB.alarm.Category(category.getPath(), category.getDescription(), category.getIsDefault(), families.toArray(new String[families.size()])));
        }
        // fault families
        Map<String, alma.TMCDB.alarm.FaultFamily> faultFamiliesMap = new FaultFamiliesMap(session, config, conf, rootMap, m_logger);
        alarmsRoot.put("AlarmDefinitions", faultFamiliesMap);
        conf.put(FaultFamiliesMap.ALARM_CATEGORY_DEFINITION_PATH, faultFamiliesMap);
        counter = 0;
        List<FaultFamily> families = session.createCriteria(FaultFamily.class).add(Restrictions.eq("configuration", config)).addOrder(Order.asc("familyName")).list();
        for (FaultFamily family : families) {
            Contact contact = family.getContact();
            alma.TMCDB.alarm.FaultFamily faultFamily = new alma.TMCDB.alarm.FaultFamily(family.getFamilyName(), family.getAlarmSource(), family.getHelpURL(), new alma.TMCDB.alarm.Contact(contact.getContactName(), contact.getEmail(), contact.getGsm()));
            faultFamiliesMap.put("fault-family" + String.valueOf(counter++), faultFamily);
            // fault codes
            int codeCounter = 0;
            List<FaultCode> faultCodes = session.createCriteria(FaultCode.class).add(Restrictions.eq("faultFamily", family)).list();
            for (FaultCode faultCode : faultCodes) {
                faultFamily._.put("fault-code" + String.valueOf(codeCounter++), new alma.TMCDB.alarm.FaultCode(faultCode.getCodeValue(), faultCode.getIsInstant(), faultCode.getPriority(), faultCode.getCause(), faultCode.getAction(), faultCode.getConsequence(), faultCode.getProblemDescription()));
            }
            // default fault member
            DefaultMember defaultMember = (DefaultMember) session.createCriteria(DefaultMember.class).add(Restrictions.eq("faultFamily", family)).uniqueResult();
            if (defaultMember != null) {
                alma.TMCDB.alarm.Location location = getLocation(session, defaultMember.getLocation());
                faultFamily._.put("fault-member-default", new FaultMemberDefault(location));
            }
            // fault members
            int faultMemberCounter = 0;
            List<FaultMember> faultMembers = session.createCriteria(FaultMember.class).add(Restrictions.eq("faultFamily", family)).list();
            for (FaultMember faultMember : faultMembers) {
                alma.TMCDB.alarm.Location location = getLocation(session, faultMember.getLocation());
                faultFamily._.put("fault-member" + String.valueOf(faultMemberCounter++), new alma.TMCDB.alarm.FaultMember(faultMember.getMemberName(), location));
            }
        }
        // reductions
        ReductionDefinitions redDefs = new ReductionDefinitions(session, config, conf, rootMap, m_logger);
        administrativeRoot.put("ReductionDefinitions", redDefs);
        int linkCount = 0;
        List<alma.acs.tmcdb.ReductionLink> links = session.createCriteria(alma.acs.tmcdb.ReductionLink.class).add(Restrictions.eq("configuration", config)).list();
        for (alma.acs.tmcdb.ReductionLink link : links) {
            alma.acs.tmcdb.AlarmDefinition parent = link.getAlarmDefinitionByParentalarmdefid();
            alma.acs.tmcdb.AlarmDefinition child = link.getAlarmDefinitionByChildalarmdefid();
            ReductionLinks toLink;
            if (link.getAction() == ReductionLinkAction.CREATE)
                toLink = redDefs.getLinksToCreate();
            else if (link.getAction() == ReductionLinkAction.REMOVE)
                toLink = redDefs.getLinksToRemove();
            else
                throw new RuntimeException("unsupported reduction link action '" + link.getAction() + "' for ReductionLink with id: " + link.getReductionLinkId());
            toLink._.put("link" + (linkCount++), new ReductionLink(link.getType().toString(), new AlarmDefinition(parent.getFaultFamily(), parent.getFaultMember(), parent.getFaultCode()), new AlarmDefinition(child.getFaultFamily(), child.getFaultMember(), child.getFaultCode())));
        }
        int thresholdCount = 0;
        List<alma.acs.tmcdb.ReductionThreshold> thresholds = session.createCriteria(alma.acs.tmcdb.ReductionThreshold.class).add(Restrictions.eq("configuration", config)).list();
        for (alma.acs.tmcdb.ReductionThreshold threshold : thresholds) {
            alma.acs.tmcdb.AlarmDefinition alarm = threshold.getAlarmDefinition();
            redDefs.getThresholds()._.put("threshold" + (thresholdCount++), new alma.TMCDB.alarm.ReductionThreshold(threshold.getValue(), new AlarmDefinition(alarm.getFaultFamily(), alarm.getFaultMember(), alarm.getFaultCode())));
        }
        // alarm configuration
        rootMap.put("Alarms", alarmsRoot);
    } catch (Throwable th) {
        m_logger.log(Level.SEVERE, "Failed to load all the alarm data.", th);
    }
}
Also used : FaultCode(alma.acs.tmcdb.FaultCode) RootMap(com.cosylab.cdb.jdal.hibernate.RootMap) ArrayList(java.util.ArrayList) ReductionThreshold(alma.acs.tmcdb.ReductionThreshold) ReductionDefinitions(alma.TMCDB.alarm.ReductionDefinitions) DefaultMember(alma.acs.tmcdb.DefaultMember) FaultFamiliesMap(alma.TMCDB.alarm.FaultFamiliesMap) ReductionLink(alma.TMCDB.alarm.ReductionLink) ReductionThreshold(alma.acs.tmcdb.ReductionThreshold) AlarmCategory(alma.acs.tmcdb.AlarmCategory) FaultMember(alma.acs.tmcdb.FaultMember) DOMConfigurationAccessor(alma.TMCDB.alarm.DOMConfigurationAccessor) Categories(alma.TMCDB.alarm.Categories) AlarmDefinition(alma.TMCDB.alarm.AlarmDefinition) Contact(alma.acs.tmcdb.Contact) FaultMemberDefault(alma.TMCDB.alarm.FaultMemberDefault) ReductionLinks(alma.TMCDB.alarm.ReductionLinks) FaultFamily(alma.acs.tmcdb.FaultFamily) AlarmSystemConfiguration(alma.TMCDB.alarm.AlarmSystemConfiguration)

Example 2 with Contact

use of alma.acs.tmcdb.Contact in project ACS by ACS-Community.

the class HibernateWDALAlarmPluginImpl method importAlarms.

public static void importAlarms(Session session, Configuration config, ConfigurationAccessor conf, Logger m_logger) throws Exception {
    // clean up whatever is in the session
    session.getTransaction().commit();
    session.clear();
    session.beginTransaction();
    // create DAOs
    ACSAlarmDAOImpl alarmDAO = new ACSAlarmDAOImpl(m_logger);
    ACSCategoryDAOImpl categoryDAO = new ACSCategoryDAOImpl(m_logger, alarmDAO);
    ACSResponsiblePersonDAOImpl responsiblePersonDAO = new ACSResponsiblePersonDAOImpl();
    // configure
    alarmDAO.setConfAccessor(conf);
    alarmDAO.setSurveillanceAlarmId("SURVEILLANCE:SOURCE:1");
    alarmDAO.setResponsiblePersonDAO(responsiblePersonDAO);
    categoryDAO.setConfAccessor(conf);
    //categoryDAO.setCategoryTreeRoot("ACS");
    categoryDAO.setCategoryTreeRoot("ROOT");
    categoryDAO.setSurveillanceCategoryPath("ACS.SURVEILLANCE");
    responsiblePersonDAO.setAlarmDAO(alarmDAO);
    // load
    final List<alma.acs.alarmsystem.generated.FaultFamily> families = alarmDAO.loadAlarms();
    final alma.acs.alarmsystem.generated.Category[] categories = categoryDAO.loadCategories();
    Map<String, ArrayList<AlarmCategory>> categoryFaultFamilyLinks = new HashMap<String, ArrayList<AlarmCategory>>();
    // store categories
    if (categories != null)
        for (alma.acs.alarmsystem.generated.Category daoCategory : categories) {
            AlarmCategory category = (AlarmCategory) session.createCriteria(AlarmCategory.class).add(Restrictions.eq("configuration", config)).add(Restrictions.eq("alarmCategoryName", daoCategory.getPath())).uniqueResult();
            if (category == null) {
                category = new AlarmCategory();
                category.setAlarmCategoryName(daoCategory.getPath());
                category.setConfiguration(config);
            }
            category.setDescription(nonEmptyString(daoCategory.getDescription(), "(description)"));
            category.setPath(daoCategory.getPath());
            category.setIsDefault(daoCategory.getIsDefault());
            session.saveOrUpdate(category);
            // clear first (in case of update)
            category.getFaultFamilies().clear();
            // cache mappings
            String[] faultFamilies = daoCategory.getAlarms().getFaultFamily();
            for (String faultFamily : faultFamilies) {
                ArrayList<AlarmCategory> list = categoryFaultFamilyLinks.get(faultFamily);
                if (list == null) {
                    list = new ArrayList<AlarmCategory>();
                    categoryFaultFamilyLinks.put(faultFamily, list);
                }
                list.add(category);
            }
        }
    // store fault families and contacts, etc.
    if (families != null)
        for (alma.acs.alarmsystem.generated.FaultFamily family : families) {
            final alma.acs.alarmsystem.generated.Contact daoContact = family.getContact();
            Contact contact = (Contact) session.createCriteria(Contact.class).add(Restrictions.eq("contactName", daoContact.getName())).uniqueResult();
            if (contact == null) {
                contact = new Contact();
                contact.setContactName(nonEmptyString(daoContact.getName(), "(empty)"));
                contact.setEmail(daoContact.getEmail());
                contact.setGsm(daoContact.getGsm());
                session.persist(contact);
            } else // If contact exist, let's check if this contact contains different information. If so,
            // issue an error
            {
                if (!trimAndNullToEmpty(contact.getEmail()).equals(trimAndNullToEmpty(daoContact.getEmail())) || !trimAndNullToEmpty(contact.getGsm()).equals(trimAndNullToEmpty(daoContact.getGsm()))) {
                    throw new RuntimeException("Data stored for contact '" + contact.getContactName() + "' in TMCDB " + "does not match that comming from the 'contact' node of fault family '" + family.getName() + "'. " + "TMCDB: <" + contact.getEmail() + ", " + contact.getGsm() + ">, " + "CDB: <" + daoContact.getEmail() + ", " + daoContact.getGsm() + ">");
                }
            }
            FaultFamily faultFamily = (FaultFamily) session.createCriteria(FaultFamily.class).add(Restrictions.eq("configuration", config)).add(Restrictions.eq("familyName", family.getName())).uniqueResult();
            if (faultFamily == null) {
                faultFamily = new FaultFamily();
                faultFamily.setFamilyName(family.getName());
                faultFamily.setConfiguration(config);
            }
            faultFamily.setAlarmSource(family.getAlarmSource());
            faultFamily.setHelpURL(family.getHelpUrl());
            faultFamily.setContact(contact);
            session.saveOrUpdate(faultFamily);
            // clear first (in case of update)	
            faultFamily.getAlarmCategories().clear();
            ArrayList<AlarmCategory> list = categoryFaultFamilyLinks.get(family.getName());
            if (list != null)
                for (AlarmCategory category : list) {
                    category.getFaultFamilies().add(faultFamily);
                    faultFamily.getAlarmCategories().add(category);
                    session.update(category);
                    session.update(faultFamily);
                }
            // default fault member
            if (family.getFaultMemberDefault() != null) {
                DefaultMember defaultMember = null;
                // there can be only one
                if (faultFamily.getDefaultMembers().size() != 0)
                    defaultMember = faultFamily.getDefaultMembers().iterator().next();
                if (defaultMember == null) {
                    defaultMember = new DefaultMember();
                    defaultMember.setFaultFamily(faultFamily);
                }
                defaultMember.setLocation(getLocation(session, family.getFaultMemberDefault().getLocation()));
                session.saveOrUpdate(defaultMember);
            } else {
                for (DefaultMember memberToRemove : faultFamily.getDefaultMembers()) {
                    faultFamily.getDefaultMembers().remove(memberToRemove);
                    session.delete(memberToRemove);
                }
                session.update(faultFamily);
            }
            // copy all
            Set<FaultMember> faultMembersToRemove = new HashSet<FaultMember>(faultFamily.getFaultMembers());
            // add fault members
            for (alma.acs.alarmsystem.generated.FaultMember daoFaultMember : family.getFaultMember()) {
                FaultMember faultMember = (FaultMember) session.createCriteria(FaultMember.class).add(Restrictions.eq("memberName", daoFaultMember.getName())).add(Restrictions.eq("faultFamily", faultFamily)).uniqueResult();
                faultMembersToRemove.remove(faultMember);
                if (faultMember == null) {
                    faultMember = new FaultMember();
                    faultMember.setMemberName(daoFaultMember.getName());
                    faultMember.setFaultFamily(faultFamily);
                }
                faultMember.setLocation(getLocation(session, daoFaultMember.getLocation()));
                session.saveOrUpdate(faultMember);
            }
            if (faultMembersToRemove.size() > 0) {
                for (FaultMember faultMemberToRemove : faultMembersToRemove) {
                    faultFamily.getFaultMembers().remove(faultMemberToRemove);
                    session.delete(faultMemberToRemove);
                }
                session.update(faultFamily);
            }
            // copy all
            Set<FaultCode> faultCodesToRemove = new HashSet<FaultCode>(faultFamily.getFaultCodes());
            // add fault codes
            for (alma.acs.alarmsystem.generated.FaultCode daoFaultCode : family.getFaultCode()) {
                FaultCode faultCode = (FaultCode) session.createCriteria(FaultCode.class).add(Restrictions.eq("faultFamily", faultFamily)).add(Restrictions.eq("codeValue", daoFaultCode.getValue())).uniqueResult();
                faultCodesToRemove.remove(faultCode);
                if (faultCode == null) {
                    faultCode = new FaultCode();
                    faultCode.setFaultFamily(faultFamily);
                    faultCode.setCodeValue(daoFaultCode.getValue());
                }
                faultCode.setPriority(daoFaultCode.getPriority());
                faultCode.setCause(daoFaultCode.getCause());
                faultCode.setAction(daoFaultCode.getAction());
                faultCode.setConsequence(daoFaultCode.getConsequence());
                faultCode.setProblemDescription(nonEmptyString(daoFaultCode.getProblemDescription(), "(description)"));
                faultCode.setIsInstant(daoFaultCode.getInstant());
                session.saveOrUpdate(faultCode);
            }
            if (faultCodesToRemove.size() > 0) {
                for (FaultCode faultCodeToRemove : faultCodesToRemove) {
                    faultFamily.getFaultCodes().remove(faultCodeToRemove);
                    session.delete(faultCodeToRemove);
                }
                session.update(faultFamily);
            }
        }
    try {
        alma.alarmsystem.alarmmessage.generated.ReductionDefinitions redDefs = alarmDAO.getReductionDefinitions();
        if (redDefs != null) {
            if (redDefs.getLinksToCreate() != null)
                saveReductionLinks(session, config, redDefs.getLinksToCreate().getReductionLink(), ReductionLinkAction.CREATE);
            if (redDefs.getLinksToRemove() != null)
                saveReductionLinks(session, config, redDefs.getLinksToRemove().getReductionLink(), ReductionLinkAction.REMOVE);
            int count = 0;
            if (redDefs.getThresholds() != null) {
                alma.alarmsystem.alarmmessage.generated.Threshold[] thresholds = redDefs.getThresholds().getThreshold();
                for (alma.alarmsystem.alarmmessage.generated.Threshold threshold : thresholds) {
                    // also commit first
                    if (count % 100 == 0) {
                        session.getTransaction().commit();
                        // cleanup first level cache
                        session.clear();
                        session.beginTransaction();
                        config = (Configuration) session.get(Configuration.class, config.getConfigurationId());
                    }
                    count++;
                    alma.acs.tmcdb.AlarmDefinition alarm = getAlarmDefinition(session, config, threshold.getAlarmDefinition(), false);
                    alma.acs.tmcdb.ReductionThreshold t = (alma.acs.tmcdb.ReductionThreshold) session.createQuery("from ReductionThreshold " + "where AlarmDefinitionId = " + alarm.getAlarmDefinitionId()).uniqueResult();
                    if (t == null) {
                        t = new ReductionThreshold();
                        t.setAlarmDefinition(alarm);
                        t.setConfiguration(config);
                    }
                    t.setValue(threshold.getValue());
                    session.saveOrUpdate(t);
                }
            }
        }
    } finally {
        // clear cache (to free memory)
        adCache.clear();
    }
}
Also used : FaultCode(alma.acs.tmcdb.FaultCode) AlarmCategory(alma.acs.tmcdb.AlarmCategory) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ReductionThreshold(alma.acs.tmcdb.ReductionThreshold) ACSCategoryDAOImpl(com.cosylab.acs.laser.dao.ACSCategoryDAOImpl) DefaultMember(alma.acs.tmcdb.DefaultMember) ReductionThreshold(alma.acs.tmcdb.ReductionThreshold) ACSAlarmDAOImpl(com.cosylab.acs.laser.dao.ACSAlarmDAOImpl) AlarmCategory(alma.acs.tmcdb.AlarmCategory) ReductionThreshold(alma.acs.tmcdb.ReductionThreshold) FaultMember(alma.acs.tmcdb.FaultMember) Contact(alma.acs.tmcdb.Contact) FaultFamily(alma.acs.tmcdb.FaultFamily) ACSResponsiblePersonDAOImpl(com.cosylab.acs.laser.dao.ACSResponsiblePersonDAOImpl)

Example 3 with Contact

use of alma.acs.tmcdb.Contact in project ACS by ACS-Community.

the class HibernateWDALAlarmPluginImpl method updateEpilogue.

/* (non-Javadoc)
	 * @see com.cosylab.cdb.jdal.hibernate.plugin.HibernateWDALPlugin#updateEpilogue(org.hibernate.Session, alma.acs.tmcdb.Configuration, java.util.Map)
	 */
@SuppressWarnings("unchecked")
public static void updateEpilogue(Session session, Configuration config, Map<String, Object> rootMap, Logger m_logger, String curl) {
    if (!curl.startsWith("Alarms"))
        return;
    else if (curl.matches("Alarms")) {
        loadEpilogue(session, config, rootMap, m_logger);
        return;
    }
    String c = curl.replaceFirst("Alarms/", "");
    try {
        DOMConfigurationAccessor conf = new DOMConfigurationAccessor();
        conf.setSession(session);
        Map<String, Object> alarmsRoot = new RootMap<String, Object>();
        Map<String, Object> administrativeRoot = new RootMap<String, Object>();
        alarmsRoot.put("Administrative", administrativeRoot);
        administrativeRoot.put("AlarmSystemConfiguration", new AlarmSystemConfiguration());
        Categories categoriesMap = new Categories(session, config, conf, rootMap, m_logger);
        administrativeRoot.put("Categories", categoriesMap);
        conf.put(Categories.CATEGORY_DEFINITION_PATH, categoriesMap);
        // categories
        int counter = 0;
        List<AlarmCategory> categories = session.createCriteria(AlarmCategory.class).add(Restrictions.eq("configuration", config)).list();
        for (AlarmCategory category : categories) {
            ArrayList<String> families = new ArrayList<String>();
            for (FaultFamily family : category.getFaultFamilies()) families.add(family.getFamilyName());
            categoriesMap.put("category" + String.valueOf(counter++), new alma.TMCDB.alarm.Category(category.getPath(), category.getDescription(), category.getIsDefault(), families.toArray(new String[families.size()])));
        }
        // fault families
        Map<String, alma.TMCDB.alarm.FaultFamily> faultFamiliesMap = new FaultFamiliesMap(session, config, conf, rootMap, m_logger);
        alarmsRoot.put("AlarmDefinitions", faultFamiliesMap);
        conf.put(FaultFamiliesMap.ALARM_CATEGORY_DEFINITION_PATH, faultFamiliesMap);
        counter = 0;
        List<FaultFamily> families = session.createCriteria(FaultFamily.class).add(Restrictions.eq("configuration", config)).addOrder(Order.asc("familyName")).list();
        for (FaultFamily family : families) {
            Contact contact = family.getContact();
            alma.TMCDB.alarm.FaultFamily faultFamily = new alma.TMCDB.alarm.FaultFamily(family.getFamilyName(), family.getAlarmSource(), family.getHelpURL(), new alma.TMCDB.alarm.Contact(contact.getContactName(), contact.getEmail(), contact.getGsm()));
            faultFamiliesMap.put("fault-family" + String.valueOf(counter++), faultFamily);
            // fault codes
            int codeCounter = 0;
            List<FaultCode> faultCodes = session.createCriteria(FaultCode.class).add(Restrictions.eq("faultFamily", family)).list();
            for (FaultCode faultCode : faultCodes) {
                faultFamily._.put("fault-code" + String.valueOf(codeCounter++), new alma.TMCDB.alarm.FaultCode(faultCode.getCodeValue(), faultCode.getIsInstant(), faultCode.getPriority(), faultCode.getCause(), faultCode.getAction(), faultCode.getConsequence(), faultCode.getProblemDescription()));
            }
            // default fault member
            DefaultMember defaultMember = (DefaultMember) session.createCriteria(DefaultMember.class).add(Restrictions.eq("faultFamily", family)).uniqueResult();
            if (defaultMember != null) {
                alma.TMCDB.alarm.Location location = getLocation(session, defaultMember.getLocation());
                faultFamily._.put("fault-member-default", new FaultMemberDefault(location));
            }
            // fault members
            int faultMemberCounter = 0;
            List<FaultMember> faultMembers = session.createCriteria(FaultMember.class).add(Restrictions.eq("faultFamily", family)).list();
            for (FaultMember faultMember : faultMembers) {
                alma.TMCDB.alarm.Location location = getLocation(session, faultMember.getLocation());
                faultFamily._.put("fault-member" + String.valueOf(faultMemberCounter++), new alma.TMCDB.alarm.FaultMember(faultMember.getMemberName(), location));
            }
        }
        // reductions
        ReductionDefinitions redDefs = new ReductionDefinitions(session, config, conf, rootMap, m_logger);
        administrativeRoot.put("ReductionDefinitions", redDefs);
        int linkCount = 0;
        List<alma.acs.tmcdb.ReductionLink> links = session.createCriteria(alma.acs.tmcdb.ReductionLink.class).add(Restrictions.eq("configuration", config)).list();
        for (alma.acs.tmcdb.ReductionLink link : links) {
            alma.acs.tmcdb.AlarmDefinition parent = link.getAlarmDefinitionByParentalarmdefid();
            alma.acs.tmcdb.AlarmDefinition child = link.getAlarmDefinitionByChildalarmdefid();
            ReductionLinks toLink;
            if (link.getAction() == ReductionLinkAction.CREATE)
                toLink = redDefs.getLinksToCreate();
            else if (link.getAction() == ReductionLinkAction.REMOVE)
                toLink = redDefs.getLinksToRemove();
            else
                throw new RuntimeException("unsupported reduction link action '" + link.getAction() + "' for ReductionLink with id: " + link.getReductionLinkId());
            toLink._.put("link" + (linkCount++), new ReductionLink(link.getType().toString(), new AlarmDefinition(parent.getFaultFamily(), parent.getFaultMember(), parent.getFaultCode()), new AlarmDefinition(child.getFaultFamily(), child.getFaultMember(), child.getFaultCode())));
        }
        int thresholdCount = 0;
        List<alma.acs.tmcdb.ReductionThreshold> thresholds = session.createCriteria(alma.acs.tmcdb.ReductionThreshold.class).add(Restrictions.eq("configuration", config)).list();
        for (alma.acs.tmcdb.ReductionThreshold threshold : thresholds) {
            alma.acs.tmcdb.AlarmDefinition alarm = threshold.getAlarmDefinition();
            redDefs.getThresholds()._.put("threshold" + (thresholdCount++), new alma.TMCDB.alarm.ReductionThreshold(threshold.getValue(), new AlarmDefinition(alarm.getFaultFamily(), alarm.getFaultMember(), alarm.getFaultCode())));
        }
        // alarm configuration
        rootMap.put("Alarms", alarmsRoot);
    } catch (Throwable th) {
        m_logger.log(Level.SEVERE, "Failed to update all the alarm data.", th);
    }
}
Also used : FaultCode(alma.acs.tmcdb.FaultCode) RootMap(com.cosylab.cdb.jdal.hibernate.RootMap) ArrayList(java.util.ArrayList) ReductionThreshold(alma.acs.tmcdb.ReductionThreshold) ReductionDefinitions(alma.TMCDB.alarm.ReductionDefinitions) DefaultMember(alma.acs.tmcdb.DefaultMember) FaultFamiliesMap(alma.TMCDB.alarm.FaultFamiliesMap) ReductionLink(alma.TMCDB.alarm.ReductionLink) ReductionThreshold(alma.acs.tmcdb.ReductionThreshold) AlarmCategory(alma.acs.tmcdb.AlarmCategory) FaultMember(alma.acs.tmcdb.FaultMember) DOMConfigurationAccessor(alma.TMCDB.alarm.DOMConfigurationAccessor) Categories(alma.TMCDB.alarm.Categories) AlarmDefinition(alma.TMCDB.alarm.AlarmDefinition) Contact(alma.acs.tmcdb.Contact) FaultMemberDefault(alma.TMCDB.alarm.FaultMemberDefault) ReductionLinks(alma.TMCDB.alarm.ReductionLinks) FaultFamily(alma.acs.tmcdb.FaultFamily) AlarmSystemConfiguration(alma.TMCDB.alarm.AlarmSystemConfiguration)

Aggregations

AlarmCategory (alma.acs.tmcdb.AlarmCategory)3 Contact (alma.acs.tmcdb.Contact)3 DefaultMember (alma.acs.tmcdb.DefaultMember)3 FaultCode (alma.acs.tmcdb.FaultCode)3 FaultFamily (alma.acs.tmcdb.FaultFamily)3 FaultMember (alma.acs.tmcdb.FaultMember)3 ReductionThreshold (alma.acs.tmcdb.ReductionThreshold)3 ArrayList (java.util.ArrayList)3 AlarmDefinition (alma.TMCDB.alarm.AlarmDefinition)2 AlarmSystemConfiguration (alma.TMCDB.alarm.AlarmSystemConfiguration)2 Categories (alma.TMCDB.alarm.Categories)2 DOMConfigurationAccessor (alma.TMCDB.alarm.DOMConfigurationAccessor)2 FaultFamiliesMap (alma.TMCDB.alarm.FaultFamiliesMap)2 FaultMemberDefault (alma.TMCDB.alarm.FaultMemberDefault)2 ReductionDefinitions (alma.TMCDB.alarm.ReductionDefinitions)2 ReductionLink (alma.TMCDB.alarm.ReductionLink)2 ReductionLinks (alma.TMCDB.alarm.ReductionLinks)2 RootMap (com.cosylab.cdb.jdal.hibernate.RootMap)2 ACSAlarmDAOImpl (com.cosylab.acs.laser.dao.ACSAlarmDAOImpl)1 ACSCategoryDAOImpl (com.cosylab.acs.laser.dao.ACSCategoryDAOImpl)1