001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nuxeo - initial API and implementation
016 *
017 * $Id: JOOoConvertPluginImpl.java 18651 2007-05-13 20:28:53Z sfermigier $
018 */
019
020package org.nuxeo.ecm.directory;
021
022import java.util.List;
023
024/**
025 * Base interface for references between directory fields.
026 * <p>
027 * References are used to leverage SQL joins or attributes that store a list of distinguished names in LDAP servers
028 * (e.g. uniqueMember).
029 * <p>
030 * In nuxeo directories, references are special entry fields that are string list of entry ids of a target directory.
031 *
032 * @author ogrisel
033 */
034public interface Reference {
035
036    String getFieldName();
037
038    Directory getSourceDirectory() throws DirectoryException;
039
040    void setSourceDirectoryName(String sourceDirectoryName);
041
042    Directory getTargetDirectory() throws DirectoryException;
043
044    void setTargetDirectoryName(String targetDirectoryName);
045
046    void addLinks(String sourceId, List<String> targetIds) throws DirectoryException;
047
048    void addLinks(List<String> sourceIds, String targetId) throws DirectoryException;
049
050    void removeLinksForSource(String sourceId) throws DirectoryException;
051
052    void removeLinksForTarget(String targetId) throws DirectoryException;
053
054    List<String> getTargetIdsForSource(String sourceId) throws DirectoryException;
055
056    List<String> getSourceIdsForTarget(String targetId) throws DirectoryException;
057
058    void setTargetIdsForSource(String sourceId, List<String> targetIds) throws DirectoryException;
059
060    void setSourceIdsForTarget(String targetId, List<String> sourceIds) throws DirectoryException;
061
062    /**
063     * Returns a clone, added for hot reload support.
064     *
065     * @since 5.6
066     */
067    Reference clone();
068}