Example usage for com.liferay.portal.kernel.util StringPool SLASH

List of usage examples for com.liferay.portal.kernel.util StringPool SLASH

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringPool SLASH.

Prototype

String SLASH

To view the source code for com.liferay.portal.kernel.util StringPool SLASH.

Click Source Link

Usage

From source file:com.liferay.portlet.documentlibrary.lar.DLPortletDataHandlerImpl.java

License:Open Source License

protected static String getFileEntryBinPath(PortletDataContext portletDataContext, FileEntry fileEntry) {

    StringBundler sb = new StringBundler(5);

    sb.append(portletDataContext.getPortletPath(PortletKeys.DOCUMENT_LIBRARY));
    sb.append("/bin/");
    sb.append(fileEntry.getFileEntryId());
    sb.append(StringPool.SLASH);
    sb.append(fileEntry.getVersion());/*from  w w w. j av  a 2s  .  c o  m*/

    return sb.toString();
}

From source file:com.liferay.portlet.documentlibrary.model.impl.DLFolderImpl.java

License:Open Source License

public String getPath() throws PortalException, SystemException {
    StringBuilder sb = new StringBuilder();

    DLFolder folder = this;

    while (folder != null) {
        sb.insert(0, folder.getName());//from  w  ww  .  j ava2 s. c o m
        sb.insert(0, StringPool.SLASH);

        folder = folder.getParentFolder();
    }

    return sb.toString();
}

From source file:com.liferay.portlet.documentlibrary.service.impl.DLContentLocalServiceImpl.java

License:Open Source License

public void deleteContentsByDirectory(long companyId, long repositoryId, String dirName)
        throws SystemException {

    if (!dirName.endsWith(StringPool.SLASH)) {
        dirName = dirName.concat(StringPool.SLASH);
    }//from  w  ww  .  j  ava 2s.  c o m

    dirName = dirName.concat(StringPool.PERCENT);

    dlContentPersistence.removeByC_R_LikeP(companyId, repositoryId, dirName);
}

From source file:com.liferay.portlet.documentlibrary.service.impl.DLContentLocalServiceImpl.java

License:Open Source License

public List<DLContent> getContentsByDirectory(long companyId, long repositoryId, String dirName)
        throws SystemException {

    if (!dirName.endsWith(StringPool.SLASH)) {
        dirName = dirName.concat(StringPool.SLASH);
    }/* ww w.j  av a  2 s.  c om*/

    dirName = dirName.concat(StringPool.PERCENT);

    return dlContentPersistence.findByC_R_LikeP(companyId, repositoryId, dirName);
}

From source file:com.liferay.portlet.documentlibrary.service.impl.DLFileEntryLocalServiceImpl.java

License:Open Source License

protected void validateFileName(String fileName) throws PortalException {
    if (fileName.contains(StringPool.SLASH)) {
        throw new FileNameException(fileName);
    }/*w w w . j  a  v a 2s  . c  om*/
}

From source file:com.liferay.portlet.documentlibrary.sharepoint.DLSharepointStorageImpl.java

License:Open Source License

@Override
public void addDocumentElements(SharepointRequest sharepointRequest, Element element) throws Exception {

    String parentFolderPath = sharepointRequest.getRootPath();

    long groupId = SharepointUtil.getGroupId(parentFolderPath);
    long parentFolderId = getLastFolderId(groupId, parentFolderPath,
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);

    if (parentFolderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
        return;//from   w w  w  .j  a  va2  s. c o  m
    }

    List<FileEntry> fileEntries = DLAppServiceUtil.getFileEntries(groupId, parentFolderId);

    for (FileEntry fileEntry : fileEntries) {
        String documentPath = parentFolderPath.concat(StringPool.SLASH).concat(fileEntry.getTitle());

        addDocumentElement(element, documentPath, fileEntry.getCreateDate(), fileEntry.getModifiedDate(),
                fileEntry.getUserName());
    }
}

From source file:com.liferay.portlet.documentlibrary.sharepoint.DLSharepointStorageImpl.java

License:Open Source License

protected Tree getFolderTree(Folder folder, String parentFolderPath) {
    String folderPath = parentFolderPath.concat(StringPool.SLASH).concat(folder.getName());

    return getFolderTree(folderPath, folder.getCreateDate(), folder.getModifiedDate(),
            folder.getLastPostDate());/*  ww w.  j a  v  a2s  .  co  m*/
}

From source file:com.liferay.portlet.documentlibrary.sharepoint.DLSharepointStorageImpl.java

License:Open Source License

protected Tree getFileEntryTree(FileEntry fileEntry, String parentFolderPath) {

    String documentPath = parentFolderPath.concat(StringPool.SLASH).concat(fileEntry.getTitle());

    return getDocumentTree(documentPath, fileEntry.getCreateDate(), fileEntry.getModifiedDate(),
            fileEntry.getSize(), fileEntry.getUserName(), fileEntry.getVersion());
}

From source file:com.liferay.portlet.documentlibrary.store.AdvancedFileSystemStore.java

License:Open Source License

@Override
public String[] getFileNames(long companyId, long repositoryId) {
    File repositoryDir = getRepositoryDir(companyId, repositoryId);

    String[] directories = FileUtil.listDirs(repositoryDir);

    List<String> fileNames = new ArrayList<String>();

    for (String directory : directories) {
        fileNames.addAll(getAdvancedFileNames(companyId, repositoryId,
                repositoryDir.getPath() + StringPool.SLASH + directory));
    }// w ww. ja  v a  2  s  . c om

    return fileNames.toArray(new String[0]);
}

From source file:com.liferay.portlet.documentlibrary.store.AdvancedFileSystemStore.java

License:Open Source License

@Override
public void updateFile(long companyId, long repositoryId, String fileName, String newFileName)
        throws PortalException {

    super.updateFile(companyId, repositoryId, fileName, newFileName);

    File newFileNameDir = getFileNameDir(companyId, repositoryId, newFileName);

    String[] fileNameVersions = FileUtil.listFiles(newFileNameDir);

    for (String fileNameVersion : fileNameVersions) {
        String ext = FileUtil.getExtension(fileNameVersion);

        if (ext.equals(_HOOK_EXTENSION)) {
            continue;
        }// w ww.  ja v  a  2  s.c  o m

        File fileNameVersionFile = new File(newFileNameDir + StringPool.SLASH + fileNameVersion);
        File newFileNameVersionFile = new File(newFileNameDir + StringPool.SLASH
                + FileUtil.stripExtension(fileNameVersion) + StringPool.PERIOD + _HOOK_EXTENSION);

        fileNameVersionFile.renameTo(newFileNameVersionFile);
    }
}