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.portal.kernel.backgroundtask;
016    
017    import java.io.Serializable;
018    
019    /**
020     * @author Michael C. Han
021     */
022    public class BackgroundTaskResult implements Serializable {
023    
024            public static BackgroundTaskResult SUCCESS = new BackgroundTaskResult(
025                    BackgroundTaskConstants.STATUS_SUCCESSFUL);
026    
027            public BackgroundTaskResult() {
028            }
029    
030            public BackgroundTaskResult(int status) {
031                    _status = status;
032            }
033    
034            public BackgroundTaskResult(int status, String statusMessage) {
035                    _status = status;
036                    _statusMessage = statusMessage;
037            }
038    
039            public int getStatus() {
040                    return _status;
041            }
042    
043            public String getStatusMessage() {
044                    return _statusMessage;
045            }
046    
047            public boolean isSuccessful() {
048                    if (_status == BackgroundTaskConstants.STATUS_SUCCESSFUL) {
049                            return true;
050                    }
051    
052                    return false;
053            }
054    
055            public void setStatus(int status) {
056                    _status = status;
057            }
058    
059            public void setStatusMessage(String statusMessage) {
060                    _statusMessage = statusMessage;
061            }
062    
063            private int _status;
064            private String _statusMessage;
065    
066    }