Search in sources :

Example 1 with BbWorkspaceLabel

use of com.netsteadfast.greenstep.po.hbm.BbWorkspaceLabel in project bamboobsc by billchen198318.

the class WorkspaceLogicServiceImpl method delete.

@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(String workspaceOid) throws ServiceException, Exception {
    if (super.isBlank(workspaceOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    WorkspaceVO workspace = new WorkspaceVO();
    workspace.setOid(workspaceOid);
    DefaultResult<WorkspaceVO> oldResult = this.workspaceService.findObjectByOid(workspace);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    workspace = oldResult.getValue();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("spaceId", workspace.getSpaceId());
    List<BbWorkspaceConfig> configs = this.workspaceConfigService.findListByParams(params);
    List<BbWorkspaceLabel> labels = this.workspaceLabelService.findListByParams(params);
    for (int i = 0; configs != null && i < configs.size(); i++) {
        BbWorkspaceConfig config = configs.get(i);
        this.workspaceConfigService.delete(config);
    }
    for (int i = 0; labels != null && i < labels.size(); i++) {
        BbWorkspaceLabel label = labels.get(i);
        this.workspaceLabelService.delete(label);
    }
    return workspaceService.deleteObject(workspace);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) BbWorkspaceLabel(com.netsteadfast.greenstep.po.hbm.BbWorkspaceLabel) WorkspaceVO(com.netsteadfast.greenstep.vo.WorkspaceVO) BbWorkspaceConfig(com.netsteadfast.greenstep.po.hbm.BbWorkspaceConfig) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with BbWorkspaceLabel

use of com.netsteadfast.greenstep.po.hbm.BbWorkspaceLabel in project bamboobsc by billchen198318.

the class WorkspaceUtils method setTitle.

private static void setTitle(BbWorkspaceConfig config, Map<String, Object> templateParameters) throws ServiceException, Exception {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("spaceId", config.getSpaceId());
    params.put("position", config.getPosition());
    List<BbWorkspaceLabel> labels = workspaceLabelService.findListByParams(params);
    if (labels == null || labels.size() < 1) {
        return;
    }
    for (BbWorkspaceLabel label : labels) {
        templateParameters.put("title", label.getLabel());
    }
}
Also used : HashMap(java.util.HashMap) BbWorkspaceLabel(com.netsteadfast.greenstep.po.hbm.BbWorkspaceLabel)

Aggregations

BbWorkspaceLabel (com.netsteadfast.greenstep.po.hbm.BbWorkspaceLabel)2 HashMap (java.util.HashMap)2 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)1 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)1 BbWorkspaceConfig (com.netsteadfast.greenstep.po.hbm.BbWorkspaceConfig)1 WorkspaceVO (com.netsteadfast.greenstep.vo.WorkspaceVO)1 Transactional (org.springframework.transaction.annotation.Transactional)1