Skip to content

Commit

Permalink
Added Order Enum
Browse files Browse the repository at this point in the history
  • Loading branch information
r4m-juan committed Dec 14, 2021
1 parent c8b2495 commit 69259f2
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions src/main/java/com/route4me/sdk/services/orders/OrderStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* The MIT License
*
* Copyright 2021 Route4Me.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.route4me.sdk.services.orders;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
*
* @author Route4Me
*/
public class OrderStatus {

public enum OrderStatusEnum {

NEW(0),
INBOUND_SCAN(1),
SORTED_BY_TERRITORY(2),
LOADED(3),
MISSING(4),
DAMAGED(5),
MANUALLY_LOADED(6),
ROUTED(7),
UNROUTED(8),
SORTED_BY_ROUTE(9),
ROUTE_STARTED(10),
FAILED(11),
SKIPPED(12),
DONE(13),
CANCELLED(14),
SCHEDULED(15);

private int value;
private static final Map<Integer, OrderStatusEnum> lookup
= new HashMap<>();

static {
for (Iterator<OrderStatusEnum> it = EnumSet.allOf(OrderStatusEnum.class).iterator(); it.hasNext();) {
OrderStatusEnum s = it.next();
lookup.put(s.getValue(), s);
}
}

private OrderStatusEnum(int value) {
this.value = value;
}

/**
* @return the value
*/
public int getValue() {
return value;
}

/**
* @param value the value to set
*/
public void setValue(int value) {
this.value = value;
}

public static OrderStatusEnum get(int code) {
return lookup.get(code);
}

}
}

0 comments on commit 69259f2

Please sign in to comment.