0025217: Draw Harness - activate GLSL warnings output within command vgldebug
[occt.git] / src / STEPConstruct / STEPConstruct_AP203Context.cxx
CommitLineData
b311480e 1// Created on: 1999-11-19
2// Created by: Andrey BETENEV
3// Copyright (c) 1999-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
7fd59977 17#include <STEPConstruct_AP203Context.ixx>
18
03155c18 19#ifndef _WIN32
7fd59977 20# include <pwd.h>
7fd59977 21# include <netdb.h>
03155c18 22#else
7fd59977 23# include <winsock2.h>
24#endif
7fd59977 25
26#include <stdio.h>
27
28#include <OSD_Process.hxx>
29#include <Quantity_Date.hxx>
30
31#include <TCollection_HAsciiString.hxx>
32#include <TColStd_SequenceOfAsciiString.hxx>
33#include <Interface_HArray1OfHAsciiString.hxx>
34
35#include <StepBasic_CalendarDate.hxx>
36#include <StepBasic_LocalTime.hxx>
37#include <StepBasic_ApprovalStatus.hxx>
38#include <StepBasic_CoordinatedUniversalTimeOffset.hxx>
39#include <StepBasic_AheadOrBehind.hxx>
40#include <StepBasic_Person.hxx>
41#include <StepBasic_Organization.hxx>
42#include <StepBasic_SecurityClassification.hxx>
43#include <StepAP203_HArray1OfPersonOrganizationItem.hxx>
44#include <StepAP203_HArray1OfClassifiedItem.hxx>
45#include <StepAP203_HArray1OfDateTimeItem.hxx>
46#include <StepAP203_HArray1OfApprovedItem.hxx>
47#include <StepBasic_ProductCategory.hxx>
48
49//=======================================================================
50//function : STEPConstruct_AP203Context
51//purpose :
52//=======================================================================
53
54STEPConstruct_AP203Context::STEPConstruct_AP203Context ()
55{
56 InitRoles();
57}
58
59//=======================================================================
60//function : DefaultApproval
61//purpose :
62//=======================================================================
63
64Handle(StepBasic_Approval) STEPConstruct_AP203Context::DefaultApproval ()
65{
66 if ( defApproval.IsNull() ) {
67 Handle(StepBasic_ApprovalStatus) aStatus = new StepBasic_ApprovalStatus;
68 Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString ("not_yet_approved");
69 aStatus->Init ( aName );
70
71 Handle(TCollection_HAsciiString) aLevel = new TCollection_HAsciiString ("");
72 defApproval = new StepBasic_Approval;
73 defApproval->Init ( aStatus, aLevel );
74 }
75 return defApproval;
76}
77
78//=======================================================================
79//function : SetDefaultApproval
80//purpose :
81//=======================================================================
82
83void STEPConstruct_AP203Context::SetDefaultApproval (const Handle(StepBasic_Approval) &app)
84{
85 defApproval = app;
86}
87
88//=======================================================================
89//function : DefaultDateAndTime
90//purpose :
91//=======================================================================
92
93Handle(StepBasic_DateAndTime) STEPConstruct_AP203Context::DefaultDateAndTime ()
94{
95 if ( defDateAndTime.IsNull() ) {
96 OSD_Process sys;
97 Quantity_Date date = sys.SystemDate ();
98
99 Handle(StepBasic_CalendarDate) aDate = new StepBasic_CalendarDate;
100 aDate->Init ( date.Year(), date.Day(), date.Month() );
101
102 Handle(StepBasic_CoordinatedUniversalTimeOffset) zone =
103 new StepBasic_CoordinatedUniversalTimeOffset;
104 Standard_Integer shift = Standard_Integer(timezone);
105 Standard_Integer shifth = abs ( shift ) / 3600;
106 Standard_Integer shiftm = ( abs ( shift ) - shifth * 3600 ) / 60;
107 StepBasic_AheadOrBehind sense = ( shift >0 ? StepBasic_aobBehind :
108 shift <0 ? StepBasic_aobAhead :
109 StepBasic_aobExact );
110 zone->Init ( shifth, ( shiftm != 0 ), shiftm, sense );
111
112 Handle(StepBasic_LocalTime) aTime = new StepBasic_LocalTime;
113 aTime->Init ( date.Hour(), Standard_True, date.Minute(), Standard_False, 0., zone );
114
115 defDateAndTime = new StepBasic_DateAndTime;
116 defDateAndTime->Init ( aDate, aTime );
117 }
118 return defDateAndTime;
119}
120
121//=======================================================================
122//function : SetDefaultDateAndTime
123//purpose :
124//=======================================================================
125
126void STEPConstruct_AP203Context::SetDefaultDateAndTime (const Handle(StepBasic_DateAndTime) &dt)
127{
128 defDateAndTime = dt;
129}
130
131//=======================================================================
132//function : DefaultPersonAndOrganization
133//purpose :
134//=======================================================================
135
136Handle(StepBasic_PersonAndOrganization) STEPConstruct_AP203Context::DefaultPersonAndOrganization ()
137{
138 if ( defPersonAndOrganization.IsNull() ) {
139 // get IP address as a unique id of organization
140#ifdef WNT // adapted for NT which lacks gethostent()
141 char hostname[1024];
142 hostname[0] = '\0';
143 gethostname ( hostname, 1020 );
144 hostname[1020] = '\0';
145 struct hostent *he = gethostbyname ( hostname );
146#else // adapted for Sun2.5, which lacks definition of gethostname()
147 struct hostent *he = gethostent();
148 while ( he && he->h_name && (unsigned char)he->h_addr_list[0][0] == 127 )
149 he = gethostent();
150#endif
151 Handle(TCollection_HAsciiString) orgId = new TCollection_HAsciiString ( "" );
152 if ( he && he->h_addr_list && he->h_length >0 ) {
153 char str[100];
154 unsigned i1 = (unsigned char)he->h_addr_list[0][0];
155 unsigned i2 = (unsigned char)he->h_addr_list[0][1];
156 unsigned i3 = (unsigned char)he->h_addr_list[0][2];
157 sprintf ( str, "IP%03u.%03u.%03u.000", i1, i2, i3 );
158 orgId->AssignCat ( str );
159 }
160
161 // create organization
162 Handle(StepBasic_Organization) aOrg = new StepBasic_Organization;
163 Handle(TCollection_HAsciiString) oName = new TCollection_HAsciiString ( "Unspecified" );
164 Handle(TCollection_HAsciiString) oDescr = new TCollection_HAsciiString ( "" );
165 aOrg->Init ( Standard_True, orgId, oName, oDescr );
166
167 // construct person`s name
168 OSD_Process sys;
169 Standard_CString usr = sys.UserName().ToCString();
170#ifndef WNT
171 if ( usr ) {
172 struct passwd *pwd = getpwnam ( usr );
173 if ( pwd ) usr = pwd->pw_gecos;
174 }
175 else usr = "Unknown";
176#endif
177 TCollection_AsciiString user ( usr );
178 Handle(TCollection_HAsciiString) fname = new TCollection_HAsciiString ("");
179 Handle(TCollection_HAsciiString) lname = new TCollection_HAsciiString ("");
180 Handle(Interface_HArray1OfHAsciiString) mname;
181 TColStd_SequenceOfAsciiString names;
182 Standard_Integer i; // svv Jan11 2000 : porting on DEC
183 for ( i=1; ; i++ ) {
184 TCollection_AsciiString token = user.Token ( " \t", i );
185 if ( ! token.Length() ) break;
186 names.Append ( token );
187 }
188 if ( names.Length() >0 ) fname->AssignCat ( names.Value(1).ToCString() );
189 if ( names.Length() >1 ) lname->AssignCat ( names.Value(names.Length()).ToCString() );
190 if ( names.Length() >2 ) {
191 mname = new Interface_HArray1OfHAsciiString ( 1, names.Length()-2 );
192 for ( i=2; i < names.Length(); i++ )
193 mname->SetValue ( i-1, new TCollection_HAsciiString ( names.Value(i) ) );
194 }
195
196 // create a person
197 Handle(StepBasic_Person) aPerson = new StepBasic_Person;
198 Handle(TCollection_HAsciiString) uid = new TCollection_HAsciiString ( orgId );
199 uid->AssignCat ( "," );
200 uid->AssignCat ( TCollection_AsciiString ( sys.UserId() ).ToCString() );
201 Handle(Interface_HArray1OfHAsciiString) suffix, prefix;
202 aPerson->Init ( uid, Standard_True, lname, Standard_True, fname, ( ! mname.IsNull() ),
203 mname, Standard_False, suffix, Standard_False, prefix );
204
205 defPersonAndOrganization = new StepBasic_PersonAndOrganization;
206 defPersonAndOrganization->Init ( aPerson, aOrg );
207 }
208 return defPersonAndOrganization;
209}
210
211//=======================================================================
212//function : SetDefaultPersonAndOrganization
213//purpose :
214//=======================================================================
215
216void STEPConstruct_AP203Context::SetDefaultPersonAndOrganization (const Handle(StepBasic_PersonAndOrganization) &po)
217{
218 defPersonAndOrganization = po;
219}
220
221//=======================================================================
222//function : DefaultSecurityClassificationLevel
223//purpose :
224//=======================================================================
225
226Handle(StepBasic_SecurityClassificationLevel) STEPConstruct_AP203Context::DefaultSecurityClassificationLevel ()
227{
228 if ( defSecurityClassificationLevel.IsNull() ) {
229 defSecurityClassificationLevel = new StepBasic_SecurityClassificationLevel;
230 Handle(TCollection_HAsciiString) levName = new TCollection_HAsciiString ( "unclassified" );
231 defSecurityClassificationLevel->Init ( levName );
232 }
233 return defSecurityClassificationLevel;
234}
235
236//=======================================================================
237//function : SetDefaultSecurityClassificationLevel
238//purpose :
239//=======================================================================
240
241void STEPConstruct_AP203Context::SetDefaultSecurityClassificationLevel (const Handle(StepBasic_SecurityClassificationLevel) &scl)
242{
243 defSecurityClassificationLevel = scl;
244}
245
246//=======================================================================
247//function : RoleCreator
248//purpose :
249//=======================================================================
250
251Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleCreator () const
252{
253 return roleCreator;
254}
255
256//=======================================================================
257//function : RoleDesignOwner
258//purpose :
259//=======================================================================
260
261Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleDesignOwner () const
262{
263 return roleDesignOwner;
264}
265
266//=======================================================================
267//function : RoleDesignSupplier
268//purpose :
269//=======================================================================
270
271Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleDesignSupplier () const
272{
273 return roleDesignSupplier;
274}
275
276//=======================================================================
277//function : RoleClassificationOfficer
278//purpose :
279//=======================================================================
280
281Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleClassificationOfficer () const
282{
283 return roleClassificationOfficer;
284}
285
286//=======================================================================
287//function : RoleCreationDate
288//purpose :
289//=======================================================================
290
291Handle(StepBasic_DateTimeRole) STEPConstruct_AP203Context::RoleCreationDate () const
292{
293 return roleCreationDate;
294}
295
296//=======================================================================
297//function : RoleClassificationDate
298//purpose :
299//=======================================================================
300
301Handle(StepBasic_DateTimeRole) STEPConstruct_AP203Context::RoleClassificationDate () const
302{
303 return roleClassificationDate;
304}
305
306//=======================================================================
307//function : RoleApprover
308//purpose :
309//=======================================================================
310
311Handle(StepBasic_ApprovalRole) STEPConstruct_AP203Context::RoleApprover () const
312{
313 return roleApprover;
314}
315
316//=======================================================================
317//function : Init
318//purpose :
319//=======================================================================
320
321void STEPConstruct_AP203Context::Init (const Handle(StepShape_ShapeDefinitionRepresentation) &sdr)
322{
323 Clear();
324 STEPConstruct_Part SDRTool;
325 SDRTool.ReadSDR ( sdr );
326 InitPart ( SDRTool );
327}
328
329//=======================================================================
330//function : Init
331//purpose :
332//=======================================================================
333
334void STEPConstruct_AP203Context::Init (const STEPConstruct_Part &SDRTool)
335{
336 Clear();
337 InitPart ( SDRTool );
338}
339
340//=======================================================================
341//function : Init
342//purpose :
343//=======================================================================
344
345//void STEPConstruct_AP203Context::Init (const STEPConstruct_Part &SDRTool, const Handle(Interface_Model) &Model) {}
346
347//=======================================================================
348//function : Init
349//purpose :
350//=======================================================================
351
352void STEPConstruct_AP203Context::Init (const Handle(StepRepr_NextAssemblyUsageOccurrence) &NAUO)
353{
354 Clear();
355 InitAssembly ( NAUO );
356}
357
358//=======================================================================
359//function : GetCreator
360//purpose :
361//=======================================================================
362
363Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetCreator () const
364{
365 return myCreator;
366}
367
368//=======================================================================
369//function : GetDesignOwner
370//purpose :
371//=======================================================================
372
373Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetDesignOwner () const
374{
375 return myDesignOwner;
376}
377
378//=======================================================================
379//function : GetDesignSupplier
380//purpose :
381//=======================================================================
382
383Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetDesignSupplier () const
384{
385 return myDesignSupplier;
386}
387
388//=======================================================================
389//function : GetClassificationOfficer
390//purpose :
391//=======================================================================
392
393Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetClassificationOfficer () const
394{
395 return myClassificationOfficer;
396}
397
398//=======================================================================
399//function : GetSecurity
400//purpose :
401//=======================================================================
402
403Handle(StepAP203_CcDesignSecurityClassification) STEPConstruct_AP203Context::GetSecurity () const
404{
405 return mySecurity;
406}
407
408//=======================================================================
409//function : GetCreationDate
410//purpose :
411//=======================================================================
412
413Handle(StepAP203_CcDesignDateAndTimeAssignment) STEPConstruct_AP203Context::GetCreationDate () const
414{
415 return myCreationDate;
416}
417
418//=======================================================================
419//function : GetClassificationDate
420//purpose :
421//=======================================================================
422
423Handle(StepAP203_CcDesignDateAndTimeAssignment) STEPConstruct_AP203Context::GetClassificationDate () const
424{
425 return myClassificationDate;
426}
427
428//=======================================================================
429//function : GetApproval
430//purpose :
431//=======================================================================
432
433Handle(StepAP203_CcDesignApproval) STEPConstruct_AP203Context::GetApproval () const
434{
435 return myApproval;
436}
437
438//=======================================================================
439//function : GetApprover
440//purpose :
441//=======================================================================
442
443Handle(StepBasic_ApprovalPersonOrganization) STEPConstruct_AP203Context::GetApprover () const
444{
445 return myApprover;
446}
447
448//=======================================================================
449//function : GetApprovalDateTime
450//purpose :
451//=======================================================================
452
453Handle(StepBasic_ApprovalDateTime) STEPConstruct_AP203Context::GetApprovalDateTime () const
454{
455 return myApprovalDateTime;
456}
457
458//=======================================================================
459//function : GetProductCategoryRelationship
460//purpose :
461//=======================================================================
462
463Handle(StepBasic_ProductCategoryRelationship) STEPConstruct_AP203Context::GetProductCategoryRelationship () const
464{
465 return myProductCategoryRelationship;
466}
467
468//=======================================================================
469//function : Clear
470//purpose :
471//=======================================================================
472
473void STEPConstruct_AP203Context::Clear ()
474{
475 myCreator.Nullify();
476 myDesignOwner.Nullify();
477 myDesignSupplier.Nullify();
478 myClassificationOfficer.Nullify();
479 mySecurity.Nullify();
480 myCreationDate.Nullify();
481 myClassificationDate.Nullify();
482 myApproval.Nullify();
483
484// myApprover.Nullify();
485// myApprovalDateTime.Nullify();
486
487 myProductCategoryRelationship.Nullify();
488}
489
490//=======================================================================
491//function : InitRoles
492//purpose :
493//=======================================================================
494
495void STEPConstruct_AP203Context::InitRoles ()
496{
497 roleCreator = new StepBasic_PersonAndOrganizationRole;
498 roleDesignOwner = new StepBasic_PersonAndOrganizationRole;
499 roleDesignSupplier = new StepBasic_PersonAndOrganizationRole;
500 roleClassificationOfficer = new StepBasic_PersonAndOrganizationRole;
501 roleCreationDate = new StepBasic_DateTimeRole;
502 roleClassificationDate = new StepBasic_DateTimeRole;
503 roleApprover = new StepBasic_ApprovalRole;
504
505 roleCreator->Init ( new TCollection_HAsciiString ( "creator" ) );
506 roleDesignOwner->Init ( new TCollection_HAsciiString ( "design_owner" ) );
507 roleDesignSupplier->Init ( new TCollection_HAsciiString ( "design_supplier" ) );
508 roleClassificationOfficer->Init ( new TCollection_HAsciiString ( "classification_officer" ) );
509 roleCreationDate->Init ( new TCollection_HAsciiString ( "creation_date" ) );
510 roleClassificationDate->Init ( new TCollection_HAsciiString ( "classification_date" ) );
511 roleApprover->Init ( new TCollection_HAsciiString ( "approver" ) );
512}
513
514//=======================================================================
515//function : InitPart
516//purpose :
517//=======================================================================
518
519void STEPConstruct_AP203Context::InitPart (const STEPConstruct_Part &SDRTool)
520{
521 if ( myCreator.IsNull() ) {
522 myCreator = new StepAP203_CcDesignPersonAndOrganizationAssignment;
523 Handle(StepAP203_HArray1OfPersonOrganizationItem) items =
524 new StepAP203_HArray1OfPersonOrganizationItem (1, 2);
525 items->ChangeValue(1).SetValue ( SDRTool.PDF() );
526 items->ChangeValue(2).SetValue ( SDRTool.PD() );
527 myCreator->Init ( DefaultPersonAndOrganization(), RoleCreator(), items );
528 }
529
530 if ( myDesignOwner.IsNull() ) {
531 myDesignOwner = new StepAP203_CcDesignPersonAndOrganizationAssignment;
532 Handle(StepAP203_HArray1OfPersonOrganizationItem) items =
533 new StepAP203_HArray1OfPersonOrganizationItem (1, 1);
534 items->ChangeValue(1).SetValue ( SDRTool.Product() );
535 myDesignOwner->Init ( DefaultPersonAndOrganization(), RoleDesignOwner(), items );
536 }
537
538 if ( myDesignSupplier.IsNull() ) {
539 myDesignSupplier = new StepAP203_CcDesignPersonAndOrganizationAssignment;
540 Handle(StepAP203_HArray1OfPersonOrganizationItem) items =
541 new StepAP203_HArray1OfPersonOrganizationItem (1, 1);
542 items->ChangeValue(1).SetValue ( SDRTool.PDF() );
543 myDesignSupplier->Init ( DefaultPersonAndOrganization(), RoleDesignSupplier(), items );
544 }
545
546 if ( myCreationDate.IsNull() ) {
547 myCreationDate = new StepAP203_CcDesignDateAndTimeAssignment;
548 Handle(StepAP203_HArray1OfDateTimeItem) items =
549 new StepAP203_HArray1OfDateTimeItem (1, 1);
550 items->ChangeValue(1).SetValue ( SDRTool.PD() );
551 myCreationDate->Init ( DefaultDateAndTime(), RoleCreationDate(), items );
552 }
553
554 if ( mySecurity.IsNull() ) {
555
556 Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString ( "" );
557 Handle(TCollection_HAsciiString) aPurpose = new TCollection_HAsciiString ( "" );
558 Handle(StepBasic_SecurityClassification) sc = new StepBasic_SecurityClassification;
559 sc->Init ( aName, aPurpose, DefaultSecurityClassificationLevel() );
560
561 mySecurity = new StepAP203_CcDesignSecurityClassification;
562 Handle(StepAP203_HArray1OfClassifiedItem) items =
563 new StepAP203_HArray1OfClassifiedItem (1, 1);
564 items->ChangeValue(1).SetValue ( SDRTool.PDF() );
565 mySecurity->Init ( sc, items );
566 }
567 InitSecurityRequisites();
568
569 if ( myApproval.IsNull() ) {
570 myApproval = new StepAP203_CcDesignApproval;
571 Handle(StepAP203_HArray1OfApprovedItem) items =
572 new StepAP203_HArray1OfApprovedItem (1, 3);
573 items->ChangeValue(1).SetValue ( SDRTool.PDF() );
574 items->ChangeValue(2).SetValue ( SDRTool.PD() );
575 items->ChangeValue(3).SetValue ( mySecurity->AssignedSecurityClassification() );
576 myApproval->Init ( DefaultApproval(), items );
577 }
578 InitApprovalRequisites();
579
580 if ( myProductCategoryRelationship.IsNull() ) {
581 Handle(StepBasic_ProductCategory) PC = new StepBasic_ProductCategory;
582 Handle(TCollection_HAsciiString) PCName = new TCollection_HAsciiString ( "part" );
583 PC->Init ( PCName, Standard_False, 0 );
584
585 myProductCategoryRelationship = new StepBasic_ProductCategoryRelationship;
586 Handle(TCollection_HAsciiString) PCRName = new TCollection_HAsciiString ( "" );
587 Handle(TCollection_HAsciiString) PCRDescr = new TCollection_HAsciiString ( "" );
588 myProductCategoryRelationship->Init ( PCRName, Standard_True, PCRDescr, PC, SDRTool.PRPC() );
589 }
590}
591
592//=======================================================================
593//function : InitAssembly
594//purpose :
595//=======================================================================
596
597void STEPConstruct_AP203Context::InitAssembly (const Handle(StepRepr_NextAssemblyUsageOccurrence) &NAUO)
598{
599 if ( mySecurity.IsNull() ) {
600
601 Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString ( "" );
602 Handle(TCollection_HAsciiString) aPurpose = new TCollection_HAsciiString ( "" );
603 Handle(StepBasic_SecurityClassification) sc = new StepBasic_SecurityClassification;
604 sc->Init ( aName, aPurpose, DefaultSecurityClassificationLevel() );
605
606 mySecurity = new StepAP203_CcDesignSecurityClassification;
607 Handle(StepAP203_HArray1OfClassifiedItem) items =
608 new StepAP203_HArray1OfClassifiedItem (1, 1);
609 items->ChangeValue(1).SetValue ( NAUO );
610 mySecurity->Init ( sc, items );
611 }
612 InitSecurityRequisites();
613
614 if ( myApproval.IsNull() ) {
615 myApproval = new StepAP203_CcDesignApproval;
616 Handle(StepAP203_HArray1OfApprovedItem) items =
617 new StepAP203_HArray1OfApprovedItem (1, 1);
618 items->ChangeValue(1).SetValue ( mySecurity->AssignedSecurityClassification() );
619 myApproval->Init ( DefaultApproval(), items );
620 }
621 InitApprovalRequisites();
622}
623
624//=======================================================================
625//function : InitSecurityRequisites
626//purpose :
627//=======================================================================
628
629void STEPConstruct_AP203Context::InitSecurityRequisites ()
630{
631 if ( myClassificationOfficer.IsNull() ||
632 myClassificationOfficer->Items()->Value(1).Value() != mySecurity->AssignedSecurityClassification() ) {
633 myClassificationOfficer = new StepAP203_CcDesignPersonAndOrganizationAssignment;
634 Handle(StepAP203_HArray1OfPersonOrganizationItem) items =
635 new StepAP203_HArray1OfPersonOrganizationItem (1, 1);
636 items->ChangeValue(1).SetValue ( mySecurity->AssignedSecurityClassification() );
637 myClassificationOfficer->Init ( DefaultPersonAndOrganization(), RoleClassificationOfficer(), items );
638 }
639
640 if ( myClassificationDate.IsNull() ||
641 myClassificationDate->Items()->Value(1).Value() != mySecurity->AssignedSecurityClassification() ) {
642 myClassificationDate = new StepAP203_CcDesignDateAndTimeAssignment;
643 Handle(StepAP203_HArray1OfDateTimeItem) items =
644 new StepAP203_HArray1OfDateTimeItem (1, 1);
645 items->ChangeValue(1).SetValue ( mySecurity->AssignedSecurityClassification() );
646 myClassificationDate->Init ( DefaultDateAndTime(), RoleClassificationDate(), items );
647 }
648}
649
650//=======================================================================
651//function : InitApprovalRequisites
652//purpose :
653//=======================================================================
654
655void STEPConstruct_AP203Context::InitApprovalRequisites ()
656{
657 if ( myApprover.IsNull() ||
658 myApprover->AuthorizedApproval() != myApproval->AssignedApproval() ) {
659 myApprover = new StepBasic_ApprovalPersonOrganization;
660 StepBasic_PersonOrganizationSelect po;
661 po.SetValue ( DefaultPersonAndOrganization() );
662 myApprover->Init ( po, myApproval->AssignedApproval(), RoleApprover() );
663 }
664
665 if ( myApprovalDateTime.IsNull() ||
666 myApprovalDateTime->DatedApproval() != myApproval->AssignedApproval() ) {
667 myApprovalDateTime = new StepBasic_ApprovalDateTime;
668 StepBasic_DateTimeSelect dt;
669 dt.SetValue ( DefaultDateAndTime() );
670 myApprovalDateTime->Init ( dt, myApproval->AssignedApproval() );
671 }
672}