Examples of SbiAlarmContact


Examples of it.eng.spagobi.kpi.alarm.metadata.SbiAlarmContact

   *
   * @throws EMFUserError
   */
  private void importAlarmContact(boolean overwrite) throws EMFUserError {
    logger.debug("IN");
    SbiAlarmContact exportedAlarmContact = null;
    try {
      List exportedAlarmContacts = importer.getAllExportedSbiObjects(sessionExpDB, "SbiAlarmContact", null);
      Iterator iterSbiAlarmContact = exportedAlarmContacts.iterator();
      while (iterSbiAlarmContact.hasNext()) {
        exportedAlarmContact = (SbiAlarmContact) iterSbiAlarmContact.next();
        Integer oldId = exportedAlarmContact.getId();
        Integer existingAlarmContactId = null;
        Map alarmContactIdAss = metaAss.getAlarmContactIDAssociation();
        Set alarmContactIdAssSet = alarmContactIdAss.keySet();
        if (alarmContactIdAssSet.contains(oldId) && !overwrite) {
          metaLog.log("Exported alarm Contact " + exportedAlarmContact.getName() + " not inserted"
              + " because it has the same label of an existing alarm Contact");
          continue;
        } else {
          existingAlarmContactId = (Integer) alarmContactIdAss.get(oldId);
        }
        if (existingAlarmContactId != null) {
          logger.info("The Alarm Contact with id:[" + exportedAlarmContact.getId() + "] is just present. It will be updated.");
          metaLog.log("The Alarm Contact with name = [" + exportedAlarmContact.getName() + "] will be updated.");
          SbiAlarmContact existingAlarmContact = ImportUtilities.modifyExistingSbiAlarmContacts(exportedAlarmContact, sessionCurrDB, existingAlarmContactId, metaAss,importer);
          sessionCurrDB.update(existingAlarmContact);
        } else {
          SbiAlarmContact newAlarmContact = ImportUtilities.makeNewSbiAlarmContacts(exportedAlarmContact, sessionCurrDB, metaAss, importer);
          sessionCurrDB.save(newAlarmContact);
          metaLog.log("Inserted new Alarm Contact " + newAlarmContact.getName());
          Integer newId = newAlarmContact.getId();
          metaAss.insertCoupleAlarmContact(oldId, newId);
        }
      }
    } catch (Exception e) {
      if (exportedAlarmContact != null) {
View Full Code Here

Examples of it.eng.spagobi.kpi.alarm.metadata.SbiAlarmContact

 
  private Set<SbiAlarmContact> deserializeContactsJSONArray(JSONArray rows) throws JSONException{
    Set<SbiAlarmContact> toReturn = new HashSet<SbiAlarmContact>();
    for(int i=0; i< rows.length(); i++){
      JSONObject obj = (JSONObject)rows.get(i);
      SbiAlarmContact c = new SbiAlarmContact();
      Integer id = obj.getInt("id")
      String email = obj.getString("email")
      String mobile = obj.getString("mobile")
      String resources = obj.getString("resources")
      String name = obj.getString("name")
      c.setEmail(email);
      c.setId(id);
      c.setMobile(mobile);
      c.setName(name);
      c.setResources(resources);
      toReturn.add(c);
   
    return toReturn;
  }
View Full Code Here

Examples of it.eng.spagobi.kpi.alarm.metadata.SbiAlarmContact

    public SbiAlarmContact findById(Integer id) {
        Session session = getSession();
        Transaction tx = null;
        try {
          tx = session.beginTransaction();
      SbiAlarmContact item = (SbiAlarmContact)session.get(SbiAlarmContact.class, id);
      tx.commit();
      return item;
     
    } catch (HibernateException e) {
      if( tx != null && tx.isActive() ){
View Full Code Here

Examples of it.eng.spagobi.kpi.alarm.metadata.SbiAlarmContact

    public AlarmContact loadById(Integer id) {
        Session session = getSession();
        Transaction tx = null;
        try {
          tx = session.beginTransaction();
      SbiAlarmContact item = (SbiAlarmContact)session.get(SbiAlarmContact.class, id);
      tx.commit();
      AlarmContact alarmContact=toAlarmContact(item);
      return alarmContact;
     
    } catch (HibernateException e) {
View Full Code Here

Examples of it.eng.spagobi.kpi.alarm.metadata.SbiAlarmContact

      Set<SbiAlarmContact> alarmContacts = sbiAlarm.getSbiAlarmContacts();     
      JSONArray contactsJSON = new JSONArray();
     
      while(itAllContacts.hasNext()){
        JSONObject jsonContact = new JSONObject();
        SbiAlarmContact contact = (SbiAlarmContact)itAllContacts.next();
        if(contact!=null){
          Integer contactId = contact.getId();
          jsonContact.put("id", contact.getId());
          jsonContact.put("name", contact.getName());         
          jsonContact.put("mobile", contact.getMobile());
          jsonContact.put("email", contact.getEmail());
          jsonContact.put("resources", contact.getResources());
          Iterator itTemp = alarmContacts.iterator();
          boolean contained = false;
          while(itTemp.hasNext()){
            SbiAlarmContact c =(SbiAlarmContact)itTemp.next();
            if(c.getId().equals(contactId)){
              jsonContact.put("checked", true);
              contained = true;
              break;
            }
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.