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 / UpdateRequestHelper.java @ 2715
History | View | Annotate | Download (2.94 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 org.gvsig.tools.dispose.DisposableIterable; |
26 |
import org.gvsig.tools.dispose.DisposeUtils; |
27 |
import org.gvsig.vcsgis.lib.VCSGisEntityEditable; |
28 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
29 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
30 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepositoryData; |
31 |
import org.gvsig.vcsgis.lib.repository.requests.VCSGisUpdateRequest; |
32 |
|
33 |
/**
|
34 |
*
|
35 |
* @author gvSIG Team
|
36 |
*/
|
37 |
public class UpdateRequestHelper extends AbstractRequestHelper implements VCSGisUpdateRequest { |
38 |
|
39 |
private static final String REQUEST_NAME = "Update"; |
40 |
|
41 |
// in
|
42 |
public String entityName; |
43 |
public String revisionCode; |
44 |
|
45 |
// out
|
46 |
public VCSGisEntityEditable entity;
|
47 |
public DisposableIterable<VCSGisRepositoryData> data;
|
48 |
|
49 |
public UpdateRequestHelper(VCSGisRepository repository, String entityName) { |
50 |
super(repository,REQUEST_NAME);
|
51 |
this.entityName = entityName;
|
52 |
this.revisionCode = null; |
53 |
this.entity = null; |
54 |
this.data = null; |
55 |
} |
56 |
|
57 |
@Override
|
58 |
public String getEntityName() { |
59 |
return this.entityName; |
60 |
} |
61 |
|
62 |
@Override
|
63 |
public String getRevisionCode() { |
64 |
return this.revisionCode; |
65 |
} |
66 |
|
67 |
@Override
|
68 |
public void setRevisionCode(String revisionCode) { |
69 |
this.revisionCode = revisionCode;
|
70 |
} |
71 |
|
72 |
@Override
|
73 |
public DisposableIterable<VCSGisRepositoryData> getRepositoryData() {
|
74 |
if (this.data == null) { |
75 |
throw new IllegalStateException("The request needs to be executed before calling this method."); |
76 |
} |
77 |
return this.data; |
78 |
} |
79 |
|
80 |
@Override
|
81 |
public VCSGisEntity getRepositoryEntity() {
|
82 |
if (this.data == null) { |
83 |
throw new IllegalStateException("The request needs to be executed before calling this method."); |
84 |
} |
85 |
return this.entity; |
86 |
} |
87 |
|
88 |
@Override
|
89 |
public void dispose() { |
90 |
super.dispose();
|
91 |
DisposeUtils.disposeQuietly(this.data);
|
92 |
this.data = null; |
93 |
this.entity = null; |
94 |
this.entityName = null; |
95 |
this.revisionCode = null; |
96 |
} |
97 |
|
98 |
} |