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

com.alogic.xscript.plugins.Obj Maven / Gradle / Ivy

There is a newer version: 1.6.17
Show newest version
package com.alogic.xscript.plugins;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.alogic.xscript.ExecuteWatcher;
import com.alogic.xscript.Logiclet;
import com.alogic.xscript.LogicletContext;
import com.anysoft.util.Properties;

/**
 * 在当前文档增加一个对象
 * 
 * @author duanyy
 *
 */
public class Obj extends Segment {
	protected String tag = "data";
	
	public Obj(String tag, Logiclet p) {
		super(tag, p);
	}

	@Override
	public void configure(Properties p){
		super.configure(p);
		
		tag = p.GetValue("tag", tag, false, true);
	}
	
	protected void onExecute(Map root,
			Map current, LogicletContext ctx, ExecuteWatcher watcher) {
		String tagValue = ctx.transform(tag);
		if (StringUtils.isNotEmpty(tagValue)){
			Map template = new HashMap();
			current.put(tagValue, template);
			super.onExecute(root, (Map)template, ctx, watcher);
		}
	}	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy