606613b43ddca73b856b3167fea3e9cdd38aa584.svn-base 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. package xin.glue.ui.common;
  2. import com.posdata.glue.PosException;
  3. import com.posdata.glue.biz.activity.PosActivity;
  4. import com.posdata.glue.biz.constants.PosBizControlConstants;
  5. import com.posdata.glue.context.PosContext;
  6. public class PosSelectBranch extends PosActivity {
  7. public String runActivity(PosContext ctx) {
  8. if (getProperty("values") == null ||
  9. getProperty("param") == null)
  10. throw new PosException("Property configuring error!\nProperty: branches, values, param.");
  11. String[] params = (String[])ctx.get(getProperty("param").trim());
  12. if (params == null)
  13. return PosBizControlConstants.SUCCESS;
  14. String value = params[0];
  15. String[] values = getProperty("values").trim().split("\\|");
  16. String[] branches;
  17. if (getProperty("branches") != null)
  18. branches = getProperty("branches").trim().split("\\|");
  19. else branches = values;
  20. int length = (branches.length < values.length)? values.length : branches.length;
  21. for (int i = 0; i < length; i++) {
  22. if (values[i].equalsIgnoreCase(value)) {
  23. logger.logDebug(value);
  24. return value;
  25. }
  26. }
  27. return PosBizControlConstants.SUCCESS;
  28. }
  29. }