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; 021 022/** 023 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a> 024 * @since 5.7 025 */ 026public class CSVImportStatus { 027 028 private final State state; 029 030 private final int positionInQueue; 031 032 private final int queueSize; 033 034 public enum State { 035 SCHEDULED, RUNNING, COMPLETED 036 } 037 038 public CSVImportStatus(State state) { 039 this(state, 0, 0); 040 } 041 042 public CSVImportStatus(State state, int positionInQueue, int queueSize) { 043 this.state = state; 044 this.positionInQueue = positionInQueue; 045 this.queueSize = queueSize; 046 } 047 048 public State getState() { 049 return state; 050 } 051 052 public int getPositionInQueue() { 053 return positionInQueue; 054 } 055 056 public int getQueueSize() { 057 return queueSize; 058 } 059 060 public boolean isScheduled() { 061 return state == State.SCHEDULED; 062 } 063 064 public boolean isRunning() { 065 return state == State.RUNNING; 066 } 067 068 public boolean isComplete() { 069 return state == State.COMPLETED; 070 } 071}