2 * Copyright (c) 2011. Electronic Business Systems Ltd
4 package gr.ebs.gss.server.domain;
8 import javax.persistence.Column;
9 import javax.persistence.Entity;
10 import javax.persistence.Id;
11 import javax.persistence.Temporal;
12 import javax.persistence.TemporalType;
13 import javax.persistence.Version;
15 import org.hibernate.annotations.CollectionOfElements;
16 import org.hibernate.annotations.IndexColumn;
18 import com.bradmcevoy.http.LockInfo;
19 import com.bradmcevoy.http.LockTimeout;
20 import com.bradmcevoy.http.LockToken;
21 import com.bradmcevoy.http.LockInfo.LockDepth;
22 import com.bradmcevoy.http.LockInfo.LockScope;
23 import com.bradmcevoy.http.LockInfo.LockType;
31 public class FileLock {
34 public String lockedByUser;
35 @Temporal(TemporalType.TIMESTAMP)
36 @Column(name="from_date")
40 public LockScope scope;
42 public LockDepth depth;
46 @IndexColumn(name="secId")
55 // TODO Auto-generated constructor stub
58 public FileLock(String id,LockToken token){
60 this.tokenId=token.tokenId;
62 this.depth=token.info.depth;
63 this.scope=token.info.scope;
64 this.type=token.info.type;
65 this.lockedByUser=token.info.lockedByUser;
67 if(token.timeout!=null){
68 this.seconds=token.timeout.getSeconds();
69 this.otherSeconds=token.timeout.getOtherSeconds();
71 this.from=token.getFrom();
75 public LockToken toToken(){
76 LockToken res = new LockToken();
78 LockInfo info = new LockInfo(scope,type,lockedByUser,depth);
79 LockTimeout timeout = new LockTimeout(seconds);
92 public String getId() {
100 * @param id the id to set
102 public void setId(String id) {
108 * Retrieve the lockedByUser.
110 * @return the lockedByUser
112 public String getLockedByUser() {
118 * Modify the lockedByUser.
120 * @param lockedByUser the lockedByUser to set
122 public void setLockedByUser(String lockedByUser) {
123 this.lockedByUser = lockedByUser;
132 public Date getFrom() {
140 * @param from the from to set
142 public void setFrom(Date from) {
148 * Retrieve the tokenId.
150 * @return the tokenId
152 public String getTokenId() {
158 * Modify the tokenId.
160 * @param tokenId the tokenId to set
162 public void setTokenId(String tokenId) {
163 this.tokenId = tokenId;
168 * Retrieve the scope.
172 public LockScope getScope() {
180 * @param scope the scope to set
182 public void setScope(LockScope scope) {
192 public LockType getType() {
200 * @param type the type to set
202 public void setType(LockType type) {
208 * Retrieve the depth.
212 public LockDepth getDepth() {
220 * @param depth the depth to set
222 public void setDepth(LockDepth depth) {
228 * Retrieve the seconds.
230 * @return the seconds
232 public Long getSeconds() {
238 * Modify the seconds.
240 * @param seconds the seconds to set
242 public void setSeconds(Long seconds) {
243 this.seconds = seconds;
248 * Retrieve the otherSeconds.
250 * @return the otherSeconds
252 public Long[] getOtherSeconds() {
258 * Modify the otherSeconds.
260 * @param otherSeconds the otherSeconds to set
262 public void setOtherSeconds(Long[] otherSeconds) {
263 this.otherSeconds = otherSeconds;