File tree Expand file tree Collapse file tree
packages/core/src/openbim/IDSSpecifications/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,7 +52,10 @@ export class IDSSpecification implements IDSSpecificationData {
5252 * @returns An array representing the test results.
5353 * If no requirements are defined for the specification, an empty array is returned.
5454 */
55- async test ( modelIds : RegExp [ ] ) {
55+ async test (
56+ modelIds : RegExp [ ] ,
57+ config : { skipIfFails : boolean } = { skipIfFails : true } ,
58+ ) {
5659 const result : IDSCheckResult = new FRAGS . DataMap ( ) ;
5760
5861 if ( this . requirements . size === 0 ) return result ;
@@ -69,7 +72,7 @@ export class IDSSpecification implements IDSSpecificationData {
6972 // Test applicable elements against requirements
7073 const requirementPromises = [ ] ;
7174 for ( const requirement of this . requirements ) {
72- requirementPromises . push ( requirement . test ( entities , result ) ) ;
75+ requirementPromises . push ( requirement . test ( entities , result , config ) ) ;
7376 }
7477
7578 await Promise . all ( requirementPromises ) ;
Original file line number Diff line number Diff line change @@ -73,14 +73,23 @@ export class IDSAttribute extends IDSFacet {
7373 // Test cases from buildingSMART repo have been tested and they all match with the expected result
7474 // All invalid cases have been treated as failures
7575 // FragmentsGroup do not hold some of the entities used in the tests
76- async test ( items : ModelIdMap , collector : ModelIdDataMap < IDSItemCheckResult > ) {
76+ async test (
77+ items : ModelIdMap ,
78+ collector : ModelIdDataMap < IDSItemCheckResult > ,
79+ config : { skipIfFails : boolean } = { skipIfFails : true } ,
80+ ) {
7781 const fragments = this . _components . get ( FragmentsManager ) ;
7882 for ( const [ modelId , localIds ] of Object . entries ( items ) ) {
7983 const model = fragments . list . get ( modelId ) ;
8084 if ( ! model ) continue ;
8185 const data = await model . getItemsData ( [ ...localIds ] ) ;
8286 for ( const item of data ) {
83- const checks = this . getItemChecks ( collector , modelId , item ) ;
87+ const checks = this . getItemChecks (
88+ collector ,
89+ modelId ,
90+ item ,
91+ config . skipIfFails ,
92+ ) ;
8493 if ( ! checks ) continue ;
8594
8695 const attrNames = Object . keys ( item ) ;
Original file line number Diff line number Diff line change @@ -102,7 +102,11 @@ export class IDSEntity extends IDSFacet {
102102 }
103103 }
104104
105- async test ( items : ModelIdMap , collector : ModelIdDataMap < IDSItemCheckResult > ) {
105+ async test (
106+ items : ModelIdMap ,
107+ collector : ModelIdDataMap < IDSItemCheckResult > ,
108+ config : { skipIfFails : boolean } ,
109+ ) {
106110 const fragments = this . _components . get ( FragmentsManager ) ;
107111 for ( const [ modelId , localIds ] of Object . entries ( items ) ) {
108112 const model = fragments . list . get ( modelId ) ;
@@ -111,7 +115,12 @@ export class IDSEntity extends IDSFacet {
111115 const data = await model . getItemsData ( [ ...localIds ] ) ;
112116 for ( const item of data ) {
113117 if ( ! ( "value" in item . _category ) ) continue ;
114- const checks = this . getItemChecks ( collector , modelId , item ) ;
118+ const checks = this . getItemChecks (
119+ collector ,
120+ modelId ,
121+ item ,
122+ config . skipIfFails ,
123+ ) ;
115124 if ( ! checks ) continue ;
116125 await this . evalName ( item . _category . value , checks ) ;
117126 await this . evalPredefinedType ( modelId , item , checks ) ;
Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ export abstract class IDSFacet {
107107 collector : ModelIdDataMap < IDSItemCheckResult > ,
108108 modelId : string ,
109109 item : FRAGS . ItemData ,
110+ skipIfFails : boolean ,
110111 ) {
111112 if (
112113 ! ( "value" in item . _localId && typeof item . _localId . value === "number" )
@@ -121,7 +122,7 @@ export abstract class IDSFacet {
121122 }
122123
123124 let result = modelItemResults . get ( item . _localId . value ) ;
124- if ( result ) {
125+ if ( result && skipIfFails ) {
125126 // If there are results already and the item didn't pass
126127 // return null to skip further checks
127128 if ( ! result . pass ) return null ;
@@ -176,6 +177,7 @@ export abstract class IDSFacet {
176177 abstract test (
177178 items : ModelIdMap ,
178179 collector : ModelIdDataMap < IDSItemCheckResult > ,
180+ config : { skipIfFails : boolean } ,
179181 ) : Promise < void > ;
180182
181183 abstract serialize ( type : "applicability" | "requirement" ) : string ;
Original file line number Diff line number Diff line change @@ -89,7 +89,11 @@ export class IDSMaterial extends IDSFacet {
8989 }
9090 }
9191
92- async test ( items : ModelIdMap , collector : ModelIdDataMap < IDSItemCheckResult > ) {
92+ async test (
93+ items : ModelIdMap ,
94+ collector : ModelIdDataMap < IDSItemCheckResult > ,
95+ config : { skipIfFails : boolean } = { skipIfFails : true } ,
96+ ) {
9397 const fragments = this . _components . get ( FragmentsManager ) ;
9498 for ( const [ modelId , localIds ] of Object . entries ( items ) ) {
9599 const model = fragments . list . get ( modelId ) ;
@@ -107,7 +111,12 @@ export class IDSMaterial extends IDSFacet {
107111 } ) ;
108112
109113 for ( const item of data ) {
110- const checks = this . getItemChecks ( collector , modelId , item ) ;
114+ const checks = this . getItemChecks (
115+ collector ,
116+ modelId ,
117+ item ,
118+ config . skipIfFails ,
119+ ) ;
111120 if ( ! checks ) continue ;
112121
113122 // If it doesn't have associations
Original file line number Diff line number Diff line change @@ -153,7 +153,11 @@ export class IDSProperty extends IDSFacet {
153153 }
154154 }
155155
156- async test ( items : ModelIdMap , collector : ModelIdDataMap < IDSItemCheckResult > ) {
156+ async test (
157+ items : ModelIdMap ,
158+ collector : ModelIdDataMap < IDSItemCheckResult > ,
159+ config : { skipIfFails : boolean } = { skipIfFails : true } ,
160+ ) {
157161 const fragments = this . _components . get ( FragmentsManager ) ;
158162 for ( const [ modelId , localIds ] of Object . entries ( items ) ) {
159163 const model = fragments . list . get ( modelId ) ;
@@ -168,7 +172,12 @@ export class IDSProperty extends IDSFacet {
168172 } ) ;
169173
170174 for ( const item of data ) {
171- const checks = this . getItemChecks ( collector , modelId , item ) ;
175+ const checks = this . getItemChecks (
176+ collector ,
177+ modelId ,
178+ item ,
179+ config . skipIfFails ,
180+ ) ;
172181 if ( ! checks ) continue ;
173182
174183 const sets = await this . getPsets ( item ) ;
You can’t perform that action at this time.
0 commit comments