OneCode ローコード エンジン、ドメイン駆動設計 (DDD) テクノロジの実践 (1)

序文

ドメイン駆動設計(略して ddd) の概念は、有名なモデリングの専門家であるエリック エヴァンスが 2004 年に出版した最も影響力のある著書『ドメイン駆動設計 - ソフトウェア コアの複雑さに取り組む』 (ドメイン駆動設計 - ソフトウェア コアの複雑さに取り組む) に由来しています。ソフトウェアの中心)、エヴァンス DDD と呼ばれる、ドメイン駆動型の設計アイデアをソフトウェア開発者の視野に取り入れます。20 年近い開発の中で、ドメイン モデルの設計は常に非常に重要な位置を占めてきましたが、ビジネス シナリオを直接指向したその設計思想は、特定のビジネス シナリオを使用したモデルの構築により適しています。私たちが日常生活で目にする DDD モデルのほとんどは、特定のビジネス背景を持つドメイン固有のモデリング ツールです。

過去 2 年間、新世代の WEB テクノロジー、マイクロサービス、ミッドプラットフォーム テクノロジー、クラウド ネイティブ アプリケーションの推進により、ドメイン駆動モデル (DDD) がこの分野で再び注目を集めています。ソフトウェア設計のこと。ローコード/ノーコードプラットフォームは、近年急速に発展を続けている技術分野です。

1. OneCode ツールセットの概要

OneCode-DSM (以下、DSM)ツール セットは、ローコード モデリング アプリケーションに焦点を当てた、OneCode ローコード エンジンに基づく高レベル モデリング ツールです。

OneCode エンジンでは、一般ユーザーにノーコードのドラッグ デザイナーとローコードのビジネス ロジック アレンジャーを提供するだけでなく、ビジネス ドメインの専門家向けの DSM モデリング ツールも提供します。

OneCode-DSM アプリ

(1)ビジュアルデザイナー

ビジュアルデザイナーエンジンを主体とした帳票レポートツールは、日常的によく使われる帳票レポートに、業務フロー承認やデータ大画面表示設計、モバイル表示などをコードレスで実現します。

(2) ローコードサービス統合ツール

(3) DSMモデリングツール

2.OneCode-DSM ツール

(1) ツール構成の概要

DSM モデリング ツールは、OneCode モデリングの補助ツールであり、リソース ライブラリ管理モジュール、ドメイン モデル構築モジュール、およびビュー ファクトリ構成モジュールを提供します。

ストレージ モデル モジュールの主な機能は、ユーザーがユーザーのデータベース、外部 API インターフェイス、および既存の「コード」アプリケーションを、コンバーターを通じて DSM で認識できるリソース部門形式に変換できるように支援することです。

ドメイン モデル モジュールは DSM のコア ツールです。ドメイン モデルにインポートされたリソースは、特定のシナリオの値オブジェクト、シナリオ メニュー、および一般的なドメイン サービスと組み合わされて、特定のビジネス シナリオに従ってドメイン モデルのモデリングを完了します。

ビュー ファクトリは、ドメイン モデルを具体的に実現したものです。ドメイン モデルのアプリケーションでは、モデリング出力製品がコード出力ファクトリを通じてビット ビュー アプリケーションを出力し、これらのビュー アプリケーションはさらに処理されて、ユーザー インタラクティブなアプリケーションに出力されます。ビューファクトリーを介してアプリケーションを実行します。

(2) OneCode言語(アノテーション)の構成

(3) モデリングプロセス

3、倉庫モデリング

(1) データベースモデリングによる

最も頻繁に使用されるストレージ ツールはデータベース変換アプリケーションであり、ユーザーはデータベース ツールを通じてデータ ソースの構成を完了します。

データソース構成

ライブラリ テーブル マッピングのコード例:

 @DBTable(configKey="fdt",cname="领导信息",tableName="FDT_LINGDAO",primaryKey="uuid")
 @Repository(repositoryId="54fa1fd2-cae4-44b0-8387-f10f98bdd63c")
	public interface FdtLingdao  {

      @Uid
      @DBField(cnName="主键",dbFieldName="uuid")
 	public String getUuid();

	  public void setUuid(String  uuid);

      @CustomAnnotation(caption="名称")
      @DBField(cnName="名称",length=20,dbFieldName="test")
 	  public String getTest();

	  public void setTest(String  test);

      @CustomAnnotation(caption="领导姓名")
      @DBField(cnName="领导姓名",length=20,dbFieldName="name")
 	  public String getName();

	  public void setName(String  name);

      @CustomAnnotation(caption="职务")
      @DBField(cnName="职务",length=100,dbFieldName="duty")
 	  public String getDuty();

	  public void setDuty(String  duty);

      @CustomAnnotation(caption="创建时间")
      @DBField(cnName="创建时间",length=0,dbType=ColType.DATETIME,dbFieldName="createtime")
 	  public Date getCreatetime();

	  public void setCreatetime(Date  createtime);

  }

ライブラリ テーブル ローダーのサンプル CRUD コード:

@Aggregation(type = AggregationType.aggregationEntity,entityClass=FdtLingdao.class,rootClass= FdtLingdaoService.class)
public interface FdtLingdaoService  {

    @APIEventAnnotation(bindMenu = {CustomMenuItem.reload})
    public List<FdtLingdao> findAll()throws JDSException;

    public List<FdtLingdao> findByWhere(String where)throws JDSException;
    
    @APIEventAnnotation(bindMenu = {CustomMenuItem.search})
    public List<FdtLingdao> find(FdtLingdao  fdtLingdao)throws JDSException;
   
    @APIEventAnnotation(bindMenu = {CustomMenuItem.add,CustomMenuItem.editor})
    public FdtLingdao getFdtLingdaoInfo(String uuid) throws JDSException;

    @APIEventAnnotation(bindMenu = {CustomMenuItem.save}, callback = {CustomCallBack.ReloadParent, CustomCallBack.Close})
    public FdtLingdao update( FdtLingdao  fdtLingdao) throws JDSException;

    @APIEventAnnotation(bindMenu = {CustomMenuItem.delete}, callback = {CustomCallBack.Reload})
    public Boolean delete(String uuid) throws JDSException;
}

(2) ソリッドモデリングによる

ストレージエンティティインスタンス

@Entity
@Aggregation(type = AggregationType.aggregationRoot,sourceClass = Role.class, rootClass = Role.class)
public interface Role extends java.io.Serializable {

  
    @MethodChinaName(cname = "角色标识")
    @Uid
    public String getRoleId();

    public void setRoleId(String roleId);


    @MethodChinaName(cname = "名称")
    @Caption
    public String getName();

    public void setName(String name);

    @MethodChinaName(cname = "角色类型")
    public RoleType getType();

    public void setType(RoleType type);

    @MethodChinaName(cname = "级数")
    public String getRoleNum();

    public void setRoleNum(String num);


   
    @MethodChinaName(cname = "系统ID")
    @Pid
    public String getSysId();

    public void setSysId(String sysId);


    @MethodChinaName(cname = "人员")
    @Ref(ref = RefType.m2m, view = ViewType.grid)
    public List<Person> getPersonList();

    @MethodChinaName(cname = "部门")
    @Ref(ref = RefType.m2m, view = ViewType.grid)
    public List<Org> getOrgList();

    public List<String> getOrgIdList();
}

   

(3) 実体関係

ウェアハウス モデリングの中心的な目的は、構造化データをオブジェクト指向モデルに変換することであり、最も重要なポイントの 1 つはエンティティ関係の処理です。DSM 設計により、ユーザーはデータベース テーブルをインポートした後にエンティティ関係を再度実行できます。データベース テーブル間の関係は、1:1、1:N、N:N モデルに従って確立されます。モデリングが完了すると、コード出力処理中にビジネステンプレートの設定に従ってエンティティモデルが変換され、エンティティコードに@Refリレーションシップタグが追加されたモデリングアプリケーションが完成します。

データベースモデルの関係 エンティティ関係 エンティティアノテーションの設定
1:N 1対多 @Ref(ref = RefType.o2m)
N:N 多対多 @Ref(ref = RefType.m2m)
1:1 一対一 @Ref(ref = RefType.o2o)
引用 @Ref(ref = RefType.ref)
見上げる @Ref(ref = RefType.)

エンティティ モデルの関係は、基本モデル上のストレージ モデルに従って設計され、独自に拡張されます。

public enum RefType implements IconEnumstype {
   ref("引用", "spafont spa-icon-c-databinder"),
   o2m("一对多", "spafont spa-icon-c-treeview"),
   m2o("多对一", "spafont spa-icon-alignwh"),
   f2f("自循环", "spafont spa-icon-cancel"),
   o2o("一对一", "spafont spa-icon-hmirror"),
   find("查找", "xui-icon-search"),
   m2m("多对多", "spafont spa-icon-alignwh");
    private final String imageClass;
    private final String name;

    RefType(String name, String imageClass) {
        this.name = name;
        this.imageClass = imageClass;
    }
}

(4) 倉庫モデリングテンプレート

(5) ストレージモデルの共通アノテーション

注釈名 使用
@DBTテーブル データベース テーブル マッピングの構成には
主に、データ ソース ID、テーブル名、主キー情報が含まれます
@DBTable(configKey="fdt",tableName="FDT_LINGDAO",primaryKey="uuid")
@DBフィールド データベースフィールドの設定 @DBField(cnName="作成時刻", length=0, dbType=ColType.DATETIME, dbFieldName="作成時刻")
@Uid エンティティ フィールド。通常はデータベース エンティティの主キーとして識別され、DDD モデルでは一意の値として識別されます。 @Uid
@ピッド 親コンポーネントフィールド。通常、親オブジェクトの主キーを識別するためにリレーショナルエンティティで使用されます。 @ピッド
@CustomAnnotation 一般的に使用されるエンティティ注釈、注釈属性には、フィールド表示タイプ、読み取り可能な属性、表示注釈などが含まれます。 @CustomAnnotation(caption="位置")
@キャプション タイトルの注釈は通常、表の行データの表示におけるデフォルトの表示フィールドとして使用されます。たとえば、(人事オブジェクト内の)人物はデフォルトの表示オプションとして名前を使用します。 @キャプション
@Ref エンティティ関係プロパティ @Ref(ref = RefType.m2m、ビュー = ViewType.grid)
@APIEventAnnotation API サービス アノテーションは、外部サービスの識別です。このアノテーションを追加すると、以降のモデルモデリングでWeb APIサービスに変換されます。 @APIEventAnnotation(bindMenu = {CustomMenuItem.search})

4番目、ドメインモデリング

(1) ドメインモデリングの構成

(2) ドメインモデリングの原則

モデルレンダリングの原理

OneCode 自体は Java Spring アノテーションに基づく拡張サブセットのセットである JAVA 言語システムに基づいており、ハイブリッド コンパイル エンジンは拡張アノテーションを通じて完全なドメイン モデルを構築し、標準の Spring を読み取ることで通常の Web データ配信とスケジューリング プロセスを完了します。注釈。

注釈の例では次のことが説明されています。

完全なサンプルコード:

@Controller
@RequestMapping("/admin/org/deparment/")
@MethodChinaName(cname = "部门管理", imageClass = "bpmfont bpmgongzuoliuzuhuzicaidan")
@Aggregation(sourceClass = IDeparmentService.class, rootClass = Org.class)
public interface IDeparmentAPI {
    @RequestMapping(method = RequestMethod.POST, value = "Persons")
    @GridViewAnnotation()
    @ModuleAnnotation(caption = "人员列表")
    @APIEventAnnotation(bindMenu = {CustomMenuItem.treeNodeEditor})
    @ResponseBody
    public <K extends IPersonGrid> ListResultModel<List<K>> getPersons(String orgId);

    @RequestMapping(method = RequestMethod.POST, value = "loadChild")
    @APIEventAnnotation(bindMenu = {CustomMenuItem.loadChild})
    @ResponseBody
    public <T extends IDeparmentTree> ListResultModel<List<T>> loadChild(String parentId);


    @MethodChinaName(cname = "部门信息")
    @RequestMapping(method = RequestMethod.POST, value = "DeparmentInfo")
    @NavGroupViewAnnotation(saveUrl = "admin.org.deparment.saveOrg")
    @DialogAnnotation
    @ModuleAnnotation(caption = "编辑部门信息", width = "600", height = "480")
    @APIEventAnnotation(callback = {CustomCallBack.ReloadParent, CustomCallBack.Close}, bindMenu = {CustomMenuItem.editor})
    @ResponseBody
    public <K extends IDeparmentNav> ResultModel<K> getDeparmentInfo(String orgId);

    @MethodChinaName(cname = "添加部门")
    @RequestMapping(method = RequestMethod.POST, value = "addDeparment")
    @FormViewAnnotation()
    @DialogAnnotation
    @ModuleAnnotation(caption = "添加部门", width = "350", height = "260")
    @APIEventAnnotation(bindMenu = {CustomMenuItem.add}, autoRun = true)
    @ResponseBody
    public <M extends IAddDeparmentForm> ResultModel<M> addDeparment(String parentId);

    @MethodChinaName(cname = "保存机构信息")
    @RequestMapping(value = {"saveOrg"}, method = {RequestMethod.GET, RequestMethod.POST})
    @APIEventAnnotation(callback = {CustomCallBack.ReloadParent, CustomCallBack.Close}, bindMenu = {CustomMenuItem.save})
    public @ResponseBody
    ResultModel<Boolean> saveOrg(@RequestBody IAddDeparmentForm deparmentForm);

    @MethodChinaName(cname = "删除部门")
    @RequestMapping(value = {"delOrg"}, method = {RequestMethod.GET, RequestMethod.POST})
    @APIEventAnnotation(callback = {CustomCallBack.Reload, CustomCallBack.ReloadParent}, bindMenu = {CustomMenuItem.delete})
    public @ResponseBody
    ResultModel<Boolean> delOrg(String orgId);

    ;
}

(3) アグリゲーション構成

モデリング構成

インターフェース構成

フォーム構成

イベント配信を実行する

(4) 集計分類

(5) 集約ルート

通常、独立したドメイン アプリケーションを識別するための集約ルート設計には、グローバルな一意性の特性があります。一般的な領域では、ワークフロー内のプロセス インスタンス (ProcessInst) オブジェクトなど、時間軸の次元を持つオブジェクトの説明。集約ルートを取得した後は、時間軸に従って一度前方にプロセス定義オブジェクトを取得し、後方にプロセスの履歴データを取得し、権限、データフォーム、業務例のステータスなどのエンティティデータを取得できます。現在のノード。

集約ルート構成のプロセス例

プロセスインスタンス集約のソースコード

@Entity
@MethodChinaName(cname = "流程实例")
@Aggregation(type = AggregationType.aggregationRoot, sourceClass = ProcessInst.class, rootClass = ProcessInst.class)
public interface ProcessInst extends java.io.Serializable {
    @MethodChinaName(cname = "流程实例UUID")
    @Uid
    public String getProcessInstId();

    @MethodChinaName(cname = "流程定义UUID")
    @Pid
    public String getProcessDefId();

   
    @MethodChinaName(cname = "流程定义版本UUID")
    @Pid
    public String getProcessDefVersionId();


    @MethodChinaName(cname = "流程实例名称")
    public String getName();

  
    @MethodChinaName(cname = "紧急程度")
    public String getUrgency();

  
    @MethodChinaName(cname = "流程实例状态")
    public ProcessInstStatus getState();

 
    @MethodChinaName(cname = "流程实例副本数量")
    public int getCopyNumber();

    
    @MethodChinaName(cname = "程实例启动时间")
    public Date getStartTime();

   
    @MethodChinaName(cname = "流程实例办结时间")
    public Date getEndTime();


    @MethodChinaName(cname = " 流程实例时间限制")
    public Date getLimitTime();

 
    @MethodChinaName(cname = "流程实例状态")
    public ProcessInstStatus getRunStatus();

    @MethodChinaName(cname = "流程定义版本")
    @Ref(ref = RefType.m2o, view = ViewType.grid)
    public ProcessDefVersion getProcessDefVersion() throws BPMException;

    
    @MethodChinaName(cname = "流程定义")
    @Ref(ref = RefType.m2o, view = ViewType.dic)
    public ProcessDef getProcessDef() throws BPMException;

    
    @MethodChinaName(cname = "活动实例")
    @Ref(ref = RefType.o2m, view = ViewType.grid)
    public List<ActivityInst> getActivityInstList() throws BPMException;

    
    @MethodChinaName(cname = "流程属性值", returnStr = "getWorkflowAttribute($R('attName'))", display = false)
    public Object getWorkflowAttribute(ProcessInstAtt name);

  
    @MethodChinaName(cname = "权限属性值", returnStr = "getRightAttribute($R('attName'))", display = false)
    public Object getRightAttribute(ProcessInstAtt name);

    
    @MethodChinaName(cname = "应用属性值", returnStr = "getAppAttribute($R('attName'))", display = false)
    public Object getAppAttribute(ProcessInstAtt name);

  
    @MethodChinaName(cname = "定制属性值", returnStr = "getAttribute($R('attName'))", display = false)
    public String getAttribute(String name);


    
    @MethodChinaName(cname = "取得流程中的所有属性值", returnStr = "getAllAttribute()", display = false)
    @Ref(ref = RefType.o2m, view = ViewType.grid)
    public List<AttributeInst> getAllAttribute();


    @MethodChinaName(cname = "个人定制属性值", returnStr = "getAttribute($R('personId'),$R('attName'))", display = true)
    public String getPersonAttribute(String personId, String name);

  
    @MethodChinaName(cname = "设置定制属性", returnStr = "setAttribute($R('attName'),$R('value'))", display = false)
    public void setAttribute(String name, String value) throws BPMException;


      @MethodChinaName(cname = "设置个人定制属性", returnStr = "setAttribute($R('personId'),$R('attName'),$R('value'))", display = false)
    public void setPersonAttribute(String personId, String name, String value) throws BPMException;


    
    @MethodChinaName(cname = "更新流程实例名称(公文标题)", returnStr = "updateProcessInstUrgency($R('processInstName'))")
    public ReturnType updateProcessInstName(String name)
            throws BPMException;

    @MethodChinaName(cname = "更新流程实例紧急程度", returnStr = "updateProcessInstUrgency($R('urgency'))")
    public ReturnType updateProcessInstUrgency(
            String urgency) throws BPMException;

    
    @MethodChinaName(cname = "流程实例挂起", returnStr = "suspendProcessInst()", display = false)
    public ReturnType suspendProcessInst()
            throws BPMException;


    @MethodChinaName(cname = "继续流程实例", returnStr = "resumeProcessInst()", display = false)
    public ReturnType resumeProcessInst()
            throws BPMException;

   
    @MethodChinaName(cname = "取得活动的历史数据, 根据流程实例")
    public List<ActivityInstHistory> getActivityInstHistoryListByProcessInst() throws BPMException;


    
    @MethodChinaName(cname = "中止流程实例", returnStr = "abortProcessInst()", display = false)
    public ReturnType abortProcessInst()
            throws BPMException;

  
    @MethodChinaName(cname = "流程实例完成", returnStr = "completeProcessInst()", display = false)
    public ReturnType completeProcessInst()
            throws BPMException;

    
    @MethodChinaName(cname = "删除流程实例", returnStr = "deleteProcessInst()", display = false)
    public ReturnType deleteProcessInst()
            throws BPMException;


    
    @MethodChinaName(cname = "获取表单数据")
    public DataMap getFormValues() throws BPMException;


   
    @MethodChinaName(cname = "更新表单数据")
    public void updateFormValues(DataMap dataMap) throws BPMException;

}

(6) 集合体エンティティ

集約エンティティは通常、ビジネス フォーム内の単一テーブルや単純な関連付けテーブルなどの独立したエンティティを記述するために使用されます。通常、これには単純な値の関係のみが含まれており、その機能はリストのクエリやフォームの保存などの単純なアプリケーションに限定されています。

単一のテーブルフォーム

コード例

@Controller
@RequestMapping("/test/fdtlingdaoservice/")
@Aggregation(type=AggregationType.aggregationEntity,sourceClass=FdtLingdaoService.class)
public interface FdtLingdaoAPI  {
     @APIEventAnnotation(bindMenu=CustomMenuItem.search)
     @RequestMapping(value="searchUrl")
     @ModuleAnnotation
     @GridViewAnnotation
     @ResponseBody
     public   ListResultModel<List<FindGridView>> find (FdtLingdao fdtLingdao);
    
     @APIEventAnnotation(bindMenu={CustomMenuItem.add,CustomMenuItem.editor})
     @RequestMapping(value="addPath")
     @ModuleAnnotation
     @FormViewAnnotation
     @ResponseBody
     public   ResultModel<GetFdtLingdaoInfoView> getFdtLingdaoInfo (String uuid);
    
     @APIEventAnnotation(bindMenu=CustomMenuItem.save,callback={CustomCallBack.ReloadParent,CustomCallBack.Close})
     @RequestMapping(value="update")
     @ResponseBody
     public   ResultModel<FdtLingdao> update (@RequestBody FdtLingdao fdtLingdao);
    
     @RequestMapping(value="findByWhere")
     @ResponseBody
     public   ListResultModel<List<FdtLingdao>> findByWhere (String where);
    
     @APIEventAnnotation(bindMenu=CustomMenuItem.delete,callback=CustomCallBack.Reload)
     @RequestMapping(value="delete")
     @ResponseBody
     public   ResultModel<Boolean> delete (String uuid);
    
     @APIEventAnnotation(bindMenu=CustomMenuItem.reload)
     @RequestMapping(value="dataUrl")
     @ModuleAnnotation
     @GridViewAnnotation
     @ResponseBody
     public   ListResultModel<List<FindAllGridView>> findAll ();
    

   


}

(6) アクションメニュー

アクション メニューは DDD モデルでは定義されていませんが、ローコード アプリケーションでは重要な役割を果たします。

アクション メニューのモデリングでは、主にメニュー表示と関連するアクションが組み合わされます。

ワークフロー送信メニューのモデリング

メニューの配置

エディタの右クリックメニュー

共通メニューの注意事項

注釈 位置
@ToolBarMenu コンテナ上部のツールバー @ToolBarMenu(hAlign = HAlignType.left、ハンドラー = false、menuClass = JavaRepositoryEditorTools.class)
@MenuBarMenu トップメニューバー @MenuBarMenu(menuType = CustomMenuType.sub、caption = "新建"、imageClass = "xuicon xui-uicmd-add"、index = 5)
@BottomBarMenu コンテナ下部のボタンバー @BottomBarMenu(menuClass = CustomBuildAction.class)
@PageBar ページバー @PageBar(ページ数 = 100)
@GridRowCmd リスト行アクションボタンバー @GridRowCmd(tagCmdsAlign = TagCmdsAlign.left、menuClass = {AttachMentService.class})
@RightContextMenu メニューバーを右クリック @RightContextMenu(menuClass = JavaViewPackageMenu.class)
@Controller
@RequestMapping(value = {"/java/agg/context/"})
@MenuBarMenu(menuType = CustomMenuType.component, caption = "菜单")
@Aggregation(type = AggregationType.menu)
public class JavaAggPackageMenu {

    @RequestMapping(method = RequestMethod.POST, value = "paste")
    @CustomAnnotation(imageClass = "spafont spa-icon-paste", index = 1, caption = "粘贴")
    @APIEventAnnotation(customRequestData = {RequestPathEnum.treeview, RequestPathEnum.sTagVar}, callback = CustomCallBack.TreeReloadNode)
    public @ResponseBody
    TreeListResultModel<List<JavaAggTree>> paste(String sfilePath, String packageName, String domainId, String projectName) {
        TreeListResultModel<List<JavaAggTree>> result = new TreeListResultModel<List<JavaAggTree>>();
        try {
            DSMFactory dsmFactory = DSMFactory.getInstance();
            File desFile = new File(sfilePath);
            DomainInst domainInst = dsmFactory.getAggregationManager().getDomainInstById(domainId);
            JavaSrcBean srcBean = dsmFactory.getTempManager().genJavaSrc(desFile, domainInst, null);
            DSMFactory.getInstance().getBuildFactory().copy(srcBean, packageName);
            result.setIds(Arrays.asList(new String[]{domainId + "|" + packageName}));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }

    @RequestMapping(method = RequestMethod.POST, value = "reLoad")
    @CustomAnnotation(imageClass = "xuicon xui-refresh", index = 1, caption = "刷新")
    @APIEventAnnotation(customRequestData = RequestPathEnum.treeview, callback = CustomCallBack.TreeReloadNode)
    public @ResponseBody
    TreeListResultModel<List<JavaAggTree>> reLoad(String packageName, String domainId, String filePath) {
        TreeListResultModel<List<JavaAggTree>> result = new TreeListResultModel<List<JavaAggTree>>();
        String id = domainId + "|" + packageName;
        result.setIds(Arrays.asList(new String[]{id}));
        return result;
    }


    @RequestMapping(value = {"split"})
    @Split
    @CustomAnnotation(index = 2)
    @ResponseBody
    public ResultModel<Boolean> split2() {
        ResultModel<Boolean> result = new ResultModel<Boolean>();
        return result;
    }

    @RequestMapping(value = "UploadFile")
    @APIEventAnnotation(autoRun = true)
    @DialogAnnotation(width = "450", height = "380", caption = "上传JAVA文件")
    @ModuleAnnotation
    @FormViewAnnotation
    @CustomAnnotation(caption = "上传", index = 3, imageClass = "xui-icon-upload", tips = "上传")
    public @ResponseBody
    ResultModel<UPLoadFile> uploadFile(String domainId, String packageName) {
        ResultModel<UPLoadFile> resultModel = new ResultModel<UPLoadFile>();
        try {
            UPLoadFile upLoadFile = new UPLoadFile(domainId, packageName);
            resultModel.setData(upLoadFile);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return resultModel;
    }


    @RequestMapping(value = {"split"})
    @Split
    @CustomAnnotation(index = 4)
    @ResponseBody
    public ResultModel<Boolean> split6() {
        ResultModel<Boolean> result = new ResultModel<Boolean>();
        return result;
    }


    @RequestMapping(method = RequestMethod.POST, value = "newApp")
    @CustomAnnotation(imageClass = "xuicon xui-uicmd-add", index = 5)
    @MenuBarMenu(menuType = CustomMenuType.sub, caption = "新建", imageClass = "xuicon xui-uicmd-add", index = 5)
    public JavaAggNewMenu getJavaJarAction() {
        return new JavaAggNewMenu();
    }


    @RequestMapping(method = RequestMethod.POST, value = "importAgg")
    @CustomAnnotation(imageClass = "xuicon xui-uicmd-add", index = 6)
    @MenuBarMenu(menuType = CustomMenuType.sub, caption = "导入", imageClass = "spafont spa-icon-html", index = 5)
    public JavaAggImportMenu importAgg() {
        return new JavaAggImportMenu();
    }

    @RequestMapping(value = {"split"})
    @Split
    @CustomAnnotation(index = 7)
    @ResponseBody
    public ResultModel<Boolean> split7() {
        ResultModel<Boolean> result = new ResultModel<Boolean>();
        return result;
    }


    @MethodChinaName(cname = "删除")
    @RequestMapping(method = RequestMethod.POST, value = "delete")
    @CustomAnnotation(imageClass = "xuicon xui-icon-minus", index = 8)
    @APIEventAnnotation(customRequestData = RequestPathEnum.treeview, callback = CustomCallBack.TreeReloadNode)
    public @ResponseBody
    TreeListResultModel<List<JavaAggTree>> delete(String domainId, String parentId, String filePath, String javaTempId) {
        TreeListResultModel<List<JavaAggTree>> result = new TreeListResultModel<List<JavaAggTree>>();
        try {
            File desFile = new File(filePath);
            DSMFactory dsmFactory = DSMFactory.getInstance();
            DomainInst domainInst = dsmFactory.getAggregationManager().getDomainInstById(domainId);
            if (desFile.exists()) {
                if (desFile.isDirectory()) {
                    JavaPackage javaPackage = domainInst.getPackageByFile(desFile);
                    dsmFactory.getTempManager().deleteJavaPackage(javaPackage);
                } else {
                    JavaSrcBean srcBean = dsmFactory.getTempManager().genJavaSrc(desFile, domainInst, javaTempId);
                    dsmFactory.getTempManager().deleteJavaFile(srcBean);
                }
            }

            result.setIds(Arrays.asList(new String[]{parentId}));

        } catch (JDSException e) {
            e.printStackTrace();
        }

        return result;
    }


    public ESDChrome getCurrChromeDriver() {
        Object handleId = JDSActionContext.getActionContext().getParams("handleId");
        ChromeDriver chrome = null;
        if (handleId != null) {
            chrome = ESDEditor.getInstance().getChromeDriverById(handleId.toString());
        }
        if (chrome == null) {
            chrome = ESDEditor.getInstance().getCurrChromeDriver();
        }
        return new ESDChrome(chrome);
    }


}

(7)通用域

通用域将系统中常用服务进行了独立分类可以在工程构建时导入进来。

通用域管理

(8)API服务接口

api服务接口是手工代码接入的域服务,在普通java类上加上聚和接口后会统一归类到该类型管理。

(9)领域模型常用注解

注解名称 用途 实例
@RequestMapping 直接使用的SpringMvc注解用于将当前方法标识为,web可访问 @RequestMapping(value = {"AggAPITree"}, method = {RequestMethod.GET, RequestMethod.POST})
@ModuleAnnotation 视图标识,在方法上标识改注解后会被模型编译器识别为视图模型将其内部对象渲染为视图。 @ModuleAnnotation(dynLoad = true, imageClass = "spafont spa-icon-moveforward", caption = "模块授权")
@ResponseBody 直接使用的SpringMvc注解,标识为JSON数据返回 @ResponseBody
@DialogAnnotation 添加该标识时,当前端路由到当前方法时,以独立窗口的方式返回 @DialogAnnotation(width = "850", height = "750")
@Aggregation 领域标识,在类注解中添加该标识,会被DSM引擎自动索引并根据注解中指定类型加载到相关的实体列表中 @Aggregation(type = AggregationType.customDomain,
sourceClass = PersonService.class,
rootClass = Person.class)
@*Domain 通用域标识 @OrgDomain
@BpmDomain
@VfsDomain
@MsgDomain
@NavDomain
@*TreeView 树形注解包括了,导航树、弹出字典树,折叠分组树等注解集合 @TreeViewAnnotation
@NavTreeViewAnnotation
@NavFoldingTreeViewAnnotation
@PopTreeViewAnnotation
@GridViewAnnotation 数据列表注解
@GalleryView*Annotation 详情图形混合注解 @GalleryViewAnnotation
@NavGalleryViewAnnotation
@*TabsViewAnnotation Tab切换页 @TabsViewAnnotation
@NavTabsViewAnnotation
@NavFoldingTabsViewAnnotation
@PopMenuViewAnnotation 菜单导航 @PopMenuViewAnnotation
@NavGroupViewAnnotation 分组表单 @NavGroupViewAnnotation
@FormViewAnnotation 表单注解 @FormViewAnnotation
@*ButtonViewsViewAnnotation 按钮栏视图 @ButtonViewsAnnotation
@NavButtonViewsAnnotation

五,后续章节内容介绍

在下一章节中,我们将重点介绍,OneCode视图工厂以及,模块组装,权限设定、菜单应用等相关工具使用。

章节预览:

(1)视图工厂组成

视图工厂,最终面向用户的展现方式,在建模中通常会有相关的服务通过聚合实体与关系完成初步的视图构建。

工場構成を見る

(2) 設計目的

ドメイン ファクトリでは、より貧血な基本エンティティ オブジェクトが集約および並べ替えられて、ビジネスの理解と運用に役立つ充血モデルが形成されます。また、その低結合アプリケーションは、インターフェイス モデルの注釈を拡張することによって実現されます。このスタイルの設計はビュー ファクトリでも引き続き継続され、通常の単一コンポーネントが渡され、バックエンド JAVA コードの集合体によって共通の関数と補助コンポーネントがカプセル化され、独立したビュー コンポーネントが形成されます。

(3) リストビュー

共通リスト関数

共通構成

リスト情報の構成

おすすめ

転載: blog.csdn.net/wenzhangli/article/details/130519559