19 package org.turro.file.util;
22 import java.util.ArrayList;
23 import java.util.List;
24 import org.turro.annotation.ElephantControl;
25 import org.turro.elephant.context.ElephantContext;
26 import org.turro.elephant.context.IConstructor;
27 import org.turro.elephant.impl.repository.Repository;
28 import org.turro.entities.Controls;
34 @ElephantControl(name=Controls.CTRL_FILES)
37 private final String entityPath;
40 this.entityPath = entityPath;
44 return "/_internal/files" + entityPath;
48 return new Repository(constructor, getPublishable());
52 return "/WEB-INF/files" + entityPath;
56 return new Repository(constructor, getPrivate());
60 return getPublicFile(file,
true);
64 return getFile(getPublishable(), file, withContext);
68 return getFiles(getPublishable());
71 public String
getFile(String folder, String file) {
72 return getFile(folder, file,
true);
75 public String
getFile(String folder, String file,
boolean withContext) {
84 return getFiles(folder,
true);
87 public List<String>
getFiles(String folder,
boolean withContext) {
89 List<String> files =
new ArrayList<>();
91 for(File f : root.listFiles()) {
101 return getImageFiles(folder,
true);
106 List<PairedFile> files =
new ArrayList<>();
108 for(File f : root.listFiles()) {
125 public static String
getPrivate(String entityPath, String file) {
static String getRealPath(String path)
static String getRootWebPath()
List< String > getFiles(String folder)
List< String > getPublicFiles()
String getPublicFile(String file, boolean withContext)
List< PairedFile > getImageFiles(String folder)
String getPublicFile(String file)
String getFile(String folder, String file, boolean withContext)
String getFile(String folder, String file)
static List< PairedFile > getPublishableImages(String entityPath, String file)
Repository getPrivateRepository(IConstructor constructor)
Repository getPublishableRepository(IConstructor constructor)
static String getPublishable(String entityPath, String file)
List< String > getFiles(String folder, boolean withContext)
FileAttach(String entityPath)
static String getPrivate(String entityPath, String file)
static List< String > getPublishableFiles(String entityPath, String file)
List< PairedFile > getImageFiles(String folder, boolean withContext)