All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.logicbus.kvalue.xscript.set.KVSUnionStore Maven / Gradle / Ivy

There is a newer version: 1.6.17
Show newest version
package com.logicbus.kvalue.xscript.set;

import java.util.Map;

import com.alogic.xscript.ExecuteWatcher;
import com.alogic.xscript.Logiclet;
import com.alogic.xscript.LogicletContext;
import com.logicbus.kvalue.xscript.KVRowOperation;
import com.anysoft.util.Properties;
import com.anysoft.util.PropertiesConstants;
import com.logicbus.kvalue.core.KeyValueRow;
import com.logicbus.kvalue.core.SetRow;

/**这个命令类似于 SUNION 命令,但它将结果保存到 dstKey 集合,而不是简单地返回结果集。
*如果 dstKey 已经存在,则将其覆盖。
*dstKey 可以是 key 本身。 * * @author zhongyi * */ public class KVSUnionStore extends KVRowOperation { protected String others = ""; protected String dstKey = ""; protected String delimeter = ";"; public KVSUnionStore(String tag, Logiclet p) { super(tag, p); } @Override public void configure(Properties p) { super.configure(p); others = PropertiesConstants.getRaw(p, "others", others); dstKey = PropertiesConstants.getRaw(p, "dstKey", dstKey); delimeter = PropertiesConstants.getRaw(p, "delimeter", delimeter); } @Override protected void onExecute(KeyValueRow row, Map root, Map current, LogicletContext ctx, ExecuteWatcher watcher) { if (row instanceof SetRow) { SetRow r = (SetRow) row; ctx.SetValue(id, String.valueOf(r.unionStore(dstKey, null,ctx.transform(others).split(delimeter)))); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy