1 | var GLOBAL_BRANCH_METHOD_INDEX =-1;
|
2 | function EntitiesMapper() {
|
3 |
|
4 | }
|
5 |
|
6 | EntitiesMapper.toServerMethod = function (method) {
|
7 | var serverMethod = {
|
8 | uniqueId: method.uniqueId,
|
9 | displayName: method.srcData.displayName,
|
10 | position: method.srcData.position,
|
11 | endPosition: method.srcData.endPosition,
|
12 | hash: method.srcData.hash,
|
13 | sigHash: method.srcData.sigHash,
|
14 | meta: method.meta,
|
15 | techSpecificInfo: method.techSpecificInfo,
|
16 | idxInMapping: method.idxInMapping
|
17 | };
|
18 |
|
19 | return serverMethod;
|
20 | }
|
21 |
|
22 | EntitiesMapper.toServerBranch = function (branch) {
|
23 | var serverBranch = {
|
24 | uniqueId: branch.uniqueId,
|
25 | filename: branch.srcData.relativeFilename,
|
26 | type: branch.type,
|
27 | position: branch.srcData.position,
|
28 | endPosition: branch.srcData.endPosition,
|
29 | hash: branch.srcData.hash,
|
30 | index: branch.index,
|
31 | parentPosition: branch.srcData.parentPosition,
|
32 | enclosingMethodIdx: branch.enclosingMethodIdx
|
33 | }
|
34 | if(branch.enclosingMethodIdx == GLOBAL_BRANCH_METHOD_INDEX){
|
35 | serverBranch.techSpecificInfo = branch.techSpecificInfo
|
36 | }
|
37 |
|
38 | return serverBranch;
|
39 | }
|
40 |
|
41 | module.exports = EntitiesMapper; |
\ | No newline at end of file |