Package com.exedosoft.plat.template

Source Code of com.exedosoft.plat.template.BindData2FormModel

package com.exedosoft.plat.template;

import java.util.List;

import com.exedosoft.plat.bo.BOInstance;
import com.exedosoft.plat.ui.DOFormModel;

import freemarker.ext.beans.StringModel;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;

public class BindData2FormModel implements TemplateMethodModelEx {

  public Object exec(List paras) throws TemplateModelException {

    // TemplateModel model =
    // Environment.getCurrentEnvironment().getVariable("lineData");
    StringModel p1 = (StringModel) paras.get(0);
    StringModel p2 = (StringModel) paras.get(1);
    if (p2 != null) {
      BOInstance data = null;
      if (p1 != null) {
        data = (BOInstance) p1.getWrappedObject();
      }
      DOFormModel fm = (DOFormModel) p2.getWrappedObject();
      fm.setData(data);
     
      if (data != null) {
        if (!fm.isAccess(data)) {
          return "false";
        }
      } else {
        if (!fm.isAccess()) {
          return "false";
        }

      }

    }

    return "";
  }

}
TOP

Related Classes of com.exedosoft.plat.template.BindData2FormModel

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.