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