public static String getWebdavURL(Node node, boolean withTimeParam, boolean isGetRealNodePath) throws Exception { NodeLocation location = NodeLocation.getNodeLocationByNode(getRealNode(node)); String repository = location.getRepository(); String workspace = location.getWorkspace(); String currentProtal = PortalContainer.getCurrentRestContextName(); String portalName = PortalContainer.getCurrentPortalContainerName(); String originalNodePath = isGetRealNodePath ? getRealNodePath(node) : Text.escape(node.getPath(), '%', true); StringBuffer imagePath = new StringBuffer(); imagePath .append("/") .append(portalName) .append("/") .append(currentProtal) .append("/jcr/") .append(repository) .append("/") .append(workspace) .append(originalNodePath); if (withTimeParam) { if (imagePath.indexOf("?") > 0) { imagePath.append("&time="); } else { imagePath.append("?time="); } imagePath.append(System.currentTimeMillis()); } return imagePath.toString(); }
/** * Generate the Thumbnail Image URI. * * @param file the node * @return the Thumbnail uri with medium size * @throws Exception the exception */ public static String generateThumbnailImageURI(Node file) throws Exception { StringBuilder builder = new StringBuilder(); NodeLocation fielLocation = NodeLocation.getNodeLocationByNode(file); String repository = fielLocation.getRepository(); String workspaceName = fielLocation.getWorkspace(); String nodeIdentifiler = file.getPath().replaceFirst("/", ""); String portalName = PortalContainer.getCurrentPortalContainerName(); String restContextName = PortalContainer.getCurrentRestContextName(); InputStream stream = file.getNode(NodetypeConstant.JCR_CONTENT) .getProperty(NodetypeConstant.JCR_DATA) .getStream(); if (stream.available() == 0) return null; stream.close(); builder .append("/") .append(portalName) .append("/") .append(restContextName) .append("/") .append("thumbnailImage/medium/") .append(repository) .append("/") .append(workspaceName) .append("/") .append(nodeIdentifiler); return builder.toString(); }
@Override public Node filterNodeToDisplay(Node node) { try { Node displayNode = getNodeToCheckState(node); if (displayNode == null) return null; if (isSearchContent) return displayNode; NodeLocation nodeLocation = NodeLocation.getNodeLocationByNode(displayNode); WCMComposer wcmComposer = WCMCoreUtils.getService(WCMComposer.class); HashMap<String, String> filters = new HashMap<String, String>(); filters.put( WCMComposer.FILTER_MODE, queryCriteria.isLiveMode() ? WCMComposer.MODE_LIVE : WCMComposer.MODE_EDIT); return wcmComposer.getContent( nodeLocation.getWorkspace(), nodeLocation.getPath(), filters, WCMCoreUtils.getSystemSessionProvider()); } catch (Exception e) { return null; } }
public void setUploadedNode(Node node) throws Exception { uploadedNode_ = NodeLocation.getNodeLocationByNode(node); }
/** * Get node's expression by a node. * * @param Node the node to get expression * @return The node's expression */ public static final String getExpressionByNode(final Node node) { NodeLocation location = NodeLocation.getNodeLocationByNode(node); return mergeString(location.getRepository(), location.getWorkspace(), location.getPath()); }