我在注册表中配置了以下自定义生命周期。状态和转换如下所示:
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,我可以使用它将生命周期附加到工件。=> 你不能设置 Lifecycle-State * "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);