001    /**
002     * Copyright (c) 2000-2013 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.mobile.device.rulegroup.action.impl;
016    
017    import com.liferay.portal.kernel.util.GetterUtil;
018    import com.liferay.portal.kernel.util.UnicodeProperties;
019    import com.liferay.portlet.mobiledevicerules.model.MDRAction;
020    
021    import java.util.ArrayList;
022    import java.util.Collection;
023    import java.util.Collections;
024    
025    import javax.servlet.http.HttpServletRequest;
026    import javax.servlet.http.HttpServletResponse;
027    
028    /**
029     * @author Edward Han
030     */
031    public class SimpleRedirectActionHandler extends BaseRedirectActionHandler {
032    
033            public static String getHandlerType() {
034                    return SimpleRedirectActionHandler.class.getName();
035            }
036    
037            @Override
038            public Collection<String> getPropertyNames() {
039                    return _propertyNames;
040            }
041    
042            @Override
043            public String getType() {
044                    return getHandlerType();
045            }
046    
047            @Override
048            protected String getURL(
049                    MDRAction mdrAction, HttpServletRequest request,
050                    HttpServletResponse response) {
051    
052                    UnicodeProperties typeSettingsProperties =
053                            mdrAction.getTypeSettingsProperties();
054    
055                    return GetterUtil.getString(typeSettingsProperties.getProperty("url"));
056            }
057    
058            private static Collection<String> _propertyNames;
059    
060            static {
061                    _propertyNames = new ArrayList<String>(1);
062    
063                    _propertyNames.add("url");
064    
065                    _propertyNames = Collections.unmodifiableCollection(_propertyNames);
066            }
067    
068    }