001/* 002 * (C) Copyright 2011 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.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 * Anahide Tchertchian 016 */ 017package org.nuxeo.theme.styling.service.descriptors; 018 019import org.apache.commons.lang.builder.EqualsBuilder; 020import org.nuxeo.common.xmap.annotation.XNode; 021import org.nuxeo.common.xmap.annotation.XObject; 022 023/** 024 * @since 5.5 025 */ 026@XObject("presets") 027public class FlavorPresets { 028 029 @XNode("@category") 030 String category; 031 032 @XNode("@src") 033 String src; 034 035 /** 036 * Resolved source content 037 */ 038 String content; 039 040 public String getCategory() { 041 return category; 042 } 043 044 public String getSrc() { 045 return src; 046 } 047 048 public void setCategory(String category) { 049 this.category = category; 050 } 051 052 public void setSrc(String src) { 053 this.src = src; 054 } 055 056 public String getContent() { 057 return content; 058 } 059 060 public void setContent(String content) { 061 this.content = content; 062 } 063 064 public FlavorPresets clone() { 065 FlavorPresets clone = new FlavorPresets(); 066 clone.setSrc(src); 067 clone.setCategory(category); 068 clone.setContent(content); 069 return clone; 070 } 071 072 @Override 073 public boolean equals(Object obj) { 074 if (!(obj instanceof FlavorPresets)) { 075 return false; 076 } 077 if (obj == this) { 078 return true; 079 } 080 FlavorPresets f = (FlavorPresets) obj; 081 // do not take content into account for overrides 082 return new EqualsBuilder().append(category, f.category).append(src, f.src).isEquals(); 083 } 084 085}