Search in sources :

Example 1 with SysTwitterVO

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

the class SystemTwitterSaveOrUpdateAction method update.

private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysTwitterVO oldSysTwitter = new SysTwitterVO();
    oldSysTwitter.setOid(this.getFields().get("oid"));
    DefaultResult<SysTwitterVO> oldResult = this.sysTwitterService.findObjectByOid(oldSysTwitter);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    oldSysTwitter = oldResult.getValue();
    SysTwitterVO sysTwitter = new SysTwitterVO();
    sysTwitter.setOid(oldSysTwitter.getOid());
    sysTwitter.setSystem(oldSysTwitter.getSystem());
    sysTwitter.setTitle(this.getFields().get("title"));
    sysTwitter.setEnableFlag(("true".equals(this.getFields().get("enableFlag")) ? YesNo.YES : YesNo.NO));
    // 先清除之前的blob資料
    sysTwitter.setContent(null);
    // 先清除之前的blob資料		
    this.sysTwitterService.updateObject(sysTwitter);
    String content = StringEscapeUtils.unescapeEcmaScript(this.getFields().get("content"));
    sysTwitter.setContent(content.getBytes());
    DefaultResult<SysTwitterVO> result = this.sysTwitterService.updateObject(sysTwitter);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysTwitterVO(com.netsteadfast.greenstep.vo.SysTwitterVO)

Example 2 with SysTwitterVO

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

the class MenuSupportUtils method getTwitterAccordionPane.

public static String getTwitterAccordionPane(String systemId) throws ServiceException, Exception {
    if (StringUtils.isBlank(systemId)) {
        return "";
    }
    SysTwitterVO sysTwitter = new SysTwitterVO();
    sysTwitter.setSystem(systemId);
    DefaultResult<SysTwitterVO> result = sysTwitterService.findByUK(sysTwitter);
    if (result.getValue() == null) {
        return "";
    }
    sysTwitter = result.getValue();
    if (!YesNo.YES.equals(sysTwitter.getEnableFlag())) {
        return "";
    }
    String content = new String(sysTwitter.getContent(), "utf8");
    if (StringUtils.isBlank(content)) {
        return "";
    }
    StringBuilder sb = new StringBuilder();
    String title = StringEscapeUtils.escapeHtml4(sysTwitter.getTitle());
    String id = "_" + systemId + "_twitter_AccordionPane";
    sb.append("<div data-dojo-type=\"dijit/layout/AccordionPane\" title=\"<img src='./icons/twitter.png' border='0'/>&nbsp;" + title + "\" id=\"" + id + "\"> \n");
    sb.append(content);
    sb.append("\n");
    sb.append("</div>");
    return sb.toString();
}
Also used : SysTwitterVO(com.netsteadfast.greenstep.vo.SysTwitterVO)

Example 3 with SysTwitterVO

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

the class SystemTwitterManagementAction method loadSysTwitterData.

private void loadSysTwitterData() throws ServiceException, Exception {
    sysTwitter.setOid(this.getFields().get("oid"));
    DefaultResult<SysTwitterVO> result = this.sysTwitterService.findObjectByOid(sysTwitter);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    this.sysTwitter = result.getValue();
    this.getFields().put("content", new String(this.sysTwitter.getContent(), "utf8"));
    SysVO sys = new SysVO();
    sys.setSysId(this.sysTwitter.getSystem());
    DefaultResult<SysVO> sysResult = this.sysService.findByUK(sys);
    if (sysResult.getValue() == null) {
        throw new ServiceException(sysResult.getSystemMessage().getValue());
    }
    sys = sysResult.getValue();
    this.getFields().put("systemOid", sys.getOid());
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) SysTwitterVO(com.netsteadfast.greenstep.vo.SysTwitterVO)

Example 4 with SysTwitterVO

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

the class SystemTwitterSaveOrUpdateAction method delete.

private void delete() throws ControllerException, AuthorityException, ServiceException, Exception {
    SysTwitterVO sysTwitter = new SysTwitterVO();
    sysTwitter.setOid(this.getFields().get("oid"));
    DefaultResult<Boolean> result = this.sysTwitterService.deleteObject(sysTwitter);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() && result.getValue()) {
        this.success = IS_YES;
    }
}
Also used : SysTwitterVO(com.netsteadfast.greenstep.vo.SysTwitterVO)

Example 5 with SysTwitterVO

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

the class SystemTwitterSaveOrUpdateAction method save.

private void save() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    SysVO sys = this.findSys();
    SysTwitterVO sysTwitter = new SysTwitterVO();
    sysTwitter.setSystem(sys.getSysId());
    sysTwitter.setTitle(this.getFields().get("title"));
    sysTwitter.setEnableFlag(("true".equals(this.getFields().get("enableFlag")) ? YesNo.YES : YesNo.NO));
    sysTwitter.setContent(this.getFields().get("content").getBytes());
    DefaultResult<SysTwitterVO> result = this.sysTwitterService.saveObject(sysTwitter);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : SysVO(com.netsteadfast.greenstep.vo.SysVO) SysTwitterVO(com.netsteadfast.greenstep.vo.SysTwitterVO)

Aggregations

SysTwitterVO (com.netsteadfast.greenstep.vo.SysTwitterVO)5 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)2 SysVO (com.netsteadfast.greenstep.vo.SysVO)2