001package de.kiezatlas;
002
003
004import de.deepamehta.core.Association;
005import de.deepamehta.core.RelatedTopic;
006import de.deepamehta.core.Topic;
007import de.deepamehta.core.service.ResultList;
008import de.deepamehta.core.service.accesscontrol.SharingMode;
009import de.deepamehta.plugins.geomaps.model.GeoCoordinate;
010
011import java.util.List;
012
013
014
015public interface KiezatlasService {
016
017    static final String KIEZATLAS_WORKSPACE_NAME = "Kiezatlas";
018    static final String KIEZATLAS_WORKSPACE_URI = "de.kiezatlas.workspace";
019    static final SharingMode KIEZATLAS_WORKSPACE_SHARING_MODE = SharingMode.PUBLIC;
020
021    static final String WEBSITE         = "ka2.website";
022    static final String GEO_OBJECT      = "ka2.geo_object";
023    static final String GEO_OBJECT_NAME = "ka2.geo_object.name";
024    static final String GEO_OBJECT_ADDRESS = "dm4.contacts.address";
025
026    /**
027     * Returns the "Kiezatlas Website" topic the given geomap is assigned to.
028     */
029    Topic getWebsite(long geomapId);
030
031    /**
032     * Returns the facet types assigned to the given Kiezatlas Website.
033     */
034    ResultList<RelatedTopic> getFacetTypes(long websiteId);
035
036    /**
037     * Returns all Kiezatlas criteria existing in the DB. ### Experimental
038     * A Kiezatlas criteria is a topic type whose URI starts with <code>ka2.criteria.</code>
039     * but does not end with <code>.facet</code>.
040     */
041    List<Topic> getAllCriteria();
042
043    /**
044     * Returns all Geo Objects assigned to the given geomap.
045     */
046    List<Topic> getGeoObjects(long geomapId);
047
048    /**
049     * Returns all Geo Objects assigned to the given category.
050     */
051    List<RelatedTopic> getGeoObjectsByCategory(long categoryId);
052
053    /**
054     * Searches for Geo Objects whose name match the search term (case-insensitive substring search).
055     *
056     * @param   clock   The logical clock value send back to the client (contained in GeoObjects).
057     *                  Allows the client to order asynchronous responses.
058     */
059    GeoObjects searchGeoObjectNames(String searchTerm, long clock);
060
061    /**
062     * Searches for categories that match the search term (case-insensitive substring search)
063     * and returns all Geo Objects of those categories, grouped by category.
064     *
065     * @param   clock   The logical clock value send back to the client (contained in GroupedGeoObjects).
066     *                  Allows the client to order asynchronous responses.
067     */
068    GroupedGeoObjects searchCategories(String searchTerm, long clock);
069
070    Topic createWebsite(String siteName, String siteUri);
071
072    Association addGeoObjectToWebsite(long geoObjectId, long siteId);
073
074    /** Fetches Geo Coordinate facet related to a Geo Objects Address (!) topic. */
075    GeoCoordinate getGeoCoordinateByGeoObject(Topic geoObject);
076
077    ResultList<RelatedTopic> getParentRelatedAggregatedGeoObjects(Topic bezirksFacet);
078
079    Topic getImageFileFacetByGeoObject(Topic facettedTopic);
080
081    void updateImageFileFacet(Topic geoObject, String imageFilePath);
082
083    Topic getFacettedBezirksregionChildTopic(Topic facettedTopic);
084
085    String getGeoObjectAttribution(Topic geoObject);
086
087}