001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.upgrade.v5_0_0;
016    
017    import com.liferay.portal.kernel.upgrade.UpgradeProcess;
018    import com.liferay.portal.kernel.upgrade.util.TempUpgradeColumnImpl;
019    import com.liferay.portal.kernel.upgrade.util.UpgradeColumn;
020    import com.liferay.portal.kernel.upgrade.util.UpgradeTable;
021    import com.liferay.portal.kernel.upgrade.util.UpgradeTableFactoryUtil;
022    import com.liferay.portal.upgrade.v5_0_0.util.IGFolderNameColumnImpl;
023    import com.liferay.portal.upgrade.v5_0_0.util.IGFolderTable;
024    import com.liferay.portal.upgrade.v5_0_0.util.IGImageNameColumnImpl;
025    import com.liferay.portal.upgrade.v5_0_0.util.IGImageTable;
026    
027    /**
028     * @author Alexander Chow
029     */
030    public class UpgradeImageGallery extends UpgradeProcess {
031    
032            @Override
033            protected void doUpgrade() throws Exception {
034    
035                    // IGFolder
036    
037                    UpgradeColumn groupIdColumn = new TempUpgradeColumnImpl("groupId");
038    
039                    UpgradeColumn parentFolderIdColumn = new TempUpgradeColumnImpl(
040                            "parentFolderId");
041    
042                    IGFolderNameColumnImpl igFolderNameColumn = new IGFolderNameColumnImpl(
043                            groupIdColumn, parentFolderIdColumn);
044    
045                    UpgradeTable upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
046                            IGFolderTable.TABLE_NAME, IGFolderTable.TABLE_COLUMNS,
047                            groupIdColumn, parentFolderIdColumn, igFolderNameColumn);
048    
049                    upgradeTable.updateTable();
050    
051                    // IGImage
052    
053                    UpgradeColumn imageIdColumn = new TempUpgradeColumnImpl("imageId");
054    
055                    IGImageNameColumnImpl imageNameColumn =
056                            new IGImageNameColumnImpl(imageIdColumn);
057    
058                    upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
059                            IGImageTable.TABLE_NAME, IGImageTable.TABLE_COLUMNS,
060                            imageIdColumn, imageNameColumn);
061    
062                    upgradeTable.updateTable();
063            }
064    
065    }