public static <A1, B1> Tuple<A1, B1> of(A1 a1, B1 b1) { return new Tuple<A1, B1>(a1, b1); }
public static <A1, B1> Tuple<A1, B1> of(A1 a1, B1 b1) { return new Tuple<A1, B1>(a1, b1); }
protected <T> void submitProcessFile( final Queue<Tuple<File, Future<T>>> futures, final File child, final Function<Resource, T> fileProcessor) { final Future<T> fileFuture = this.executorService.submit( new Callable<T>() { @Override public T call() throws Exception { logger.debug("processing file: {}", child); return fileProcessor.apply(new FileSystemResource(child)); } }); logger.debug("queued file processing: {}", child); futures.offer(new Tuple<File, Future<T>>(child, fileFuture)); }
@Override public Tuple<String, Element> exportData(String id) { final Element node = this.exportDataElement(id); if (node == null) { return null; } return new Tuple<String, Element>(id, node); }
protected <T> void submitProcessFile( final Queue<Tuple<File, Future<T>>> futures, final File child, final Function<Resource, T> fileProcessor) { final Future<T> fileFuture = this.executorService.submit( new Callable<T>() { @Override public T call() throws Exception { logger.debug("processing file: {}", child); return fileProcessor.apply(new FileSystemResource(child)); } }); logger.debug("queued file processing: {}", child); futures.offer(new Tuple<File, Future<T>>(child, fileFuture)); }
protected <T> void submitDirectoryRecurse( final Queue<Tuple<File, Future<T>>> futures, final ConcurrentMap<File, T> results, final File directory, final FileFilter fileFilter, final Function<Resource, T> fileProcessor) { final Future<T> dirFuture = this.executorService.submit( new Callable<T>() { @Override public T call() throws Exception { recurseOnDirectory( futures, results, directory, fileFilter, fileProcessor); return null; } }); logger.debug("queued directory recurse: {}", directory); futures.offer(new Tuple<File, Future<T>>(directory, dirFuture)); }
protected <T> void submitDirectoryRecurse( final Queue<Tuple<File, Future<T>>> futures, final ConcurrentMap<File, T> results, final File directory, final FileFilter fileFilter, final Function<Resource, T> fileProcessor) { final Future<T> dirFuture = this.executorService.submit( new Callable<T>() { @Override public T call() throws Exception { recurseOnDirectory( futures, results, directory, fileFilter, fileProcessor); return null; } }); logger.debug("queued directory recurse: {}", directory); futures.offer(new Tuple<File, Future<T>>(directory, dirFuture)); }
public void addPortletSearchResults(String url, SearchResult result) { final Set<String> tabs = this.getTabs(result); for (final String tab : tabs) { final List<Tuple<SearchResult, String>> typeResults = this.results.getUnchecked(tab); typeResults.add(new Tuple<>(result, url)); } }
/** * Parse the parameter name and the optional portlet window id from a fully qualified query * parameter. */ protected Tuple<String, IPortletWindowId> parsePortletParameterName( HttpServletRequest request, String name, Set<String> additionalPortletIds) { // Look for a 2nd separator which might indicate a portlet window id for (final String additionalPortletId : additionalPortletIds) { final int windowIdIdx = name.indexOf(additionalPortletId); if (windowIdIdx == -1) { continue; } final String paramName = name.substring( PORTLET_PARAM_PREFIX.length() + additionalPortletId.length() + SEPARATOR.length()); final IPortletWindowId portletWindowId = this.portletWindowRegistry.getPortletWindowId(request, additionalPortletId); return new Tuple<String, IPortletWindowId>(paramName, portletWindowId); } final String paramName = this.safeSubstringAfter(PORTLET_PARAM_PREFIX, name); return new Tuple<String, IPortletWindowId>(paramName, null); }
/** * Parse the parameter name and the optional portlet window id from a fully qualified query * parameter. */ protected Tuple<String, IPortletWindowId> parsePortletParameterName( HttpServletRequest request, String name, Set<String> additionalPortletIds) { // Look for a 2nd separator which might indicate a portlet window id for (final String additionalPortletId : additionalPortletIds) { final int windowIdIdx = name.indexOf(additionalPortletId); if (windowIdIdx == -1) { continue; } final String paramName = name.substring( PORTLET_PARAM_PREFIX.length() + additionalPortletId.length() + SEPARATOR.length()); final IPortletWindowId portletWindowId = this.portletWindowRegistry.getPortletWindowId(request, additionalPortletId); return new Tuple<String, IPortletWindowId>(paramName, portletWindowId); } final String paramName = this.safeSubstringAfter(PORTLET_PARAM_PREFIX, name); return new Tuple<String, IPortletWindowId>(paramName, null); }
@Override public Tuple<String, Element> unmarshal(Source source) throws IOException, XmlMappingException { // Convert the StAX XMLEventReader to a dom4j Element final Element node = convertToElement(source); return new Tuple<String, Element>(source.getSystemId(), node); }
@Override public Object unmarshal(Source source) throws IOException, XmlMappingException { if (source instanceof StAXSource) { source = fixStAXSource((StAXSource) source); } final Transformer identityTransformer; try { identityTransformer = this.xmlUtilities.getIdentityTransformer(); } catch (TransformerConfigurationException e) { throw new RuntimeException("Failed to create identity Transformer", e); } final DOMResult domResult = new DOMResult(); try { identityTransformer.transform(source, domResult); } catch (TransformerException e) { throw new RuntimeException("Failed to transform " + source + " into Document", e); } final Document resultDoc = (Document) domResult.getNode(); return new Tuple<String, Document>(source.getSystemId(), resultDoc); }
final Tuple<String, String> tuple = new Tuple<String, String>(fragmentName, tabName); layoutNodeIdNameResolutionCache.put(new Element(targetedLayoutNodeId, tuple)); return tuple;
/** * Handles locking and identifying proper root and namespaces that used to take place in super * class. * * @param person * @param profile * @return @ */ private Document _safeGetUserLayout(IPerson person, IUserProfile profile) { Document layoutDoc; Tuple<String, String> key = null; final Cache<Tuple<String, String>, Document> layoutCache = getLayoutImportExportCache(); if (layoutCache != null) { key = new Tuple<>(person.getUserName(), profile.getProfileFname()); layoutDoc = layoutCache.getIfPresent(key); if (layoutDoc != null) { return (Document) layoutDoc.cloneNode(true); } } layoutDoc = super.getPersonalUserLayout(person, profile); Element layout = layoutDoc.getDocumentElement(); layout.setAttribute(Constants.NS_DECL, Constants.NS_URI); if (layoutCache != null && key != null) { layoutCache.put(key, (Document) layoutDoc.cloneNode(true)); } return layoutDoc; }
/** * Get the portletApplicationId and portletName for the specified channel definition id. The * portletApplicationId will be {@link Tuple#first} and the portletName will be {@link * Tuple#second} */ @Override public Tuple<String, String> getPortletDescriptorKeys(IPortletDefinition portletDefinition) { final String portletApplicationId; if (portletDefinition.getPortletDescriptorKey().isFrameworkPortlet()) { portletApplicationId = this.servletContext.getContextPath(); } else { portletApplicationId = portletDefinition.getPortletDescriptorKey().getWebAppName(); } final String portletName = portletDefinition.getPortletDescriptorKey().getPortletName(); return new Tuple<String, String>(portletApplicationId, portletName); } }
new Tuple<IPortletDefinitionId, QName>(portletDefinitionId, eventName);
protected Tuple<String, String> getPortletDescriptorKeys(PortletDefinitionForm form) { if (form.getPortletName() == null || (form.getApplicationId() == null && !form.isFramework())) { return null; } final String portletAppId; if (form.isFramework()) { portletAppId = this.servletContext.getContextPath(); } else { portletAppId = form.getApplicationId(); } final String portletName = form.getPortletName(); return new Tuple<>(portletAppId, portletName); }
/** * Get the portletApplicationId and portletName for the specified channel definition id. The * portletApplicationId will be {@link Tuple#first} and the portletName will be {@link * Tuple#second} */ @Override public Tuple<String, String> getPortletDescriptorKeys(IPortletDefinition portletDefinition) { final String portletApplicationId; if (portletDefinition.getPortletDescriptorKey().isFrameworkPortlet()) { portletApplicationId = this.servletContext.getContextPath(); } else { portletApplicationId = portletDefinition.getPortletDescriptorKey().getWebAppName(); } final String portletName = portletDefinition.getPortletDescriptorKey().getPortletName(); return new Tuple<String, String>(portletApplicationId, portletName); } }
/** * Provides a {@link Tuple} containing the "fragmentized" version of a DLM fragment * owner's layout, together with the username. This version of the layout consistent with what * DLM uses internally for fragments, and is created by FragmentActivator.fragmentizeLayout. * It's important that the version returned by this method matches what DLM uses internally * because it will be used to establish relationships between fragment layout nodes and user * customizations of DLM fragments. * * @param userId * @return */ /* TODO: make private */ Tuple<String, DistributedUserLayout> getUserLayoutTuple( String userName, int userId) { final PersonImpl person = new PersonImpl(); person.setUserName(userName); person.setID(userId); person.setSecurityContext(new BrokenSecurityContext()); final IUserProfile profile = layoutStore.getUserProfileByFname(person, UserProfile.DEFAULT_PROFILE_FNAME); final DistributedUserLayout userLayout = layoutStore.getUserLayout(person, (UserProfile) profile); return new Tuple<String, DistributedUserLayout>(userName, userLayout); } }