Package com.priint.pubserver.comet.util
Class ConfigUtils
java.lang.Object
com.priint.pubserver.comet.util.ConfigUtils
The Class ConfigUtils.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionThe default primitive values. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanaddOrUpdateDependency(PluginConfigDataHandler container, String uri, PluginConfigDependencyRestriction restriction) Adds the or update dependency.static voidaddToIndex(PluginConfigDataHandler indexContainer, String uri, String label, PluginConfigDependencyRestriction restriction) Adds the to index.static ObjectCast.static PluginMethodcreateContextRule(String methodName) Creates the context rule.static booleandependencyExists(PluginConfigDataHandler container, String uri) Dependency exists.static ConfigUtils.ObjectFieldFind field.static ConfigUtils.ObjectFieldfindFieldWithValue(Object item, String fieldName, Object value) Find field with value.static StringgetClassesString(Class<?>[] classes) Gets the classes string.static StringgetClassesString(Class<?>[] classes, String delimiter) Gets the classes string.static <T extends Serializable>
PluginConfigDataHandlergetConfigSkeleton(Class<T> clazz) Gets the config skeleton.static <T extends Serializable>
PluginConfigDataHandlergetConfigSkeleton(Class<T> clazz, Map<Class<?>, Object> defaultValues) Gets the config skeleton.static <T extends CometEntity>
TgetEmbeddedEntity(PluginConfigDataHandler container, Class<T> clazz) Get the embedded CometEntity custom configuration from a PluginConfig container.static <T> TgetObjectSkeleton(Class<T> clazz) Gets the object skeleton.static <T> TGets the object skeleton.static <T> TgetObjectSkeleton(Class<T> clazz, Map<Class<?>, Object> defaultValues) Gets the object skeleton.static <T> TinitializeObject(T target) Initialize object.static <T> TInitialize object.static <T> TinitializeObject(T target, Map<Class<?>, Object> defaultValues) Initialize object.static booleanisInSameProject(PluginConfigDataHandler config1, PluginConfigDataHandler config2) Checks if is in same project.static booleanisInSameProject(String path1, String path2) Checks if is in same project.static PluginConfigDataHandlernewPluginConfig(Class<? extends CometEntity> clazz, int newId, String login) New plugin config.static PluginConfigDataHandlernewPluginConfig(Class<? extends CometEntity> clazz, int newId, String login, String rootPath) New plugin config.static PluginConfigDataHandlernewPluginConfig(Class<? extends CometEntity> clazz, int newId, String login, String rootPath, boolean calculatePath) New plugin config.static PluginConfigDataHandlernewPluginConfigNoPath(Class<? extends CometEntity> clazz, int newId, String login) New plugin config no path.static booleanremoveDependency(PluginConfigDataHandler container, String uri) Removes the dependency.static voidremoveFromIndex(PluginConfigDataHandler indexContainer, String uri) Removes the from index.static <T extends CometEntity>
voidsetEmbeddedEntity(PluginConfigDataHandler container, T entity) Sets the embedded entity.
-
Field Details
-
defaultPrimitiveValues
The default primitive values.
-
-
Method Details
-
newPluginConfigNoPath
public static PluginConfigDataHandler newPluginConfigNoPath(Class<? extends CometEntity> clazz, int newId, String login) throws CometException New plugin config no path.- Parameters:
clazz- the classnewId- the new idlogin- the login- Returns:
- the plugin config data handler
- Throws:
CometException- the comet exception
-
newPluginConfig
public static PluginConfigDataHandler newPluginConfig(Class<? extends CometEntity> clazz, int newId, String login) throws CometException New plugin config.- Parameters:
clazz- the classnewId- the new idlogin- the login- Returns:
- the plugin config data handler
- Throws:
CometException- the comet exception
-
newPluginConfig
public static PluginConfigDataHandler newPluginConfig(Class<? extends CometEntity> clazz, int newId, String login, String rootPath) throws CometException New plugin config.- Parameters:
clazz- the classnewId- the new idlogin- the loginrootPath- the root path- Returns:
- the plugin config data handler
- Throws:
CometException- the comet exception
-
newPluginConfig
public static PluginConfigDataHandler newPluginConfig(Class<? extends CometEntity> clazz, int newId, String login, String rootPath, boolean calculatePath) throws CometException New plugin config.- Parameters:
clazz- the classnewId- the new idlogin- the loginrootPath- the root pathcalculatePath- the calculate path- Returns:
- the plugin config data handler
- Throws:
CometException- the comet exception
-
getEmbeddedEntity
public static <T extends CometEntity> T getEmbeddedEntity(PluginConfigDataHandler container, Class<T> clazz) throws CometException Get the embedded CometEntity custom configuration from a PluginConfig container.
We assume, that there is exactly one item of the expected type embedded in this PluginConfig, otherwise an Exception is raised.
- Type Parameters:
T- the generic type- Parameters:
container- the containerclazz- the clazz- Returns:
- the custom configuration embedded in this container
- Throws:
CometException- the comet exception
-
setEmbeddedEntity
public static <T extends CometEntity> void setEmbeddedEntity(PluginConfigDataHandler container, T entity) throws CometException Sets the embedded entity.- Type Parameters:
T- the generic type- Parameters:
container- the containerentity- the entity- Throws:
CometException- the comet exception
-
addOrUpdateDependency
public static boolean addOrUpdateDependency(PluginConfigDataHandler container, String uri, PluginConfigDependencyRestriction restriction) throws CometException Adds the or update dependency.- Parameters:
container- the containeruri- the urirestriction- the restriction- Returns:
- true, if successful
- Throws:
CometException- the comet exception
-
dependencyExists
public static boolean dependencyExists(PluginConfigDataHandler container, String uri) throws CometException Dependency exists.- Parameters:
container- the containeruri- the uri- Returns:
- true, if successful
- Throws:
CometException- the comet exception
-
addToIndex
public static void addToIndex(PluginConfigDataHandler indexContainer, String uri, String label, PluginConfigDependencyRestriction restriction) throws CometException Adds the to index.- Parameters:
indexContainer- the index containeruri- the urilabel- the labelrestriction- the restriction- Throws:
CometException- the comet exception
-
removeFromIndex
public static void removeFromIndex(PluginConfigDataHandler indexContainer, String uri) throws CometException Removes the from index.- Parameters:
indexContainer- the index containeruri- the uri- Throws:
CometException- the comet exception
-
removeDependency
public static boolean removeDependency(PluginConfigDataHandler container, String uri) throws CometException Removes the dependency.- Parameters:
container- the containeruri- the uri- Returns:
- true, if successful
- Throws:
CometException- the comet exception
-
getClassesString
Gets the classes string.- Parameters:
classes- the classes- Returns:
- the classes string
-
getClassesString
Gets the classes string.- Parameters:
classes- the classesdelimiter- the delimiter- Returns:
- the classes string
-
getObjectSkeleton
Gets the object skeleton.- Type Parameters:
T- the generic type- Parameters:
clazz- the class- Returns:
- the object skeleton
-
getObjectSkeleton
Gets the object skeleton.- Type Parameters:
T- the generic type- Parameters:
clazz- the classdefaultValues- the default values- Returns:
- the object skeleton
-
getObjectSkeleton
public static <T> T getObjectSkeleton(Class<T> clazz, List<Class<?>> usedClasses, Map<Class<?>, Object> defaultValues) Gets the object skeleton.- Type Parameters:
T- the generic type- Parameters:
clazz- the classusedClasses- the used classesdefaultValues- the default values- Returns:
- the object skeleton
-
initializeObject
public static <T> T initializeObject(T target) Initialize object.- Type Parameters:
T- the generic type- Parameters:
target- the target- Returns:
- the t
-
initializeObject
Initialize object.- Type Parameters:
T- the generic type- Parameters:
target- the targetdefaultValues- the default values- Returns:
- the t
-
initializeObject
public static <T> T initializeObject(T target, List<Class<?>> usedClasses, Map<Class<?>, Object> defaultValues) Initialize object.- Type Parameters:
T- the generic type- Parameters:
target- the targetusedClasses- the used classesdefaultValues- the default values- Returns:
- the t
-
getConfigSkeleton
Gets the config skeleton.- Type Parameters:
T- the generic type- Parameters:
clazz- the class- Returns:
- the config skeleton
-
getConfigSkeleton
public static <T extends Serializable> PluginConfigDataHandler getConfigSkeleton(Class<T> clazz, Map<Class<?>, Object> defaultValues) Gets the config skeleton.- Type Parameters:
T- the generic type- Parameters:
clazz- the classdefaultValues- the default values- Returns:
- the config skeleton
-
cast
Cast.- Parameters:
target- the targetvalue- the value- Returns:
- the object
-
createContextRule
Creates the context rule.- Parameters:
methodName- the method name- Returns:
- the plugin method
-
findFieldWithValue
public static ConfigUtils.ObjectField findFieldWithValue(Object item, String fieldName, Object value) throws CometException Find field with value.- Parameters:
item- the itemfieldName- the field namevalue- the value- Returns:
- the object field
- Throws:
CometException- the comet exception
-
findField
public static ConfigUtils.ObjectField findField(Object item, String fieldName) throws CometException Find field.- Parameters:
item- the itemfieldName- the field name- Returns:
- the object field
- Throws:
CometException- the comet exception
-
isInSameProject
Checks if is in same project.- Parameters:
path1- the path 1path2- the path 2- Returns:
- true, if is in same project
-
isInSameProject
public static boolean isInSameProject(PluginConfigDataHandler config1, PluginConfigDataHandler config2) Checks if is in same project.- Parameters:
config1- the config 1config2- the config 2- Returns:
- true, if is in same project
-