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 com.liferay.portal.kernel.exception.SystemException;
018    import com.liferay.portal.model.BackgroundTask;
019    
020    /**
021     * @author Michael C. Han
022     */
023    public class DelegatingBackgroundTaskExecutor
024            implements BackgroundTaskExecutor {
025    
026            public DelegatingBackgroundTaskExecutor(
027                    BackgroundTaskExecutor backgroundTaskExecutor) {
028    
029                    _backgroundTaskExecutor = backgroundTaskExecutor;
030            }
031    
032            @Override
033            public BackgroundTaskResult execute(BackgroundTask backgroundTask)
034                    throws Exception {
035    
036                    return _backgroundTaskExecutor.execute(backgroundTask);
037            }
038    
039            @Override
040            public BackgroundTaskStatusMessageTranslator
041                    getBackgroundTaskStatusMessageTranslator() {
042    
043                    return _backgroundTaskExecutor.
044                            getBackgroundTaskStatusMessageTranslator();
045            }
046    
047            @Override
048            public String handleException(BackgroundTask backgroundTask, Exception e)
049                    throws SystemException {
050    
051                    return _backgroundTaskExecutor.handleException(backgroundTask, e);
052            }
053    
054            @Override
055            public boolean isSerial() {
056                    return _backgroundTaskExecutor.isSerial();
057            }
058    
059            protected BackgroundTaskExecutor getBackgroundTaskExecutor() {
060                    return _backgroundTaskExecutor;
061            }
062    
063            private BackgroundTaskExecutor _backgroundTaskExecutor;
064    
065    }