19 package org.turro.entities;
21 import java.util.Collection;
22 import java.util.Collections;
23 import java.util.HashMap;
24 import java.util.Objects;
25 import org.turro.string.Strings;
26 import org.turro.action.IElephantSendable;
27 import org.turro.action.IEntityCtrl;
28 import org.turro.action.Interceptors;
29 import org.turro.action.LinkType;
30 import org.turro.action.Plugins;
31 import org.turro.actor.Actors;
32 import org.turro.auth.Authentication;
33 import org.turro.collections.KeyValueMap;
34 import org.turro.elephant.context.Application;
35 import org.turro.elephant.context.ElephantContext;
36 import org.turro.elephant.context.IConstructor;
37 import org.turro.elephant.direct.AbstractDirectContentCtrl;
38 import org.turro.elephant.security.IUser;
39 import org.turro.file.Folder;
40 import org.turro.jpa.Dao;
41 import org.turro.jpa.entity.EntityWebUrls;
42 import org.turro.marker.MarkerHelper;
43 import org.turro.participation.IParticipationCtrl;
44 import org.turro.participation.ParticipationReason;
45 import org.turro.path.Path;
46 import org.turro.plugin.contacts.IContact;
47 import org.turro.script.Script;
48 import org.turro.script.Scripting;
49 import org.turro.security.ConceptPermission;
109 return path !=
null ?
path.getRoot():
null;
117 return path !=
null ?
path.getPath() :
null;
124 }
else if(
path.getSize() == 2) {
132 return getEntitites(search, maxResults,
new KeyValueMap(
new HashMap()));
136 public Collection
getEntitites(String root, String search,
int maxResults) {
137 return getEntitites(root, search, maxResults,
new KeyValueMap(
new HashMap()));
147 return Collections.EMPTY_LIST;
158 return path !=
null ?
path.getRoot() :
null;
203 if(Strings.isBlank(contextPath)) {
206 if(Strings.isBlank(contextPath)) {
210 if(Strings.isBlank(contextPath)) {
213 if(Strings.isBlank(contextPath)) {
217 return Strings.isBlank(contextPath,
"/");
234 return path.getSize() == 2 &&
path.getNode(1).matches(
"[0-9]+");
282 ((
IEntityCtrl) ctrl).setTemplate(reason.toString().replaceAll(
"_",
"-").toLowerCase());
289 return ctrl !=
null ? ctrl.
parse(constructor) :
"";
295 return ctrl !=
null ? ctrl.
parse(constructor) :
"";
306 set.addAll(iee.getAllChildren());
340 .folder(
"deliverables")
361 hash = 97 * hash + Objects.hashCode(this.path);
373 if (getClass() != obj.getClass()) {
377 if (!Objects.equals(
this.getPath(), other.
getPath())) {
static Parameters parameters(String root)
static< T > T loadImplementation(Class< T > jclass)
static boolean isActorFor(Object entity, String actor)
static IContact getIContact()
static IContact getUser()
static String getEntityWebContext(String path)
String parse(IConstructor constructor)
static Object getControl(String name)
Object getParticipationControl(IConstructor constructor, IContact contact, ParticipationReason reason)
IElephantSendable getSendable()
Collection getEntitites(String search, int maxResults)
boolean isValidLongEntity()
String getReadAllUrl(LinkType type, String contextPath)
IElephantEntity getController(Object entity)
Object getObject(Path entityPath)
Object getControl(String name, IConstructor constructor, IContact contact)
Collection getEntitites(String root, String search, int maxResults)
Object getControl(String name, IContact contact)
boolean isActor(IContact contact, String actor)
abstract Path createPath()
IElephantEntity getController(String entityPath)
Object getControl(String name, String entityPath, IContact contact)
abstract boolean itsMine(Object entity)
String parseFollowCtrl(IConstructor constructor)
String parseSpamCtrl(IConstructor constructor)
boolean isActor(String actor)
boolean itsMine(String rootPath)
boolean hasRelatedRole(EntityRole role, IContact contact)
boolean equals(Object obj)
DefaultElephantEntity(String entityPath)
abstract IElephantEntity createInstance(String entityPath)
Collection< Object > getRelatedByRole(EntityRole role, IContact contact)
IElephantEntity getMain(Object entity)
Object getParticipationControl(IConstructor constructor, ParticipationReason reason)
String getEntityUrl(LinkType type, String contextPath)
abstract IElephantEntity createInstance(Object entity)
ConceptPermission getConceptPermission(String name)
EntitySet getAllChildren()
DefaultElephantEntity(Object entity)
static Folder internal(String entityPath)
static String getUrlFromEntity(Object entity)
static String setObfuscatedPars(String parameters)
Collection< String > getAllowedRoots()
static final String EMPTY_ID
List< IElephantEntity > getChildren()
Object configureCtrl(Object ctrl, IContact contact)
void setReason(ParticipationReason reason)