Package it.eng.spago.base

Examples of it.eng.spago.base.SourceBean


        if(!l.isEmpty()){
          Iterator it = l.iterator();
          while(it.hasNext()){
            SbiDistributionListsObjects temp = (SbiDistributionListsObjects)it.next();
            String xmlstr = temp.getXml();
            SourceBean sb = SourceBean.fromXMLString(xmlstr);
            String trigName = (String)sb.getAttribute("triggerName");
            if (trigName != null && trigName.equals(triggername)){
              aSession.delete(temp);
            }
          }     
        }
View Full Code Here


        return;
      }
      if (DAOFactory.getDistributionListDAO().isDocScheduledInOtherTime(dl,objId,xml)){
        otherSchedule = true;
      }
      SourceBean sbOrig = SourceBean.fromXMLString(xml);
      String trigNameOrig = (String)sbOrig.getAttribute("triggerName");
     
      List listRowsOrig = sbOrig.getAttributeAsList("PARAMETERS.PARAMETER");
        SourceBean tmpSBOrig = (SourceBean)listRowsOrig.get(0);
        String parvaluesOrig =(String) tmpSBOrig.getAttribute("value");
     
      SbiDistributionListsObjects hibDistributionListsObjects = new SbiDistributionListsObjects();
     
      aSession = getSession();
      tx = aSession.beginTransaction();
      if(otherSchedule == true){

        String hql = "from SbiDistributionListsObjects sdlo where sdlo.sbiDistributionList.dlId=" + dl.getId()+" and sdlo.sbiObjects.biobjId="+objId;
        Query query = aSession.createQuery(hql);
         
        List l = query.list();
       
          Iterator it = l.iterator();
          while(it.hasNext()){
            SbiDistributionListsObjects temp = (SbiDistributionListsObjects)it.next();
            String xmlstr = temp.getXml();
            SourceBean sb = SourceBean.fromXMLString(xmlstr);
            String trigName = (String)sb.getAttribute("triggerName");
           
            List listRows = sb.getAttributeAsList("PARAMETERS.PARAMETER");
            SourceBean tmpSB = (SourceBean)listRows.get(0);
            String parvalues =(String) tmpSB.getAttribute("value");
         
           
            if (trigName != null && trigName.equals(trigNameOrig) && parvalues!=null && parvalues.equals(parvaluesOrig)){ hibDistributionListsObjects = temp; };
          }     
      }
View Full Code Here

    logger.debug("IN");

    EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
   
    // get the module response
    SourceBean moduleResponse = (SourceBean)responseContainer.getServiceResponse().getAttribute("DetailDataSourceModule");
   
    // 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: detailDataSource"  );
        return "detailDataSource";
      }
    }
   
    // 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: detailDataSourceLoop"  );
          logger.debug("OUT");
          return "detailDataSourceLoop";
    } else {
View Full Code Here

     
      params = new HashMap();
      params.put("pagination", getPaginationParamVaue(mimeType) );
     
     
      SourceBean config = (SourceBean)ConfigSingleton.getInstance();   
      SourceBean baseTemplateFileSB = (SourceBean)config.getAttribute("QBE.TEMPLATE-BUILDER.BASE-TEMPLATE");
      String baseTemplateFileStr = null;
      if(baseTemplateFileSB != null) baseTemplateFileStr = baseTemplateFileSB.getCharacters();
      File baseTemplateFile = null;
      if(baseTemplateFileStr != null) baseTemplateFile = new File(baseTemplateFileStr);
     
      templateBuilder = new TemplateBuilder(sqlQuery, extractedFields, params, baseTemplateFile);
      templateContent = templateBuilder.buildTemplate();
View Full Code Here

    logger.debug("IN");
        
    Session tmpSession = null;
    Transaction tx = null;
    try {
      SourceBean sbOrig = SourceBean.fromXMLString(xml);
      String trigNameOrig = (String)sbOrig.getAttribute("triggerName");
     
      tmpSession = getSession();
      tx = tmpSession.beginTransaction();
     
      //String hql = "from SbiDistributionListsObjects sdlo where sdlo.sbiDistributionList.dlId=" + dl.getId()+" and sdlo.sbiObjects.biobjId="+objId;
      String hql = "from SbiDistributionListsObjects sdlo where sdlo.sbiDistributionList.dlId=? and sdlo.sbiObjects.biobjId=?";
      Query query = tmpSession.createQuery(hql);
      query.setInteger(0, dl.getId());
      query.setInteger(1, objId);
      List l = query.list();
      if(!l.isEmpty()){
        Iterator it = l.iterator();
        while(it.hasNext()){
          SbiDistributionListsObjects temp = (SbiDistributionListsObjects)it.next();
          String xmlstr = temp.getXml();
          SourceBean sb = SourceBean.fromXMLString(xmlstr);
          String trigName = (String)sb.getAttribute("triggerName");
          if (trigName != null && trigName.equals(trigNameOrig)) return true;
       
      }
      tx.commit();
    } catch (HibernateException he) {
View Full Code Here

  
  public void service(SourceBean request, SourceBean response)  {
   
    JSONObject formState;
    String templateName;
    SourceBean template;
    SourceBean formBlock;
    SourceBean queryBlock;
   
    QbeEngineInstance qbeEngineInstance;
    ContentServiceProxy contentServiceProxy;
   
    logger.debug("IN");
View Full Code Here

   */
  public String scheduleJob(String xmlRequest) {
    StringBuffer servreponse = new StringBuffer();
    try{
      Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
      SourceBean request = SourceBean.fromXMLString(xmlRequest);
      servreponse.append("<EXECUTION_OUTCOME ");
      String runImmediately = (String) request.getAttribute("runImmediately");
      if( (runImmediately!=null) && runImmediately.equalsIgnoreCase("true")) {
        String jobName = (String) request.getAttribute("jobName");
        String jobGroup = (String) request.getAttribute("jobGroup");
        if(jobGroup==null)
          jobGroup = Scheduler.DEFAULT_GROUP;
        // recover scheduling parameters
        SourceBean jobParameters = (SourceBean)request.getAttribute("PARAMETERS");
        // transform parameters sourcebean into JobDataMap structure and set it into the jobDetail
        JobDataMap jdm = getJobDataMap(jobParameters);
        String nameTrig = "schedule_uuid_" + UUIDGenerator.getInstance().generateTimeBasedUUID().toString();
        Trigger trigger = TriggerUtils.makeImmediateTrigger(nameTrig, 0, 10000);
        trigger.setJobName(jobName);
          trigger.setJobGroup(jobGroup);
        trigger.setJobDataMap(jdm);
        scheduler.scheduleJob(trigger);
      } else {
        String triggerName = (String) request.getAttribute("triggerName");
        String triggerDescription = (String) request.getAttribute("triggerDescription");
        String triggerGroup = (String) request.getAttribute("triggerGroup");
        if(triggerGroup==null)
          triggerGroup = Scheduler.DEFAULT_GROUP;
        String jobName = (String) request.getAttribute("jobName");
        String jobGroup = (String) request.getAttribute("jobGroup");
        if(jobGroup==null)
          jobGroup = Scheduler.DEFAULT_GROUP;
        // recover scheduling parameters
        SourceBean jobParameters = (SourceBean)request.getAttribute("PARAMETERS");
        // transform parameters sourcebean into JobDataMap structure and set it into the jobDetail
        JobDataMap jdm = getJobDataMap(jobParameters);
        // recover and transform dates
        // get the start date param (format yyyy-mm-gg) and start time (format hh:mm:ss....)
        String startDateStr = (String)request.getAttribute("startDate");
View Full Code Here

   *
   * @param DocumentCompositionConfigurationSB the document composition configuration sb
   */
  public DocumentCompositionConfiguration (SourceBean DocumentCompositionConfigurationSB){
    init();
    SourceBean documentsConfigurationSB;
    templateFile = (String)DocumentCompositionConfigurationSB.getAttribute(Constants.TEMPLATE_VALUE);


    documentsConfigurationSB = (SourceBean)DocumentCompositionConfigurationSB.getAttribute(Constants.DOCUMENTS_CONFIGURATION);

View Full Code Here

    List documentList;
    List refreshDocList;
    List paramList;
    List styleList;
    SourceBean styleSB;
    SourceBean documentSB;
    SourceBean refreshSB;
    SourceBean dimensionSB;
    SourceBean parametersSB;
    SourceBean paramSB;
    SourceBean refreshDocLinkedSB;
    try{

      documentList = documentsConfigurationSB.getAttributeAsList(Constants.DOCUMENT);
      //create dimensions Map
      String videoWidthS=(documentsConfigurationSB.getAttribute(Constants.VIDEO_WIGTH)!=null) ? documentsConfigurationSB.getAttribute(Constants.VIDEO_WIGTH).toString() : null;
      String videoHeightS=(documentsConfigurationSB.getAttribute(Constants.VIDEO_HEIGHT) != null) ? documentsConfigurationSB.getAttribute(Constants.VIDEO_HEIGHT).toString() : null;
      if(videoWidthS!=null & videoHeightS!=null){
        videoWidth=Integer.valueOf(videoWidthS);
        videoHeight=Integer.valueOf(videoHeightS);
      }
      else{
        videoWidth=DEFAULT_WIDTH;
        videoHeight=DEFAULT_HEIGHT;
       
      }

      //loop on documents
      for(int i = 0; i < documentList.size(); i++) {

        documentSB = (SourceBean)documentList.get(i);
        document = new Document()
        //set the number that identify the document within of hash table
        document.setNumOrder(i)
        attributeValue = (String)documentSB.getAttribute(Constants.SBI_OBJ_LABEL);
        document.setSbiObjLabel(attributeValue);
        attributeValue = (documentSB.getAttribute(Constants.TITLE)==null)?"":(String)documentSB.getAttribute(Constants.TITLE);
        document.setTitle(attributeValue);

        Integer width = (documentsConfigurationSB.getAttribute(Constants.VIDEO_WIGTH)==null)?DEFAULT_WIDTH:Integer.valueOf((String)documentsConfigurationSB.getAttribute(Constants.VIDEO_WIGTH));
        Integer height = (documentsConfigurationSB.getAttribute(Constants.VIDEO_HEIGHT)==null)?DEFAULT_HEIGHT:Integer.valueOf((String)documentsConfigurationSB.getAttribute(Constants.VIDEO_HEIGHT));


        document.setVideoWidth(getVideoDimensions("width", width));
        document.setVideoHeight(getVideoDimensions("height", height));

        dimensionSB = (SourceBean)documentSB.getAttribute(Constants.STYLE);     
        attributeValue = (String)dimensionSB.getAttribute(Constants.DIMENSION_STYLE);
        //attributeValue = (String)dimensionSB.getAttribute("class");
        document.setStyle(attributeValue);     
        parametersSB = (SourceBean)documentSB.getAttribute(Constants.PARAMETERS)
        if(parametersSB!=null){
          paramList = parametersSB.getAttributeAsList(Constants.PARAMETER);
          Properties param = new Properties();
          //loop on parameters of single document
          for(int j = 0; j < paramList.size(); j++) {
            paramSB = (SourceBean)paramList.get(j);
            String sbiParLabel = (paramSB.getAttribute(Constants.SBI_PAR_LABEL)==null)?"":(String)paramSB.getAttribute(Constants.SBI_PAR_LABEL);
            param.setProperty("sbi_par_label_param_"+i+"_"+j, sbiParLabel);
            String typePar = (paramSB.getAttribute(Constants.TYPE)==null)?"":(String)paramSB.getAttribute(Constants.TYPE);
            param.setProperty("type_par_"+i+"_"+j, typePar);
            String defaultValuePar = (paramSB.getAttribute(Constants.DEFAULT_VALUE)==null)?"":(String)paramSB.getAttribute(Constants.DEFAULT_VALUE);
            param.setProperty("default_value_param_"+i+"_"+j, defaultValuePar);

            refreshSB = (SourceBean)paramSB.getAttribute(Constants.REFRESH);       
            if(refreshSB!=null){
              refreshDocList = refreshSB.getAttributeAsList(Constants.REFRESH_DOC_LINKED);
              if(refreshDocList!=null){
                Properties paramRefreshLinked = new Properties();
                //loop on document linked to single parameter
                int k = 0;
                for(k = 0; k < refreshDocList.size(); k++) {
                  refreshDocLinkedSB = (SourceBean)refreshDocList.get(k);
                  String labelDoc = (refreshDocLinkedSB.getAttribute(Constants.LABEL_DOC)==null)?"":(String)refreshDocLinkedSB.getAttribute(Constants.LABEL_DOC);
                  paramRefreshLinked.setProperty("refresh_doc_linked", labelDoc);
                  String labelPar = (refreshDocLinkedSB.getAttribute(Constants.LABEL_PARAM)==null)?"":(String)refreshDocLinkedSB.getAttribute(Constants.LABEL_PARAM);
                  paramRefreshLinked.setProperty("refresh_par_linked", labelPar);
                  String defaultValueLinked = (paramSB.getAttribute(Constants.DEFAULT_VALUE)==null)?"":(String)paramSB.getAttribute(Constants.DEFAULT_VALUE);
                  paramRefreshLinked.setProperty("default_value_linked", defaultValueLinked);
                  String typeCrossPar = (refreshDocLinkedSB.getAttribute(Constants.TYPE_CROSS)==null)?Constants.CROSS_INTERNAL:(String)refreshDocLinkedSB.getAttribute(Constants.TYPE_CROSS);
                  paramRefreshLinked.setProperty("type_cross_linked", typeCrossPar);
                  param.setProperty("param_linked_"+i+"_"+j+"_"+k, paramRefreshLinked.toString());
                }
                param.setProperty("num_doc_linked_param_"+i+"_"+j, new Integer(k).toString());
              }
View Full Code Here

      ISbiAttributeDAO attrDAO= DAOFactory.getSbiAttributeDAO();
     
      //hashmap to use during
      HashMap< String, Integer> attributesLookup = new HashMap< String, Integer> ();
      for (int i=0; i<defaultAttributes.size();i++) {
          SourceBean attribute = (SourceBean) defaultAttributes.get(i);
         
          SbiAttribute sbiAttribute = new SbiAttribute();
          String attrName = (String) attribute.getAttribute("name");
         
          SbiAttribute existingAttribute = attrDAO.loadSbiAttributeByName(attrName);
          if(existingAttribute == null){
            sbiAttribute.setAttributeName(attrName);
            String attrDescr = (String) attribute.getAttribute("description");
            sbiAttribute.setDescription(attrDescr);         
           
            try
              Integer id = attrDAO.saveSbiAttribute(sbiAttribute);
              attributesLookup.put(attrName, id);
          } catch (EMFUserError e) {
            logger.error(e.getMessage(), e);
         
          }else{
            attributesLookup.put(attrName, existingAttribute.getAttributeId());
          }
       
      }
     
      List defaultRoles = _config.getAttributeAsList("DEFAULT_ROLES.ROLE");
      IRoleDAO roleDAO= DAOFactory.getRoleDAO();
      roleDAO.setUserID("server_init");
      IDomainDAO domainDAO = DAOFactory.getDomainDAO();
        List<Domain> domains =domainDAO.loadListDomainsByType("ROLE_TYPE");
        HashMap<String, Integer> domainIds = new HashMap<String, Integer> ();
        for(int i=0; i< domains.size(); i++){
          domainIds.put(domains.get(i).getValueCd(), domains.get(i).getValueId());
        }
       
        HashMap< String, Integer> rolesLookup = new HashMap< String, Integer> ();
      for (int i=0; i< defaultRoles.size();i++) {
          SourceBean role = (SourceBean) defaultRoles.get(i);
          Role sbiRole = new Role();
          String roleName = (String) role.getAttribute("roleName");
          sbiRole.setName(roleName);
          String roleDescr = (String) role.getAttribute("description");
          sbiRole.setDescription(roleDescr);
         
          String roleTypeCD = (String) role.getAttribute("roleTypeCD");
          sbiRole.setRoleTypeCD(roleTypeCD);
         
          Integer valueId = domainIds.get(roleTypeCD);
          if(valueId != null){
            sbiRole.setRoleTypeID(valueId);
          }
          try {
            Role roleToInsert = roleDAO.loadByName(roleName);
            Integer id = null;
            if(roleToInsert == null){
              roleDAO.insertRole(sbiRole);
            }         
            Role newRole = roleDAO.loadByName(roleName);
            id = newRole.getId();
           
            rolesLookup.put(roleName, id);
        } catch (EMFUserError e) {
          logger.error(e.getMessage(), e);
        }         
      }
      //finally default users with associations
      List defaultsUsers = _config.getAttributeAsList("DEFAULT_USERS.USER");
      Iterator it = defaultsUsers.iterator();
      ISbiUserDAO userDAO= DAOFactory.getSbiUserDAO();

      while (it.hasNext()) {
          SourceBean user = (SourceBean) it.next();
         
          SbiUser sbiUser = new SbiUser();
          String userId = (String) user.getAttribute("userId");
          sbiUser.setUserId(userId);
          String password = (String) user.getAttribute("password");
        if (password!=null){
            try {
              sbiUser.setPassword(Password.encriptPassword(password));
          } catch (Exception e) {
            logger.error("Impossible to encript Password", e);
          }
        }
          String fullName = (String) user.getAttribute("fullName");
          if(fullName != null){
            sbiUser.setFullName(fullName);
          }

          try {
            //checks if user already exists
            Integer existingId = userDAO.loadByUserId(userId);
            Integer idUser =existingId;
            if(existingId == null){
              //create user id
              idUser = userDAO.saveSbiUser(sbiUser);
            }

           
            List<SourceBean> attributes = user.getAttributeAsList("ATTRIBUTE");
            if(attributes != null){
              for(int i= 0; i< attributes.size(); i++){
                SourceBean attribute = attributes.get(i);
                String name = (String)attribute.getAttribute("name");
                String value = (String)attribute.getAttribute("value");
               
                SbiUserAttributes sbiUserAttr = new SbiUserAttributes();
                sbiUserAttr.setAttributeValue(value);
               
                Integer attrID = attributesLookup.get(name);
               
                SbiUserAttributesId sbiUserAttrID = new SbiUserAttributesId();
                sbiUserAttrID.setId(idUser);//user ID
                sbiUserAttrID.setAttributeId(attrID.intValue());
                sbiUserAttr.setId(sbiUserAttrID);
               
                userDAO.updateSbiUserAttributes(sbiUserAttr);

              }
            }
            List<SourceBean> userroles = user.getAttributeAsList("ROLE");
            if(userroles != null){
              for(int i= 0; i< userroles.size(); i++){
                SourceBean role = userroles.get(i);
                String name = (String)role.getAttribute("name");
                SbiExtUserRoles sbiExtUserRole = new SbiExtUserRoles();
                SbiExtUserRolesId id = new SbiExtUserRolesId();
               
                Integer extRoleId = rolesLookup.get(name);
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.