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

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

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;

/**这个命令的作用和 SDIFF 类似,但它将结果保存到 dstKey 集合,而不是简单地返回结果集。
*如果 dstKey 集合已经存在,则将其覆盖。 *dstKey 可以是 key 本身。 * * @author zhongyi * */ public class KVSDiffStore extends KVRowOperation { protected String others = ""; protected String dstKey = ""; protected String delimeter = ";"; public KVSDiffStore(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.diffStore(dstKey, ctx.transform(others).split(delimeter)))); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy