001/* 002 * (C) Copyright 2006-2016 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 * Tiago Cardoso <[email protected]> 018 */ 019package org.nuxeo.ecm.platform.threed.service; 020 021import org.nuxeo.common.xmap.annotation.XNode; 022import org.nuxeo.common.xmap.annotation.XObject; 023 024/** 025 * Object representing an automatic render view on the {@link ThreeDService}. An {@code AutomaticRenderView} references 026 * the {@code RenderView} through its name. 027 * 028 * @since 8.4 029 */ 030@XObject("automaticRenderView") 031public class AutomaticRenderView implements Comparable<AutomaticRenderView> { 032 033 @XNode("@order") 034 protected Integer order; 035 036 @XNode("@name") 037 protected String name; 038 039 @XNode("@enabled") 040 protected Boolean enabled; 041 042 public AutomaticRenderView(AutomaticRenderView other) { 043 order = other.order; 044 name = other.name; 045 enabled = other.enabled; 046 } 047 048 public AutomaticRenderView() { 049 super(); 050 } 051 052 public Integer getOrder() { 053 return order; 054 } 055 056 public void setOrder(Integer order) { 057 this.order = order; 058 } 059 060 public String getName() { 061 return name; 062 } 063 064 public void setName(String name) { 065 this.name = name; 066 } 067 068 public String getId() { 069 return String.valueOf(name.hashCode() & 0x7fffffff); 070 } 071 072 public boolean isEnabled() { 073 return (enabled == null) || enabled; 074 } 075 076 public void setEnabled(boolean enabled) { 077 this.enabled = enabled; 078 } 079 080 @Override 081 public int compareTo(AutomaticRenderView o) { 082 return name.compareTo(o.name); 083 } 084 085 public void merge(AutomaticRenderView src) { 086 if (src.order != null) { 087 order = src.order; 088 } 089 if (src.name != null) { 090 name = src.name; 091 } 092 if (src.enabled != null) { 093 enabled = src.enabled; 094 } 095 } 096}