Search in sources :

Example 1 with OlapCatalogVO

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

the class AnalyticsMDXLogicServiceImpl method update.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<OlapMdxVO> update(OlapMdxVO olapMdx, String configOid, String catalogOid) throws ServiceException, Exception {
    if (null == olapMdx || super.isNoSelectId(configOid) || super.isNoSelectId(catalogOid) || super.isBlank(olapMdx.getName()) || super.isBlank(olapMdx.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<OlapMdxVO> oldResult = this.olapMdxService.findObjectByOid(olapMdx);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    // 查資料是否存在
    OlapConfVO config = this.loadOlapConfig(configOid);
    // 查資料是否存在
    OlapCatalogVO catalog = this.loadOlapCatalog(catalogOid);
    olapMdx.setConfOid(config.getOid());
    olapMdx.setCatalogOid(catalog.getOid());
    if (olapMdx.getName().equals(oldResult.getValue().getName()) && !olapMdx.getOid().equals(oldResult.getValue().getOid())) {
        // 存在別筆資料但UK相同 , 所以不能 UPDATE
        throw new ServiceException("Please change another name!");
    }
    oldResult.getValue().setExpression(null);
    // 先把BLOB 資料清掉
    this.olapMdxService.updateObject(oldResult.getValue());
    return this.olapMdxService.updateObject(olapMdx);
}
Also used : OlapConfVO(com.netsteadfast.greenstep.vo.OlapConfVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OlapCatalogVO(com.netsteadfast.greenstep.vo.OlapCatalogVO) OlapMdxVO(com.netsteadfast.greenstep.vo.OlapMdxVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with OlapCatalogVO

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

the class AnalyticsMDXLogicServiceImpl method create.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<OlapMdxVO> create(OlapMdxVO olapMdx, String configOid, String catalogOid) throws ServiceException, Exception {
    if (null == olapMdx || super.isNoSelectId(configOid) || super.isNoSelectId(catalogOid) || super.isBlank(olapMdx.getName())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    // 查資料是否存在
    OlapConfVO config = this.loadOlapConfig(configOid);
    // 查資料是否存在
    OlapCatalogVO catalog = this.loadOlapCatalog(catalogOid);
    olapMdx.setConfOid(config.getOid());
    olapMdx.setCatalogOid(catalog.getOid());
    return this.olapMdxService.saveObject(olapMdx);
}
Also used : OlapConfVO(com.netsteadfast.greenstep.vo.OlapConfVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OlapCatalogVO(com.netsteadfast.greenstep.vo.OlapCatalogVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with OlapCatalogVO

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

the class AnalyticsMDXLogicServiceImpl method loadOlapCatalog.

private OlapCatalogVO loadOlapCatalog(String oid) throws ServiceException, Exception {
    OlapCatalogVO catalog = new OlapCatalogVO();
    catalog.setOid(oid);
    DefaultResult<OlapCatalogVO> result = this.olapCatalogService.findObjectByOid(catalog);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    catalog = result.getValue();
    return catalog;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OlapCatalogVO(com.netsteadfast.greenstep.vo.OlapCatalogVO)

Example 4 with OlapCatalogVO

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

the class AnalyticsCatalogSaveOrUpdateAction method update.

private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    this.checkUploadCatalog();
    OlapCatalogVO olapCatalog = new OlapCatalogVO();
    this.transformFields2ValueObject(olapCatalog, new String[] { "oid", "id", "name", "description" });
    DefaultResult<OlapCatalogVO> result = this.analyticsCatalogLogicService.update(olapCatalog, this.getFields().get("uploadOid"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : OlapCatalogVO(com.netsteadfast.greenstep.vo.OlapCatalogVO)

Example 5 with OlapCatalogVO

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

the class AnalyticsProcessAction method rendererHtml.

private void rendererHtml(File catalogFile) throws ControllerException, AuthorityException, ServiceException, Exception {
    this.content = "";
    this.checkFields("query");
    boolean showDimensionTitle = true;
    boolean showParentMembers = true;
    if (!"true".equals(this.getFields().get("showDimensionTitle"))) {
        showDimensionTitle = false;
    }
    if (!"true".equals(this.getFields().get("showParentMembers"))) {
        showParentMembers = false;
    }
    OlapCatalogVO catalog = this.loadOlapCatalog(this.getFields().get("catalogOid"));
    OlapConfVO config = this.loadOlapConfig(this.getFields().get("configOid"));
    catalogFile = OlapUtils.writeCatalogContentToFile(catalog.getId() + "_" + super.getAccountOid(), new String(catalog.getContent(), Constants.BASE_ENCODING));
    String mondrianUrl = OlapUtils.getMondrianUrl(config.getJdbcUrl(), config.getJdbcDrivers(), catalogFile.getPath());
    this.content = Pivot4JUtils.rendererHtml(mondrianUrl, this.getFields().get("expression"), showDimensionTitle, showParentMembers);
    this.message = this.getText("MESSAGE.QCHARTS_PROG002D0002Q_msg1") + super.getHtmlBr();
    this.success = IS_YES;
}
Also used : OlapConfVO(com.netsteadfast.greenstep.vo.OlapConfVO) OlapCatalogVO(com.netsteadfast.greenstep.vo.OlapCatalogVO)

Aggregations

OlapCatalogVO (com.netsteadfast.greenstep.vo.OlapCatalogVO)10 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)5 OlapConfVO (com.netsteadfast.greenstep.vo.OlapConfVO)4 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)2 Transactional (org.springframework.transaction.annotation.Transactional)2 AuthorityException (com.netsteadfast.greenstep.base.exception.AuthorityException)1 ControllerException (com.netsteadfast.greenstep.base.exception.ControllerException)1 OlapMdxVO (com.netsteadfast.greenstep.vo.OlapMdxVO)1 File (java.io.File)1