Clover icon

Magnolia REST Content Delivery 2.1

  1. Project Clover database Fri Mar 16 2018 18:21:08 CET
  2. Package info.magnolia.rest.delivery.jcr.v1

File WorkspaceParameters.java

 

Code metrics

0
0
0
1
163
72
0
-
-
0
-
100% of code in this file is excluded from these metrics.

Classes

Class Line # Actions
WorkspaceParameters 48 0 100% 0 0
-1.0 -
 

Contributing tests

This file is covered by 3 tests. .

Source view

1    /**
2    * This file Copyright (c) 2017-2018 Magnolia International
3    * Ltd. (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10    * This file is distributed in the hope that it will be
11    * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12    * implied warranty of MERCHANTABILITY or FITNESS FOR A
13    * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14    * Redistribution, except as permitted by whichever of the GPL
15    * or MNA you select, is prohibited.
16    *
17    * 1. For the GPL license (GPL), you can redistribute and/or
18    * modify this file under the terms of the GNU General
19    * Public License, Version 3, as published by the Free Software
20    * Foundation. You should have received a copy of the GNU
21    * General Public License, Version 3 along with this program;
22    * if not, write to the Free Software Foundation, Inc., 51
23    * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24    *
25    * 2. For the Magnolia Network Agreement (MNA), this file
26    * and the accompanying materials are made available under the
27    * terms of the MNA which accompanies this distribution, and
28    * is available at http://www.magnolia-cms.com/mna.html
29    *
30    * Any modifications to this file must keep this entire header
31    * intact.
32    *
33    */
34    package info.magnolia.rest.delivery.jcr.v1;
35   
36    import info.magnolia.jcr.util.NodeTypes;
37    import info.magnolia.rest.reference.ReferenceDefinition;
38   
39    import java.util.ArrayList;
40    import java.util.Collections;
41    import java.util.List;
42   
43    /**
44    * Default parameters for a specific workspace, for use by the JCR delivery endpoint.
45    * @deprecated since 2.1, consider to use {@link info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpoint} with embedded configuration.
46    */
47    @Deprecated
 
48    public class WorkspaceParameters {
49   
50    private String workspace;
51    private String rootPath;
52    private int depth = 0;
53    private boolean includeSystemProperties = true;
54    private List<String> nodeTypes = Collections.singletonList(NodeTypes.Content.NAME);
55    private List<String> childNodeTypes = Collections.singletonList(NodeTypes.ContentNode.NAME);
56    private long limit = 10;
57    private boolean bypassWorkspaceAcls = false;
58    private List<ReferenceDefinition> references = new ArrayList<>();
59   
60    /**
61    * Defines the target workspace to serve content from.
62    *
63    * @return a logical workspace name; if empty the {@link JcrDeliveryEndpoint} will try to use the workspace-params key
64    * as both endpoint prefix and workspace name.
65    */
 
66    toggle public String getWorkspace() {
67    return workspace;
68    }
69   
 
70    toggle public void setWorkspace(String workspace) {
71    this.workspace = workspace;
72    }
73   
74    /**
75    * Defines the root path used to resolve the given node path parameter, and to execute queries.
76    */
 
77    toggle public String getRootPath() {
78    return rootPath;
79    }
80   
 
81    toggle public void setRootPath(String rootPath) {
82    this.rootPath = rootPath;
83    }
84   
85    /**
86    * Defines the depth for child-nodes to be included in the responses.
87    *
88    * @return the depth, relative to result nodes; by default, child-nodes are not included.
89    */
 
90    toggle public int getDepth() {
91    return depth;
92    }
93   
 
94    toggle public void setDepth(int depth) {
95    this.depth = depth;
96    }
97   
98    /**
99    * Defines whether jcr:—and mgnl:-prefixed properties will be included in responses.
100    *
101    * @return false by default.
102    */
 
103    toggle public boolean isIncludeSystemProperties() {
104    return includeSystemProperties;
105    }
106   
 
107    toggle public void setIncludeSystemProperties(boolean includeSystemProperties) {
108    this.includeSystemProperties = includeSystemProperties;
109    }
110   
 
111    toggle public List<String> getNodeTypes() {
112    return nodeTypes;
113    }
114   
 
115    toggle public void setNodeTypes(List<String> nodeTypes) {
116    this.nodeTypes = nodeTypes;
117    }
118   
 
119    toggle public List<String> getChildNodeTypes() {
120    return childNodeTypes;
121    }
122   
 
123    toggle public void setChildNodeTypes(List<String> childNodeTypes) {
124    this.childNodeTypes = childNodeTypes;
125    }
126   
127    /**
128    * Defines the amount of results to return in a paginated result set.
129    *
130    * @return 10 by default
131    */
 
132    toggle public long getLimit() {
133    return limit;
134    }
135   
 
136    toggle public void setLimit(long limit) {
137    this.limit = limit;
138    }
139   
140    /**
141    * Defines whether or not workspace permissions (ACLs) should be evaluated.
142    *
143    * <p>This may be used to serve all content for the given workspace params to anonymous users;
144    * until relevant JCR permissions for the anonymous user are set up.<br/>
145    * Mind however that URI permissions are still evaluated.
146    * The <em>rest-anonymous</em> role has a GET permission to '/.rest/delivery/*'.
147    */
 
148    toggle public boolean isBypassWorkspaceAcls() {
149    return bypassWorkspaceAcls;
150    }
151   
 
152    toggle public void setBypassWorkspaceAcls(boolean bypassWorkspaceAcls) {
153    this.bypassWorkspaceAcls = bypassWorkspaceAcls;
154    }
155   
 
156    toggle public List<ReferenceDefinition> getReferences() {
157    return references;
158    }
159   
 
160    toggle public void setReferences(List<ReferenceDefinition> references) {
161    this.references = references;
162    }
163    }