留言板

How to use liferay for Larger Sites

thumbnail
Auditya manikanta Vadrevu,修改在15 年前。

How to use liferay for Larger Sites

Liferay Master 帖子: 621 加入日期: 08-5-6 最近的帖子
hi,
i have a requirement where i need to maintain a large site in liferay portal.

The website contains almost 800 pages. How to migrate from that site to our portal.

One way is to start creating all pages, journal contents etc.., (it will take so much of time)

Any other ideas..., it will be helpfull


Thanks in Advance,
V.Auditya
thumbnail
Victor Zorin,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Legend 帖子: 1228 加入日期: 08-4-14 最近的帖子
Just finished similar data migration, for local government, from a third-party CMS, 8,000+ entries, plus documents plus calendar events.

The only way to do such volume is to create a Java migration script, which will do transfer of all data into Liferay. In our case, the script was loading data directly from CMS database and publishing them as articles in liferay portal.

A couple of other things had to be done to maintain synchronization of sites during roll-over time, as previous site was live and liferay-based one was under completion.
A portlet had to be developed which would display the latest additions to live site, so the content would be synchronized manually on a daily basis, until switchover time.
thumbnail
Auditya manikanta Vadrevu,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Master 帖子: 621 加入日期: 08-5-6 最近的帖子
hi victor,

thanks for ur quick and valuable reply.


Ok this will work fine if the client site have cms database, but in my case all the pages are static (just html files, not in database).

What i planned is to copy whole site folder in webapps and and call the files through embedded link option in pages. (and l will give folder permissions to various users to update content in files.) But the problem in this method is upon refresh of the page , the page renders the first page (which we have specified in embedded link).

U could get a doubt that if this is the method then why to use portal..... This is because, I want to extend my previous static site with liferay collaboration features, CMS etc.., so that from now i can use cms in my site with my previous static files.

do u have any idea how to overcome that refresh problem in embedded link? or any other idea how to import files in portal ?



Thanks in Advance,
V.Auditya
thumbnail
Victor Zorin,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Legend 帖子: 1228 加入日期: 08-4-14 最近的帖子
Not really clear about "refresh" issues, suppose could be addressed one or another way.

But I would probably still migrate an entire content into the liferay, it is much better from content and configuration management point of view. It really does not matter whether you migrate data from database or from static pages, you still publish an article in liferay. Your case would probably be even simpler, since one page would be represented by a single article.

If you still would like to maintain both sites running in parallel, there could be another way:
rather then making links from dynamic liferay to static site, which is as you are saying has got some fundamental problems, do it the the other way - make static links from static website to liferay-based collaboration area. If look-and-feel is the same, user won't notice the site change and you would not have "refresh" problems.
thumbnail
Auditya manikanta Vadrevu,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Master 帖子: 621 加入日期: 08-5-6 最近的帖子
hi victor,

If look-and-feel is the same, user won't notice the site change and you would not have "refresh" problems.


This is a good idea .


It really does not matter whether you migrate data from database or from static pages, you still publish an article in liferay. Your case would probably be even simpler, since one page would be represented by a single article.


I can see the only option of migrating the data from static pages to journal content is to add articles one by one for every page manually. ( it will be quite hard if our site have more than 800 pages). Is there any other method to migrate ? (dynamically ?)


Thanks in Advance,
V.Auditya
thumbnail
Victor Zorin,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Legend 帖子: 1228 加入日期: 08-4-14 最近的帖子
I di dnot mean migrating by hand, but as we did it, do it automatically, using Liferay API.
1. Go through every link on static site,
2. get page html,
3. modify page html by changing over urls within the html to liferay friendly urls
3. create article xml from it
4.ceate a new article using Liferay API
5. create a page with friendly url' using Liferay API
6. create 'article content portlet' instance on this page using Liferay API
7. assign published article to this portlet instance using liferay API

All automatically , it is worth to spend a couple of days to write such Java class.

You would probably need to create an empty theme for those pages, because each article will contain an entire layout of the static site.
thumbnail
Auditya manikanta Vadrevu,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Master 帖子: 621 加入日期: 08-5-6 最近的帖子
hi victor,


Thanks for the solution.



can u give an example how u have managed with that liferay API and also that java file(as u have developed it) .This will be very helpfull.





Thanks in Advance,
V.Auditya
thumbnail
Victor Zorin,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Legend 帖子: 1228 加入日期: 08-4-14 最近的帖子
Unlike my own company files, this particular source code can not be given away as by implementation contract it became client's intellectual property.
Have a look at liferay service utility classes, they provide all methods you would need, eg. com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil for article publishing. All of them are fairly straightforward. If in doubt, use liferay's struts-config.xml to find Action classes that show how these utilities are used by liferay portlets itself.
thumbnail
Auditya manikanta Vadrevu,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Master 帖子: 621 加入日期: 08-5-6 最近的帖子
hi victor,

ok no probs..

i will try to develop it. thanks for the hints.


Thanks,
V.Auditya
thumbnail
Victor Zorin,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Legend 帖子: 1228 加入日期: 08-4-14 最近的帖子
Adding link to similar post, which may provide more samples, Migrate foreign data .
thumbnail
Auditya manikanta Vadrevu,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Master 帖子: 621 加入日期: 08-5-6 最近的帖子
hi victor,
thanks for ur hint.

First i have tried to add the article with the sample data which i have entered manually.


article = JournalArticleLocalServiceUtil.addArticle(userid,articleId,false,plid,title,description,
manual_body_string,type,
structureId,templateId,10,10,2008,0,0,1,1,1,1,1,true,1,1,1,1,1,true,true,false,null,null,null,
articleURL,req.getPreferences(),new String[0],true,true);


The article has been added successfully.


But the body is not displaying the string i have passed with contentPre and contentPost Strings.

But when i pass only the string without the contentPre and contentPost string the body of the journal is displayed correctly but an error is seen in log

10:59:13,667 ERROR [LocaleTransformerListener:118] org.dom4j.DocumentException: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.



and also ..


Actually i didnt understood how u created articleId uniquely
String articleId = prop.getProperty("url").replaceAll("/", ".");
logger.info("articleId=" + articleId);
if (articleId.length() > 75) {
 String hash = String.valueOf(articleId.hashCode());
 articleId = articleId.substring(0, 70 - hash.length());
 articleId += "." + hash;
 logger.info("************** reduced article ID to " + articleId);
}


With Regards
V.Auditya.
thumbnail
Victor Zorin,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Legend 帖子: 1228 加入日期: 08-4-14 最近的帖子
1. article content shall be a valid XML file
Go to your liferay database, get to the field which contains journal content, and see how does it look like.

2. with article id, I had to come up with the way of how to relate an article in liferay with the source page.
So if the source page URL is '/intranet/hr/forms', article id would be 'intranet.hr.forms'.
However there is a length limit on article id, so if url is too long, I was hashing the rest of the url, to maintain its uniqueness.
By having an articleId properly built, we are able to re-import full content on the fly, or detect and re-submit those articles that have been modified on old system during phasing/testing period.
thumbnail
Auditya manikanta Vadrevu,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Master 帖子: 621 加入日期: 08-5-6 最近的帖子
hi victor,

Now i understood about the article id. thanks for the help. and also the content is also displayed corrrectly.

But still with a structure and template given(not default) iam getting a problem in displaying the content, i have seen the content from database as u suggested.

Its working with only default structure and default template .

here is my code


String contentPre = "<!--?xml version=\"1.0\" encoding=\"UTF-8\"?-->"
+ "<root available-locales="\&quot;en_US\&quot;" default-locale="\&quot;\&quot;">"
+ "<static-content language-id="\&quot;en_US\&quot;">";

String customString = "My name is auditya";

String contentPost = "</static-content></root>";

String body = contentPre + customString + contentPost;

System.out.println(body);
// i have specified structure id and template id in the method.
System.out.println("ARTICLE ADDED");
System.out.println("APPROVED");



here is the log after execution,



<?xml version="1.0" encoding="UTF-8"?><root available-locales="en_US" default-locale=""><static-content language-id="en_US"><![CDATA[My name is auditya]]></static-content></root>
ARTICLE ADDED
APPROVED



there is no error in log but the created article does not show content in its body.



With regards,
V.Auditya
thumbnail
Victor Zorin,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Legend 帖子: 1228 加入日期: 08-4-14 最近的帖子
Try to set a default-locale in xml template to en_US.
thumbnail
Auditya manikanta Vadrevu,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Master 帖子: 621 加入日期: 08-5-6 最近的帖子
hi victor,

even after adding the default locale also the content is not displayed.


See this Articles --- Files



With Regards,
V.Auditya
thumbnail
Victor Zorin,修改在15 年前。

RE: How to use liferay for Larger Sites

Liferay Legend 帖子: 1228 加入日期: 08-4-14 最近的帖子
Auditya, keep playing around locales.
We had a couple of issues like this before as liferay does not handle locales in a standard way when displaying article content.

We had articles coming up 'with no content' for some users and 'with content' for other users. After we ran scripts over liferay tables aligning user and article locales, problem was gone.
deva v,修改在14 年前。

RE: How to use liferay for Larger Sites

New Member 帖子: 2 加入日期: 09-6-1 最近的帖子
This Post is a Very good guide to migrate larger sites automatically into liferay.





Thanks to Victor & Auditya
thumbnail
Lisa Simpson,修改在14 年前。

RE: How to use liferay for Larger Sites

Liferay Legend 帖子: 2034 加入日期: 09-3-5 最近的帖子
Can you guys be persuaded to write a wiki article about this????
thumbnail
Samujjwal Sahu,修改在11 年前。

RE: How to use liferay for Larger Sites

Junior Member 帖子: 31 加入日期: 12-5-22 最近的帖子
Hi Victor,
I have done all the steps as you have mentioned. And thanks for this helpful thread. But I am stuck in a place right now: Please help me with some input.

I am using Liferay 6.1 EE
Things that are working fine:
1. Creating a page
2. Creating JournalArticle by adding the PreContent and PostContent strings (to make the content XML) using default structure (static-content ) as well as using a fixed structure (dynamic-content)
3. Adding a Web Content Display portlet in the newly created page.
4. Setting the JournalArticle into that Web Content Display portlet.

BUT the portlet is showing blank.

I feel the problem lies with the content generation.
PreContent and Post-Content for Dynamic element:
String contentPre = "<?xml version=\"1.0\" ?>"
+ "<root available-locales=\"en_US\" default-locale=\"en_US\">"
+ "<dynamic-element name=\"var\" instance-id=\"" +instanceId
+"\" type=\"text_area\" index-type=\"text\"><dynamic-content><![CDATA[";
String contentPost = "]]></dynamic-content></dynamic-element></root>";


I am generating the instance-id usinf the below method:
protected String generateInstanceId() {
StringBuilder instanceId = new StringBuilder(8);

String key = PwdGenerator.KEY1 + PwdGenerator.KEY2 + PwdGenerator.KEY3;

for (int i = 0; i < 8; i++) {
int pos = (int)Math.floor(Math.random() * key.length());

instanceId.append(key.charAt(pos));
}
return instanceId.toString();
}


For default structures or static content the Precontent and postcontent is :
String contentPre = "<?xml version=\"1.0\" ?>"
+ "<root available-locales=\"en_US\" default-locale=\"en_US\">"
+ "<static-content language-id=\"en_US\"><![CDATA[";
String contentPost = "]]></static-content></root>";


As you can see that i have also set the Locales en_US but still its not showing up.

Please share your view on this:

Regards
Samujjwal
thumbnail
Victor Zorin,修改在11 年前。

RE: How to use liferay for Larger Sites

Liferay Legend 帖子: 1228 加入日期: 08-4-14 最近的帖子
A couple of questions to help in debugging:

1). do you have pages with given friendly urls created in your portal and target organisation/site?

2). if yes, do you have WebContent portlet deployed on these pages?

3). Do you see any publshed articles or even with empty content but with given title when you access Control Panel > Web Content?
thumbnail
Samujjwal Sahu,修改在11 年前。

RE: How to use liferay for Larger Sites

Junior Member 帖子: 31 加入日期: 12-5-22 最近的帖子
Hi Victor,
Thanks for your reply.
1). do you have pages with given friendly urls created in your portal and target organisation/site? - Yes

2). if yes, do you have WebContent portlet deployed on these pages? - Yes

3). Do you see any published articles or even with empty content but with given title when you access Control Panel > Web Content? - Yes

Yaah I am able to see all the above mentioned things.
I have been able to solve the problem. I was not using the below mentioned method:

JournalArticleLocalServiceUtil.updateJournalArticle(article, true);


After the addArticle() call i called the above mentioned method and it worked.

I more thing which i did is making the autoArticleId : true

Thanks for the reply Victor.

Regards
Samujjwal
thumbnail
Victor Zorin,修改在11 年前。

RE: How to use liferay for Larger Sites

Liferay Legend 帖子: 1228 加入日期: 08-4-14 最近的帖子
Congtrats!
thumbnail
Samujjwal Sahu,修改在11 年前。

RE: How to use liferay for Larger Sites

Junior Member 帖子: 31 加入日期: 12-5-22 最近的帖子
emoticon
One more thing Victor,
How can we programmatically set a particular portlet in a layout template.
Using which util class can i fetch all the layouttemplate present in liferay? Even custom layouts.

And in which table the themes are stored?

I want my users to choose the theme and layout for the content that he will be uploading.

regards
Samujjwal
Muhammad Adnan,修改在8 年前。

RE: How to use liferay for Larger Sites

New Member 帖子: 3 加入日期: 15-4-21 最近的帖子
Hi Samujhwal Sahu,

I used your attached SampleTestPortlet.java and getting following exception

com.liferay.portlet.dynamicdatamapping.NoSuchStructureException: No DDMStructure exists with the key {groupId=10195, classNameId=10109, structureKey=GENERAL}

I am using following IDs

String structureId = "84108";
String templateId = "84110";

Do I need to update these IDs in database?
thumbnail
Samujjwal Sahu,修改在7 年前。

RE: How to use liferay for Larger Sites

Junior Member 帖子: 31 加入日期: 12-5-22 最近的帖子
Hi Adnan,
Yes. These are IDs which I have been using for my portal instance. You need to create one structure and find out the structure ID of it.

Sorry about the delayed reply.

Regards
Samujjwal
thumbnail
Jacques Traore,修改在10 年前。

RE: How to use liferay for Larger Sites

Junior Member 帖子: 49 加入日期: 13-1-21 最近的帖子
Hi everybody,
I have a similar problem and I really hope you can help me because I am working on it for more than 2 months but I can't figure it out.
I am using Liferay 6.1.1/ Tomcat7/Oracle 11g.
I need to upload about 600 web content (with custom structure and template) in both English and French languages.
The SOAP's addArticle(....) works at 90%...
1- The uploaded articles are visible in control panel but not displayed in the asset publisher till I click on publish button. Why???
2- I don't know how to add the translation of the same article.

Thanks in advance,
thumbnail
jose fernandez,修改在10 年前。

RE: How to use liferay for Larger Sites

Junior Member 帖子: 32 加入日期: 08-5-26 最近的帖子
http://www.liferay.com/c/message_boards/find_message?messageId=25237833
thumbnail
Rob Zondag,修改在9 年前。

RE: How to use liferay for Larger Sites

New Member 帖子: 8 加入日期: 12-8-7 最近的帖子
Hi Jose,

Very nice to point to this article but as far as I can see you haven't posted a solution yet ... or ... ?

All the best,

Rob
thumbnail
Samujjwal Sahu,修改在7 年前。

RE: How to use liferay for Larger Sites

Junior Member 帖子: 31 加入日期: 12-5-22 最近的帖子
Hi Jacques,
Wanted to ask if you have called the Updatearticle method as well. I have mentioned in the above posts,

JournalArticleLocalServiceUtil.updateJournalArticle(article, true);

After the addArticle() call i called the above mentioned method and it worked.
I more thing which i did is making the autoArticleId : true

Just check the above two things. If those are done or not. Hope that helps and solves your problem.

Regards
Samujjwal Sahu