@Override public DocumentModel getParentFolderForNewModel(CoreSession session, DocumentModel instance) { UserWorkspaceService service = Framework.getService(UserWorkspaceService.class); return service.getCurrentUserPersonalWorkspace(session, instance); }
public DocumentModel getCurrentUserPersonalWorkspace() { if (!initialized) { initialize(); } // protection in case we have not yet chosen a repository. if not // repository, then there is no documentManager(session) if (documentManager == null) { return null;// this is ok because it eventually will be // dealt with by setCurrentDocument, which will deal with // the lack of a documentManager } return getUserWorkspaceService().getCurrentUserPersonalWorkspace(documentManager, navigationContext.getCurrentDocument()); }
@OperationMethod public DocumentModel run(Blob blob) throws OperationException, IOException { DocumentModel userws = userWorkspace.getCurrentUserPersonalWorkspace(session, getCurrentDocument()); FileImporterContext fileImporterContext = FileImporterContext.builder(session, blob, userws.getPathAsString()) .build(); return fileManager.createOrUpdateDocument(fileImporterContext); }
@Override public void handleEvent(Event event) { DocumentEventContext ctx = (DocumentEventContext) event.getContext(); DocumentModel userProfileDocument = ctx.getSourceDocument(); // The document should be the current user profile doc if (!userProfileDocument.hasFacet("UserProfile")) { return; } // No need to sync Seam session for system user if (ctx.getPrincipal() instanceof SystemPrincipal) { log.debug("Skip locale update for system user"); return; } // if the profile does not belong to the current user // => no need to sync Seam session UserWorkspaceService uws = Framework.getService(UserWorkspaceService.class); DocumentModel userWorkspace = uws.getCurrentUserPersonalWorkspace(ctx.getCoreSession(), userProfileDocument); if (!userProfileDocument.getPathAsString().startsWith(userWorkspace.getPathAsString())) { return; } // performing the locale update LocaleStartup localeStartup = LocaleStartup.instance(); if (localeStartup == null) { log.warn("Locale Startup not available. Can't set locale"); return; } localeStartup.setupLocale(userProfileDocument); }
@Override public DocumentModel getUserProfileDocument(CoreSession session) { DocumentModel userWorkspace = getUserWorkspaceService().getCurrentUserPersonalWorkspace(session, null); if (userWorkspace == null) { return null; } String uid = profileUidCache.getIfPresent(session.getPrincipal().getName()); final IdRef ref = new IdRef(uid); if (uid != null && session.exists(ref)) { return session.getDocument(ref); } else { DocumentModel profile = new UserProfileDocumentGetter(session, userWorkspace).getOrCreate(); profileUidCache.put(session.getPrincipal().getName(), profile.getId()); return profile; } }
DocumentModel uws = userWorkspaceService.getCurrentUserPersonalWorkspace(session);
public DocumentModel saveSearch(CoreSession session, ContentViewState searchContentViewState, String title) { UserWorkspaceService userWorkspaceService = Framework.getService(UserWorkspaceService.class); DocumentModel uws = userWorkspaceService.getCurrentUserPersonalWorkspace(session, null);