AssetInfo.java
3.61 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* javax.jcr.Session
* org.apache.sling.api.resource.Resource
*/
package com.adobe.aem.formsndocuments.transferobjects;
import com.adobe.aem.formsndocuments.util.FMConstants;
import com.adobe.aem.formsndocuments.util.FMUtils;
import com.adobe.aemforms.fm.exception.FormsMgrException;
import javax.jcr.Session;
import org.apache.sling.api.resource.Resource;
public class AssetInfo {
private Resource resource;
private FMConstants.CoreAssetType type;
private String nonFMAssetPublishType;
public AssetInfo(Resource resource, FMConstants.CoreAssetType type) throws FormsMgrException {
if (resource == null) {
Object[] args = new Object[]{"resource", resource};
throw new FormsMgrException("AEM-FMG-700-001", args);
}
this.resource = resource;
this.type = type;
}
public Resource getResource() {
return this.resource;
}
public void setResource(Resource resource) {
this.resource = resource;
}
public FMConstants.CoreAssetType getType() {
return this.type;
}
public void setType(FMConstants.CoreAssetType type) {
this.type = type;
}
public String getNonFMAssetPublishType() {
return this.nonFMAssetPublishType;
}
public void setNonFMAssetType(String nonFMAssetPublishType) {
this.nonFMAssetPublishType = nonFMAssetPublishType;
}
public boolean equals(Object obj) {
if (!(obj instanceof AssetInfo)) {
return false;
}
AssetInfo formInfo = (AssetInfo)obj;
return this.resource.getPath().equals(formInfo.resource.getPath());
}
public String toString() {
return "Form Path : " + this.resource.getPath() + " Form Type : " + (Object)((Object)this.type);
}
public int hashCode() {
return this.resource.getPath().hashCode();
}
public String getPublishAssetType() {
switch (this.type) {
case FORM: {
return "Form Template";
}
case FORMSET: {
return "Form Set";
}
case GUIDE: {
return "Adaptive Form";
}
case PDFFORM: {
return "PDF Form";
}
case PRINTFORM: {
return "Document";
}
case RESOURCE: {
return "Resource";
}
case AFFRAGMENT: {
return "Adaptive Form Fragment";
}
case ADAPTIVEDOCUMENT: {
return "Adaptive Document";
}
case THEME: {
return "Theme";
}
case NONFMASSET: {
if (this.resource.getPath().startsWith("/content/forms/af")) {
return "AF CQ Page";
}
if (this.resource.getPath().startsWith("/etc")) {
return "Theme Clientlib";
}
if ("template".equals(this.nonFMAssetPublishType)) {
return "Adaptive Form Template";
}
if ("contentpolicy".equals(this.nonFMAssetPublishType)) {
return "Content Policy";
}
if (this.nonFMAssetPublishType == null) break;
return this.nonFMAssetPublishType;
}
}
return "Asset";
}
public long getLastModifiedOrCreatedTime(Session session) throws FormsMgrException {
return FMUtils.getLastModifiedOrCreated(session, this.getResource().getPath());
}
}