1 18 package sync4j.framework.engine; 19 20 import java.security.Principal ; 21 22 import sync4j.framework.engine.SyncItem; 23 import sync4j.framework.engine.SyncOperation; 24 25 import org.apache.commons.lang.builder.ToStringBuilder; 26 27 28 39 public class SyncOperationImpl implements SyncOperation { 40 41 43 private SyncItem syncItemA = null; 44 public SyncItem getSyncItemA() { 45 return this.syncItemA; 46 } 47 48 public void setSyncItemA(SyncItem syncItemA) { 49 this.syncItemA = syncItemA; 50 } 51 52 private SyncItem syncItemB = null; 53 public SyncItem getSyncItemB() { 54 return this.syncItemB; 55 } 56 57 public void setSyncItemB(SyncItem syncItemB) { 58 this.syncItemB = syncItemB; 59 } 60 61 private char operation = 0; 62 public char getOperation() { 63 return this.operation; 64 } 65 66 public void setOperation(char operation) { 67 this.operation = operation; 68 } 69 70 private Principal owner = null; 71 72 77 public Principal getOwner() { 78 return this.owner; 79 } 80 81 84 public void setOwner(Principal owner) { 85 this.owner = owner; 86 } 87 88 private boolean aOperation = false; 89 90 94 public boolean isAOperation() { 95 return aOperation; 96 } 97 98 102 public void setAOperation(boolean aOperation) { 103 this.aOperation = aOperation; 104 } 105 106 private boolean bOperation = false; 107 108 112 public boolean isBOperation() { 113 return bOperation; 114 } 115 116 120 public void setBOperation(boolean bOperation) { 121 this.bOperation = bOperation; 122 } 123 124 126 public SyncOperationImpl() { 127 } 128 129 138 public SyncOperationImpl(Principal owner , 139 SyncItem syncItemA , 140 SyncItem syncItemB , 141 char operation , 142 boolean aOperation, 143 boolean bOperation) { 144 this.owner = owner ; 145 this.syncItemA = syncItemA; 146 this.syncItemB = syncItemB; 147 this.operation = operation; 148 this.aOperation = aOperation; 149 this.bOperation = bOperation; 150 } 151 152 public SyncOperationImpl(SyncItem syncItemA, 153 SyncItem syncItemB, 154 char operation) { 155 this(null, syncItemA, syncItemB, operation, false, false); 159 } 160 161 163 public String toString() { 164 ToStringBuilder b = new ToStringBuilder(this); 165 166 b.append("A", "" + syncItemA); 167 b.append("B", "" + syncItemB); 168 String o = ""; 169 switch (operation) { 170 case NEW : o = "NEW" ; break; 171 case DELETE: o = "DELETE" ; break; 172 case UPDATE: o = "UPDATE" ; break; 173 case CONFLICT: o = "CONFLICT" ; break; 174 case NOP: o = "NOP" ; break; 175 case ACCEPT_CHUNK: o = "ACCEPT_CHUNK"; break; 176 } 177 b.append("operation", o); 178 b.append("isAOperation", String.valueOf(aOperation)); 179 b.append("isBOperation", String.valueOf(bOperation)); 180 181 return b.toString(); 182 } 183 } | Popular Tags |