gvsig-projects-pool / org.gvsig.vcsgis / trunk / org.gvsig.vcsgis / org.gvsig.vcsgis.lib / org.gvsig.vcsgis.lib.impl / src / main / java / org / gvsig / vcsgis / lib / requests / CheckoutRequestHelper.java @ 3315
History | View | Annotate | Download (3.67 KB)
1 |
/*
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2020 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18 |
*
|
19 |
* For any additional information, do not hesitate to contact us
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
21 |
*/
|
22 |
|
23 |
package org.gvsig.vcsgis.lib.requests; |
24 |
|
25 |
import java.sql.Timestamp; |
26 |
import org.gvsig.tools.dataTypes.DataTypeUtils; |
27 |
import org.gvsig.tools.dispose.DisposableIterable; |
28 |
import org.gvsig.tools.dispose.DisposeUtils; |
29 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
30 |
import org.gvsig.vcsgis.lib.VCSGisEntityEditable; |
31 |
import org.gvsig.vcsgis.lib.repository.requests.VCSGisCheckoutRequest; |
32 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
33 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepositoryData; |
34 |
|
35 |
/**
|
36 |
*
|
37 |
* @author gvSIG Team
|
38 |
*/
|
39 |
public class CheckoutRequestHelper extends AbstractRequestHelper implements VCSGisCheckoutRequest { |
40 |
|
41 |
private static final String REQUEST_NAME = "Checkout"; |
42 |
|
43 |
// in
|
44 |
public String entityName; |
45 |
public String repositoryRevisionCode; |
46 |
public Timestamp efectiveDate; |
47 |
|
48 |
// out
|
49 |
public VCSGisEntityEditable entity;
|
50 |
public DisposableIterable<VCSGisRepositoryData> data;
|
51 |
public String usersHashCode; |
52 |
public String topologyPlansHashCode; |
53 |
|
54 |
public CheckoutRequestHelper(VCSGisRepository repository, String entityName) { |
55 |
super(repository, REQUEST_NAME);
|
56 |
this.entityName = entityName;
|
57 |
this.entity = null; |
58 |
this.data = null; |
59 |
} |
60 |
|
61 |
@Override
|
62 |
public Timestamp getEfectiveDate() { |
63 |
return this.efectiveDate; |
64 |
} |
65 |
|
66 |
@Override
|
67 |
public void setEfectiveDate(Timestamp efectiveDate) { |
68 |
this.efectiveDate = efectiveDate;
|
69 |
} |
70 |
|
71 |
@Override
|
72 |
public void setEfectiveDate(String efectiveDate) { |
73 |
Timestamp tms = (Timestamp) DataTypeUtils.toTimestamp(efectiveDate, null); |
74 |
this.efectiveDate = tms;
|
75 |
} |
76 |
|
77 |
@Override
|
78 |
public String getRevisionCode() { |
79 |
return this.repositoryRevisionCode; |
80 |
} |
81 |
|
82 |
@Override
|
83 |
public void setRevisionCode(String revisionCode) { |
84 |
this.repositoryRevisionCode = revisionCode;
|
85 |
} |
86 |
|
87 |
@Override
|
88 |
public String getEntityName() { |
89 |
return this.entityName; |
90 |
} |
91 |
|
92 |
@Override
|
93 |
public DisposableIterable<VCSGisRepositoryData> getData() {
|
94 |
if (this.data == null) { |
95 |
throw new IllegalStateException("The request needs to be executed before calling this method."); |
96 |
} |
97 |
return this.data; |
98 |
} |
99 |
|
100 |
@Override
|
101 |
public VCSGisEntity getEntity() {
|
102 |
if (this.data == null) { |
103 |
throw new IllegalStateException("The request needs to be executed before calling this method."); |
104 |
} |
105 |
return this.entity; |
106 |
} |
107 |
|
108 |
@Override
|
109 |
public String getUsersHashCode() { |
110 |
return this.usersHashCode; |
111 |
} |
112 |
|
113 |
@Override
|
114 |
public String getTopologyPlansHashCode() { |
115 |
return this.topologyPlansHashCode; |
116 |
} |
117 |
|
118 |
@Override
|
119 |
public void dispose() { |
120 |
super.dispose();
|
121 |
DisposeUtils.disposeQuietly(this.data);
|
122 |
this.data = null; |
123 |
this.entity = null; |
124 |
this.entityName = null; |
125 |
} |
126 |
|
127 |
} |