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

com.activitystream.model.interfaces.LinkedElement Maven / Gradle / Ivy

Go to download

AS-SDK is a java library to allow easy interoperability with Activity Stream.

There is a newer version: 0.1.25
Show newest version
package com.activitystream.model.interfaces;

import com.activitystream.model.entities.EntityReference;
import com.activitystream.model.relations.Relation;
import com.activitystream.model.security.SecurityScope;
import com.activitystream.model.utils.ElementTraversal;

import java.util.function.Consumer;

public interface LinkedElement {

    enum LINK_DETAILS {
        FULL,
        LIST,
        LIST_DETAILED
    }


    /************  Utility Functions ************/

    /**
     * Low-level element traversal. Should probably not be used outside the implementation of {@link ElementTraversal}.
     */
    boolean traverse(ElementVisitor visitor);

    /**
     * Higher level element traversal, providing a somewhat stream-like interface for manipulating nested elements.
     */
    default ElementTraversal traversal() {
        return new ElementTraversal(this);
    }

    default void onEachEntityRelation(Consumer action) {
    }

    default void onEachRelationType(StreamItemRelationTypeConsumer action) {
    }

    default void onEachEntityReference(Consumer action) {
    }

    void setSecurityScope(SecurityScope scope);

    //void createApiLinks(Tenant tenant, LINK_DETAILS details);

    @FunctionalInterface
    interface ElementVisitor {

        boolean visit(LinkedElement linkedElement);
    }

    @FunctionalInterface
    interface StreamItemRelationTypeConsumer {

        void accept(String relationType, String outType, String inType);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy