001/* 002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Thomas Roger 016 */ 017 018package org.nuxeo.ecm.csv; 019 020/** 021 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a> 022 * @since 5.7 023 */ 024public class CSVImportStatus { 025 026 private final State state; 027 028 private final int positionInQueue; 029 030 private final int queueSize; 031 032 public enum State { 033 SCHEDULED, RUNNING, COMPLETED 034 } 035 036 public CSVImportStatus(State state) { 037 this(state, 0, 0); 038 } 039 040 public CSVImportStatus(State state, int positionInQueue, int queueSize) { 041 this.state = state; 042 this.positionInQueue = positionInQueue; 043 this.queueSize = queueSize; 044 } 045 046 public State getState() { 047 return state; 048 } 049 050 public int getPositionInQueue() { 051 return positionInQueue; 052 } 053 054 public int getQueueSize() { 055 return queueSize; 056 } 057 058 public boolean isScheduled() { 059 return state == State.SCHEDULED; 060 } 061 062 public boolean isRunning() { 063 return state == State.RUNNING; 064 } 065 066 public boolean isComplete() { 067 return state == State.COMPLETED; 068 } 069}