1 28 29 package com.caucho.amber.entity; 30 31 import com.caucho.amber.query.ResultSetCacheChunk; 32 import com.caucho.amber.type.EntityType; 33 import com.caucho.util.L10N; 34 import com.caucho.util.Log; 35 36 import java.util.logging.Logger ; 37 38 41 public class TableInvalidateCompletion extends AmberCompletion { 42 private static final L10N L = new L10N(TableInvalidateCompletion.class); 43 private static final Logger log = Log.open(TableInvalidateCompletion.class); 44 45 private String _table; 46 47 public TableInvalidateCompletion(String table) 48 { 49 if (table == null) 50 throw new NullPointerException (); 51 52 _table = table; 53 } 54 55 60 public boolean complete(EntityType rootType, 61 Object key, 62 EntityItem entityItem) 63 { 64 if (rootType.getTable().getName().equals(_table)) { 65 entityItem.expire(); 66 } 67 else { 68 entityItem.getEntity().__caucho_invalidate_foreign(_table, null); 69 } 70 71 return false; 72 } 73 74 79 public boolean complete(ResultSetCacheChunk chunk) 80 { 81 return chunk.invalidate(_table, null); 82 } 83 84 87 public boolean equals(Object o) 88 { 89 if (this == o) 90 return true; 91 else if (o == null || o.getClass() != getClass()) 92 return false; 93 94 TableInvalidateCompletion comp = (TableInvalidateCompletion) o; 95 96 return _table.equals(comp._table); 97 } 98 } 99 | Popular Tags |