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

org.tentackle.domain.AbstractDomainOperation Maven / Gradle / Ivy

There is a newer version: 21.16.1.0
Show newest version
/*
 * Tentackle - https://tentackle.org.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

package org.tentackle.domain;

import org.tentackle.pdo.DomainContext;
import org.tentackle.pdo.DomainOperation;
import org.tentackle.pdo.Operation;
import org.tentackle.pdo.PersistenceDelegate;
import org.tentackle.reflect.EffectiveClassProvider;
import org.tentackle.session.Session;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * The abstract domain operation.
 *
 * @author harald
 * @param  the operation type
 * @param  the domain implementation type
 */
public abstract class AbstractDomainOperation, D extends AbstractDomainOperation>
       implements DomainOperation, EffectiveClassProvider, Serializable {

  @Serial
  private static final long serialVersionUID = 1L;


  private T operation;   // the operation instance this is a delegate for


  /**
   * Creates an operation domain object.
   *
   * @param operation the persistent domain object this is a delegate for
   */
  public AbstractDomainOperation(T operation) {
    this.operation = operation;
  }


  /**
   * Creates an operation domain object.
   */
  public AbstractDomainOperation() {
  }


  @Override
  public PersistenceDelegate getPersistenceDelegate() {
    return operation.getPersistenceDelegate();
  }

  @Override
  public T me() {
    return operation;
  }

  @Override
  public T getOperation() {
    return operation;
  }

  /**
   * Sets the operation.
* * @param operation the operation */ public void setOperation(T operation) { this.operation = operation; } @Override public DomainContext getDomainContext() { return operation.getPersistenceDelegate().getDomainContext(); } @Override public Session getSession() { return operation.getPersistenceDelegate().getSession(); } @Override public Class getEffectiveClass() { return operation.getEffectiveClass(); } @Override public List> getEffectiveSuperClasses() { return operation.getEffectiveSuperClasses(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy