本文整理汇总了Java中uk.org.ponder.util.UniversalRuntimeException.accumulate方法的典型用法代码示例。如果您正苦于以下问题:Java UniversalRuntimeException.accumulate方法的具体用法?Java UniversalRuntimeException.accumulate怎么用?Java UniversalRuntimeException.accumulate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uk.org.ponder.util.UniversalRuntimeException
的用法示例。
在下文中一共展示了UniversalRuntimeException.accumulate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EvalPDFReportBuilder
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
public EvalPDFReportBuilder(OutputStream outputStream) {
document = new Document();
try {
pdfWriter = PdfWriter.getInstance(document, outputStream);
pdfWriter.setStrictImageSequence(true);
document.open();
// attempting to handle i18n chars better
// BaseFont evalBF = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.IDENTITY_H,
// BaseFont.EMBEDDED);
// paragraphFont = new Font(evalBF, 9, Font.NORMAL);
// paragraphFont = new Font(Font.TIMES_ROMAN, 9, Font.NORMAL);
titleTextFont = new Font(Font.TIMES_ROMAN, 22, Font.BOLD);
boldTextFont = new Font(Font.TIMES_ROMAN, 10, Font.BOLD);
questionTextFont = FontFactory.getFont(FontFactory.TIMES_ROMAN, 11, Font.BOLD);
paragraphFont = FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL);
paragraphFontBold = FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD);
frontTitleFont = FontFactory.getFont(FontFactory.TIMES_ROMAN, frontTitleSize, Font.NORMAL);
frontAuthorFont = FontFactory.getFont(FontFactory.TIMES_ROMAN, 18, Font.NORMAL);
frontInfoFont = FontFactory.getFont(FontFactory.TIMES_ROMAN, 16, Font.NORMAL);
} catch (Exception e) {
throw UniversalRuntimeException.accumulate(e, "Unable to start PDF Report");
}
}
示例2: addTools
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
/**
* Process tool adds
* @return
*/
public String addTools () {
for (int i = 0; i < selectedTools.length; i++) {
SitePage page;
try {
page = site.addPage();
Tool tool = toolManager.getTool(selectedTools[i]);
page.setTitle(tool.getTitle());
ToolConfiguration placement = page.addTool(tool.getId());
siteService.save(site);
EventTrackingService.post(
EventTrackingService.newEvent(PAGE_ADD, "/site/" + site.getId() +
"/page/" + page.getId() +
"/tool/" + selectedTools[i] +
"/placement/" + placement.getId(), false));
}
catch(Exception e) {
throw UniversalRuntimeException.accumulate(e, "Error adding tool " + selectedTools[i]);
}
}
return "success";
}
示例3: addPage
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
/**
* Adds a new single tool page to the current site
* @param toolId
* @param title
* @return the newly added SitePage
*/
public SitePage addPage (String toolId, String title) {
SitePage page;
try {
page = site.addPage();
page.setTitle(title);
ToolConfiguration placement = page.addTool(toolId);
siteService.save(site);
EventTrackingService.post(
EventTrackingService.newEvent(PAGE_ADD, "/site/" + site.getId() +
"/page/" + page.getId() +
"/tool/" + toolId +
"/placement/" + placement.getId(), false));
}
catch (Exception e) {
throw UniversalRuntimeException.accumulate(e, "Error adding page " + title);
}
init();
return page;
}
示例4: invokeRunnable
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
public void invokeRunnable(Runnable torun) {
TargettedMessageList tml = errorStateManager.getTargettedMessageList();
for (int i = 0; i < tml.size(); ++i) {
TargettedMessage message = tml.messageAt(i);
if (errorFilter.matchIgnores(message.messagecodes))
continue;
if (message.exception != null) {
Throwable nested = message.exception instanceof UniversalRuntimeException
? ((UniversalRuntimeException) message.exception).getTargetException() : message.exception;
if (nested instanceof TargettedMessageException) {
if (errorFilter
.matchIgnores(((TargettedMessageException) nested).getTargettedMessage().messagecodes)) {
continue;
}
}
throw UniversalRuntimeException.accumulate(message.exception);
}
}
torun.run();
}
示例5: invokeRunnable
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
public void invokeRunnable(Runnable torun) {
TargettedMessageList tml = errorStateManager.getTargettedMessageList();
for (int i = 0; i < tml.size(); ++ i) {
TargettedMessage message = tml.messageAt(i);
if (message.exception != null) {
throw UniversalRuntimeException.accumulate(message.exception);
}
}
torun.run();
}
示例6: getOutputStream
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
private OutputStream getOutputStream(HttpServletResponse response){
try {
return response.getOutputStream();
} catch (IOException ioe) {
throw UniversalRuntimeException.accumulate(ioe,
"Unable to get response stream for Evaluation Results Export");
}
}
示例7: addElementWithJump
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
public void addElementWithJump(Element currentPara, boolean jumpIfLittleSpace)
{
//20140226 - [email protected] - https://jira.sakaiproject.org/browse/EVALSYS-1100
//Adds a big size element (a header or a graphic) and jumps to another page/column if it detects that is below the last third of the document.
float y = responseArea.getYLine();
LOG.debug("Vertical position Y: "+y);
try
{
if ((jumpIfLittleSpace) && (y<(document.top()/3)))
{
//If there's little space to the bottom border, we jump to the next column. I use this only for headers.
column = Math.abs(column - 1);
if (column==0)
{
document.newPage();
responseArea.setSimpleColumn(document.left(),document.top(),document.right()/2, document.bottom()+pagefooter);
}
else
{
responseArea.setSimpleColumn(document.right()/2,document.top(),document.right(), document.bottom()+pagefooter);
}
//Just to align vertically the top elements
if (!currentPara.toString().equals("[ ]")) responseArea.addElement(new Paragraph(" "));
}
responseArea.addElement(currentPara);
responseArea.go();
}
catch (DocumentException e) {
// TODO Auto-generated catch block
throw UniversalRuntimeException.accumulate(e, "Unable to add element to PDF Report");
}
}
示例8: addLittleElementWithJump
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
public void addLittleElementWithJump(Element littleElement)
{
//20140226 - [email protected] - https://jira.sakaiproject.org/browse/EVALSYS-1100
//Adds a little element testing if it fits in current column.
try
{
responseArea.addElement(littleElement);
status=responseArea.go();
if (status==ColumnText.NO_MORE_COLUMN)
{
column = Math.abs(column - 1);
if (column==0)
{
document.newPage();
responseArea.setSimpleColumn(document.left(),document.top(),document.right()/2, document.bottom()+pagefooter);
}
else
{
responseArea.setSimpleColumn(document.right()/2,document.top(),document.right(), document.bottom()+pagefooter);
}
}
}
catch (DocumentException e) {
// TODO Auto-generated catch block
throw UniversalRuntimeException.accumulate(e, "Unable to add elements to PDF Report");
}
}
示例9: saveSite
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
/**
* Wrapper around siteService to save a site
* @param site
* @throws IdUnusedException
* @throws PermissionException
*/
public void saveSite(Site site) {
try {
siteService.save(site);
}
catch (Exception e) {
throw UniversalRuntimeException.accumulate(e, "Error saving site");
}
}
示例10: handleHelperDone
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
private boolean handleHelperDone() {
Logger.log.info("Done handling helper in view: " + viewParameters.viewID);
// Removing hack
tsh.clearTokenState(IN_HELPER_INDICATOR);
ELReference elref = (ELReference) tsh
.getTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + HelperViewParameters.POST_HELPER_BINDING);
ParameterList paramlist = (ParameterList) tsh
.getTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + POST_HELPER_BINDING_PARAMLIST);
statePreservationManager.scopeRestore();
if (paramlist != null) {
for (int i = 0; i < paramlist.size(); i++) {
UIParameter param = (UIParameter) paramlist.get(i);
if (param instanceof UIELBinding) {
bma.setBeanValue(((UIELBinding) param).valuebinding.value, beanLocator,
((UIELBinding) param).rvalue, null, false);
}
}
}
String methodBinding = elref == null ? null : elref.value;
Object beanReturn = null;
if (methodBinding != null) {
ShellInfo shells = bma.fetchShells(methodBinding, beanLocator, true);
beanReturn = bma.invokeBeanMethod(shells, null);
}
ViewParameters originParams = (ViewParameters) tsh
.getTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + POST_HELPER_ARI2_VIEWPARAMS);
ARIResult ariresult = ari.interpretActionResult(viewParameters, beanReturn);
ariprocessor.interceptActionResult(ariresult, originParams, ariresult);
String urlToRedirectTo = ViewParamUtil.getAnyFullURL(ariresult.resultingView, vsh);
try {
response.sendRedirect(urlToRedirectTo);
} catch (IOException e) {
throw UniversalRuntimeException.accumulate(e, "Error redirecting to url: " + urlToRedirectTo);
}
return true;
}
示例11: service
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
protected void service(HttpServletRequest req, HttpServletResponse res) {
try {
req.setCharacterEncoding("UTF-8");
// This line was added for Sakai 2.0
req.setAttribute(Tool.NATIVE_URL, Tool.NATIVE_URL);
RSACUtils.startServletRequest(req, res, rsacbl, RSACUtils.HTTP_SERVLET_FACTORY);
// A request bean locator just good for this request.
BeanLocator rbl = rsacbl.getBeanLocator();
// pass the request to RSF.
rbl.locateBean("rootHandlerBean");
} catch (Throwable t) {
if (t instanceof UniversalRuntimeException) {
UniversalRuntimeException ure = (UniversalRuntimeException) t;
if (ForcibleException.class.isAssignableFrom(ure.getCategory())) {
throw (ure);
}
}
Logger.log.warn("Error servicing SakaiRSF request ", t);
try {
res.getWriter().println("[An error occurred handling this RSF request]");
if (rsacbl == null) {
res.getWriter().println("[Context has not been started properly]");
}
res.getWriter().close();
} catch (Exception e) {
}
throw UniversalRuntimeException.accumulate(t, "Error servicing SakaiRSF request ");
} finally {
if (rsacbl != null) {
rsacbl.endRequest();
}
}
}
示例12: checkLockOnCurrentUserAndSite
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
public boolean checkLockOnCurrentUserAndSite(String authzfunction) {
String context = toolmanager.getCurrentPlacement().getContext();
try {
Site site = siteService.getSite(context);
return securityService.unlock(authzfunction, site.getReference());
} catch (IdUnusedException e) {
throw UniversalRuntimeException.accumulate(e, "Could not fetch the site for context " + context);
}
}
示例13: makeCommonAccessHandler
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
private CommonAccessHandler makeCommonAccessHandler() {
return new CommonAccessHandler() {
public void handleAccess(HttpServletRequest req, HttpServletResponse res, EntityReference reference,
WBLAcceptor acceptor) {
try {
rsacbl.startRequest();
// A request bean locator just good for this request.
WriteableBeanLocator rbl = rsacbl.getBeanLocator();
// inchuck entityReference
rbl.set("sakai-EntityReference", reference.toString());
if (acceptor != null) {
acceptor.acceptWBL(rbl);
}
RSACUtils.startServletRequest(wrapRequest(req), res, rsacbl, RSACUtils.HTTP_SERVLET_FACTORY);
// pass the request to RSF.
rbl.locateBean("rootHandlerBean");
} catch (Exception t) {
// Access servlet performs no useful logging, do it here.
Logger.log.error("Error handling access request", t);
Throwable unwrapped = UniversalRuntimeException.unwrapException(t);
if (unwrapped instanceof RuntimeException) {
throw ((RuntimeException) unwrapped);
} else
throw UniversalRuntimeException.accumulate(unwrapped, "Error handling access request");
} finally {
rsacbl.endRequest();
}
}
};
}
示例14: addTitlePage
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
public void addTitlePage(String evaltitle, String groupNames, String startDate, String endDate,
String responseInformation, byte[] bannerImageBytes, String evalSystemTitle, String informationTitle) {
try {
float pagefooter = paragraphFont.getSize();
PdfContentByte cb = pdfWriter.getDirectContent();
float docMiddle = (document.right() - document.left()) / 2 + document.leftMargin();
Paragraph emptyPara = new Paragraph(" ");
emptyPara.setSpacingAfter(100.0f);
// Title
Paragraph titlePara = new Paragraph("\n\n\n" + evaltitle, frontTitleFont);
titlePara.setAlignment(Element.ALIGN_CENTER);
document.add(titlePara);
// Groups
Paragraph groupPara = new Paragraph(groupNames, frontAuthorFont);
groupPara.setSpacingBefore(25.0f);
groupPara.setAlignment(Element.ALIGN_CENTER);
document.add(groupPara);
// Little info area? I don't know, it was on the mockup though
Paragraph infoPara = new Paragraph(informationTitle, frontInfoFont);
infoPara.setAlignment(Element.ALIGN_CENTER);
infoPara.setSpacingBefore(90.0f);
document.add(infoPara);
// Started on
Paragraph startedPara = new Paragraph(startDate, frontInfoFont);
startedPara.setAlignment(Element.ALIGN_CENTER);
startedPara.setSpacingBefore(25.0f);
document.add(startedPara);
// Ended on
Paragraph endedPara = new Paragraph(endDate, frontInfoFont);
endedPara.setAlignment(Element.ALIGN_CENTER);
endedPara.setSpacingBefore(25.0f);
document.add(endedPara);
// Reply Rate
Paragraph replyRatePara = new Paragraph(responseInformation, frontInfoFont);
replyRatePara.setAlignment(Element.ALIGN_CENTER);
replyRatePara.setSpacingBefore(25.0f);
document.add(replyRatePara);
// Logo and Tagline
cb.beginText();
cb.setFontAndSize(BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252,
BaseFont.EMBEDDED), 12);
cb.showTextAligned(PdfContentByte.ALIGN_CENTER, evalSystemTitle, docMiddle, document
.bottom() + 20, 0);
cb.endText();
if (bannerImageBytes != null) {
Image banner = Image.getInstance(bannerImageBytes);
cb.addImage(banner, banner.getWidth(), 0, 0, banner.getHeight(), docMiddle
- (banner.getWidth() / 2), document.bottom() + 35);
}
document.newPage();
responseArea = new ColumnText(cb);
responseArea.setSimpleColumn(document.left(),document.top(),document.right()/2, document.bottom()+pagefooter);
responseArea.go();
} catch (DocumentException | IOException de) {
throw UniversalRuntimeException.accumulate(de, "Unable to create title page");
}
}
示例15: handleHelperHelper
import uk.org.ponder.util.UniversalRuntimeException; //导入方法依赖的package包/类
private boolean handleHelperHelper(final String pathBeyondViewID) {
Logger.log.info("Handling helper in view: " + viewParameters.viewID + " pathBeyondViewID: " + pathBeyondViewID);
String helperId = (String) tsh
.getTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + HelperViewParameters.HELPER_ID);
if (pathBeyondViewID.endsWith(".helper")) {
int i = pathBeyondViewID.lastIndexOf('/');
if (i >= 0) {
String helperName = pathBeyondViewID.substring(i + 1);
String toolName = pathBeyondViewID.substring(0, i);
i = helperName.lastIndexOf('.');
helperName = helperName.substring(0, i);
Logger.log.debug("new helper name" + helperName);
Logger.log.debug("tool name" + toolName);
tsh.putTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + "orig-helper-id", helperId);
tsh.putTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + "helper-tool-name", toolName);
helperId = helperName;
tsh.putTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + HelperViewParameters.HELPER_ID,
helperId);
}
}
String origToolName = (String) tsh
.getTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + "helper-tool-name");
if (origToolName != null && pathBeyondViewID.endsWith(origToolName)) {
helperId = (String) tsh.getTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + "orig-helper-id");
Logger.log.debug("returning to " + helperId);
tsh.putTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + HelperViewParameters.HELPER_ID, helperId);
tsh.clearTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + "helper-tool-name");
tsh.clearTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + "orig-helper-id");
}
ActiveTool helperTool = activeToolManager.getActiveTool(helperId);
String baseUrl = bup.getBaseURL();
int hostStart = baseUrl.indexOf("://") + 3;
int hostEnd = baseUrl.indexOf('/', hostStart);
String contextPath = baseUrl.substring(hostEnd);
contextPath += viewParameters.viewID;
contextPath += IN_HELPER_PATH;
String helperPathInfo = pathInfo[0] + "/" + pathInfo[1];
request.removeAttribute(Tool.NATIVE_URL);
// this is the forward call
try {
helperTool.help(request, response, contextPath, helperPathInfo);
} catch (ToolException e) {
throw UniversalRuntimeException.accumulate(e, "ToolException when trying to call help. HelperId: "
+ helperId + " contextPath: " + contextPath + " pathInfo: " + pathInfo);
}
return true;
}