Package edu.uiuc.ncsa.security.storage
Class GenericStoreUtils
- java.lang.Object
-
- edu.uiuc.ncsa.security.storage.GenericStoreUtils
-
public class GenericStoreUtils extends Object
This is where static generic methods for stores like searches live. These are horribly inefficient but sometimes there is no other way. The intent is that if you need to use these, they are centralized to prevent boiler plating.Created by Jeff Gaynor
on 8/10/21 at 6:38 AM
-
-
Constructor Summary
Constructors Constructor Description GenericStoreUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Identifiable
fromXML(Store store, XMLMap map)
This will convert a map into an object.static void
fromXMLAndSave(Store store, XMLMap map)
static <V extends Identifiable>
List<V>getMostRecent(Store<V> store, int n, List<String> attributes)
static <V extends Identifiable>
List<V>search(Store<V> store, String key, boolean isNull)
static <V extends Identifiable>
List<V>search(Store<V> store, String key, String condition, boolean isRegEx, List<String> attr)
static <V extends Identifiable>
List<V>search(Store<V> store, String key, String condition, boolean isRegEx, List<String> attr, String dateField, Date before, Date after)
static XMLMap
toXML(Store store, Identifiable identifiable)
Convert an identifiable object to anXMLMap
.static <V extends Identifiable>
voidupdate(Store<V> store, List<Identifier> ids, Map<String,Object> values)
Generic implementation ofStore.update(List, Map)
and will loop through the elements doing the update one at a time.
-
-
-
Method Detail
-
search
public static <V extends Identifiable> List<V> search(Store<V> store, String key, String condition, boolean isRegEx, List<String> attr)
-
search
public static <V extends Identifiable> List<V> search(Store<V> store, String key, String condition, boolean isRegEx, List<String> attr, String dateField, Date before, Date after)
-
getMostRecent
public static <V extends Identifiable> List<V> getMostRecent(Store<V> store, int n, List<String> attributes)
-
toXML
public static XMLMap toXML(Store store, Identifiable identifiable)
Convert an identifiable object to anXMLMap
. This is useful for serializing objects in the store, backing them up, etc.- Parameters:
store
-identifiable
-- Returns:
-
fromXML
public static Identifiable fromXML(Store store, XMLMap map)
This will convert a map into an object. You must issue a save separately or if you prefer,fromXMLAndSave(Store, XMLMap)
.- Parameters:
store
-map
-- Returns:
-
update
public static <V extends Identifiable> void update(Store<V> store, List<Identifier> ids, Map<String,Object> values)
Generic implementation ofStore.update(List, Map)
and will loop through the elements doing the update one at a time. If the store has the capability at all for batch processing, implement it. This is for things likeMemoryStore
s andFileStore
s that have no such ability. Note that part of the contract is that the element must exist and an exception is thrown of there is no such element.- Parameters:
store
-ids
-values
-
-
search
public static <V extends Identifiable> List<V> search(Store<V> store, String key, boolean isNull)
-
-