@Override public ServiceResponse<NavigationElementTree> perform(ServiceRequest<NamedValues> request) throws Exception { String lookup = (String) request.getData().get("lookup"); boolean lazyLoadResource = (Boolean) request.getData().get("lazyLoadResource"); List<NavigationElementTree> navigationElementTrees = new ArrayList<NavigationElementTree>(); if (ConfigContainer.isAppInstalled() && StringUtils.isNotBlank(lookup)) { String packageLookup = StringUtils.getPackageLookup(lookup); if (packageLookup == null) { logger.warn(MSG_WRONG_LOOKUP); } else { OPFContext context = OPFContext.getContext(); INavElementContainer navElementContainer = context.getNavElementContainer(); List<NavigationElement> navElementListByPackage = navElementContainer.getNavElementListByPackage(packageLookup); if (navElementListByPackage == null || navElementListByPackage.isEmpty()) { logger.warn(MSG_APPROPRIATE_NAVIGATION_ELEMENTS_WERE_FOUND); } else { NavigationElementTree navigationElementTree = null; NavigationElement parent = null; for (NavigationElement vo : navElementListByPackage) { if (vo.getLookup().equalsIgnoreCase(lookup)) { parent = vo; navigationElementTree = convert(parent); break; } } if (parent == null) { logger.warn(MSG_NO_SUCH_PARENT_NAVIGATION_WAS_FOUND); } else { buildTree(navigationElementTree, parent, navElementListByPackage, lazyLoadResource); navigationElementTrees = navigationElementTree.getChildren(); } } } } return new ServiceResponse<NavigationElementTree>( navigationElementTrees, "Return tree navigation elements.", true); }
@Override public void contextInitialized(ServletContextEvent sce) { File app = Env.getDefaultEnvFile(); File keyStore = InstallUtils.getKeyStore(); Map<String, String> propertiesMap = KeyUtils.getMapProperties(app, keyStore); ConfigContainer.putAll(propertiesMap); File xmlProp = InstallUtils.getXmlEnv(); if (!ConfigContainer.isAppInstalled() && xmlProp.exists()) { Map<String, String> settings = EnvironmentsUtils.convertFromXml(xmlProp); ConfigContainer.putAll(settings); } File propFile = InstallUtils.getPropEnv(); if (!ConfigContainer.isAppInstalled() && propFile.exists()) { ConfigContainer.putAll(MiscUtils.getProperties(propFile)); } if (!xmlProp.exists()) { if (!OpenFlameConfig.DOMAIN_URL.exist()) OpenFlameConfig.DOMAIN_URL.setValue(TomcatUtils.getCatalinaHost(sce)); if (!OpenFlameConfig.PORT.exist()) OpenFlameConfig.PORT.setValue(TomcatUtils.getCatalinaPort(sce).toString()); if (!OpenFlameConfig.CONTEXT_URL.exist()) OpenFlameConfig.CONTEXT_URL.setValue(TomcatUtils.getCatalinaContext(sce)); } String domainUrl = OpenFlameConfig.DOMAIN_URL.getValue(); String port = OpenFlameConfig.PORT.getValue(); String contextUrl = OpenFlameConfig.CONTEXT_URL.getValue(); if (domainUrl != null && port != null && contextUrl != null) { Env.FIREJACK_URL.setValue(WebUtils.getNormalizedUrl(domainUrl, port, contextUrl)); } ConfigContainer.setHost(TomcatUtils.getCatalinaHost(sce)); ConfigContainer.setPort(TomcatUtils.getCatalinaPort(sce)); super.contextInitialized(sce); }