1 21 package com.jaspersoft.jasperserver.api.metadata.common.domain.client; 22 23 import java.util.Date ; 24 import java.util.List ; 25 26 import com.jaspersoft.jasperserver.api.JSException; 27 import com.jaspersoft.jasperserver.api.metadata.common.domain.Folder; 28 import com.jaspersoft.jasperserver.api.metadata.common.domain.Resource; 29 import com.jaspersoft.jasperserver.api.metadata.common.domain.ResourceLookup; 30 31 35 public class ResourceLookupImpl implements ResourceLookup { 36 37 private int version; 38 private Date creationDate; 39 private String name; 40 private String label; 41 private String description; 42 private String folderUri; 43 private String uri; 44 private String resourceType; 45 46 public ResourceLookupImpl() { 47 } 48 49 public String getName() { 50 return name; 51 } 52 53 public String getLabel() { 54 return label; 55 } 56 57 public String getDescription() { 58 return description; 59 } 60 61 public List getAttributes() { 62 return null; 64 } 65 66 public void setDescription(String description) { 67 this.description = description; 68 } 69 70 public void setLabel(String label) { 71 this.label = label; 72 } 73 74 public void setName(String name) { 75 this.uri = null; 76 this.name = name; 77 } 78 79 public String getURIString() 80 { 81 if (uri == null) { 82 StringBuffer sb = new StringBuffer (); 83 if (getParentFolder() != null && !getParentFolder().equals(Folder.SEPARATOR)) 84 sb.append(getParentFolder()); 85 sb.append(Folder.SEPARATOR); 86 if (!getName().equals(Folder.SEPARATOR)) 87 sb.append(getName()); 88 uri = sb.toString(); 89 } 90 return uri; 91 } 92 93 96 public String getURI() { 97 return getProtocol() + ":" + getPath(); 98 } 99 100 public String getParentURI() { 101 return getParentFolder() == null ? null : getProtocol() + ":" + getParentFolder(); 102 } 103 104 public String getParentPath() { 105 return getParentFolder() == null ? null : getParentFolder(); 106 } 107 108 111 public String getPath() { 112 return getURIString(); 113 } 114 115 118 public String getProtocol() { 119 return Resource.URI_PROTOCOL; 120 } 121 122 public String getParentFolder() { 123 return folderUri; 124 } 125 126 public void setParentFolder(Folder folder) { 127 this.uri = null; 128 folderUri = folder.getURIString(); 129 } 130 131 public void setParentFolder(String folderURI) { 132 this.uri = null; 133 folderUri = folderURI; 134 } 135 136 public void setURI(String uri) { 137 this.uri = uri; 138 } 139 140 protected final JSException lookupUnsupportedException() { 141 return new JSException("The call is not supported by resource lookup objects."); 142 } 143 144 public int getVersion() { 145 return version; 146 } 147 148 public void setVersion(int version) { 149 this.version = version; 150 } 151 152 public String getResourceType() { 153 return resourceType; 154 } 155 156 public void setResourceType(String resourceType) { 157 this.resourceType = resourceType; 158 } 159 160 public Date getCreationDate() { 161 return creationDate; 162 } 163 164 public void setCreationDate(Date creationDate) { 165 this.creationDate = creationDate; 166 } 167 168 public boolean isNew() { 169 return false; 170 } 171 172 public void setURIString(String uri) { 173 this.uri = uri; 174 } 175 } 176 | Popular Tags |