Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Template


     
      siteDomain.setRecCreateBy(user.getUserId());
      siteDomain.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      siteDomain.setSite(site);
     
      Template template = TemplateDAO.load(site.getSiteId(), Constants.TEMPLATE_BASIC);
      siteDomain.setTemplate(template);
      form.setTemplateId(template.getTemplateId().toString());
      form.setModuleDisplaySize(String.valueOf(Constants.TEMPLATE_MODULE_DISPLAY_SIZE));
      siteDomainParamBean.setModuleDisplaySize(String.valueOf(Constants.TEMPLATE_MODULE_DISPLAY_SIZE));

      siteDomainLanguage = new SiteDomainLanguage();
      siteDomainLanguage.setSiteLogoContentType("");
      siteDomainLanguage.setRecCreateBy(user.getUserId());
      siteDomainLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      siteDomain.setSiteDomainLanguage(siteDomainLanguage);
      siteDomain.getSiteDomainLanguages().add(siteDomainLanguage);
      siteDomain.setBaseCurrency(site.getSiteCurrencyClassDefault());
      SiteProfileClass siteProfileClass = SiteProfileClassDAO.load(form.getSiteProfileClassId());
      siteDomainLanguage.setSiteProfileClass(siteProfileClass);
    }
    else {
          Template template = TemplateDAO.load(site.getSiteId(), Format.getLong(form.getTemplateId()));
          siteDomain.setTemplate(template);
          if (!Format.isNullOrEmpty(siteDomainLanguage.getSiteDomainParam())) {
            siteDomainParamBean = (SiteDomainParamBean) Utility.joxUnMarshall(SiteDomainParamBean.class, siteDomainLanguage.getSiteDomainParam());
          }
          siteDomainParamBean.setMailFromContactUs(form.getMailFromContactUs());
View Full Code Here


        query = em.createQuery("from Template where siteId = :siteId and templateName = :templateName order by templateId");
        query.setParameter("siteId", form.getSiteId());
        query.setParameter("templateName", Constants.TEMPLATE_BASIC);
        iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          Template template = (Template) iterator.next();
          LabelValueBean bean = new LabelValueBean(template.getTemplateName(),Format.getLong(template.getTemplateId()));
          vector.add(bean);
        }
       
        query = em.createQuery("from Template where siteId = :siteId and templateName != :templateName order by templateId");
        query.setParameter("siteId", form.getSiteId());
        query.setParameter("templateName", Constants.TEMPLATE_BASIC);
        iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          Template template = (Template) iterator.next();
          LabelValueBean bean = new LabelValueBean(template.getTemplateName(),Format.getLong(template.getTemplateId()));
          vector.add(bean);
        }
        LabelValueBean templates[] = new LabelValueBean[vector.size()];
        vector.copyInto(templates);
        form.setTemplates(templates);
View Full Code Here

        if (form.getSrTemplateDesc().length() > 0) {
          query.setParameter("templateDesc", "%" + form.getSrTemplateDesc() + "%");
        }
        Iterator<?> iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          Template template = (Template) iterator.next();
          TemplateDisplayForm display = new TemplateDisplayForm();
          if (template.getTemplateName().equals(Constants.TEMPLATE_BASIC)) {
            display.setServletResource(true);
          }
          else {
            display.setServletResource(false);
          }
          display.setTemplateId(Format.getLong(template.getTemplateId()));
          display.setTemplateName(template.getTemplateName());
          display.setTemplateDesc(template.getTemplateDesc());
          String previewURL = "";
          SiteDomain siteDomain = site.getSiteDomainDefault();
          previewURL += "http://" + siteDomain.getSiteDomainName();
          if (!Format.isNullOrEmpty(siteDomain.getSitePublicPortNum())) {
            previewURL += ":" + siteDomain.getSitePublicPortNum();
          }
          previewURL += "/" + adminBean.getContextPath() + "/web/fe/";
          previewURL += siteDomain.getSiteDomainPrefix() + "/";
          previewURL += siteDomain.getSiteProfileDefault().getSiteProfileClass().getSiteProfileClassName() + "/";
          previewURL += "home";
          previewURL += "?templateName=" + template.getTemplateName();
          display.setPreviewURL(previewURL);
        vector.add(display);
        }
        form.setTemplates(vector);
       
View Full Code Here

    TemplateListingActionForm form = (TemplateListingActionForm) actionForm;
   
    String templateNames[] = form.getTemplateNames();
   
    for (int i = 0; i < templateNames.length; i++) {
      Template template = TemplateDAO.load(site.getSiteId(), templateNames[i]);
        String prefix = Utility.getTemplatePrefix(site, templateNames[i]);
        if (!Utility.removeFile(prefix)) {
              ActionMessages errors = new ActionMessages();
             errors.add("msg", new ActionMessage("error.template.remove", templateNames[i]));
              saveMessages(request, errors);
View Full Code Here

            em.remove(homePageLanguage);
          }
          em.remove(homePage);
          siteDomain.setHomePage(null);
         
          Template template = siteDomain.getTemplate();
          em.remove(template);
          siteDomain.setTemplate(null);
        }

    sql = "from SiteProfile siteProfile where siteProfile.siteDomain.site.siteId = :siteId";
View Full Code Here

    query.setParameter("siteId", siteId);
    iterator = query.getResultList().iterator();
    vector = new Vector<LabelValueBean>();
      vector.add(new LabelValueBean("", ""));
    while (iterator.hasNext()) {
      Template template = (Template) iterator.next();
      LabelValueBean bean = new LabelValueBean(template.getTemplateName(), template.getTemplateId().toString());
      vector.add(bean);
    }
    LabelValueBean templates[] = new LabelValueBean[vector.size()];
    vector.copyInto(templates);
    form.setTemplates(templates);
View Full Code Here

        errors.add("extract", new ActionMessage("error.template.prefix.empty"));
          saveMessages(request, errors);
      return actionMapping.findForward("error");
      }

      Template template = TemplateDAO.load(site.getSiteId(), templateName);
      if (template != null) {
        errors.add("extract", new ActionMessage("error.template.duplicate", templateName));
          saveMessages(request, errors);
      return actionMapping.findForward("error");
      }

      try {
        if (!Format.isNullOrEmpty(form.getTemplateName())) {
          File entry = new File(prefix);
          entry.mkdir();
        }
        else {
            InputStream stream = form.getFile().getInputStream();
            JarInputStream jarStream = new JarInputStream(stream);
            while (true) {
              JarEntry entry = jarStream.getNextJarEntry();
              if (entry == null) {
                break;
              }
              String name = prefix + entry.getName();
              if (entry.isDirectory()) {
                File jarEntry = new File(name);
                jarEntry.mkdirs();
                continue;
              }
              FileOutputStream writer = new FileOutputStream(name);
              byte[] buffer = new byte[1024];
              while (true) {
                int size = jarStream.read(buffer);
                if (size <= 0) {
                  break;
                }
                writer.write(buffer, 0, size);
              }
              writer.close();
            }
        }
      } catch (SecurityException e) {
        errors.add("extract", new ActionMessage("error.file.create.invalid"));
          saveMessages(request, errors);
      return actionMapping.findForward("error");
      } catch (FileNotFoundException e) {
        errors.add("extract", new ActionMessage("error.file.create.invalid"));
          saveMessages(request, errors);
      return actionMapping.findForward("error");
      } catch (Exception e) {
        errors.add("extract", new ActionMessage("error.file.create.invalid"));
          saveMessages(request, errors);
      return actionMapping.findForward("error");
      }
     
    template = new Template();
      template.setTemplateDesc(form.getTemplateDesc());
      template.setRecCreateBy(adminBean.getUser().getUserId());
      template.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      template.setTemplateName(templateName);
      template.setSite(site);
      template.setRecUpdateBy(adminBean.getUser().getUserId());
      template.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      em.persist(template);
     
      errors.add("info", new ActionMessage("message.template.created", templateName));
      saveMessages(request, errors);
     
      form.setTemplateName(template.getTemplateName());
    form.setTemplateDesc(template.getTemplateDesc());
        showDirectoryContent(request, form);

        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
        ActionForward actionForward = actionMapping.findForward("success");
        return actionForward;
View Full Code Here

    TemplateMaintActionForm form = (TemplateMaintActionForm) actionForm;
    if (form == null) {
      form = new TemplateMaintActionForm();
    }
    String templateName = request.getParameter("templateName");
    Template template = new Template();
    template = TemplateDAO.load(site.getSiteId(), templateName);
    form.setTemplateDesc(template.getTemplateDesc());
        if (form.getTemplateName().equals(Constants.TEMPLATE_BASIC)) {
          showDirectoryContentFromServlet(request, form);
        }
        else {
            showDirectoryContent(request, form);
View Full Code Here

    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    TemplateMaintActionForm form = (TemplateMaintActionForm) actionForm;

    Template template = new Template();
    template = TemplateDAO.load(site.getSiteId(), form.getTemplateName());
   
    template.setTemplateDesc(form.getTemplateDesc());
      template.setRecUpdateBy(adminBean.getUser().getUserName());
      template.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      em.persist(template);
      showDirectoryContent(request, form);
        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    return mapping.findForward("success");
  }
View Full Code Here

            FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
      return mapping.findForward("error");
      }
     
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Template template = TemplateDAO.load(site.getSiteId(), form.getTemplateName());
    em.remove(template);
    return mapping.findForward("removeSuccess");
  }
View Full Code Here

TOP

Related Classes of com.jada.jpa.entity.Template

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.