gvsig-projects-pool / org.gvsig.online / trunk / org.gvsig.online / org.gvsig.online.lib / org.gvsig.online.lib.impl / src / main / java / org / gvsig / online / lib / impl / workspace / StoreProperties.java @ 9459
History | View | Annotate | Download (3.2 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.online.lib.impl.workspace; |
24 |
|
25 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
26 |
import org.gvsig.online.lib.api.workingcopy.OnlineWorkingcopy; |
27 |
|
28 |
/**
|
29 |
*
|
30 |
* @author gvSIG Team
|
31 |
*/
|
32 |
public class StoreProperties { |
33 |
|
34 |
private static final String STORE_PROPERTY_WORKSPACE = "ONLINE_WORKSPACE"; |
35 |
private static final String STORE_PROPERTY_ENTITY = "ONLINE_ENTITY"; |
36 |
|
37 |
private static final String STORE_NOT_IN_REMOTE = "STORE_NOT_IN_REMOTE"; |
38 |
|
39 |
public static final int MODE_UNKNOWN = 0; |
40 |
public static final int MODE_ONLINE = 1; |
41 |
public static final int MODE_NOT_ONLINE = 2; |
42 |
|
43 |
public static void set(FeatureStore store, OnlineWorkingcopy workspace, String entityName) { |
44 |
if( store == null ) { |
45 |
return;
|
46 |
} |
47 |
store.setProperty(STORE_PROPERTY_WORKSPACE, workspace.getCode()); |
48 |
store.setProperty(STORE_PROPERTY_ENTITY, entityName); |
49 |
} |
50 |
|
51 |
public static void setNotOnlineMode(FeatureStore store) { |
52 |
if( store == null ) { |
53 |
return;
|
54 |
} |
55 |
store.setProperty(STORE_PROPERTY_WORKSPACE, STORE_NOT_IN_REMOTE); |
56 |
store.setProperty(STORE_PROPERTY_ENTITY, STORE_NOT_IN_REMOTE); |
57 |
} |
58 |
|
59 |
public static void setUnknownOnlineMode(FeatureStore store) { |
60 |
if( store == null ) { |
61 |
return;
|
62 |
} |
63 |
store.setProperty(STORE_PROPERTY_WORKSPACE, null);
|
64 |
store.setProperty(STORE_PROPERTY_ENTITY, null);
|
65 |
} |
66 |
|
67 |
public static int getOnlineMode(FeatureStore store) { |
68 |
String workspace_code = (String) store.getProperty(STORE_PROPERTY_WORKSPACE); |
69 |
if( workspace_code==null ) { |
70 |
// Is unknown if the store is in the Version Control Syetem (VCS)
|
71 |
return MODE_UNKNOWN;
|
72 |
} |
73 |
if( workspace_code.equalsIgnoreCase(STORE_NOT_IN_REMOTE) ) {
|
74 |
// The store is NOT in the Version Control Syetem (VCS)
|
75 |
return MODE_NOT_ONLINE;
|
76 |
} |
77 |
// The store is in the Version Control Syetem (VCS)
|
78 |
return MODE_ONLINE;
|
79 |
} |
80 |
|
81 |
public static String getWorkspaceCode(FeatureStore store) { |
82 |
String workspace_code = (String) store.getProperty(STORE_PROPERTY_WORKSPACE); |
83 |
return workspace_code;
|
84 |
} |
85 |
|
86 |
public static String getEntityName(FeatureStore store) { |
87 |
String entityName = (String) store.getProperty(STORE_PROPERTY_ENTITY); |
88 |
return entityName;
|
89 |
} |
90 |
|
91 |
|
92 |
} |