@contrail/flexplm 1.3.2-alpha.328325d → 1.3.2-alpha.3ffe557
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/lib/cli/commands/compile.d.ts +4 -0
- package/lib/cli/commands/compile.js +73 -0
- package/lib/cli/commands/compile.spec.d.ts +1 -0
- package/lib/cli/commands/compile.spec.js +80 -0
- package/lib/cli/commands/create.d.ts +5 -0
- package/lib/cli/commands/create.js +77 -0
- package/lib/cli/commands/create.spec.d.ts +1 -0
- package/lib/cli/commands/create.spec.js +78 -0
- package/lib/cli/commands/upload.d.ts +17 -0
- package/lib/cli/commands/upload.js +228 -0
- package/lib/cli/commands/upload.spec.d.ts +1 -0
- package/lib/cli/commands/upload.spec.js +88 -0
- package/lib/cli/index.d.ts +5 -0
- package/lib/cli/index.js +70 -0
- package/lib/cli/index.spec.d.ts +1 -0
- package/lib/cli/index.spec.js +85 -0
- package/lib/cli/template/mapping-template.ts.template +62 -0
- package/lib/entity-processor/base-entity-processor.d.ts +47 -5
- package/lib/entity-processor/base-entity-processor.js +53 -28
- package/lib/entity-processor/base-entity-processor.spec.js +1 -103
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/interfaces/mapping-file.d.ts +460 -0
- package/lib/interfaces/mapping-file.js +2 -0
- package/lib/publish/base-process-publish-assortment.d.ts +25 -0
- package/lib/publish/base-process-publish-assortment.js +60 -6
- package/lib/publish/base-process-publish-assortment.spec.js +22 -4
- package/lib/publish/mockData.js +5 -0
- package/lib/transform/identifier-conversion-spec-mockData.js +34 -6
- package/lib/transform/identifier-conversion.d.ts +36 -0
- package/lib/transform/identifier-conversion.js +36 -0
- package/lib/transform/identifier-conversion.spec.js +4 -0
- package/lib/util/config-defaults.js +3 -0
- package/lib/util/config-defaults.spec.js +9 -0
- package/lib/util/data-converter-spec-mockData.js +17 -3
- package/lib/util/data-converter.d.ts +97 -0
- package/lib/util/data-converter.js +133 -1
- package/lib/util/data-converter.spec.js +68 -0
- package/lib/util/error-response-object.d.ts +5 -0
- package/lib/util/error-response-object.js +7 -0
- package/lib/util/event-short-message-status.js +1 -0
- package/lib/util/federation.js +8 -0
- package/lib/util/flexplm-connect.d.ts +7 -0
- package/lib/util/flexplm-connect.js +14 -0
- package/lib/util/logger-config.js +1 -0
- package/lib/util/map-util-spec-mockData.js +17 -3
- package/lib/util/map-utils.d.ts +27 -0
- package/lib/util/map-utils.js +27 -0
- package/lib/util/thumbnail-util.d.ts +21 -0
- package/lib/util/thumbnail-util.js +28 -1
- package/lib/util/thumbnail-util.spec.js +6 -0
- package/lib/util/type-conversion-utils-spec-mockData.js +3 -3
- package/lib/util/type-conversion-utils.d.ts +140 -0
- package/lib/util/type-conversion-utils.js +143 -0
- package/lib/util/type-defaults.d.ts +58 -0
- package/lib/util/type-defaults.js +58 -0
- package/lib/util/type-defaults.spec.js +5 -5
- package/lib/util/type-utils.d.ts +21 -0
- package/lib/util/type-utils.js +23 -0
- package/lib/util/type-utils.spec.js +2 -0
- package/package.json +21 -6
- package/scripts/copy-template.js +10 -0
- package/.github/pull_request_template.md +0 -31
- package/.github/workflows/flexplm-lib.yml +0 -27
- package/.github/workflows/publish-to-npm.yml +0 -121
- package/CHANGELOG.md +0 -35
- package/publish.bat +0 -5
- package/publish.sh +0 -5
- package/src/entity-processor/base-entity-processor.spec.ts +0 -582
- package/src/entity-processor/base-entity-processor.ts +0 -565
- package/src/flexplm-request.ts +0 -28
- package/src/flexplm-utils.spec.ts +0 -27
- package/src/flexplm-utils.ts +0 -29
- package/src/index.ts +0 -22
- package/src/interfaces/interfaces.ts +0 -122
- package/src/interfaces/item-family-changes.ts +0 -67
- package/src/interfaces/publish-change-data.ts +0 -43
- package/src/publish/base-process-publish-assortment-callback.ts +0 -50
- package/src/publish/base-process-publish-assortment.spec.ts +0 -1992
- package/src/publish/base-process-publish-assortment.ts +0 -1134
- package/src/publish/mockData.ts +0 -4561
- package/src/transform/identifier-conversion-spec-mockData.ts +0 -496
- package/src/transform/identifier-conversion.spec.ts +0 -354
- package/src/transform/identifier-conversion.ts +0 -282
- package/src/util/config-defaults.spec.ts +0 -350
- package/src/util/config-defaults.ts +0 -93
- package/src/util/data-converter-spec-mockData.ts +0 -231
- package/src/util/data-converter.spec.ts +0 -1041
- package/src/util/data-converter.ts +0 -762
- package/src/util/error-response-object.spec.ts +0 -116
- package/src/util/error-response-object.ts +0 -50
- package/src/util/event-short-message-status.ts +0 -22
- package/src/util/federation.ts +0 -172
- package/src/util/flexplm-connect.spec.ts +0 -132
- package/src/util/flexplm-connect.ts +0 -208
- package/src/util/logger-config.ts +0 -20
- package/src/util/map-util-spec-mockData.ts +0 -231
- package/src/util/map-utils.spec.ts +0 -103
- package/src/util/map-utils.ts +0 -41
- package/src/util/mockData.ts +0 -101
- package/src/util/thumbnail-util.spec.ts +0 -508
- package/src/util/thumbnail-util.ts +0 -272
- package/src/util/type-conversion-utils-spec-mockData.ts +0 -271
- package/src/util/type-conversion-utils.spec.ts +0 -968
- package/src/util/type-conversion-utils.ts +0 -460
- package/src/util/type-defaults.spec.ts +0 -669
- package/src/util/type-defaults.ts +0 -281
- package/src/util/type-utils.spec.ts +0 -227
- package/src/util/type-utils.ts +0 -144
- package/tsconfig.json +0 -24
- package/tslint.json +0 -57
|
@@ -1,460 +0,0 @@
|
|
|
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 | undefined> {
|
|
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 async isOutboundCreatableFromEntity(fileId: string, mapFileUtil: MapFileUtil, entity: any, context?: any): Promise<boolean> {
|
|
355
|
-
|
|
356
|
-
let isOutboundCreatable = true;
|
|
357
|
-
|
|
358
|
-
if (!fileId) {
|
|
359
|
-
return isOutboundCreatable;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
let mapKey: string | undefined;
|
|
363
|
-
try {
|
|
364
|
-
mapKey = await this.getMapKey(fileId, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
|
|
365
|
-
} catch {
|
|
366
|
-
return isOutboundCreatable;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
if (!mapKey) {
|
|
370
|
-
return isOutboundCreatable;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
|
|
374
|
-
if (mapData && mapData['isOutboundCreatable']) {
|
|
375
|
-
isOutboundCreatable = await mapData['isOutboundCreatable'](entity, context);
|
|
376
|
-
}
|
|
377
|
-
return isOutboundCreatable;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/** Takes in a FlexPLM object and determines whether inbound
|
|
381
|
-
* images should be synced. In most cases, the creation owning system
|
|
382
|
-
* will also control image syncing. Defaults to false if no mapping exists.
|
|
383
|
-
* Map file entry in '<mapKey>:syncInboundImages()'
|
|
384
|
-
*
|
|
385
|
-
* @param fileId id for mapFile
|
|
386
|
-
* @param mapFileUtil class to get mapfile
|
|
387
|
-
* @param object FlexPLM object
|
|
388
|
-
* @param context optional context object
|
|
389
|
-
* @returns Promise<boolean>
|
|
390
|
-
*/
|
|
391
|
-
static async syncInboundImages(fileId: string, mapFileUtil: MapFileUtil, object: any, context?: any): Promise<boolean> {
|
|
392
|
-
|
|
393
|
-
let syncImages = false;
|
|
394
|
-
|
|
395
|
-
if (!fileId) {
|
|
396
|
-
return syncImages;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
let mapKey: string | undefined;
|
|
400
|
-
try {
|
|
401
|
-
mapKey = await this.getMapKeyFromObject(fileId, mapFileUtil, object, TypeConversionUtils.FLEX2VIBE_DIRECTION);
|
|
402
|
-
} catch {
|
|
403
|
-
return syncImages;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
if (!mapKey) {
|
|
407
|
-
return syncImages;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
|
|
411
|
-
if (mapData && mapData['syncInboundImages']) {
|
|
412
|
-
syncImages = await mapData['syncInboundImages'](object, context);
|
|
413
|
-
}
|
|
414
|
-
return syncImages;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/** Takes in a VibeIQ entity object and determines whether outbound
|
|
418
|
-
* images should be synced. In most cases, the creation owning system
|
|
419
|
-
* will also control image syncing. Defaults to true if no mapping exists.
|
|
420
|
-
* Map file entry in '<mapKey>:syncOutboundImages()'
|
|
421
|
-
*
|
|
422
|
-
* @param fileId id for mapFile
|
|
423
|
-
* @param mapFileUtil class to get mapfile
|
|
424
|
-
* @param entity VibeIQ entity
|
|
425
|
-
* @param context optional context object
|
|
426
|
-
* @returns Promise<boolean>
|
|
427
|
-
*/
|
|
428
|
-
static async syncOutboundImages(fileId: string, mapFileUtil: MapFileUtil, entity: any, context?: any): Promise<boolean> {
|
|
429
|
-
|
|
430
|
-
let syncImages = true;
|
|
431
|
-
|
|
432
|
-
if (!fileId) {
|
|
433
|
-
return syncImages;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
let mapKey: string | undefined;
|
|
437
|
-
try {
|
|
438
|
-
mapKey = await this.getMapKey(fileId, mapFileUtil, entity, TypeConversionUtils.VIBE2FLEX_DIRECTION);
|
|
439
|
-
} catch {
|
|
440
|
-
return syncImages;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
if (!mapKey) {
|
|
444
|
-
return syncImages;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
const mapData = await MapUtil.getFullMapSection(fileId, mapFileUtil, mapKey);
|
|
448
|
-
if (mapData && mapData['syncOutboundImages']) {
|
|
449
|
-
syncImages = await mapData['syncOutboundImages'](entity, context);
|
|
450
|
-
}
|
|
451
|
-
return syncImages;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
static getObjectType(object:any) {
|
|
455
|
-
let objectType = object['flexPLMObjectClass'];
|
|
456
|
-
return objectType;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|