1 2 17 18 19 package org.apache.poi.poifs.filesystem; 20 21 import java.io.*; 22 23 import java.util.*; 24 25 import org.apache.poi.poifs.property.Property; 26 27 37 38 public abstract class EntryNode 39 implements Entry 40 { 41 42 private Property _property; 44 45 private DirectoryNode _parent; 47 48 55 56 protected EntryNode(final Property property, final DirectoryNode parent) 57 { 58 _property = property; 59 _parent = parent; 60 } 61 62 67 68 protected Property getProperty() 69 { 70 return _property; 71 } 72 73 78 79 protected boolean isRoot() 80 { 81 82 return (_parent == null); 84 } 85 86 93 94 protected abstract boolean isDeleteOK(); 95 96 97 98 103 104 public String getName() 105 { 106 return _property.getName(); 107 } 108 109 114 115 public boolean isDirectoryEntry() 116 { 117 return false; 118 } 119 120 125 126 public boolean isDocumentEntry() 127 { 128 return false; 129 } 130 131 137 138 public DirectoryEntry getParent() 139 { 140 return _parent; 141 } 142 143 155 156 public boolean delete() 157 { 158 boolean rval = false; 159 160 if ((!isRoot()) && isDeleteOK()) 161 { 162 rval = _parent.deleteEntry(this); 163 } 164 return rval; 165 } 166 167 180 181 public boolean renameTo(final String newName) 182 { 183 boolean rval = false; 184 185 if (!isRoot()) 186 { 187 rval = _parent.changeName(getName(), newName); 188 } 189 return rval; 190 } 191 192 193 } 195 | Popular Tags |