Customizing Social Office 3.0 using plugins

 In the Liferay Developers Guide there is a nice little tidbit titled "Creating Plugins to Extend Plugins" found here. This basically allows a lot of the same principles used with hook plugins when customizing Liferay.  The difference here is that it allows you to customize portlet plugins with plugins.  As with hook plugins this allows a degree of separation between your customization's and the default application.

This same concept can also be used to customize Social Office plugins (including Social Office EE plugins).  The name of the new plugin must match the name of the original plugin since the so-hook expects the original name.

We had a need to hide the two public Site types in Social Office (Open and Public Restricted) since we share our Portal instance with our Clients.  

Do the following to customize the so-portlet:

  1. In Liferay IDE create a new Liferay Portlet Plugin project called: so-portlet
  2. Expand the new so-portlet project and delete everything below docroot
  3. Copy the original so-portlet WAR file into the root directory of the new so-portlet project in eclipse:

  4. Edit the build.xml ANT script and add the following property to the script:
        <property
            name="original.war.file"
            value="so-portlet-6.2.0.2-ce-ga1-20140210151141114.war"
        />
    
  5. Run the all Ant task.  A new tmp directory will show up at the root of the so-portlet project (may need to refresh).  At this point this is the contents of the original war file.  
  6. Copy tmp/WEB-INF/liferay-plugin-package.properties to docroot/WEB-INF in the so-portlet project (Create WEB-INF if it doesn't already exist).
  7. Modify liferay-plugin-package.properties and change module-incremental-version to 10.  This will cause your custom so-portlet to always take priority over the default so-portlet.
  8. Copy tmp/sites/edit_site.jsp to docroot/sites
  9. Modify docroot/sites/edit_site.jsp and remove the lines that define Public and Public Restricted Sites (Search for TYPE_SITE_OPEN and TYPE_SITE_PUBLIC_RESTRICTED).
  10. Run the all Ant task again and now tmp will be a combination of the default war file and your cusomizations.  This also generates a custom war file in the plugins SDK dist folder that can be deployed to a Liferay server

That's pretty much it.  This procedure can be used with pretty much any portlet project including EE versions.

Blogs
I have the same requirements in my project. But I don't know where to get so-portlet war file. Can you?
Hi Jamie, I have the same proble to understand how to make the war of the portlet that I want to modify.

I have to modify the so-portlet.

Up to now, I have the source code of Social Office 3.0 , I have imported in Eclipse the so-portlet to make the war from myself, but there are a lot of errors that I have to manage.

Is this the right way or there's another one to do this?

Thanks
Gaetano
rename the "SocialOffice.lpkg" in "SocialOffice.zip" and inside I can find all the 18 portlet of social office.
Can we modify the java classes as well using this procedure ?
In case we need to modify the actual business logic in one of the portlets?
Yes. You have to copy the folder WEB-INF under /docroot, and after you can modify all the java classes.

Copy all the WEB-INF folder is necessary to avoid the dependencies.

Bye
Gaetano
Thanks for quick response Gaetano, had to copy the source files under docroot/WEB-INF/src. Now we are able to extend existing portlet classes using custom classes.
As per my understanding for overriding other config files like portlet.xml,liferay-display.xml, we need to copy each to docroot/WEB-INF folder ?
[ As per my understanding for overriding other config files like portlet.xml,liferay-display.xml, we need to copy each to docroot/WEB-INF folder ? ]

Yes, every file that you have to modify needs to be copied in docroot/WEB-INF in the same directory structure (as this guide explain).

Bye
Gaetano
This procedure was successful to me only when I use build-common-plugin-ext.xml. Should this be done with build-common-plugin.xml?