Search in sources :

Example 1 with PersistSaveOneAction

use of com.tvd12.calabash.persist.action.PersistSaveOneAction in project calabash by youngmonkeys.

the class SimpleEntityMapPersistExecutor method persist.

@Override
public void persist(EntityMapSetting mapSetting, Object key, Object value) {
    EntityMapPersist mapPersist = getMapPersist(mapSetting);
    if (mapPersist != null) {
        PersistSaveOneAction action = new PersistSaveOneAction(key, value);
        addPersistActionToQueue(mapSetting, action);
    }
}
Also used : EntityMapPersist(com.tvd12.calabash.persist.EntityMapPersist)

Example 2 with PersistSaveOneAction

use of com.tvd12.calabash.persist.action.PersistSaveOneAction in project calabash by youngmonkeys.

the class PersistSaveActionBulk method execute.

@Override
public void execute() {
    Map<Object, Object> keyValues = new HashMap<>();
    for (PersistAction action : actions) {
        if (action.getType() == PersistActionType.SAVE_ONE) {
            PersistSaveOneAction one = (PersistSaveOneAction) action;
            keyValues.put(one.getKey(), one.getValue());
        } else {
            PersistSaveManyAction many = (PersistSaveManyAction) action;
            keyValues.putAll(many.getKeyValues());
        }
    }
    ((EntityMapPersist) mapPersist).persist(keyValues);
}
Also used : PersistSaveManyAction(com.tvd12.calabash.persist.action.PersistSaveManyAction) HashMap(java.util.HashMap) PersistSaveOneAction(com.tvd12.calabash.persist.action.PersistSaveOneAction) EntityMapPersist(com.tvd12.calabash.persist.EntityMapPersist) PersistAction(com.tvd12.calabash.persist.action.PersistAction)

Example 3 with PersistSaveOneAction

use of com.tvd12.calabash.persist.action.PersistSaveOneAction in project calabash by youngmonkeys.

the class PersistSaveActionBulk method execute.

@Override
public void execute() {
    Map keyValues = new HashMap<>();
    for (PersistAction action : actions) {
        if (action.getType() == PersistActionType.SAVE_ONE) {
            PersistSaveOneAction one = (PersistSaveOneAction) action;
            keyValues.put(one.getKey(), one.getValue());
        } else {
            PersistSaveManyAction many = (PersistSaveManyAction) action;
            keyValues.putAll(many.getKeyValues());
        }
    }
    ((BytesMapPersist) mapPersist).persist(keyValues);
}
Also used : PersistSaveManyAction(com.tvd12.calabash.persist.action.PersistSaveManyAction) HashMap(java.util.HashMap) PersistSaveOneAction(com.tvd12.calabash.persist.action.PersistSaveOneAction) PersistAction(com.tvd12.calabash.persist.action.PersistAction) BytesMapPersist(com.tvd12.calabash.persist.BytesMapPersist) Map(java.util.Map) HashMap(java.util.HashMap)

Example 4 with PersistSaveOneAction

use of com.tvd12.calabash.persist.action.PersistSaveOneAction in project calabash by youngmonkeys.

the class SimpleBytesMapPersistExecutor method persist.

@Override
public void persist(MapSetting mapSetting, ByteArray key, byte[] value) {
    BytesMapPersist mapPersist = getMapPersist(mapSetting);
    if (mapPersist != null) {
        PersistSaveOneAction action = new PersistSaveOneAction(key, value);
        addPersistActionToQueue(mapSetting, action);
    }
}
Also used : BytesMapPersist(com.tvd12.calabash.persist.BytesMapPersist)

Aggregations

BytesMapPersist (com.tvd12.calabash.persist.BytesMapPersist)2 EntityMapPersist (com.tvd12.calabash.persist.EntityMapPersist)2 PersistAction (com.tvd12.calabash.persist.action.PersistAction)2 PersistSaveManyAction (com.tvd12.calabash.persist.action.PersistSaveManyAction)2 PersistSaveOneAction (com.tvd12.calabash.persist.action.PersistSaveOneAction)2 HashMap (java.util.HashMap)2 Map (java.util.Map)1