001/* 002 * (C) Copyright 2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Anahide Tchertchian 018 */ 019package org.nuxeo.theme.styling.service.descriptors; 020 021import org.apache.commons.lang.builder.EqualsBuilder; 022import org.nuxeo.common.xmap.annotation.XNode; 023import org.nuxeo.common.xmap.annotation.XObject; 024 025/** 026 * @since 5.5 027 */ 028@XObject("presets") 029public class FlavorPresets { 030 031 @XNode("@category") 032 String category; 033 034 @XNode("@src") 035 String src; 036 037 /** 038 * Resolved source content 039 */ 040 String content; 041 042 public String getCategory() { 043 return category; 044 } 045 046 public String getSrc() { 047 return src; 048 } 049 050 public void setCategory(String category) { 051 this.category = category; 052 } 053 054 public void setSrc(String src) { 055 this.src = src; 056 } 057 058 public String getContent() { 059 return content; 060 } 061 062 public void setContent(String content) { 063 this.content = content; 064 } 065 066 public FlavorPresets clone() { 067 FlavorPresets clone = new FlavorPresets(); 068 clone.setSrc(src); 069 clone.setCategory(category); 070 clone.setContent(content); 071 return clone; 072 } 073 074 @Override 075 public boolean equals(Object obj) { 076 if (!(obj instanceof FlavorPresets)) { 077 return false; 078 } 079 if (obj == this) { 080 return true; 081 } 082 FlavorPresets f = (FlavorPresets) obj; 083 // do not take content into account for overrides 084 return new EqualsBuilder().append(category, f.category).append(src, f.src).isEquals(); 085 } 086 087}