use of com.netsteadfast.greenstep.vo.WorkspaceCompomentVO in project bamboobsc by billchen198318.
the class BaseWorkspaceCompoment method loadFromId.
@Override
public CompomentsModel loadFromId(String compomentId) throws ServiceException, Exception {
if (StringUtils.isBlank(compomentId)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
WorkspaceCompomentVO compoment = new WorkspaceCompomentVO();
compoment.setCompId(compomentId);
DefaultResult<WorkspaceCompomentVO> result = workspaceCompomentService.findByUK(compoment);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
compoment = result.getValue();
CompomentsModel model = new CompomentsModel();
this.setModel(model);
model.setId(compoment.getCompId());
model.setName(compoment.getName());
model.setResource(this.getResource());
model.setParameters(this.getParameters());
model.setContent("");
return model;
}
use of com.netsteadfast.greenstep.vo.WorkspaceCompomentVO in project bamboobsc by billchen198318.
the class WorkspaceUtils method fillTemplateParameters.
private static Map<String, Object> fillTemplateParameters(WorkspaceTemplateVO template, List<BbWorkspaceConfig> configs, boolean defaultMode, Map<String, Object> templateParameters) throws ServiceException, Exception {
Map<String, Object> parameter = new HashMap<String, Object>();
for (int position = 0; position < template.getPositionSize(); position++) {
String content = "";
for (int c = 0; configs != null && c < configs.size(); c++) {
BbWorkspaceConfig config = configs.get(c);
if (config.getPosition() != position) {
continue;
}
WorkspaceCompomentVO compoment = new WorkspaceCompomentVO();
compoment.setCompId(config.getCompId());
DefaultResult<WorkspaceCompomentVO> cResult = workspaceCompomentService.findByUK(compoment);
if (cResult.getValue() == null) {
throw new ServiceException(cResult.getSystemMessage().getValue());
}
compoment = cResult.getValue();
if (defaultMode) {
// default mode
try {
setTitle(config, templateParameters);
content = getCompomentRenderBody(compoment, templateParameters);
} catch (Exception e) {
e.printStackTrace();
}
} else {
// view layout mode
content = getCompomentImage(compoment);
}
}
parameter.put(TEMPLATE_VARIABLE_NAME + position, content);
}
return parameter;
}
Aggregations