001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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            protected void doUpgrade() throws Exception {
033    
034                    // IGFolder
035    
036                    UpgradeColumn groupIdColumn = new TempUpgradeColumnImpl("groupId");
037    
038                    UpgradeColumn parentFolderIdColumn = new TempUpgradeColumnImpl(
039                            "parentFolderId");
040    
041                    IGFolderNameColumnImpl igFolderNameColumn = new IGFolderNameColumnImpl(
042                            groupIdColumn, parentFolderIdColumn);
043    
044                    UpgradeTable upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
045                            IGFolderTable.TABLE_NAME, IGFolderTable.TABLE_COLUMNS,
046                            groupIdColumn, parentFolderIdColumn, igFolderNameColumn);
047    
048                    upgradeTable.updateTable();
049    
050                    // IGImage
051    
052                    UpgradeColumn imageIdColumn = new TempUpgradeColumnImpl("imageId");
053    
054                    IGImageNameColumnImpl imageNameColumn =
055                            new IGImageNameColumnImpl(imageIdColumn);
056    
057                    upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
058                            IGImageTable.TABLE_NAME, IGImageTable.TABLE_COLUMNS,
059                            imageIdColumn, imageNameColumn);
060    
061                    upgradeTable.updateTable();
062            }
063    
064    }