001/*
002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id: JOOoConvertPluginImpl.java 18651 2007-05-13 20:28:53Z sfermigier $
020 */
021
022package org.nuxeo.ecm.directory;
023
024import java.util.List;
025
026/**
027 * Base interface for references between directory fields.
028 * <p>
029 * References are used to leverage SQL joins or attributes that store a list of distinguished names in LDAP servers
030 * (e.g. uniqueMember).
031 * <p>
032 * In nuxeo directories, references are special entry fields that are string list of entry ids of a target directory.
033 *
034 * @author ogrisel
035 */
036public interface Reference {
037
038    String getFieldName();
039
040    Directory getSourceDirectory() throws DirectoryException;
041
042    void setSourceDirectoryName(String sourceDirectoryName);
043
044    Directory getTargetDirectory() throws DirectoryException;
045
046    void setTargetDirectoryName(String targetDirectoryName);
047
048    void addLinks(String sourceId, List<String> targetIds) throws DirectoryException;
049
050    void addLinks(List<String> sourceIds, String targetId) throws DirectoryException;
051
052    void removeLinksForSource(String sourceId) throws DirectoryException;
053
054    void removeLinksForTarget(String targetId) throws DirectoryException;
055
056    List<String> getTargetIdsForSource(String sourceId) throws DirectoryException;
057
058    List<String> getSourceIdsForTarget(String targetId) throws DirectoryException;
059
060    void setTargetIdsForSource(String sourceId, List<String> targetIds) throws DirectoryException;
061
062    void setSourceIdsForTarget(String targetId, List<String> sourceIds) throws DirectoryException;
063
064    /**
065     * Returns a clone, added for hot reload support.
066     *
067     * @since 5.6
068     */
069    Reference clone();
070}