Package org.apdplat.platform.model

Examples of org.apdplat.platform.model.Model


        for(ModelInfo modelInfo : modelInfos){
            if(modelInfo.getModelEnglish().toUpperCase().equals(modelName.toUpperCase())){
                String modelClzz=modelInfo.getModelPackage()+"."+modelInfo.getModelEnglish();
                try {
                    Class clazz = Class.forName(modelClzz);
                    Model model=(Model)clazz.newInstance();
                    if(model!=null){
                        Generator.setActionModelMap(actions, model);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                    System.out.println("请再重新运行命令一次");
                    return;
                }
            }
            if(modelInfo.getModelEnglish().toUpperCase().equals(modelName1.toUpperCase())){
                String modelClzz=modelInfo.getModelPackage()+"."+modelInfo.getModelEnglish();
                try {
                    Class clazz = Class.forName(modelClzz);
                    Model model=(Model)clazz.newInstance();
                    if(model!=null){
                        Generator.setActionModelMap(actions1, model);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                    System.out.println("请再重新运行命令一次");
                    return;
                }
            }
            if(modelInfo.getModelEnglish().toUpperCase().equals(modelName2.toUpperCase())){
                String modelClzz=modelInfo.getModelPackage()+"."+modelInfo.getModelEnglish();
                try {
                    Class clazz = Class.forName(modelClzz);
                    Model model=(Model)clazz.newInstance();
                    if(model!=null){
                        Generator.setActionModelMap(actions2, model);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                    System.out.println("请再重新运行命令一次");
                    return;
                }
            }
            if(modelInfo.getModelEnglish().toUpperCase().equals(modelName3.toUpperCase())){
                String modelClzz=modelInfo.getModelPackage()+"."+modelInfo.getModelEnglish();
                try {
                    Class clazz = Class.forName(modelClzz);
                    Model model=(Model)clazz.newInstance();
                    if(model!=null){
                        Generator.setActionModelMap(actions3, model);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                    System.out.println("请再重新运行命令一次");
                    return;
                }
            }
            if(modelInfo.getModelEnglish().toUpperCase().equals(modelName4.toUpperCase())){
                String modelClzz=modelInfo.getModelPackage()+"."+modelInfo.getModelEnglish();
                try {
                    Class clazz = Class.forName(modelClzz);
                    Model model=(Model)clazz.newInstance();
                    if(model!=null){
                        Generator.setActionModelMap(actions4, model);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
View Full Code Here


        for(ModelInfo modelInfo : modelInfos){
            if(modelInfo.getModelEnglish().equalsIgnoreCase(modelName)){
                String modelClzz=modelInfo.getModelPackage()+"."+modelInfo.getModelEnglish();
                try {
                    Class clazz = Class.forName(modelClzz);
                    Model model=(Model)clazz.newInstance();
                    if(model!=null){
                        Generator.setActionModelMap(actions, model);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
View Full Code Here

    protected void objectReference(T model) {
        Field[] fields = model.getClass().getDeclaredFields();//获得对象方法集合
        for (Field field : fields) {// 遍历该数组
            if(field.isAnnotationPresent(ManyToOne.class) || field.isAnnotationPresent(OneToOne.class)){
                LOG.debug(model.getMetaData()+" 有ManyToOne 或 OneToOne映射,字段为"+field.getName());
                Model value=(Model)ReflectionUtils.getFieldValue(model, field);
                if(value==null){
                    LOG.debug(model.getMetaData()+" 的字段"+field.getName()+"没有值,忽略处理");
                    continue;
                }
                int id=value.getId();
                LOG.debug("id: "+id);
                value=getService().retrieve(value.getClass(), id);
                ReflectionUtils.setFieldValue(model, field, value);
            }
        }
    }
View Full Code Here

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        String modelName=request.getParameter("modelName");
        if(modelName!=null){
            Model model = SpringContextUtils.getBean(modelName);
            request.setAttribute("model", model);
            LOG.info("用户使用facade action,modelName="+modelName);
        }
        chain.doFilter(request, response);
    }
View Full Code Here

                String actionNamespace=ModuleService.getModulePath(module.getParentModule());
                String actionPackage=actionPackageBase+"."+actionNamespace.replace("/", ".").replace("\\", ".")+"action";
                actionNamespace=actionNamespace.substring(0, actionNamespace.length()-1);
                String actionPath=actionPackage.replace(".", "/");
                //判断此模块是否已被指定操作特定的模型
                Model model=actionToModel.get(module.getEnglish());
                System.out.println("actionToModel action: "+module.getEnglish());
                if(model!=null){
                    System.out.println("actionToModel model: "+model.getClass().getName());
                    System.out.println("模块 "+module.getChinese()+" 已被指定操作特定的模型 "+model.getMetaData());
                    //模块有指定的Model
                    String modelPackage=model.getClass().getName().replace("."+model.getClass().getSimpleName(), "");
                    generateAction(actionPackage,actionNamespace,actionName,modelPackage,model.getClass().getSimpleName(),workspaceModuleBasePath,specialCommands);
                    continue;
                }
                System.out.println("模块 "+module.getChinese()+" 没有对应的模型 ");
               
                if(models.contains(action)){
View Full Code Here

     * @param modulePath 多级非叶子模块(路径名称等于模块英文名称)
     * @param module 叶子模块(路径名称等于模块英文名称)
     * @return
     */
    public static String getContent(String modulePath, String module) {
        Model model=actionToModel.get(module);
        if(model==null){
            return "";
        }
       
        String templateName="js.ftl";

        LOG.info("开始生成JS");
       
        Map<String, Object> context = new HashMap<>();
        List<ModelFieldData> attrs=model.getAllRenderModelAttr();
        //去除重复的词典,便于在修改页面加载各个不同的下拉菜单
        Set<String> dicNames=new HashSet<String>();
        for(ModelFieldData attr : attrs){
            if(!"".equals(attr.getSimpleDic())){
                dicNames.add(attr.getSimpleDic());
            }
            if(!"".equals(attr.getTreeDic())){
                dicNames.add(attr.getTreeDic());
            }
        }
       
        int baseHeight=120;
        //添加,分为两列
        List<ModelFieldData> modelAttrs=model.getModelAttr();
        int len=modelAttrs.size()/2+modelAttrs.size()%2;
        int createHeight=baseHeight+len*16*2;       
        int labelWidth=80;
        int maxLength=0;
        List<ModelFieldData> leftModelAttrs=new ArrayList<>();
        for(int i=0;i<len;i++){
            ModelFieldData data=modelAttrs.get(i);
            leftModelAttrs.add(data);
            int length=data.getChinese().length();
            if(length>4){
                maxLength=length>maxLength?length:maxLength;
            }
        }
        List<ModelFieldData> rightModelAttrs=new ArrayList<>();
        for(int i=len;i<modelAttrs.size();i++){
            ModelFieldData data=modelAttrs.get(i);
            rightModelAttrs.add(data);
            int length=data.getChinese().length();
            if(length>4){
                maxLength=length>maxLength?length:maxLength;
            }
        }
        if(maxLength>0){
            labelWidth=(maxLength-4)*10+80;
        }
        //搜索,分为两列
        List<ModelFieldData> searchableAttrs=model.getAllModelSearchableAttr();
        len=searchableAttrs.size()/2+searchableAttrs.size()%2;       
        int searchHeight=baseHeight+len*16*2;
        List<ModelFieldData> leftSearchableAttrs=new ArrayList<>();
        for(int i=0;i<len;i++){
            leftSearchableAttrs.add(searchableAttrs.get(i));
        }
        List<ModelFieldData> rightSearchableAttrs=new ArrayList<>();
        for(int i=len;i<searchableAttrs.size();i++){
            rightSearchableAttrs.add(searchableAttrs.get(i));
        }
       
        if(modulePath.startsWith("/")){
            modulePath=modulePath.substring(1);
        }
        if(modulePath.endsWith("/")){
            modulePath=modulePath.substring(0,modulePath.length()-1);
        }
        if(createHeight>999){
            createHeight=999;
        }
        Integer createWidth=(createHeight*16)/9;
        if(createWidth<800){
            createWidth=800;
        }
        if(searchHeight>999){
            searchHeight=999;
        }
        Integer searchWidth=(searchHeight*16)/9;
        if(searchWidth<800){
            searchWidth=800;
        }
        context.put("namespace", modulePath);
        context.put("action", dealWithAcdtion(module));
        context.put("attrs", attrs);
        context.put("dicNames", dicNames);
        context.put("labelWidth", labelWidth);
        context.put("createWidth", createWidth.toString());
        context.put("createHeight", createHeight);
        context.put("searchWidth", searchWidth.toString());
        context.put("searchHeight", searchHeight);
        context.put("leftModelAttrs", leftModelAttrs);
        context.put("rightModelAttrs", rightModelAttrs);
        context.put("searchableAttrs", searchableAttrs);
        context.put("leftSearchableAttrs", leftSearchableAttrs);
        context.put("rightSearchableAttrs", rightSearchableAttrs);
        context.put("model", model.getClass().getSimpleName());
        context.put("title", model.getMetaData());
        context.put("icon", module);
       

        try {
            Template template = freemarkerConfiguration.getTemplate(templateName, ENCODING);
View Full Code Here

TOP

Related Classes of org.apdplat.platform.model.Model

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.