Author: unibrew Date: 2005-12-09 18:23:49 -0500 (Fri, 09 Dec 2005) New Revision: 1772 Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollVotesDatabase.java trunk/forge/portal-extensions/forge-ear/src/META-INF/application.xml trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml Log: [JBLAB-407] Polls commiting. Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollVotesDatabase.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollVotesDatabase.java 2005-12-09 22:22:45 UTC (rev 1771) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/PollVotesDatabase.java 2005-12-09 23:23:49 UTC (rev 1772) @@ -7,9 +7,11 @@ import org.jboss.shotoku.Directory; import org.jboss.shotoku.Node; import org.jboss.shotoku.aop.Inject; +import org.jboss.shotoku.exceptions.DeleteException; import org.jboss.shotoku.exceptions.RepositoryException; import org.jboss.shotoku.exceptions.ResourceAlreadyExists; import org.jboss.shotoku.exceptions.ResourceDoesNotExist; +import org.jboss.shotoku.exceptions.SaveException; public class PollVotesDatabase { @@ -32,7 +34,10 @@ } catch (ResourceAlreadyExists e) { System.out.println ("[POLLPORTLET] Database file for poll already exists!"); e.printStackTrace(); - } catch (RepositoryException e2) { + } catch (SaveException e) { + System.out.println ("[POLLS] Problem while saving property for database file."); + e.printStackTrace(); + }catch (RepositoryException e2) { System.out.println ("[POLLPORTLET] Problem with creating data file for poll!"); e2.printStackTrace(); } @@ -50,6 +55,7 @@ public boolean votedOnPoll (String pollId, String userId, String vote) { System.out.println ("SETTING PROPERTY FOR FILE"); + System.out.println ("POLLID: "+pollId+" USERID: "+userId+" VOTE: "+vote); Node pollFile=null; try { pollFile = databaseDir.getNode(pollId); @@ -69,17 +75,28 @@ e3.printStackTrace(); } } + System.out.println("PRZED DODANIEM GŁOSU "+pollFile.getClass().getCanonicalName()); pollFile.setProperty(userId,vote); - pollFile.save("[Polls] Saving property for poll's database file."); + System.out.println("PO DODANIU GŁOSU PRZED SAVEM"+pollFile.getClass().getCanonicalName()); + try { + pollFile.save("[Polls] Saving property for poll's database file."); + System.out.println("PO DODANU GŁOSU PO SAVIE"+pollFile.getClass().getCanonicalName()); + } catch (SaveException e) { + System.out.println ("[POLLS] Problem while saving property for database file."); + e.printStackTrace(); + } return true; } public Map<String,String> getUserVotesForPollFile (String pollId) { + System.out.println ("GETUSERVOTESFORPOLLFILE POLLID: "+pollId); Map<String,String> userVotes = null; if (pollId==null) return new Hashtable<String,String>(0); try { Node pollFile = databaseDir.getNode(pollId); + System.out.println("PRZED GETPROPERTIES "+pollFile.getClass().getCanonicalName()); userVotes = pollFile.getProperties(); + System.out.println("PO GETPROPERTIES "+pollFile.getClass().getCanonicalName()); System.out.println ("I'M BEFORE DISPLAYING FILE PROPERTIES."); for (String first:userVotes.keySet()){ System.out.println("PROPERTY: "+first+" VALUE: "+userVotes.get(first)); @@ -101,10 +118,12 @@ Node pollFile = databaseDir.getNode(pollId); pollFile.delete(); } catch (ResourceDoesNotExist e2) { - System.out.println ("[PRIMATESPORTLET] Poll's data file was already deleted."); + System.out.println ("[POLLS] Poll's data file was already deleted."); e2.printStackTrace(); - } - catch (RepositoryException e) { + } catch (DeleteException e3) { + System.out.println ("[POLLS] Problem with deleting database file."); + e3.printStackTrace(); + } catch (RepositoryException e) { System.out.println ("[POLLPORTLET] Problem while deleting poll's data file."); e.printStackTrace(); } Modified: trunk/forge/portal-extensions/forge-ear/src/META-INF/application.xml =================================================================== --- trunk/forge/portal-extensions/forge-ear/src/META-INF/application.xml 2005-12-09 22:22:45 UTC (rev 1771) +++ trunk/forge/portal-extensions/forge-ear/src/META-INF/application.xml 2005-12-09 23:23:49 UTC (rev 1772) @@ -25,6 +25,11 @@ </module> <module> <web> + <web-uri>polls-portlet.war</web-uri> + </web> + </module> + <module> + <web> <web-uri>kosmos-server.war</web-uri> </web> </module> Modified: trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml =================================================================== --- trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml 2005-12-09 22:22:45 UTC (rev 1771) +++ trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml 2005-12-09 23:23:49 UTC (rev 1772) @@ -300,9 +300,16 @@ <window-name>DownloadCounterPortletWindowDefaultDownloads</window-name> <instance-ref>counter.DownloadCounterPortlet.DownloadCounterPortletInstance</instance-ref> <region>center</region> - <height>0</height> + <height>1</height> <window-state>normal</window-state> </window> + <window> + <window-name>PollsPortletWindowDefaultDownloads</window-name> + <instance-ref>polls.PollsPortlet.PollsPortletInstance</instance-ref> + <region>center</region> + <height>2</height> + <window-state>normal</window-state> + </window> </page> <page> |