Search in sources :

Example 1 with StrategyMapItemsVO

use of com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO in project bamboobsc by billchen198318.

the class LoadStrategyMapItemsForRecCommand method fillStrategyMapItems.

private StrategyMapItemsVO fillStrategyMapItems(VisionVO vision, Context context) throws ServiceException, Exception {
    StrategyMapItemsVO mapItems = new StrategyMapItemsVO();
    int w = 190;
    StrategyMapVO map = new StrategyMapVO();
    map.setVisId(vision.getVisId());
    DefaultResult<StrategyMapVO> smResult = this.strategyMapService.findByUK(map);
    if (smResult.getValue() == null) {
        this.setMessage(context, smResult.getSystemMessage().getValue());
        return mapItems;
    }
    map = smResult.getValue();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("masterOid", map.getOid());
    List<BbStrategyMapNodes> nodes = this.strategyMapNodesService.findListByParams(params);
    List<BbStrategyMapConns> conns = this.strategyMapConnsService.findListByParams(params);
    for (int i = 0; nodes != null && i < nodes.size(); i++) {
        BbStrategyMapNodes node = nodes.get(i);
        String div = "<div class=\"w\" id=\"" + node.getId() + "\">" + node.getText() + "<div class=\"ep\"></div></div>";
        String css = "#" + node.getId() + " { left:" + node.getPositionX() + "px; top:" + node.getPositionY() + "px; width:" + w + "px; }";
        mapItems.getDiv().add(div);
        mapItems.getCss().add(css);
    }
    for (int i = 0; conns != null && i < conns.size(); i++) {
        BbStrategyMapConns conn = conns.get(i);
        mapItems.getCon().add("{ source:\"" + conn.getSourceId() + "\", target:\"" + conn.getTargetId() + "\" }");
    }
    return mapItems;
}
Also used : BbStrategyMapConns(com.netsteadfast.greenstep.po.hbm.BbStrategyMapConns) StrategyMapItemsVO(com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO) HashMap(java.util.HashMap) StrategyMapVO(com.netsteadfast.greenstep.vo.StrategyMapVO) BbStrategyMapNodes(com.netsteadfast.greenstep.po.hbm.BbStrategyMapNodes)

Example 2 with StrategyMapItemsVO

use of com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO in project bamboobsc by billchen198318.

the class LoadStrategyMapItemsForNewCommand method fillStrategyMapItems.

private StrategyMapItemsVO fillStrategyMapItems(VisionVO vision) throws Exception {
    StrategyMapItemsVO mapItems = new StrategyMapItemsVO();
    int w = 190;
    int top = 10;
    for (PerspectiveVO perspective : vision.getPerspectives()) {
        int left = 10;
        for (ObjectiveVO objective : perspective.getObjectives()) {
            String idName = objective.getObjId();
            /**
				 * 1em = 16px
				 * 
				 * <div class="w" id="phone1">PHONE INTERVIEW 1<div class="ep"></div></div>
				 * #phone1 { left:35em; top:12em; width:7em; }
				 * 
				 */
            String div = "<div class=\"w\" id=\"" + idName + "\">" + objective.getName() + "<div class=\"ep\"></div></div>";
            String css = "#" + idName + " { left:" + left + "px; top:" + top + "px; width:" + w + "px; }";
            mapItems.getDiv().add(div);
            mapItems.getCss().add(css);
            left += (w + 80);
        }
        top += 120;
    }
    return mapItems;
}
Also used : StrategyMapItemsVO(com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO)

Example 3 with StrategyMapItemsVO

use of com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO in project bamboobsc by billchen198318.

the class IndexAction method loadRecord.

@SuppressWarnings("unchecked")
private void loadRecord() throws ControllerException, ServiceException, Exception {
    String visionOid = this.getFields().get("visionOid");
    if (super.isNoSelectId(visionOid)) {
        return;
    }
    Context context = new ContextBase();
    context.put("visionOid", visionOid);
    SimpleChain chain = new SimpleChain();
    ChainResultObj resultObj = chain.getResultFromResource("strategyMapItemsForRecChain", context);
    this.setPageMessage(resultObj.getMessage());
    if (resultObj.getValue() instanceof StrategyMapItemsVO) {
        this.divItems = ((StrategyMapItemsVO) resultObj.getValue()).getDiv();
        this.cssItems = ((StrategyMapItemsVO) resultObj.getValue()).getCss();
        this.conItems = ((StrategyMapItemsVO) resultObj.getValue()).getCon();
    }
}
Also used : Context(org.apache.commons.chain.Context) StrategyMapItemsVO(com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO) ChainResultObj(com.netsteadfast.greenstep.base.model.ChainResultObj) SimpleChain(com.netsteadfast.greenstep.base.chain.SimpleChain) ContextBase(org.apache.commons.chain.impl.ContextBase)

Example 4 with StrategyMapItemsVO

use of com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO in project bamboobsc by billchen198318.

the class LoadStrategyMapItemsForNewCommand method execute.

@Override
public boolean execute(Context context) throws Exception {
    if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
        return false;
    }
    BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
    String visionOid = (String) context.get("visionOid");
    VisionVO vision = null;
    for (VisionVO obj : treeObj.getVisions()) {
        if (obj.getOid().equals(visionOid)) {
            vision = obj;
        }
    }
    StrategyMapItemsVO mapItems = this.fillStrategyMapItems(vision);
    this.setResult(context, mapItems);
    return false;
}
Also used : StrategyMapItemsVO(com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 5 with StrategyMapItemsVO

use of com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO in project bamboobsc by billchen198318.

the class LoadStrategyMapItemsForRecCommand method execute.

@Override
public boolean execute(Context context) throws ServiceException, Exception {
    if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
        return false;
    }
    BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
    String visionOid = (String) context.get("visionOid");
    VisionVO vision = null;
    for (VisionVO obj : treeObj.getVisions()) {
        if (obj.getOid().equals(visionOid)) {
            vision = obj;
        }
    }
    StrategyMapItemsVO mapItems = this.fillStrategyMapItems(vision, context);
    this.setResult(context, mapItems);
    return false;
}
Also used : StrategyMapItemsVO(com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Aggregations

StrategyMapItemsVO (com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO)7 SimpleChain (com.netsteadfast.greenstep.base.chain.SimpleChain)3 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)3 Context (org.apache.commons.chain.Context)3 ControllerException (com.netsteadfast.greenstep.base.exception.ControllerException)2 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)2 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)2 BbStrategyMapConns (com.netsteadfast.greenstep.po.hbm.BbStrategyMapConns)1 BbStrategyMapNodes (com.netsteadfast.greenstep.po.hbm.BbStrategyMapNodes)1 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)1 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)1 StrategyMapVO (com.netsteadfast.greenstep.vo.StrategyMapVO)1 HashMap (java.util.HashMap)1 ContextBase (org.apache.commons.chain.impl.ContextBase)1