UserPropertiesManager.java 3.4 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  aQute.bnd.annotation.ProviderType
 *  javax.annotation.Nonnull
 *  javax.annotation.Nullable
 *  javax.jcr.Node
 *  javax.jcr.Property
 *  javax.jcr.RepositoryException
 *  org.apache.jackrabbit.api.security.user.Authorizable
 *  org.apache.jackrabbit.api.security.user.Group
 *  org.apache.sling.commons.osgi.PropertiesUtil
 */
package com.adobe.granite.security.user;

import aQute.bnd.annotation.ProviderType;
import com.adobe.granite.security.user.UserProperties;
import com.adobe.granite.security.user.UserPropertiesComposite;
import com.adobe.granite.security.user.UserPropertiesFilter;
import java.security.Principal;
import java.util.Comparator;
import java.util.Iterator;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
import org.apache.sling.commons.osgi.PropertiesUtil;

@ProviderType
public interface UserPropertiesManager {
    public static final String JCR_TITLE = "{http://www.jcp.org/jcr/1.0}title";
    public static final String GRANITE_RANKING = "granite:ranking";
    public static final int DEFAULT_RANKING = 1000;
    public static final Comparator<Node> DESCENDING_RANKING_COMPARATOR = new Comparator<Node>(){

        @Override
        public int compare(Node p1, Node p2) {
            try {
                return this.ranking(p1) - this.ranking(p2);
            }
            catch (RepositoryException e) {
                return 0;
            }
        }

        private int ranking(Node p) throws RepositoryException {
            if (p.hasProperty("granite:ranking")) {
                return PropertiesUtil.toInteger((Object)p.getProperty("granite:ranking").getLong(), (int)1000);
            }
            return 1000;
        }
    };

    public UserProperties createUserProperties(String var1, String var2) throws RepositoryException;

    public UserProperties getUserProperties(String var1, String var2) throws RepositoryException;

    public UserProperties getUserProperties(Authorizable var1, String var2) throws RepositoryException;

    public UserProperties getUserProperties(Node var1) throws RepositoryException;

    public UserPropertiesComposite getUserPropertiesComposite(String var1, String[] var2) throws RepositoryException;

    public UserPropertiesComposite getUserPropertiesComposite(String var1, UserPropertiesFilter var2) throws RepositoryException;

    @Nonnull
    public UserPropertiesComposite getUserPropertiesComposite(@Nonnull String var1, @Nullable String var2) throws RepositoryException;

    @Nonnull
    public UserPropertiesComposite getUserPropertiesComposite(@Nonnull String var1, @Nullable String var2, @Nonnull Comparator<Node> var3) throws RepositoryException;

    public Iterator<UserProperties> getMemberOfUserProperties(String var1, String var2, boolean var3) throws RepositoryException;

    public Iterator<UserProperties> getMemberUserProperties(Group var1, String var2, boolean var3) throws RepositoryException;

    public /* varargs */ boolean addReaders(@Nonnull UserProperties var1, @Nonnull Principal ... var2) throws RepositoryException;

    public /* varargs */ boolean removeReaders(@Nonnull UserProperties var1, @Nonnull Principal ... var2) throws RepositoryException;

}