@Test public void getDocFolderRelativePathWithLinks() throws Exception { ConversationState conversationState = new ConversationState(new Identity("root")); ConversationState.setCurrent(conversationState); Map<String, String> activityParameters = new HashMap<>(); activityParameters.put("REPOSITORY", "repository"); activityParameters.put("WORKSPACE", "collaboration"); activityParameters.put("nodePath", "/sites/intranet/web contents/site artifacts/announcements/test1.txt"); activityParameters.put("id", "c036fb997f0001016364ca764f61b4d1"); NodeLocation nodeLocation1 = new NodeLocation("repository", "collaboration", null, "c036fb997f0001016364ca764f61b4d1"); Node file1 = mock(Node.class); Node intranetNode = mock(Node.class); Node sitesNode = mock(Node.class); Node rootNode = mock(Node.class); when(file1.getName()).thenReturn("test1.txt"); when(file1.getPath()).thenReturn("/sites/intranet/test1.txt"); when(file1.getParent()).thenReturn(intranetNode); when(intranetNode.getName()).thenReturn("intranet"); when(intranetNode.getPath()).thenReturn("/sites/intranet"); when(intranetNode.getParent()).thenReturn(sitesNode); when(sitesNode.getName()).thenReturn("sites"); when(sitesNode.getPath()).thenReturn("/sites"); when(sitesNode.getParent()).thenReturn(rootNode); when(rootNode.getName()).thenReturn("/"); when(rootNode.getPath()).thenReturn("/"); PowerMockito.mockStatic(NodeLocation.class); PowerMockito.when(NodeLocation.getNodeByLocation(Matchers.refEq(nodeLocation1))).thenReturn(file1); FileUIActivity fileUIActivity = Mockito.spy(new FileUIActivity()); DriveData driveData = new DriveData(); driveData.setHomePath("/sites"); driveData.setName("Managed Sites"); driveData.setWorkspace("collboration"); TrashService trashService = Mockito.mock(TrashService.class); DocumentService documentService = Mockito.mock(DocumentService.class); Mockito.doReturn(trashService).when(fileUIActivity).getApplicationComponent(Mockito.eq(TrashService.class)); Mockito.doReturn(documentService).when(fileUIActivity).getApplicationComponent(Mockito.eq(DocumentService.class)); Mockito.doReturn(driveData).when(fileUIActivity).getDocDrive(0); Mockito.when(trashService.isInTrash(file1)).thenReturn(false); Mockito.when(documentService.getLinkInDocumentsApp(file1.getPath(), driveData)).thenReturn("FILE1_URI"); Mockito.when(documentService.getLinkInDocumentsApp(intranetNode.getPath(), driveData)).thenReturn("INTRANET_URI"); Mockito.when(documentService.getLinkInDocumentsApp(sitesNode.getPath(), driveData)).thenReturn("SITES_URI"); fileUIActivity.setUIActivityData(activityParameters); LinkedHashMap<String, String> docFolderRelativePathWithLinks = fileUIActivity.getDocFolderRelativePathWithLinks(0); assertNotNull(docFolderRelativePathWithLinks); assertEquals(3, docFolderRelativePathWithLinks.size()); Set<String> folderNamesWithIndex = docFolderRelativePathWithLinks.keySet(); int i = 0; for (String folderNameWithIndex : folderNamesWithIndex) { String folderPath = docFolderRelativePathWithLinks.get(folderNameWithIndex); switch (i) { case 0: assertEquals("Managed Sites_2", folderNameWithIndex); assertEquals("SITES_URI", folderPath); break; case 1: assertEquals("intranet_1", folderNameWithIndex); assertEquals("INTRANET_URI", folderPath); break; case 2: assertEquals("test1.txt_0", folderNameWithIndex); assertEquals("FILE1_URI", folderPath); break; } i++; } assertEquals("FILE1_URI", fileUIActivity.getDocFilePath(0)); assertEquals("'Managed Sites': 'SITES_URI','intranet': 'INTRANET_URI'", fileUIActivity.getDocFileBreadCrumb(0)); }
public LinkedHashMap<String, String> getDocFolderRelativePathWithLinks(int i) { if ((i + 1) > activityFileAttachments.size()) { return null; } if(folderPathWithLinks == null) { folderPathWithLinks = new LinkedHashMap[filesCount]; } if(folderPathWithLinks[i] == null) { folderPathWithLinks[i] = new LinkedHashMap<>(); LinkedHashMap<String, String> reversedFolderPathWithLinks = new LinkedHashMap<>(); DriveData drive; Node sharedNode = getSharedNode(i); if (sharedNode != null) { drive = getDocDrive(NodeLocation.getNodeLocationByNode(sharedNode)); } else { drive = getDocDrive(i); } if (drive != null) { try { Map<String, String> parameters = drive.getParameters(); String driveName = drive.getName(); if (parameters != null) { if (parameters.containsKey("groupId")) { String groupId = parameters.get("groupId"); if (StringUtils.isNotBlank(groupId)) { try { groupId = groupId.replaceAll("\\.", "/"); if (groupId.startsWith(SpaceUtils.SPACE_GROUP)) { SpaceService spaceService = getSpaceService(); Space space = spaceService.getSpaceByGroupId(groupId); if (space != null) { driveName = space.getDisplayName(); } } else { Group group = getOrganizationService().getGroupHandler().findGroupById(groupId); driveName = group == null ? driveName : group.getLabel(); } } catch (Exception e) { LOG.warn("Can't get drive name for group with id '" + groupId + "'", e); } } } else if (parameters.containsKey("userId")) { String userId = parameters.get("userId"); if (StringUtils.isNotBlank(userId)) { try { userId = userId.indexOf("/") >= 0 ? userId.substring(userId.lastIndexOf("/") + 1) : userId; User user = getOrganizationService().getUserHandler().findUserByName(userId); if (user != null) { driveName = user.getDisplayName(); } } catch (Exception e) { LOG.warn("Can't get drive name for user with id '" + userId + "'", e); } } } } String driveHomePath = drive.getResolvedHomePath(); String drivePublicFolderHomePath = null; if (ManageDriveServiceImpl.PERSONAL_DRIVE_NAME.equals(drive.getName())) { drivePublicFolderHomePath = driveHomePath.replace("/" + ManageDriveServiceImpl.PERSONAL_DRIVE_PRIVATE_FOLDER_NAME, "/" + ManageDriveServiceImpl.PERSONAL_DRIVE_PUBLIC_FOLDER_NAME); } Node parentContentNode; if (sharedNode != null) { parentContentNode = sharedNode; } else { parentContentNode = getContentNode(i); } while (parentContentNode != null) { String parentPath = parentContentNode.getPath(); if (!parentPath.contains(driveHomePath)) { break; } else if (!driveHomePath.equals("/") && parentPath.equals("/")) { break; } else if (drivePublicFolderHomePath != null && parentPath.equals(drivePublicFolderHomePath)) { reversedFolderPathWithLinks.put(ManageDriveServiceImpl.PERSONAL_DRIVE_PUBLIC_FOLDER_NAME, getDocOpenUri(parentPath, i)); break; } String nodeName; if (parentPath.equals(driveHomePath)) { nodeName = driveName; } else if (parentContentNode.hasProperty("exo:title")) { nodeName = parentContentNode.getProperty("exo:title").getString(); } else { nodeName = parentContentNode.getName(); } reversedFolderPathWithLinks.put(nodeName + "_" + reversedFolderPathWithLinks.size(), getDocOpenUri(parentPath, i)); if (parentPath.equals("/")) { break; } else { parentContentNode = parentContentNode.getParent(); } } } catch (AccessDeniedException e) { LOG.debug(e.getMessage()); } catch (RepositoryException re) { ActivityFileAttachment activityFileAttachment = activityFileAttachments.get(i); LOG.error("Cannot retrieve path of doc " + activityFileAttachment.getDocPath() + " : " + re.getMessage(), re); } } if(reversedFolderPathWithLinks.size() > 1) { List<Map.Entry<String, String>> entries = new ArrayList<>(reversedFolderPathWithLinks.entrySet()); for(int j = entries.size()-1; j >= 0; j--) { Map.Entry<String, String> entry = entries.get(j); folderPathWithLinks[i].put(StringEscapeUtils.escapeHtml4(entry.getKey()), entry.getValue()); } } else { folderPathWithLinks[i] = reversedFolderPathWithLinks; } } return folderPathWithLinks[i]; }
FileUIActivity extends BaseUIActivity { public LinkedHashMap<String, String> getDocFolderRelativePathWithLinks(int i) { if ((i + 1) > activityFileAttachments.size()) { return null; } if(folderPathWithLinks == null) { folderPathWithLinks = new LinkedHashMap[filesCount]; } if(folderPathWithLinks[i] == null) { folderPathWithLinks[i] = new LinkedHashMap<>(); LinkedHashMap<String, String> reversedFolderPathWithLinks = new LinkedHashMap<>(); DriveData drive; Node sharedNode = getSharedNode(i); if (sharedNode != null) { drive = getDocDrive(NodeLocation.getNodeLocationByNode(sharedNode)); } else { drive = getDocDrive(i); } if (drive != null) { try { Map<String, String> parameters = drive.getParameters(); String driveName = drive.getName(); if (parameters != null) { if (parameters.containsKey("groupId")) { String groupId = parameters.get("groupId"); if (StringUtils.isNotBlank(groupId)) { try { groupId = groupId.replaceAll("\\.", "/"); if (groupId.startsWith(SpaceUtils.SPACE_GROUP)) { SpaceService spaceService = getSpaceService(); Space space = spaceService.getSpaceByGroupId(groupId); if (space != null) { driveName = space.getDisplayName(); } } else { Group group = getOrganizationService().getGroupHandler().findGroupById(groupId); driveName = group == null ? driveName : group.getLabel(); } } catch (Exception e) { LOG.warn("Can't get drive name for group with id '" + groupId + "'", e); } } } else if (parameters.containsKey("userId")) { String userId = parameters.get("userId"); if (StringUtils.isNotBlank(userId)) { try { userId = userId.indexOf("/") >= 0 ? userId.substring(userId.lastIndexOf("/") + 1) : userId; User user = getOrganizationService().getUserHandler().findUserByName(userId); if (user != null) { driveName = user.getDisplayName(); } } catch (Exception e) { LOG.warn("Can't get drive name for user with id '" + userId + "'", e); } } } } String driveHomePath = drive.getResolvedHomePath(); String drivePublicFolderHomePath = null; if (ManageDriveServiceImpl.PERSONAL_DRIVE_NAME.equals(drive.getName())) { drivePublicFolderHomePath = driveHomePath.replace("/" + ManageDriveServiceImpl.PERSONAL_DRIVE_PRIVATE_FOLDER_NAME, "/" + ManageDriveServiceImpl.PERSONAL_DRIVE_PUBLIC_FOLDER_NAME); } Node parentContentNode; if (sharedNode != null) { parentContentNode = sharedNode; } else { parentContentNode = getContentNode(i); } while (parentContentNode != null) { String parentPath = parentContentNode.getPath(); if (!parentPath.contains(driveHomePath)) { break; } else if (!driveHomePath.equals("/") && parentPath.equals("/")) { break; } else if (drivePublicFolderHomePath != null && parentPath.equals(drivePublicFolderHomePath)) { reversedFolderPathWithLinks.put(ManageDriveServiceImpl.PERSONAL_DRIVE_PUBLIC_FOLDER_NAME, getDocOpenUri(parentPath, i)); break; } String nodeName; if (parentPath.equals(driveHomePath)) { nodeName = driveName; } else if (parentContentNode.hasProperty("exo:title")) { nodeName = parentContentNode.getProperty("exo:title").getString(); } else { nodeName = parentContentNode.getName(); } reversedFolderPathWithLinks.put(nodeName + "_" + reversedFolderPathWithLinks.size(), getDocOpenUri(parentPath, i)); if (parentPath.equals("/")) { break; } else { parentContentNode = parentContentNode.getParent(); } } } catch (AccessDeniedException e) { LOG.debug(e.getMessage()); } catch (RepositoryException re) { ActivityFileAttachment activityFileAttachment = activityFileAttachments.get(i); LOG.error("Cannot retrieve path of doc " + activityFileAttachment.getDocPath() + " : " + re.getMessage(), re); } } if(reversedFolderPathWithLinks.size() > 1) { List<Map.Entry<String, String>> entries = new ArrayList<>(reversedFolderPathWithLinks.entrySet()); for(int j = entries.size()-1; j >= 0; j--) { Map.Entry<String, String> entry = entries.get(j); folderPathWithLinks[i].put(StringEscapeUtils.escapeHtml4(entry.getKey()), entry.getValue()); } } else { folderPathWithLinks[i] = reversedFolderPathWithLinks; } } return folderPathWithLinks[i]; } }
FileUIActivity extends BaseUIActivity { public LinkedHashMap<String, String> getDocFolderRelativePathWithLinks(int i) { if ((i + 1) > activityFileAttachments.size()) { return null; } if(folderPathWithLinks == null) { folderPathWithLinks = new LinkedHashMap[filesCount]; } if(folderPathWithLinks[i] == null) { folderPathWithLinks[i] = new LinkedHashMap<>(); LinkedHashMap<String, String> reversedFolderPathWithLinks = new LinkedHashMap<>(); DriveData drive; Node sharedNode = getSharedNode(i); if (sharedNode != null) { drive = getDocDrive(NodeLocation.getNodeLocationByNode(sharedNode)); } else { drive = getDocDrive(i); } if (drive != null) { try { Map<String, String> parameters = drive.getParameters(); String driveName = drive.getName(); if (parameters != null) { if (parameters.containsKey("groupId")) { String groupId = parameters.get("groupId"); if (StringUtils.isNotBlank(groupId)) { try { groupId = groupId.replaceAll("\\.", "/"); if (groupId.startsWith(SpaceUtils.SPACE_GROUP)) { SpaceService spaceService = getSpaceService(); Space space = spaceService.getSpaceByGroupId(groupId); if (space != null) { driveName = space.getDisplayName(); } } else { Group group = getOrganizationService().getGroupHandler().findGroupById(groupId); driveName = group == null ? driveName : group.getLabel(); } } catch (Exception e) { LOG.warn("Can't get drive name for group with id '" + groupId + "'", e); } } } else if (parameters.containsKey("userId")) { String userId = parameters.get("userId"); if (StringUtils.isNotBlank(userId)) { try { userId = userId.indexOf("/") >= 0 ? userId.substring(userId.lastIndexOf("/") + 1) : userId; User user = getOrganizationService().getUserHandler().findUserByName(userId); if (user != null) { driveName = user.getDisplayName(); } } catch (Exception e) { LOG.warn("Can't get drive name for user with id '" + userId + "'", e); } } } } String driveHomePath = drive.getResolvedHomePath(); String drivePublicFolderHomePath = null; if (ManageDriveServiceImpl.PERSONAL_DRIVE_NAME.equals(drive.getName())) { drivePublicFolderHomePath = driveHomePath.replace("/" + ManageDriveServiceImpl.PERSONAL_DRIVE_PRIVATE_FOLDER_NAME, "/" + ManageDriveServiceImpl.PERSONAL_DRIVE_PUBLIC_FOLDER_NAME); } Node parentContentNode; if (sharedNode != null) { parentContentNode = sharedNode; } else { parentContentNode = getContentNode(i); } while (parentContentNode != null) { String parentPath = parentContentNode.getPath(); if (!parentPath.contains(driveHomePath)) { break; } else if (!driveHomePath.equals("/") && parentPath.equals("/")) { break; } else if (drivePublicFolderHomePath != null && parentPath.equals(drivePublicFolderHomePath)) { reversedFolderPathWithLinks.put(ManageDriveServiceImpl.PERSONAL_DRIVE_PUBLIC_FOLDER_NAME, getDocOpenUri(parentPath, i)); break; } String nodeName; if (parentPath.equals(driveHomePath)) { nodeName = driveName; } else if (parentContentNode.hasProperty("exo:title")) { nodeName = parentContentNode.getProperty("exo:title").getString(); } else { nodeName = parentContentNode.getName(); } reversedFolderPathWithLinks.put(nodeName + "_" + reversedFolderPathWithLinks.size(), getDocOpenUri(parentPath, i)); if (parentPath.equals("/")) { break; } else { parentContentNode = parentContentNode.getParent(); } } } catch (AccessDeniedException e) { LOG.debug(e.getMessage()); } catch (RepositoryException re) { ActivityFileAttachment activityFileAttachment = activityFileAttachments.get(i); LOG.error("Cannot retrieve path of doc " + activityFileAttachment.getDocPath() + " : " + re.getMessage(), re); } } if(reversedFolderPathWithLinks.size() > 1) { List<Map.Entry<String, String>> entries = new ArrayList<>(reversedFolderPathWithLinks.entrySet()); for(int j = entries.size()-1; j >= 0; j--) { Map.Entry<String, String> entry = entries.get(j); folderPathWithLinks[i].put(StringEscapeUtils.escapeHtml4(entry.getKey()), entry.getValue()); } } else { folderPathWithLinks[i] = reversedFolderPathWithLinks; } } return folderPathWithLinks[i]; } FileUIActivity(); }
FileUIActivity extends BaseUIActivity { public LinkedHashMap<String, String> getDocFolderRelativePathWithLinks(int i) { if ((i + 1) > activityFileAttachments.size()) { return null; } if(folderPathWithLinks == null) { folderPathWithLinks = new LinkedHashMap[filesCount]; } if(folderPathWithLinks[i] == null) { folderPathWithLinks[i] = new LinkedHashMap<>(); LinkedHashMap<String, String> reversedFolderPathWithLinks = new LinkedHashMap<>(); DriveData drive; Node sharedNode = getSharedNode(i); if (sharedNode != null) { drive = getDocDrive(NodeLocation.getNodeLocationByNode(sharedNode)); } else { drive = getDocDrive(i); } if (drive != null) { try { Map<String, String> parameters = drive.getParameters(); String driveName = drive.getName(); if (parameters != null) { if (parameters.containsKey("groupId")) { String groupId = parameters.get("groupId"); if (StringUtils.isNotBlank(groupId)) { try { groupId = groupId.replaceAll("\\.", "/"); if (groupId.startsWith(SpaceUtils.SPACE_GROUP)) { SpaceService spaceService = getSpaceService(); Space space = spaceService.getSpaceByGroupId(groupId); if (space != null) { driveName = space.getDisplayName(); } } else { Group group = getOrganizationService().getGroupHandler().findGroupById(groupId); driveName = group == null ? driveName : group.getLabel(); } } catch (Exception e) { LOG.warn("Can't get drive name for group with id '" + groupId + "'", e); } } } else if (parameters.containsKey("userId")) { String userId = parameters.get("userId"); if (StringUtils.isNotBlank(userId)) { try { userId = userId.indexOf("/") >= 0 ? userId.substring(userId.lastIndexOf("/") + 1) : userId; User user = getOrganizationService().getUserHandler().findUserByName(userId); if (user != null) { driveName = user.getDisplayName(); } } catch (Exception e) { LOG.warn("Can't get drive name for user with id '" + userId + "'", e); } } } } String driveHomePath = drive.getResolvedHomePath(); String drivePublicFolderHomePath = null; if (ManageDriveServiceImpl.PERSONAL_DRIVE_NAME.equals(drive.getName())) { drivePublicFolderHomePath = driveHomePath.replace("/" + ManageDriveServiceImpl.PERSONAL_DRIVE_PRIVATE_FOLDER_NAME, "/" + ManageDriveServiceImpl.PERSONAL_DRIVE_PUBLIC_FOLDER_NAME); } Node parentContentNode; if (sharedNode != null) { parentContentNode = sharedNode; } else { parentContentNode = getContentNode(i); } while (parentContentNode != null) { String parentPath = parentContentNode.getPath(); if (!parentPath.contains(driveHomePath)) { break; } else if (!driveHomePath.equals("/") && parentPath.equals("/")) { break; } else if (drivePublicFolderHomePath != null && parentPath.equals(drivePublicFolderHomePath)) { reversedFolderPathWithLinks.put(ManageDriveServiceImpl.PERSONAL_DRIVE_PUBLIC_FOLDER_NAME, getDocOpenUri(parentPath, i)); break; } String nodeName; if (parentPath.equals(driveHomePath)) { nodeName = driveName; } else if (parentContentNode.hasProperty("exo:title")) { nodeName = parentContentNode.getProperty("exo:title").getString(); } else { nodeName = parentContentNode.getName(); } reversedFolderPathWithLinks.put(nodeName + "_" + reversedFolderPathWithLinks.size(), getDocOpenUri(parentPath, i)); if (parentPath.equals("/")) { break; } else { parentContentNode = parentContentNode.getParent(); } } } catch (AccessDeniedException e) { LOG.debug(e.getMessage()); } catch (RepositoryException re) { ActivityFileAttachment activityFileAttachment = activityFileAttachments.get(i); LOG.error("Cannot retrieve path of doc " + activityFileAttachment.getDocPath() + " : " + re.getMessage(), re); } } if(reversedFolderPathWithLinks.size() > 1) { List<Map.Entry<String, String>> entries = new ArrayList<>(reversedFolderPathWithLinks.entrySet()); for(int j = entries.size()-1; j >= 0; j--) { Map.Entry<String, String> entry = entries.get(j); folderPathWithLinks[i].put(StringEscapeUtils.escapeHtml4(entry.getKey()), entry.getValue()); } } else { folderPathWithLinks[i] = reversedFolderPathWithLinks; } } return folderPathWithLinks[i]; } FileUIActivity(); String getActivityTitle(); void setActivityTitle(String activityTitle); String getContentLink(int i); void setContentLink(int i,String contentLink); String getMessage(); void setMessage(String message); String getContentName(int i); String getContentName(Node contentNode, String activityContentName); void setContentName(String contentName, int i); String getImagePath(int i); void setImagePath(String imagePath, int i); String getMimeType(int i); void setMimeType(String mimeType, int i); String getNodeUUID(int i); void setNodeUUID(String nodeUUID, int i); String getState(int i); void setState(String state, int i); String getAuthor(int i); void setAuthor(String author, int i); String getDocTypeName(int i); String getDocTitle(int i); String getDocVersion(int i); String getDocSummary(int i); boolean isSymlink(int i); String getTitle(Node node); String getDateCreated(int i); void setDateCreated(String dateCreated, int i); String getLastModified(int i); void setLastModified(String lastModified, int i); Node getContentNode(int i); void setContentNode(Node contentNode, int i); NodeLocation getNodeLocation(int i); void setNodeLocation(NodeLocation nodeLocation, int i); String getSummary(Node node); String getDocumentSummary(Map<String, String> activityParams); String getUserFullName(String userId); String getUserProfileUri(String userId); String getUserAvatarImageSource(String userId); String getSpaceAvatarImageSource(String spaceIdentityId); String getActivityStatus(); int getFilesCount(); void setUIActivityData(Map<String, String> activityParams); String getWebdavURL(int i); String[] getSystemCommentBundle(Map<String, String> activityParams); String[] getSystemCommentTitle(Map<String, String> activityParams); DriveData getDocDrive(int i); String getDefaultIconClass(int i); String getDocFileBreadCrumb(int i); String getDocFilePath(int i); LinkedHashMap<String, String> getDocFolderRelativePathWithLinks(int i); String getDocFolderRelativePath(int i); String getCurrentDocOpenUri(int i); String getDocOpenUri(String nodePath, int i); String getEditLink(int i); String getActivityEditLink(int i); String getDownloadAllLink(); String getDownloadLink(int i); boolean isFileSupportPreview(Node data); boolean canEditDocument(Node data); @Override void end(); String getLinkDescription(); void setLinkDescription(String linkDescription); String getLinkImage(); void setLinkImage(String linkImage); String getLinkSource(); void setLinkSource(String linkSource); String getLinkTitle(); void setLinkTitle(String linkTitle); String getEmbedHtml(); void setEmbedHtml(String embedHtml); CloudDrive getCloudDrive(Node node); boolean isCloudFile(CloudDrive cloudDrive); CloudFile getCloudFile(Node node); String getCloudFileIcon(CloudDrive cloudDrive); }
FileUIActivity extends BaseUIActivity { public LinkedHashMap<String, String> getDocFolderRelativePathWithLinks(int i) { if ((i + 1) > activityFileAttachments.size()) { return null; } if(folderPathWithLinks == null) { folderPathWithLinks = new LinkedHashMap[filesCount]; } if(folderPathWithLinks[i] == null) { folderPathWithLinks[i] = new LinkedHashMap<>(); LinkedHashMap<String, String> reversedFolderPathWithLinks = new LinkedHashMap<>(); DriveData drive; Node sharedNode = getSharedNode(i); if (sharedNode != null) { drive = getDocDrive(NodeLocation.getNodeLocationByNode(sharedNode)); } else { drive = getDocDrive(i); } if (drive != null) { try { Map<String, String> parameters = drive.getParameters(); String driveName = drive.getName(); if (parameters != null) { if (parameters.containsKey("groupId")) { String groupId = parameters.get("groupId"); if (StringUtils.isNotBlank(groupId)) { try { groupId = groupId.replaceAll("\\.", "/"); if (groupId.startsWith(SpaceUtils.SPACE_GROUP)) { SpaceService spaceService = getSpaceService(); Space space = spaceService.getSpaceByGroupId(groupId); if (space != null) { driveName = space.getDisplayName(); } } else { Group group = getOrganizationService().getGroupHandler().findGroupById(groupId); driveName = group == null ? driveName : group.getLabel(); } } catch (Exception e) { LOG.warn("Can't get drive name for group with id '" + groupId + "'", e); } } } else if (parameters.containsKey("userId")) { String userId = parameters.get("userId"); if (StringUtils.isNotBlank(userId)) { try { userId = userId.indexOf("/") >= 0 ? userId.substring(userId.lastIndexOf("/") + 1) : userId; User user = getOrganizationService().getUserHandler().findUserByName(userId); if (user != null) { driveName = user.getDisplayName(); } } catch (Exception e) { LOG.warn("Can't get drive name for user with id '" + userId + "'", e); } } } } String driveHomePath = drive.getResolvedHomePath(); String drivePublicFolderHomePath = null; if (ManageDriveServiceImpl.PERSONAL_DRIVE_NAME.equals(drive.getName())) { drivePublicFolderHomePath = driveHomePath.replace("/" + ManageDriveServiceImpl.PERSONAL_DRIVE_PRIVATE_FOLDER_NAME, "/" + ManageDriveServiceImpl.PERSONAL_DRIVE_PUBLIC_FOLDER_NAME); } Node parentContentNode; if (sharedNode != null) { parentContentNode = sharedNode; } else { parentContentNode = getContentNode(i); } while (parentContentNode != null) { String parentPath = parentContentNode.getPath(); if (!parentPath.contains(driveHomePath)) { break; } else if (!driveHomePath.equals("/") && parentPath.equals("/")) { break; } else if (drivePublicFolderHomePath != null && parentPath.equals(drivePublicFolderHomePath)) { reversedFolderPathWithLinks.put(ManageDriveServiceImpl.PERSONAL_DRIVE_PUBLIC_FOLDER_NAME, getDocOpenUri(parentPath, i)); break; } String nodeName; if (parentPath.equals(driveHomePath)) { nodeName = driveName; } else if (parentContentNode.hasProperty("exo:title")) { nodeName = parentContentNode.getProperty("exo:title").getString(); } else { nodeName = parentContentNode.getName(); } reversedFolderPathWithLinks.put(nodeName + "_" + reversedFolderPathWithLinks.size(), getDocOpenUri(parentPath, i)); if (parentPath.equals("/")) { break; } else { parentContentNode = parentContentNode.getParent(); } } } catch (AccessDeniedException e) { LOG.debug(e.getMessage()); } catch (RepositoryException re) { ActivityFileAttachment activityFileAttachment = activityFileAttachments.get(i); LOG.error("Cannot retrieve path of doc " + activityFileAttachment.getDocPath() + " : " + re.getMessage(), re); } } if(reversedFolderPathWithLinks.size() > 1) { List<Map.Entry<String, String>> entries = new ArrayList<>(reversedFolderPathWithLinks.entrySet()); for(int j = entries.size()-1; j >= 0; j--) { Map.Entry<String, String> entry = entries.get(j); folderPathWithLinks[i].put(StringEscapeUtils.escapeHtml4(entry.getKey()), entry.getValue()); } } else { folderPathWithLinks[i] = reversedFolderPathWithLinks; } } return folderPathWithLinks[i]; } FileUIActivity(); String getActivityTitle(); void setActivityTitle(String activityTitle); String getContentLink(int i); void setContentLink(int i,String contentLink); String getMessage(); void setMessage(String message); String getContentName(int i); String getContentName(Node contentNode, String activityContentName); void setContentName(String contentName, int i); String getImagePath(int i); void setImagePath(String imagePath, int i); String getMimeType(int i); void setMimeType(String mimeType, int i); String getNodeUUID(int i); void setNodeUUID(String nodeUUID, int i); String getState(int i); void setState(String state, int i); String getAuthor(int i); void setAuthor(String author, int i); String getDocTypeName(int i); String getDocTitle(int i); String getDocVersion(int i); String getDocSummary(int i); boolean isSymlink(int i); String getTitle(Node node); String getDateCreated(int i); void setDateCreated(String dateCreated, int i); String getLastModified(int i); void setLastModified(String lastModified, int i); Node getContentNode(int i); void setContentNode(Node contentNode, int i); NodeLocation getNodeLocation(int i); void setNodeLocation(NodeLocation nodeLocation, int i); String getSummary(Node node); String getDocumentSummary(Map<String, String> activityParams); String getUserFullName(String userId); String getUserProfileUri(String userId); String getUserAvatarImageSource(String userId); String getSpaceAvatarImageSource(String spaceIdentityId); String getActivityStatus(); int getFilesCount(); void setUIActivityData(Map<String, String> activityParams); String getWebdavURL(int i); String[] getSystemCommentBundle(Map<String, String> activityParams); String[] getSystemCommentTitle(Map<String, String> activityParams); DriveData getDocDrive(int i); String getDefaultIconClass(int i); String getDocFileBreadCrumb(int i); String getDocFilePath(int i); LinkedHashMap<String, String> getDocFolderRelativePathWithLinks(int i); String getDocFolderRelativePath(int i); String getCurrentDocOpenUri(int i); String getDocOpenUri(String nodePath, int i); String getEditLink(int i); String getActivityEditLink(int i); String getDownloadAllLink(); String getDownloadLink(int i); boolean isFileSupportPreview(Node data); boolean canEditDocument(Node data); @Override void end(); String getLinkDescription(); void setLinkDescription(String linkDescription); String getLinkImage(); void setLinkImage(String linkImage); String getLinkSource(); void setLinkSource(String linkSource); String getLinkTitle(); void setLinkTitle(String linkTitle); String getEmbedHtml(); void setEmbedHtml(String embedHtml); CloudDrive getCloudDrive(Node node); boolean isCloudFile(CloudDrive cloudDrive); CloudFile getCloudFile(Node node); String getCloudFileIcon(CloudDrive cloudDrive); static final String[] EMPTY_ARRAY; static final String SEPARATOR_REGEX; static final String ID; static final String CONTENT_LINK; static final String MESSAGE; static final String ACTIVITY_STATUS; static final String IMAGE_PATH; static final String MIME_TYPE; static final String STATE; static final String AUTHOR; static final String DATE_CREATED; static final String LAST_MODIFIED; static final String DOCUMENT_TYPE_LABEL; static final String DOCUMENT_TITLE; static final String DOCUMENT_VERSION; static final String DOCUMENT_SUMMARY; static final String IS_SYSTEM_COMMENT; static final String SYSTEM_COMMENT; static final String ONE_DRIVE_PROVIDER_ID; static final String GOOGLE_DRIVE_PROVIDER_ID; static final String ONE_DRIVE_ICON; static final String GOOGLE_DRIVE_ICON; public int filesCount; }