Package it.eng.spagobi.tools.udp.metadata

Examples of it.eng.spagobi.tools.udp.metadata.SbiUdp



  @SuppressWarnings("unchecked")
  public SbiUdp findById(Integer id) {
    logger.debug("IN");
    SbiUdp prop = null;
    Session session = getSession();
    Transaction tx = null;
    try {
      tx = session.beginTransaction();
      prop = (SbiUdp)session.get(SbiUdp.class, id);
View Full Code Here


    Session session = getSession();
    Udp udp = null;
    Transaction tx = null;
    try {
      tx = session.beginTransaction();
      SbiUdp prop = (SbiUdp)session.get(SbiUdp.class, id);
      tx.commit();
      udp=toUdp(prop);
    } catch (HibernateException e) {
      if( tx != null && tx.isActive() ){
        tx.rollback();
View Full Code Here

        Integer family = tmpDomain.getValueId();
        Boolean isMultivalue = Boolean.valueOf(getAttributeAsBoolean(IS_MULTIVALUE));
       
        String id = getAttributeAsString(ID);
       
        SbiUdp udp = new SbiUdp();
        udp.setName(name);
        udp.setLabel(label);
        udp.setDescription(description);
        udp.setTypeId(type);
        udp.setFamilyId(family);
        udp.setIsMultivalue(isMultivalue);
     
        if(id != null && !id.equals("") && !id.equals("0")){             
          udp.setUdpId(Integer.valueOf(id));
          udpDao.update(udp);
          logger.debug("User attribute "+id+" updated");
          JSONObject attributesResponseSuccessJSON = new JSONObject()
          attributesResponseSuccessJSON.put("success", true)
          attributesResponseSuccessJSON.put("responseText", "Operation succeded");
View Full Code Here

      tmpSession = getSession();
      tx = tmpSession.beginTransaction();
      Criterion labelCriterrion = Expression.eq("label", label);
      Criteria criteria = tmpSession.createCriteria(SbiUdp.class);
      criteria.add(labelCriterrion)
      SbiUdp hibUDP = (SbiUdp) criteria.uniqueResult();
      if (hibUDP == null) return null;
      udp = toUdp(hibUDP);       

      tx.commit();
    } catch (HibernateException he) {
View Full Code Here

      Criteria criteria2 = tmpSession.createCriteria(SbiUdp.class);
      criteria2.add(labelCriterrion)
      Criterion famCriterrion = Expression.eq("familyId", famiDom.getValueId());
      criteria2.add(famCriterrion)

      SbiUdp hibUDP = (SbiUdp) criteria2.uniqueResult();
      if (hibUDP == null) return null;
      udp = toUdp(hibUDP);       

      tx.commit();
    } catch (HibernateException he) {
View Full Code Here

      List<SbiUdp> list = (List<SbiUdp>)query.list();
      if(list != null){
        toReturn = new ArrayList<Udp>();
        for (Iterator iterator = list.iterator(); iterator.hasNext();) {
          SbiUdp sbiUdp = (SbiUdp) iterator.next();
          Udp udp = toUdp(sbiUdp);
          toReturn.add(udp);
        }
      }
      tx.commit();
View Full Code Here

        sbiUdpValue.setName(udpValue.getName());
        sbiUdpValue.setProg(udpValue.getProg());
        sbiUdpValue.setFamily(udpValue.getFamily());

        sbiUdpValue.setReferenceId(idObject);
        SbiUdp hibUdp = (SbiUdp) aSession.load(SbiUdp.class,
            udpId);
        sbiUdpValue.setSbiUdp(hibUdp);
        sbiUdpValue.setValue(udpValue.getValue());

        if(inserting){
          logger.debug("Inserting Udp association between udp "+udpValue.getLabel() + " referencing family " + udpValue.getFamily() +
              " with id "+ udpValue.getReferenceId() + "with value "+sbiUdpValue.getValue());
          sbiUdpValue.setBeginTs(new Date());
          DAOFactory.getUdpDAOValue().insert(aSession, sbiUdpValue);         
          logger.debug("value to Udp "+hibUdp.getLabel()+ " has been inserted");
        }
        else{
          // the update must close the previous record and open a new one, but only if value has changed
          if(openNewOne){
            logger.debug("Close previous udp value and open Udp association between udp "+udpValue.getLabel() + " referencing family " + udpValue.getFamily() +
                " with id "+ udpValue.getReferenceId() + "with value "+sbiUdpValue.getValue());
            // close previous one
            sbiUdpValueToClose.setBeginTs(already.getBeginTs());
            sbiUdpValueToClose.setEndTs(new Date());
            DAOFactory.getUdpDAOValue().update(aSession, sbiUdpValueToClose);
            // insert new one
            sbiUdpValue.setBeginTs(new Date());
            DAOFactory.getUdpDAOValue().insert(aSession, sbiUdpValue);
          }
          else{
            logger.debug("Update without closing Udp association between udp "+udpValue.getLabel() + " referencing family " + udpValue.getFamily() +
                " with id "+ udpValue.getReferenceId() + "with value "+sbiUdpValue.getValue());           
            // just update fields no new opening
            sbiUdpValue.setBeginTs(already.getBeginTs());
            DAOFactory.getUdpDAOValue().update(aSession, sbiUdpValue);           
          }

          logger.debug("value to Udp "+hibUdp.getLabel()+ " has been updated; associated to a "+family);
        }
      }
    } 
    logger.debug("OUT");
View Full Code Here

   *
   * @return the new hibernate parameter object
   */
  public static SbiUdp makeNewSbiUdp(SbiUdp udp,Session sessionCurrDB, MetadataAssociations metaAss, ImporterMetadata importer){
    logger.debug("IN");
    SbiUdp newUdp = new SbiUdp();
    try{
      newUdp.setDescription(udp.getDescription());
      newUdp.setIsMultivalue(udp.isIsMultivalue());
      newUdp.setLabel(udp.getLabel());
      newUdp.setName(udp.getName());

      // associations
      entitiesAssociationsSbiUdp(udp, newUdp, sessionCurrDB, metaAss, importer);

      logger.debug("OUT");
    }
    catch (Exception e) {
      logger.error("Error in creating new udp with exported id " + newUdp.getUdpId());     
    }
    return newUdp;
  }
View Full Code Here

   *
   * @throws EMFUserError the EMF user error
   */
  public static SbiUdp modifyExistingUdp(SbiUdp exportedUdp, Session sessionCurrDB, Integer existingUdpId) throws EMFUserError {
    logger.debug("IN");
    SbiUdp existingSbiUdp = null;
    try {
      existingSbiUdp = (SbiUdp) sessionCurrDB.load(SbiUdp.class, existingUdpId);

      existingSbiUdp.setDescription(exportedUdp.getDescription());
      existingSbiUdp.setIsMultivalue(exportedUdp.isIsMultivalue());
      existingSbiUdp.setLabel(exportedUdp.getLabel());
      existingSbiUdp.setName(exportedUdp.getName());


    }

    finally {
View Full Code Here

      if(newUdpId==null) {
        logger.error("could not find association with udp id with id " + oldUdpId);
        existingSbiUdpValue.setSbiUdp(null);
      }
      else{
        SbiUdp newSbiUdp = (SbiUdp) sessionCurrDB.load(SbiUdp.class, newUdpId);
        existingSbiUdpValue.setSbiUdp(newSbiUdp);
      }
    }
    //checks family
    if(exportedSbiUdpValue.getFamily() != null && exportedSbiUdpValue.getFamily().equalsIgnoreCase("Kpi")){
View Full Code Here

TOP

Related Classes of it.eng.spagobi.tools.udp.metadata.SbiUdp

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.