1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
@Service
public class Service {
private final ShaperRestClient shaperClient;
/**
* Constructor with bean injection.
* @param shaperClient Shaper rest client bean
**/
public Service(final ShaperRestClient shaperClient) {
this.shaperClient = shaperClient;
}
/**
* Gets the page for the given site identifier, resource type, resource identifier, page variation identifier and version.
* @param siteId The site identifier.
* @param resourceType The resource type, "PAGE" if the page isn't link to an external resource.
* @param resourceId The resource identifier, the page identifier if the page isn't link to an external resource.
* @param pageVariationId The page variation identifier, null for the current page variation.
* @param version The page version as "LIVE" or "DRAFT".
* @return a resolved page resource mono.
**/
public Mono<ResolvedPageResource> getPage(final String siteId, final String resourceType, final String resourceId, final String pageVariationId, final String version) {
return shaperClient.pages(siteId)
.types(resourceType)
.id(resourceId)
.getPage(pageVariationId, version, Expandable.PARENTS);
}
/**
* Gets the tenant root page for the given site identifier, tenant identifier, page variation identifier and version.
* @param siteId The site identifier.
* @param tenantId The tenant identifier.
* @param pageVariationId The page variation identifier, null for the current page variation.
* @param version The page version as "LIVE" or "DRAFT".
* @return a resolved page resource mono.
**/
public Mono<ResolvedPageResource> getRootPage(final String siteId, final String tenantId, final String pageVariationId, final String version) {
return shaperClient.pages(siteId)
.tenants(tenantId)
.get(pageVariationId, version, Expandable.PARENT);
}
/**
* Gets the page model for the given site identifier and page model identifier.
* @param siteId The site identifier.
* @param modelId The page model identifier.
* @return a page model resource mono.
**/
public Mono<PageModelResource> getPageModel(final String siteId, final String modelId) {
return shaperClient.models(siteId, modelId)
.get();
}
/**
* Gets the page model for the given site identifier and resource type.
* @param siteId The site identifier.
* @param resourceType The resource type.
* @return a page model resource mono.
**/
public Mono<PageModelResource> getPageModelByResourceType(final String siteId, final String resourceType) {
return shaperClient.resourcesTypes(siteId, resourceType)
.models()
.get();
}
/**
* Gets the page model for the given site identifier, resource type and resource scope.
* @param siteId The site identifier.
* @param resourceType The resource type.
* @param resourceScope The resource scope.
* @return a page model resource mono.
**/
public Mono<PageModelResource> getPageModelByResourceType(final String siteId, final String resourceType, final String resourceScope) {
return shaperClient.resourcesTypes(siteId, resourceType)
.models()
.get(resourceScope);
}
/**
* Gets the page model for the given site identifier, resource type and resource scope.
* @param siteId The site identifier.
* @param applicationContext The application context.
* @return a page model resource mono.
**/
public Mono<PageModelResource> getPageModelByApplicationContext(final String siteId, final String applicationContext) {
return shaperClient.applications(siteId, applicationContext)
.models()
.get();
}
/**
* Gets the page model for the given site identifier, resource type and resource scope.
* @param siteId The site identifier.
* @param applicationContext The application context.
* @param version The page version as "LIVE" or "DRAFT".
* @return a page model resource mono.
**/
public Mono<PageModelResource> getPageModelByApplicationContext(final String siteId, final String applicationContext, final String version) {
return shaperClient.applications(siteId, applicationContext)
.models()
.get(version);
}
}
|