&ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
&ANALYZE-RESUME
{adecomm/appserv.i}
DEFINE VARIABLE h_Astra                    AS HANDLE          NO-UNDO.
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Check Version Notes Wizard" DataLogicProcedure _INLINE
/* Actions: af/cod/aftemwizcw.w ? ? ? ? */
/* MIP Update Version Notes Wizard
Check object version notes.
af/cod/aftemwizpw.w
*/
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Update-Object-Version" DataLogicProcedure _INLINE
/* Actions: ? ? ? ? af/sup/afverxftrp.p */
/* This has to go above the definitions sections, as that is what it modifies.
   If its not, then the definitions section will have been saved before the
   XFTR code kicks in and changes it */
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Definition Comments Wizard" DataLogicProcedure _INLINE
/* Actions: ? af/cod/aftemwizcw.w ? ? ? */
/* Program Definition Comment Block Wizard
Welcome to the Program Definition Comment Block Wizard. Press Next to proceed.
af/cod/aftemwizpw.w
*/
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS DataLogicProcedure 
/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation ("PSC"),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the "License"); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an "AS IS"*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors:                                                      *
*                                                                    *
*********************************************************************/
/*---------------------------------------------------------------------------------
  File: rycoilog3p.p

  Description:  SDO Logic for ryc_object_instance

  Purpose:      A procedure library (PLIP) to support the maintenance of the ryc_object_instance table
                The following internal procedures may be added or modified
                to act as validation to creation, modification, or deletion of
                records in the database table
                
                Client-side:
                rowObjectValidate***
                
                Server-side upon create:
                createPreTransValidate***
                createBeginTransValidate
                createEndTransValidate
                createPostTransValidate
                
                Server-side upon write (create and modify):
                writePreTransValidate***
                writeBeginTransValidate
                writeEndTransValidate
                writePostTransValidate
                
                Server-side upon delete:
                deletePreTransValidate
                deleteBeginTransValidate
                deleteEndTransValidate
                deletePostTransValidate
                
                *** The rowObjectValidate, createPreTransValidate and writePreTransValidate
                internal procedures are automatically generated by the SDO generator

  Parameters:

  History:
  --------
  (v:010000)    Task:    90000033   UserRef:    POSSE
                Date:   20/04/2001  Author:     Phil Magnay

  Update Notes: Data Logic Procedure Auto-Generation

  (v:010001)    Task:    90000119   UserRef:    posse
                Date:   06/05/2001  Author:     Haavard Danielsen

  Update Notes: Point to src/adm2/logic.i

  (v:010002)    Task:   101000062   UserRef:    
                Date:   09/29/2001  Author:     Peter Judge

  Update Notes: Attributes cannot be added to more than one Object Instance in Repository Object Control

  (v:010003)    Task:           0   UserRef:    
                Date:   11/06/2001  Author:     Mark Davies (MIP)

  Update Notes: Clear ttAttributeValue table before creating new records. Causes duplicate values to be created.

  (v:010004)    Task:           0   UserRef:    
                Date:   11/06/2001  Author:     Mark Davies (MIP)

  Update Notes: Fixed issue #4108 - Triple attributes adding field in Rep Obj Maintenance

  (v:010005)    Task:           0   UserRef:    
                Date:   05/14/2002  Author:     Mark Davies (MIP)

  Update Notes: Remove reference to removed field collect_attribute_value_obj (Delta9)

-----------------------------------------------------------------------------*/
/*                   This .W file was created with the Progress UIB.             */
/*-------------------------------------------------------------------------------*/

/* ***************************  Definitions  ************************** */
/* MIP-GET-OBJECT-VERSION pre-processors
   The following pre-processors are maintained automatically when the object is
   saved. They pull the object and version from Roundtable if possible so that it
   can be displayed in the about window of the container */

&scop object-name       rycoilog3p.p
DEFINE VARIABLE lv_this_object_name AS CHARACTER INITIAL "{&object-name}":U NO-UNDO.
&scop object-version    000000

/* Astra object identifying preprocessor */
&glob   AstraPlip    yes

DEFINE VARIABLE cObjectName         AS CHARACTER NO-UNDO.

ASSIGN cObjectName = "{&object-name}":U.

&scop   mip-notify-user-on-plip-close   NO


/* Data Preprocessor Definitions */
&GLOB DATA-LOGIC-TABLE ryc_object_instance
&GLOB DATA-FIELD-DEFS  "ry/obj/rycoiful3o.i"

/* Error handling definitions */
{af/sup2/afcheckerr.i &define-only = YES}
{af/sup2/afrun2.i &define-only = YES}

DEFINE TEMP-TABLE ttRycAttributeValue RCODE-INFORMATION /* Defined same as RowobjUpd temp table */
    {ry/obj/rycavful4o.i}
    {src/adm2/rupdflds.i}.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


&ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK 

/* ********************  Preprocessor Definitions  ******************** */

&Scoped-define PROCEDURE-TYPE DataLogicProcedure
&Scoped-define DB-AWARE yes


/* Db-Required definitions. */
&IF DEFINED(DB-REQUIRED) = 0 &THEN
    &GLOBAL-DEFINE DB-REQUIRED TRUE
&ENDIF
&GLOBAL-DEFINE DB-REQUIRED-START   &IF {&DB-REQUIRED} &THEN
&GLOBAL-DEFINE DB-REQUIRED-END     &ENDIF





/* _UIB-PREPROCESSOR-BLOCK-END */
&ANALYZE-RESUME


/* ************************  Function Prototypes ********************** */

{&DB-REQUIRED-START}

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD getSDOLevel DataLogicProcedure  _DB-REQUIRED
FUNCTION getSDOLevel RETURNS CHARACTER
  ( /* parameter-definitions */ )  FORWARD.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

{&DB-REQUIRED-END}


/* *********************** Procedure Settings ************************ */

&ANALYZE-SUSPEND _PROCEDURE-SETTINGS
/* Settings for THIS-PROCEDURE
   Type: DataLogicProcedure
   Allow: 
   Frames: 0
   Add Fields to: Neither
   Other Settings: CODE-ONLY COMPILE APPSERVER DB-AWARE
 */
&ANALYZE-RESUME _END-PROCEDURE-SETTINGS

/* *************************  Create Window  ************************** */

&ANALYZE-SUSPEND _CREATE-WINDOW
/* DESIGN Window definition (used by the UIB) 
  CREATE WINDOW DataLogicProcedure ASSIGN
         HEIGHT             = 14.38
         WIDTH              = 55.6.
/* END WINDOW DEFINITION */
                                                                        */
&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB DataLogicProcedure 
/* ************************* Included-Libraries *********************** */

{src/adm2/logic.i}

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


 


&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK DataLogicProcedure 


/* ***************************  Main Block  ******************************* */

{ry/app/ryplipmain.i}

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


/* **********************  Internal Procedures  *********************** */

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE killPlip DataLogicProcedure 
PROCEDURE killPlip :
/*------------------------------------------------------------------------------
  Purpose:     entry point to instantly kill the plip if it should get lost in memory
  Parameters:  <none>
  Notes:       
------------------------------------------------------------------------------*/

  {ry/app/ryplipkill.i}

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE objectDescription DataLogicProcedure 
PROCEDURE objectDescription :
/*------------------------------------------------------------------------------
  Purpose:     Pass out a description of the PLIP, used in Plip temp-table
  Parameters:  <none>
  Notes:       This should be changed manually for each plip
------------------------------------------------------------------------------*/

  DEFINE OUTPUT PARAMETER cDescription AS CHARACTER NO-UNDO.

  ASSIGN cDescription = "Astra 2 ryc_object_instance Data Logic Procedure".

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE plipSetup DataLogicProcedure 
PROCEDURE plipSetup :
/*------------------------------------------------------------------------------
  Purpose:    Run by main-block of PLIP at startup of PLIP
  Parameters: <none>
  Notes:       
------------------------------------------------------------------------------*/

  {ry/app/ryplipsetu.i}  

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE plipShutdown DataLogicProcedure 
PROCEDURE plipShutdown :
/*------------------------------------------------------------------------------
  Purpose:     This procedure will be run just before the calling program 
               terminates
  Parameters:  <none>
  Notes:       
------------------------------------------------------------------------------*/

  {ry/app/ryplipshut.i}

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rowObjectValidate DataLogicProcedure 
PROCEDURE rowObjectValidate :
/*------------------------------------------------------------------------------
  Purpose:     Procedure used to validate RowObject record client-side
  Parameters:  <none>
  Notes:       
------------------------------------------------------------------------------*/

  DEFINE VARIABLE cMessageList    AS CHARACTER    NO-UNDO.
  DEFINE VARIABLE cValueList      AS CHARACTER    NO-UNDO.
  DEFINE VARIABLE cDataTarget     AS CHARACTER    NO-UNDO.
  DEFINE VARIABLE hDataTarget     AS HANDLE       NO-UNDO.
  DEFINE VARIABLE iLoop           AS INTEGER      NO-UNDO.
  DEFINE VARIABLE hAsHandle       AS HANDLE       NO-UNDO.

  IF b_ryc_object_instance.smartobject_obj = 0 OR b_ryc_object_instance.smartobject_obj = ? THEN
    ASSIGN
      cMessageList = cMessageList + (IF NUM-ENTRIES(cMessageList,CHR(3)) > 0 THEN CHR(3) ELSE '':U) + 
                    {af/sup2/aferrortxt.i 'AF' '1' 'ryc_object_instance' 'smartobject_obj' "'SmartObject Obj'"}.

  IF b_ryc_object_instance.container_smartobject_obj = 0 OR b_ryc_object_instance.container_smartobject_obj = ? THEN
    ASSIGN
      cMessageList = cMessageList + (IF NUM-ENTRIES(cMessageList,CHR(3)) > 0 THEN CHR(3) ELSE '':U) + 
                    {af/sup2/aferrortxt.i 'AF' '1' 'ryc_object_instance' 'container_smartobject_obj' "'Container SmartObject Obj'"}.

  ERROR-STATUS:ERROR = NO.
  RETURN cMessageList.

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

{&DB-REQUIRED-START}

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE writePreTransValidate DataLogicProcedure  _DB-REQUIRED
PROCEDURE writePreTransValidate :
/*------------------------------------------------------------------------------
  Purpose:     Procedure used to validate records server-side before the transaction 
               scope upon write
  Parameters:  <none>
  Notes:       
------------------------------------------------------------------------------*/

  DEFINE VARIABLE cMessageList    AS CHARACTER    NO-UNDO.
  DEFINE VARIABLE cValueList      AS CHARACTER    NO-UNDO.

  DEFINE BUFFER bgsc_object_type      FOR gsc_object_type.
  DEFINE BUFFER b2ryc_object_instance FOR ryc_object_instance.
  DEFINE BUFFER bryc_smartobject      FOR ryc_smartobject.

  /* First check that we do not allow duplicate instances of DataFields on an object */
  IF b_ryc_object_instance.rowMod = "A":U 
  OR b_ryc_object_instance.rowMod = "C":U
  THEN DO:
      FIND FIRST bryc_smartobject
           WHERE bryc_smartobject.smartobject_obj = b_ryc_object_instance.smartobject_obj
           NO-LOCK NO-ERROR.
      IF AVAILABLE bryc_smartobject THEN DO:
          ASSIGN cValueList = bryc_smartobject.object_filename.
          FIND FIRST bgsc_object_type
               WHERE bgsc_object_type.object_type_obj = bryc_smartobject.object_type_obj
               NO-LOCK NO-ERROR.
      END.
      ELSE
          cValueList = "specified".
    
    IF  AVAILABLE bgsc_object_type 
    AND bgsc_object_type.object_type_code = "DataField":U 
    AND CAN-FIND(FIRST b2ryc_object_instance
                 WHERE b2ryc_object_instance.container_smartobject_obj = b_ryc_object_instance.container_smartobject_obj
                   AND b2ryc_object_instance.smartobject_obj           = b_ryc_object_instance.smartobject_obj) THEN
            ASSIGN cMessageList = cMessageList + (IF NUM-ENTRIES(cMessageList,CHR(3)) > 0 THEN CHR(3) ELSE '':U) 
                                + {af/sup2/aferrortxt.i 'AF' '8' 'ryc_object_instance' 'smartobject_obj' "'Smart Data Field - '" "cValueList"}.
  END.

  ERROR-STATUS:ERROR = NO.
  RETURN cMessageList.

END PROCEDURE.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

{&DB-REQUIRED-END}

/* ************************  Function Implementations ***************** */

{&DB-REQUIRED-START}

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION getSDOLevel DataLogicProcedure  _DB-REQUIRED
FUNCTION getSDOLevel RETURNS CHARACTER
  ( /* parameter-definitions */ ) :
/*------------------------------------------------------------------------------
  Purpose:  
    Notes:  
------------------------------------------------------------------------------*/

  RETURN "SmartObject".   /* Function return value. */

END FUNCTION.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME

{&DB-REQUIRED-END}

