001/* 002 * (C) Copyright 2006-2013 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 * ldoguin 018 * 019 */ 020package org.nuxeo.template.api.descriptor; 021 022import java.io.Serializable; 023 024import org.apache.commons.logging.Log; 025import org.apache.commons.logging.LogFactory; 026import org.nuxeo.common.xmap.annotation.XNode; 027import org.nuxeo.common.xmap.annotation.XObject; 028 029@XObject("outputFormat") 030public class OutputFormatDescriptor implements Serializable { 031 032 private static final long serialVersionUID = 1L; 033 034 protected static final Log log = LogFactory.getLog(OutputFormatDescriptor.class); 035 036 @XNode("@id") 037 protected String id; 038 039 @XNode("@label") 040 protected String label; 041 042 @XNode("@enabled") 043 protected boolean enabled = true; 044 045 @XNode("@chainId") 046 protected String chainId; 047 048 @XNode("@mimetype") 049 protected String mimeType; 050 051 public String getId() { 052 return id; 053 } 054 055 public String getLabel() { 056 return label; 057 } 058 059 public boolean isEnabled() { 060 return enabled; 061 } 062 063 public String getChainId() { 064 return chainId; 065 } 066 067 public String getMimeType() { 068 return mimeType; 069 } 070 071 public OutputFormatDescriptor clone() { 072 OutputFormatDescriptor clone = new OutputFormatDescriptor(); 073 clone.enabled = enabled; 074 clone.chainId = chainId; 075 clone.mimeType = mimeType; 076 clone.label = label; 077 clone.id = id; 078 return clone; 079 } 080 081 public void merge(OutputFormatDescriptor srcOutFormat) { 082 if (srcOutFormat.mimeType != null) { 083 mimeType = srcOutFormat.mimeType; 084 } 085 if (srcOutFormat.chainId != null) { 086 chainId = srcOutFormat.chainId; 087 } 088 if (srcOutFormat.label != null) { 089 label = srcOutFormat.label; 090 } 091 } 092}