package xin.glue.ui.common; import com.posdata.glue.PosException; import com.posdata.glue.biz.activity.PosActivity; import com.posdata.glue.biz.constants.PosBizControlConstants; import com.posdata.glue.context.PosContext; public class PosSelectBranch extends PosActivity { public String runActivity(PosContext ctx) { if (getProperty("values") == null || getProperty("param") == null) throw new PosException("Property configuring error!\nProperty: branches, values, param."); String[] params = (String[])ctx.get(getProperty("param").trim()); if (params == null) return PosBizControlConstants.SUCCESS; String value = params[0]; String[] values = getProperty("values").trim().split("\\|"); String[] branches; if (getProperty("branches") != null) branches = getProperty("branches").trim().split("\\|"); else branches = values; int length = (branches.length < values.length)? values.length : branches.length; for (int i = 0; i < length; i++) { if (values[i].equalsIgnoreCase(value)) { logger.logDebug(value); return value; } } return PosBizControlConstants.SUCCESS; } }