1 7 package com.inversoft.savant.ant.types; 8 9 import java.util.Date ; 10 import java.util.List ; 11 12 import org.apache.tools.ant.types.DataType; 13 import org.apache.tools.ant.types.Reference; 14 15 import com.inversoft.savant.Artifact; 16 import com.inversoft.savant.ArtifactGroup; 17 18 19 27 public class ArtifactGroupType extends DataType { 28 29 private ArtifactGroup proxy = new ArtifactGroup(); 30 31 32 35 public ArtifactGroupType() { 36 } 37 38 39 42 public ArtifactGroup getProxy() { 43 return proxy; 44 } 45 46 49 public void setRefid(Reference reference) { 50 super.setRefid(reference); 51 52 ArtifactGroupType group = (ArtifactGroupType) reference.getReferencedObject(getProject()); 53 List artifacts = group.getArtifacts(); 54 for (int i = 0; i < artifacts.size(); i++) { 55 proxy.addArtifact((Artifact) artifacts.get(i)); 56 } 57 58 proxy.setClasspathid(group.getClasspathid()); 59 proxy.setFilesetid(group.getFilesetid()); 60 proxy.setExpireminutes(group.getExpireminutes()); 61 proxy.setExpiretime(group.getExpiretime()); 62 } 63 64 67 public List getArtifacts() { 68 return proxy.getArtifacts(); 69 } 70 71 76 public void addConfiguredArtifact(ArtifactType artifact) { 77 if (isReference()) { 78 throw noChildrenAllowed(); 79 } 80 81 if (artifact.getExpireminutes() == 0) { 82 artifact.setExpireminutes(proxy.getExpireminutes()); 83 } 84 85 if (artifact.getExpiretime() == null) { 86 artifact.setExpiretime(proxy.getExpiretime()); 87 } 88 89 proxy.addArtifact(artifact.getProxy()); 90 } 91 92 99 public void addConfiguredArtifactgroup(ArtifactGroupType group) { 100 if (isReference()) { 101 throw noChildrenAllowed(); 102 } 103 104 List artifacts = group.getArtifacts(); 105 for (int i = 0; i < artifacts.size(); i++) { 106 proxy.addArtifact((Artifact) artifacts.get(i)); 107 } 108 } 109 110 public String getClasspathid() { 111 return proxy.getClasspathid(); 112 } 113 114 public void setClasspathid(String classPathId) { 115 if (isReference()) { 116 throw tooManyAttributes(); 117 } 118 119 proxy.setClasspathid(classPathId); 120 } 121 122 public String getFilesetid() { 123 return proxy.getFilesetid(); 124 } 125 126 public void setFilesetid(String fileSetId) { 127 if (isReference()) { 128 throw tooManyAttributes(); 129 } 130 131 proxy.setFilesetid(fileSetId); 132 } 133 134 public int getExpireminutes() { 135 return proxy.getExpireminutes(); 136 } 137 138 public void setExpireminutes(int expireMinutes) { 139 proxy.setExpireminutes(expireMinutes); 140 } 141 142 public Date getExpiretime() { 143 return proxy.getExpiretime(); 144 } 145 146 public void setExpiretime(Date expireTime) { 147 proxy.setExpiretime(expireTime); 148 } 149 } | Popular Tags |