MediaSetNodeItem.java 3.27 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.scene7.is.catalog.util.localization.LocaleMap
 *  com.scene7.is.provider.ImageSetColorLabel
 *  com.scene7.is.util.DigestAdler32
 *  com.scene7.is.util.SizeInt
 *  com.scene7.is.util.error.ApplicationException
 *  org.jetbrains.annotations.NotNull
 */
package com.scene7.is.ps.provider.fvctx;

import com.scene7.is.catalog.util.localization.LocaleMap;
import com.scene7.is.provider.ImageSetColorLabel;
import com.scene7.is.ps.provider.IZoomException;
import com.scene7.is.ps.provider.Request;
import com.scene7.is.ps.provider.fvctx.FvctxImageProps;
import com.scene7.is.ps.provider.fvctx.FvctxNode;
import com.scene7.is.ps.provider.fvctx.FvctxNodeNull;
import com.scene7.is.ps.provider.fvctx.MediaSetItemType;
import com.scene7.is.ps.provider.fvctx.MediaSetMetaData;
import com.scene7.is.ps.provider.fvctx.MediaSetSetType;
import com.scene7.is.ps.provider.fvctx.MediaSetVideoProps;
import com.scene7.is.util.DigestAdler32;
import com.scene7.is.util.SizeInt;
import com.scene7.is.util.error.ApplicationException;
import java.util.zip.Adler32;
import org.jetbrains.annotations.NotNull;

public class MediaSetNodeItem
extends FvctxNodeNull {
    private Adler32 imageDigest = DigestAdler32.createMessageDigest();

    MediaSetNodeItem(@NotNull FvctxNode next) {
        super(next);
    }

    @Override
    public void startItem(MediaSetItemType type) {
        this.imageDigest = DigestAdler32.createMessageDigest();
        this.getNext().startItem(type);
    }

    @Override
    public void endItem(@NotNull String imageVersion) {
        String iv = DigestAdler32.createSignature((long)this.imageDigest.getValue());
        this.getNext().endItem(iv);
    }

    @Override
    public void startFrame(@NotNull String netPath, @NotNull String query, @NotNull Request parsedRequest, @NotNull FvctxImageProps imageProps, boolean hasNestedFrame, boolean isMediaSetItem) throws ApplicationException {
        this.updateDigest(imageProps);
        this.getNext().startFrame(netPath, query, parsedRequest, imageProps, hasNestedFrame, isMediaSetItem);
    }

    @Override
    public void startVideoFrame(@NotNull String netPath, @NotNull String query, @NotNull MediaSetVideoProps videoProps) throws ApplicationException {
        MediaSetVideoProps.updateVideoDigest(this.imageDigest, videoProps);
        this.getNext().startVideoFrame(netPath, query, videoProps);
    }

    @Override
    public void image(@NotNull String netPath, @NotNull String query, @NotNull Request parsedRequest, @NotNull FvctxImageProps imageProps) throws ApplicationException {
        this.updateDigest(imageProps);
        this.getNext().image(netPath, query, parsedRequest, imageProps);
    }

    @Override
    public void swatch(@NotNull String netPath, @NotNull String query, @NotNull Request parsedRequest, @NotNull FvctxImageProps imageProps, boolean hasNestedFrame, boolean isMediaItemSwatch) throws ApplicationException {
        this.updateDigest(imageProps);
        this.getNext().swatch(netPath, query, parsedRequest, imageProps, hasNestedFrame, isMediaItemSwatch);
    }

    private void updateDigest(@NotNull FvctxImageProps imageProps) {
        if (this.imageDigest != null) {
            FvctxImageProps.updateImageDigest(this.imageDigest, imageProps);
        }
    }
}