Package it.eng.spago.base

Examples of it.eng.spago.base.SourceBean


    if (t!=null){
      try {
      actualHeight+=separatorHeight; 
      Integer yValue=actualHeight;
      //Draws the Threshold Code
      SourceBean thresholdTextCode1 = new SourceBean(thresholdTextCode);
     
      String code=t.getCode() != null ? t.getCode() : "";
      String codeTh = "Code: "+code;
      if(codeTh.length()>20)codeTh = codeTh.substring(0, 19);

      thresholdTextCode1.setAttribute("reportElement.y", yValue.toString());
      SourceBean threshCode2=(SourceBean)thresholdTextCode1.getAttribute("text");
      threshCode2.setCharacters(codeTh);
     
      sourceBeansToAdd.add(thresholdTextCode1);
      List semaphoreValue = newThresholdLine(t, bandDetailReport);
      sourceBeansToAdd.addAll(semaphoreValue);   
     
      //Adds a separator line
      SourceBean thresholdLineSeparator1=new SourceBean(thresholdLineSeparator);
      thresholdLineSeparator1.setAttribute("reportElement.y",new Integer(yValue.intValue()+16).toString());
      sourceBeansToAdd.add(thresholdLineSeparator1);
     
      } catch (SourceBeanException e) {
        logger.error("SourceBeanException", e);
        e.printStackTrace();
View Full Code Here


      if(thValues!=null && !thValues.isEmpty()){
        Iterator thIt = thValues.iterator();
        while(thIt.hasNext()){
          ThresholdValue val = (ThresholdValue)thIt.next();
          if (val!=null){
            SourceBean semaphor1=new SourceBean(semaphor);
            SourceBean thresholdTextValue1=new SourceBean(thresholdTextValue);
           
            //Semaphore Threshold creation
           
            xValue = xValue + thresholdFieldWidth;
           
            if(xValue +thresholdSemaphoreWidth + thresholdFieldWidth>=maxSubTemplateWIdtht){ 
              xValue = new Integer(5) + thresholdFieldWidth;
              actualHeight+=valueHeight;
              yValue = actualHeight;
            }
              String colorSemaphor = val.getColourString();
              semaphor1.setAttribute("reportElement.x", xValue.toString());
              semaphor1.setAttribute("reportElement.y", new Integer(yValue.intValue()+2).toString());
              if(colorSemaphor!=null){
                semaphor1.setAttribute("reportElement.forecolor""#000000");
                semaphor1.setAttribute("reportElement.backcolor", colorSemaphor);
              }else{
                semaphor1.setAttribute("reportElement.forecolor", "#FFFFFF");
                semaphor1.setAttribute("reportElement.backcolor", "#FFFFFF");
              }
              sourceBeansToAdd.add(semaphor1);
           
              xValue = xValue + thresholdFieldSeparatorWidth; 
                       
              //Threshold Value Creation 
              String labelTh=val.getLabel() != null ? val.getLabel() : "";
              String min = val.getMinValue()!= null ? val.getMinValue().toString() : null;
              String max = val.getMaxValue()!= null ?  val.getMaxValue().toString() : null;
              String valueTh = "Value: ";
              if(val.getThresholdType().equalsIgnoreCase("RANGE")){
                if (min!=null && max !=null){
                    valueTh = valueTh + min+"-"+max+" "+labelTh;
                }else if (min!=null && max==null){
                  valueTh = valueTh + "> "+min+" "+labelTh;
                }else if (min==null && max!=null){
                   valueTh = valueTh + "< "+max+" "+labelTh;
                }
              }else if(val.getThresholdType().equalsIgnoreCase("MINIMUM")){
                valueTh = valueTh + "< "+min+" "+labelTh;
              }else if(val.getThresholdType().equalsIgnoreCase("MAXIMUM")){
                valueTh = valueTh + "> "+max+" "+labelTh;
              }
              if(valueTh.length()>25)valueTh = valueTh.substring(0, 24);
 
              thresholdTextValue1.setAttribute("reportElement.x", xValue.toString());
              thresholdTextValue1.setAttribute("reportElement.y", yValue.toString());
              SourceBean threshValue2=(SourceBean)thresholdTextValue1.getAttribute("text");
              threshValue2.setCharacters(valueTh);
             
              sourceBeansToAdd.add(thresholdTextValue1);
          }
        }
      }
View Full Code Here

 
 
  private void getAllJobs(SourceBean request, SourceBean response) throws EMFUserError {
    try {
      // create the sourcebean of the list
      SourceBean pageListSB  = new SourceBean("PAGED_LIST");
      SchedulerServiceSupplier schedulerService=new SchedulerServiceSupplier();
      String xmlList = schedulerService.getJobList();
      //SourceBean schedModRespSB = SchedulerUtilities.getSBFromWebServiceResponse(wsresp);
      SourceBean rowsSB = SourceBean.fromXMLString(xmlList);
      if(rowsSB==null){
        throw new Exception("Web service response incomplete");
      }
      // recover all jobs
      List jobSBs = rowsSB.getAttributeAsList("ROW");
     
      Iterator jobSBiter = jobSBs.iterator();
      while(jobSBiter.hasNext()) {
        SourceBean jobSB = (SourceBean)jobSBiter.next();
        String jobname = (String)jobSB.getAttribute("jobName");
        String jobgroupname = (String)jobSB.getAttribute("jobGroupName");
        String xmlSchedList = schedulerService.getJobSchedulationList(jobname, jobgroupname);
        int numSchedulation = 0;
        SourceBean rowsSB_JSL = SourceBean.fromXMLString(xmlSchedList);
        if(rowsSB_JSL!=null) {
          List schedulations = rowsSB_JSL.getAttributeAsList("ROW");
          if(schedulations!=null){
            numSchedulation = schedulations.size();
          }
        }
        jobSB.setAttribute("numSchedule", new Integer(numSchedulation));
View Full Code Here

      SpagoBITracer.major(SpagoBIConstants.NAME_MODULE, SchedulerUtilities.class.getName(),
                      "getSBFromWebServiceResponse", "Error while parsing service response", e);
    }
    return schedModRespSB;
    */
    SourceBean schedModRespSB = null;
    try{
      schedModRespSB = SourceBean.fromXMLString(response);
    } catch (Exception e) {
      SpagoBITracer.major(SpagoBIConstants.NAME_MODULE, SchedulerUtilities.class.getName(),
                      "getSBFromWebServiceResponse", "Error while parsing service response", e);
View Full Code Here

   *
   * @return true, if successful
   */
  public static boolean checkResultOfWSCall(SourceBean resultSB)  {
    boolean result = true;
    SourceBean execOutSB = null;
    if(!resultSB.getName().equals("EXECUTION_OUTCOME")) {
      execOutSB = (SourceBean)resultSB.getAttribute("EXECUTION_OUTCOME");
    } else {
      execOutSB = resultSB;
    }
    if(execOutSB!=null) {
      String outcome = (String)execOutSB.getAttribute("outcome");
      if(outcome.equalsIgnoreCase("fault")) {
        result = false;
      }
    }
    return result;
View Full Code Here

  private QbeTemplate parse(SourceBean template) {
   
    QbeTemplate qbeTemplate = null;
   
    String templateName;
    SourceBean datamartSB, querySB, formSB, worksheetSB;
    String dmName;
    SourceBean modalitySB;
    List modalities;
    SourceBean compositeModalitySB;
    SourceBean functionalitiesSB;
    JSONObject formJSONTemplate, formValuesJSONTemplate, queryJSON, worksheetJSONTemplate;
   
    try {
     
      qbeTemplate = new QbeTemplate();
     
      templateName = template.getName();
      logger.debug("Parsing template [" + templateName + "] ...");
      Assert.assertNotNull(templateName, "Root tag cannot be not be null");
     
     
      if(!TAG_ROOT_COMPOSITE.equalsIgnoreCase(templateName)
          && !TAG_ROOT_NORMAL.equalsIgnoreCase(templateName)){
       
        QbeTemplateParseException e = new QbeTemplateParseException("Malformed template structure");
        e.setDescription("template root tag cannot be equals to [" + templateName +"]. " +
            "It must be equal to [" + TAG_ROOT_NORMAL + "] or [" + TAG_ROOT_COMPOSITE + "]");
        e.addHint("Check document template in document details page");
        throw e;
      }
     
      boolean isComposite;
      isComposite = TAG_ROOT_COMPOSITE.equalsIgnoreCase(templateName);
      qbeTemplate.setComposite( isComposite );
     
      modalities  = new ArrayList();
      dmName = null;
     
      if(qbeTemplate.isComposite()) {
        List qbeList;
        SourceBean qbeSB;
        String dblink;
       
        logger.debug("The QBE described in the template is of type COMPOSITE");
               
        qbeList = template.getAttributeAsList(TAG_ROOT_NORMAL);
        for(int i = 0; i < qbeList.size(); i++) {
          qbeSB = (SourceBean)qbeList.get(i);
         
          // DATAMART block
          if(qbeSB.containsAttribute(TAG_DATAMART)) {
            datamartSB = (SourceBean)qbeSB.getAttribute(TAG_DATAMART)
            dmName = (String)datamartSB.getAttribute(PROP_DATAMART_NAME);
            Assert.assertTrue(!StringUtilities.isEmpty(dmName), "Attribute [" + PROP_DATAMART_NAME +"] in tag [" + TAG_DATAMART + "] must be properly defined");
           
            qbeTemplate.addDatamartName( dmName );
                   
            dblink = (String)datamartSB.getAttribute(PROP_DATAMART_DBLINK);
            if(dblink != null) {
              qbeTemplate.setDbLink( dmName, dblink );
            }
          } else {
            Assert.assertUnreachable("Missing compolsury tag [" + TAG_DATAMART + "]");
          }
         
          // MODALITY block
          if(qbeSB.containsAttribute(TAG_MODALITY)) {
            modalitySB = (SourceBean)qbeSB.getAttribute(TAG_MODALITY);
            modalities.add(modalitySB);   
          } else {
            logger.debug("Qbe template associated to datamart [" + dmName + "] does not contain tag [" + TAG_MODALITY +"] so it will be not profiled");
          }
        }     
      } else {
        logger.debug("The QBE described in the template is of type STANDARD");
       
        // DATAMART block
        if(template.containsAttribute(TAG_DATAMART)) {
          datamartSB = (SourceBean)template.getAttribute(TAG_DATAMART);
          dmName = (String)datamartSB.getAttribute(PROP_DATAMART_NAME);
          Assert.assertTrue(!StringUtilities.isEmpty(dmName), "Attribute [" + PROP_DATAMART_NAME +"] in tag [" + TAG_DATAMART + "] must be properly defined");
         
          qbeTemplate.addDatamartName( dmName );
        } else {
          Assert.assertUnreachable("Missing compolsury tag [" + TAG_DATAMART + "]");
        }
       
        // MODALITY block
        if(template.containsAttribute(TAG_MODALITY)) {
          modalitySB = (SourceBean)template.getAttribute(TAG_MODALITY);
          modalities.add(modalitySB);
        } else {
          logger.debug("Qbe template does not contain tag [" + TAG_MODALITY +"] so it will be not profiled");
        }
       
        // query block
        if(template.containsAttribute(TAG_QUERY)) {
          querySB = (SourceBean) template.getAttribute(TAG_QUERY);
          queryJSON = new JSONObject(querySB.getCharacters());
          qbeTemplate.setProperty("query", queryJSON);
        } else {
          logger.debug("Qbe template does not contain tag [" + TAG_QUERY +"]");
        }
       
        // form block
        if(template.containsAttribute(TAG_FORM)) {
          formSB = (SourceBean) template.getAttribute(TAG_FORM);
          formJSONTemplate = new JSONObject(formSB.getCharacters());
          qbeTemplate.setProperty("formJSONTemplate", formJSONTemplate);
        } else {
          logger.debug("Qbe template does not contain tag [" + TAG_FORM +"]");
        }
       
        // form values block
        if(template.containsAttribute(TAG_FORM_VALUES)) {
          formSB = (SourceBean) template.getAttribute(TAG_FORM_VALUES);
          formValuesJSONTemplate = new JSONObject(formSB.getCharacters());
          qbeTemplate.setProperty("formValuesJSONTemplate", formValuesJSONTemplate);
        } else {
          logger.debug("Qbe template does not contain tag [" + TAG_FORM_VALUES +"]");
        }
       
        // worksheet block
        if(template.containsAttribute(TAG_WORKSHEET_DEFINITION)) {
          worksheetSB = (SourceBean) template.getAttribute(TAG_WORKSHEET_DEFINITION);
          worksheetJSONTemplate = new JSONObject(worksheetSB.getCharacters());
          qbeTemplate.setProperty("worksheetJSONTemplate", worksheetJSONTemplate);
        } else {
          logger.debug("Qbe template does not contain tag [" + TAG_WORKSHEET_DEFINITION +"]");
        }
      }
     
      compositeModalitySB = new SourceBean(TAG_MODALITY);
     
      for(int i = 0; i < modalities.size(); i++) {
        modalitySB = (SourceBean)modalities.get(i);
        String recursiveFilteringAttr = (String)modalitySB.getAttribute(QbeXMLModelAccessModality.ATTR_RECURSIVE_FILTERING);
        if(!StringUtilities.isEmpty(recursiveFilteringAttr)) {
          compositeModalitySB.setAttribute(QbeXMLModelAccessModality.ATTR_RECURSIVE_FILTERING, recursiveFilteringAttr);
        }
        List tables = modalitySB.getAttributeAsList(TAG_MODALITY_TABLE);
        for(int j = 0; j < tables.size(); j++) {
          SourceBean tableSB = (SourceBean)tables.get(j);
          compositeModalitySB.setAttribute(tableSB);
        }
      }
         
      if(compositeModalitySB != null && compositeModalitySB.getAttribute(TAG_MODALITY_TABLE) != null) {
        QbeXMLModelAccessModality datamartModelAccessModality = new QbeXMLModelAccessModality(compositeModalitySB);
        qbeTemplate.setDatamartModelAccessModality(datamartModelAccessModality);
      }
     
      if(template.containsAttribute(TAG_EXTERNAL_SERVICES)) {
        SourceBean extServiceConfig = (SourceBean) template.getAttribute(TAG_EXTERNAL_SERVICES);
        List services = extServiceConfig.getAttributeAsList(TAG_EXTERNAL_SERVICE);
        Iterator it = services.iterator();
        while (it.hasNext()) {
          SourceBean aServiceConfig = (SourceBean) it.next();
          logger.debug("Reading external service configuration....");
          String description = (String) aServiceConfig.getAttribute(PROP_SERVICE_DESCRIPTION);
          logger.debug("Description = [" + description + "]");
          String endpoint = (String) aServiceConfig.getAttribute(PROP_SERVICE_ENDPOINT);
          logger.debug("Endpoint = [" + endpoint + "]");
          String operation = (String) aServiceConfig.getAttribute(PROP_SERVICE_OPERATION);
          logger.debug("Operation = [" + operation + "]");
          String requiredColumns = (String) aServiceConfig.getAttribute(PROP_SERVICE_REQUIREDCOLUMNS);
          logger.debug("Required columns = [" + requiredColumns + "]");
          if (description == null || description.trim().equals("")) {
            logger.error("External service configuration is not valid: " + PROP_SERVICE_DESCRIPTION + " attribute is mandatory.");
            QbeTemplateParseException e = new QbeTemplateParseException("Wrong external service configuration");
            e.setDescription("External service configuration is not valid: " + PROP_SERVICE_DESCRIPTION
View Full Code Here

      String jobGroupNameRecovered = (String)jobDetSB.getAttribute("jobGroupName");
      jobInfo.setJobName(jobNameRecovered);
      jobInfo.setJobDescription(jobDescriptionRecovered);
      jobInfo.setJobGroupName(jobGroupNameRecovered);
      // set all documents and parameters
      SourceBean jobParSB = (SourceBean)jobDetSB.getAttribute("JOB_PARAMETERS");
      if(jobParSB!=null) {
        IBIObjectDAO biobjdao = DAOFactory.getBIObjectDAO();
        IBIObjectParameterDAO biobjpardao = DAOFactory.getBIObjectParameterDAO();
        SourceBean docLblSB = (SourceBean)jobParSB.getFilteredSourceBeanAttribute("JOB_PARAMETER", "name", "documentLabels");
        String docLblStr = (String)docLblSB.getAttribute("value");
        String[] docLbls = docLblStr.split(",");
        for(int i=0; i<docLbls.length; i++) {
          //BIObject biobj = biobjdao.loadBIObjectByLabel(docLbls[i]);
          BIObject biobj = biobjdao.loadBIObjectByLabel(docLbls[i].substring(0, docLbls[i].indexOf("__")));
          List biobjpars = biobjpardao.loadBIObjectParametersById(biobj.getId());
          biobj.setBiObjectParameters(biobjpars);
          String biobjlbl = biobj.getLabel() + "__" + (i+1);
          SourceBean queryStringSB = (SourceBean)jobParSB.getFilteredSourceBeanAttribute("JOB_PARAMETER", "name", biobjlbl);
          SourceBean iterativeSB = (SourceBean)jobParSB.getFilteredSourceBeanAttribute("JOB_PARAMETER", "name", biobjlbl + "_iterative");
          List iterativeParameters = new ArrayList();
          if (iterativeSB != null) {
            String iterativeParametersStr = (String) iterativeSB.getAttribute("value");
            String[] iterativeParametersArray = iterativeParametersStr.split(";");
            iterativeParameters.addAll(Arrays.asList(iterativeParametersArray));
          }
          SourceBean loadAtRuntimeSB = (SourceBean)jobParSB.getFilteredSourceBeanAttribute("JOB_PARAMETER", "name", biobjlbl + "_loadAtRuntime");
          Map<String, String> loadAtRuntimeParameters = new HashMap<String, String>();
          if (loadAtRuntimeSB != null) {
            String loadAtRuntimeStr = (String) loadAtRuntimeSB.getAttribute("value");
            String[] loadAtRuntimeArray = loadAtRuntimeStr.split(";");
            for (int count = 0; count < loadAtRuntimeArray.length; count++) {
              String loadAtRuntime = loadAtRuntimeArray[count];
              int parameterUrlNameIndex = loadAtRuntime.lastIndexOf("(");
              String parameterUrlName = loadAtRuntime.substring(0, parameterUrlNameIndex);
              String userAndRole = loadAtRuntime.substring(parameterUrlNameIndex + 1, loadAtRuntime.length() - 1);
              loadAtRuntimeParameters.put(parameterUrlName, userAndRole);
            }
          }
          SourceBean useFormulaSB = (SourceBean)jobParSB.getFilteredSourceBeanAttribute("JOB_PARAMETER", "name", biobjlbl + "_useFormula");
          Map<String, String> useFormulaParameters = new HashMap<String, String>();
          if (useFormulaSB != null) {
            String useFormulaStr = (String) useFormulaSB.getAttribute("value");
            String[] useFormulaArray = useFormulaStr.split(";");
            for (int count = 0; count < useFormulaArray.length; count++) {
              String useFormula = useFormulaArray[count];
              int parameterUrlNameIndex = useFormula.lastIndexOf("(");
              String parameterUrlName = useFormula.substring(0, parameterUrlNameIndex);
View Full Code Here

    int index = 0;
    while(iterBiobjIds.hasNext()) {
      index ++;
      SaveInfo sInfo = new SaveInfo();
      Integer biobjid = (Integer)iterBiobjIds.next();
      SourceBean objParSB = (SourceBean)triggerDetSB.getFilteredSourceBeanAttribute("JOB_PARAMETERS.JOB_PARAMETER", "name", "biobject_id_" + biobjid.toString()+"__"+index);
      if(objParSB!=null) {
        String parString = (String)objParSB.getAttribute("value");
        sInfo = SchedulerUtilities.fromSaveInfoString(parString);
      }
      saveOptions.put(biobjid+"__"+index, sInfo);
    }
   
View Full Code Here

    logger.debug("IN");

    EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
   
    // get the module response
    SourceBean moduleResponse = (SourceBean)responseContainer.getServiceResponse().getAttribute("DetailDistributionListUserModule");
   
    // if the module response is null throws an error and return the name of the errors publisher
    if(moduleResponse==null) {
      logger.error("Module response null");
      EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 10 );
      errorHandler.addError(error);     
      return "error";
    }
   
    // if there are errors and they are only validation errors return the name for the detail publisher
    if(!errorHandler.isOK()) {
      if(GeneralUtilities.isErrorHandlerContainingOnlyValidationError(errorHandler)) {
        logger.info("Publish: detailDistributionListUser"  );
        return "detailDistributionListUser";
      }
    }
   
    // if there are some errors into the errorHandler (not validation errors), return the name for the errors publisher
    if(!errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR)) {
      return new String("error");
    }

        Object loop = moduleResponse.getAttribute("loopback");
        if (loop != null) {
          logger.info("Publish: detailDistributionListUserLoop"  );
          logger.debug("OUT");
          return "detailDistributionListUserLoop";
    } else {
View Full Code Here

    logger.debug("IN");

    EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
   
    // get the module response
    SourceBean moduleResponse = (SourceBean)responseContainer.getServiceResponse().getAttribute("DetailDistributionListUserModule");
   
    // if the module response is null throws an error and return the name of the errors publisher
    if(moduleResponse==null) {
      logger.error("Module response null");
      EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 10 );
      errorHandler.addError(error);     
      return "error";
    }
   
    // if there are errors and they are only validation errors return the name for the detail publisher
    if(!errorHandler.isOK()) {
      if(GeneralUtilities.isErrorHandlerContainingOnlyValidationError(errorHandler)) {
        logger.info("Publish: insertEmail"  );
        return "insertEmail";
      }
    }
   
    // if there are some errors into the errorHandler (not validation errors), return the name for the errors publisher
    if(!errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR)) {
      return new String("error");
    }

        Object loop = moduleResponse.getAttribute("loopback");
        if (loop != null) {
          logger.info("Publish: detailDistributionListUserLoop"  );
          logger.debug("OUT");
          return "detailDistributionListUserLoop";
    } else {
View Full Code Here

TOP

Related Classes of it.eng.spago.base.SourceBean

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.