1 package org.jahia.content; 2 3 import java.util.Map ; 4 5 import org.jahia.exceptions.JahiaException; 6 import java.util.ArrayList ; 7 import java.io.Serializable ; 8 9 21 22 public class ObjectLink implements Serializable { 23 private int ID = -1; 24 private ObjectKey leftObjectKey; 25 private ObjectKey rightObjectKey; 26 private String type; 27 private int status; 28 private java.util.Date creationDate; 29 private String creationUserKey; 30 private java.util.Date lastModificationDate; 31 private String lastModificationUserKey; 32 private java.util.Map leftObjectMetadata; 33 private java.util.Map rightObjectMetadata; 34 private java.util.Map commonMetadata; 35 36 protected ObjectLink (int ID, ObjectKey leftObjectKey, 37 ObjectKey rightObjectKey, 38 String type, int status, java.util.Date creationDate, 39 String creationUserKey, 40 java.util.Date lastModificationDate, 41 String lastModificationUserKey, 42 Map leftObjectMetadata, 43 Map rightObjectMetadata, Map commonMetadata) { 44 this.ID = ID; 45 this.leftObjectKey = leftObjectKey; 46 this.rightObjectKey = rightObjectKey; 47 this.type = type; 48 this.status = status; 49 this.creationDate = creationDate; 50 this.creationUserKey = creationUserKey; 51 this.lastModificationDate = lastModificationDate; 52 this.lastModificationUserKey = lastModificationUserKey; 53 this.leftObjectMetadata = leftObjectMetadata; 54 this.rightObjectMetadata = rightObjectMetadata; 55 this.commonMetadata = commonMetadata; 56 } 57 58 static public ObjectLink createLink (ObjectKey leftObjectKey, 59 ObjectKey rightObjectKey, 60 String type, int status, 61 java.util.Date creationDate, 62 String creationUserKey, 63 java.util.Date lastModificationDate, 64 String lastModificationUserKey, 65 Map leftObjectMetadata, 66 Map rightObjectMetadata, 67 Map commonMetadata) 68 throws JahiaException { 69 ObjectLink link = new ObjectLink( -1, leftObjectKey, rightObjectKey, 70 type, status, creationDate, 71 creationUserKey, 72 lastModificationDate, 73 lastModificationUserKey, 74 leftObjectMetadata, 75 rightObjectMetadata, 76 commonMetadata); 77 ObjectLinkDB.getInstance().createObjectLink(link); 78 return link; 79 } 80 81 static public ObjectLink getLink (int linkID) 82 throws JahiaException { 83 return ObjectLinkDB.getInstance().getObjectLink(linkID); 84 } 85 86 static public ArrayList findByLeftAndRightObjectKeys (ObjectKey leftObjectKey, 87 ObjectKey rightObjectKey) 88 throws JahiaException { 89 return ObjectLinkDB.getInstance().findByLeftAndRightObjectKeys(leftObjectKey, rightObjectKey); 90 } 91 92 static public ArrayList findByLeftObjectKey (ObjectKey leftObjectKey) 93 throws JahiaException { 94 return ObjectLinkDB.getInstance().findByLeftObjectKey(leftObjectKey); 95 } 96 97 static public ArrayList findByRightObjectKey (ObjectKey rightObjectKey) 98 throws JahiaException { 99 return ObjectLinkDB.getInstance().findByRightObjectKey(rightObjectKey); 100 } 101 102 static public ArrayList findByTypeAndLeftAndRightObjectKeys (String type, 103 ObjectKey leftObjectKey, 104 ObjectKey rightObjectKey) 105 throws JahiaException { 106 return ObjectLinkDB.getInstance().findByTypeAndLeftAndRightObjectKeys(type, leftObjectKey, rightObjectKey); 107 } 108 109 static public ArrayList findByTypeAndLeftObjectKey (String type, 110 ObjectKey leftObjectKey) 111 throws JahiaException { 112 return ObjectLinkDB.getInstance().findByTypeAndLeftObjectKey(type, leftObjectKey); 113 } 114 115 static public ArrayList findByTypeAndRightObjectKey (String type, 116 ObjectKey rightObjectKey) 117 throws JahiaException { 118 return ObjectLinkDB.getInstance().findByTypeAndRightObjectKey(type, rightObjectKey); 119 } 120 121 public void save() 122 throws JahiaException { 123 ObjectLinkDB.getInstance().updateObjectLink(this); 124 } 125 126 public void remove() 127 throws JahiaException { 128 ObjectLinkDB.getInstance().removeObjectLink(getID()); 129 } 130 131 protected void setID(int ID) { 132 this.ID = ID; 133 } 134 135 public int getID () { 136 return ID; 137 } 138 139 public ObjectKey getLeftObjectKey () { 140 return leftObjectKey; 141 } 142 143 public void setLeftObjectKey (ObjectKey leftObjectKey) { 144 this.leftObjectKey = leftObjectKey; 145 } 146 147 public ObjectKey getRightObjectKey () { 148 return rightObjectKey; 149 } 150 151 public void setRightObjectKey (ObjectKey rightObjectKey) { 152 this.rightObjectKey = rightObjectKey; 153 } 154 155 public String getType () { 156 return type; 157 } 158 159 public void setType (String type) { 160 this.type = type; 161 } 162 163 public int getStatus () { 164 return status; 165 } 166 167 public void setStatus (int status) { 168 this.status = status; 169 } 170 171 public java.util.Date getCreationDate () { 172 return creationDate; 173 } 174 175 public void setCreationDate (java.util.Date creationDate) { 176 this.creationDate = creationDate; 177 } 178 179 public String getCreationUserKey () { 180 return creationUserKey; 181 } 182 183 public void setCreationUserKey (String creationUserKey) { 184 this.creationUserKey = creationUserKey; 185 } 186 187 public java.util.Date getLastModificationDate () { 188 return lastModificationDate; 189 } 190 191 public void setLastModificationDate (java.util.Date lastModificationDate) { 192 this.lastModificationDate = lastModificationDate; 193 } 194 195 public String getLastModificationUserKey () { 196 return lastModificationUserKey; 197 } 198 199 public void setLastModificationUserKey (String lastModificationUserKey) { 200 this.lastModificationUserKey = lastModificationUserKey; 201 } 202 203 public java.util.Map getLeftObjectMetadata () { 204 return leftObjectMetadata; 205 } 206 207 public java.util.Map getRightObjectMetadata () { 208 return rightObjectMetadata; 209 } 210 211 public java.util.Map getCommonMetadata () { 212 return commonMetadata; 213 } 214 } 215 | Popular Tags |