7 Replies Latest reply: Mar 15, 2012 2:46 PM by Laura Kolker RSS

    Making all widgets work with our custom content type

    laura.kolker

      Hi all,

       

      I'm involved in a project in which we are creating a custom content type.

      There appear to be many core widgets that jive applications have available to them: Latest Updates, Popular Documents, Recent Content Panel, etc.

      We've found that even though we've implemented the recent content provider, and we've gotten the history userbar working, that many of these other widget panels don't provide correct links to the content type, or information about who made the content type, even if an entry is made into the panel for the content type. See screenshot.latestupdatesq.png

       

      So, what is involved with making sure that core widgets (like Latest Updates) properly support the new content type?

       

      Any ideas?

      Thanks,

      Laura

        • Re: Making all widgets work with our custom content type

          Laura,

           

          Does your custom content type implement VisibleType? If you implement this interface with a good TypeUIProvider you should start seeing the proper icons/links etc.. for your content type.

           

          Let me know if you have any questions or need anymore details.

           

          -Nate

            • Re: Making all widgets work with our custom content type
              laura.kolker

              Does your custom content type implement VisibleType? If you implement this interface with a good TypeUIProvider you should start seeing the proper icons/links etc.. for your content type.


              Well, it already implements ContentObjectType, which I understand to be an extension of VisibleType.

               

              Here is the full list of interfaces our content type is currently implementing:

               

              public class ProtocolContentType implements ContentObjectType, //extends VisibleType 
                                               ContainableType, //need this to put things in a container/location
                                               FilteredIndexableType, //extends IndexableType
                                               RecentContentEnabledType, //the choose location widget expects this
                                               RecentHistoryEnabledType,
                                               TaggableType,  //extends VisibleType
                                               CommentableType, //extends VisibleType
                                               WatchableType,
                                               ViewCountSupportedType,
                                               NotificationEnabledType<Protocol>,
                                               EntitlementCheckableType<Protocol>
              

               

              As for a good TypeUIProvider - we've certainly implemented a TypeUIProvider, and have done our best to implement every method, but documentation on this subject is minimal. What would a "good" one entail? If it's the TypeUIProvider that is at fault, what methods are the likely points of failure?

               

              Thanks,

              Laura

                • Re: Making all widgets work with our custom content type

                  For the TypeUIProvider ensure that there are impls for everything, especially getJiveObjectURLFactory(), getLinkProvider(), and getIconGenerator().  These subsystems are more important for other widgets. The Recent Content widget is less integrated with the rest of the API to allow for easier injection into the recent content stream. Looking at your screen shot it appears that the getAuthor, getSubject methods aren't returning anything. If that is the case they should probably deletegate to your content objects getUser and getPlainSubject methods.

                    • Re: Making all widgets work with our custom content type
                      laura.kolker

                      Hi Nate,

                       

                      Thanks for the tips.
                      So, some more details: The icon generator was fully implemented. There were a handful of methods in the url factory and link provider that weren't implemented. They didn't appear to be the likely problem, but I implemented them anyway. Didn't work, unforunately.

                       

                      I reviewed whether my objects had getAuthor, getSubject, getPlainSubject, etc. Added them as necessary, but it didn't help.

                       

                      That being said, I realized later in the day that our use of what was being called Latest Updates widget is really the Recent Content widget. So, I examined the RecentContentInfoProvider more closely.

                       

                      A couple of weird details that have come to light:
                      * On my local dev sandbox, the recent content plugin displays correctly.
                      * But on my staging (UAT) server, hosted by jive, when I first load the widget, instances of our content type are listed correctly, but a page reload changes it to the status described above.
                      * Additionally, I examined the links more closely, and they're invariably pointing to an invalid object id. So, our links follow a standard convention: baseurl/protocol/objectid. The failing links all have an objectid of 0.
                      * I added the following code to my recentContentInfoProvider.getObjectUrl method, to see if it was being passed null or objects with a 0 id:

                      public String getObjectUrl(JiveObject object, boolean constructAbsoluteURL) {
                              if (object == null || object.getID() < 1) {
                                  log.error("Object is null or id is less than 1: " + object);
                                  return "";
                              }
                              return JiveResourceResolver.getJiveObjectURL(object, constructAbsoluteURL);
                          }
                      

                       

                      And the urls of the bad links were, in fact, affected.

                       

                      ERROR providers.ProtocolRecentContentInfoProvider - Object is null or id is less than 1: com.lifetech.jive.protocol.data.ProtocolProxy@3fb97458
                      

                       

                      What does it mean that I'm getting passed objects with 0 ids? I don't even know how that could have happened. I'm using the same id generating code that's used in the memo example, so it's really unlikely that there are actually objects in the db with 0 ids.

                       

                      I'm attaching my RecentContentInfoProvider.

                       

                      Thanks for all your help.
                      Laura