use of org.compiere.util.Util.ArrayKey in project metasfresh-webui-api by metasfresh.
the class ViewsRepository method createFactoriesMap.
private static ImmutableMap<ArrayKey, IViewFactory> createFactoriesMap(final Collection<IViewFactory> viewFactories) {
final Map<ArrayKey, IViewFactory> factories = new HashMap<>();
for (final IViewFactory factory : viewFactories) {
final ViewFactory annotation = factory.getClass().getAnnotation(ViewFactory.class);
if (annotation == null) {
// this might be a development bug
logger.warn("Skip {} because it's not annotated with {}", factory, ViewFactory.class);
continue;
}
final WindowId windowId = WindowId.fromJson(annotation.windowId());
JSONViewDataType[] viewTypes = annotation.viewTypes();
if (viewTypes.length == 0) {
viewTypes = JSONViewDataType.values();
}
for (final JSONViewDataType viewType : viewTypes) {
factories.put(mkFactoryKey(windowId, viewType), factory);
}
}
return ImmutableMap.copyOf(factories);
}
use of org.compiere.util.Util.ArrayKey in project metasfresh-webui-api by metasfresh.
the class MenuTree method getNewRecordNodeForWindowId.
public Optional<MenuNode> getNewRecordNodeForWindowId(final WindowId windowId) {
final DocumentId elementId = windowId.toDocumentId();
final ArrayKey key = mkTypeAndElementIdKey(MenuNodeType.NewRecord, elementId);
final List<MenuNode> nodes = nodesByTypeAndElementId.get(key);
if (nodes == null || nodes.isEmpty()) {
return Optional.empty();
}
final MenuNode newRecordNode = nodes.get(0);
return Optional.of(newRecordNode);
}
use of org.compiere.util.Util.ArrayKey in project metasfresh-webui-api by metasfresh.
the class MenuTree method getFirstNodeByElementIdOrNull.
private MenuNode getFirstNodeByElementIdOrNull(final MenuNodeType type, final DocumentId elementId) {
final ArrayKey key = mkTypeAndElementIdKey(type, elementId);
final List<MenuNode> nodes = nodesByTypeAndElementId.get(key);
if (nodes == null || nodes.isEmpty()) {
return null;
}
return nodes.get(0);
}
Aggregations