String serviceInterfaceFullName = serveicePackge + ".I"
+ recordFullType + "Service";
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
// 导入 com.eatle.utils.DwzAjaxJsonUtil;
FullyQualifiedJavaType type = new FullyQualifiedJavaType(
"com.eatle.utils.DwzAjaxJsonUtil");
importedTypes.add(type);
type = FullyQualifiedJavaType.getNewMapInstance();
importedTypes.add(type);
// import ...
type = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
importedTypes.add(type);
type = new FullyQualifiedJavaType(actionFullName);
TopLevelClass topLevelClass = new TopLevelClass(type);
topLevelClass.setVisibility(JavaVisibility.PUBLIC);
type = new FullyQualifiedJavaType("com.eatle.web.action.BaseAction");
topLevelClass.setSuperClass(type);
importedTypes.add(type);
// add field, getter, setter for orderby clause
// @Resource
// private IUserService userService;
type = new FullyQualifiedJavaType("javax.annotation.Resource");
importedTypes.add(type);
Field field = new Field();
field.setVisibility(JavaVisibility.PRIVATE);
type = new FullyQualifiedJavaType(serviceInterfaceFullName);
importedTypes.add(type);
field.setType(type);
field.setName(serviceObjName); //$NON-NLS-1$
field.addAnnotation("@Resource");
topLevelClass.addField(field);
// private Pagination page;
field = new Field();
field.setVisibility(JavaVisibility.PRIVATE);
type = new FullyQualifiedJavaType("com.eatle.utils.Pagination");
importedTypes.add(type);
field.setType(type);
field.setName("page");
topLevelClass.addField(field);
field = new Field();
field.setVisibility(JavaVisibility.PRIVATE);
type = new FullyQualifiedJavaType(recordFullType);
field.setType(type);
field.setName(recordLowerFullType);
topLevelClass.addField(field);
topLevelClass.addImportedTypes(importedTypes);
// setter getter