Package com.jada.admin.customAttribute

Examples of com.jada.admin.customAttribute.CustomAttributeMaintActionForm


                             ActionForm actionForm,
                             HttpServletRequest request,
                             HttpServletResponse response)
        throws Throwable {

        CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
        form.setMode("C");
       
        FormUtils.setFormDisplayMode(request, form, FormUtils.CREATE_MODE);
        ActionForward actionForward = actionMapping.findForward("success");
        return actionForward;
    }
View Full Code Here


            HttpServletRequest request,
            HttpServletResponse response)
    throws Throwable {
 
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
    if (form == null) {
      form = new CustomAttributeMaintActionForm();
    }
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
   
    CustomAttribute customAttribute = (CustomAttribute) em.find(CustomAttribute.class, Format.getLong(form.getCustomAttribId()));
   
      GoogleTranslate translator = new GoogleTranslate(form.getFromLocale(), form.getToLocale());
    form.setCustomAttribDescLangFlag(true);
    form.setCustomAttribDescLang(translator.translate(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc()));
   
    if (customAttribute.getCustomAttribDataTypeCode() == Constants.CUSTOM_ATTRIBUTE_DATA_TYPE_STRING) {
      form.setCustomAttribOptionLangFlag(true);
      CustomAttributeOptionDisplayForm optionForms[] = form.getCustomAttribOptions();
      for (int i = 0; i < optionForms.length; i++) {
        CustomAttributeOptionDisplayForm optionForm = optionForms[i];
        optionForm.setCustomAttribValueLang(translator.translate(optionForm.getCustomAttribValue()));
        optionForm.setCustomAttribValueLangFlag(true);
      }
View Full Code Here

            HttpServletRequest request,
            HttpServletResponse response)
    throws Throwable {
 
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
   
    CustomAttribute customAttribute = (CustomAttribute) em.find(CustomAttribute.class, Format.getLong(form.getCustomAttribId()));
        copyProperties(form, customAttribute, request);
    FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    ActionForward actionForward = actionMapping.findForward("success");
    return actionForward;
  }
View Full Code Here

                              HttpServletRequest request,
                              HttpServletResponse response)
        throws Throwable {

      Site site = getAdminBean(request).getSite();
        CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
    initSiteProfiles(form, site);
    String customAttribId = request.getParameter("customAttribId");
        CustomAttribute customAttribute = new CustomAttribute();
        customAttribute = CustomAttributeDAO.load(site.getSiteId(), Format.getLong(customAttribId));
        form.setMode("U");
        copyProperties(form, customAttribute, request);
        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
        ActionForward actionForward = actionMapping.findForward("success");
        return actionForward;
    }
View Full Code Here

            ActionForm actionForm,
            HttpServletRequest request,
            HttpServletResponse response)
    throws Throwable {
   
    CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
      Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    try {
      CustomAttribute customAttribute = CustomAttributeDAO.load(site.getSiteId(), Format.getLong(form.getCustomAttribId()));
          copyProperties(form, customAttribute, request);
      em.remove(customAttribute);
      for (CustomAttributeLanguage customAttributeLanguage : customAttribute.getCustomAttributeLanguages()) {
        em.remove(customAttributeLanguage);
      }
View Full Code Here

    throws Throwable {

      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    MessageResources resources = this.getResources(request);
    boolean insertMode = false;
    CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
    if (form.getMode().equals("C")) {
      insertMode = true;
    }

    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    initSiteProfiles(form, site);
    CustomAttribute customAttribute = new CustomAttribute();
    if (!insertMode) {
      customAttribute = CustomAttributeDAO.load(site.getSiteId(), Format.getLong(form.getCustomAttribId()));
    }

    ActionMessages errors = validate(form, request);
    if (errors.size() != 0) {
      saveMessages(request, errors);
      return mapping.findForward("error");
    }

    if (insertMode) {
      customAttribute.setRecCreateBy(adminBean.getUser().getUserId());
      customAttribute.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      form.setCustomAttribDataTypeCodeDesc(resources.getMessage("customAttrib.dataTypeCode." + form.getCustomAttribDataTypeCode()));
      form.setCustomAttribTypeCodeDesc(resources.getMessage("customAttrib.typeCode." + form.getCustomAttribTypeCode()));
     
      CustomAttributeLanguage customAttribLanguage = new CustomAttributeLanguage();
      customAttribute.setSystemRecord(Constants.VALUE_NO);
      customAttribLanguage.setRecCreateBy(adminBean.getUser().getUserId());
      customAttribLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        SiteProfileClass siteProfileClass = (SiteProfileClass) em.find(SiteProfileClass.class, form.getSiteProfileClassDefaultId());
        customAttribLanguage.setSiteProfileClass(siteProfileClass);
        customAttribLanguage.setCustomAttribute(customAttribute);
        customAttribute.setCustomAttributeLanguage(customAttribLanguage);
        customAttribute.getCustomAttributeLanguages().add(customAttribLanguage);
    }
    customAttribute.setSite(site);
    customAttribute.setCustomAttribName(form.getCustomAttribName());
    customAttribute.setRecUpdateBy(adminBean.getUser().getUserId());
    customAttribute.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
   
    if (form.isSiteProfileClassDefault() && form.isSiteCurrencyClassDefault()) {
      saveDefault(customAttribute, form, adminBean);
    }
    else {
      if (!form.isSiteProfileClassDefault()) {
        saveLanguage(customAttribute, form, adminBean);
      }
      if (!form.isSiteCurrencyClassDefault()) {
        saveCurrency(customAttribute, form, adminBean);
      }
    }
   
    if (insertMode) {
      em.persist(customAttribute);
    }
    else {
      // em.update(customAttribute);
    }
        form.setMode("U");
        form.setCustomAttribId(customAttribute.getCustomAttribId().toString());
        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    return mapping.findForward("success");
  }
View Full Code Here

   
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
   
    String customAttribOptionIds[] = form.getCustomAttribOptionIds();
    if (customAttribOptionIds != null) {
      for (int i = 0; i < customAttribOptionIds.length; i++) {
        CustomAttributeOption customAttribOption = CustomAttributeOptionDAO.load(site.getSiteId(), Format.getLong(customAttribOptionIds[i]));
        String sql = "select count(*) " +
               "from   ItemAttributeDetail itemAttributeDetail " +
View Full Code Here

  public ActionForward getCustomAttributeOptions(ActionMapping mapping,
        ActionForm actionForm,
        HttpServletRequest request,
        HttpServletResponse response)
    throws Throwable {
    CustomAttributeMaintActionForm form = (CustomAttributeMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    initSiteProfiles(form, site);
 
    Long customAttribId = Format.getLong(form.getCustomAttribId());
    CustomAttribute customAttribute = CustomAttributeDAO.load(site.getSiteId(), customAttribId);
    JSONEscapeObject jsonResult = new JSONEscapeObject();
    Iterator<?> iterator = customAttribute.getCustomAttributeOptions().iterator();
    Vector<JSONEscapeObject> customAttributeOptions = new Vector<JSONEscapeObject>();
    while (iterator.hasNext()) {
View Full Code Here

TOP

Related Classes of com.jada.admin.customAttribute.CustomAttributeMaintActionForm

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.