import org.argeo.api.acr.spi.ProvidedRepository;
import org.argeo.api.cms.CmsAuth;
import org.argeo.api.cms.CmsSession;
+import org.argeo.api.cms.CmsState;
+import org.argeo.api.uuid.UuidFactory;
import org.argeo.cms.auth.CurrentUser;
import org.argeo.cms.internal.runtime.CmsContextImpl;
* Multi-session {@link ProvidedRepository}, integrated with a CMS.
*/
public class CmsContentRepository extends AbstractContentRepository {
+ public final static String RUN_BASE = "/run";
private Map<CmsSession, CmsContentSession> userSessions = Collections.synchronizedMap(new HashMap<>());
+ private CmsState cmsState;
+ private UuidFactory uuidFactory;
+
/*
* REPOSITORY
*/
CmsSession cmsSession = CurrentUser.getCmsSession();
CmsContentSession contentSession = userSessions.get(cmsSession);
if (contentSession == null) {
- final CmsContentSession newContentSession = new CmsContentSession(this, cmsSession.getSubject(), locale);
+ final CmsContentSession newContentSession = new CmsContentSession(this, cmsSession.getUuid(),
+ cmsSession.getSubject(), locale);
cmsSession.addOnCloseCallback((c) -> {
newContentSession.close();
userSessions.remove(cmsSession);
throw new RuntimeException("Could not login as data admin", e1);
} finally {
}
- return new CmsContentSession(this, loginContext.getSubject(), Locale.getDefault());
+ return new CmsContentSession(this, getCmsState().getUuid(), loginContext.getSubject(),
+ Locale.getDefault());
+ }
+
+ protected CmsState getCmsState() {
+ return cmsState;
+ }
+
+ public void setCmsState(CmsState cmsState) {
+ this.cmsState = cmsState;
+ }
+
+ public void setUuidFactory(UuidFactory uuidFactory) {
+ this.uuidFactory = uuidFactory;
}
}