001/*
002 * (C) Copyright 2011 * All rights reserved. This program and the accompanying materials
003 * are made available under the terms of the GNU Lesser General Public License
004 * (LGPL) version 2.1 which accompanies this distribution, and is available at
005 * http://www.gnu.org/licenses/lgpl.html
006 *
007 * This library is distributed in the hope that it will be useful,
008 * but WITHOUT ANY WARRANTY; without even the implied warranty of
009 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
010 * Lesser General Public License for more details.
011 *
012 * Contributors:
013 *     ldoguin
014 *
015 * $Id$
016 */
017
018package org.nuxeo.ecm.platform.task;
019
020import org.nuxeo.common.xmap.annotation.XNode;
021import org.nuxeo.common.xmap.annotation.XObject;
022
023/**
024 * @author <a href="mailto:ldoguin@nuxeo.com">Laurent Doguin</a>
025 * @since 5.5
026 */
027@XObject("taskProvider")
028public class TaskProviderDescriptor {
029
030    @XNode("@id")
031    private String id;
032
033    @XNode("@class")
034    private Class<TaskProvider> taskProvider;
035
036    @XNode("@enabled")
037    private Boolean enabled = true;
038
039    public TaskProvider getNewInstance() {
040        try {
041            return taskProvider.newInstance();
042        } catch (ReflectiveOperationException e) {
043            throw new RuntimeException(e);
044        }
045    }
046
047    public String getId() {
048        return id;
049    }
050
051    public Boolean isEnabled() {
052        return enabled;
053    }
054}