BrightSide Workbench Full Report + Source Code
StandardFolder.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2022 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU Affero General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Affero General Public License for more details.
14
*
15
* You should have received a copy of the GNU Affero General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
package
org.turro.entities;
20
21
import
java.nio.file.Path;
22
import
org.turro.elephant.context.ElephantContext;
23
import
org.turro.file.Folder;
24
import
org.turro.plugin.contacts.IContact;
25
30
public
class
StandardFolder
{
31
32
private
static
final
String
33
PUBLISHABLE =
"/_internal/files"
,
34
INTERNAL =
"/WEB-INF/files"
;
35
36
public
static
Folder
publishable
(String
entityPath
) {
37
return
Folder.from(Path.of(
ElephantContext
.
getRealPath
(PUBLISHABLE),
entityPath
));
38
}
39
40
public
static
Folder
internal
(String
entityPath
) {
41
return
Folder.from(Path.of(
ElephantContext
.
getRealPath
(INTERNAL),
entityPath
));
42
}
43
44
public
static
Folder
publishable
(String
entityPath
, String
folder
) {
45
return
Folder.from(Path.of(
ElephantContext
.
getRealPath
(PUBLISHABLE),
entityPath
,
folder
));
46
}
47
48
public
static
Folder
internal
(String
entityPath
, String
folder
) {
49
return
Folder.from(Path.of(
ElephantContext
.
getRealPath
(INTERNAL),
entityPath
,
folder
));
50
}
51
52
/* Getters */
53
54
public
String
asString
() {
55
return
path;
56
}
57
58
public
Path
asPath
() {
59
return
Path.of(path);
60
}
61
62
public
Folder
asFolder
() {
63
return
Folder.from(path);
64
}
65
66
/* Modifiers */
67
68
public
StandardFolder
real
() {
69
path =
ElephantContext
.
getRealPath
(path);
70
return
this
;
71
}
72
73
public
StandardFolder
entity
(Object
entity
) {
74
if
(
entity
instanceof
IContact
contact)
entity
= contact.getContact();
75
path = path +
Entities
.
getController
(
entity
).
getPath
();
76
return
this
;
77
}
78
79
public
StandardFolder
entityPath
(String
entityPath
) {
80
path = path +
entityPath
;
81
return
this
;
82
}
83
84
public
StandardFolder
folder
(String
folder
) {
85
path = path +
"/"
+
folder
;
86
return
this
;
87
}
88
89
/* Factory */
90
91
public
static
StandardFolder
publishable
() {
92
return
new
StandardFolder
(
"/_internal/files"
);
93
}
94
95
public
static
StandardFolder
internal
() {
96
return
new
StandardFolder
(
"/WEB-INF/files"
);
97
}
98
99
private
String path;
100
101
private
StandardFolder
(String path) {
102
this.path = path;
103
}
104
105
}
org.turro.elephant.context.ElephantContext
Definition:
ElephantContext.java:59
org.turro.elephant.context.ElephantContext.getRealPath
static String getRealPath(String path)
Definition:
ElephantContext.java:115
org.turro.entities.Entities
Definition:
Entities.java:37
org.turro.entities.Entities.getController
static IElephantEntity getController(String path)
Definition:
Entities.java:78
org.turro.entities.StandardFolder
Definition:
StandardFolder.java:30
org.turro.entities.StandardFolder.asString
String asString()
Definition:
StandardFolder.java:54
org.turro.entities.StandardFolder.entityPath
StandardFolder entityPath(String entityPath)
Definition:
StandardFolder.java:79
org.turro.entities.StandardFolder.asFolder
Folder asFolder()
Definition:
StandardFolder.java:62
org.turro.entities.StandardFolder.asPath
Path asPath()
Definition:
StandardFolder.java:58
org.turro.entities.StandardFolder.entity
StandardFolder entity(Object entity)
Definition:
StandardFolder.java:73
org.turro.entities.StandardFolder.publishable
static StandardFolder publishable()
Definition:
StandardFolder.java:91
org.turro.entities.StandardFolder.publishable
static Folder publishable(String entityPath)
Definition:
StandardFolder.java:36
org.turro.entities.StandardFolder.real
StandardFolder real()
Definition:
StandardFolder.java:68
org.turro.entities.StandardFolder.folder
StandardFolder folder(String folder)
Definition:
StandardFolder.java:84
org.turro.entities.StandardFolder.publishable
static Folder publishable(String entityPath, String folder)
Definition:
StandardFolder.java:44
org.turro.entities.IElephantEntity.getPath
String getPath()
org.turro.plugin.contacts.IContact
Definition:
elephant/src/main/java/org/turro/plugin/contacts/IContact.java:33
TurroProjects
Public
Elephant
elephant
src
main
java
org
turro
entities
StandardFolder.java
Generated on Tue Mar 12 2024 07:01:21 for BrightSide by
1.9.1