| skipped 10 lines |
11 | 11 | | import tigase.db.UserNotFoundException; |
12 | 12 | | import tigase.db.UserRepository; |
13 | 13 | | import tigase.form.Field; |
| 14 | + | import tigase.pubsub.AccessModel; |
14 | 15 | | import tigase.pubsub.Affiliation; |
15 | 16 | | import tigase.pubsub.LeafNodeConfig; |
16 | 17 | | import tigase.pubsub.NodeType; |
| skipped 16 lines |
33 | 34 | | private static SecureRandom numberGenerator; |
34 | 35 | | |
35 | 36 | | private static final String SUBSCRIBES_KEY = "subscribers"; |
| 37 | + | |
| 38 | + | private static final String ACCESS_MODEL_KEY = "pubsub#access_model"; |
36 | 39 | | |
37 | 40 | | public static synchronized String createUID() { |
38 | 41 | | SecureRandom ng = numberGenerator; |
| skipped 220 lines |
259 | 262 | | try { |
260 | 263 | | nodeConfig.read(repository, config, NODES_KEY + nodeName + "/configuration"); |
261 | 264 | | if (readChildren) { |
262 | | - | //if (nodeConfig.getNodeType() == NodeType.collection) { |
263 | | - | Field f = Field.fieldTextMulti("pubsub#children", getNodeChildren(nodeName), null); |
264 | | - | nodeConfig.add(f); |
265 | | - | //} |
| 265 | + | // if (nodeConfig.getNodeType() == NodeType.collection) { |
| 266 | + | Field f = Field.fieldTextMulti("pubsub#children", getNodeChildren(nodeName), null); |
| 267 | + | nodeConfig.add(f); |
| 268 | + | // } |
266 | 269 | | } |
267 | 270 | | } catch (Exception e) { |
268 | 271 | | throw new RepositoryException("Node configuration reading error", e); |
| skipped 37 lines |
306 | 309 | | repository.setData(config.getServiceName(), NODES_KEY + nodeName + "/" + ITEMS_KEY + "/" + id, "publisher", publisher); |
307 | 310 | | } catch (Exception e) { |
308 | 311 | | throw new RepositoryException("Item writing error", e); |
| 312 | + | } |
| 313 | + | } |
| 314 | + | |
| 315 | + | public AccessModel getNodeAccessModel(String nodeName) throws RepositoryException { |
| 316 | + | try { |
| 317 | + | // name = repository.getData(config.getServiceName(), |
| 318 | + | // NODES_KEY + nodeName, NODE_TYPE_KEY); |
| 319 | + | String name = repository.getData(config.getServiceName(), NODES_KEY + nodeName + "/configuration/", ACCESS_MODEL_KEY); |
| 320 | + | |
| 321 | + | if (name != null) { |
| 322 | + | return AccessModel.valueOf(name); |
| 323 | + | } else { |
| 324 | + | return null; |
| 325 | + | } |
| 326 | + | } catch (Exception e) { |
| 327 | + | throw new RepositoryException("AccessModel getting error", e); |
309 | 328 | | } |
310 | 329 | | } |
311 | 330 | | } |
| skipped 1 lines |