Package it.eng.spagobi.tools.distributionlist.bo

Examples of it.eng.spagobi.tools.distributionlist.bo.DistributionList


   * @param response The response Source Bean
   * @throws EMFUserError If an exception occurs
   */ 
  private void insertEmail(SourceBean request, String mod, SourceBean response) throws EMFUserError, SourceBeanException  {
   
    DistributionList dl = DAOFactory.getDistributionListDAO().loadDistributionListById(new Integer((String)request.getAttribute("DL_ID")));   
    response.setAttribute("dlObj", dl);
    String id = (String) request.getAttribute("DL_ID");
    response.setAttribute("DL_ID", id);

    response.setAttribute("modality", mod);
View Full Code Here


   
    String id = "";
    String email = "";
    String userId ="";
    String submessagedet = "";
    DistributionList dl = null;
    try {
           
      this.modalita = SpagoBIConstants.DETAIL_SUBSC;
     
      id = (String) request.getAttribute("DL_ID");
View Full Code Here

      String id = (String) request.getAttribute("DL_ID");
      this.modalita = SpagoBIConstants.DETAIL_UNSUBSC;
      IEngUserProfile userProfile = UserUtilities.getUserProfile();
      String userId = (String)((UserProfile)userProfile).getUserId();
      //load the dl
      DistributionList dl = DAOFactory.getDistributionListDAO().loadDistributionListById(new Integer(id));

      DAOFactory.getDistributionListDAO().unsubscribeFromDistributionList(dl, userId);
    }
    catch (EMFUserError e){
        logger.error("Cannot fill response container" + e.getLocalizedMessage());
View Full Code Here

   * @param response The response Source Bean
   * @throws EMFUserError If an exception occurs
   */  
  private void getDistributionList(SourceBean request, SourceBean response) throws EMFUserError {   
    try {                      
      DistributionList dl = DAOFactory.getDistributionListDAO().loadDistributionListById(new Integer((String)request.getAttribute("DL_ID")));   
      this.modalita = SpagoBIConstants.DETAIL_SELECT;
      IDomainDAO domaindao = DAOFactory.getDomainDAO();
      List dialects = domaindao.loadListDomainsByType("DIALECT_HIB");
      response.setAttribute(NAME_ATTR_LIST_DIALECTS, dialects);
      response.setAttribute("modality", modalita);
View Full Code Here

   */
  public DistributionList loadDistributionListById(Integer Id)
      throws EMFUserError {

    logger.debug("IN");
    DistributionList toReturn = null;
    Session aSession = null;
    Transaction tx = null;

    try {
      aSession = getSession();
View Full Code Here

  /* (non-Javadoc)
   * @see it.eng.spagobi.tools.distributionlist.dao.IDistributionListDAO#loadDistributionListByName(java.lang.String)
   */
  public DistributionList loadDistributionListByName(String name) throws EMFUserError {
    logger.debug("IN");
    DistributionList biDL = null;
    Session tmpSession = null;
    Transaction tx = null;
    try {
      tmpSession = getSession();
      tx = tmpSession.beginTransaction();
View Full Code Here

   * @param hibDistributionList the hib distribution list
   *
   * @return the distribution list
   */
  public DistributionList toDistributionList(SbiDistributionList hibDistributionList){
    DistributionList dl = new DistributionList();
   
    dl.setId((hibDistributionList.getDlId()).intValue());
    dl.setName(hibDistributionList.getName());
    dl.setDescr(hibDistributionList.getDescr())
   
    //Gets all userids and respective emails and puts them into a list of Emails
    List emails = new ArrayList();
    Set s = hibDistributionList.getSbiDistributionListUsers();
    Iterator i = s.iterator();
    while(i.hasNext()){
      SbiDistributionListUser dls =(SbiDistributionListUser) i.next();
      String userId = dls.getUserId();
      String e_mail = dls.getEMail();
      Email email = new Email();
      email.setUserId(userId);
      email.setEmail(e_mail);
      emails.add(email);     
    }

    dl.setEmails(emails);
   
    //Gets all documents related to the distribution list and puts them into a list of documents
    List documents = new ArrayList();
    Set d = hibDistributionList.getSbiDistributionListsObjectses();
    Iterator it = d.iterator();
    while(it.hasNext()){
      SbiDistributionListsObjects dlo =(SbiDistributionListsObjects) it.next();
      SbiObjects so = dlo.getSbiObjects();
      BIObjectDAOHibImpl objDAO=null;
      try {
        objDAO = (BIObjectDAOHibImpl)DAOFactory.getBIObjectDAO();
        BIObject obj = objDAO.toBIObject(so);
        documents.add(obj);
      } catch (EMFUserError e) {

      }

     
    }

    dl.setDocuments(documents);
 
    return dl;
  }
View Full Code Here

   * @throws EMFUserError If an exception occurs
   */  
  private void getDistributionList(SourceBean request, SourceBean response) throws EMFUserError
    logger.debug("IN");
    try {                      
      DistributionList dl = DAOFactory.getDistributionListDAO().loadDistributionListById(new Integer((String)request.getAttribute("DL_ID")));   
      this.modalita = SpagoBIConstants.DETAIL_MOD;
      if (request.getAttribute("SUBMESSAGEDET") != null &&
        ((String)request.getAttribute("SUBMESSAGEDET")).equalsIgnoreCase(MOD_SAVEBACK))
      {
        response.setAttribute("loopback", "true");
View Full Code Here

      SessionContainer permSess = sessCont.getPermanentContainer();
      IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

      IDistributionListDAO dao=DAOFactory.getDistributionListDAO();
      dao.setUserProfile(profile);
      DistributionList dlNew = recoverDistributionListDetails(serviceRequest);
     
      EMFErrorHandler errorHandler = getErrorHandler();
      
      // if there are some validation errors into the errorHandler it does not write into DB
      Collection errors = errorHandler.getErrors();
      if (errors != null && errors.size() > 0) {
        Iterator iterator = errors.iterator();
        while (iterator.hasNext()) {
          Object error = iterator.next();
          if (error instanceof EMFValidationError) {
            serviceResponse.setAttribute("dlObj", dlNew);
            serviceResponse.setAttribute("modality", mod);
            return;
          }
        }
      }
     
      if (mod.equalsIgnoreCase(SpagoBIConstants.DETAIL_INS)) {     
        //if a dl with the same name does not exist in the db ok, else error
        if (dao.loadDistributionListByName(dlNew.getName()) != null){
          HashMap params = new HashMap();
          params.put(AdmintoolsConstants.PAGE, ListDistributionListModule.MODULE_PAGE);
          EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 9100, new Vector(), params );
          getErrorHandler().addError(error);
          return;
        }      
        
        dao.insertDistributionList(dlNew);
       
        //gets the new setted Id from the DL just inserted and puts it into dlNew
        DistributionList tmpDL = dao.loadDistributionListByName(dlNew.getName());
        dlNew.setId(tmpDL.getId());
        mod = SpagoBIConstants.DETAIL_MOD;
      } else {       
        //updates dl
        dao.modifyDistributionList(dlNew);     
     
View Full Code Here

    logger.debug("IN");
    try {
      String id = (String) request.getAttribute("DL_ID");
     
      //deletes the dl
      DistributionList dl = DAOFactory.getDistributionListDAO().loadDistributionListById(new Integer(id));
      DAOFactory.getDistributionListDAO().eraseDistributionList(dl);
    }
    catch (EMFUserError e){
        logger.error("Cannot fill response container" + e.getLocalizedMessage());
        HashMap params = new HashMap();     
View Full Code Here

TOP

Related Classes of it.eng.spagobi.tools.distributionlist.bo.DistributionList

Copyright © 2018 www.massapicom. 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.