001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Nuxeo - initial API and implementation
011 *
012 * $Id$
013 */
014
015package org.nuxeo.ecm.core.security;
016
017import org.nuxeo.common.xmap.annotation.XNode;
018import org.nuxeo.common.xmap.annotation.XObject;
019
020/**
021 * Pluggable policy descriptor for core security
022 *
023 * @author Anahide Tchertchian
024 */
025@XObject("policy")
026public class SecurityPolicyDescriptor implements Comparable<SecurityPolicyDescriptor> {
027
028    @XNode("@name")
029    private String name;
030
031    @XNode("@class")
032    private Class<Object> policy;
033
034    @XNode("@enabled")
035    private boolean enabled = true;
036
037    @XNode("@order")
038    private int order = 0;
039
040    public String getName() {
041        return name;
042    }
043
044    public Class<Object> getPolicy() {
045        return policy;
046    }
047
048    public boolean isEnabled() {
049        return enabled;
050    }
051
052    public int getOrder() {
053        return order;
054    }
055
056    @Override
057    public int compareTo(SecurityPolicyDescriptor anotherPolicy) {
058        return order - anotherPolicy.order;
059    }
060
061}