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

com.anaptecs.jeaf.services.usermanagement.AuthorizationServiceProxy Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
/*
 * anaptecs GmbH, Ricarda-Huch-Str. 71, 72760 Reutlingen, Germany
 * 
 * Copyright 2004 - 2019. All rights reserved.
 */
package com.anaptecs.jeaf.services.usermanagement;

import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.List;

import com.anaptecs.jeaf.core.api.MessageConstants;
import com.anaptecs.jeaf.core.api.Service;
import com.anaptecs.jeaf.core.api.ServiceObjectID;
import com.anaptecs.jeaf.core.servicechannel.api.Command;
import com.anaptecs.jeaf.core.servicechannel.api.ServiceProxy;
import com.anaptecs.jeaf.core.spi.TransactionBehavior;
import com.anaptecs.jeaf.xfun.api.XFun;
import com.anaptecs.jeaf.xfun.api.errorhandling.ApplicationException;
import com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException;
import com.anaptecs.jeaf.xfun.api.trace.Trace;

/**
 * ServiceProxy class for JEAF service AuthorizationService.
 */
public final class AuthorizationServiceProxy extends ServiceProxy implements AuthorizationService {
  /**
   * Serial version uid for the proxy class.
   */
  private static final long serialVersionUID = 1L;

  /**
   * Initialize object.
   *
   * @param pTransactionBehavior Definition of transactional behavior. The Parameter must not be null.
   */
  public AuthorizationServiceProxy( TransactionBehavior pTransactionBehavior ) {
    super(AuthorizationService.class, pTransactionBehavior);
  }

  /**
   * Generated proxy implementation for method "hasAuthorization".
   * 
   * Method checks whether the current user has the authorization of the passed type.
   */
  public boolean hasAuthorization( AuthorizationType pAuthorizationType ) {
    try {
      Command lCommand = new HasAuthorization_AuthorizationType_AuthorizationService_Command(pAuthorizationType);
      return (boolean) this.executeCommand(lCommand);
    }
    catch (ApplicationException e) {
      throw new JEAFSystemException(e.getErrorCode(), e, e.getMessageParameters());
    }
  }

  /**
   * Generated proxy implementation for method "hasAuthorization".
   * 
   * Method checks whether the current user has the permission to access the service object with the passed id with the
   * passed access mode.
   */
  public boolean hasAuthorization( ServiceObjectID pServiceObjectID, ObjectAccessMode pAccessMode ) {
    try {
      Command lCommand = new HasAuthorization_ServiceObjectID_ObjectAccessMode_AuthorizationService_Command(
          pServiceObjectID, pAccessMode);
      return (boolean) this.executeCommand(lCommand);
    }
    catch (ApplicationException e) {
      throw new JEAFSystemException(e.getErrorCode(), e, e.getMessageParameters());
    }
  }

  /**
   * Generated proxy implementation for method "hasAuthorization".
   * 
   * Method checks whether the current user has the permission to execute a use case of the passed type.
   */
  public boolean hasAuthorization( UseCaseDefinition pUseCase ) {
    try {
      Command lCommand = new HasAuthorization_UseCaseDefinition_AuthorizationService_Command(pUseCase);
      return (boolean) this.executeCommand(lCommand);
    }
    catch (ApplicationException e) {
      throw new JEAFSystemException(e.getErrorCode(), e, e.getMessageParameters());
    }
  }

  /**
   * Generated proxy implementation for method "enforceAuthorization".
   * 
   * Method checks whether the current user has right now the authorization that is described by the passed
   * authorization type. This method enforces that the user has the required authorization. If the check is negative an
   * exception due to insufficient privileges will be thrown.
   */
  public void enforceAuthorization( AuthorizationType pAuthorizationType ) {
    try {
      Command lCommand = new EnforceAuthorization_AuthorizationType_AuthorizationService_Command(pAuthorizationType);
      this.executeCommand(lCommand);
    }
    catch (ApplicationException e) {
      throw new JEAFSystemException(e.getErrorCode(), e, e.getMessageParameters());
    }
  }

  /**
   * Generated proxy implementation for method "enforceAuthorization".
   * 
   * Method checks whether the current user has right now the authorization for the service object with the passed ID
   * and the passed access mode. This method enforces that the user has the required authorization. If the check is
   * negative an exception due to insufficient privileges will be thrown.
   */
  public void enforceAuthorization( ServiceObjectID pServiceObjectID, ObjectAccessMode pAccessMode ) {
    try {
      Command lCommand = new EnforceAuthorization_ServiceObjectID_ObjectAccessMode_AuthorizationService_Command(
          pServiceObjectID, pAccessMode);
      this.executeCommand(lCommand);
    }
    catch (ApplicationException e) {
      throw new JEAFSystemException(e.getErrorCode(), e, e.getMessageParameters());
    }
  }

  /**
   * Generated proxy implementation for method "getObjectAccessPrivilege".
   * 
   * Method returns the access privilege for the object with the passed id for the current user.
   */
  public ObjectAccessPrivilege getObjectAccessPrivilege( ServiceObjectID pServiceObjectID ) {
    try {
      Command lCommand = new GetObjectAccessPrivilege_ServiceObjectID_AuthorizationService_Command(pServiceObjectID);
      return (ObjectAccessPrivilege) this.executeCommand(lCommand);
    }
    catch (ApplicationException e) {
      throw new JEAFSystemException(e.getErrorCode(), e, e.getMessageParameters());
    }
  }

  /**
   * Generated proxy implementation for method "getObjectAccessPriviliges".
   * 
   * Method returns the access privileges for the objects with the passed ids for the current user.
   */
  public ObjectAccessPrivilege getObjectAccessPriviliges( ServiceObjectID pServiceObjectIDs ) {
    try {
      Command lCommand = new GetObjectAccessPriviliges_ServiceObjectID_AuthorizationService_Command(pServiceObjectIDs);
      return (ObjectAccessPrivilege) this.executeCommand(lCommand);
    }
    catch (ApplicationException e) {
      throw new JEAFSystemException(e.getErrorCode(), e, e.getMessageParameters());
    }
  }

  /**
   * Generated proxy implementation for method "getAllAuthorizedUseCases".
   * 
   * Method returns all use cases definitions for which the current user is currently authorized.
   */
  @SuppressWarnings("unchecked")
  public List getAllAuthorizedUseCases( ) {
    try {
      Command lCommand = new GetAllAuthorizedUseCases_AuthorizationService_Command();
      return (List) this.executeCommand(lCommand);
    }
    catch (ApplicationException e) {
      throw new JEAFSystemException(e.getErrorCode(), e, e.getMessageParameters());
    }
  }
}

/**
 * Generated command class for service method "hasAuthorization".
 */
final class HasAuthorization_AuthorizationType_AuthorizationService_Command extends Command {
  /**
   * Default serial version uid.
   */
  private static final long serialVersionUID = 1L;

  /**
   * Constant for factor to convert nano seconds to milliseconds.
   */
  private static final int MILLISECONDS = 1000 * 1000;

  /**
   * Constant describes the service method that is called by this proxy class.
   */
  private static final Method SERVICE_METHOD;

  /**
   * Object array with all parameters that are passed to the service.
   */
  private final Object[] parameters;
  /**
   * Initializer is used to get the method object describing the called service method only once.
   */
  static {
    try {
      SERVICE_METHOD = AuthorizationService.class.getMethod("hasAuthorization", AuthorizationType.class);
    }
    catch (NoSuchMethodException e) {
      throw new JEAFSystemException(MessageConstants.SERVICE_METHOD_DOES_NOT_EXIST, e,
          AuthorizationService.class.getName(), "hasAuthorization(AuthorizationType.class)");
    }
  }

  /**
   * Attribute transports the method parameter "pAuthorizationType" to the service implementation via the service
   * channel.
   */
  private final AuthorizationType authorizationType;

  /**
   * Initialize object. All parameters from method "hasAuthorization" have to be passed as parameters to this command
   * object.
   * 
   * @param pAuthorizationType AuthorizationType
   */
  HasAuthorization_AuthorizationType_AuthorizationService_Command( AuthorizationType pAuthorizationType ) {
    super(AuthorizationService.class);
    authorizationType = pAuthorizationType;
    parameters = new Object[] { authorizationType };
  }

  /**
   * Method executes the service call represented by this command object via JEAFs service channel.
   * 
   * @param pTargetService Reference to the service which should be called by this command. The parameter must not be
   * null.
   * @return Serializable Result object of the service call. Due to the fact that all returned objects of remote calls
   * in Java (EJBs e.g.) have to be serializable services always have to return serializable objects no matter if it
   * will be serialized or not. If a service method has no return type (void) then the method returns null. Service
   * methods also may return null as return value.
   */
  @Override
  public Serializable execute( Service pTargetService ) {
    // Execute service call.
    AuthorizationService lService = (AuthorizationService) pTargetService;
    // Trace service call.
    Trace lTrace = XFun.getTrace();
    lTrace.write(MessageConstants.EXECUTING_SERVICE_CALL, this.getCalledServiceMethod());
    long lStartTime = System.nanoTime();
    Serializable lResult = (Serializable) lService.hasAuthorization(authorizationType);
    // Calculate duration of service call in milliseconds
    String lDuration = Long.toString((System.nanoTime() - lStartTime) / MILLISECONDS);
    // Trace result of service call.
    lTrace.write(MessageConstants.RETURNING_FROM_SERVICE_CALL, this.getCalledServiceMethod(), lDuration);
    return lResult;
  }

  /**
   * Method returns a method object describing the service method that will be called by this command object.
   * 
   * @return {@link Method} Method object describing the called service method. The method never returns null.
   */
  @Override
  public final Method getServiceMethod( ) {
    return SERVICE_METHOD;
  }

  /**
   * Method returns all parameters that will be passed to the service.
   * 
   * @return {@link Object} Object array with all parameters that will be passed to the service. The method may return
   * an empty array in case that the method has no parameters.
   */
  @Override
  public Object[] getParameters( ) {
    return parameters;
  }
}

/**
 * Generated command class for service method "hasAuthorization".
 */
final class HasAuthorization_ServiceObjectID_ObjectAccessMode_AuthorizationService_Command extends Command {
  /**
   * Default serial version uid.
   */
  private static final long serialVersionUID = 1L;

  /**
   * Constant for factor to convert nano seconds to milliseconds.
   */
  private static final int MILLISECONDS = 1000 * 1000;

  /**
   * Constant describes the service method that is called by this proxy class.
   */
  private static final Method SERVICE_METHOD;

  /**
   * Object array with all parameters that are passed to the service.
   */
  private final Object[] parameters;
  /**
   * Initializer is used to get the method object describing the called service method only once.
   */
  static {
    try {
      SERVICE_METHOD =
          AuthorizationService.class.getMethod("hasAuthorization", ServiceObjectID.class, ObjectAccessMode.class);
    }
    catch (NoSuchMethodException e) {
      throw new JEAFSystemException(MessageConstants.SERVICE_METHOD_DOES_NOT_EXIST, e,
          AuthorizationService.class.getName(), "hasAuthorization(ServiceObjectID.class, ObjectAccessMode.class)");
    }
  }

  /**
   * Attribute transports the method parameter "pServiceObjectID" to the service implementation via the service channel.
   */
  private final ServiceObjectID serviceObjectID;

  /**
   * Attribute transports the method parameter "pAccessMode" to the service implementation via the service channel.
   */
  private final ObjectAccessMode accessMode;

  /**
   * Initialize object. All parameters from method "hasAuthorization" have to be passed as parameters to this command
   * object.
   * 
   * @param pServiceObjectID ServiceObjectID
   * @param pAccessMode ObjectAccessMode
   */
  HasAuthorization_ServiceObjectID_ObjectAccessMode_AuthorizationService_Command( ServiceObjectID pServiceObjectID,
      ObjectAccessMode pAccessMode ) {
    super(AuthorizationService.class);
    serviceObjectID = pServiceObjectID;
    accessMode = pAccessMode;
    parameters = new Object[] { serviceObjectID, accessMode };
  }

  /**
   * Method executes the service call represented by this command object via JEAFs service channel.
   * 
   * @param pTargetService Reference to the service which should be called by this command. The parameter must not be
   * null.
   * @return Serializable Result object of the service call. Due to the fact that all returned objects of remote calls
   * in Java (EJBs e.g.) have to be serializable services always have to return serializable objects no matter if it
   * will be serialized or not. If a service method has no return type (void) then the method returns null. Service
   * methods also may return null as return value.
   */
  @Override
  public Serializable execute( Service pTargetService ) {
    // Execute service call.
    AuthorizationService lService = (AuthorizationService) pTargetService;
    // Trace service call.
    Trace lTrace = XFun.getTrace();
    lTrace.write(MessageConstants.EXECUTING_SERVICE_CALL, this.getCalledServiceMethod());
    long lStartTime = System.nanoTime();
    Serializable lResult = (Serializable) lService.hasAuthorization(serviceObjectID, accessMode);
    // Calculate duration of service call in milliseconds
    String lDuration = Long.toString((System.nanoTime() - lStartTime) / MILLISECONDS);
    // Trace result of service call.
    lTrace.write(MessageConstants.RETURNING_FROM_SERVICE_CALL, this.getCalledServiceMethod(), lDuration);
    return lResult;
  }

  /**
   * Method returns a method object describing the service method that will be called by this command object.
   * 
   * @return {@link Method} Method object describing the called service method. The method never returns null.
   */
  @Override
  public final Method getServiceMethod( ) {
    return SERVICE_METHOD;
  }

  /**
   * Method returns all parameters that will be passed to the service.
   * 
   * @return {@link Object} Object array with all parameters that will be passed to the service. The method may return
   * an empty array in case that the method has no parameters.
   */
  @Override
  public Object[] getParameters( ) {
    return parameters;
  }
}

/**
 * Generated command class for service method "hasAuthorization".
 */
final class HasAuthorization_UseCaseDefinition_AuthorizationService_Command extends Command {
  /**
   * Default serial version uid.
   */
  private static final long serialVersionUID = 1L;

  /**
   * Constant for factor to convert nano seconds to milliseconds.
   */
  private static final int MILLISECONDS = 1000 * 1000;

  /**
   * Constant describes the service method that is called by this proxy class.
   */
  private static final Method SERVICE_METHOD;

  /**
   * Object array with all parameters that are passed to the service.
   */
  private final Object[] parameters;
  /**
   * Initializer is used to get the method object describing the called service method only once.
   */
  static {
    try {
      SERVICE_METHOD = AuthorizationService.class.getMethod("hasAuthorization", UseCaseDefinition.class);
    }
    catch (NoSuchMethodException e) {
      throw new JEAFSystemException(MessageConstants.SERVICE_METHOD_DOES_NOT_EXIST, e,
          AuthorizationService.class.getName(), "hasAuthorization(UseCaseDefinition.class)");
    }
  }

  /**
   * Attribute transports the method parameter "pUseCase" to the service implementation via the service channel.
   */
  private final UseCaseDefinition useCase;

  /**
   * Initialize object. All parameters from method "hasAuthorization" have to be passed as parameters to this command
   * object.
   * 
   * @param pUseCase UseCaseDefinition
   */
  HasAuthorization_UseCaseDefinition_AuthorizationService_Command( UseCaseDefinition pUseCase ) {
    super(AuthorizationService.class);
    useCase = pUseCase;
    parameters = new Object[] { useCase };
  }

  /**
   * Method executes the service call represented by this command object via JEAFs service channel.
   * 
   * @param pTargetService Reference to the service which should be called by this command. The parameter must not be
   * null.
   * @return Serializable Result object of the service call. Due to the fact that all returned objects of remote calls
   * in Java (EJBs e.g.) have to be serializable services always have to return serializable objects no matter if it
   * will be serialized or not. If a service method has no return type (void) then the method returns null. Service
   * methods also may return null as return value.
   */
  @Override
  public Serializable execute( Service pTargetService ) {
    // Execute service call.
    AuthorizationService lService = (AuthorizationService) pTargetService;
    // Trace service call.
    Trace lTrace = XFun.getTrace();
    lTrace.write(MessageConstants.EXECUTING_SERVICE_CALL, this.getCalledServiceMethod());
    long lStartTime = System.nanoTime();
    Serializable lResult = (Serializable) lService.hasAuthorization(useCase);
    // Calculate duration of service call in milliseconds
    String lDuration = Long.toString((System.nanoTime() - lStartTime) / MILLISECONDS);
    // Trace result of service call.
    lTrace.write(MessageConstants.RETURNING_FROM_SERVICE_CALL, this.getCalledServiceMethod(), lDuration);
    return lResult;
  }

  /**
   * Method returns a method object describing the service method that will be called by this command object.
   * 
   * @return {@link Method} Method object describing the called service method. The method never returns null.
   */
  @Override
  public final Method getServiceMethod( ) {
    return SERVICE_METHOD;
  }

  /**
   * Method returns all parameters that will be passed to the service.
   * 
   * @return {@link Object} Object array with all parameters that will be passed to the service. The method may return
   * an empty array in case that the method has no parameters.
   */
  @Override
  public Object[] getParameters( ) {
    return parameters;
  }
}

/**
 * Generated command class for service method "enforceAuthorization".
 */
final class EnforceAuthorization_AuthorizationType_AuthorizationService_Command extends Command {
  /**
   * Default serial version uid.
   */
  private static final long serialVersionUID = 1L;

  /**
   * Constant for factor to convert nano seconds to milliseconds.
   */
  private static final int MILLISECONDS = 1000 * 1000;

  /**
   * Constant describes the service method that is called by this proxy class.
   */
  private static final Method SERVICE_METHOD;

  /**
   * Object array with all parameters that are passed to the service.
   */
  private final Object[] parameters;
  /**
   * Initializer is used to get the method object describing the called service method only once.
   */
  static {
    try {
      SERVICE_METHOD = AuthorizationService.class.getMethod("enforceAuthorization", AuthorizationType.class);
    }
    catch (NoSuchMethodException e) {
      throw new JEAFSystemException(MessageConstants.SERVICE_METHOD_DOES_NOT_EXIST, e,
          AuthorizationService.class.getName(), "enforceAuthorization(AuthorizationType.class)");
    }
  }

  /**
   * Attribute transports the method parameter "pAuthorizationType" to the service implementation via the service
   * channel.
   */
  private final AuthorizationType authorizationType;

  /**
   * Initialize object. All parameters from method "enforceAuthorization" have to be passed as parameters to this
   * command object.
   * 
   * @param pAuthorizationType AuthorizationType
   */
  EnforceAuthorization_AuthorizationType_AuthorizationService_Command( AuthorizationType pAuthorizationType ) {
    super(AuthorizationService.class);
    authorizationType = pAuthorizationType;
    parameters = new Object[] { authorizationType };
  }

  /**
   * Method executes the service call represented by this command object via JEAFs service channel.
   * 
   * @param pTargetService Reference to the service which should be called by this command. The parameter must not be
   * null.
   * @return Serializable Result object of the service call. Due to the fact that all returned objects of remote calls
   * in Java (EJBs e.g.) have to be serializable services always have to return serializable objects no matter if it
   * will be serialized or not. If a service method has no return type (void) then the method returns null. Service
   * methods also may return null as return value.
   */
  @Override
  public Serializable execute( Service pTargetService ) {
    // Execute service call.
    AuthorizationService lService = (AuthorizationService) pTargetService;
    // Trace service call.
    Trace lTrace = XFun.getTrace();
    lTrace.write(MessageConstants.EXECUTING_SERVICE_CALL, this.getCalledServiceMethod());
    long lStartTime = System.nanoTime();
    lService.enforceAuthorization(authorizationType);
    // Calculate duration of service call in milliseconds
    String lDuration = Long.toString((System.nanoTime() - lStartTime) / MILLISECONDS);
    // Trace result of service call.
    lTrace.write(MessageConstants.RETURNING_FROM_SERVICE_CALL, this.getCalledServiceMethod(), lDuration);
    // Method has no return type thus the method returns null.
    return null;
  }

  /**
   * Method returns a method object describing the service method that will be called by this command object.
   * 
   * @return {@link Method} Method object describing the called service method. The method never returns null.
   */
  @Override
  public final Method getServiceMethod( ) {
    return SERVICE_METHOD;
  }

  /**
   * Method returns all parameters that will be passed to the service.
   * 
   * @return {@link Object} Object array with all parameters that will be passed to the service. The method may return
   * an empty array in case that the method has no parameters.
   */
  @Override
  public Object[] getParameters( ) {
    return parameters;
  }
}

/**
 * Generated command class for service method "enforceAuthorization".
 */
final class EnforceAuthorization_ServiceObjectID_ObjectAccessMode_AuthorizationService_Command extends Command {
  /**
   * Default serial version uid.
   */
  private static final long serialVersionUID = 1L;

  /**
   * Constant for factor to convert nano seconds to milliseconds.
   */
  private static final int MILLISECONDS = 1000 * 1000;

  /**
   * Constant describes the service method that is called by this proxy class.
   */
  private static final Method SERVICE_METHOD;

  /**
   * Object array with all parameters that are passed to the service.
   */
  private final Object[] parameters;
  /**
   * Initializer is used to get the method object describing the called service method only once.
   */
  static {
    try {
      SERVICE_METHOD =
          AuthorizationService.class.getMethod("enforceAuthorization", ServiceObjectID.class, ObjectAccessMode.class);
    }
    catch (NoSuchMethodException e) {
      throw new JEAFSystemException(MessageConstants.SERVICE_METHOD_DOES_NOT_EXIST, e,
          AuthorizationService.class.getName(), "enforceAuthorization(ServiceObjectID.class, ObjectAccessMode.class)");
    }
  }

  /**
   * Attribute transports the method parameter "pServiceObjectID" to the service implementation via the service channel.
   */
  private final ServiceObjectID serviceObjectID;

  /**
   * Attribute transports the method parameter "pAccessMode" to the service implementation via the service channel.
   */
  private final ObjectAccessMode accessMode;

  /**
   * Initialize object. All parameters from method "enforceAuthorization" have to be passed as parameters to this
   * command object.
   * 
   * @param pServiceObjectID ServiceObjectID
   * @param pAccessMode ObjectAccessMode
   */
  EnforceAuthorization_ServiceObjectID_ObjectAccessMode_AuthorizationService_Command( ServiceObjectID pServiceObjectID,
      ObjectAccessMode pAccessMode ) {
    super(AuthorizationService.class);
    serviceObjectID = pServiceObjectID;
    accessMode = pAccessMode;
    parameters = new Object[] { serviceObjectID, accessMode };
  }

  /**
   * Method executes the service call represented by this command object via JEAFs service channel.
   * 
   * @param pTargetService Reference to the service which should be called by this command. The parameter must not be
   * null.
   * @return Serializable Result object of the service call. Due to the fact that all returned objects of remote calls
   * in Java (EJBs e.g.) have to be serializable services always have to return serializable objects no matter if it
   * will be serialized or not. If a service method has no return type (void) then the method returns null. Service
   * methods also may return null as return value.
   */
  @Override
  public Serializable execute( Service pTargetService ) {
    // Execute service call.
    AuthorizationService lService = (AuthorizationService) pTargetService;
    // Trace service call.
    Trace lTrace = XFun.getTrace();
    lTrace.write(MessageConstants.EXECUTING_SERVICE_CALL, this.getCalledServiceMethod());
    long lStartTime = System.nanoTime();
    lService.enforceAuthorization(serviceObjectID, accessMode);
    // Calculate duration of service call in milliseconds
    String lDuration = Long.toString((System.nanoTime() - lStartTime) / MILLISECONDS);
    // Trace result of service call.
    lTrace.write(MessageConstants.RETURNING_FROM_SERVICE_CALL, this.getCalledServiceMethod(), lDuration);
    // Method has no return type thus the method returns null.
    return null;
  }

  /**
   * Method returns a method object describing the service method that will be called by this command object.
   * 
   * @return {@link Method} Method object describing the called service method. The method never returns null.
   */
  @Override
  public final Method getServiceMethod( ) {
    return SERVICE_METHOD;
  }

  /**
   * Method returns all parameters that will be passed to the service.
   * 
   * @return {@link Object} Object array with all parameters that will be passed to the service. The method may return
   * an empty array in case that the method has no parameters.
   */
  @Override
  public Object[] getParameters( ) {
    return parameters;
  }
}

/**
 * Generated command class for service method "getObjectAccessPrivilege".
 */
final class GetObjectAccessPrivilege_ServiceObjectID_AuthorizationService_Command extends Command {
  /**
   * Default serial version uid.
   */
  private static final long serialVersionUID = 1L;

  /**
   * Constant for factor to convert nano seconds to milliseconds.
   */
  private static final int MILLISECONDS = 1000 * 1000;

  /**
   * Constant describes the service method that is called by this proxy class.
   */
  private static final Method SERVICE_METHOD;

  /**
   * Object array with all parameters that are passed to the service.
   */
  private final Object[] parameters;
  /**
   * Initializer is used to get the method object describing the called service method only once.
   */
  static {
    try {
      SERVICE_METHOD = AuthorizationService.class.getMethod("getObjectAccessPrivilege", ServiceObjectID.class);
    }
    catch (NoSuchMethodException e) {
      throw new JEAFSystemException(MessageConstants.SERVICE_METHOD_DOES_NOT_EXIST, e,
          AuthorizationService.class.getName(), "getObjectAccessPrivilege(ServiceObjectID.class)");
    }
  }

  /**
   * Attribute transports the method parameter "pServiceObjectID" to the service implementation via the service channel.
   */
  private final ServiceObjectID serviceObjectID;

  /**
   * Initialize object. All parameters from method "getObjectAccessPrivilege" have to be passed as parameters to this
   * command object.
   * 
   * @param pServiceObjectID ServiceObjectID
   */
  GetObjectAccessPrivilege_ServiceObjectID_AuthorizationService_Command( ServiceObjectID pServiceObjectID ) {
    super(AuthorizationService.class);
    serviceObjectID = pServiceObjectID;
    parameters = new Object[] { serviceObjectID };
  }

  /**
   * Method executes the service call represented by this command object via JEAFs service channel.
   * 
   * @param pTargetService Reference to the service which should be called by this command. The parameter must not be
   * null.
   * @return Serializable Result object of the service call. Due to the fact that all returned objects of remote calls
   * in Java (EJBs e.g.) have to be serializable services always have to return serializable objects no matter if it
   * will be serialized or not. If a service method has no return type (void) then the method returns null. Service
   * methods also may return null as return value.
   */
  @Override
  public Serializable execute( Service pTargetService ) {
    // Execute service call.
    AuthorizationService lService = (AuthorizationService) pTargetService;
    // Trace service call.
    Trace lTrace = XFun.getTrace();
    lTrace.write(MessageConstants.EXECUTING_SERVICE_CALL, this.getCalledServiceMethod());
    long lStartTime = System.nanoTime();
    Serializable lResult = (Serializable) lService.getObjectAccessPrivilege(serviceObjectID);
    // Calculate duration of service call in milliseconds
    String lDuration = Long.toString((System.nanoTime() - lStartTime) / MILLISECONDS);
    // Trace result of service call.
    lTrace.write(MessageConstants.RETURNING_FROM_SERVICE_CALL, this.getCalledServiceMethod(), lDuration);
    return lResult;
  }

  /**
   * Method returns a method object describing the service method that will be called by this command object.
   * 
   * @return {@link Method} Method object describing the called service method. The method never returns null.
   */
  @Override
  public final Method getServiceMethod( ) {
    return SERVICE_METHOD;
  }

  /**
   * Method returns all parameters that will be passed to the service.
   * 
   * @return {@link Object} Object array with all parameters that will be passed to the service. The method may return
   * an empty array in case that the method has no parameters.
   */
  @Override
  public Object[] getParameters( ) {
    return parameters;
  }
}

/**
 * Generated command class for service method "getObjectAccessPriviliges".
 */
final class GetObjectAccessPriviliges_ServiceObjectID_AuthorizationService_Command extends Command {
  /**
   * Default serial version uid.
   */
  private static final long serialVersionUID = 1L;

  /**
   * Constant for factor to convert nano seconds to milliseconds.
   */
  private static final int MILLISECONDS = 1000 * 1000;

  /**
   * Constant describes the service method that is called by this proxy class.
   */
  private static final Method SERVICE_METHOD;

  /**
   * Object array with all parameters that are passed to the service.
   */
  private final Object[] parameters;
  /**
   * Initializer is used to get the method object describing the called service method only once.
   */
  static {
    try {
      SERVICE_METHOD = AuthorizationService.class.getMethod("getObjectAccessPriviliges", ServiceObjectID.class);
    }
    catch (NoSuchMethodException e) {
      throw new JEAFSystemException(MessageConstants.SERVICE_METHOD_DOES_NOT_EXIST, e,
          AuthorizationService.class.getName(), "getObjectAccessPriviliges(ServiceObjectID.class)");
    }
  }

  /**
   * Attribute transports the method parameter "pServiceObjectIDs" to the service implementation via the service
   * channel.
   */
  private final ServiceObjectID serviceObjectIDs;

  /**
   * Initialize object. All parameters from method "getObjectAccessPriviliges" have to be passed as parameters to this
   * command object.
   * 
   * @param pServiceObjectIDs ServiceObjectID
   */
  GetObjectAccessPriviliges_ServiceObjectID_AuthorizationService_Command( ServiceObjectID pServiceObjectIDs ) {
    super(AuthorizationService.class);
    serviceObjectIDs = pServiceObjectIDs;
    parameters = new Object[] { serviceObjectIDs };
  }

  /**
   * Method executes the service call represented by this command object via JEAFs service channel.
   * 
   * @param pTargetService Reference to the service which should be called by this command. The parameter must not be
   * null.
   * @return Serializable Result object of the service call. Due to the fact that all returned objects of remote calls
   * in Java (EJBs e.g.) have to be serializable services always have to return serializable objects no matter if it
   * will be serialized or not. If a service method has no return type (void) then the method returns null. Service
   * methods also may return null as return value.
   */
  @Override
  public Serializable execute( Service pTargetService ) {
    // Execute service call.
    AuthorizationService lService = (AuthorizationService) pTargetService;
    // Trace service call.
    Trace lTrace = XFun.getTrace();
    lTrace.write(MessageConstants.EXECUTING_SERVICE_CALL, this.getCalledServiceMethod());
    long lStartTime = System.nanoTime();
    Serializable lResult = (Serializable) lService.getObjectAccessPriviliges(serviceObjectIDs);
    // Calculate duration of service call in milliseconds
    String lDuration = Long.toString((System.nanoTime() - lStartTime) / MILLISECONDS);
    // Trace result of service call.
    lTrace.write(MessageConstants.RETURNING_FROM_SERVICE_CALL, this.getCalledServiceMethod(), lDuration);
    return lResult;
  }

  /**
   * Method returns a method object describing the service method that will be called by this command object.
   * 
   * @return {@link Method} Method object describing the called service method. The method never returns null.
   */
  @Override
  public final Method getServiceMethod( ) {
    return SERVICE_METHOD;
  }

  /**
   * Method returns all parameters that will be passed to the service.
   * 
   * @return {@link Object} Object array with all parameters that will be passed to the service. The method may return
   * an empty array in case that the method has no parameters.
   */
  @Override
  public Object[] getParameters( ) {
    return parameters;
  }
}

/**
 * Generated command class for service method "getAllAuthorizedUseCases".
 */
final class GetAllAuthorizedUseCases_AuthorizationService_Command extends Command {
  /**
   * Default serial version uid.
   */
  private static final long serialVersionUID = 1L;

  /**
   * Constant for factor to convert nano seconds to milliseconds.
   */
  private static final int MILLISECONDS = 1000 * 1000;

  /**
   * Constant describes the service method that is called by this proxy class.
   */
  private static final Method SERVICE_METHOD;

  /**
   * Object array with all parameters that are passed to the service.
   */
  private final Object[] parameters;
  /**
   * Initializer is used to get the method object describing the called service method only once.
   */
  static {
    try {
      SERVICE_METHOD = AuthorizationService.class.getMethod("getAllAuthorizedUseCases");
    }
    catch (NoSuchMethodException e) {
      throw new JEAFSystemException(MessageConstants.SERVICE_METHOD_DOES_NOT_EXIST, e,
          AuthorizationService.class.getName(), "getAllAuthorizedUseCases(null)");
    }
  }

  /**
   * Initialize object. All parameters from method "getAllAuthorizedUseCases" have to be passed as parameters to this
   * command object.
   * 
   * 
   */
  GetAllAuthorizedUseCases_AuthorizationService_Command( ) {
    super(AuthorizationService.class);
    parameters = new Object[] {};
  }

  /**
   * Method executes the service call represented by this command object via JEAFs service channel.
   * 
   * @param pTargetService Reference to the service which should be called by this command. The parameter must not be
   * null.
   * @return Serializable Result object of the service call. Due to the fact that all returned objects of remote calls
   * in Java (EJBs e.g.) have to be serializable services always have to return serializable objects no matter if it
   * will be serialized or not. If a service method has no return type (void) then the method returns null. Service
   * methods also may return null as return value.
   */
  @Override
  public Serializable execute( Service pTargetService ) {
    // Execute service call.
    AuthorizationService lService = (AuthorizationService) pTargetService;
    // Trace service call.
    Trace lTrace = XFun.getTrace();
    lTrace.write(MessageConstants.EXECUTING_SERVICE_CALL, this.getCalledServiceMethod());
    long lStartTime = System.nanoTime();
    Serializable lResult = (Serializable) lService.getAllAuthorizedUseCases();
    // Calculate duration of service call in milliseconds
    String lDuration = Long.toString((System.nanoTime() - lStartTime) / MILLISECONDS);
    // Trace result of service call.
    lTrace.write(MessageConstants.RETURNING_FROM_SERVICE_CALL, this.getCalledServiceMethod(), lDuration);
    return lResult;
  }

  /**
   * Method returns a method object describing the service method that will be called by this command object.
   * 
   * @return {@link Method} Method object describing the called service method. The method never returns null.
   */
  @Override
  public final Method getServiceMethod( ) {
    return SERVICE_METHOD;
  }

  /**
   * Method returns all parameters that will be passed to the service.
   * 
   * @return {@link Object} Object array with all parameters that will be passed to the service. The method may return
   * an empty array in case that the method has no parameters.
   */
  @Override
  public Object[] getParameters( ) {
    return parameters;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy