-
Notifications
You must be signed in to change notification settings - Fork 461
/
ContainerView.java
40 lines (31 loc) · 1.21 KB
/
ContainerView.java
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
package com.dotmarketing.portlets.containers.model;
import com.dotmarketing.beans.Host;
import com.dotmarketing.portlets.containers.business.FileAssetContainerUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
/**
* It is a {@link Container} for UI, it make sure to return the container relative path from {@link ContainerView#host}
*/
@JsonSerialize(using = ContainerViewSerializer.class)
public class ContainerView {
private final Container container;
public ContainerView(final Container container) {
this.container = container;
}
/**
* If {@link ContainerView#container} is a {@link FileAssetContainer} then return the Container relative oath
* If the container is not a {@link FileAssetContainer} then return null.
*
* @return
*/
public String getPath(){
if (FileAssetContainerUtil.getInstance().isFileAssetContainer(container)) {
final FileAssetContainer fileAssetContainer = (FileAssetContainer) container;
return FileAssetContainerUtil.getInstance().getFullPath(fileAssetContainer);
} else {
return null;
}
}
public Container getContainer() {
return container;
}
}