001/* 002 * (C) Copyright 2006-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 * Thomas Roger <[email protected]> 018 */ 019 020package org.nuxeo.ecm.platform.video.service; 021 022import org.nuxeo.common.xmap.annotation.XNode; 023import org.nuxeo.common.xmap.annotation.XObject; 024 025/** 026 * Object representing a registered automatic video conversion on the {@link VideoService}. 027 * <p> 028 * An {@code AutomaticVideoConversion} references the {@code VideoConversion} through its name. 029 * 030 * @author <a href="mailto:[email protected]">Thomas Roger</a> 031 * @since 5.5 032 */ 033@XObject("automaticVideoConversion") 034public class AutomaticVideoConversion implements Cloneable, Comparable<AutomaticVideoConversion> { 035 036 @XNode("@name") 037 private String name; 038 039 @XNode("@enabled") 040 private boolean enabled = true; 041 042 @XNode("@order") 043 private int order = 0; 044 045 public String getName() { 046 return name; 047 } 048 049 public boolean isEnabled() { 050 return enabled; 051 } 052 053 public void setEnabled(boolean enabled) { 054 this.enabled = enabled; 055 } 056 057 public int getOrder() { 058 return order; 059 } 060 061 @Override 062 public AutomaticVideoConversion clone() throws CloneNotSupportedException { 063 return (AutomaticVideoConversion) super.clone(); 064 } 065 066 @Override 067 public int compareTo(AutomaticVideoConversion o) { 068 int cmp = order - o.order; 069 if (cmp == 0) { 070 // make sure we have a deterministic sort 071 cmp = name.compareTo(o.name); 072 } 073 return cmp; 074 } 075 076}