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(String translationId, String fromText) {
028                    _translationId = translationId;
029                    setFromText(fromText);
030            }
031    
032            public Translation(String translationId, String fromText, String toText) {
033                    _translationId = translationId;
034                    setFromText(fromText);
035                    setToText(toText);
036            }
037    
038            public String getFromText() {
039                    return _fromText;
040            }
041    
042            public String getToText() {
043                    return _toText;
044            }
045    
046            public String getTranslationId() {
047                    return _translationId;
048            }
049    
050            public void setFromText(String fromText) {
051                    try {
052                            _fromText = new String(fromText.getBytes(), StringPool.UTF8);
053                    }
054                    catch (UnsupportedEncodingException uee) {
055                    }
056            }
057    
058            public void setToText(String toText) {
059                    try {
060                            _toText = new String(toText.getBytes(), StringPool.UTF8);
061                    }
062                    catch (UnsupportedEncodingException uee) {
063                    }
064            }
065    
066            private String _fromText;
067            private String _toText;
068            private String _translationId;
069    
070    }