入門記7:BuriEditorを使ってみる。

先日のぶり祭りで発表されたBuriEditorことescafeFlowEditorことBuriEditor。

これでBuriを動かしてみました。


入門記1で作った文書管理プロセスのフローを、そのままBuriEditorでもう一度書きます。名前を被らせないよう、パッケージの名前は「文書管理パッケージ3」としておきます。

Before

After

あとは、src/main/resources配下のburi.dicon.buri-user.diconに以下を追加。

<component name="BuriEngineConfig" class="org.escafe.buri.engine.impl.BuriEngineConfigImpl">
	<!--// 以下を追加 //-->
	<initMethod name="addResourceConfig">
		<arg>"editor_docmanage.xpdl"</arg>
		<arg>"文書管理パッケージ3"</arg>
	</initMethod>
</component>

Baoは使いません(めんどくさいからw)。また、DaoもDtoも使いまわせる筈なので、以前のままにします。


起動する為のJUnitですが、入門記1で作ったもののパッケージ名だけを変えればOKです。

public class BuriEditorTest extends S2TestCase {

	private static final String DICON_PATH = "app.dicon";

	@Override
	protected void setUp() throws Exception {
		super.setUp();
		super.include(DICON_PATH);
	}
	@SuppressWarnings("unchecked")
	public void testTx() {
		BuriAutoSelectProcessor processor = (BuriAutoSelectProcessor) super.getComponent(BuriAutoSelectProcessor.class);

		DocumentDto doc1 = new DocumentDto("文書A", "文書Aです。");
		DocumentDto doc2 = new DocumentDto("文書B", "文書Bです。");
		DocumentDto doc3 = new DocumentDto("文書C", "文書Cです。");
		// 1st
		processor.toNextStatus("文書管理パッケージ3.文書管理プロセス.登録", doc1, null);
		System.out.println(processor.getDataListFromPath("文書管理パッケージ3.文書管理プロセス.公開中", doc1, DocumentDto.class).size());
		List<DocumentDto> list = processor.getDataListFromPath("文書管理パッケージ3.文書管理プロセス.公開中", doc1, DocumentDto.class);
		for (DocumentDto dto: list) {
			System.out.println(dto);
		}
		assertEquals(1, processor.getDataListFromPath("文書管理パッケージ3.文書管理プロセス.公開中", doc1, DocumentDto.class).size());
		// 2nd
		processor.toNextStatus("文書管理パッケージ3.文書管理プロセス.登録", doc2, null);
		processor.toNextStatus("文書管理パッケージ3.文書管理プロセス.登録", doc3, null);
		assertEquals(3, processor.getDataListFromPath("文書管理パッケージ3.文書管理プロセス.公開中", doc2, DocumentDto.class).size());
		// 3rd
		processor.toNextStatus("文書管理パッケージ3.文書管理プロセス.公開中", doc1, null);
		assertEquals(2, processor.getDataListFromPath("文書管理パッケージ3.文書管理プロセス.公開中", doc1, DocumentDto.class).size());
		// 4th
		processor.toNextStatus("文書管理パッケージ3.文書管理プロセス.公開中", doc2, null);
		processor.toNextStatus("文書管理パッケージ3.文書管理プロセス.公開中", doc3, null);
		assertEquals(0, processor.getDataListFromPath("文書管理パッケージ3.文書管理プロセス.公開中", doc1, DocumentDto.class).size());
	}

}


では、実行。

java.lang.NullPointerException
at org.escafe.buri.oouo.internal.structure.BuriActivityType.getParticipantName(BuriActivityType.java:59)
at org.escafe.buri.util.packages.abst.AbstBuriExecProcess.entryActivity(AbstBuriExecProcess.java:95)

うはー><


で、id:nobeansの人にgetParticipantNameって何してんの?と聞いたところ、アクターの名前取りに行ってるんじゃない?なんて答えが。BuriEditorで吐かせたXPDLと以前JPEdで作ったのを比べるとDtoの宣言がないくらいで、他は大きな違いはないように見えます。

しかし一か所劇的な違いが!

BuriEditorで書かれたXPDLのアクターを宣言してると思われる個所。
  <Participants>
    <Participant Id="null_par1" Name="文書管理担当">
      <ParticipantType Type="ROLE"/>
    </Participant>
  </Participants>

そのアクターに置かれたアクティビティを定義していると思われる個所。
    <Activity Id="newpkg_wp1_act2" Name="登録">
      <Implementation>
        <No/>
      </Implementation>
      <Performer>newpkg_wp1_par1</Performer>
      <FinishMode>
        <Automatic/>
      </FinishMode>
      <ExtendedAttributes>
        <ExtendedAttribute Name="JaWE_GRAPH_PARTICIPANT_ID" Value="newpkg_wp1_par1"/>
        <ExtendedAttribute Name="JaWE_GRAPH_OFFSET" Value="94,182"/>
        <ExtendedAttribute Name="BURI_GRAPH_RECTANGLE" Value="94,182,124,104"/>
      </ExtendedAttributes>
    </Activity>


JPEdで書かれたXPDLのアクターを宣言してると思われる個所。
    <Participants>
        <Participant Id="newpkg_wp1_par1" Name="文書管理担当">
            <ParticipantType Type="ROLE"/>
        </Participant>
    </Participants>

そのアクターに置かれたアクティビティを定義していると思われる個所。
    <Activity Id="newpkg_wp1_act1" Name="登録">
        <Implementation>
            <No/>
        </Implementation>
        <Performer>newpkg_wp1_par1</Performer>
        <StartMode>
            <Automatic/>
        </StartMode>
        <FinishMode>
            <Automatic/>
        </FinishMode>
        <ExtendedAttributes>
            <ExtendedAttribute Name="JaWE_GRAPH_PARTICIPANT_ID" Value="newpkg_wp1_par1"/>
            <ExtendedAttribute Name="JaWE_GRAPH_OFFSET" Value="214,55"/>
        </ExtendedAttributes>
    </Activity>

アクターのIDが違う><
XPDLをテキストで開いて、「」という部分だけ直してあげるときれいに動きました。


なので、BuriEditorでフローを書く際は、必ずアクターのIDも一緒に変えて上げないといけません。


・・・BuriEditorでは、アクティビティにアクターのIDを操作する箇所がないにも関わらず(プルダウンでアクターの名前を選べるんですが、IDを指定する処がない、という事ですね)、上記のようにすでにアクターのIDが付与されているので、これはバグ報告って事になるのかな?w(違ってたらゴメンナサイ><


(追記)BuriEditorで書いたフローを追記。