1 24 package org.objectweb.jalisto.se.impl.server.oid; 25 26 import org.objectweb.jalisto.se.impl.LogicalOid; 27 import org.objectweb.jalisto.se.exception.IdentityException; 28 import org.objectweb.jalisto.se.impl.server.PhysicalOid; 29 import org.objectweb.jalisto.se.api.internal.OidActionCaller; 30 31 import java.io.Serializable ; 32 33 public class OidInfo implements Serializable { 34 35 public OidInfo(LogicalOid floid, PhysicalOid fpoid) { 36 this.floid = floid; 37 this.fpoid = fpoid; 38 this.update = 0; 39 this.created = false; 40 } 41 42 public OidInfo(LogicalOid floid, PhysicalOid fpoid, short update) { 43 this.floid = floid; 44 this.fpoid = fpoid; 45 this.update = update; 46 } 47 48 public boolean isDeleting() { 49 return (fpoid == null); 50 } 51 52 public LogicalOid getFloid() { 53 return floid; 54 } 55 56 public void setFpoid(PhysicalOid fpoid) { 57 this.fpoid = fpoid; 58 } 59 60 public PhysicalOid getFpoid() { 61 return fpoid; 62 } 63 64 public void setUpdate(short update) { 65 this.update = update; 66 } 67 68 public short getUpdate() { 69 return update; 70 } 71 72 public boolean isCreated() { 73 return created; 74 } 75 76 public void markAsCreated() { 77 if (created) { 78 throw new IdentityException("the given oid " + floid + " already has created datas"); 79 } 80 created = true; 81 } 82 83 public OidActionCaller getActionCaller() { 84 return actionCaller; 85 } 86 87 public void setActionCaller(OidActionCaller actionCaller) { 88 this.actionCaller = actionCaller; 89 } 90 91 public OidInfo getClone() { 92 OidInfo clone = new OidInfo(floid.getClone(), fpoid.getClone()); 93 clone.setUpdate(update); 94 return clone; 95 } 96 97 public String toString() { 98 StringBuffer sb = new StringBuffer (); 99 sb.append("oidi").append(actionCaller).append("(").append(floid).append(',').append(fpoid).append(',').append( 100 update).append(")"); 101 return sb.toString(); 102 } 103 104 105 private LogicalOid floid; 106 private PhysicalOid fpoid; 107 private short update; 108 private boolean created; 109 private transient OidActionCaller actionCaller = OidActionCaller.READ_CALLER; 110 111 static final long serialVersionUID = -7589377044064761459L; 112 } 113 | Popular Tags |