incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r225690 - in /incubator/graffito/trunk/applications/framework-portlets: ./ src/java/org/apache/portals/graffito/portlets/util/ src/java/org/apache/portals/graffito/servlets/
Date Thu, 28 Jul 2005 05:34:07 GMT
Author: clombart
Date: Wed Jul 27 22:34:02 2005
New Revision: 225690

URL: http://svn.apache.org/viewcvs?rev=225690&view=rev
Log:
Review object model (see GRFT-25)

Modified:
    incubator/graffito/trunk/applications/framework-portlets/.classpath
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/GraffitoTools.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/ServiceUtil.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/servlets/GraffitoViewerServlet.java

Modified: incubator/graffito/trunk/applications/framework-portlets/.classpath
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/.classpath?rev=225690&r1=225689&r2=225690&view=diff
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/.classpath (original)
+++ incubator/graffito/trunk/applications/framework-portlets/.classpath Wed Jul 27 22:34:02
2005
@@ -13,11 +13,11 @@
   </classpathentry>
   <classpathentry kind="var" path="MAVEN_REPO/portlet-api/jars/portlet-api-1.0.jar">
   </classpathentry>
-  <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-api-2.0-M3-dev.jar">
+  <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-api-2.0-M3.jar">
   </classpathentry>
-  <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-commons-2.0-M3-dev.jar">
+  <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-commons-2.0-M3.jar">
   </classpathentry>
-  <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-components-2.0-M3-dev.jar">
+  <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-components-2.0-M3.jar">
   </classpathentry>
   <classpathentry kind="var" path="MAVEN_REPO/log4j/jars/log4j-1.2.8.jar">
   </classpathentry>
@@ -39,9 +39,9 @@
   </classpathentry>
   <classpathentry kind="var" path="MAVEN_REPO/velocity-tools/jars/velocity-tools-1.1.jar">
   </classpathentry>
-  <classpathentry kind="var" path="MAVEN_REPO/portals-bridges/jars/portals-bridges-common-0.1.jar">
+  <classpathentry kind="var" path="MAVEN_REPO/portals-bridges/jars/portals-bridges-common-0.3.jar">
   </classpathentry>
-  <classpathentry kind="var" path="MAVEN_REPO/portals-bridges/jars/portals-bridges-velocity-0.1.jar">
+  <classpathentry kind="var" path="MAVEN_REPO/portals-bridges/jars/portals-bridges-velocity-0.3.jar">
   </classpathentry>
   <classpathentry kind="var" path="MAVEN_REPO/graffito/jars/graffito-api-1.0-a1-dev.jar">
   </classpathentry>

Modified: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/GraffitoTools.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/GraffitoTools.java?rev=225690&r1=225689&r2=225690&view=diff
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/GraffitoTools.java
(original)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/GraffitoTools.java
Wed Jul 27 22:34:02 2005
@@ -17,9 +17,10 @@
 
 import java.util.ArrayList;
 
-import org.apache.portals.graffito.model.CmsObject;
-import org.apache.portals.graffito.model.Document;
-import org.apache.portals.graffito.model.Folder;
+import org.apache.portals.graffito.model.core.CmsObject;
+import org.apache.portals.graffito.model.core.Content;
+import org.apache.portals.graffito.model.core.Folder;
+import org.apache.portals.graffito.model.dm.Document;
 
 /**
  *
@@ -64,22 +65,29 @@
       }
       
       /**
-       * This method can be used in a velocity template to check if a document has to be
view with the 
+       * This method can be used in a velocity template to check if a content has to be view
with the 
        * Graffito servlet viewer or not. HTML and text document can be display direclty in
the portlet.
        * Other content types (PDF, Open office documents, Ms Word, ...) require the Graffito
viewer servlet. 
        * 
-       * @param document the document to check
+       * @param content the content to check
        * @return true if the Graffito servlet viewer is required
        */
-      public boolean requireGraffitoViewer(Document document)
+      public boolean requireGraffitoViewer(Content content)
       {
-          
-          if (document.getContentType().equals("text/plain") || document.getContentType().equals("text/html"))
-          {
-              return false;
-          }
-          
-          return true;
+        if (content instanceof Document)
+        {
+            Document document = (Document) content;
+            if (document.getContentType().equals("text/plain") || document.getContentType().equals("text/html"))
+            {
+                return false;
+            }
+
+            return true;
+        }
+        else
+        {
+            return false;
+        }
       }       
       
       /**

Modified: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/ServiceUtil.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/ServiceUtil.java?rev=225690&r1=225689&r2=225690&view=diff
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/ServiceUtil.java
(original)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/ServiceUtil.java
Wed Jul 27 22:34:02 2005
@@ -18,9 +18,10 @@
 import org.apache.jetspeed.security.UserManager;
 import org.apache.jetspeed.services.JetspeedPortletServices;
 import org.apache.jetspeed.services.PortletServices;
-import org.apache.portals.graffito.ContentModelService;
-import org.apache.portals.graffito.ContentPermissionService;
-import org.apache.portals.graffito.ContentServerService;
+import org.apache.portals.graffito.services.core.ContentModelService;
+import org.apache.portals.graffito.services.core.ContentPermissionService;
+import org.apache.portals.graffito.services.core.ContentServerService;
+import org.apache.portals.graffito.services.dm.DocumentModelService;
 
 /**
  * Utility class used to access to Graffito services & parameters
@@ -38,6 +39,12 @@
         PortletServices services = JetspeedPortletServices.getSingleton();
         return (ContentModelService) services.getService("ContentModel");
     }
+    
+    public static DocumentModelService getDocumentService()
+    {
+        PortletServices services = JetspeedPortletServices.getSingleton();
+        return (DocumentModelService) services.getService("DocumentModel");
+    }    
 
     public static ContentServerService getServerService()
     {

Modified: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/servlets/GraffitoViewerServlet.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/servlets/GraffitoViewerServlet.java?rev=225690&r1=225689&r2=225690&view=diff
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/servlets/GraffitoViewerServlet.java
(original)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/servlets/GraffitoViewerServlet.java
Wed Jul 27 22:34:02 2005
@@ -25,10 +25,11 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.portals.graffito.ContentModelService;
 import org.apache.portals.graffito.exception.ContentManagementException;
-import org.apache.portals.graffito.model.Document;
+import org.apache.portals.graffito.model.dm.Document;
 import org.apache.portals.graffito.portlets.util.ServiceUtil;
+import org.apache.portals.graffito.services.core.ContentModelService;
+import org.apache.portals.graffito.services.dm.DocumentModelService;
 
 
 
@@ -50,7 +51,7 @@
     {
         
         
-        ContentModelService modelService = ServiceUtil.getModelService();        
+        DocumentModelService modelService = ServiceUtil.getDocumentService();    
         if (null == modelService)
         {
             throw new ServletException("Failed to find the content model service");
@@ -63,7 +64,7 @@
             if (document!=null)
             {
                 response.setContentType(document.getContentType());
-                InputStream documentStream = document.getContent().getContentStream();
+                InputStream documentStream = document.getDocumentStream().getContentStream();
                 drain(documentStream, response.getOutputStream());
                 documentStream.close();
             }



Mime
View raw message