ServiceLoginUtil.java 1.18 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  javax.jcr.RepositoryException
 *  javax.jcr.Session
 *  org.apache.sling.jcr.api.SlingRepository
 */
package com.adobe.granite.taskmanagement.impl.utils;

import javax.jcr.RepositoryException;
import javax.jcr.Session;
import org.apache.sling.jcr.api.SlingRepository;

public class ServiceLoginUtil {
    private static final String WORKFLOW_USER_READER_SERVICE = "user";
    private static final String TASKMANAGEMENT_SERVICE = "taskmanagement";

    public static Session createWorkflowUserReaderSession(SlingRepository repository) {
        try {
            return repository.loginService("user", null);
        }
        catch (RepositoryException e) {
            throw new RuntimeException("Unable to create workflow user reader service session.", (Throwable)e);
        }
    }

    public static Session createTaskmanagementSession(SlingRepository repository) {
        try {
            return repository.loginService("taskmanagement", null);
        }
        catch (RepositoryException e) {
            throw new RuntimeException("Unable to create taskamnagement service session.", (Throwable)e);
        }
    }
}