private WorkflowManager getWorkflowManager() throws RepositoryException { return ((HippoWorkspace) session.getWorkspace()).getWorkflowManager(); } }
HierarchyResolver getHierarchyResolver() throws RepositoryException { return ((HippoWorkspace) upstream).getHierarchyResolver(); }
/** * Look up the real user name pertaining to a user ID * * @param userId ID of some user * @param session current user's JCR session * @return name of the user or nothing, wrapped in an Optional */ public static Optional<String> getUserName(final String userId, final Session session) { try { final HippoWorkspace workspace = (HippoWorkspace) session.getWorkspace(); final User user = workspace.getSecurityService().getUser(userId); return getUserName(user); } catch (RepositoryException e) { log.debug("Unable to determine displayName of user '{}'.", userId, e); } return Optional.empty(); }
public RemoteHierarchyResolver getHierarchyResolver() throws RepositoryException, RemoteException { try { HierarchyResolver hierarchyResolver = workspace.getHierarchyResolver(); return ((RemoteServicingAdapterFactory)getFactory()).getRemoteHierarchyResolver(hierarchyResolver, workspace.getSession()); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
if (!docs.hasNext()) { Document folder = ((HippoWorkspace) session.getJcrSession() .getWorkspace()).getDocumentManager().getDocument("embedded", docNode.getUUID()); Workflow workflow = manager.getWorkflow("internal", folder);
if (!docs.hasNext()) { Document folder = ((HippoWorkspace) session.getJcrSession() .getWorkspace()).getDocumentManager().getDocument("embedded", docNode.getUUID()); Workflow workflow = manager.getWorkflow("internal", folder);
private static WorkflowManager getWorkflowManager(final Session session) throws RepositoryException { final HippoWorkspace workspace = (HippoWorkspace) session.getWorkspace(); return workspace.getWorkflowManager(); }
protected Node traverse(Session session, String path) throws RepositoryException { if (path.startsWith("/")) { path = path.substring(1); } return ((HippoWorkspace) session.getWorkspace()).getHierarchyResolver().getNode(session.getRootNode(), path); }
private Boolean isSystemUser(String userName) { try { final SecurityService securityService = ((HippoWorkspace) session.getWorkspace()).getSecurityService(); return securityService.hasUser(userName) && securityService.getUser(userName).isSystemUser(); } catch (ItemNotFoundException ignore) { // If hasUser returns true, we expect getUser to return a user, so it is very unlikely that // securityService.getUser(userName) will throw this exception } catch (RepositoryException e) { log.error("Failed to determine system status of event", e); } return null; }
private static WorkflowManager getWorkflowManager(final Session session) throws RepositoryException { return ((HippoWorkspace) session.getWorkspace()).getWorkflowManager(); }
newValues = new String[] { arguments.get(propPath) }; } else { final HierarchyResolver hr = ((HippoWorkspace) rootSession.getWorkspace()).getHierarchyResolver(); Property parentProperty = hr.getProperty(target, propPath); if (parentProperty == null) {
/** * Look up the real user name pertaining to a user ID * * @param userId ID of some user * @param session current user's JCR session * @return name of the user or nothing, wrapped in an Optional */ public static Optional<String> getUserName(final String userId, final Session session) { try { final HippoWorkspace workspace = (HippoWorkspace) session.getWorkspace(); final User user = workspace.getSecurityService().getUser(userId); final String firstName = user.getFirstName(); final String lastName = user.getLastName(); final StringBuilder sb = new StringBuilder(); if (firstName != null) { sb.append(firstName.trim()); sb.append(" "); } if (lastName != null) { sb.append(lastName.trim()); } return Optional.of(sb.toString().trim()); } catch (final RepositoryException e) { log.debug("Unable to determine displayName of user '{}'.", userId, e); } return Optional.empty(); }
protected final WorkflowManager getWorkflowManager(Session session) throws RepositoryException { return ((HippoWorkspace) session.getWorkspace()).getWorkflowManager(); }
@Override public IRequestHandler mapRequest(final Request request, final MountParameters mountParams) { String path = Strings.join("/", request.getUrl().getSegments()); try { javax.jcr.Session subSession = UserSession.get().getJcrSession(); Node node = ((HippoWorkspace) subSession.getWorkspace()).getHierarchyResolver().getNode( subSession.getRootNode(), path); // YUCK: no exception! if (node == null) { log.info("no binary found at " + path); } else { if (node.isNodeType(HippoNodeType.NT_DOCUMENT)) { node = (Node) JcrHelper.getPrimaryItem(node); } return new JcrResourceRequestHandler(node); } } catch (PathNotFoundException e) { log.info("binary not found " + e.getMessage()); } catch (javax.jcr.LoginException ex) { log.warn(ex.getMessage()); } catch (RepositoryException ex) { log.error(ex.getMessage()); } return null; }
@Override public User getUser() throws RepositoryException { return ((HippoWorkspace) getWorkspace()).getSecurityService().getUser(getUserID()); }
@Override protected WorkflowManager load() { Session jcrSession = getJcrSessionInternal(); if (jcrSession != null) { try { HippoWorkspace workspace = (HippoWorkspace)jcrSession.getWorkspace(); return workspace.getWorkflowManager(); } catch (RepositoryException ex) { ex.printStackTrace(); } } return null; }
Node mirrorNode = ((HippoWorkspace)((HippoSession)node.getSession()).getWorkspace()).getHierarchyResolver().getNode(node, path); if (mirrorNode != null) { return reqContext.getHstLinkCreator().create(mirrorNode, reqContext.getResolvedSiteMapItem());
final SecurityService securityService = ((HippoWorkspace) lazyCloseableSession.getSession().getWorkspace()).getSecurityService();
protected Workflow getWorkflow(Node node, String category) throws RepositoryException { HippoWorkspace wsp = (HippoWorkspace) node.getSession().getWorkspace(); WorkflowManager workflowMgr = wsp.getWorkflowManager(); Node canonicalNode = ((HippoNode) node).getCanonicalNode(); return workflowMgr.getWorkflow(category, canonicalNode); }
public Workflow getWorkflow(String category, Document document) throws RepositoryException { Workspace workspace = session.getWorkspace(); ClassLoader workspaceClassloader = workspace.getClass().getClassLoader(); ClassLoader currentClassloader = Thread.currentThread().getContextClassLoader(); try { if (workspaceClassloader != currentClassloader) { Thread.currentThread().setContextClassLoader(workspaceClassloader); } WorkflowManager wfm = ((HippoWorkspace) workspace).getWorkflowManager(); return wfm.getWorkflow(category, document); } catch (RepositoryException e) { throw e; } catch (Exception ignore) { // Just ignore other exceptions which are not handled properly in the repository such as NPE. } finally { if (workspaceClassloader != currentClassloader) { Thread.currentThread().setContextClassLoader(currentClassloader); } } return null; }