Hello dear Community,
I never used the revisions per API, but now I try to "rebuild" the history function in the WebEdit. I now how I can get the revisions for different objects, but when I like to restore a deleted element I get sometimes the information that my revision is archived.
Everything is fine with this information, but I can't find a method to check if my object or revision is archived...
I know the following pice of code is very bad, but currently I just try to understand the API.
element = context.getStoreElement();
StoreAgent storeAgent = context.requestSpecialist(StoreAgent.TYPE);
BrokerAgent brokerAgent = context.requireSpecialist(BrokerAgent.TYPE);
PageStoreRoot pageStore = (PageStoreRoot) storeAgent.getStore(Type.PAGESTORE);
context.logInfo("MyElement: " + element);
context.logInfo("Revision : " + element.getRevision().getId());
List deletedElements = pageStore.getDeletedChildren(element.getRevision().getId(), 0);
for (DeletedElementsInfo deletedElementsInfo : deletedElements) {
context.logInfo("deletedElementsInfo: " + deletedElementsInfo);
for(ElementInfo info : deletedElementsInfo.getDeletedElements()) {
if(info.getNodeTag().equals("SECTION") == false) {
context.logInfo("info: " + info);
context.logInfo("uid: " + info.getUid());
context.logInfo("storetype: " + info.getStoreType());
rev = context.getProject().getRevision(info.getRevisionId() - 1);
context.logInfo("try to get broker at rev.: " + (info.getRevisionId() - 1));
SpecialistsBroker broker = brokerAgent.getBroker(info.getRevisionId() - 1);
StoreElementAgent revisionElementAgent = broker.requestSpecialist(StoreElementAgent.TYPE);
IDProvider elem = revisionElementAgent.loadStoreElement(info.getUid(), Page.UID_TYPE, false); // Exception
context.logInfo("" + elem);
}
}
}
I get the following exception at the marked line.
ElementNotFoundException: Element with id 65 not found for revision 20204 (initial=20204) (current) pagestore), revision 20204 is archived!
Kind regards
Benjamin