001/* 002 * (C) Copyright 2013 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Antoine Taillefer <ataillefer@nuxeo.com> 016 */ 017package org.nuxeo.drive.service.impl; 018 019import java.io.Serializable; 020 021import org.nuxeo.common.xmap.annotation.XNode; 022import org.nuxeo.common.xmap.annotation.XObject; 023 024/** 025 * XMap descriptor for the {@code factory} elements of the {@code activeFileSystemItemFactories} contributions. 026 * 027 * @author Antoine Taillefer 028 */ 029@XObject("factory") 030public class ActiveFileSystemItemFactoryDescriptor implements Serializable { 031 032 private static final long serialVersionUID = 1630714012089221788L; 033 034 @XNode("") 035 protected String name; 036 037 @XNode("@enabled") 038 protected boolean enabled = true; 039 040 public String getName() { 041 return name; 042 } 043 044 public void setName(String name) { 045 this.name = name; 046 } 047 048 public boolean isEnabled() { 049 return enabled; 050 } 051 052 public void setEnabled(boolean enabled) { 053 this.enabled = enabled; 054 } 055 056 @Override 057 public String toString() { 058 StringBuilder sb = new StringBuilder(name); 059 sb.append(" (enabled = "); 060 sb.append(enabled); 061 sb.append(")"); 062 return sb.toString(); 063 } 064 065 @Override 066 public boolean equals(Object obj) { 067 if (this == obj) { 068 return true; 069 } 070 if (!(obj instanceof ActiveFileSystemItemFactoryDescriptor)) { 071 return false; 072 } 073 return this.name.equals(((ActiveFileSystemItemFactoryDescriptor) obj).getName()); 074 } 075 076 @Override 077 public int hashCode() { 078 return name.hashCode(); 079 } 080 081}