@contrail/flexplm 1.1.67-alpha.0 → 1.1.67-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@contrail/flexplm` are documented here.
4
+
5
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
+ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [1.1.67] - 2026-xx-xx
11
+
12
+ ### Added
13
+ - Added EventShortMessageStatus status values for adding items to projects functionality.
14
+
15
+ ### Changed
16
+ - Added optional `context` parameter to `TypeConversionUtils.isInboundCreatableFromObject` method to allow passing context data to map file `isInboundCreatable` functions.
17
+
18
+ ## [1.1.66] - (initial changelog entry)
19
+
20
+ - Initial changelog. Prior releases did not include a changelog.
21
+ See git history for changes predating this entry.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/flexplm",
3
- "version": "1.1.67-alpha.0",
3
+ "version": "1.1.67-alpha.1",
4
4
  "description": "Library used for integration with flexplm.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -3,6 +3,7 @@ export enum EventShortMessageStatus {
3
3
  FAILURE = 'Failure',
4
4
  CREATED = 'Created',
5
5
  ITEM_FAMILY_ID_MISSING = "Item_family_id_missing",
6
+ ITEM_FAMILY_NOT_FOUND = "Item_family_not_found",
6
7
  PROJECT_ITEM_NOT_FOUND = "Project_item_not_found",
7
8
  MISSING_IDENTIFIER_PROPERTIES = 'Missing_identifier_properties',
8
9
  MISSING_INPUT = 'Missing_input',
@@ -1,239 +1,244 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
3
- exports.mapping = {
4
- typeConversion: {
5
- vibe2flex: {
6
- 'custom-entity': {
7
- getMapKey: (entity) =>{
8
- const typePath = entity['typePath'];
9
- let mapKey = '';
10
- switch (typePath) {
11
- case 'custom-entity:pack':
12
- mapKey = 'packaging';
13
- break;
14
- case 'custom-entity:prefix':
15
- mapKey = 'prefix';
16
- break;
17
- case 'custom-entity:catName':
18
- mapKey = 'catName';
19
- break;
20
- case 'custom-entity:partnerOrg':
21
- mapKey = 'partnerOrg';
22
- break;
23
- case 'custom-entity:catFamily':
24
- mapKey = 'catFamily';
25
- break;
26
- case 'custom-entity:formName':
27
- mapKey = 'formName';
28
- break;
29
- }
30
-
31
- return mapKey;
32
- }
33
- }
34
- },
35
- flex2vibe: {
36
- LCSLast: {
37
- getMapKey: (object) =>{ return 'catName';}
38
- },
39
- LCSRevisableEntity : {
40
- getMapKey: (object) =>{
41
- const typePath = object['flexPLMTypePath'];
42
- let mapKey = '';
43
- switch (typePath) {
44
- case 'Revisable Entity\\packaging':
45
- mapKey = 'packaging';
46
- break
47
- case 'Revisable Entity\\prefix':
48
- mapKey = 'prefix';
49
- break
50
- };
51
- return mapKey;
52
- }
53
- }
54
- }
55
-
56
- },
57
- LCSProduct: {
58
- vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
59
- vibe2flex: {
60
- getClass: () => 'LCSProduct',
61
- getSoftType: (entity /*, dependencies*/) =>{
62
- const prodType = entity['prodType'];
63
- let val = '';
64
- switch (prodType) {
65
- case 'acc':
66
- val = 'Product\\Accesories';
67
- break;
68
- case 'app':
69
- val = 'Product\\Apparel';
70
- break;
71
- case 'eqp':
72
- val = 'Product\\Equipment';
73
- break;
74
- case 'foot':
75
- val = 'Product\\Footwear';
76
- break;
77
- }
78
-
79
- return val;
80
- },
81
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }, { processor: 'VALUE_TRANSFORM', functionTransformersKey: 'valueTransform' }],
82
- rekey: {
83
- productName: 'name',
84
- vibeIQIdentifier: 'itemNumber'
85
- },
86
- valueTransform: {
87
- transformEx: (row/*, dependencies*/) => {
88
- return row['otherProp'] + 'xxx';
89
- }
90
- }
91
-
92
- },
93
- flex2vibe: {
94
- getClass: () => 'item',
95
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
96
- rekey: {
97
- itemNumber: 'vibeIQIdentifier',
98
- name: 'productName',
99
- }
100
- }
101
- },
102
- LCSSKU: {
103
- vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
104
- vibe2flex: {
105
- getClass: () => 'LCSSKU',
106
- getSoftType: (entity /*, dependencies*/) =>{
107
- const prodType = entity['prodType'];
108
- let val = '';
109
- switch (prodType) {
110
- case 'acc':
111
- val = 'Product\\Accesories';
112
- break;
113
- case 'app':
114
- val = 'Product\\Apparel';
115
- break;
116
- case 'eqp':
117
- val = 'Product\\Equipment';
118
- break;
119
- case 'foot':
120
- val = 'Product\\Footwear';
121
- break;
122
- }
123
-
124
- return val;
125
- },
126
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
127
- rekey: {
128
- skuName: 'optionName',
129
- vibeIQIdentifier: 'itemNumber'
130
- }
131
- },
132
- flex2vibe: {
133
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
134
- rekey: {
135
- itemNumber: 'vibeIQIdentifier',
136
- optionName: 'skuName',
137
- }
138
- }
139
- },
140
-
141
- packaging: {
142
- vibe2flex: {
143
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
144
- rekey: {
145
- retailPackType: 'packType',
146
- retailIntroDate: 'introDate'
147
- },
148
- getSoftType: () => 'Revisable Entity\\packaging',
149
- getClass: () => 'LCSRevisableEntity'
150
- },
151
- flex2vibe: {
152
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
153
- rekey: {
154
- packType: 'retailPackType',
155
- introDate: 'retailIntroDate'
156
- },
157
- getClass: () => 'custom-entity',
158
- getSoftType: () => 'custom-entity:pack',
159
-
160
- }
161
- },
162
- prefix: {
163
- isInboundCreatable: () => true,
164
- vibe2flex: {
165
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
166
- rekey: {
167
- retailOwner: 'owner',
168
- retailIntroDate: 'introDate'
169
- },
170
- getSoftType: () => 'Revisable Entity\\prefix',
171
- getClass: () => 'LCSRevisableEntity'
172
- },
173
- flex2vibe: {
174
- transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
175
- rekey: {
176
- owner: 'retailOwner',
177
- introDate: 'retailIntroDate'
178
- },
179
- getClass: () => 'custom-entity',
180
- getSoftType: () => 'custom-entity:prefix',
181
-
182
- }
183
- },
184
- catName: {
185
- getIdentifierProperties: () => ['catName', 'catNumber'],
186
- getInformationalProperties: () => ['longName'],
187
- vibe2flex: {
188
- transformOrder: [],
189
- getSoftType: () => 'Last\\catName',
190
- getClass: () => 'LCSLast'
191
- },
192
- flex2vibe: {
193
- transformOrder: [],
194
- getClass: () => 'custom-entity',
195
- getSoftType: () => 'custom-entity:catName',
196
-
197
- }
198
- },
199
- partnerOrg: {
200
- vibe2flex: {
201
- transformOrder: [],
202
- getSoftType: () => 'Business Object\\partnerOrg',
203
- getClass: () => 'LCSLifecycleManaged'
204
- },
205
- flex2vibe: {
206
- transformOrder: [],
207
- getClass: () => 'custom-entity',
208
- getSoftType: () => 'custom-entity:partnerOrg',
209
-
210
- }
211
- },
212
- catFamily: {
213
- vibe2flex: {
214
- transformOrder: [],
215
- getSoftType: () => 'Revisable Entity\\catFamily',
216
- getClass: () => 'LCSRevisableEntity'
217
- },
218
- flex2vibe: {
219
- transformOrder: [],
220
- getClass: () => 'custom-entity',
221
- getSoftType: () => 'custom-entity:catFamily',
222
-
223
- }
224
- },
225
- formName: {
226
- vibe2flex: {
227
- transformOrder: [],
228
- getSoftType: () => 'Material\\form',
229
- getClass: () => 'LCSMaterial'
230
- },
231
- flex2vibe: {
232
- transformOrder: [],
233
- getClass: () => 'custom-entity',
234
- getSoftType: () => 'custom-entity:formName',
235
-
236
- }
237
- },
238
-
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ exports.mapping = {
4
+ typeConversion: {
5
+ vibe2flex: {
6
+ 'custom-entity': {
7
+ getMapKey: (entity) =>{
8
+ const typePath = entity['typePath'];
9
+ let mapKey = '';
10
+ switch (typePath) {
11
+ case 'custom-entity:pack':
12
+ mapKey = 'packaging';
13
+ break;
14
+ case 'custom-entity:prefix':
15
+ mapKey = 'prefix';
16
+ break;
17
+ case 'custom-entity:catName':
18
+ mapKey = 'catName';
19
+ break;
20
+ case 'custom-entity:partnerOrg':
21
+ mapKey = 'partnerOrg';
22
+ break;
23
+ case 'custom-entity:catFamily':
24
+ mapKey = 'catFamily';
25
+ break;
26
+ case 'custom-entity:formName':
27
+ mapKey = 'formName';
28
+ break;
29
+ }
30
+
31
+ return mapKey;
32
+ }
33
+ }
34
+ },
35
+ flex2vibe: {
36
+ LCSLast: {
37
+ getMapKey: (object) =>{ return 'catName';}
38
+ },
39
+ LCSRevisableEntity : {
40
+ getMapKey: (object) =>{
41
+ const typePath = object['flexPLMTypePath'];
42
+ let mapKey = '';
43
+ switch (typePath) {
44
+ case 'Revisable Entity\\packaging':
45
+ mapKey = 'packaging';
46
+ break
47
+ case 'Revisable Entity\\prefix':
48
+ mapKey = 'prefix';
49
+ break
50
+ };
51
+ return mapKey;
52
+ }
53
+ }
54
+ }
55
+
56
+ },
57
+ LCSProduct: {
58
+ vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
59
+ vibe2flex: {
60
+ getClass: () => 'LCSProduct',
61
+ getSoftType: (entity /*, dependencies*/) =>{
62
+ const prodType = entity['prodType'];
63
+ let val = '';
64
+ switch (prodType) {
65
+ case 'acc':
66
+ val = 'Product\\Accesories';
67
+ break;
68
+ case 'app':
69
+ val = 'Product\\Apparel';
70
+ break;
71
+ case 'eqp':
72
+ val = 'Product\\Equipment';
73
+ break;
74
+ case 'foot':
75
+ val = 'Product\\Footwear';
76
+ break;
77
+ }
78
+
79
+ return val;
80
+ },
81
+ transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }, { processor: 'VALUE_TRANSFORM', functionTransformersKey: 'valueTransform' }],
82
+ rekey: {
83
+ productName: 'name',
84
+ vibeIQIdentifier: 'itemNumber'
85
+ },
86
+ valueTransform: {
87
+ transformEx: (row/*, dependencies*/) => {
88
+ return row['otherProp'] + 'xxx';
89
+ }
90
+ }
91
+
92
+ },
93
+ flex2vibe: {
94
+ getClass: () => 'item',
95
+ transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
96
+ rekey: {
97
+ itemNumber: 'vibeIQIdentifier',
98
+ name: 'productName',
99
+ }
100
+ }
101
+ },
102
+ LCSSKU: {
103
+ vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
104
+ vibe2flex: {
105
+ getClass: () => 'LCSSKU',
106
+ getSoftType: (entity /*, dependencies*/) =>{
107
+ const prodType = entity['prodType'];
108
+ let val = '';
109
+ switch (prodType) {
110
+ case 'acc':
111
+ val = 'Product\\Accesories';
112
+ break;
113
+ case 'app':
114
+ val = 'Product\\Apparel';
115
+ break;
116
+ case 'eqp':
117
+ val = 'Product\\Equipment';
118
+ break;
119
+ case 'foot':
120
+ val = 'Product\\Footwear';
121
+ break;
122
+ }
123
+
124
+ return val;
125
+ },
126
+ transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
127
+ rekey: {
128
+ skuName: 'optionName',
129
+ vibeIQIdentifier: 'itemNumber'
130
+ }
131
+ },
132
+ flex2vibe: {
133
+ transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
134
+ rekey: {
135
+ itemNumber: 'vibeIQIdentifier',
136
+ optionName: 'skuName',
137
+ }
138
+ }
139
+ },
140
+
141
+ packaging: {
142
+ vibe2flex: {
143
+ transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
144
+ rekey: {
145
+ retailPackType: 'packType',
146
+ retailIntroDate: 'introDate'
147
+ },
148
+ getSoftType: () => 'Revisable Entity\\packaging',
149
+ getClass: () => 'LCSRevisableEntity'
150
+ },
151
+ flex2vibe: {
152
+ transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
153
+ rekey: {
154
+ packType: 'retailPackType',
155
+ introDate: 'retailIntroDate'
156
+ },
157
+ getClass: () => 'custom-entity',
158
+ getSoftType: () => 'custom-entity:pack',
159
+
160
+ }
161
+ },
162
+ prefix: {
163
+ isInboundCreatable: (object, context) => {
164
+ if (context && context.skipPrefix) {
165
+ return false;
166
+ }
167
+ return true;
168
+ },
169
+ vibe2flex: {
170
+ transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
171
+ rekey: {
172
+ retailOwner: 'owner',
173
+ retailIntroDate: 'introDate'
174
+ },
175
+ getSoftType: () => 'Revisable Entity\\prefix',
176
+ getClass: () => 'LCSRevisableEntity'
177
+ },
178
+ flex2vibe: {
179
+ transformOrder: [{ processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' }],
180
+ rekey: {
181
+ owner: 'retailOwner',
182
+ introDate: 'retailIntroDate'
183
+ },
184
+ getClass: () => 'custom-entity',
185
+ getSoftType: () => 'custom-entity:prefix',
186
+
187
+ }
188
+ },
189
+ catName: {
190
+ getIdentifierProperties: () => ['catName', 'catNumber'],
191
+ getInformationalProperties: () => ['longName'],
192
+ vibe2flex: {
193
+ transformOrder: [],
194
+ getSoftType: () => 'Last\\catName',
195
+ getClass: () => 'LCSLast'
196
+ },
197
+ flex2vibe: {
198
+ transformOrder: [],
199
+ getClass: () => 'custom-entity',
200
+ getSoftType: () => 'custom-entity:catName',
201
+
202
+ }
203
+ },
204
+ partnerOrg: {
205
+ vibe2flex: {
206
+ transformOrder: [],
207
+ getSoftType: () => 'Business Object\\partnerOrg',
208
+ getClass: () => 'LCSLifecycleManaged'
209
+ },
210
+ flex2vibe: {
211
+ transformOrder: [],
212
+ getClass: () => 'custom-entity',
213
+ getSoftType: () => 'custom-entity:partnerOrg',
214
+
215
+ }
216
+ },
217
+ catFamily: {
218
+ vibe2flex: {
219
+ transformOrder: [],
220
+ getSoftType: () => 'Revisable Entity\\catFamily',
221
+ getClass: () => 'LCSRevisableEntity'
222
+ },
223
+ flex2vibe: {
224
+ transformOrder: [],
225
+ getClass: () => 'custom-entity',
226
+ getSoftType: () => 'custom-entity:catFamily',
227
+
228
+ }
229
+ },
230
+ formName: {
231
+ vibe2flex: {
232
+ transformOrder: [],
233
+ getSoftType: () => 'Material\\form',
234
+ getClass: () => 'LCSMaterial'
235
+ },
236
+ flex2vibe: {
237
+ transformOrder: [],
238
+ getClass: () => 'custom-entity',
239
+ getSoftType: () => 'custom-entity:formName',
240
+
241
+ }
242
+ },
243
+
239
244
  };
@@ -640,5 +640,44 @@ describe('conversion-utils', () => {
640
640
  }
641
641
  });
642
642
 
643
+ it('should pass context to isInboundCreatable function', async () =>{
644
+ const spy = jest.spyOn(mapFileUtil, 'getMapFile')
645
+ .mockImplementation(async () =>{
646
+ return mapping;
647
+ });
648
+ const object = {
649
+ flexPLMObjectClass: 'LCSRevisableEntity',
650
+ flexPLMTypePath: 'Revisable Entity\\prefix'
651
+ }
652
+ const context = { skipPrefix: true };
653
+
654
+ try{
655
+ const results = await TypeConversionUtils.isInboundCreatableFromObject(TRANSFORM_MAP_FILE, mapFileUtil, object, context);
656
+ expect(results).toBeFalsy();
657
+
658
+ } finally {
659
+ spy.mockRestore();
660
+ }
661
+ });
662
+
663
+ it('should work without context parameter', async () =>{
664
+ const spy = jest.spyOn(mapFileUtil, 'getMapFile')
665
+ .mockImplementation(async () =>{
666
+ return mapping;
667
+ });
668
+ const object = {
669
+ flexPLMObjectClass: 'LCSRevisableEntity',
670
+ flexPLMTypePath: 'Revisable Entity\\prefix'
671
+ }
672
+
673
+ try{
674
+ const results = await TypeConversionUtils.isInboundCreatableFromObject(TRANSFORM_MAP_FILE, mapFileUtil, object);
675
+ expect(results).toBeTruthy();
676
+
677
+ } finally {
678
+ spy.mockRestore();
679
+ }
680
+ });
681
+
643
682
  });
644
683
  });
@@ -1,360 +1,360 @@
1
- import { MapFileUtil, TransformProcessor, TransformTask } from '@contrail/transform-data';
2
- import { TypeDefaults } from './type-defaults';
3
- import { MapUtil } from './map-utils';
4
-
5
- /** This class is helper functions to get the data for converting
6
- * VibeIQ entities to / from FlexPLM Objects
7
- */
8
- export class TypeConversionUtils {
9
- static NO_ENTITY_TYPE = 'Not able to determine the entity type of the entity object';
10
- static VIBE2FLEX_DIRECTION = 'vibe2flex';
11
- static FLEX2VIBE_DIRECTION = 'flex2vibe';
12
- constructor(){
13
- }
14
-
15
- /** Takes in a VibeIQ entity object and returns the correct FlexPLM
16
- * object class associated to the entity. Order of precedence
17
- * Property 'flexPLMObjectClass'
18
- * Map file entry in 'typeConversion:vibe2flex:<value>:getObjectClass()'
19
- * for value from 'entityClass' or root from 'typePath'
20
- * TypeDefaults.getDefaultObjectClass() function
21
- * @param transformMapFile id for mapFile
22
- * @param mapFileUtil class to get mapfile
23
- * @param entity
24
- * @returns Promise<string>
25
- */
26
- static async getObjectClass(transformMapFile, mapFileUtil, entity): Promise<string> {
27
- let objectClass = entity['flexPLMObjectClass'];
28
-
29
- if(objectClass){
30
- return objectClass;
31
- }
32
-
33
- if(transformMapFile){
34
- const mapSectionKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
35
- const mapData = await mapFileUtil.getMappingSection(transformMapFile, mapSectionKey, TypeConversionUtils.VIBE2FLEX_DIRECTION);
36
- if(mapData['getClass']){
37
- objectClass = await mapData['getClass'](entity);
38
- }
39
- }
40
-
41
- if(objectClass){
42
- return objectClass;
43
- }
44
- return TypeDefaults.getDefaultObjectClass(entity);
45
- }
46
-
47
- /** Takes in a VibeIQ entity object and returns the correct FlexPLM
48
- * FlexType associated to the entity. Order of precedence
49
- * Property 'flexPLMTypePath'
50
- * Map file entry in 'typeConversion:vibe2flex:<value>:getSoftType()'
51
- * for value from 'entityClass' or root from 'typePath'
52
- * TypeDefaults.getDefaultObjectTypePath() function
53
- *
54
- * @param transformMapFile id for mapFile
55
- * @param mapFileUtil class to get mapfile
56
- * @param entity VibeIQ entity
57
- * @returns Promise<string>
58
- */
59
- static async getObjectTypePath(transformMapFile, mapFileUtil, entity): Promise<string> {
60
- let typePath = entity['flexPLMTypePath'];
61
-
62
- if(typePath){
63
- return typePath;
64
- }
65
-
66
- if(transformMapFile){
67
- const mapSectionKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
68
- const mapData = await mapFileUtil.getMappingSection(transformMapFile, mapSectionKey, TypeConversionUtils.VIBE2FLEX_DIRECTION);
69
- if(mapData['getSoftType']){
70
- typePath = await mapData['getSoftType'](entity);
71
- }
72
- }
73
-
74
- if(typePath){
75
- return typePath;
76
- }
77
-
78
- return TypeDefaults.getDefaultObjectTypePath(entity);
79
- }
80
-
81
- /**Takes in a VibeIQ entity object and returns the correct
82
- * identifier properties. Order of precedence
83
- * Property 'flexPLMIdentifierProperties'
84
- * Map file entry in 'typeConversion:vibe2flex:<value>:getIdentifierProperties()'
85
- * for value from 'entityClass' or root from 'typePath'
86
- * TypeDefaults.getDefaultIdentifierProperties() function
87
- *
88
- * @param transformMapFile id for mapFile
89
- * @param mapFileUtil class to get mapfile
90
- * @param entity
91
- * @returns Promise<string[]>
92
- */
93
- static async getIdentifierProperties(transformMapFile, mapFileUtil, entity) :Promise<string[]> {
94
- let identifiers = entity['flexPLMIdentifierProperties'];
95
- if(identifiers){
96
- return identifiers
97
- }
98
-
99
- if(transformMapFile){
100
- const mapKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
101
-
102
- const mapData = await MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
103
- if(mapData && mapData['getIdentifierProperties']){
104
- identifiers = await mapData['getIdentifierProperties'](entity);
105
- }
106
- }
107
- if(identifiers){
108
- return identifiers
109
- }
110
-
111
- return TypeDefaults.getDefaultIdentifierProperties(entity);
112
- }
113
-
114
- /**Takes in a VibeIQ entity object and returns the correct
115
- * informational properties. Order of precedence
116
- * Property 'flexPLMInformationalProperties'
117
- * Map file entry in 'typeConversion:vibe2flex:<value>:getInformationalProperties()'
118
- * for value from 'entityClass' or root from 'typePath'
119
- * TypeDefaults.getDefaultObjectTypePath() function
120
- *
121
- * @param transformMapFile id for mapFile
122
- * @param mapFileUtil class to get mapfile
123
- * @param entity
124
- * @returns string
125
- */
126
- static async getInformationalProperties(transformMapFile, mapFileUtil, entity) :Promise<string[]> {
127
- let identifiers = entity['flexPLMInformationalProperties'];
128
- if(identifiers){
129
- return identifiers
130
- }
131
-
132
- if(transformMapFile){
133
- const mapKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
134
- const mapData = await MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
135
- if(mapData && mapData['getInformationalProperties']){
136
- identifiers = await mapData['getInformationalProperties'](entity);
137
- }
138
- }
139
- if(identifiers){
140
- return identifiers
141
- }
142
-
143
- return TypeDefaults.getDefaultInformationalProperties(entity);
144
- }
145
-
146
- /**Takes in a VibeIQ entity object and returns the correct mapKey
147
- * Order of precedence:
148
- * Map file entry in 'typeConversion:<direction>:<value>:getObjectClass()'
149
- * for value from 'entityClass' or root from 'typePath'
150
- * TypeDefaults.getDefaultObjectClass() function
151
- *
152
- * @param transformMapFile
153
- * @param mapFileUtil
154
- * @param entity
155
- * @param type
156
- * @param direction
157
- * @returns
158
- */
159
- static async getMapKey(transformMapFile, mapFileUtil: MapFileUtil, entity: any, direction: string): Promise<string> {
160
- if(transformMapFile){
161
- const type = this.getEntityType(entity);
162
- const mappingData = await mapFileUtil.getMappingSection(transformMapFile, 'typeConversion', direction);
163
- if(mappingData && mappingData[type] && mappingData[type]['getMapKey']){
164
- const mapKey = await mappingData[type]['getMapKey'](entity);
165
- return mapKey;
166
- }
167
-
168
- }
169
- return TypeDefaults.getDefaultObjectClass(entity);
170
- }
171
-
172
- /** Returns the VibeIQ entity type from an entity.
173
- * Throws error if it can't determine the entity type
174
- *
175
- * @param entity
176
- * @returns string
177
- */
178
- static getEntityType(entity: any) {
179
- let entityType = entity['entityType'];
180
- if (!entityType) {
181
- const typePath: string = entity['typePath'];
182
- if (typePath) {
183
- const types = typePath.split(':');
184
- if(types && types[0]){
185
- entityType = types[0];
186
- }
187
- }
188
- }
189
- if (!entityType) {
190
- throw Error(TypeConversionUtils.NO_ENTITY_TYPE);
191
- }
192
- return entityType;
193
- }
194
-
195
- /** Takes in a FlexPLM object and returns the correct VibeIQ entity
196
- * class associated to the object. Order of precedence
197
- * Property 'vibeIQEntityClass'
198
- * Map file entry in 'typeConversion:flex2vibe:<value>:getObjectClass()'
199
- * for value from 'objectClass'
200
- * TypeDefaults.getDefaultEntityClass() function
201
- *
202
- * @param fileId id for mapFile
203
- * @param mapFileUtil class to get mapfile
204
- * @param object FlexPLM object
205
- * @returns Promise<string>
206
- */
207
- static async getEntityClassFromObject(fileId, mapFileUtil, object): Promise<string>{
208
- let entityClass = object['vibeIQEntityClass'];
209
- if (entityClass){
210
- return entityClass;
211
- }
212
-
213
- if(fileId){
214
- const mapSectionKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
215
- const mapData = await mapFileUtil.getMappingSection(fileId, mapSectionKey, TypeConversionUtils.FLEX2VIBE_DIRECTION);
216
- if(mapData['getClass']){
217
- entityClass = await mapData['getClass'](object);
218
- }
219
- }
220
-
221
- if(entityClass){
222
- return entityClass;
223
- }
224
- return TypeDefaults.getDefaultEntityClass(object);
225
- }
226
-
227
- /** Takes in a FlexPLM object and returns the correct VibeIQ
228
- * type associated to the object. Order of precedence
229
- * Property 'vibeIQTypePath'
230
- * Map file entry in 'typeConversion:flex2vibe:<value>:getSoftType()'
231
- * for value from 'objectClass' or root from 'flexPLMTypePath'
232
- * TypeDefaults.getDefaultEntityTypePath() function
233
- *
234
- * @param transformMapFile id for mapFile
235
- * @param mapFileUtil class to get mapfile
236
- * @param entity VibeIQ entity
237
- * @returns Promise<string>
238
- */
239
- static async getEntityTypePathFromOjbect(fileId, mapFileUtil, object): Promise<string>{
240
- let typePath = object['vibeIQTypePath'];
241
-
242
- if(typePath){
243
- return typePath;
244
- }
245
-
246
- if(fileId){
247
- const mapSectionKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
248
- const mapData = await mapFileUtil.getMappingSection(fileId, mapSectionKey, TypeConversionUtils.FLEX2VIBE_DIRECTION);
249
- if(mapData['getSoftType']){
250
- typePath = await mapData['getSoftType'](object);
251
- }
252
- }
253
-
254
- if(typePath){
255
- return typePath;
256
- }
257
- return TypeDefaults.getDefaultEntityTypePath(object);
258
- }
259
-
260
- /**Takes in a FlexPLM object and returns the correct
261
- * identifier properties. Order of precedence
262
- * Property 'vibeIQIdentifierProperties'
263
- * Map file entry in 'typeConversion:flex2vibe:<value>:getIdentifierProperties()'
264
- * for value from 'objectClass'
265
- * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
266
- *
267
- * @param transformMapFile id for mapFile
268
- * @param mapFileUtil class to get mapfile
269
- * @param object
270
- * @returns Promise<string[]>
271
- */
272
- static async getIdentifierPropertiesFromObject(fileId, mapFileUtil: MapFileUtil, object: any): Promise<string[]>{
273
- let identifiers = object['vibeIQIdentifierProperties'];
274
- if(identifiers){
275
- return identifiers
276
- }
277
-
278
- if(fileId){
279
- const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
280
-
281
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
282
- if(mapData && mapData['getIdentifierProperties']){
283
- identifiers = await mapData['getIdentifierProperties'](object);
284
- }
285
- }
286
- if(identifiers){
287
- return identifiers
288
- }
289
-
290
- return TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
291
- }
292
-
293
- /**Takes in a FlexPLM object and returns the correct
294
- * identifier properties. Order of precedence
295
- * Property 'vibeIQIdentifierProperties'
296
- * Map file entry in 'typeConversion:flex2vibe:<value>:getInformationalProperties()'
297
- * for value from 'objectClass'
298
- * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
299
- *
300
- * @param transformMapFile id for mapFile
301
- * @param mapFileUtil class to get mapfile
302
- * @param object
303
- * @returns Promise<string[]>
304
- */
305
- static async getInformationalPropertiesFromObject(fileId, mapFileUtil: MapFileUtil, object: any): Promise<string[]>{
306
- let identifiers = object['vibeIQInformationalProperties'];
307
- if(identifiers){
308
- return identifiers
309
- }
310
-
311
- if(fileId){
312
- const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
313
-
314
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
315
- if(mapData && mapData['getInformationalProperties']){
316
- identifiers = await mapData['getInformationalProperties'](object);
317
- }
318
- }
319
- if(identifiers){
320
- return identifiers
321
- }
322
-
323
- return TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
324
- }
325
-
326
- static async getMapKeyFromObject(fileId, mapFileUtil: MapFileUtil, object: any, direction:string): Promise<string> {
327
- const type = this.getObjectType(object);
328
- if(fileId){
329
- const mappingData = await mapFileUtil.getMappingSection(fileId, 'typeConversion', direction);
330
- if(mappingData && mappingData[type] && mappingData[type]['getMapKey']){
331
- const mapKey = await mappingData[type]['getMapKey'](object);
332
- return mapKey;
333
- }
334
- return type;
335
- }
336
- //TODO use TypeDefaults?
337
- }
338
-
339
- static async isInboundCreatableFromObject(fileId: string, mapFileUtil: MapFileUtil, object: any): Promise<boolean> {
340
-
341
- let isInboundCreatable = false;
342
- if(fileId){
343
- const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
344
-
345
- const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
346
- if(mapData && mapData['isInboundCreatable']){
347
- isInboundCreatable = await mapData['isInboundCreatable'](object);
348
- }
349
- }
350
-
351
- return isInboundCreatable;
352
- }
353
-
354
- static getObjectType(object:any) {
355
- let objectType = object['flexPLMObjectClass'];
356
- return objectType;
357
- }
358
-
359
-
1
+ import { MapFileUtil, TransformProcessor, TransformTask } from '@contrail/transform-data';
2
+ import { TypeDefaults } from './type-defaults';
3
+ import { MapUtil } from './map-utils';
4
+
5
+ /** This class is helper functions to get the data for converting
6
+ * VibeIQ entities to / from FlexPLM Objects
7
+ */
8
+ export class TypeConversionUtils {
9
+ static NO_ENTITY_TYPE = 'Not able to determine the entity type of the entity object';
10
+ static VIBE2FLEX_DIRECTION = 'vibe2flex';
11
+ static FLEX2VIBE_DIRECTION = 'flex2vibe';
12
+ constructor(){
13
+ }
14
+
15
+ /** Takes in a VibeIQ entity object and returns the correct FlexPLM
16
+ * object class associated to the entity. Order of precedence
17
+ * Property 'flexPLMObjectClass'
18
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getObjectClass()'
19
+ * for value from 'entityClass' or root from 'typePath'
20
+ * TypeDefaults.getDefaultObjectClass() function
21
+ * @param transformMapFile id for mapFile
22
+ * @param mapFileUtil class to get mapfile
23
+ * @param entity
24
+ * @returns Promise<string>
25
+ */
26
+ static async getObjectClass(transformMapFile, mapFileUtil, entity): Promise<string> {
27
+ let objectClass = entity['flexPLMObjectClass'];
28
+
29
+ if(objectClass){
30
+ return objectClass;
31
+ }
32
+
33
+ if(transformMapFile){
34
+ const mapSectionKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
35
+ const mapData = await mapFileUtil.getMappingSection(transformMapFile, mapSectionKey, TypeConversionUtils.VIBE2FLEX_DIRECTION);
36
+ if(mapData['getClass']){
37
+ objectClass = await mapData['getClass'](entity);
38
+ }
39
+ }
40
+
41
+ if(objectClass){
42
+ return objectClass;
43
+ }
44
+ return TypeDefaults.getDefaultObjectClass(entity);
45
+ }
46
+
47
+ /** Takes in a VibeIQ entity object and returns the correct FlexPLM
48
+ * FlexType associated to the entity. Order of precedence
49
+ * Property 'flexPLMTypePath'
50
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getSoftType()'
51
+ * for value from 'entityClass' or root from 'typePath'
52
+ * TypeDefaults.getDefaultObjectTypePath() function
53
+ *
54
+ * @param transformMapFile id for mapFile
55
+ * @param mapFileUtil class to get mapfile
56
+ * @param entity VibeIQ entity
57
+ * @returns Promise<string>
58
+ */
59
+ static async getObjectTypePath(transformMapFile, mapFileUtil, entity): Promise<string> {
60
+ let typePath = entity['flexPLMTypePath'];
61
+
62
+ if(typePath){
63
+ return typePath;
64
+ }
65
+
66
+ if(transformMapFile){
67
+ const mapSectionKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
68
+ const mapData = await mapFileUtil.getMappingSection(transformMapFile, mapSectionKey, TypeConversionUtils.VIBE2FLEX_DIRECTION);
69
+ if(mapData['getSoftType']){
70
+ typePath = await mapData['getSoftType'](entity);
71
+ }
72
+ }
73
+
74
+ if(typePath){
75
+ return typePath;
76
+ }
77
+
78
+ return TypeDefaults.getDefaultObjectTypePath(entity);
79
+ }
80
+
81
+ /**Takes in a VibeIQ entity object and returns the correct
82
+ * identifier properties. Order of precedence
83
+ * Property 'flexPLMIdentifierProperties'
84
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getIdentifierProperties()'
85
+ * for value from 'entityClass' or root from 'typePath'
86
+ * TypeDefaults.getDefaultIdentifierProperties() function
87
+ *
88
+ * @param transformMapFile id for mapFile
89
+ * @param mapFileUtil class to get mapfile
90
+ * @param entity
91
+ * @returns Promise<string[]>
92
+ */
93
+ static async getIdentifierProperties(transformMapFile, mapFileUtil, entity) :Promise<string[]> {
94
+ let identifiers = entity['flexPLMIdentifierProperties'];
95
+ if(identifiers){
96
+ return identifiers
97
+ }
98
+
99
+ if(transformMapFile){
100
+ const mapKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
101
+
102
+ const mapData = await MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
103
+ if(mapData && mapData['getIdentifierProperties']){
104
+ identifiers = await mapData['getIdentifierProperties'](entity);
105
+ }
106
+ }
107
+ if(identifiers){
108
+ return identifiers
109
+ }
110
+
111
+ return TypeDefaults.getDefaultIdentifierProperties(entity);
112
+ }
113
+
114
+ /**Takes in a VibeIQ entity object and returns the correct
115
+ * informational properties. Order of precedence
116
+ * Property 'flexPLMInformationalProperties'
117
+ * Map file entry in 'typeConversion:vibe2flex:<value>:getInformationalProperties()'
118
+ * for value from 'entityClass' or root from 'typePath'
119
+ * TypeDefaults.getDefaultObjectTypePath() function
120
+ *
121
+ * @param transformMapFile id for mapFile
122
+ * @param mapFileUtil class to get mapfile
123
+ * @param entity
124
+ * @returns string
125
+ */
126
+ static async getInformationalProperties(transformMapFile, mapFileUtil, entity) :Promise<string[]> {
127
+ let identifiers = entity['flexPLMInformationalProperties'];
128
+ if(identifiers){
129
+ return identifiers
130
+ }
131
+
132
+ if(transformMapFile){
133
+ const mapKey = await this.getMapKey(transformMapFile, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
134
+ const mapData = await MapUtil.getFullMapSection(transformMapFile, mapFileUtil, mapKey);
135
+ if(mapData && mapData['getInformationalProperties']){
136
+ identifiers = await mapData['getInformationalProperties'](entity);
137
+ }
138
+ }
139
+ if(identifiers){
140
+ return identifiers
141
+ }
142
+
143
+ return TypeDefaults.getDefaultInformationalProperties(entity);
144
+ }
145
+
146
+ /**Takes in a VibeIQ entity object and returns the correct mapKey
147
+ * Order of precedence:
148
+ * Map file entry in 'typeConversion:<direction>:<value>:getObjectClass()'
149
+ * for value from 'entityClass' or root from 'typePath'
150
+ * TypeDefaults.getDefaultObjectClass() function
151
+ *
152
+ * @param transformMapFile
153
+ * @param mapFileUtil
154
+ * @param entity
155
+ * @param type
156
+ * @param direction
157
+ * @returns
158
+ */
159
+ static async getMapKey(transformMapFile, mapFileUtil: MapFileUtil, entity: any, direction: string): Promise<string> {
160
+ if(transformMapFile){
161
+ const type = this.getEntityType(entity);
162
+ const mappingData = await mapFileUtil.getMappingSection(transformMapFile, 'typeConversion', direction);
163
+ if(mappingData && mappingData[type] && mappingData[type]['getMapKey']){
164
+ const mapKey = await mappingData[type]['getMapKey'](entity);
165
+ return mapKey;
166
+ }
167
+
168
+ }
169
+ return TypeDefaults.getDefaultObjectClass(entity);
170
+ }
171
+
172
+ /** Returns the VibeIQ entity type from an entity.
173
+ * Throws error if it can't determine the entity type
174
+ *
175
+ * @param entity
176
+ * @returns string
177
+ */
178
+ static getEntityType(entity: any) {
179
+ let entityType = entity['entityType'];
180
+ if (!entityType) {
181
+ const typePath: string = entity['typePath'];
182
+ if (typePath) {
183
+ const types = typePath.split(':');
184
+ if(types && types[0]){
185
+ entityType = types[0];
186
+ }
187
+ }
188
+ }
189
+ if (!entityType) {
190
+ throw Error(TypeConversionUtils.NO_ENTITY_TYPE);
191
+ }
192
+ return entityType;
193
+ }
194
+
195
+ /** Takes in a FlexPLM object and returns the correct VibeIQ entity
196
+ * class associated to the object. Order of precedence
197
+ * Property 'vibeIQEntityClass'
198
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getObjectClass()'
199
+ * for value from 'objectClass'
200
+ * TypeDefaults.getDefaultEntityClass() function
201
+ *
202
+ * @param fileId id for mapFile
203
+ * @param mapFileUtil class to get mapfile
204
+ * @param object FlexPLM object
205
+ * @returns Promise<string>
206
+ */
207
+ static async getEntityClassFromObject(fileId, mapFileUtil, object): Promise<string>{
208
+ let entityClass = object['vibeIQEntityClass'];
209
+ if (entityClass){
210
+ return entityClass;
211
+ }
212
+
213
+ if(fileId){
214
+ const mapSectionKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
215
+ const mapData = await mapFileUtil.getMappingSection(fileId, mapSectionKey, TypeConversionUtils.FLEX2VIBE_DIRECTION);
216
+ if(mapData['getClass']){
217
+ entityClass = await mapData['getClass'](object);
218
+ }
219
+ }
220
+
221
+ if(entityClass){
222
+ return entityClass;
223
+ }
224
+ return TypeDefaults.getDefaultEntityClass(object);
225
+ }
226
+
227
+ /** Takes in a FlexPLM object and returns the correct VibeIQ
228
+ * type associated to the object. Order of precedence
229
+ * Property 'vibeIQTypePath'
230
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getSoftType()'
231
+ * for value from 'objectClass' or root from 'flexPLMTypePath'
232
+ * TypeDefaults.getDefaultEntityTypePath() function
233
+ *
234
+ * @param transformMapFile id for mapFile
235
+ * @param mapFileUtil class to get mapfile
236
+ * @param entity VibeIQ entity
237
+ * @returns Promise<string>
238
+ */
239
+ static async getEntityTypePathFromOjbect(fileId, mapFileUtil, object): Promise<string>{
240
+ let typePath = object['vibeIQTypePath'];
241
+
242
+ if(typePath){
243
+ return typePath;
244
+ }
245
+
246
+ if(fileId){
247
+ const mapSectionKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
248
+ const mapData = await mapFileUtil.getMappingSection(fileId, mapSectionKey, TypeConversionUtils.FLEX2VIBE_DIRECTION);
249
+ if(mapData['getSoftType']){
250
+ typePath = await mapData['getSoftType'](object);
251
+ }
252
+ }
253
+
254
+ if(typePath){
255
+ return typePath;
256
+ }
257
+ return TypeDefaults.getDefaultEntityTypePath(object);
258
+ }
259
+
260
+ /**Takes in a FlexPLM object and returns the correct
261
+ * identifier properties. Order of precedence
262
+ * Property 'vibeIQIdentifierProperties'
263
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getIdentifierProperties()'
264
+ * for value from 'objectClass'
265
+ * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
266
+ *
267
+ * @param transformMapFile id for mapFile
268
+ * @param mapFileUtil class to get mapfile
269
+ * @param object
270
+ * @returns Promise<string[]>
271
+ */
272
+ static async getIdentifierPropertiesFromObject(fileId, mapFileUtil: MapFileUtil, object: any): Promise<string[]>{
273
+ let identifiers = object['vibeIQIdentifierProperties'];
274
+ if(identifiers){
275
+ return identifiers
276
+ }
277
+
278
+ if(fileId){
279
+ const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
280
+
281
+ const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
282
+ if(mapData && mapData['getIdentifierProperties']){
283
+ identifiers = await mapData['getIdentifierProperties'](object);
284
+ }
285
+ }
286
+ if(identifiers){
287
+ return identifiers
288
+ }
289
+
290
+ return TypeDefaults.getDefaultIdentifierPropertiesFromObject(object);
291
+ }
292
+
293
+ /**Takes in a FlexPLM object and returns the correct
294
+ * identifier properties. Order of precedence
295
+ * Property 'vibeIQIdentifierProperties'
296
+ * Map file entry in 'typeConversion:flex2vibe:<value>:getInformationalProperties()'
297
+ * for value from 'objectClass'
298
+ * TypeDefaults.getDefaultIdentifierPropertiesFromObject() function
299
+ *
300
+ * @param transformMapFile id for mapFile
301
+ * @param mapFileUtil class to get mapfile
302
+ * @param object
303
+ * @returns Promise<string[]>
304
+ */
305
+ static async getInformationalPropertiesFromObject(fileId, mapFileUtil: MapFileUtil, object: any): Promise<string[]>{
306
+ let identifiers = object['vibeIQInformationalProperties'];
307
+ if(identifiers){
308
+ return identifiers
309
+ }
310
+
311
+ if(fileId){
312
+ const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
313
+
314
+ const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
315
+ if(mapData && mapData['getInformationalProperties']){
316
+ identifiers = await mapData['getInformationalProperties'](object);
317
+ }
318
+ }
319
+ if(identifiers){
320
+ return identifiers
321
+ }
322
+
323
+ return TypeDefaults.getDefaultInformationalPropertiesFromObject(object);
324
+ }
325
+
326
+ static async getMapKeyFromObject(fileId, mapFileUtil: MapFileUtil, object: any, direction:string): Promise<string> {
327
+ const type = this.getObjectType(object);
328
+ if(fileId){
329
+ const mappingData = await mapFileUtil.getMappingSection(fileId, 'typeConversion', direction);
330
+ if(mappingData && mappingData[type] && mappingData[type]['getMapKey']){
331
+ const mapKey = await mappingData[type]['getMapKey'](object);
332
+ return mapKey;
333
+ }
334
+ return type;
335
+ }
336
+ //TODO use TypeDefaults?
337
+ }
338
+
339
+ static async isInboundCreatableFromObject(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean> {
340
+
341
+ let isInboundCreatable = false;
342
+ if(fileId){
343
+ const mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
344
+
345
+ const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
346
+ if(mapData && mapData['isInboundCreatable']){
347
+ isInboundCreatable = await mapData['isInboundCreatable'](object, context);
348
+ }
349
+ }
350
+
351
+ return isInboundCreatable;
352
+ }
353
+
354
+ static getObjectType(object:any) {
355
+ let objectType = object['flexPLMObjectClass'];
356
+ return objectType;
357
+ }
358
+
359
+
360
360
  }