Пример #1
0
 private PDocument getPDocument(DocumentName documentName, Long key) {
   try {
     MDSInstance instance = storeInitializer.getMDSInstance();
     MDSSession session = createSession(instance);
     PManager pManager = instance.getPersistenceManager();
     PContext pContext = session.getPContext();
     if (key > 0) {
       return pManager.getVersionSupport().getDocument(pContext, documentName, key);
     } else {
       return pManager.getDocument(pContext, documentName);
     }
   } catch (MDSAccessException e) {
     throw new IllegalArgumentException("Could not read ", e);
   }
 }
Пример #2
0
  private MDSSession createSession(MDSInstance instance) {
    SessionOptions sessionOptions =
        new SessionOptions(
            IsolationLevel.READ_COMMITTED, Locale.getDefault(), CustConfig.NO_CUSTOMIZATIONS);
    UserStateHandler userStateHandler =
        new UserStateHandler() {
          public Object getAttribute(String string) {
            return null;
          }

          public void setAttribute(String string, Object object) {}
        };
    return instance.createSession(sessionOptions, userStateHandler);
  }