-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take SearchOptions into separate configuration class
- Loading branch information
1 parent
1d9ef47
commit e088157
Showing
6 changed files
with
82 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/org/chainoptim/desktop/shared/search/model/SearchOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,19 @@ | ||
package org.chainoptim.desktop.shared.search.model; | ||
|
||
import org.chainoptim.desktop.shared.search.filters.FilterOption; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class SearchOptions { | ||
|
||
private List<FilterOption> filterOptions; | ||
private Map<String, String> sortOptions; | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/org/chainoptim/desktop/shared/search/model/SearchOptionsConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.chainoptim.desktop.shared.search.model; | ||
|
||
import org.chainoptim.desktop.shared.common.uielements.UIItem; | ||
import org.chainoptim.desktop.shared.enums.Feature; | ||
import org.chainoptim.desktop.shared.enums.FilterType; | ||
import org.chainoptim.desktop.shared.search.filters.FilterOption; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class SearchOptionsConfiguration { | ||
|
||
private SearchOptionsConfiguration() { | ||
} | ||
|
||
private static final SearchOptions SUPPLIER_ORDER_OPTIONS = new SearchOptions( | ||
List.of( | ||
new FilterOption( | ||
new UIItem("Order Date Start", "orderDateStart"), | ||
new ArrayList<>(), | ||
FilterType.DATE | ||
), | ||
new FilterOption( | ||
new UIItem("Quantity", "greaterThanQuantity"), | ||
new ArrayList<>(), | ||
FilterType.NUMBER | ||
), | ||
new FilterOption( | ||
new UIItem("Status", "status"), | ||
List.of(new UIItem("Delivered", "DELIVERED"), new UIItem("Pending", "PENDING")), | ||
FilterType.ENUM | ||
) | ||
), | ||
Map.of( | ||
"orderDate", "Order Date", | ||
"estimatedDeliveryDate", "Estimated Delivery Date", | ||
"deliveryDate", "Delivery Date", | ||
"quantity", "Quantity" | ||
) | ||
); | ||
|
||
private static final Map<Feature, SearchOptions> SEARCH_OPTIONS_MAP = Map.of( | ||
Feature.SUPPLIER_ORDER, SUPPLIER_ORDER_OPTIONS | ||
); | ||
|
||
public static SearchOptions getSearchOptions(Feature feature) { | ||
return SEARCH_OPTIONS_MAP.get(feature); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters