Examples of SbiUdp


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

      }

      SbiDomains udpType=(SbiDomains)session.load(SbiDomains.class, udp.getDataTypeId());

      // main attributes     
      SbiUdp hibUdp = new SbiUdp();
      hibUdp.setDescription(udp.getDescription());
      hibUdp.setFamilyId(udp.getFamilyId());
      hibUdp.setIsMultivalue(udp.getMultivalue());
      hibUdp.setLabel(udp.getLabel());
      hibUdp.setName(udp.getName());

      hibUdp.setTypeId(udpType.getValueId());
      hibUdp.setUdpId(udp.getUdpId());

      Transaction tx = session.beginTransaction();
      session.save(hibUdp);
      tx.commit();
View Full Code Here

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

      List hibList = hibQuery.list();
      if(!hibList.isEmpty()) {
        return;
      }

      SbiUdp udp =(SbiUdp)session.load(SbiUdp.class, udpValue.getUdpId());

      // main attributes     
      SbiUdpValue hibUdpValue = new SbiUdpValue();
      hibUdpValue.setBeginTs(udpValue.getBeginTs());
      hibUdpValue.setEndTs(udpValue.getEndTs());
View Full Code Here

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

      hql = "from SbiUdp u where u.label = '" + label + "' and u.typeId ="+typeId+" and u.familyId = "+familyId;*/
           
      String label = (String) unique;
      hql = "from SbiUdp u where u.label = '" + label + "'";
      hqlQuery = sessionCurrDB.createQuery(hql);
      SbiUdp hibUdp = (SbiUdp) hqlQuery.uniqueResult();
      return hibUdp;   
    }else if (hibObj instanceof SbiOrgUnit) {
      //checks existence in import db
      Map uniqueMap = (Map) unique;
      String label = (String) uniqueMap.get("label");
View Full Code Here

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

    if( !(o instanceof SbiUdp) ) {
      throw new SerializationException("UdpJSONSerializer is unable to serialize object of type: " + o.getClass().getName());
    }
   
    try {
      SbiUdp udp = (SbiUdp)o;
      result = new JSONObject();
      //converts valueId in valueCd information
      Domain tmpDomain = DAOFactory.getDomainDAO().loadDomainById(udp.getTypeId());
      String typeStr = tmpDomain.getValueCd();         
      tmpDomain = DAOFactory.getDomainDAO().loadDomainById((udp.getFamilyId()));
      String familyStr =  tmpDomain.getValueCd();
       
      result.put(UDP_ID, udp.getUdpId());
      result.put(UDP_NAME, udp.getName() );
      result.put(UDP_DESCRIPTION, udp.getDescription() );
      result.put(UDP_LABEL, udp.getLabel() );
      result.put(UDP_TYPE, typeStr );
      result.put(UDP_FAMILY, familyStr);   
      result.put(UDP_MULTIVALUE, udp.isIsMultivalue())
     
    } catch (Throwable t) {
      throw new SerializationException("An error occurred while serializing object: " + o, t);
    } finally {
     
View Full Code Here

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

    // Udp

    List exportedUdpList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiUdp", null);
    Iterator iterUdp = exportedUdpList.iterator();
    while (iterUdp.hasNext()) {
      SbiUdp udp = (SbiUdp) iterUdp.next();

      //logical unique key but table just looks for label
/*      Map uniqueMap = new HashMap();
      Map doaminAss = metaAss.getDomainIDAssociation();
      Integer newTypeId = (Integer)doaminAss.get(udp.getTypeId());
      uniqueMap.put("typeId", newTypeId);
      Integer newFamilyId = (Integer)doaminAss.get(udp.getFamilyId());
      uniqueMap.put("familyId", newFamilyId);
      uniqueMap.put("label", udp.getLabel());
      Object existObj = importer.checkExistence(uniqueMap, sessionCurrDB, new SbiUdp());*/
      String label = udp.getLabel();
      Object existObj = importer.checkExistence(label, sessionCurrDB, new SbiUdp());
      if (existObj != null) {
        SbiUdp dsCurr = (SbiUdp) existObj;
        metaAss.insertCoupleUdpAssociation(udp.getUdpId(), dsCurr.getUdpId());
        metaLog.log("Exported association between type id " + udp.getTypeId() + " "
            + " and family id " + udp.getFamilyId() + " with label "
            + udp.getLabel() + " not inserted"
            + " because already existing into the current database");
      }
    }
    // Udp Value

    List exportedUdpValList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiUdpValue", null);
    Iterator iterUdpVal = exportedUdpValList.iterator();
    while (iterUdpVal.hasNext()) {
      SbiUdpValue udpVal = (SbiUdpValue) iterUdpVal.next();
      // check if the association already exist
      Map uniqueMap = new HashMap();
      Map kpiAss = metaAss.getKpiIDAssociation();
      Map modelAss = metaAss.getModelIDAssociation();
      Map udpAss = metaAss.getUdpAssociation();
     
      if(udpVal.getSbiUdp() != null){
        Integer newUdpId = (Integer)udpAss.get(udpVal.getSbiUdp().getUdpId());
        uniqueMap.put("udpId", newUdpId);
        Integer newRefId = null;
        if(udpVal.getFamily().equalsIgnoreCase("Kpi")){
          newRefId = (Integer)kpiAss.get(udpVal.getReferenceId());
        }else{
          newRefId = (Integer)modelAss.get(udpVal.getReferenceId());
        }
        uniqueMap.put("referenceId", newRefId);
        uniqueMap.put("family", udpVal.getFamily());
      }
 
      Object existObj = importer.checkExistence(uniqueMap, sessionCurrDB, new SbiUdpValue());
      if (existObj != null) {
        SbiUdpValue dsCurr = (SbiUdpValue) existObj;
        metaAss.insertCoupleUdpValueAssociation(udpVal.getUdpValueId(), dsCurr.getUdpValueId());
        metaLog.log("Exported association udp value between udp with label " + udpVal.getSbiUdp().getLabel() + " "
            + " and family " + udpVal.getFamily() + " with reference id "
            +  udpVal.getReferenceId() + " not inserted"
            + " because already existing into the current database");
      }
    }
    // OU  SbiOrgUnit
    List exportedSbiOrgUnitList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiOrgUnit", null);
    Iterator iterOUVal = exportedSbiOrgUnitList.iterator();
    while (iterOUVal.hasNext()) {
      SbiOrgUnit ouVal = (SbiOrgUnit) iterOUVal.next();
      Map uniqueMap = new HashMap();
      String label = ouVal.getLabel();
      String name = ouVal.getName();
      uniqueMap.put("label", label);
      uniqueMap.put("name", name);
      Object existObj = importer.checkExistence(uniqueMap, sessionCurrDB, new SbiOrgUnit());
      if (existObj != null) {
        SbiOrgUnit dsCurr = (SbiOrgUnit) existObj;
        metaAss.insertCoupleIdOuAssociation(ouVal.getId(), dsCurr.getId());
        metaLog.log("Found an existing ou " + dsCurr.getName() + " with "
            + "the same label of one exported ou");
      }
    }// OU hierarchy SbiOrgUnitHierarchies
    List exportedSbiOuHierList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiOrgUnitHierarchies", null);
    Iterator iterOUHierVal = exportedSbiOuHierList.iterator();
    while (iterOUHierVal.hasNext()) {
      SbiOrgUnitHierarchies ouHierVal = (SbiOrgUnitHierarchies) iterOUHierVal.next();
      // check if the association already exist
      Map uniqueMap = new HashMap();
      String label = ouHierVal.getLabel();
      String company = ouHierVal.getCompany();
      uniqueMap.put("label", label);
      uniqueMap.put("company", company);
      Object existObj = importer.checkExistence(uniqueMap, sessionCurrDB, new SbiOrgUnitHierarchies());
      if (existObj != null) {
        SbiOrgUnitHierarchies dsCurr = (SbiOrgUnitHierarchies) existObj;
        metaAss.insertCoupleIdOuHierarchyAssociation(ouHierVal.getId(), dsCurr.getId());
        metaLog.log("Found an existing ou hierarchy " + dsCurr.getName() + " with "
            + "the same label of one exported ou hierarchy");
      }
      /*
      String label = ouHierVal.getLabel();
      Object existObj = importer.checkExistence(label, sessionCurrDB, new SbiOrgUnitHierarchies());
      if (existObj != null) {
        SbiOrgUnitHierarchies dsCurr = (SbiOrgUnitHierarchies) existObj;
        metaAss.insertCoupleIdOuHierarchyAssociation(ouHierVal.getId(), dsCurr.getId());
        metaLog.log("Found an existing ou hierarchy " + dsCurr.getName() + " with "
            + "the same label of one exported ou hierarchy");
      }
      */
    }// OU node  SbiOrgUnitNodes
    List exportedSbiOrgUnitNodeList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiOrgUnitNodes", null);
    Iterator iterOUNodeVal = exportedSbiOrgUnitNodeList.iterator();
    while (iterOUNodeVal.hasNext()) {
      SbiOrgUnitNodes ouVal = (SbiOrgUnitNodes) iterOUNodeVal.next();
      // check if the association already exist
      Map uniqueMap = new HashMap();
      Map ouAss = metaAss.getOuAssociation();
      Map hierAss = metaAss.getOuHierarchiesAssociation();
      if(ouVal.getSbiOrgUnit() != null){
        Integer newOuId = (Integer)ouAss.get(ouVal.getSbiOrgUnit().getId());
        uniqueMap.put("ouId", newOuId);
        Integer newHierId = (Integer)hierAss.get(ouVal.getSbiOrgUnitHierarchies().getId());
        uniqueMap.put("hierarchyId", newHierId);
      }
      Object existObj = importer.checkExistence(uniqueMap, sessionCurrDB, new SbiOrgUnitNodes());
      if (existObj != null) {
        SbiOrgUnitNodes dsCurr = (SbiOrgUnitNodes) existObj;
        metaAss.insertCoupleIdOuNodeAssociation(ouVal.getNodeId(), dsCurr.getNodeId());
        metaLog.log("Found an existing ou node " + dsCurr.getNodeId() + " with "
            + "the same organizational unit and hierarchy of one exported ou node");
      }
    }// OU grants  SbiOrgUnitGrant
    List exportedSbiOUGrantList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiOrgUnitGrant", null);
    Iterator iterOUGrantVal = exportedSbiOUGrantList.iterator();
    while (iterOUGrantVal.hasNext()) {
      SbiOrgUnitGrant ouGrantVal = (SbiOrgUnitGrant) iterOUGrantVal.next();
      String label = ouGrantVal.getLabel();
      Object existObj = importer.checkExistence(label, sessionCurrDB, new SbiOrgUnitGrant());
      if (existObj != null) {
        SbiOrgUnitGrant dsCurr = (SbiOrgUnitGrant) existObj;
        metaAss.insertCoupleIdOuGrantAssociation(ouGrantVal.getId(), dsCurr.getId());
        metaLog.log("Found an existing ou grant " + dsCurr.getId() + " with "
            + "the same label of one exported ou grant");
      }
    }// OU grant nodes  SbiOrgUnitGrantNodes
    List exportedSbiOUGrantNodeList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiOrgUnitGrantNodes", null);
    Iterator iterOUGrantNodesVal = exportedSbiOUGrantNodeList.iterator();
    while (iterOUGrantNodesVal.hasNext()) {
      SbiOrgUnitGrantNodes ouGrantNode = (SbiOrgUnitGrantNodes) iterOUGrantNodesVal.next();
      Map uniqueMap = new HashMap();   
      Map nodeAss = metaAss.getOuNodeAssociation();
      Map miAss = metaAss.getModelInstanceIDAssociation();
      Map grantAss = metaAss.getOuGrantAssociation();
      if(ouGrantNode.getId() != null){
        Integer newGrantId = (Integer)grantAss.get(ouGrantNode.getId().getGrantId());
        uniqueMap.put("grantId", newGrantId );
        Integer newNodeId = (Integer)nodeAss.get(ouGrantNode.getId().getNodeId());
        uniqueMap.put("nodeId", newNodeId);
        Integer newMiId = (Integer)miAss.get(ouGrantNode.getId().getKpiModelInstNodeId());
        uniqueMap.put("modelInstId", newMiId);
      }
      Object existObj = importer.checkExistence(uniqueMap, sessionCurrDB, new SbiOrgUnitGrantNodes());
      if (existObj != null) {
        SbiOrgUnitGrantNodes dsCurr = (SbiOrgUnitGrantNodes) existObj;
        metaAss.insertCoupleIdOuGrantNodesAssociation(ouGrantNode.getId(), dsCurr.getId());
        metaLog.log("Found an existing ou grant node with grant id " + dsCurr.getId().getGrantId() + " with "
            + "the same id of one exported ou grant node");
      }
    }
    logger.debug("OUT");
  }
View Full Code Here

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

   *
   * @throws EMFUserError
   */
  private void importUdp(Integer udpId, boolean overwrite) throws EMFUserError {
    logger.debug("IN");
    SbiUdp udp = null;
    try {

      List exportedUdps = importer.getFilteredExportedSbiObjects(sessionExpDB, "SbiUdp", "udpId", udpId);
      Iterator iterSbiUdp = exportedUdps.iterator();
      while (iterSbiUdp.hasNext()) {
        udp = (SbiUdp) iterSbiUdp.next();
        Integer oldId = udp.getUdpId();

        Integer existingUdpId = null;
        //other methd
        Map udpAss = metaAss.getUdpAssociation();
        Set udpAssSet = udpAss.keySet();
        if (udpAssSet.contains(oldId) && !overwrite) {
          metaLog.log("Exported association between type id " + udp.getTypeId() + " "
              + " and family id " + udp.getFamilyId() + " with label "
              + udp.getLabel() + " not inserted"
              + " because already existing into the current database");
          continue;
        } else {
          existingUdpId = (Integer) udpAss.get(oldId);
        }
        if (existingUdpId != null) {
          logger.info("The udp with label:[" + udp.getLabel() + "] is just present. It will be updated.");
          metaLog.log("The udp with label = [" + udp.getLabel() + "] will be updated.");
          SbiUdp existingUdp = ImportUtilities.modifyExistingUdp(udp, sessionCurrDB, existingUdpId);
          ImportUtilities.entitiesAssociationsSbiUdp(existingUdp, udp, sessionCurrDB,  metaAss, importer);
          sessionCurrDB.update(existingUdp);
        } else {
          SbiUdp newUdp = ImportUtilities.makeNewSbiUdp(udp, sessionCurrDB, metaAss, importer);
          sessionCurrDB.save(newUdp);
          metaLog.log("Inserted new udp with label " + newUdp.getLabel()+" type id " + udp.getTypeId() + " "
                + " and family id " + udp.getFamilyId());
          Integer newId = newUdp.getUdpId();
          sessionExpDB.evict(udp);
          metaAss.insertCoupleUdpAssociation(oldId, newId);
        }

      }
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.