Accessing two projects at the same time – copy data

In this article I want to show you a way how to access two projects (on the same RedDot CMS server) at the same time. This is very useful to copy data from one project directly to an other. I used it one year ago for a relaunch of the Hapag-Lloyd’s site www.hapag-lloyd.com.

Here I want to show you the way to reuse the login information while you are connected with one user per project. But it is also possible to login via user name and password.

String logonGuidOld="EF103F2989C94BCEBBC189427F9E6729";
String sessionKeyOld="6F4929F495D04A779F07587E1B294A6D";
String projectGuidOld="5256C671655D4CE696F663C73CE3E526";

CmsClient clientOld = new CmsClient(logonGuidOld);
Project projectOld = clientOld.getProject(sessionKeyOld, projectGuidOld);

String logonGuid=”D714CF042F3749DFA13298E489552468″;
String sessionKey=”C463987D1AAA4F1E9C7B394CD485B7AE”;
String projectGuid=”73671509FA5C43ED8FC4171AD0298AD2″;

CmsClient client = new CmsClient(logonGuid);
Project project = client.getProject(sessionKey, projectGuid);

Page sourcePg = projectOld.getPageById(“old page id”);

Page targetPg = project.getPageById(“new page id”);

As you can see it’s quite simple to program an access to several projects at the same time. Using the available methods for getting and setting data you can satisfy almost every migration task you receive (as long as jRQL offers it).

I used exactly this approach to directly create all of our office pages in the new project and fill all contact data from old into the new table. It takes one morning to write the program and streamline the old data before writing it again. Within some hours the program does the job. This is one of my personal success stories.

You can even migrate images and media files following these steps:

  1. programatically download the files from the old project under a new filename (if you need)
  2. manually copying all files to the server machine and import it into the new project’s folder
  3. use another jRQL program to set all new filenames in the new project’s pages

For further details on downloading images, please refer to the article about image editing.

On such a migration task you usually need to access a big amount of pages, therfore you should have a look how jRQL helps you to handle a list of pages.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: