Example usage for com.liferay.portal.kernel.model CompanyConstants SYSTEM

List of usage examples for com.liferay.portal.kernel.model CompanyConstants SYSTEM

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model CompanyConstants SYSTEM.

Prototype

long SYSTEM

To view the source code for com.liferay.portal.kernel.model CompanyConstants SYSTEM.

Click Source Link

Usage

From source file:com.liferay.adaptive.media.image.internal.storage.ImageStorage.java

License:Open Source License

public void delete(FileVersion fileVersion, String configurationUuid) {
    DLStoreUtil.deleteDirectory(fileVersion.getCompanyId(), CompanyConstants.SYSTEM,
            getFileVersionPath(fileVersion, configurationUuid));
}

From source file:com.liferay.adaptive.media.image.internal.storage.ImageStorage.java

License:Open Source License

public void delete(long companyId, String configurationUuid) {
    DLStoreUtil.deleteDirectory(companyId, CompanyConstants.SYSTEM,
            getConfigurationEntryPath(configurationUuid));
}

From source file:com.liferay.adaptive.media.image.internal.storage.ImageStorage.java

License:Open Source License

public void save(FileVersion fileVersion, String configurationUuid, InputStream inputStream) {

    try {//w  w w  . j ava 2 s  .c  o  m
        String fileVersionPath = getFileVersionPath(fileVersion, configurationUuid);

        DLStoreUtil.addFile(fileVersion.getCompanyId(), CompanyConstants.SYSTEM, fileVersionPath, false,
                inputStream);
    } catch (PortalException pe) {
        throw new AdaptiveMediaRuntimeException.IOException(pe);
    }
}

From source file:com.liferay.adaptive.media.image.internal.storage.ImageStorage.java

License:Open Source License

protected InputStream getFileAsStream(long companyId, String path) throws PortalException {

    return DLStoreUtil.getFileAsStream(companyId, CompanyConstants.SYSTEM, path);
}

From source file:com.liferay.adaptive.media.image.internal.util.ImageStorage.java

License:Open Source License

public void copy(FileVersion sourceFileVersion, FileVersion destinationFileVersion) {

    try {/*  w w w  .j a  va 2s .  c om*/
        Path destinationBasePath = getFileVersionPath(destinationFileVersion);

        Path sourceBasePath = getFileVersionPath(sourceFileVersion);

        String[] sourceFileNames = DLStoreUtil.getFileNames(sourceFileVersion.getCompanyId(),
                CompanyConstants.SYSTEM, sourceBasePath.toString());

        for (String sourceFileName : sourceFileNames) {
            Path sourceFileNamePath = Paths.get(sourceFileName);

            try (InputStream inputStream = getFileAsStream(sourceFileVersion.getCompanyId(),
                    sourceFileNamePath)) {

                Path destinationPath = destinationBasePath.resolve(sourceFileNamePath);

                DLStoreUtil.addFile(sourceFileVersion.getCompanyId(), CompanyConstants.SYSTEM,
                        destinationPath.toString(), false, inputStream);
            }
        }
    } catch (IOException | PortalException e) {
        throw new AdaptiveMediaRuntimeException.IOException(e);
    }
}

From source file:com.liferay.adaptive.media.image.internal.util.ImageStorage.java

License:Open Source License

public void delete(FileVersion fileVersion) {
    Path fileVersionPath = getFileVersionPath(fileVersion);

    DLStoreUtil.deleteDirectory(fileVersion.getCompanyId(), CompanyConstants.SYSTEM,
            fileVersionPath.toString());
}

From source file:com.liferay.adaptive.media.image.internal.util.ImageStorage.java

License:Open Source License

public Optional<ImageInfo> getImageInfo(FileVersion fileVersion,
        ImageAdaptiveMediaConfigurationEntry configurationEntry) {

    try {/*from  w  w  w . java  2s  .  com*/
        Path fileVersionVariantPath = getFileVersionVariantPath(fileVersion, configurationEntry);

        if (!DLStoreUtil.hasDirectory(fileVersion.getCompanyId(), CompanyConstants.SYSTEM,
                fileVersionVariantPath.toString())) {

            return Optional.empty();
        }

        File file = getFile(fileVersion.getCompanyId(), fileVersionVariantPath);

        return Optional.of(new ImageInfo(fileVersion.getMimeType(), file.length()));
    } catch (PortalException pe) {
        throw new AdaptiveMediaRuntimeException.IOException(pe);
    }
}

From source file:com.liferay.adaptive.media.image.internal.util.ImageStorage.java

License:Open Source License

public void save(FileVersion fileVersion, ImageAdaptiveMediaConfigurationEntry configurationEntry,
        InputStream inputStream) {

    try {// w w  w  . j  a  v a 2 s .c o m
        Path fileVersionVariantPath = getFileVersionVariantPath(fileVersion, configurationEntry);

        DLStoreUtil.addFile(fileVersion.getCompanyId(), CompanyConstants.SYSTEM,
                fileVersionVariantPath.toString(), false, inputStream);
    } catch (PortalException pe) {
        throw new AdaptiveMediaRuntimeException.IOException(pe);
    }
}

From source file:com.liferay.adaptive.media.image.internal.util.ImageStorage.java

License:Open Source License

protected File getFile(long companyId, Path path) throws PortalException {
    return DLStoreUtil.getFile(companyId, CompanyConstants.SYSTEM, path.toString());
}

From source file:com.liferay.adaptive.media.image.internal.util.ImageStorage.java

License:Open Source License

protected InputStream getFileAsStream(long companyId, Path path) throws PortalException {

    return DLStoreUtil.getFileAsStream(companyId, CompanyConstants.SYSTEM, path.toString());
}