当前位置: 首页>>代码示例>>Java>>正文


Java Before类代码示例

本文整理汇总了Java中com.jfinal.aop.Before的典型用法代码示例。如果您正苦于以下问题:Java Before类的具体用法?Java Before怎么用?Java Before使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Before类属于com.jfinal.aop包,在下文中一共展示了Before类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFolder

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before( EvictInterceptor.class )
@CacheName( "Web" )
public void createFolder() {
  Integer project_id = getParaToInt("project.id");
  String name = getPara("folder.name");

  checkNotNull(project_id, "project.id");
  checkNotNull(name, "folder.name");

  // 检查同一个项目,同一个目录是否有相同名字的folder
  checkSameFolderName(project_id, 1, name);
  Folder folder = new Folder();
  folder.setLevel(1);
  folder.setName(name);
  folder.setRootId(0);
  folder.setPid(0);
  folder.setWProjectId(project_id);
  if ( folder.save() )
    OK();
  else
    Error(500, "Oop! create folder fail.");
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:23,代码来源:ProjectController.java

示例2: renameFolder

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before( EvictInterceptor.class )
@CacheName( "Web" )
public void renameFolder() {
  Integer project_id = getParaToInt("project.id");
  Integer folder_id = getParaToInt("folder.id");
  String name = getPara("folder.name");

  checkNotNull(project_id, "project.id");
  checkNotNull(folder_id, "folder.id");
  checkNotNull(name, "folder.name");

  // 检查同一个项目,同一个目录是否有相同名字的folder
  checkSameFolderName(project_id, 1, name);
  Folder folder = Folder.dao.findById(folder_id);
  if ( folder == null ) {
    Error(500, "Oop! folder not exit.");
    return;
  }
  folder.setName(name);
  if ( folder.update() )
    OK();
  else
    Error(500, "Oop! create folder fail.");
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:25,代码来源:ProjectController.java

示例3: deteleFolder

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before( EvictInterceptor.class )
@CacheName( "Web" )
public void deteleFolder() {
  Integer folder_id = getParaToInt("folder.id");

  checkNotNull(folder_id, "folder.id");

  boolean hasInter = Interface.dao.query("w_folder_id = ?", folder_id).size() > 0;
  if ( hasInter ) {
    Error(400, "Oop! folder has interface can't detele");
    return;
  }
  if ( Folder.dao.deleteById(folder_id) )
    OK();
  else
    Error(500, "Oop! delete folder fail.");
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:18,代码来源:ProjectController.java

示例4: renameInterface

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before( EvictInterceptor.class )
@CacheName( "Web" )
public void renameInterface() {
  Integer projectId = getParaToInt("project.id");
  String interfaceId = getPara("interface.id");
  String name = getPara("interface.name");

  checkNotNull(projectId, "project.id");
  checkNotNull(interfaceId, "interface.id");
  checkNotNull(name, "interface.name");

  Interface interfaces = Interface.dao.findById(interfaceId);
  if ( interfaces == null ) {
    Error(500, "Oop! not exist folder name.");
    return;
  }

  interfaces.setName(name);
  if ( interfaces.update() )
    OK();
  else
    Error(500, "Oop! create interface fail.");
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:24,代码来源:ProjectController.java

示例5: getUploadFilesMap

import com.jfinal.aop.Before; //导入依赖的package包/类
/**
 * 获取所有上传的文件
 *
 * @return
 */
@Before(NotAction.class)
public HashMap<String, UploadFile> getUploadFilesMap() {
    if (!isMultipartRequest()) {
        return null;
    }

    List<UploadFile> fileList = getFiles();
    HashMap<String, UploadFile> filesMap = null;
    if (ArrayUtils.isNotEmpty(fileList)) {
        filesMap = new HashMap<String, UploadFile>();
        for (UploadFile ufile : fileList) {
            filesMap.put(ufile.getParameterName(), ufile);
        }
    }
    return filesMap;
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:22,代码来源:JbootController.java

示例6: getInterfaceByFolder

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before( CacheInterceptor.class )
@CacheName( "Web" )
public void getInterfaceByFolder() {
  Integer projectId = getParaToInt("project.id");
  Integer folderId = getParaToInt("folder.id");

  checkNotNull(projectId, "project.id");
  checkNotNull(folderId, "folder.id");

  OK(Interface.dao.find("select * from w_interface where w_project_id = ? and  w_folder_id = ? order by seq asc", projectId, folderId));
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:12,代码来源:ProjectController.java

示例7: createInterfaceQuick

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before( EvictInterceptor.class )
  @CacheName( "Web" )
  public void createInterfaceQuick() {
    Integer projectId = getParaToInt("project.id");
    String folderId = getPara("folder.id");
    String name = getPara("interface.name");
//	  String code = getPara("interface.code");

    checkNotNull(projectId, "project.id");
    checkNotNull(folderId, "folder.id");
    checkNotNull(name, "interface.name");
//	  checkNotNull(code, "interface.code");

    Folder folder = Folder.dao.findById(folderId);
    if ( folder == null ) {
      Error(500, "Oop! not exist folder name.");
      return;
    }
//	  checkSameInterfaceCode(projectId, folder.getId(), code);

    Interface interfaces = new Interface();
    interfaces.setName(name);
    interfaces.setWProjectId(projectId);
    interfaces.setWFolderId(folder.getId());
//	  interfaces.setCode(code);
    if ( interfaces.save() )
      OK();
    else
      Error(500, "Oop! create interface fail.");
  }
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:31,代码来源:ProjectController.java

示例8: deteleInterface

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before( EvictInterceptor.class )
@CacheName( "Web" )
public void deteleInterface() {
  Integer interface_id = getParaToInt("interface.id");

  checkNotNull(interface_id, "interface.id");

  if ( Interface.dao.deleteById(interface_id) )
    OK();
  else
    Error(500, "Oop! delete folder fail.");
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:13,代码来源:ProjectController.java

示例9: duplicateInterface

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before( { EvictInterceptor.class, Tx.class } )
@CacheName( "Web" )
public void duplicateInterface() {
  Integer interfaceId = getParaToInt("interface.id");
  Integer projectId = getParaToInt("project.id");
  Integer folderId = getParaToInt("folder.id");

  checkNotNull(projectId, "project.id");
  checkNotNull(folderId, "folder.id");
  checkNotNull(interfaceId, "interface.id");

  Interface interfaces = Interface.dao.findById(interfaceId);
  if ( interfaces == null ) {
    Error(500, "Oop! interface not exist.");
    return;
  }
  List<Parameter> parameters = Parameter.dao.find("select * from w_parameter where w_interface_id = ?", interfaces.getId());

  interfaces.setId(null);
  interfaces.setCode(interfaces.getCode() + "Copy");
  interfaces.setName(interfaces.getName() + "Copy");
  interfaces.setSeq(interfaces.getSeq() == null ? 100 : interfaces.getSeq() + 100);
  interfaces.save();

  for ( Parameter parameter : parameters ) {
    parameter.setId(null);
    parameter.setWInterfaceId(interfaces.getId());
    parameter.save();
  }

  OK(Interface.dao.find("select * from w_interface where w_project_id = ? and  w_folder_id = ? order by seq asc", projectId, folderId));
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:33,代码来源:ProjectController.java

示例10: cloneModel

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before(Tx.class)
public void cloneModel() {
	Object projectId = getPara("projectId");
	Object modelId = getPara();

	Assert.checkNotNull(projectId, "projectId");
	Assert.checkNotNull(modelId, "modelId");

	// 一共需要复制 model, model_item, generate
	DbModel model = DbModel.dao.findById(modelId);
	if ( model == null ) throw new ApiException("Oop! model not exist.");

	List<DbModelItem> dbModelItemList = DbModelItem.dao.find("select * from w_db_model_item where w_model_id = ?", modelId);
	model.remove("id").setName(model.getName() + "_clone");
	model.setClassName(null);
	model.setDescribe(null);
	if ( !model.save() ) throw new ApiException("Oop! clone model fail.");
	for (DbModelItem dbModelItem : dbModelItemList) {
		dbModelItem.remove("id").setWModelId(model.getId());
		dbModelItem.save();
	}
	Generate generate = Generate.dao.findFirst("select * from w_generate where w_model_id = ?", modelId);
	if ( generate != null) {
		generate.remove("id").setWModelId(model.getId());
		generate.setModuleName(null);
		generate.save();
	}
	OK();
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:30,代码来源:DBModelController.java

示例11: save

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before(Tx.class)
public void save() {
	DbModel dbmodel = getModel(DbModel.class, "dbmodel");
	Generate generate = getModel(Generate.class, "generate");
	List<DbModelItem> dbmodelItems = getModels(DbModelItem.class, "model");
	if(StrKit.isBlank(dbmodel.getClassName())) {
	  dbmodel.setClassName(camelNameConvert(dbmodel.getName()));
	}
	if(StrKit.isBlank(generate.getModuleName())) {
	  generate.setModuleName(dbmodel.getClassName().toLowerCase());
	}
	if(dbmodel.save()) {
	  generate.setWModelId(dbmodel.getId());
	  generate.save();
	  int serial = 0;
		for(DbModelItem item : dbmodelItems) {
			// 根据type设置java_type
			item.setJavaType(mysqlAndJavaType.get(item.getType()));
			item.setWModelId(dbmodel.getId());
			item.save();
			serial = item.getSerial();
		}
		createDateTime("create_date", "创建时间", dbmodel.getId(), serial++).save();
		createDateTime("modify_date", "更新时间", dbmodel.getId(), serial++).save();
	}
	OK();
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:28,代码来源:DBModelController.java

示例12: delete

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before(Tx.class)
public void delete() {
  Object id = getPara();
  Assert.checkNotNull(id, "model id");
  boolean hasRelation = DbModelMapping.dao.find("select * from w_db_model_mapping where master_id = ? or slaves_id = ?", id, id).size() > 0;
  if(hasRelation) {
    throw new ApiException("Oop~ model has relation, can't delete.");
  }
  if(DbModel.dao.deleteById(id)) OK();
  else Error(500, "Oop~ delete model fail.");
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:12,代码来源:DBModelController.java

示例13: setFlashAttr

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before(NotAction.class)
public Controller setFlashAttr(String name, Object value) {
    if (flash == null) {
        flash = new HashMap<>();
    }

    flash.put(name, value);
    return this;
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:10,代码来源:JbootController.java

示例14: setFlashMap

import com.jfinal.aop.Before; //导入依赖的package包/类
@Before(NotAction.class)
public Controller setFlashMap(Map map) {
    if (map == null) {
        throw new NullPointerException("map is null");
    }
    if (flash == null) {
        flash = new HashMap<>();
    }

    flash.putAll(map);
    return this;
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:13,代码来源:JbootController.java

示例15: getBaseUrl

import com.jfinal.aop.Before; //导入依赖的package包/类
/**
 * 获取当前网址
 *
 * @return
 */
@Before(NotAction.class)
public String getBaseUrl() {
    HttpServletRequest req = getRequest();
    int port = req.getServerPort();

    return port == 80
            ? String.format("%s://%s%s", req.getScheme(), req.getServerName(), req.getContextPath())
            : String.format("%s://%s%s%s", req.getScheme(), req.getServerName(), ":" + port, req.getContextPath());

}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:16,代码来源:JbootController.java


注:本文中的com.jfinal.aop.Before类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。