001    package org.apache.ojb.odmg.link;
002    
003    /* Copyright 2002-2005 The Apache Software Foundation
004     *
005     * Licensed under the Apache License, Version 2.0 (the "License");
006     * you may not use this file except in compliance with the License.
007     * You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    import org.apache.commons.lang.builder.ToStringBuilder;
019    import org.apache.ojb.broker.PersistenceBroker;
020    import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
021    
022    /**
023     * @author <a href="mailto:arminw@apache.org">Armin Waibel</a>
024     * @version $Id: LinkEntry.java,v 1.1 2007-08-24 22:17:41 ewestfal Exp $
025     */
026    public abstract class LinkEntry
027    {
028        final boolean isUnlink;
029        final Object source;
030        final Object referenceToLink;
031        final ObjectReferenceDescriptor ord;
032    
033        protected LinkEntry(Object source, ObjectReferenceDescriptor ord, Object referenceToLink, boolean unlink)
034        {
035            this.source = source;
036            this.ord = ord;
037            this.referenceToLink = referenceToLink;
038            isUnlink = unlink;
039        }
040    
041        public abstract void execute(final PersistenceBroker broker);
042    
043        public String toString()
044        {
045            return new ToStringBuilder(this)
046                    .append("source", source)
047                    .append("descriptor", ord)
048                    .append("referenceToLink", referenceToLink)
049                    .append("isUnlink", isUnlink)
050                    .toString();
051        }
052    }