001/* 002 * (C) Copyright 2014 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.targetplatforms.core.descriptors; 020 021import java.util.ArrayList; 022import java.util.List; 023 024import org.nuxeo.common.xmap.annotation.XNode; 025import org.nuxeo.common.xmap.annotation.XNodeList; 026import org.nuxeo.common.xmap.annotation.XObject; 027 028/** 029 * Descriptor for target platform contributions. 030 * 031 * @since 5.7.1 032 */ 033@XObject("platform") 034public class TargetPlatformDescriptor extends TargetDescriptor { 035 036 @XNode("fastTrack") 037 Boolean fastTrack; 038 039 @XNode("trial") 040 Boolean trial; 041 042 @XNode("default") 043 Boolean isDefault; 044 045 @XNodeList(value = "testVersions/version", type = ArrayList.class, componentType = String.class) 046 List<String> testVersions; 047 048 public boolean isFastTrackSet() { 049 return fastTrack != null; 050 } 051 052 public boolean isFastTrack() { 053 return Boolean.TRUE.equals(fastTrack); 054 } 055 056 public boolean isTrialSet() { 057 return trial != null; 058 } 059 060 public boolean isTrial() { 061 return Boolean.TRUE.equals(trial); 062 } 063 064 public boolean isDefaultSet() { 065 return isDefault != null; 066 } 067 068 public boolean isDefault() { 069 return Boolean.TRUE.equals(isDefault); 070 } 071 072 public List<String> getTestVersions() { 073 return testVersions; 074 } 075 076 @Override 077 public TargetPlatformDescriptor clone() { 078 TargetPlatformDescriptor clone = new TargetPlatformDescriptor(); 079 doClone(clone); 080 return clone; 081 } 082 083 protected void doClone(TargetPlatformDescriptor clone) { 084 super.doClone(clone); 085 clone.fastTrack = fastTrack; 086 clone.trial = trial; 087 clone.isDefault = isDefault; 088 if (testVersions != null) { 089 clone.testVersions = new ArrayList<>(testVersions); 090 } 091 } 092 093}