Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ADITO_Update_Upgrade
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab Maintenance 28.03.2025 | 20:00 - 23:00 MEZ
Show more breadcrumbs
xrm
ADITO_Update_Upgrade
Commits
7f9cafbc
Commit
7f9cafbc
authored
3 years ago
by
Sebastian Listl
Browse files
Options
Downloads
Patches
Plain Diff
1083903 importer standard communications
parent
2c73e0b8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
process/ImporterMappingFunctions_lib/process.js
+60
-20
60 additions, 20 deletions
process/ImporterMappingFunctions_lib/process.js
with
60 additions
and
20 deletions
process/ImporterMappingFunctions_lib/process.js
+
60
−
20
View file @
7f9cafbc
import
(
"
Keyword_lib
"
);
import
(
"
Communication_lib
"
);
import
(
"
system.fileIO
"
);
import
(
"
system.SQLTYPES
"
);
import
(
"
system.text
"
);
...
...
@@ -480,41 +482,79 @@ function iKeywordAttribute (pObject)
* @return {Boolean} true
* */
function
iComm
(
pObject
)
{
if
(
!
this
.
doIfCheck
(
pObject
))
return
true
;
function
iComm
(
pObject
)
{
if
(
!
this
.
doIfCheck
(
pObject
))
return
true
;
var
address
=
this
.
InputRecord
[
pObject
.
Address
];
var
medium
=
this
.
InputRecord
[
pObject
.
Medium
];
var
contact
=
this
.
InputRecord
[
pObject
.
ContactID
];
var
standard
=
"
0
"
;
if
(
address
==
undefined
)
address
=
this
.
resolveSymbol
(
pObject
,
pObject
.
Address
);
if
(
medium
==
undefined
)
medium
=
this
.
resolveSymbol
(
pObject
,
pObject
.
Medium
);
if
(
contact
==
undefined
)
contact
=
this
.
resolveSymbol
(
pObject
,
pObject
.
ContactID
);
if
(
pObject
.
Standard
)
standard
=
"
1
"
;
if
(
address
==
undefined
)
address
=
this
.
resolveSymbol
(
pObject
,
pObject
.
Address
);
if
(
medium
==
undefined
)
medium
=
this
.
resolveSymbol
(
pObject
,
pObject
.
Medium
);
if
(
contact
==
undefined
)
contact
=
this
.
resolveSymbol
(
pObject
,
pObject
.
ContactID
);
if
(
pObject
.
Standard
)
standard
=
"
1
"
;
if
(
!
address
||
!
medium
||
!
contact
)
return
true
;
if
(
!
address
||
!
medium
||
!
contact
)
return
true
;
const
COMMUNICATION
=
this
.
getTableCase
(
"
communication
"
);
const
COMMUNICATIONID
=
this
.
getColumnCase
(
"
communicationid
"
);
const
OBJECT_ROWID
=
this
.
getColumnCase
(
"
object_rowid
"
);
const
OBJECT_TYPE
=
this
.
getColumnCase
(
"
object_type
"
);
const
ISSTANDARD
=
this
.
getColumnCase
(
"
isstandard
"
);
const
MEDIUM_ID
=
this
.
getColumnCase
(
"
medium_id
"
);
const
ADDR
=
this
.
getColumnCase
(
"
addr
"
);
var
keywordAttr
=
new
KeywordAttribute
(
$KeywordRegistry
.
communicationMedium
(),
"
category
"
);
mediumCategory
=
new
SqlBuilder
(
this
.
Config
.
AliasTo
)
.
select
(
"
AB_KEYWORD_ATTRIBUTERELATION.
"
+
keywordAttr
.
dbField
)
.
from
(
"
AB_KEYWORD_ATTRIBUTERELATION
"
)
.
join
(
"
AB_KEYWORD_ENTRY
"
,
"
AB_KEYWORD_ATTRIBUTERELATION.AB_KEYWORD_ENTRY_ID = AB_KEYWORD_ENTRY.AB_KEYWORD_ENTRYID
"
)
.
where
(
"
AB_KEYWORD_ATTRIBUTERELATION.AB_KEYWORD_ATTRIBUTE_ID
"
,
keywordAttr
.
id
)
.
and
(
"
AB_KEYWORD_ENTRY.KEYID
"
,
medium
)
.
cell
();
var
sql
=
"
select
"
+
this
.
getColumnCase
(
"
communicationid
"
)
+
"
,
"
+
this
.
getColumnCase
(
"
addr
"
)
+
"
from
"
+
this
.
getTableCase
(
"
communication
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
object_rowid
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
medium_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
isstandard
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
object_type
"
)
+
"
= ?
"
;
var
existingData
=
db
.
array
(
db
.
ROW
,
[
sql
,
[[
contact
,
SQLTYPES
.
CHAR
],
[
medium
,
SQLTYPES
.
CHAR
],
//TODO: define types dynamically and not hardcoded
[
standard
,
SQLTYPES
.
SMALLINT
],
[
"
Contact
"
,
SQLTYPES
.
CHAR
]]],
this
.
Config
.
AliasTo
,
0
,
this
.
getConfiguredTimeout
());
var
sql
=
new
SqlBuilder
(
this
.
Config
.
AliasTo
)
.
select
([
COMMUNICATIONID
,
ADDR
,
MEDIUM_ID
,
ISSTANDARD
])
.
from
(
COMMUNICATION
)
.
where
(
COMMUNICATION
+
"
.
"
+
OBJECT_ROWID
,
contact
)
.
and
(
COMMUNICATION
+
"
.
"
+
OBJECT_TYPE
,
"
Contact
"
)
.
and
(
COMMUNICATION
+
"
.
"
+
MEDIUM_ID
,
CommUtil
.
getMediumIdsByCategory
(
mediumCategory
),
SqlBuilder
.
IN
());
var
existingData
=
sql
.
table
(
null
,
null
,
this
.
getConfiguredTimeout
());
var
hasStandardAddr
=
existingData
.
some
(
function
(
commData
)
{
return
commData
[
3
]
==
"
1
"
;
//check if there is already a standard address for the medium category
});
if
(
hasStandardAddr
)
{
standard
=
"
0
"
;
}
var
existingComm
=
existingData
.
find
(
function
(
commData
)
{
return
commData
[
2
]
==
medium
;
//check if communication with the same medium exists
});
if
(
existing
Data
.
length
==
0
)
if
(
!
existing
Comm
)
{
var
columns
=
[
this
.
getColumnCase
(
"
communicationid
"
),
this
.
getColumnCase
(
"
addr
"
),
this
.
getColumnCase
(
"
medium_id
"
),
this
.
getColumnCase
(
"
object_rowid
"
),
this
.
getColumnCase
(
"
isstandard
"
)];
this
.
insertData
(
this
.
getTableCase
(
"
communication
"
),
columns
,
null
,
[
util
.
getNewUUID
(),
address
,
medium
,
contact
,
standard
],
this
.
Config
.
AliasTo
);
var
columns
=
[
COMMUNICATIONID
,
ADDR
,
MEDIUM_ID
,
OBJECT_ROWID
,
ISSTANDARD
];
this
.
insertData
(
COMMUNICATION
,
columns
,
null
,
[
util
.
getNewUUID
(),
address
,
medium
,
contact
,
standard
],
this
.
Config
.
AliasTo
);
}
else
{
var
existingId
=
existing
Data
[
0
];
var
existingAddress
=
existing
Data
[
1
];
var
existingId
=
existing
Comm
[
0
];
var
existingAddress
=
existing
Comm
[
1
];
if
(
address
!=
existingAddress
)
{
var
cond
=
this
.
getColumnCase
(
"
communicationid
"
)
+
"
= '
"
+
existingId
+
"
'
"
;
this
.
updateData
(
this
.
getTableCase
(
"
communication
"
),
[
this
.
getColumnCase
(
"
addr
"
)
],
null
,
[
address
],
cond
,
this
.
Config
.
AliasTo
);
var
cond
=
COMMUNICATIONID
+
"
= '
"
+
existingId
+
"
'
"
;
this
.
updateData
(
COMMUNICATION
,
[
ADDR
],
null
,
[
address
],
cond
,
this
.
Config
.
AliasTo
);
}
}
return
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment