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.api.impl; 020 021import java.util.List; 022 023import org.nuxeo.targetplatforms.api.TargetPackage; 024import org.nuxeo.targetplatforms.api.TargetPlatform; 025 026/** 027 * {@link TargetPlatform} implementation relying on an original implementation, useful for override when adding 028 * additional metadata. 029 * 030 * @since 5.7.1 031 */ 032public class TargetPlatformExtension extends TargetExtension implements TargetPlatform, Comparable<TargetPlatform> { 033 034 private static final long serialVersionUID = 1L; 035 036 protected TargetPlatform origPlatform; 037 038 // needed by GWT serialization 039 protected TargetPlatformExtension() { 040 super(); 041 } 042 043 public TargetPlatformExtension(TargetPlatform orig) { 044 super(orig); 045 origPlatform = orig; 046 } 047 048 @Override 049 public boolean isFastTrack() { 050 return origPlatform.isFastTrack(); 051 } 052 053 @Override 054 public List<String> getAvailablePackagesIds() { 055 return origPlatform.getAvailablePackagesIds(); 056 } 057 058 @Override 059 public List<TargetPackage> getAvailablePackages() { 060 return origPlatform.getAvailablePackages(); 061 } 062 063 @Override 064 public TargetPlatform getParent() { 065 return origPlatform.getParent(); 066 } 067 068 @Override 069 public List<String> getTestVersions() { 070 return origPlatform.getTestVersions(); 071 } 072 073 @Override 074 public int compareTo(TargetPlatform o) { 075 // compare first on name, then on version 076 int comp = getName().compareTo(o.getName()); 077 if (comp == 0) { 078 comp = getVersion().compareTo(o.getVersion()); 079 } 080 return comp; 081 } 082 083}