Source:
private AbstractChangePackage resolveChangePackageProxy( final Optional<SessionId> maybeSession, final ChangePackageProxy changePackageProxy) throws ESException { if (!maybeSession.isPresent()) { throw new ESException( Messages.EMFStoreImpl_NoValidSessiondIdFound); } final ESSessionId resolvedSession = getAccessControl().getSessions().resolveSessionById( maybeSession.get().getId()); final SessionId sessionId = APIUtil.toInternal(SessionId.class, resolvedSession); final Optional<ChangePackageFragmentUploadAdapter> maybeAdapter = ESCollections.find(sessionId.eAdapters(), ChangePackageFragmentUploadAdapter.class); if (!maybeAdapter.isPresent()) { throw new ESException( Messages.EMFStoreImpl_NoFragmentAdapterFound); } final ChangePackageFragmentUploadAdapter adapter = maybeAdapter.get(); AbstractChangePackage changePackage; if (ServerConfiguration.useFileBasedChangePackageOnServer()) { final Optional<FileBasedChangePackage> fileBasedChangePackage = adapter .getFileBasedChangePackage(changePackageProxy.getId()); if (!fileBasedChangePackage.isPresent()) { throw new ESException( Messages.EMFStoreImpl_NoCompletedChangePackageFound); } changePackage = fileBasedChangePackage.get(); } else { final Optional<ChangePackage> maybeCompletedChangePackage = adapter .getCompletedChangePackage(changePackageProxy.getId()); if (!maybeCompletedChangePackage.isPresent()) { throw new ESException( Messages.EMFStoreImpl_NoCompletedChangePackageFound); } changePackage = maybeCompletedChangePackage.get(); } adapter.clearCompleted(changePackageProxy.getId()); changePackage.setLogMessage( ModelUtil.clone(changePackageProxy.getLogMessage())); return changePackage; }

Target:
private AbstractChangePackage resolveChangePackageProxy( final Optional<SessionId> maybeSession, final ChangePackageProxy changePackageProxy) throws ESException { if (!maybeSession.isPresent()) { throw new ESException( Messages.EMFStoreImpl_NoValidSessiondIdFound); } final ESSessionId resolvedSession = getAccessControl().getSessions().resolveSessionById( maybeSession.get().getId()); final SessionId sessionId = APIUtil.toInternal(SessionId.class, resolvedSession); final Optional<ChangePackageFragmentUploadAdapter> maybeAdapter = ESCollections.find(sessionId.eAdapters(), ChangePackageFragmentUploadAdapter.class); if (!maybeAdapter.isPresent()) { throw new ESException( Messages.EMFStoreImpl_NoFragmentAdapterFound); } final ChangePackageFragmentUploadAdapter adapter = maybeAdapter.get(); AbstractChangePackage changePackage; if (ServerConfiguration.useFileBasedChangePackageOnServer()) { final Optional<FileBasedChangePackage> fileBasedChangePackage = adapter .getFileBasedChangePackage(changePackageProxy.getId()); if (!fileBasedChangePackage.isPresent()) { throw new ESException( Messages.EMFStoreImpl_NoCompletedChangePackageFound); } changePackage = fileBasedChangePackage.get(); } else { final Optional<ChangePackage> maybeCompletedChangePackage = adapter .convertFileBasedToInMemoryChangePackage(changePackageProxy.getId()); if (!maybeCompletedChangePackage.isPresent()) { throw new ESException( Messages.EMFStoreImpl_NoCompletedChangePackageFound); } changePackage = maybeCompletedChangePackage.get(); } adapter.clearCompleted(changePackageProxy.getId()); changePackage.setLogMessage( ModelUtil.clone(changePackageProxy.getLogMessage())); return changePackage; }