All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.cq.dam.index.bootstrap.DamIndexBootstrap Maven / Gradle / Ivy

There is a newer version: 6.5.21
Show newest version
/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * ___________________
 *
 *  Copyright 2014 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/

package com.adobe.cq.dam.index.bootstrap;

import com.adobe.cq.dam.index.builder.*;
import com.adobe.cq.dam.index.builder.api.IndexDefinition;
import com.adobe.cq.dam.index.helper.IndexHelper;
import com.google.common.collect.ImmutableList;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferencePolicy;
import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
import org.apache.sling.api.resource.LoginException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collections;
import java.util.List;

/**
 * Dam indexing related bootstrap configuration
 */
@Component
@Deprecated
public class DamIndexBootstrap {

    protected void activate(final ComponentContext context) {
        //NOOP activate for a deprecated component
    }

    protected void bindJcrResolverFactory(ResourceResolverFactory factory) {
        //NOOP bind for a deprecated component
    }

    protected void unbindJcrResolverFactory(ResourceResolverFactory factory) {
        //NOOP unbind for a deprecated component
    }

    public static List createAggregationRules() {
        return ImmutableList.of(
                new AggregationRule("dam:Asset",
                        ImmutableList.of("jcr:content", "jcr:content/metadata", "jcr:content/metadata/*", "jcr:content/renditions",
                                "jcr:content/renditions/original", "jcr:content/renditions/original/jcr:content", "jcr:content/comments", "jcr:content/comments/*", "jcr:content/usages")
                )
        );
    }

    public static List createIndexRules() {
        return ImmutableList.of(
                new IndexRule("dam:Asset",
                        ImmutableList.of(
                                new SimplePropertyDefinition("jcr:content/metadata/cq:tags", "cqTags", 1.0f, false, true, true),
                                new SimplePropertyDefinition("jcr:content/metadata/dc:format", "dcFormat", 1.0f, true),
                                new SimplePropertyDefinition("jcr:content/metadata/dam:status", "damStatus"),
                                new SimplePropertyDefinition("jcr:content/metadata/videoCodec", "videoCodec"),
                                new SimplePropertyDefinition("jcr:content/metadata/audioCodec", "audioCodec"),
                                new SimplePropertyDefinition("jcr:content/metadata/dc:title", "dcTitle", 2.0f, false, true, true),
                                new SimplePropertyDefinition("jcr:content/metadata/dc:description", "dcDescription", 1.0f, false, true, true),
                                new SimplePropertyDefinition("jcr:content/metadata/xmpMM:InstanceID", "xmpMMInstanceId"),
                                new SimplePropertyDefinition("jcr:content/metadata/xmpMM:DocumentID", "xmpMMDocumentId"),
                                new SimplePropertyDefinition("jcr:content/metadata/dam:sha1", "damSha1"),
                                new SimplePropertyDefinition("jcr:content/hasValidMetadata", "hasValidMetadata", "Boolean"),
                                new SimplePropertyDefinition("jcr:content/metadata/refExpired", "refExpired", "Boolean"),
                                new SimplePropertyDefinition("jcr:content/metadata/videoBitrate", "videoBitrate"),
                                new SimplePropertyDefinition("jcr:content/metadata/audioBitrate", "audioBitRate"),
                                new SimplePropertyDefinition("jcr:content/usages/usedBy", "usedBy"),
                                new OrderedPropertyDefinition("jcr:content/jcr:lastModified", "jcrLastModified", "Date"),
                                new OrderedPropertyDefinition("jcr:content/metadata/prism:expirationDate", "expirationDate", "Date"),
                                new OrderedPropertyDefinition("jcr:content/onTime", "onTime", "Date"),
                                new OrderedPropertyDefinition("jcr:content/offTime", "offTime", "Date"),
                                new OrderedPropertyDefinition("jcr:content/metadata/dam:size", "damSize", "Long"),
                                new OrderedPropertyDefinition("jcr:content/averageRating", "averageRating", "Double"),
                                new OrderedPropertyDefinition("jcr:content/metadata/tiff:ImageWidth", "tiffImageWidth", "Long"),
                                new OrderedPropertyDefinition("jcr:content/metadata/tiff:ImageLength", "tiffImageLength", "Long"),
                                new OrderedPropertyDefinition("jcr:content/usages/dam:score", "score", "Long"),
                                new NullChkEnabledPropertyDefinition("jcr:content/metadata/simsearchVersion", "simsearchVersion", true),
                                new SimplePropertyDefinition("jcr:content/metadata/predictedTags/*/name", "predictedTags", true, false, true),
                                new SimplePropertyDefinition("jcr:content/metadata/predictedTags/*/confidence", "predictedTagsConfidence", true, false, true),
                                new SimplePropertyDefinition("jcr:content/metadata/dam:search_promote", "damSearchElevate", 100.0f, true),
                                new SimplePropertyDefinition("jcr:content/jcr:title", "jcrTitle", 2.0f, false, true, true),
                                new SimplePropertyDefinition("jcr:content/jcr:description", "jcrDescription", 1.0f, false, true, true)
                        )
                )
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy