FvctxImagePath.java 2.17 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.scene7.is.catalog.util.ObjectTypeEnum
 *  com.scene7.is.provider.catalog.Catalog
 *  com.scene7.is.provider.catalog.CatalogException
 *  com.scene7.is.provider.catalog.ObjectRecord
 *  com.scene7.is.util.UniversalPath
 *  com.scene7.is.util.text.ParsingException
 *  com.scene7.is.util.text.parsers.URLDecodeParser
 *  org.jetbrains.annotations.NotNull
 */
package com.scene7.is.ps.provider.fvctx;

import com.scene7.is.catalog.util.ObjectTypeEnum;
import com.scene7.is.provider.catalog.Catalog;
import com.scene7.is.provider.catalog.CatalogException;
import com.scene7.is.provider.catalog.ObjectRecord;
import com.scene7.is.ps.provider.RequestBuilderUtil;
import com.scene7.is.util.UniversalPath;
import com.scene7.is.util.text.ParsingException;
import com.scene7.is.util.text.parsers.URLDecodeParser;
import org.jetbrains.annotations.NotNull;

public class FvctxImagePath {
    @NotNull
    public static String canonicalizeImagePath(@NotNull Catalog catalog, @NotNull String path) throws ParsingException, CatalogException {
        String preparedPath = FvctxImagePath.preparePath(path);
        Catalog pathCatalog = catalog.getRecord(preparedPath).getCatalog();
        return RequestBuilderUtil.getAbsolutePath(pathCatalog, preparedPath);
    }

    @NotNull
    public static String canonicalizeVideoPath(@NotNull Catalog catalog, @NotNull String path) throws ParsingException, CatalogException {
        String preparedPath = FvctxImagePath.preparePath(path);
        Catalog pathCatalog = catalog.getRecord(preparedPath, ObjectTypeEnum.STATIC).getCatalog();
        return RequestBuilderUtil.getAbsolutePath(pathCatalog, preparedPath);
    }

    @NotNull
    public static String preparePath(String path) throws ParsingException {
        String preparedPath = (String)URLDecodeParser.urlDecodeParser().parse(path);
        preparedPath = UniversalPath.collapseSlashes((CharSequence)preparedPath);
        preparedPath = UniversalPath.removeTrailingSlashes((CharSequence)preparedPath);
        UniversalPath.validatePath((String)preparedPath);
        return preparedPath;
    }

    private FvctxImagePath() {
    }
}