List of usage examples for com.liferay.portal.kernel.util PrefsPropsUtil getBoolean
public static boolean getBoolean(String name)
From source file:es.uib.owu.liferay.cas.service.impl.CasServiceUtilLocalServiceImpl.java
License:Open Source License
private TicketValidator getTicketValidator(long companyId, String proxyReceptorUrl, String allowAnyProxy, String allowedProxyChains, boolean renew) throws SystemException { if (_log.isDebugEnabled()) _log.debug("getTicketValidator"); Cas20ServiceTicketValidator ticketValidator = _ticketValidators.get(Long.valueOf(companyId)); //Cas20ServiceTicketValidator ticketValidator = (Cas20ServiceTicketValidator) _ticketValidators.get(Long.valueOf(companyId)); if (ticketValidator != null) { return ticketValidator; }/* www .ja va2 s .c o m*/ String serverName = PrefsPropsUtil.getString(companyId, PropsKeys.CAS_SERVER_NAME, PropsUtil.get(PropsKeys.CAS_SERVER_NAME)); String casServerUrl = PrefsPropsUtil.getString(companyId, PropsKeys.CAS_SERVER_URL, PropsUtil.get(PropsKeys.CAS_SERVER_URL)); String casLoginUrl = PrefsPropsUtil.getString(companyId, PropsKeys.CAS_LOGIN_URL, PropsUtil.get(PropsKeys.CAS_LOGIN_URL)); if ((CommonUtils.isNotBlank(allowAnyProxy) || CommonUtils.isNotBlank(allowedProxyChains))) { final Cas20ProxyTicketValidator v = new Cas20ProxyTicketValidator(casServerUrl); v.setAcceptAnyProxy(PrefsPropsUtil.getBoolean(allowAnyProxy)); v.setAllowedProxyChains(createProxyList(allowedProxyChains)); ticketValidator = v; if (_log.isDebugEnabled()) { _log.debug("Cas20ProxyTicketValidator"); _log.debug("-setAcceptAnyProxy: " + allowAnyProxy); _log.debug("-setAllowedProxyChains: " + allowedProxyChains); } } else { ticketValidator = new Cas20ServiceTicketValidator(casServerUrl); if (_log.isDebugEnabled()) { _log.debug("Cas20ServiceValidator"); } } if (proxyReceptorUrl != null) { ticketValidator.setProxyCallbackUrl(serverName + proxyReceptorUrl); ProxyGrantingTicketStorageImpl proxyGrantingTicketStorage = getPGTSI(); if (_log.isDebugEnabled()) { _log.debug("Cas20ServiceValidator assigname proxyGrantingTicketStorage: " + proxyGrantingTicketStorage); } ticketValidator.setProxyGrantingTicketStorage(proxyGrantingTicketStorage); } ticketValidator.setRenew(renew); Map<String, String> parameters = new HashMap<String, String>(); parameters.put("serverName", serverName); parameters.put("casServerUrlPrefix", casServerUrl); parameters.put("casServerLoginUrl", casLoginUrl); parameters.put("redirectAfterValidation", "false"); if (allowAnyProxy != null) parameters.put("allowAnyProxy", allowAnyProxy); ticketValidator.setCustomParameters(parameters); _ticketValidators.put(Long.valueOf(companyId), ticketValidator); if (_log.isDebugEnabled()) { _log.debug("Returning cas20ProxyTicketValidator with.."); _log.debug("- serverName: " + serverName); _log.debug("- casServerUrlPrefix: " + casServerUrl); _log.debug("- casServerLoginUrl: " + casLoginUrl); if (proxyReceptorUrl != null) _log.debug("- proxyCallbackUrl: " + serverName + proxyReceptorUrl); } return ticketValidator; }
From source file:jorgediazest.indexchecker.model.JournalArticle.java
License:Open Source License
@Override public void init(String classPackageName, String classSimpleName, Service service, DataComparatorFactory dataComparatorFactory) throws Exception { super.init(classPackageName, classSimpleName, service, dataComparatorFactory); try {//from ww w . j av a2s . c o m indexAllVersions = PrefsPropsUtil.getBoolean("journal.articles.index.all.versions"); } catch (SystemException e) { throw new RuntimeException(e); } }
From source file:jorgediazest.indexchecker.portlet.IndexCheckerPortlet.java
License:Open Source License
public static Map<Long, List<Comparison>> executeCheck(Company company, List<Long> groupIds, List<String> classNames, Set<ExecutionMode> executionMode, int threadsExecutor) throws ExecutionException, InterruptedException, SystemException { ModelFactory modelFactory = new IndexCheckerModelFactory(); final String dateAttributes = PortletProps.get("data-comparator.date.attributes"); final String dateAttributesUser = PortletProps.get("data-comparator.date.attributes.user"); final String basicAttributes = PortletProps.get("data-comparator.basic.attributes"); final String basicAttributesNoVersion = PortletProps.get("data-comparator.basic.attributes.noversion"); final String categoriesTagsAttributes = PortletProps.get("data-comparator.categories-tags.attributes"); final String assetEntryAttributes = PortletProps.get("data-comparator.assetentry.attributes"); DataComparatorFactory dataComparatorFactory = new DataComparatorFactory() { protected boolean indexAllVersions = PrefsPropsUtil.getBoolean("journal.articles.index.all.versions"); protected DataComparator defaultComparator = new DataIndexCheckerModelComparator((dateAttributes + "," + basicAttributes + "," + assetEntryAttributes + "," + categoriesTagsAttributes).split(",")); protected DataComparator userComparator = new DataIndexCheckerModelComparator( (dateAttributesUser + "," + basicAttributes + "," + categoriesTagsAttributes).split(",")); protected DataComparator dlFileEntryComparator = new DataIndexCheckerModelComparator( (dateAttributes + "," + basicAttributesNoVersion + "," + assetEntryAttributes + "," + categoriesTagsAttributes).split(",")); protected DataComparator wikiPageComparator = new DataIndexCheckerResourceModelComparator( (dateAttributes + "," + basicAttributesNoVersion + "," + assetEntryAttributes + "," + categoriesTagsAttributes).split(",")); protected DataComparator resourceComparator = new DataIndexCheckerResourceModelComparator( (dateAttributes + "," + basicAttributes + "," + assetEntryAttributes + "," + categoriesTagsAttributes).split(",")); @Override/* ww w . j a va 2 s . c o m*/ public DataComparator getDataComparator(Model model) { if ("com.liferay.journal.model.JournalArticle".equals(model.getClassName()) && indexAllVersions) { return defaultComparator; } else if (User.class.getName().equals(model.getClassName())) { return userComparator; } else if (DLFileEntry.class.getName().equals(model.getClassName())) { return dlFileEntryComparator; } else if ("com.liferay.wiki.model.WikiPage".equals(model.getClassName())) { return wikiPageComparator; } if (model.isResourcedModel()) { return resourceComparator; } return defaultComparator; } }; modelFactory.setDataComparatorFactory(dataComparatorFactory); Map<String, Model> modelMap = modelFactory.getModelMap(classNames); IndexSearchUtil.autoAdjustIndexSearchLimit(modelMap.values()); long companyId = company.getCompanyId(); List<Long> groupIdsFor = new ArrayList<Long>(); groupIdsFor.add(0L); if (executionMode.contains(ExecutionMode.GROUP_BY_SITE)) { groupIdsFor.addAll(groupIds); } ExecutorService executor = Executors.newFixedThreadPool(threadsExecutor); Map<Long, List<Future<Comparison>>> futureResultDataMap = new LinkedHashMap<Long, List<Future<Comparison>>>(); for (long groupId : groupIdsFor) { List<Future<Comparison>> futureResultList = new ArrayList<Future<Comparison>>(); for (Model model : modelMap.values()) { if (!model.hasIndexerEnabled()) { continue; } CallableCheckGroupAndModel c = new CallableCheckGroupAndModel(companyId, groupId, (IndexCheckerModel) model, executionMode); futureResultList.add(executor.submit(c)); } futureResultDataMap.put(groupId, futureResultList); } Map<Long, List<Comparison>> resultDataMap = new LinkedHashMap<Long, List<Comparison>>(); for (Entry<Long, List<Future<Comparison>>> entry : futureResultDataMap.entrySet()) { List<Comparison> resultList = new ArrayList<Comparison>(); for (Future<Comparison> f : entry.getValue()) { Comparison results = f.get(); if (results != null) { resultList.add(results); } } resultDataMap.put(entry.getKey(), resultList); } executor.shutdownNow(); return resultDataMap; }