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.oauth;
016    
017    import com.liferay.portal.kernel.oauth.Verb;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     */
022    public class VerbTranslator {
023    
024            public static Verb translate(org.scribe.model.Verb verb) {
025                    if (verb == org.scribe.model.Verb.DELETE) {
026                            return Verb.DELETE;
027                    }
028                    else if (verb == org.scribe.model.Verb.GET) {
029                            return Verb.GET;
030                    }
031                    else if (verb == org.scribe.model.Verb.POST) {
032                            return Verb.POST;
033                    }
034                    else if (verb == org.scribe.model.Verb.PUT) {
035                            return Verb.PUT;
036                    }
037                    else {
038                            throw new IllegalArgumentException("Unknown verb " + verb);
039                    }
040            }
041    
042            public static org.scribe.model.Verb translate(Verb verb) {
043                    if (verb == Verb.DELETE) {
044                            return org.scribe.model.Verb.DELETE;
045                    }
046                    else if (verb == Verb.GET) {
047                            return org.scribe.model.Verb.GET;
048                    }
049                    else if (verb == Verb.POST) {
050                            return org.scribe.model.Verb.POST;
051                    }
052                    else if (verb == Verb.PUT) {
053                            return org.scribe.model.Verb.PUT;
054                    }
055                    else {
056                            throw new IllegalArgumentException("Unknown verb " + verb);
057                    }
058            }
059    
060    }