Package it.eng.spagobi.behaviouralmodel.lov.metadata

Examples of it.eng.spagobi.behaviouralmodel.lov.metadata.SbiLov


       
        List hibList = hibQuery.list();
        if (!hibList.isEmpty()){
        Iterator it = hibList.iterator()
        while (it.hasNext()) {
          SbiLov lov = (SbiLov)it.next();
          String prov = lov.getLovProvider();
            SourceBean sb = SourceBean.fromXMLString(prov);
            SourceBean conn = (SourceBean)sb.getAttribute("CONNECTION");
            String conne = conn.getCharacters();
            if (conne.equals(hibDataSource.getLabel())){
              int cutStart = prov.indexOf("<CONNECTION>");
              cutStart = cutStart+12;
              int cutEnd = prov.indexOf("</CONNECTION>");
              String firstPart = prov.substring(0, cutStart);
              String secondPart = prov.substring(cutEnd, prov.length());
              prov = firstPart+aDataSource.getLabel()+secondPart;
              lov.setLovProvider(prov);
              aSession.update(lov);
            }
           
        }}
      }}
View Full Code Here


  Transaction tx = null;
  try {
      aSession = getSession();
      tx = aSession.beginTransaction();

      SbiLov hibLov = (SbiLov) aSession.load(SbiLov.class, modalitiesValueID);
      modVal = toModalityValue(hibLov);
      tx.commit();

  } catch (HibernateException he) {
      logger.error("HibernateException", he);
View Full Code Here

      tx = aSession.beginTransaction();
      //String hql = "from SbiLov s where s.label = '" + label + "'";
      String hql = "from SbiLov s where s.label = ?" ;
      Query hqlQuery = aSession.createQuery(hql);
      hqlQuery.setString(0, label);
      SbiLov hibLov = (SbiLov) hqlQuery.uniqueResult();
      modVal = toModalityValue(hibLov);
      tx.commit();
  } catch (HibernateException he) {
      logger.error("HibernateException", he);
      if (tx != null)
View Full Code Here

  Session aSession = null;
  Transaction tx = null;
  try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiLov hibLov = (SbiLov) aSession.load(SbiLov.class, aModalitiesValue.getId());
      hibLov.setName(aModalitiesValue.getName());
      hibLov.setLabel(aModalitiesValue.getLabel());
      hibLov.setDescr(aModalitiesValue.getDescription());
      SbiDomains inpType = (SbiDomains) aSession.load(SbiDomains.class,
        new Integer(aModalitiesValue.getITypeId()));
      hibLov.setInputType(inpType);
      hibLov.setInputTypeCd(aModalitiesValue.getITypeCd());
      hibLov.setLovProvider(aModalitiesValue.getLovProvider());
      updateSbiCommonInfo4Update(hibLov);
      tx.commit();
  } catch (HibernateException he) {
      logger.error("HibernateException", he);
View Full Code Here

  Session aSession = null;
  Transaction tx = null;
  try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiLov hibLov = new SbiLov();
      hibLov.setName(aModalitiesValue.getName());
      hibLov.setLabel(aModalitiesValue.getLabel());
      hibLov.setDescr(aModalitiesValue.getDescription());
      SbiDomains inpType = (SbiDomains) aSession.load(SbiDomains.class,
        new Integer(aModalitiesValue.getITypeId()));
      hibLov.setInputType(inpType);
      hibLov.setInputTypeCd(aModalitiesValue.getITypeCd());
      hibLov.setLovProvider(aModalitiesValue.getLovProvider());
      updateSbiCommonInfo4Insert(hibLov);
      aSession.save(hibLov);
      tx.commit();
  } catch (HibernateException he) {
      logger.error("HibernateException", he);
View Full Code Here

  Session aSession = null;
  Transaction tx = null;
  try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiLov hibLov = (SbiLov) aSession.load(SbiLov.class, aModalitiesValue.getId());
      aSession.delete(hibLov);
      tx.commit();
  } catch (HibernateException he) {
      logger.debug("HibernateException", he);
View Full Code Here

      SbiParameters hibParameters = (SbiParameters)session.load(SbiParameters.class, parUse.getId());
      hibParuse.setSbiParameters(hibParameters);
      // Set the relation with idLov (if the parameter ha a lov related)
      Integer lovId = parUse.getIdLov();
      if(lovId!=null){
        SbiLov hibLov = (SbiLov)session.load(SbiLov.class, parUse.getIdLov());
        hibParuse.setSbiLov(hibLov);
      }
      hibParuse.setLabel(parUse.getLabel());
      hibParuse.setName(parUse.getName());
      hibParuse.setDescr(parUse.getDescription());
View Full Code Here

      Query hibQuery = session.createQuery(" from SbiLov where lovId = " + lov.getId());
      List hibList = hibQuery.list();
      if(!hibList.isEmpty()) {
        return;
      }
      SbiLov hibLov = new SbiLov(lov.getId());
      hibLov.setName(lov.getName());
      hibLov.setLabel(lov.getLabel());
      hibLov.setDescr(lov.getDescription());
      SbiDomains inpType = (SbiDomains)session.load(SbiDomains.class, new Integer(lov.getITypeId()));
      hibLov.setInputType(inpType);
      hibLov.setInputTypeCd(lov.getITypeCd());
      hibLov.setLovProvider(lov.getLovProvider());
      session.save(hibLov);
      tx.commit();
    } catch (Exception e) {
      logger.error("Error while inserting lov into export database " , e);
      throw new EMFUserError(EMFErrorSeverity.ERROR, "8005", "component_impexp_messages");
View Full Code Here

   * @throws EMFUserError the EMF user error
   */
  public void updateDSRefs(Map associations,  Session session, MetadataLogger log)
  throws EMFUserError {
    logger.debug("IN");
    SbiLov lov = null;
    try {
      List lovs = getAllExportedSbiObjects(session, "SbiLov", null);
      Iterator iterLovs = lovs.iterator();
      while (iterLovs.hasNext()) {
        lov = (SbiLov) iterLovs.next();
        if (lov.getInputTypeCd().equalsIgnoreCase("QUERY")) {
          String lovProv = lov.getLovProvider();
          QueryDetail qDet = QueryDetail.fromXML(lovProv);
          String oldDataSource = qDet.getDataSource();
          String assDataSource = (String) associations.get(oldDataSource);

          // register user association
          if ((assDataSource != null) && !assDataSource.trim().equals("") && (oldDataSource != null)
              && !oldDataSource.trim().equals("")) {

            qDet.setDataSource(assDataSource);
            lovProv = qDet.toXML();
            lov.setLovProvider(lovProv);
            session.save(lov);
            log.log("Changed the data source label from " + oldDataSource + " to " + assDataSource
                + " for the lov " + lov.getName());
          }
        }
      }
    } catch (Exception e) {
      if (lov != null) {
        logger.error("Error while updating connection reference for exported lov with label [" + lov.getLabel() + "].", e);
      }
      logger.error("Error while updating connection references ", e);
      throw new EMFUserError(EMFErrorSeverity.ERROR, "8004", "component_impexp_messages");
    } finally {
      logger.debug("OUT");
View Full Code Here

      return hibBIObj;
    } else if (hibObj instanceof SbiLov) {
      String label = (String) unique;
      hql = "from SbiLov lov where lov.label = '" + label + "'";
      hqlQuery = sessionCurrDB.createQuery(hql);
      SbiLov hibLov = (SbiLov) hqlQuery.uniqueResult();
      return hibLov;
    } else if (hibObj instanceof SbiFunctions) {
      String code = (String) unique;
      hql = "from SbiFunctions f where f.code = '" + code + "'";
      hqlQuery = sessionCurrDB.createQuery(hql);
View Full Code Here

TOP

Related Classes of it.eng.spagobi.behaviouralmodel.lov.metadata.SbiLov

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.