1 23 package org.infoglue.cms.webservices.elements; 24 25 public abstract class AbstractAttachment implements Attachment 26 { 27 30 private byte[] bytes; 31 32 35 private String name; 36 39 private String fileName; 40 43 private String filePath; 44 45 48 private String contentType; 49 50 53 protected AbstractAttachment() 54 { 55 } 56 57 60 protected AbstractAttachment(final String name, final String fileName, final String filePath, final String contentType, final byte[] bytes) 61 { 62 super(); 63 this.name = name; 64 65 if(fileName != null && !fileName.equals("")) 66 this.fileName = fileName; 67 else 68 this.fileName = "Unknown"; 69 70 if(filePath != null && !filePath.equals("")) 71 this.filePath = filePath; 72 else 73 this.filePath = "Unknown"; 74 75 this.contentType = contentType; 76 this.bytes = bytes; 77 } 78 79 82 public byte[] getBytes() 83 { 84 return bytes; 85 } 86 87 90 public void setBytes(final byte[] bytes) 91 { 92 this.bytes = bytes; 93 } 94 95 98 public String getName() 99 { 100 return name; 101 } 102 103 106 public void setName(final String name) 107 { 108 this.name = name; 109 } 110 111 114 public int getSize() 115 { 116 return getBytes().length; 117 } 118 119 122 public String getContentType() 123 { 124 return contentType; 125 } 126 127 130 public void setContentType(final String contentType) 131 { 132 this.contentType = contentType; 133 } 134 135 138 public String toString() 139 { 140 return "<" + getSize() + "," + getName() + "," + getContentType() + ">"; 141 } 142 143 public String getFileName() 144 { 145 return fileName; 146 } 147 148 public void setFileName(String fileName) 149 { 150 this.fileName = fileName; 151 } 152 153 public String getFilePath() 154 { 155 return filePath; 156 } 157 158 public void setFilePath(String filePath) 159 { 160 this.filePath = filePath; 161 } 162 } 163 | Popular Tags |