ReverseLiveRelationship.java
5.44 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.cq.launches.api.Launch
* com.day.cq.wcm.msm.api.LiveCopy
* com.day.cq.wcm.msm.api.LiveRelationship
* com.day.cq.wcm.msm.api.LiveStatus
* com.day.cq.wcm.msm.api.RolloutConfig
* com.day.cq.wcm.msm.api.RolloutManager
* com.day.cq.wcm.msm.api.RolloutManager$Trigger
* org.apache.sling.api.resource.Resource
* org.apache.sling.commons.json.JSONException
* org.apache.sling.commons.json.io.JSONWriter
*/
package com.adobe.cq.wcm.launches.impl;
import com.adobe.cq.launches.api.Launch;
import com.day.cq.wcm.msm.api.LiveCopy;
import com.day.cq.wcm.msm.api.LiveRelationship;
import com.day.cq.wcm.msm.api.LiveStatus;
import com.day.cq.wcm.msm.api.RolloutConfig;
import com.day.cq.wcm.msm.api.RolloutManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.io.JSONWriter;
public class ReverseLiveRelationship
implements LiveRelationship {
private final String blueprintPath;
private final String livecopyPath;
private final String syncPath;
private final String sourcePath;
private boolean isSourceExisting;
private final String targetPath;
private boolean isTargetExisting;
private final List<RolloutConfig> reverseRolloutConfigs;
private final boolean isPage;
private Map<String, Boolean> advancedStatus = new HashMap<String, Boolean>();
ReverseLiveRelationship(Launch launch, String sourcePath, boolean isSourceExisting, String targetPath, boolean isTargetExisting, List<RolloutConfig> reverseRolloutConfigs, boolean isPage) {
this.blueprintPath = launch.getRootResource().getPath();
this.syncPath = sourcePath.substring(this.blueprintPath.length());
this.livecopyPath = targetPath.substring(0, targetPath.length() - this.syncPath.length());
this.sourcePath = sourcePath;
this.isSourceExisting = isSourceExisting;
this.targetPath = targetPath;
this.isTargetExisting = isTargetExisting;
this.reverseRolloutConfigs = reverseRolloutConfigs;
this.isPage = isPage;
this.advancedStatus.put("msm:isLaunch", true);
}
public LiveCopy getLiveCopy() {
return new LiveCopy(){
public String getPath() {
return ReverseLiveRelationship.this.livecopyPath;
}
public String getBlueprintPath() {
return ReverseLiveRelationship.this.blueprintPath;
}
public boolean isDeep() {
return false;
}
public boolean isRoot() {
return true;
}
public List<RolloutConfig> getRolloutConfigs() {
return ReverseLiveRelationship.this.reverseRolloutConfigs;
}
public List<RolloutConfig> getRolloutConfigs(RolloutManager.Trigger trigger) {
ArrayList<RolloutConfig> configs = new ArrayList<RolloutConfig>();
if (ReverseLiveRelationship.this.reverseRolloutConfigs != null) {
for (RolloutConfig rc : ReverseLiveRelationship.this.reverseRolloutConfigs) {
if (!trigger.equals((Object)rc.getTrigger())) continue;
configs.add(rc);
}
}
return configs;
}
public boolean isTrigger(RolloutManager.Trigger trigger) {
return true;
}
};
}
public String getSyncPath() {
return this.syncPath;
}
public String getSourcePath() {
return this.sourcePath;
}
public String getTargetPath() {
return this.targetPath;
}
public LiveStatus getStatus() {
return new LiveStatus(){
public boolean isCancelled() {
return false;
}
public boolean isCancelledForChildren() {
return false;
}
public boolean isEditable() {
return false;
}
public boolean isSourceExisting() {
return ReverseLiveRelationship.this.isSourceExisting;
}
public boolean isTargetExisting() {
return ReverseLiveRelationship.this.isTargetExisting;
}
public Map<String, Boolean> getAdvancedStatus() {
return ReverseLiveRelationship.this.advancedStatus;
}
public Boolean getAdvancedStatus(String statusName) {
return false;
}
public boolean isPage() {
return ReverseLiveRelationship.this.isPage;
}
public void write(JSONWriter out) throws JSONException {
}
public List<String> getCanceledProperties() {
return Collections.emptyList();
}
};
}
public List<RolloutConfig> getRolloutConfigs() {
return this.reverseRolloutConfigs;
}
public List<RolloutConfig> getRolloutConfigs(RolloutManager.Trigger trigger) {
return this.getLiveCopy().getRolloutConfigs(trigger);
}
public boolean isTrigger(RolloutManager.Trigger trigger) {
return this.getLiveCopy().isTrigger(trigger);
}
public void write(JSONWriter jsonWriter) throws JSONException {
}
}