001    /**
002     * Copyright (c) 2000-2013 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.portlet.translator.model;
016    
017    import com.liferay.portal.kernel.util.StringPool;
018    
019    import java.io.Serializable;
020    import java.io.UnsupportedEncodingException;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class Translation implements Serializable {
026    
027            public Translation(
028                    String fromLanguageId, String toLanguageId, String fromText) {
029    
030                    _fromLanguageId = fromLanguageId;
031                    _toLanguageId = toLanguageId;
032    
033                    setFromText(fromText);
034            }
035    
036            public Translation(
037                    String fromLanguageId, String toLanguageId, String fromText,
038                    String toText) {
039    
040                    _fromLanguageId = fromLanguageId;
041                    _toLanguageId = toLanguageId;
042    
043                    setFromText(fromText);
044                    setToText(toText);
045            }
046    
047            public String getFromLanguageId() {
048                    return _fromLanguageId;
049            }
050    
051            public String getFromText() {
052                    return _fromText;
053            }
054    
055            public String getToLanguageId() {
056                    return _toLanguageId;
057            }
058    
059            public String getToText() {
060                    return _toText;
061            }
062    
063            public void setFromText(String fromText) {
064                    try {
065                            _fromText = new String(fromText.getBytes(), StringPool.UTF8);
066                    }
067                    catch (UnsupportedEncodingException uee) {
068                    }
069            }
070    
071            public void setToText(String toText) {
072                    try {
073                            _toText = new String(toText.getBytes(), StringPool.UTF8);
074                    }
075                    catch (UnsupportedEncodingException uee) {
076                    }
077            }
078    
079            private String _fromLanguageId;
080            private String _fromText;
081            private String _toLanguageId;
082            private String _toText;
083    
084    }