我曾经InternalProfileFormHandler
添加一个项目InternalProfileRepository
。它已成功将项目(用户:iuser310002)添加到预期的存储库。添加后,我已访问 dyn/admin 以打开存储库并删除了我刚刚使用<remove-item item-descriptor="user" id="iuser310002" />
. 然后我再次使用调用的 InternalProfileFormHandler 来添加一项。不过这一次,我atg.repository.RemovedItemException
有话说Attempt to use an item which has been removed: user:iuser310002.
我不确定它为什么要尝试创建一个与以前具有相同 id 的新用户,即使我这样做了,为什么删除的项目会导致此问题。我正在/atg/dynamo/service/IdGenerator
为 InternalProfileRepository 使用默认的 idGenerator,所以我认为我不会生成相同的 id。
这是一次成功创建项目并从第二次失败的代码...
FormHandlerInvoker invoker = new FormHandlerInvoker("/atg/userprofiling/InternalProfileFormHandler", Nucleus.getSystemNucleus());
try {
String paramName;
int paramCounter = 1;
while((paramName = (String) getCurrentTestParams().get("param" + paramCounter)) != null)
{
invoker.addInput(paramName, (String) getCurrentTestParams().get("value" + paramCounter));
paramCounter++;
}
} catch (ServletException e) {
e.printStackTrace();
}
FormHandlerInvocationResult result;
ProfileFormHandler formHandler = null;
try {
result = invoker.invoke();
formHandler =
(ProfileFormHandler)result.getDefaultFormHandler();
formHandler.handleCreate(result.getRequest(), result.getResponse());
}
以下是异常日志......这是由 formHandler.handleCreate 方法调用引起的。
atg.repository.RemovedItemException: Attempt to use an item which has been removed: user:iuser310002
at atg.adapter.gsa.ItemTransactionState.<init>(ItemTransactionState.java:385)
at atg.adapter.gsa.GSAItem.getItemTransactionState(GSAItem.java:2421)
at atg.adapter.gsa.GSAItem.getItemTransactionState(GSAItem.java:2364)
at atg.adapter.gsa.GSAItem.getItemTransactionStateUnchecked(GSAItem.java:2600)
at atg.adapter.gsa.GSAItem.getPropertyValue(GSAItem.java:1511)
at atg.repository.RepositoryItemImpl.getPropertyValue(RepositoryItemImpl.java:151)
at atg.adapter.composite.CompositeItem.createPropertyQuery(CompositeItem.java:739)
at atg.adapter.composite.CompositeItem.getPropertyLinkedItem(CompositeItem.java:630)
at atg.adapter.composite.CompositeItem.getContributingItem(CompositeItem.java:577)
at atg.adapter.composite.CompositeItem.findContributingItem(CompositeItem.java:561)
at atg.adapter.composite.MutableCompositeItem.findContributingItem(MutableCompositeItem.java:971)
at atg.adapter.composite.MutableCompositeItem.getOrCreateContributingItem(MutableCompositeItem.java:985)
at atg.adapter.composite.MutableCompositeItem.setPropertyValue(MutableCompositeItem.java:210)
at atg.userprofiling.ProfileForm.updateProfileAttributes(ProfileForm.java:3761)
at atg.userprofiling.ProfileForm.updateProfileAttributes(ProfileForm.java:3528)
at atg.userprofiling.ProfileForm.createUser(ProfileForm.java:1507)
at atg.userprofiling.ProfileForm.handleCreate(ProfileForm.java:1214)
at atg.userprofiling.ProfileFormHandler.handleCreate(ProfileFormHandler.java:402)
at atg.scenario.userprofiling.ScenarioProfileFormHandler.handleCreate(ScenarioProfileFormHandler.java:599)
at atg.test.steps.CreateInternalUserStep.runTest(CreateInternalUserStep.java:45)