2012-10-27 24 views
2

我在註冊表中配置了以下自定義生命週期。狀態和轉換如下所示:WSO2治理註冊表:通過API設置生命週期狀態?

in.design (initial) 
    -> in.development 
    -> in.production 
    -> in.text 
in.development 
    -> in.test 
in.test 
    -> released 
released 
    -> in.production 
in.production 
    -> deprecated 
deprecated 
    -> retired (end) 

用例: 批次和解爲僞像,這是在不同的系統主動管理。

問題: 我需要通過API爲某些工件設置「in.production」狀態。

我看了下面的可能性; * GenericArtifact API,我可以將生命週期附加到工件上。 =>您無法設置生命週期狀態 *「CustomLifecyclesChecklistAdminService」,但它是一個內部API並且是UI驅動的。看起來很難編程。

所以問題是: 有沒有辦法將工件的生命週期狀態設置爲不是最初狀態的狀態?

我自己的答案(有沒有更好的解決辦法嗎?):

// When "simulating" the behaviour of the UI, the following works. It feels a little awkward and looks brittle to me. Found out how to use it via debugger. 
CustomLifecyclesChecklistAdminServiceStub clc = ... 
// these are representing the check boxes in the UI 
String[] params = { "false", "true", "false" };   
clc.invokeAspect(path, lifecycleName, "to.production", params); 

回答

0

目前 'CustomLifecyclesChecklistAdminService' 是做到這一點的方式。但是,在未來的版本中,狀態轉換功能將被引入到治理API [1]中。這將提供更清潔的方法。

[1] https://wso2.org/jira/browse/REGISTRY-837