Let's say I'm adding data to different portlets inside of the Liferay Portal. Where is all these data saved to?
Most of the out of the box portlets that Liferay ships with like Blogs, Forums, Wiki, Web content gets stored in Liferay database. You can see the tables and the actual data properly if you have a production ready database configured with Liferay like MySQL or Oracle.
Liferay by default ships with Hypersonic database for quick demo purpose. It save all the information in a file. All the hypersonic related files are saved in "data\hsql" folder inside wherever you have extracted Liferay. You can view the tables using DbVisualizer if you want to see hypersonic db data.
You can also create your custom portlets. Where the data of these has to be stored is completely upto you. You can save the data in the Liferay's database if you want but that is not mandatory. It's upto you where you want to persist data for the custom portlets
Related
I have been using Liferay for work for 2 weeks. I noticed that it's a bit difficult to find good documentation and tutorials.
Until now I created pages from the web portal. After I create them, I drag and drop portlets. I don't really like this approach, I would prefer to use a coding approach. Is there a way to create a website or page programmatically by defining a project as I do to create portlets?
Moreover, I am using Liferay with WebLogic 10.3.6. I want to know where liferay puts pages I created via web-portal on the file system. I suppose that a file, or something similar, is created when I declare a new site on the Liferay web-portal.
Thank you all,
Marco
Yes Liferay has it's Database, all data of any Liferay object is stored in the database and / or on the file system depending on your configuration.
However, one of the functionality of Liferay is to let you create pages / sites through the UI. As documented in the Java Portal Specification and Liferay Server Documents your approach to create pages in an alternative way is possible but it is part of Liferay's Portal Services. You can use Liferay's Service (HTTP REST) API to call the related service. To access those APIs you need to configure your Liferay Server.
In case you want to do programmatically you still need to configure, enable and call those external HTTP services from your code. You should not create Liferay Objects from your own code hosted as an extension inside your Liferay Instance as that will result inconsistency in your Liferay Database / filesystem. (As in case of page creation Liferay creates a set of other related objects in it's database / filesystem.)
In your liferay bundle you will find two plugins of interest.
First is resources-importer-web for which description says
The Resources Importer app allows front-end developers to package web
content, portlet configurations, and layouts together in a theme
without saving it as a compiled .LAR file thereby allowing for greater
flexibility in its usage between Liferay Portal versions.This app will automatically create associated content when other
plugins are deployed that are configured to make use of the Resource
Importer app.This app installs as a Liferay service.
Second is welcome-theme which declares resources to be created by resources-importer-web. This on should be example how to create your own. Take a look at
welcome-theme\WEB-INF\src\resources-importer\*
welcome-theme\WEB-INF\liferay-plugin-package.properties
This feature is described at importing-resources-with-themes
As mentioned by gabor_the_kid, Liferay stores all objects in its tables. For example, User related objects would be in user table. Liferay exposed services or API's to change the default/to add new behaviors by program but not easier than achieving it through UI. Also maintenance should be considered for going program way of creating pages or layouts etc.
You can describe your changes using xml and use the Liferay Portal DB Setup core to create the changes in DB.
The library defines the list of available xml configurations.
on the web there are many resources about exporting a development database (HSQL) into a production one (eg. MySQL), but I need to move data in the opposite way.
I usually use the Liferay embedded function to export data to a new database, but it needs for a running database server instance (and it seems to be impossible using HSQL).
Does a way to achieve this goal exist in Liferay 6.2?
Thanks
Go to Control Panel / Server Administration / Data Migration. You can give the standard HSQL URLs - you don't need a running HSQL server. The standard HSQL parameters can be found in Liferay's portal.properties under Hypersonic
I am new to liferay. I am developing delete scheduler, which has to delete documents programatically based on some condition. using DLfileLocalServiceUtil.deleteFileEntry(id) I can delete it, but it is deleting only entry in DlfileEntry table not the actual file stored in file system in server in data folder.
DLfileLocalServiceUtil is used for managing Documents. You need to use 'JournalArticle*Util' APIs to deal with Web Contents. There are multiple Util classes for different purpose. You'll perhaps need JournalArticleLocalServiceUtil.deleteJournalArticle() methods for deleting the web contents.
I need to have the same functionality provided by the "Documents and Media display" liferay portlet but I would like to use a database other than the liferay with additional custom fields. Is It possible? Is There another portlet to display storing documents in liferay?
Anything is possible with Liferay, but this goes against a lot of basic principles of content management. Most importantly:
You want to manage content that the Content Management System (CMS) does not own
You want to use data stored in a format your CMS does not understand or maintain
If you want to use Liferay as your CMS, your best bet is to migrate the documents into the Liferay Document Library and attach your additional content using Custom Fields or 1+ custom service entities that relate back to the document and you maintain.
I want to keep web content in liferay database. Currently the JPGs are in another filesystem on another server, which I want to move to liferay database. Is there a way to bulk import these JPGs/web content to liferay db? One option I'm thinking is having a daily scheduled job to import new files from the filesystem. Curious to hear if anyone else has done it and how?
I found that there is a thing called as Database Hook. But as far as I understand, this lets you save to db only those files which you upload through the Image Gallery in Liferay. Which is a bit different from having to import files from another filesystem programmatically.
When you go to Liferay's Document Library (or image gallery in 6.0) you'll find a link "Access from Desktop" in every folder. This can be used to connect via WebDAV, so you can connect to Liferay's Document Library as if it was a Network share. Then just copy through batch files or explorer (drag&drop) and they'll end up in the doclib. Works in both directions.
For Liferay 6.1 you can also consider Liferay Sync, a Dropbox-like client that just synchronizes the document library with a folder on a local (remote from the server) system.
And the most complex variant (just to be complete here) is to use Liferay's API to insert documents programmatically. The advandage here is that you can also use it to tag and categorize the content during your import process, but it definitely is more work than just dragging and dropping files.