vpm programming - tripod.comcjmyun.tripod.com/knowledgebase/vpm_dbtablestruct… · ·...
TRANSCRIPT
Appendixes
Exercises
Foils
Version 1 Release 2October 1999FOR-E-APVPP-02-AL
ENOVIAVPM Training
Solutions
VPM Programming
VPM Programming
Copyright DASSAULT SYSTEMES 1999 i-2 Menu
Copyright DASSAULT SYSTEMES 1999
ALL RIGHTS RESERVED
No part of this publication may be marked, reproduced, translated, stored in aretrieval system or transmitted, in any form or by any means, including electronic,mechanical, photocopying, recording or otherwise, without the express prior writtenpermission of DASSAULT SYSTEMES.
Specifically, this training material is provided for your internal training requirementsonly and shall not be used to train any third party in the use and operation of oursoftware.
DO NOT
COPY
Copyright DASSAULT SYSTEMES 1999 i-3 Menu
VPM Programming
Table of Contents
Appendix 1 - DB2 Main Instructions .................................................................... 9 Appendix 2 - Oracle Main Instructions ............................................................... 11 Appendix 3 - DB table structure .......................................................................... 13 Appendix 4 - Environment Table Administration ............................................... 59 Appendix 5 - C++ Reminder ............................................................................... 63 Appendix 6 - Headers .......................................................................................... 67
Copyright DASSAULT SYSTEMES 1999 i-4 Menu
VPM Programming
VPM Programming
Copyright DASSAULT SYSTEMES 1999 i-5 Menu
Preface
Course objectives
At the end of theVPM Programming course, participants will be capable of managing VPMpossibilities for customization:
Consequently, the user will be able to:
❑ Understand the data structure in the data base
❑ Implement the User Exit provided to customize the functionalities of:the BOM productthe AFL productthe P&O productthe CFG productthe STEP product
❑ Create Data Base triggers
❑ Create new tools or methods to the PSN or VPMA, using the API for Configuration or forDatabase Access.
Prerequisites
To take full advantage of this instruction, participants are expected to be familiar with UNIXcommands and text editors, C++ programmation, VPM user functionalities and VPMAdministration course.
Training materials delivered
Each participant will receive four documents:
❑ The ‘Foils’ document used by the trainer during the lecture
❑ The ‘Appendix’ document in order to get additional information on specific domains
❑ The ‘Exercises’ document used for hands-on
❑ The ‘Solutions’ document that contains the solution for the exercises.
CATIA-related publications
❑ VPM Administration User’s Guide
❑ Reference documentation
Moreover, VPM online documentation can be accessed by selecting the item Main, Contents orIndex in the Help menu in VPMA.
VPM Programming
Copyright DASSAULT SYSTEMES 1999 i-6 Menu
Course schedule
VPM Programmation training is a5-day course. Each half-day comprises :
❑ a theoretical talk with foils
❑ exercises allowing the participants to apply the concepts covered in the lesson.
Morning Afternoon
Day 1 • Chapter 1: IntroductionExercise 1: CDM profile customization• Chapter 2: User Exit Miscellaneous• Chapter 3: User Exit - Action Flow
Exercise 2: AFL customization• Chapter 4: User Exit - BOMExercise 3: Browsing Data Structure
Day 2 • Chapter 4: User Exit - BOMExercise 4: BOM Object CreationCustomization• Chapter 4: User Exit - BOM
Exercise 5: Data Base Access• Chapter 5: Version - RevisionExercise 6: Version - RevisionCustomization
Day 3 • Chapter 6: User Exit - InterfaceExercise 7: Interface Customization• Chapter 7: User Exit - Configuration
Exercise 8: Configuration API• Chapter 8: User Exit - P&OExercise 9: User Exit P&O
Day 4 Exercise 9: User Exit P&O• Chapter 9: User Exit - DMUSLFExercise 10: DMUSLF
• Chapter 10: User Exit - STEPExercise 11: STEP Customization
Day 5 • Chapter 11: TriggersExercise 12: SQL Trigger
Question / Answer session
VPM Programming
Copyright DASSAULT SYSTEMES 1999 i-7 Menu
Reader’s Comments
We would very much appreciate your comments on this guide. Please specify the pages andlines to which they apply. All comments (concerning the general presentation, terminology,step-by-step procedures, examples, methodology and / or your overall evaluation, etc.) will becarefully examined by the authors of this documentation.
Please send your comments including your name and address to:
DASSAULT SYSTEMESTraining DepartmentCSM / STT9, quai Marcel Dassault92156 SURESNES Cedex (FRANCE)
Fax: (33-1) 40.99.43.76
VPM Programming
Copyright DASSAULT SYSTEMES 1999 i-8 Menu
Copyright DASSAULT SYSTEMES 1999 1-9 Menu
VPM Programming
Appendix 1 - DB2 Main Instructions
Listing Objects
❑ Log into DB2 db2
❑ List database(s) list db directory
❑ Enter into a database connect to DataBaseName
❑ Tables in the database select * from sysibm.systableslist tables for all
❑ Tables belonging to ownerVPMENVlist tables for schemaVPMENV
❑ Table structure select * fromowner.tabledescribe tableowner.table
❑ Objects in the table select ‘attribute list’ fromowner.tablewhere ‘Query’
Creating Objects
❑ Database creation create dbDBName onTableSpacePath
❑ Table creationcreate tableowner.table (AttributeName AttributeTypeNOT NULL)
❑ View creationcreate viewowner.view as selectAttibuteList from owner.tablewhere ‘Query’
❑ Index creationcreate unique indexowner.index onowner.table (AttributeList)
❑ Creation of a new columnalter tableowner.table addAttributeName attribute_type
❑ Insertion of a new row in a tableinsert into owner.table (AttributeList) values (ValueList)
Copyright DASSAULT SYSTEMES 1999 1-10 Menu
VPM Programming
Updating Objects
❑ Update an object updateowner.table setAttributeName = Valuewhere ‘Query’
Note : The Statement without query is applied for all the objects in the table.
Deleting Objects
❑ Deleting a db drop dbDataBaseName
❑ Deleting a table drop tableowner.table
❑ Deleting a view drop viewowner.table
❑ Deleting an index drop indexowner.index
❑ Deleting a row in a table delete fromowner.tablewhere ‘Query’
Copyright DASSAULT SYSTEMES 1999 1-11 Menu
VPM Programming
Appendix 2 - Oracle Main Instructions
Listing Objects
❑ Log into Oracle sqlplus user/pwd (system/manager)
❑ Tables in the database select table_name from all_tables;
❑ Tables belonging to owner VPMENVselect table_name from all_tables where owner=’VPMENV’;
❑ List of users created: select username from all_users;
❑ Table structure descowner.table;
❑ Objects in the tableselect ‘attribute list’ from owner.tablewhere ‘Query’ ;
Note : Each attribute containing $ must be between double-quote.
Creating Objects
❑ Table creationcreate tableowner.table (AttributeName AttributeTypeNOT NULL);
❑ View creationcreate viewowner.view as selectAttibuteList from owner.tablewhere ‘Query’;
❑ Index creationcreate unique indexowner.index onowner.table (AttributeList);
❑ Creation of a new columnalter tableowner.table addAttributeName attribute_type;
❑ Insertion of a new row in a tableinsert intoowner.table (AttributeList) values (ValueList);
Updating Objects
❑ Update an object updateowner.table setAtttibuteName = valuewhere ‘Query’;
Note : The Statement without query is applied for all the objects in the table.
Copyright DASSAULT SYSTEMES 1999 1-12 Menu
VPM Programming
Deleting Objects
❑ Deleting a table drop tableowner.table;
❑ Deleting a view drop viewowner.table;
❑ Deleting an index drop indexowner.index;
❑ Deleting a row in a table delete fromowner.tablewhere ‘Query’ ;
Copyright DASSAULT SYSTEMES 1999 1-13 Menu
VPM Programming
Appendix 3 - DB table structure
Note to the reader:
The information provided in this document is validated for VPM 1.0 R1 PTF 6Changes to the data model, programming interfaces or other product data may be required toimplement enhancements, new functions or to correct problems. These may causeunpredictable results in user programming.
Note : In every following table description, the Type name CHARACTER* means RAW for ORACLE data baseand CHAR for DB2 data base
Copyright DASSAULT SYSTEMES 1999 1-14 Menu
VPM Programming
The main tables for the following modules are:
❑ BOM (owner: Environment)
PART_LIST
CATIA_MODEL
DOCUMENT
$EXT
$EXT_LF
LF00001
$LOCK
BOUNDING_BOX
CLASH
PART_PTR
ZONE
❑ Architecture
CDM.$COROUTINES
CDM.MACRO_LIST
PROFILE.PROFILE_USER
CATIA.CONAME
CATIA.PROJECT
CATIA.PRODUCT
❑ Publish-Subscribe (owner: Administrator)
EVENTS
EXP_SUBSCRIBE
PUBLISHED_EVENTS
❑ People & Organisation (owner: Administrator)
organization_
person_
role_
Copyright DASSAULT SYSTEMES 1999 1-15 Menu
VPM Programming
❑ Security (owner: Administrator)
role_
person_
access_object_
data_group_
process_
❑ Configuration (owner: Administrator)
configuration0001_
effectivity_
configuration0002_
EFFTYPE_FOR_PART_
MODIF_STATUS_ not used
PART_EFFLINK_
❑ Action (owner: Administrator)
Action_
application_ not used
Category_ not used
Config_ not used
data_item_ not used
driver_ not used
DicoEntity_ not used
Document_ not used
EFF_FOR_PART_ not used
filter_unit_
Part_ not used
PLANNED_EFF_
Rep_ not used
site_ not used
RDB_DOCUMENT
Copyright DASSAULT SYSTEMES 1999 1-16 Menu
VPM Programming
❑ PART_LIST (Attributes describing the part)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER** Identifier of a part ( Complex object id )
$COMPID CHARACTER** 00000000 for a part
S_......... ..............; Specific company attributes for the
signature of a part
STATUS CHARACTER** Other company attributes for description
PART_DESCRIPTION CHARACTER** Other company attributes for description
C_PART_VERSION CHARACTER** Version mechanism attribute
C_MATURITY CHARACTER** Maturity management attribute
D_TOOL CHARACTER* not used
D_PARM CHARACTER* not used
C_RESPONSIBLE CHARACTER* Owner of the part
C_ORG_RESPONSIBLE CHARACTER* Organization to which the part belongs
C_CREATE TIMESTAMP Creation date of the part
C_CREATE_USER CHARACTER* User used to create the part
C_LASTMOD TIMESTAMP Last modification date
C_LASTMOD_USER CHARACTER* User used to modify the part
C_VERSION INTEGER Number of times that the part has
been overwritten
Copyright DASSAULT SYSTEMES 1999 1-17 Menu
VPM Programming
❑ CATIA_MODEL (Attributes describing the model)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Complex object identifier equal to the part $COID
$COMPID CHARACTER* Component identifier of the model
S_......... ................. Specific company attributes for signature of a model
MODEL_DESCRIPTION CHARACTER* Other company attributes for description
STATUS CHARACTER* Other company attributes for description
C_REVISION CHARACTER* Revision mechanism attribute
C_MATURITY CHARACTER* Maturity management attribute
D_TOOL CHARACTER* not used
D_PARM CHARACTER* not used
C_RESPONSIBLE CHARACTER* Owner of the model
C_ORG_RESPONSIBLE CHARACTER* Organization to which the model belongs
C_CREATE TIMESTAMP Creation date of the model
C_CREATE_USER CHARACTER* User used to create the model
C_LASTMOD TIMESTAMP Last modification date
C_LASTMOD_USER CHARACTER* User used to modify the model
C_VERSION INTEGER Number of times that the model has been overwritten
C_COMPID_DATA CHARACTER* $COMPID value of $EXT_LF table for the model
C_INTFORM SMALLINT equal to 1
C_COMPNAME_DATA VARCHAR Table name containing the link to the repository(always EXT_LF)
C_SOFT_VER VARCHAR Version of CDM, which last modified the table (416)
C_NICKNAME VARCHAR equal to the model name, will be displayed on CATIA
C_XMIN , C_XMAX ..... DOUBLE Volume of the model is defined as engineering model
C_SIZE DOUBLE storage of the model size
C_LAST_REPOSITORY VARCHAR Repository where the model is stored
Copyright DASSAULT SYSTEMES 1999 1-18 Menu
VPM Programming
❑ DOCUMENT (Attributes describing the document)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Complex object identifier equal to the part $COID
$COMPID CHARACTER* Component identifier of the model
S_......... ................. Specific company attributes for signature of a document
NOTES VARCHAR not used
C_REVISION CHARACTER* Revision mechanism attribute
C_MATURITY CHARACTER* Maturity management attribute
D_TOOL CHARACTER* Define the tool used to open the document
D_PARM CHARACTER* Tools parameter if required
D_PATH CHARACTER* Directory where the document is stored if not in DB
C_RESPONSIBLE CHARACTER* Owner of the document
C_ORG_RESPONSIBLE CHARACTER* Organization to which the document belongs
C_CREATE TIMESTAMP Creation date of the document
C_CREATE_USER CHARACTER* User used to create the document
C_LASTMOD TIMESTAMP Last modification date
C_LASTMOD_USER CHARACTER* User used to modify the document
C_VERSION INTEGER Number of times that the document has
been overwritten
C_COMPID_DATA CHARACTER* $COMPID value of $EXT_LF table for
the document
C_COMPNAME_DATA VARCHAR Table name containing the link to the repository(always EXT_LF)
C_SOFT_VER VARCHAR Version of CDM, which last modified the table (416)
C_LAST_REPOSITORY VARCHAR Repository where the document is stored
C_INTFORM SMALLINT Referenced for futur use
Copyright DASSAULT SYSTEMES 1999 1-19 Menu
VPM Programming
❑ $EXT (Table managing the links between objects)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Complex object identifier equal to the part $COID
$COMPID CHARACTER* Component identifier of the object
$SITE CHARACTER* database Id if parent and child are in different DB
$CONAME VARCHAR PART_LIST table name for the child
$COMPNAME VARCHAR Representation table name for the child
$COID_REF CHARACTER* $COID of the child
$COMPID_REF CHARACTER* $COMPID of the child
$COMPID_FATHER CHARACTER* $COMPID of the father
$COMPNAME_FATHER VARCHAR Representation table name for the father
$TYPE CHARACTER* Relation type between parent and child
C_RESPONSIBLE CHARACTER* Owner of the link
C_ORG_RESPONSIBLE CHARACTER* Organization responsible for this link
C_VERSION INTEGER Number of times the link has been overwritten
DISCI_COID CHARACTER* $COID of a discipline (CDM used only)
DISCI_COMPID CHARACTER* $COMPID of a discipline (CDM used only)
C_LASTMOD TIMESTAMP Last modification date
C_MML_TS TIMESTAMP Timestamp of the last MML synchronization
CATMML_STATUS CHARACTER* Status on the MML links : UPD, ...
EXPORT_ID CHARACTER* ‘Name’ field on the link
$USER1 VARCHAR Positioning matrix for assembly link and
NEW_MATRIX false
XMIN, XMAX...... DOUBLE Volume constituted of the set of child volumes
C_MAT01, C_MAT02........ DOUBLE Positioning matrix for assembly link andNEW_MATRIX true
Copyright DASSAULT SYSTEMES 1999 1-20 Menu
VPM Programming
❑ $EXT_LF (Table managing the links between an object and its repository)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Complex object identifier equal to the part $COID
$COMPID CHARACTER* Component identifier of the object
$TYPE CHARACTER* Reserved for futur used
$COMPID_FATHER CHARACTER* $COMPID of the object (model or document)
$CUR_ACC_MET CHARACTER* Access Method used
$CUR_ACC_MET_DATA VARCHAR Directory or table in which the repository is stored
Note:
$CUR_ACC_MET :
- DBLFCDM : repository stored inside the database using BLOB format
- DBLFAIX : repository stored in unix directory using BLOB format
- DBLFCAT : repository store in unix directory using CATIA model format
$CUR_ACC_MET_DATA is equal to :
Repository table name followed by the $coid$compid of the object within the repository table for DBLFCDM accessmethod. For instance :VPMENV.LF00001 $COID$COMPID
Repository information defined in the REPOSITORY field of the insert panel for DBLFAIX access method. Forinstance : BIN PATH /tmp/xxxxxx
Repository directory in case of DBLFCAT
❑ LF00001 (table to manage longfields within the database)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Complex object identifier equal to the part $COID
$COMPID CHARACTER* Component identifier of the object
$RECNO INTEGER Record number
$SEQNO INTEGER Sequence number
$DATA LONG VARCHAR Repository BLOB
Copyright DASSAULT SYSTEMES 1999 1-21 Menu
VPM Programming
❑ $LOCK (table to manage locks on objects)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Complex object identifier equal to the part $COID
$COMPID CHARACTER* Component identifier of the object
$LOCKTYPE CHARACTER* Type of locks put on the object
$COMPREF CHARACTER* $COMPID of the object to be locked
C_COMPNAME VARCHAR Representation table name of the locked object
C_RESPONSIBLE CHARACTER* Owner of the lock
C_ORG_RESPONSIBLE CHARACTER* Organization of the owner of the lock
C_CREATE TIMESTAMP Timestamp of creation of the lock
DURATION VARCHAR Duration, after which the lock should be removed
COMMENTS VARCHAR Comments on the lock
❑ BOUNDING_BOX (table used to manage volumes and spacemap)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Complex object identifier equal to the part $COID
$COMPID CHARACTER* Component identifier of the object equals to:
CSB^ENC^ : for a volume
$COMPID of the model for a spacemap
REF_XMIN, REF_XMAX.... DOUBLE Part volume within an assembly
ASS_XMIN, ASS_XMAX..... DOUBLE Sub-assembly volume
TYPE CHARACTER* P : for part / M : for model / ^ : no spacemap
VALID CHARACTER* V or ^
$DATA LONG VARCHAR Spacemap meshing data
Note : ^ stands for space CHARACTER*
❑ CLASH (table used to manage the clashes storage)
Copyright DASSAULT SYSTEMES 1999 1-22 Menu
VPM Programming
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Complex object identifier equal to the part $COID
$COMPID CHARACTER* Component identifier of the object
S_TYPEOFCALC INTEGER Type of computation, 3 availaible values:
clash,clash+contact, clash+contact+clearance
S_CLEARANCEVALUE DOUBLE clearance values used for the computation
TYPEOFRESULT INTEGER type of result (clash / clearance)
MINIMALDISTANCE DOUBLE Minimal distance taken into account
INSTANCE_1_COMPID CHARACTER* COMPID of clashed instances in the
INSTANCE_2_COMPID CHARACTER* PART_PTR table
STATUS INTEGER current tatus of the clashes
COMMENTITF CHARACTER* comments
C_RESPONSIBLE CHARACTER* Owner of the clash
C_ORG_RESPONSIBLE CHARACTER* Organisation of the owner
C_LASTMOD TIMESTAMP clash written date
❑ PART_PTR (Instances table)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* COID of the root part
$COMPID CHARACTER* COMPID of the instance
NAME VARCHAR instance name
NB_LINK INTEGER number of links to reach the instance from the root
OID CHARACTER* path between the root and the instance
❑ ZONE (table used to manage predefined volume attached to a product)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Complex object identifier equal to the part $COID
$COMPID CHARACTER* Component identifier of the object
S_ZONE_NAME CHARACTER* Name of the zone
XMIN, XMAX.......... DOUBLE Volume defined for a zone
❑ CDM.$COROUTINES (table in which all BOM objects must be declared)
Copyright DASSAULT SYSTEMES 1999 1-23 Menu
VPM Programming
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Complex object identifier (equals to the
environment name of the object to be declared)
$COMPID CHARACTER* Component identifier
$CREATOR CHARACTER* Object owner, equals to the environment name
$OBJ VARCHAR Table or view to be declared or on which thetrigger will be launched
$COR_NAME VARCHAR see the following note
$PARM VARCHAR see the following note
$COND CHARACTER* Trigger condition ( Insert, Delete, Update, Select)
‘$’ for table declaration
$PRIORITY SMALLINT Priority
$WHEN CHARACTER* When Trigger must be launched ( After,Before)
$PGMNAME CHARACTER* Name of the trigger program (source file, not module)
$ATTRIBUTES VARCHAR Name of attributes on which modification launchs trigger
$EDBS_FLAG CHARACTER* = Y ( Trigger component ) / N otherwise
Note: $COR_NAME
- To declare a PART_LIST:
ROOT : required when creating a new complex object ( PART_LIST )
CO_COMPONENT: an object is declared as component of a complex object
VCO_ALL_COMPONENT: This specific view must be defined for each new object
- To declare an object within the complex object (CATIA_MODEL, DOCUMENT):
CO_COMPONENT: an object is declared as component of a complex object
VCO_ALL_COMPONENT: This specific view must be defined for each new object
- For another view on an object, This declaration must be added:
VCO_COMPONENT: Used to declare a view on an object
- For $EXT_LF table:
LF_RELATION: define the relation object within the complex object
- For a trigger: Comment
Note: $PARM
- ENVNAME.PART_LIST for CO_COMPONENT
- ENVNAME.$OBJ for VCO_ALL_COMPONENT
- ENVNAME.TABLE_NAME for VCO_COMPONENT ( in this case OBJ is different from the table name)
- ENVNAME.$EXT_LF for LF_RELATION
- * for ROOT
- Parameters for trigger
Copyright DASSAULT SYSTEMES 1999 1-24 Menu
VPM Programming
❑ CDM.MACRO_LIST (table in which all the BOM profiles (aka CDMA profile) arestored)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Identifier of the profile
$COMPID CHARACTER* ‘00000000’ for a profile
MACRO_NAME VARCHAR Profile name
SEQNO SMALLINT Sequence number of the line of text
MACRO_TEXT VARCHAR Profile text
❑ PROFILE.PROFILE_USER (table used when declaring a profile in P&O)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Identification of the profile
$COMPID CHARACTER* Same
USER_NAME CHARACTER* Reserved for VPM
ENV CHARACTER* Name of the environment for the profile
MACRO_NAME VARCHAR Name of the environment for the profile_LIST
❑ CATIA.CONAME (table managing every available environment )
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* $COID of the project
$COMPID CHARACTER* Environment name
S_CONAME VARCHAR Root complex object name (ENVNAME.PART_LIST)
❑ CATIA.PROJECT (table in which everyproject are defined)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Identification of the project
$COMPID CHARACTER* 00000000 for a project
S_PROJECT VARCHAR Name of the project
Copyright DASSAULT SYSTEMES 1999 1-25 Menu
VPM Programming
❑ CATIA.PRODUCT (table used to store CSB product)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
$COID CHARACTER* Product id
$COMPID CHARACTER* Component identifier of the object
S_COID_REF CHARACTER* COID of the product part
S_ENV_REF CHARACTER* Name of the referenced environment
S_TABLE_REF CHARACTER* Name of the referenced environment
U_PRODNAM CHARACTER* Not used
❑ EVENTS ( events library )
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
EVENT_OID CHARACTER* Object Id in EVENTS table
EVENT_NAME VARCHAR Part Delete, Action Promote ...
FATHER_OID CHARACTER* Reserved for futur use
PSTYPE_OWNER VARCHAR Not used
PSTYPE_NAME VARCHAR Not used
❑ EXP_SUBSCRIBERS (subscribers)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
SUBSCRIBER_OID CHARACTER* User Id of the person suscribing
PUBLISHER_OID CHARACTER* OID of the published object
EVENT_OID CHARACTER* OID of the concerned event
SYNC_DATE TIMESTAMP Publish date
SUBSCRIBER_TYPE VARCHAR Not used
ACTION_TYPE VARCHAR Shell if request ( mail for suscribe with mail)
ACTION VARCHAR Name of the shell to launch
ACTION_DATA VARCHAR Parametres for the shell (OID, TIMESTAMP)
SUB_NICKNAME VARCHAR Parametres for the shell (email address ...)
PUB_NICKNAME VARCHAR Parametres for the shell (suscriber Id ...)
Copyright DASSAULT SYSTEMES 1999 1-26 Menu
VPM Programming
❑ PUBLISHED_EVENTS (available events)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
PUBLISHER_OID CHARACTER* OID of the published object
EVENT_OID CHARACTER* OID of the published event
PUBLISH_DATE TIMESTAMP Publish date
❑ RDB_DOCUMENTS (link between action data & BLOB storage)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
OID_DOC VARCHAR OID of the documentation
DOC_USAGE VARCHAR type of stored data
DESCRIPTION VARCHAR data description
DOC_APPLICATION VARCHAR viewer used to open the document
(empty for action)
DOC_FORMAT CHARACTER* extention used referencing the viewer
ACC_MET CHARACTER* BLOB - join BLOB storage table
(RDB_DOC_BLOB)
Copyright DASSAULT SYSTEMES 1999 1-27 Menu
VPM Programming
All tables (except the three Pub-Sub tables) have six comon attributs :
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
OID VARCHAR Object Id
VIRTUAL_OID VARCHAR Not used
TYPE VARCHAR Object type
OID_DOC VARCHAR OID of the linked document
LAST_MODIFIER_ID CHARACTER* Data Base id of the last modifier
LAST_UPDATE_DATE TIMESTAMP Date of the last modification
❑ organization_
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
id CHARACTER* Organization’s Id
name CHARACTER* name given at the creation
description VARCHAR description given at the creation
address VARCHAR address given at the creation
relating_org VARCHAR Organization parents OID
relating_org_ VARCHAR Organization parents OID in the view table
manager_ VARCHAR Manager OID in person_ table
manager VARCHAR Manager OID in person_ view table
❑ role_
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
name CHARACTER* Name of the role
description VARCHAR description
belongs_to_ VARCHAR OID of the referenced oganization
belongs_to VARCHAR OID of the referenced oganization view
relating_role VARCHAR Reserved for futur use
relating_role_ VARCHAR Reserved for futur use
Copyright DASSAULT SYSTEMES 1999 1-28 Menu
VPM Programming
❑ person_
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
id CHARACTER* id of the person
last_name VARCHAR last name of the person
first_name VARCHAR first name of the person
belongs_to VARCHAR OID of the referenced oganization
belongs_to_ VARCHAR OID of the referenced oganization view
phone_number CHARACTER* Phone_number
address VARCHAR address
email VARCHAR email
current_role VARCHAR OID of the attached role
current_role_ VARCHAR OID of the attached role view in role_ table
❑ access_object_ (privilege management)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
id CHARACTER* OID of the relating role
someone VARCHAR OID of the relating person
owner VARCHAR OID of the creator (person)
application VARCHAR OID of the relating application (VPM)
func VARCHAR OID of the relating function (BOM)
command VARCHAR OID of the relating command (Create Part)
workspace VARCHAR Reserved for futur use
authorization INTEGER Revoke & Grant management
data_in VARCHAR link to data group or profile environment
data_out VARCHAR link on profile
Copyright DASSAULT SYSTEMES 1999 1-29 Menu
VPM Programming
❑ data_group_
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
name VARCHAR Name of the data group
group_type VARCHAR Data group type ( My_Data / My Org_Data)
owner VARCHAR OID of the creator in person_ table
description VARCHAR description given at the creation
usage VARCHAR not used
❑ process_
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
application VARCHAR VPM, VPMAdmin ...
func VARCHAR BOM, Action ...
command VARCHAR Create Part, Promote action ...
owner VARCHAR OID of the (Process group) creator in person_ table
description VARCHAR description given at the creation
❑ configuration0001_ (configuration item associed to each configurable part)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
id VARCHAR id of configuration item
description VARCHAR description - not used
design VARCHAR UID of the part set configurable
owner VARCHAR not used
status VARCHAR not used
released INTEGER not used
Copyright DASSAULT SYSTEMES 1999 1-30 Menu
VPM Programming
❑ effectivity_
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
id VARCHAR effectivity id
description VARCHAR not used
status VARCHAR Validated modification or not
released INTEGER Not used
start_range INTEGER start range
end_range INTEGER end range
start_date INTEGER start date
end_date INTEGER end date
lot_id VARCHAR specific type of effectivity - not used
lot_size VARCHAR specific type of effectivity - not used
modif_id VARCHAR modificatoin tag (by default , action id)
action_type VARCHAR add / del link in PSN (`+’/’-’ in info link panel)
validation VARCHAR not used
oldlink VARCHAR optional modification
option_id VARCHAR option name
option_type VARCHAR simple option or complex option (with date/range)
option_start INTEGER Start (/ End) date (/range) when option is combined
option_end INTEGER with a date (/range)
option_lot_id VARCHAR not used
❑ configuration0002_ (configuration handlers)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
id VARCHAR id given to the CH at the creation
CUR_DATE VARCHAR current date (flag)
description VARCHAR description given at the creation
apply VARCHAR UID product
status VARCHAR not used
owner VARCHAR OID of the creator in the person table - not used
flag_frozen INTEGER not used
released INTEGER not used
Copyright DASSAULT SYSTEMES 1999 1-31 Menu
VPM Programming
❑ EFFTYPE_FOR_PART_ (Set configurable data)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
PARTID VARCHAR UID of the configurable part
ALLOWED_TYPE INTEGER type of the allowed effectivity
❑ MODIF_STATUS_ (Visibility management) - Not Used
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
STATUS INTEGER actual visibility status
TO_VALIDATE INTEGER next status
NAME VARCHAR modification tag (action id)
❑ PART_EFFLINK_ (Paste effectivity data)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
PART_ID VARCHAR UID of the part on which you pasted effectivity
PART_CHILD VARCHAR UID of the copied part
Copyright DASSAULT SYSTEMES 1999 1-32 Menu
VPM Programming
❑ Action_
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
nbr INTEGER action number
name VARCHAR action id (type, number & subnumber combined)
secondary_id VARCHAR customized id (= action id by default)
action_type VARCHAR type given at the creation
description VARCHAR abstract
creator VARCHAR id of the creator
owner VARCHAR id of the owner
organization VARCHAR id of the creator’s organisation
priority VARCHAR priority given to the action
status VARCHAR status of the action
start_date VARCHAR Target start date (yyyy-mm-dd-hh.mm.dd)
end_date VARCHAR Target end date (yyyy-mm-dd-hh.mm.dd)
various VARCHAR control parameter (system parameter)
working_eff VARCHAR modification tag (used for query)
applicability_0001 VARCHAR industrial eff type at validation time
applicability_opt VARCHAR option name generated by this action - not used
applicability_min INTEGER range / date (min value) generated by this action
applicability_max INTEGER range / date (max value) generated by this action
proposed_eff_type VARCHAR type of proposed eff (range / date)
proposed_eff_opt VARCHAR option id which has been proposed - not used
proposed_eff_min INTEGER range / date (min value) which has been proposed
proposed_eff_max INTEGER range / date (max value) which has been proposed
product VARCHAR product defined for the action
Copyright DASSAULT SYSTEMES 1999 1-33 Menu
VPM Programming
❑ filter_unit_ ( Configuration filter )
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
cfg_itm_ VARCHAR OID of the corresponding configuration item
cfg_itm VARCHAR OID of the corresponding cfg item in the view
eff_type VARCHAR type of effecivity (opt, opt+date .....)
eff_val1 INTEGER date / Range start value
eff_val2 INTEGER date / Range end value
eff_str1 VARCHAR option nam
eff_str2 VARCHAR not used
date_fu INTEGER Referenced for futur use
❑ PLANNED_EFF_ (Proposed effectivity table)
Column name Type name Explanation
----------------------------------------------------------------------------------------------------------------
ACTION_NAME VARCHAR actio id (DSG xx)
EFF_TYPE VARCHAR date/range
BOT INTEGER date / Range start value
TOP INTEGER date / Range end value
Copyright DASSAULT SYSTEMES 1999 1-34 Menu
VPM Programming
Index
Copyright DASSAULT SYSTEMES 1999 1-35 Menu
VPM Programming
CDM/CATIA Dictionaries and BOM Environment
Copyright DASSAULT SYSTEMES 1999 1-36 Menu
VPM Programming
BOM: Links between objects
Copyright DASSAULT SYSTEMES 1999 1-37 Menu
VPM Programming
BOM: Repository links - Model inside DB
Copyright DASSAULT SYSTEMES 1999 1-38 Menu
VPM Programming
BOM: Repository links - Model outside DB
Copyright DASSAULT SYSTEMES 1999 1-39 Menu
VPM Programming
BOM: Repository links - DOCUMENT inside DB
Copyright DASSAULT SYSTEMES 1999 1-40 Menu
VPM Programming
BOM: Repository links - Document outside DB
Copyright DASSAULT SYSTEMES 1999 1-41 Menu
VPM Programming
BOM: Repository links - Document outside DB
Copyright DASSAULT SYSTEMES 1999 1-42 Menu
VPM Programming
BOM: Assembly links between objects
Copyright DASSAULT SYSTEMES 1999 1-43 Menu
VPM Programming
BOM: MML links between objects
Copyright DASSAULT SYSTEMES 1999 1-44 Menu
VPM Programming
BOM: Lock
Copyright DASSAULT SYSTEMES 1999 1-45 Menu
VPM Programming
BOM: Bounding box
Copyright DASSAULT SYSTEMES 1999 1-46 Menu
VPM Programming
BOM: Zone
Copyright DASSAULT SYSTEMES 1999 1-47 Menu
VPM Programming
Configuration item and effectivity
Copyright DASSAULT SYSTEMES 1999 1-48 Menu
VPM Programming
Effectivity view
Copyright DASSAULT SYSTEMES 1999 1-49 Menu
VPM Programming
Copyright DASSAULT SYSTEMES 1999 1-50 Menu
VPM Programming
Copyright DASSAULT SYSTEMES 1999 1-51 Menu
VPM Programming
People & Organisation
Copyright DASSAULT SYSTEMES 1999 1-52 Menu
VPM Programming
Security
Copyright DASSAULT SYSTEMES 1999 1-53 Menu
VPM Programming
Secuity view
Copyright DASSAULT SYSTEMES 1999 1-54 Menu
VPM Programming
Action
Copyright DASSAULT SYSTEMES 1999 1-55 Menu
VPM Programming
Action
Copyright DASSAULT SYSTEMES 1999 1-56 Menu
VPM Programming
Publish - Subscribe
Copyright DASSAULT SYSTEMES 1999 1-57 Menu
VPM Programming
Copyright DASSAULT SYSTEMES 1999 1-58 Menu
VPM Programming
Copyright DASSAULT SYSTEMES 1999 1-59 Menu
VPM Programming
Appendix 4 - Environment Table Administration
Creating a Project:
1. Edit a command stream file CreateProject with the following content:(See sample in $CAT_CUST/InstallVPM/reffiles/DBMS/VPINSTC2)
*ON_CST_ERROR STOP*ON_ERROR STOP
*COMMAND VPPARCUS*RUN
*COMMAND VPPARPRO*RUN
*COMMANDASSIGN ‘00000000’ TO GLOBAL_T ;ASSIGN ‘T’ TO GLOBAL_VARIABLE_NAME ;RUN OID_TO_HEXA ;;
EXECUTE IMMEDIATEINSERT INTO &DICOCATI.PROJECT($COID, $COMPID, S_PROJECT)VALUES(&COID_PROJX, &TX, ‘ProjectName’);;
EXECUTE IMMEDIATECOMMIT WORK ;;*RUN
2. Change the value of catcdm.c_stream in USRENV.dcls to reference the directory where thecommand stream file is located.
3. Test that this directory is referenced as first directory by using the catpath command:catpath -l -A catcdm.c_stream
4. Run the dbcdmb commanddbcdmb CreateProject -u DbAdmin -p DbAdminPassword
Copyright DASSAULT SYSTEMES 1999 1-60 Menu
VPM Programming
Deleting a Profile
This is done in three steps:
1. Remove the link Role / Profile (only for specific profiles declared in P&O):With P&O: delete the proper row in the tab Privilege
2. Remove the link Profile / Environment (only for specific profiles declared in P&O):Two possibilitiesa. With P&O: delete the proper objects in the tab Profileb. In the Data Base with the following instruction:
db2: delete from PROFILE.PROFILE_USER where MACRO_NAME = ‘ProfileName’
Oracle:delete from PROFILE.PROFILE_USER where MACRO_NAME = ‘ProfileName’;
3. Remove the physical data of the profile in the Data Basedb2: delete from CDM.MACRO_LIST where MACRO_NAME = ‘ProfileName’
Oracle:delete from CDM.MACRO_LIST where MACRO_NAME = ‘ProfileName’;
Deleting an Environment
This is done in five steps:
1. Identify the profiles (other than the default profiles) belonging to the environment. Twopossibilities:a. With P&O: in the tab Profileb. In the Data Base with the following instruction:
db2: select MACRO_NAME from PROFILE.PROFILE_USER where ENV = ‘EnviromentName’
Oracle:select MACRO_NAME from PROFILE.PROFILE_USER where ENV = ‘EnviromentName’;
2. Remove all the specific and default profile in the databaseNote : See former paragraph.
3. Remove the declaration of the environment:db2: delete from CATIA_CONAME where S_CONAME = ‘EnviromentName.PART_LIST’
Oracle:delete from CATIA_CONAME where S_CONAME = ‘EnviromentName.PART_LIST’;
4. Remove the the table declarations and triggers in the CDM dictionary:db2: delete from CDM.$COROUTINES where $CREATOR = ‘EnviromentName’
Oracle:delete from CDM.$COROUTINES where $CREATOR = ‘EnviromentName’;
5. Remove tables and views of the environment.In order to list all tables and views in the data base, use the following instructions:
db2: list tables for schemaEnvironmentName
Oracle:select table_name from all_tables where owner = ‘EnviromentName’;
Copyright DASSAULT SYSTEMES 1999 1-61 Menu
VPM Programming
Deleting a Project
This is done in three steps:
1. List the environments belonging to the project:db2: select S_CONAME from CATIA.CONAME where $COID = ‘$COIDofProject’
Oracle:select S_CONAME from CATIA.CONAME where $COID = ‘$COIDofProject’;
2. Remove these associated environments:Note : You can in one shot delete the declarations of all environments belonging to the project. The third step
of the former paragraph will be completed for all the environments using the following instructions:
db2: delete from CATIA.CONAME where $COID = ‘$COIDofProject’
Oracle:delete from CATIA.CONAME where $COID = ‘$COIDofProject’;
3. Remove the project declaration:db2: delete from CATIA.PROJECT where S_PROJECT = ‘ProjectName’
Oracle:delete from CATIA.PROJECT where S_PROJECT = ‘ProjectName’;
Copyright DASSAULT SYSTEMES 1999 1-62 Menu
VPM Programming
Copyright DASSAULT SYSTEMES 1999 1-63 Menu
VPM Programming
Appendix 5 - C++ Reminder
Memory Management
In C++, the memory management is handled with two following instructions:
1. newchar * String = new char[50]; // Reserves a memory space for 50 characters
// Caution: this string can save only 49 characters!
2. deletedelete String; // Release the memory space referenced by String
3. void * memcpy (void * Targ, const void * Source, unsigned Count);➥ Copies Count octets from Source to Targ.
String Management
The following functionalities are available in stdlib.h
1. String copy:char * strcpy (char * Targ, const char * Source);➥ Copies Source, including the termination null chracter ‘\0’, to the location specified by
Targ, and returns Targ. No overflow checking is performed when strings are copied orappended.
char * strncpy (char * Targ, const char * Source, unsigned Count);➥ Copies the initial Count characters of Source to Targ, and returns Targ. If Count is less
than or equal to the length of Source, a null character is not automatically appended tothe copied string.
2. String concatenation:char * strcat (char * Left, const char * Right);➥ Appends Right to Left and terminates the resulting string with a null character. No
overflow checking is performed when strings are copied or appended.
char * strncat (char * Left, const char * Right, unsigned Count);➥ Appends, at most, the first Count characters of Right to Left.
Copyright DASSAULT SYSTEMES 1999 1-64 Menu
VPM Programming
3. String comparison:char * strcmp (const char * Str1, const char * Str2);➥ Compares the two string Str1 and Str2.
The return value for each of these functions indicates the lexicographic relation of Str1to Str2.Value Relationship of Str1 to Str2-1 Str1 less than Str20 Str1 identical Str21 Str1 greater than Str2
char * strncmp (const char * Str1, const char * Str2, unsigned Count );➥ Compares, at most, the first Count characters in Str1 and Str2.
char * strcimp (const char * Str1, const char * Str2);➥ Same as strcmp but does not differentiate lower and upper cases.
char * strnicmp (const char * Str1, const char * Str2, unsigned Count );➥ Same as strncmp but does not differentiate lower and upper cases.
String and I/O Management
These functionalities are available in stdio.h
1. printf (const char * format, ...)Note : Declared in in stdio.hSyntax for format:
int %dfloat %e %f %gdouble %le %lfchar * %s
2. sprintf (char * Buffer, const char * format, ...)
3. coutNote : Declared in in iostream.hcout << Buffer // Buffer can be: char *, int, double ...
4. Text format (can be used for printf and cout):New Line \nTabulation \t
Copyright DASSAULT SYSTEMES 1999 1-65 Menu
VPM Programming
File Management
Instructions available in fstream.hchar * Buffer1 = new char[50];char * Buffer2 = new char[50];char * FileName = new char[50];fstream File; // Object created to open a connectionstrcpy (FileName, “Test.txt”); // Test.txt: toto tutuFile.open(FileName, ios::in ); // Open the file FileName in read mode/* File.open(FileName, ios::out ); Open the file FileName in write mode *//* File.open(FileName, ios::in | ios::out); Open the file FileName in R/W mode */if (!File)
cout << “The file does not exit.” << endl;else
{File >> Buffer1; // The value of Buffer1 is “toto”File >> Buffer2; // The value of Buffer2 is “tutu”}
File.close(); // Close the connectiondelete Buffer1;delete Buffer2;delete FileName;
UNIX Interface
This functionality is available in stdlib.h
char * getenv (char *);
Can be used under UNIX in oder to get the value of an environment declarative variable.
Example: char * User = getenv(“USER”);
Copyright DASSAULT SYSTEMES 1999 1-66 Menu
VPM Programming
Copyright DASSAULT SYSTEMES 1999 1-67 Menu
VPM Programming
Appendix 6 - Headers
CATDMUsrMethod.h/* -*-c++-*-*/// COPYRIGHT DASSAULT SYSTEMES 1997//=============================================================================//// CATDMUsrMethod:// Contains all the user exits related to BOM////=============================================================================// Usage Notes:////=============================================================================// Sep. 97 Creation//=============================================================================
#ifndef CATDMUsrMethod_h#define CATDMUsrMethod_h
#include <time.h>
// Modification types for commitenum ModificationType { ADDLINK=1, REMOVELINK=2, MOVELINK=4, REPLACELINK=8, MOVEREPLACELINK=4+8, RENAMELINK=16, ADDLINKTOCONF=32+1 };
// Action types for versioningenum RevVerAction{ ACTION_NEW, ACTION_UPDATE};
#ifndef PartAsmID_def#define PartAsmID_deftypedef struct PartAsmId_ { char coid[8]; char compid[8]; char caenv[8]; char catab[18]; char clien[8]; // link COMPID (towards father) double xmat[12]; // transformation matrix int level;} PartAsmID;#endif
Copyright DASSAULT SYSTEMES 1999 1-68 Menu
VPM Programming
#ifndef ObjID_def#define ObjID_deftypedef struct{ char Xcoid[17]; // Coid (hexadecimal notation) char Xcompid[17]; // Compid (hexadecimal notation) double coid; // Coid (binary) double compid; // Compid (binary) char caenv[9]; char catab[19];} ObjID;#endif
#ifndef Error_def#define Error_deftypedef struct{ int Ier; // Error code char* ShortMsg; // Short message (deleted by VPM if not NULL and if Ier!=0) char* LongMsg; // Long message (deleted by VPM if not NULL and if Ier!=0)} Error;#endif
/** * Note:<BR> * * Following convention is used for naming parameters: parameter names prefixed by: * <dl> * <dd> <tt>i</tt> are input parameters * <dd> <tt>o</tt> are ouput parameters * <dd> <tt>io</tt> are input/output parameters * </dl> */
class CATDMUsrMethod{ public: //---------------------------------------- // Additional tools and methods management //---------------------------------------- static Error ExecuteUsrMethod(const char *iMethodName, const int &iNbSelectedInstances, ObjID *iSelectedObjects);
static Error OpenPSNWithUsrMethod(const char* iMethodName, const int& iNbSelectedInstances, int* iDepthArray, PartAsmID** iObjArray, double** iComputedXmatArray);
Copyright DASSAULT SYSTEMES 1999 1-69 Menu
VPM Programming
//------------------- // PSN save management //------------------- /** * Allows customization of the proposed values list in the * Modification Name combo, when commiting changes on a configurable * part in PSN. * <p> * If method does not provide a history list (<tt>oHistSize=0</tt>), * the caller method will use default history. * Allocation of <tt>oHistory</tt>’s elements has to be done in function * GetConfNameHistory. * Desallocation is the responsability of VPM. * * @param iUser * user name * @param iOrg * user organization * @param oHistory * points on the list of proposed values * @param oHistSize * number of proposed values */ static void GetConfNameHistory(const char iUser[9], const char iOrg[11], char*** oHistory, int* oHistSize);
/** * Allows user to validate keyed flag versus current modifications. * * @param iModificationFlag * flag which is going to be used in order to save following modifications * @param iModificationFlag * number of modifications * @param iTypeOfModifications * types of the modifications * @param iAddedLinks * list of added links * @param iRemovedLinks * list of removed links * * @return * If method return an error, another modification flag must * be keyed or commit canceled. */ static Error IsAValidFlagForCommit(const char* iModificationFlag, const int iNbModifications, int* iTypeOfModifications, ObjID* iAddedLinks, ObjID* iRemovedLinks);
Copyright DASSAULT SYSTEMES 1999 1-70 Menu
VPM Programming
/** * User exit called when saving Product Structure modifications * @return * <tt>1</tt> Action flow will test whether the current user/role has the right to * write the modifications (maintenance phase)<BR> * <tt>0</tt> Action flow won’t be called when saving the modifications * (development phase) */ static int ActionFlowCheck(const char *iModificationFlag, const char *iUser);
static Error SuccessfullyCommitInGraph(const char* iModificationFlag, const int iNbModifications, int* iTypeOfModifications, ObjID* iAddedLinks, ObjID* iRemovedLinks);
static void SuccessfullyRollBackInGraph();
//------------------------- // Modifications management //-------------------------
/** * User exit called when validating action and commiting PSN graph modifications * @param iModif * Modification to validate * @param oType * Type of the validation (option, range, date, pack, option_range, option_date, * pack_range, pack_date) * @param oOptListSize * Number of options in oOptList * = 1 if type is equal “option”, “option_range” or “option_date” * = n if type is equal “pack”, “pack_range” or “pack_date” * @param oOptList * significant only if oType is equal to “option”, “option_range”, * “option_date”, “pack”, “pack_range” or “pack_date” * @param oRangeBot * significant only if oType is equal to “range”, “option_range” * or “pack_range” * @param oRangeTop * significant only if oType is equal to “range”, “option_range” * or “pack_range” * @param oDateBeg * significant only if oType is equal to “date”, “option_date” * or “pack_date” * @param oDateEnd * significant only if oType is equal to “date”, “option_date” * or “pack_date” * * @return * If Error.Ier equals 0 validation is done, else error message is displayed */ static Error DefaultModValidation(const char *iModif, char **oType, int &oOptListSize, char ***oOptList, int&oRangeBot, int &oRangeTop, time_t &oDateBeg, time_t &oDateEnd);
Copyright DASSAULT SYSTEMES 1999 1-71 Menu
VPM Programming
/** * User exit called when validating a modification * @param iModification * Modification to validate * @param iUser * Identifier of the user * @param iValidationType * Type of the validation (option, range, date, pack, option_range, option_date, * pack_range, pack_date) * @param iNbOptions * Number of options in iOptionList * = 1 if type is equal “option”, “option_range” or “option_date” * = n if type is equal “pack”, “pack_range” or “pack_date” * @param iOptionList * significant only if iValidationType is equal to “option”, “option_range”, * “option_date”, “pack”, “pack_range” or “pack_date” * @param iRangeBot * significant only if iValidationType is equal to “range”, “option_range” * or “pack_range” * @param iRangeTop * significant only if iValidationType is equal to “range”, “option_range” * or “pack_range” * @param iDateBeg * significant only if iValidationType is equal to “date”, “option_date” * or “pack_date” * @param iDateEnd * significant only if iValidationType is equal to “date”, “option_date” * or “pack_date” * * @return * If Error.Ier equals 0 validation is allowed, else error message is displayed */ static Error AuthorizedModValidation(const char *iModification, const char *iUser, const char *iValidationType, const int iNbOptions, char **iOptionList, const int iRangeBot, const int iRangeTop, const time_t iDateBeg, const time_t iDateEnd);
/** * User exit called when promoting a modification * * @return * If Error.Ier equals 0 promote is allowed, else error message is displayed */ static Error AuthorizedModPromote(const char *iModification, const char *iUser); /** * User exit called when demoting a modification * * @return * If Error.Ier equals 0 demote is allowed, else error message is displayed */ static Error AuthorizedModDemote(const char *iModification, const char *iUser);
Copyright DASSAULT SYSTEMES 1999 1-72 Menu
VPM Programming
/** * User exit called when deleting a modification * * @return * If Error.Ier equals 0 delete is allowed, else error message is displayed */ static Error AuthorizedModDelete(const char *iModification, const char *iUser); /** * User exit called when creating a modification * * @return * <tt>0</tt> iModification will be of Personal type and belongs to iUser * (only iUser will see iModification until promoted) * <tt>1</tt> iModification will be of Public type (everybody can see it) */ static int ModCreateOwner(const char *iModification, const char *iUser);
//----------------------------------------------------------------- // Check user authorization for basic operations // Operations are performed if no error (error code =0) is returned //----------------------------------------------------------------- // Cut link static Error AuthorizedCut(const ObjID& iLink);
// Move Link static Error AuthorizedMove(const ObjID& iLink);
// Create Link (with paste method) static Error AuthorizedPaste(const ObjID& iFather, const ObjID& iChild);
// CheckIn object static Error AuthorizedCheckIn(const ObjID& iObj);
// CheckOut object static Error AuthorizedCheckOut(const ObjID& iObj);
// Delete object static Error AuthorizedDelete(const ObjID& iObj);
// Create object static Error AuthorizedCreate(const ObjID& iObj);
// Update object static Error AuthorizedUpdate(const ObjID& iObj);
/** * Checks autorisation before saving model in CATIA V4. * * @return * 0 means save is authorized in CATIA V4 * not 0 it is an error code : * => save in CATIA will not be performed */ static int AuthorizedCATIASave(const ObjID& iObj);
Copyright DASSAULT SYSTEMES 1999 1-73 Menu
VPM Programming
// Change maturity static Error AuthorizedPromotion(const ObjID& iObj, const char* iOldStatus, const char* iNewStatus);
/** * User exit called when changing ownership. * * @return * If Error.Ier equals 0 modification is allowed, else error message is * displayed. */ static Error AuthorizedReassign(const ObjID& iObj, const char iUser[9], const char iOrg[11]);
//---------------------- // Attributes management //---------------------- /** * User exit called when user create new panel (insert, query or update) * if $AUTHORIZEDVALUES or $HELPVALUES exist but empty. * <p> * <b> This user-exit is called several times. At each call, you only have * to fill the output parameters which are not NULL. </b> * @param oAuthorized * <tt>-1</tt> Help values without default value<BR> * <tt>-2</tt> Help values with first value as default value<BR> * <tt> 1</tt> Authorized values without default value<BR> * <tt> 2</tt> Authorized values with first value as default value * * @param oNbValues * number of values returned * @param oValues * list of values (this array is allocated and deleted by VPM) */ static void GetInputListOfValues(const char* iCatab, const char* iAttribute, int* oAuthorized=0, int* oNbValues=0, char*** oValues=0);
Copyright DASSAULT SYSTEMES 1999 1-74 Menu
VPM Programming
/** * Allows to check attribute values or to valuate company attributes * before writing a part or an object. * * @param iUpdate * <tt>0</tt> user-exit called in write context<BR> * <tt>1</tt> user-exit called in update context * @param iCaenv * Owner of the environment into which the object is being written * @param iCatab * Name of the table into which the object is being written * @param iNbAttPart * Number of attributes given for the part * @param iNbAttObj * Number of attributes given for the object * @param ioAttNames * Names of the given attributes for the part and the object being written * (array size : iNbAttPart + iNbAttObj) * @param ioAttVals * Values of the given attributes for the part and the object being written * (array size : iNbAttPart + iNbAttObj) * * @return * The method must return 0 if the operation is accepted or error code * if it is refused. In such a case, an error message is displayed in an * error notification panel and the operation is canceled. * The attributes given in the list are the ones that were valuated in * the insert panel. If you wish to valuate a “hidden” attribute, you * will have to reallocate AttNames and AttVals and add the attribute * and its value. */ static Error ComputeValuesBeforeWrite(const int iUpdate, const char* const iCaenv, const char* const iCatab, int *iNbAttPart, int *iNbAttObj, char ***ioAttNames, char ***ioAttVals);
Copyright DASSAULT SYSTEMES 1999 1-75 Menu
VPM Programming
//---------------------- // Long Field management //---------------------- /** * Allows to check source location or to customize LF management * * @param iCaenv * Owner of the environment into which the object is being written * @param iCatab * Name of the table into which the object is being written * @param iSource * Where the LF (long field) comes from :<BR> * <tt>1</tt> File<BR> * <tt>2</tt> CATIA V4<BR> * <tt>3</tt> New one (empty)<BR> * <tt>4</tt> Object in database<BR> * <tt>5</tt> Document<BR> * <tt>7</tt> DENEB product * @param ioPath * Significant only when <tt>iSource</tt> is equal to “File” (1).<BR> * It is the full path of the file. * @param ioObj * Significant only when <tt>iSource</tt> is equal to “Object in database” (4).<BR> * @param ioRepository * Where the LF is going to be written * * @return * The method must return 0 if the operation is accepted or error code * if it is refused. In such a case, an error message is displayed in an * error notification panel and the operation is canceled. */ static Error CheckLFBeforeWrite(const char* const iCaenv, const char* const iCatab, const int iSource, char **ioPath, ObjID *ioObj, char** ioRepository);
Copyright DASSAULT SYSTEMES 1999 1-76 Menu
VPM Programming
//---------------------------- // Version/revision management //---------------------------- /** * Provides a list of proposed values upon creation/update of a * version.<BR> * If number of values is greater than 0, the values will be * displayed in a list inside input panel. *<p> * Note : <b>used in NEW revisioning mode</b> * * @param iobj * object from which we want to create a new version * @param iMaturity * maturity of the object * @param iLastRev * last existing version number * @param iCurRev * version number of the object being handled * @param oNbVerValues * number of values returned * @param oVerValues * list of values (memory has to be allocated within the user * exit ; it is freed by the caller) */ static void GetNewVersionListOfValues(const ObjID& iObj, const char* iMaturity, const char* iLastVer, const char* iCurVer, int* oNbVerValues, char*** oVerValues);
/** * Provides a list of proposed values upon creation/update of a * revision. <BR> * If number of values is greater than 0, the values will be * displayed in a list inside input panel. *<p> * Note : <b>used in NEW revisioning mode</b> * * @param iObj * object from which we want to create a new revision * @param iMaturity * maturity of the object * @param iLastRev * last existing revision number * @param iCurRev * revision number of the object being handled * @param oNbRevValues * number of values returned * @param oRevValues * list of values (memory has to be allocated within the user * exit ; it is freed by the caller) */ static void GetNewRevisionListOfValues(const ObjID& iObj, const char* iMaturity, const char* iLastRev, const char* iCurRev, int* oNbRevValues, char*** oRevValues);
Copyright DASSAULT SYSTEMES 1999 1-77 Menu
VPM Programming
/** * Checks the validity of the keyed value for revision . *<p> * Note : <b>used in NEW revisioning mode</b> * * @param iObj * object from which we want to create a new version * @param iMaturity * maturity of the object * @param iPrevVer * previous version number of the object * @param iNewVer * new version number * @param iAction * create or update operation * * @return * The method must return an Error with Ier=0 if the operation is * accepted or error code if it is refused. * In such a case, an error message is displayed in an error * notification panel . */ static Error IsAValidNewVersion(const ObjID& iObj, const char* iMaturity, const char* iPrevVer, const char* iNewVer, const RevVerAction iAction);
/** * Checks the validity of the keyed value for revision. *<p> * Note : <b>used in NEW revisioning mode</b> * * @param iObj * object from which we want to create a new revision * @param iMaturity * maturity of the object * @param iPrevRev * previous revision number of the object * @param iNewRev * new revision number * @param iAction * create or update operation * * @return * The method must return an Error with Ier=0 if the operation is * accepted or error code if it is refused. * In such a case, an error message is displayed in an error * notification panel. */ static Error IsAValidNewRevision(const ObjID& iObj,const char* iMaturity, const char* iPrevRev, const char* iNewRev, const RevVerAction iAction);
Copyright DASSAULT SYSTEMES 1999 1-78 Menu
VPM Programming
/** * Checks the validity of the keyed value for revision duplication * when versioning a part. *<p> * Note : <b>used in NEW revisioning mode when declarative * CATCDMA.VPM.VERSION.SELECTREVISION.INPUT is set to TRUE</b> * * @param iObj * object from which we want to create a new revision * @param iPrevRev * previous revision number of the object * @param iNewRev * new revision number * * @return * The method must return an Error with Ier=0 if the operation is * accepted or error code if it is refused. * In such a case, an error message is displayed in an error * notification panel. */ static Error IsAValidDuplicatedRevision(const ObjID& iObj, const char* iPrevRev, const char* iNewRev);
/** * Checks the validity of the keyed value for version or revision. *<p> * Note : <b>used in OLD revisioning mode </b> * @param iObj * object from witch we want to create a new version or revision * @param iVersion * version of the part * @param iOldVerRev * version or revision of iobj * @param iNewVerRev * version or revision keyed * * @return * The method must return an Error with Ier=0 if the operation is * accepted or error code if it is refused. * In such a case, an error message is displayed in an error * notification panel. */ static Error IsAValidRevisionVersion(const ObjID& iObj, const char iVersion[4], const char iOldVerRev[4], const char iNewVerRev[4]);
Copyright DASSAULT SYSTEMES 1999 1-79 Menu
VPM Programming
/** * Called before creating new part version. * Note : <b>used in BOTH revisioning mode</b> * * @param iObj * object from which we want to create a new version * @param iNewPartNumber * <tt>0</tt> same part number<BR> * <tt>1</tt> new part number */ static Error AuthorizedNewVersion(const ObjID& iObj, const int iNewPartNumber);
/** * Called before creating new representation revision. *<p> * Note : <b>used in BOTH revisioning mode</b> * * @param iObj * object from which we want to create a new revision */ static Error AuthorizedNewRevision(const ObjID& iObj);
//------------------------ // //----------------------- /** * Allows user to perform specific action before object creation. * * @param iCaenv * Environment into which the object is going to be created * @param iObject * Object (type) to be created * * @return * If the method return an error, the creation is canceled * and an error message will be displayed in an error * notification panel. */ static Error BeforeCreateUserAction(const char* const iCaenv, const char* const iObject);
//------------------------ // //----------------------- /** * Allows user to perform specific action after write. * * @param iObj * object created * * @return * If the method return an error, a rollback will be performed * and an error message will be displayed in an error * notification panel. */ static Error AfterWriteUserAction(const ObjID& iObj);
Copyright DASSAULT SYSTEMES 1999 1-80 Menu
VPM Programming
//------------------------ // //----------------------- /** * Allows user to perform specific action after commit. * * @param iObj * object created * * @return * If the method return an error, a rollback will be performed * and an error message will be displayed in an error * notification panel. */ static Error AfterCommitUserAction();
//------------------------ // //----------------------- /** * Allows user to perform specific action after rollback. */ static void AfterRollbackUserAction();
//--------------------- // //-------------------- /** * User exit called when user print result panel. * * @return * an HTML color (for instance : “#FFFFFF”) <BR> * returned char* will be deleted by VPM */ static char* GetBGColorForPrint(const char* iCatab, const char* iAttribute, const char* iValue);
Copyright DASSAULT SYSTEMES 1999 1-81 Menu
VPM Programming
/** * Called when user select OK in New config-handler panel. * Allows to format the config-handler Id. * * @param iObj * object (product) associated to the config-handler. * * @param iCHUserId * user config-handler Id * * @param oCHNewId * updated (formatted) config-handler Id * * @return * If the method return an error, the creation will not be performed * and an error message will be displayed in an error * notification panel. */ static Error FormatConfigHandlerId(const ObjID& iObj, const char* iCHUserId, char **oCHNewId); /** * Called when display option selection box. * Allows to change options available. * * @param iUser * user ID * * @param iRole * user role * * @param iObj * object (product) of current dictionary. * * @param ioNbOpt * number of proposed/returned options. * * @param ioOptNameList * list of options name proposed/returned. * * @param ioOptTypeList * list of options type proposed. * * @param iOptDescList * list of options description proposed/returned. * * @return * If the method return an error, * and an error message will be displayed in an error * notification panel. */ static Error OptionListToDisplay(const char *iUser, const char *iRole, const char *iOrg, const ObjID& iObj, const int iNbOpt, int &oNbOpt, char ***ioOptNameList, char ***ioOptTypeList, char ***ioOptDescList);};#endif
Copyright DASSAULT SYSTEMES 1999 1-82 Menu
VPM Programming
CATVpmAFUsrMethod.h/* -*-c++-*-*/// COPYRIGHT DASSAULT SYSTEMES 1997//=============================================================================//// CATVpmAFUsrMethod:// Contains all the user exits related to ActionFlow////=============================================================================// Usage Notes:////=============================================================================// Sep. 97 Creation//=============================================================================
#ifndef CATVpmAFUsrMethod_h#define CATVpmAFUsrMethod_h
#include “CATDMUsrMethod.h”
//=============================================================================// Type definitions//=============================================================================
/** * Structure representing an action */typedef struct{ char* identifier; char* secondid; char* type; char* owner; char* priority; char* status; char* product;} Action;
//=============================================================================// User Methods//=============================================================================
/** * Notes:<BR> * * Following convention is used for naming parameters: parameter names prefixed by: * <dl> * <dd> <tt>i</tt> are input parameters * <dd> <tt>o</tt> are ouput parameters * <dd> <tt>io</tt> are input/output parameters * </dl> * <p>
Copyright DASSAULT SYSTEMES 1999 1-83 Menu
VPM Programming
* Output string parameters must be allocated by the user exit : * VPM will de-allocate them if no error is returned * <p> * The <tt>_CurrentAction</tt> static data member is accessible in * all user exits to read from. */
class CATVpmAFUsrMethod{ public :
//---------------------------------------------------------------- // Static data members //----------------------------------------------------------------
static Action _CurrentAction;
//---------------------------------------------------------------- // Status Graph Customization //---------------------------------------------------------------- /** * <b>Status Graph customization :</b> * <br>Executes a user command related to a Status Graph transition. * <p> * @param iCommandName * command name as defined in the Status Graph * @param iNbParam * number of command parameters * @param iParamList * command parameters passed as a <tt>iNbParam</tt> sized array of strings */ static Error ExecuteUsrCommand (const char * iCommandName, const int & iNbParam, char ** iParamList);
/** * <b>Status Graph customization :</b> * <br>Retrieves the person identifier relating to a “:Notify” generic command, * <br>using the “:EXT” parameter - i.e. the recipient of the notification. * <p> * @param iOperationName * operation name as defined in the Status Graph * @param oPersonId * person identifier of the notification recipient */ static Error GetNewUsrPersonId (const char * iOperationName, char ** oPersonId);
Copyright DASSAULT SYSTEMES 1999 1-84 Menu
VPM Programming
/** * <b>Status Graph customization :</b> * <br>Retrieves the message relating to a “:Notify” generic command. * <p> * @param iOperationName * operation name as defined in the Status Graph * @param oMessageTitle * title (subject) of the message * @param oMessageText * full message text */ static Error GetUsrMessageText (const char * iOperationName, char ** oMessageTitle, char ** oMessageText); /** * <b>Status Graph customization :</b> * <br>Checks a user condition associated to a status change transition : * <br>if an error is returned, (i.e. Ier != 0), the condition is false, * <br>otherwise it is true and the operation which it applies to is executed. * <p> * @param iConditionName * condition name as defined in the Status Graph * @param iOperationName * operation name as defined in the Status Graph, which the condition applies to. */ static Error CheckUsrCondition (const char * iConditionName, const char * iOperationName);
// ---------------------------------------------------------------- /** * <b>Action Property Editor customization :</b> * <br>Checks access to an external file when trying to associate it to the action * <br>(by reference) : if an error is returned (i.e. Ier != 0), the file is * <br>not accessible and therefore, the file is not associated while * <br>the error message is displayed. * <br>Also retrieves an updated pathname for this file where accessible. * <p> * @param iCurrentFullFileName * full pathname of the selected file * @param oNewFullFileName * full pathname of the accessible file (if NULL, the input name is used) */ static Error CheckUsrLibraryAccess (const char * iCurrentFullFileName, char ** oNewFullFileName);
Copyright DASSAULT SYSTEMES 1999 1-85 Menu
VPM Programming
/** * <b>Action Property Editor customization :</b> * <br>Retrieves action secondary id when creating a new action in * <br>”secondary id” mode. * <br>NOTE : this user exit is not called any more and has just been * <br>maintained in this header for compatibility reasons (see * <br>ModifySecondaryId method). * <p> * @param oSecondId * action secondary id * @param oModifiable * indicates if the action name (i.e. secondary id) can be edited from * within the Action Property Editor window : * ‘Y’ : yes, the action name can be edited * otherwise : the action name cannot be modified */ static Error GetUsrSecondaryId (char ** oSecondId, char & oModifiable);
/** * <b>Action Property Editor customization :</b> * <br>Retrieves action secondary id when user modifies action type or id in * <br>”secondary id” mode. * <p> * @param iTypePrefix * action type prefix * @param iTypeName * action type name * @param iCurrentId * action current secondary id (since last modified) * @param iClashMode * = ‘Y’ if save attempt has been made and resulted in a clash due to an existing action with the same id * @param ioModifiable * indicates if the action name (i.e. secondary id) can be edited from * within the Action Property Editor window : * ‘Y’ : yes, the action name can be edited * otherwise : the action name cannot be modified * @param oNewId * action secondary id */ static Error ModifySecondaryId (const char* iTypePrefix, const char* iTypeName, const char* iCurrentId, char iClashMode, char& ioModifiable, char** oNewId);};
#endif
Copyright DASSAULT SYSTEMES 1999 1-86 Menu
VPM Programming
CATVpmPEUsrMethod.h// COPYRIGHT DASSAULT SYSTEMES 1997//=============================================================================/** * CATVpmPEUsrMethod.h: * <b>People & Security</b> user exit interface.**///=============================================================================/** * <u>Usage Notes:</u> * Overwrite your own CATVpmPEUsrMethod using code/sample files; * Then compile and link using code/command/mkVX0PEUSR.sh script shell.**///=============================================================================#ifndef CATVpmPEUsrMethod_h#define CATVpmPEUsrMethod_h
// ============================================================================ //// defines.// ============================================================================ //// --> The following defines determine basic test conditions for the application,// CATVpmPasswdPan// ---------------#define MIN_USERID_LENGTH 2#define MAX_USERID_LENGTH 8#define MIN_PASSWD_LENGTH 4#define MAX_PASSWD_LENGTH 8
// ============================================================================ //// User Methods// ============================================================================ //
class CATVpmPEUsrMethod{ public : /** * LoginVpmSession ( person, org, role_name, role_org ) * Called at the end login time, when the user succeeded in login. * Returns 0 when ok. **/ static int LoginVpmSession ( const char* iPersonId, const char* iOrgId, const char* iRoleName, const char* iRoleOrgId ) ; /** * EndVpmSession () * Called at the end of interactive applications * No return value. **/ static void EndVpmSession () ;
Copyright DASSAULT SYSTEMES 1999 1-87 Menu
VPM Programming
/** * UpdatePasswordPermitted () * Determines that the user exit to change the password can be called * and is functional. * * Returns the following values: * 0 = Update of password is NOT permitted. * 1 = Update of password is permitted, but original password is NOT * required. * 2 = Update of password is permitted, AND original password IS * required. **/ static int ChangePasswordEnabled() ;
/** * ChangePassword () * Modifies the password of customer specific VPM components. * * Returns the following values. * -1 = Original password is incorrect. * 0 = General failure of password change. * 1 = Password modification successful. **/ static int ChangePassword ( const char* iPersonId, const char* iCurrentPasswd, const char* iNewPasswd ) ;
/** * ValidateUserId( char *iUserId ) * ValidatePassword( char *iPassword ) * Level of validation is implementation specific. Only basic checking is * managed here. * * Return values are as follows: * 1 = Validated OK. * 0 = General Failure. * -1 = Too short. * -2 = Too long. * -3 = Combination of alpha and numeric characters required. * -4 = Password and user id cannot be the same. **/ static int ValidateUserId ( const char *iUserId ) ; static int ValidatePassword ( const char *iPassword ) ;};
#endif
Copyright DASSAULT SYSTEMES 1999 1-88 Menu
VPM Programming