001/* 002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Thomas Roger 018 */ 019 020package org.nuxeo.ecm.csv.core; 021 022import java.io.Serializable; 023 024/** 025 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a> 026 * @since 5.7 027 */ 028public class CSVImportStatus implements Serializable { 029 030 private static final long serialVersionUID = 1L; 031 032 private final State state; 033 034 private final int positionInQueue; 035 036 private final int queueSize; 037 038 public enum State { 039 SCHEDULED, RUNNING, COMPLETED 040 } 041 042 public CSVImportStatus(State state) { 043 this(state, 0, 0); 044 } 045 046 public CSVImportStatus(State state, int positionInQueue, int queueSize) { 047 this.state = state; 048 this.positionInQueue = positionInQueue; 049 this.queueSize = queueSize; 050 } 051 052 public State getState() { 053 return state; 054 } 055 056 public int getPositionInQueue() { 057 return positionInQueue; 058 } 059 060 public int getQueueSize() { 061 return queueSize; 062 } 063 064 public boolean isScheduled() { 065 return state == State.SCHEDULED; 066 } 067 068 public boolean isRunning() { 069 return state == State.RUNNING; 070 } 071 072 public boolean isComplete() { 073 return state == State.COMPLETED; 074 } 075}