Skip to content

Commit 69259f2

Browse files
committed
Added Order Enum
1 parent c8b2495 commit 69259f2

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* The MIT License
3+
*
4+
* Copyright 2021 Route4Me.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
package com.route4me.sdk.services.orders;
25+
26+
import java.util.EnumSet;
27+
import java.util.HashMap;
28+
import java.util.Iterator;
29+
import java.util.Map;
30+
31+
/**
32+
*
33+
* @author Route4Me
34+
*/
35+
public class OrderStatus {
36+
37+
public enum OrderStatusEnum {
38+
39+
NEW(0),
40+
INBOUND_SCAN(1),
41+
SORTED_BY_TERRITORY(2),
42+
LOADED(3),
43+
MISSING(4),
44+
DAMAGED(5),
45+
MANUALLY_LOADED(6),
46+
ROUTED(7),
47+
UNROUTED(8),
48+
SORTED_BY_ROUTE(9),
49+
ROUTE_STARTED(10),
50+
FAILED(11),
51+
SKIPPED(12),
52+
DONE(13),
53+
CANCELLED(14),
54+
SCHEDULED(15);
55+
56+
private int value;
57+
private static final Map<Integer, OrderStatusEnum> lookup
58+
= new HashMap<>();
59+
60+
static {
61+
for (Iterator<OrderStatusEnum> it = EnumSet.allOf(OrderStatusEnum.class).iterator(); it.hasNext();) {
62+
OrderStatusEnum s = it.next();
63+
lookup.put(s.getValue(), s);
64+
}
65+
}
66+
67+
private OrderStatusEnum(int value) {
68+
this.value = value;
69+
}
70+
71+
/**
72+
* @return the value
73+
*/
74+
public int getValue() {
75+
return value;
76+
}
77+
78+
/**
79+
* @param value the value to set
80+
*/
81+
public void setValue(int value) {
82+
this.value = value;
83+
}
84+
85+
public static OrderStatusEnum get(int code) {
86+
return lookup.get(code);
87+
}
88+
89+
}
90+
}

0 commit comments

Comments
 (0)