From: H X P. <hx...@us...> - 2004-05-13 09:25:10
|
User: hxp Date: 04/05/13 02:25:03 Modified: quotes/src/main/org/jboss/nukes/addons/modules/quotes/blocks QuotesBlock.java Log: Initial pass at a pure-CMP backend for the Quotes module. First use of unknown-pk within the Nukes project. ( note use of unknown-pk idiom within QuotesModule.java: "(Integer) quoteEJB.getPrimaryKey()" ) Revision Changes Path 1.4 +30 -29 nukes/quotes/src/main/org/jboss/nukes/addons/modules/quotes/blocks/QuotesBlock.java Index: QuotesBlock.java =================================================================== RCS file: /cvsroot/jboss/nukes/quotes/src/main/org/jboss/nukes/addons/modules/quotes/blocks/QuotesBlock.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- QuotesBlock.java 3 Mar 2004 13:19:52 -0000 1.3 +++ QuotesBlock.java 13 May 2004 09:25:03 -0000 1.4 @@ -21,7 +21,8 @@ * * @author <a href="mailto:tim...@ya...">Timothy Barreto</a> * @author <a href="mailto:ju...@jb...">Julien Viet</a> - * @version $Revision: 1.3 $ + * @author <a href="mailto:Quo...@jo...">Howard Pearlmutter</a> + * @version $Revision: 1.4 $ $Date: 2004/05/13 09:25:03 $ */ public class QuotesBlock extends BlockSupport @@ -32,44 +33,44 @@ public QuotesBlock() { - super(); + super(); } public QuotesBlock(boolean persistent) { - super(persistent); + super(persistent); } // Public ------------------------------------------------------------------- public void render(Page page) { - //security check below could be usefull if you make changes to jboss-service.xml - //check the user is authorized to see the qutoes block - //if ( !getApi().secAuthAction("quotes:quoteblock:", getName() + "::", Constants.SEC_ACCESS_READ) ) { - // return; - //} - - //generate html output - Html output = new Html(); - - try - { - //get a random quote from the Quotes Module - String randomQuote = (String) server.invoke( - QuotesModule.OBJECT_NAME, - "getRandomQuote", - new Object[]{}, - new String[]{}); - output.text(randomQuote != null ? randomQuote : "Not enough quotes in database."); - output.printPage(page); - } - catch (Exception ex) - { - output.text("Cannot retrieve random quote."); - output.printPage(page); - log.error("Cannot retrieve random quote.", ex); - } + //security check below could be usefull if you make changes to jboss-service.xml + //check the user is authorized to see the qutoes block + //if ( !getApi().secAuthAction("quotes:quoteblock:", getName() + "::", Constants.SEC_ACCESS_READ) ) { + // return; + //} + + //generate html output + Html output = new Html(); + + try + { + //get a random quote from the Quotes Module + String randomQuote = (String) server.invoke( + QuotesModule.OBJECT_NAME, + "getRandomQuote", + new Object[]{}, + new String[]{}); + output.text(randomQuote != null ? randomQuote : "Not enough quotes in database."); + output.printPage(page); + } + catch (Exception ex) + { + output.text("Cannot retrieve random quote."); + output.printPage(page); + log.error("Cannot retrieve random quote.", ex); + } } } |