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
Show more breadcrumbs
xrm
ADITO_Update_Upgrade
Commits
1ae83915
"readme.md" did not exist on "2ef76932d737f91dba86293819bafda54d849762"
Commit
1ae83915
authored
5 years ago
by
Daniel Tran
Browse files
Options
Downloads
Patches
Plain Diff
Code formatted.
parent
d4c62709
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
+218
-187
218 additions, 187 deletions
process/ImporterMappingFunctions_lib/process.js
with
218 additions
and
187 deletions
process/ImporterMappingFunctions_lib/process.js
+
218
−
187
View file @
1ae83915
...
...
@@ -18,17 +18,17 @@ import("Importer_lib");
│ toolkit methods for the import handler │
│ DO NOT TOUCH - use lib_importerCustomMappingFunctions │
└───────────────────────────────────────────────────────────────┘
*/
*/
/*
* Values of the mapping line:
* Keyword req -- the column index with the new keyword value
* Container req -- the keyword container for the keyword lookup
*
* @name iKeyword
* @param {Object} pObject req the mapping line
* @return {Boolean} true
**/
* Values of the mapping line:
* Keyword req -- the column index with the new keyword value
* Container req -- the keyword container for the keyword lookup
*
* @name iKeyword
* @param {Object} pObject req the mapping line
* @return {Boolean} true
**/
function
iKeyword
(
pObject
)
{
if
(
!
this
.
doIfCheck
(
pObject
))
return
true
;
...
...
@@ -46,7 +46,7 @@ function iKeyword(pObject) {
if
(
id
==
""
||
id
==
null
)
{
id
=
util
.
getNewUUID
();
var
columns
=
[
this
.
getColumnCase
(
"
ab_keyword_entryid
"
),
this
.
getColumnCase
(
"
keyid
"
),
this
.
getColumnCase
(
"
container
"
),
this
.
getColumnCase
(
"
title
"
),
this
.
getColumnCase
(
"
sorting
"
),
this
.
getColumnCase
(
"
isactive
"
),
this
.
getColumnCase
(
"
isessential
"
)];
this
.
getColumnCase
(
"
title
"
),
this
.
getColumnCase
(
"
sorting
"
),
this
.
getColumnCase
(
"
isactive
"
),
this
.
getColumnCase
(
"
isessential
"
)];
sql
=
"
select max(coalesce(sorting, 0))+1 from ab_keyword_entry where container = ?
"
;
var
sort
=
db
.
cell
([
sql
,
[[
container
,
SQLTYPES
.
VARCHAR
]]],
this
.
Config
.
AliasTo
);
if
(
sort
==
""
)
sort
=
"
0
"
;
...
...
@@ -90,7 +90,7 @@ function iAttribute(pObject) {
var
valueColumn
=
""
;
var
attributes
=
attribute
.
split
(
"
.
"
);
var
columns
=
[
this
.
getColumnCase
(
"
ab_attributeid
"
),
this
.
getColumnCase
(
"
attribute_parent_id
"
),
this
.
getColumnCase
(
"
attribute_name
"
),
this
.
getColumnCase
(
"
attribute_type
"
),
this
.
getColumnCase
(
"
attribute_level
"
),
this
.
getColumnCase
(
"
attribute_active
"
)];
this
.
getColumnCase
(
"
attribute_type
"
),
this
.
getColumnCase
(
"
attribute_level
"
),
this
.
getColumnCase
(
"
attribute_active
"
)];
var
type
=
$AttributeTypes
.
GROUP
.
toString
();
switch
(
atype
)
{
case
$AttributeTypes
.
TEXT
.
toString
():
...
...
@@ -113,13 +113,18 @@ function iAttribute(pObject) {
return
true
;
}
if
(
this
.
FuncBuffer
.
iAttribute
==
undefined
)
this
.
FuncBuffer
.
iAttribute
=
{
childs
:
{}};
if
(
this
.
FuncBuffer
.
iAttribute
==
undefined
)
this
.
FuncBuffer
.
iAttribute
=
{
childs
:
{}
};
var
pathToFollow
=
this
.
FuncBuffer
.
iAttribute
;
for
(
var
i
=
0
;
i
<
attributes
.
length
;
i
++
)
{
if
(
pathToFollow
[
"
childs
"
][
attributes
[
i
]]
!=
undefined
)
{
var
id
=
pathToFollow
[
"
childs
"
][
attributes
[
i
]][
"
id
"
];
}
else
{
pathToFollow
[
"
childs
"
][
attributes
[
i
]]
=
{
id
:
id
,
childs
:
{}};
pathToFollow
[
"
childs
"
][
attributes
[
i
]]
=
{
id
:
id
,
childs
:
{}
};
if
(
i
==
0
)
{
var
parent
=
"
NULL
"
;
var
sql
=
"
select
"
+
this
.
getColumnCase
(
"
ab_attributeid
"
)
+
"
from
"
+
this
.
getTableCase
(
"
ab_attribute
"
)
+
"
where
"
...
...
@@ -128,7 +133,7 @@ function iAttribute(pObject) {
}
else
{
parent
=
pathToFollow
[
"
id
"
];
sql
=
"
select
"
+
this
.
getColumnCase
(
"
ab_attributeid
"
)
+
"
from
"
+
this
.
getTableCase
(
"
ab_attribute
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
attribute_name
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
attribute_parent_id
"
)
+
"
= ?
"
;
+
this
.
getColumnCase
(
"
attribute_name
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
attribute_parent_id
"
)
+
"
= ?
"
;
id
=
db
.
cell
([
sql
,
[[
attributes
[
i
],
SQLTYPES
.
VARCHAR
],
[
parent
,
SQLTYPES
.
CHAR
]]],
this
.
Config
.
AliasTo
);
}
if
(
id
==
""
||
id
==
null
)
{
...
...
@@ -146,7 +151,7 @@ function iAttribute(pObject) {
if
(
otype
)
{
var
aid
=
id
;
sql
=
"
select
"
+
this
.
getColumnCase
(
"
ab_attributeusageid
"
)
+
"
from
"
+
this
.
getTableCase
(
"
ab_attributeusage
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
ab_attribute_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
object_type
"
)
+
"
= ?
"
;
+
this
.
getColumnCase
(
"
ab_attribute_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
object_type
"
)
+
"
= ?
"
;
id
=
db
.
cell
([
sql
,
[[
aid
,
SQLTYPES
.
CHAR
],
[
otype
,
SQLTYPES
.
VARCHAR
]]],
this
.
Config
.
AliasTo
);
if
(
id
==
""
||
id
==
null
)
{
columns
=
[
this
.
getColumnCase
(
"
ab_attributeusageid
"
),
this
.
getColumnCase
(
"
ab_attribute_id
"
),
this
.
getColumnCase
(
"
object_type
"
)];
...
...
@@ -155,13 +160,13 @@ function iAttribute(pObject) {
if
(
value
&&
oid
)
{
sql
=
"
select
"
+
this
.
getColumnCase
(
"
ab_attributerelationid
"
)
+
"
from
"
+
this
.
getTableCase
(
"
ab_attributerelation
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
ab_attribute_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
object_rowid
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
object_type
"
)
+
"
= ?
"
;
+
this
.
getColumnCase
(
"
ab_attribute_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
object_rowid
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
object_type
"
)
+
"
= ?
"
;
id
=
db
.
cell
([
sql
,
[[
aid
,
SQLTYPES
.
CHAR
],
[
oid
,
SQLTYPES
.
CHAR
],
[
otype
,
SQLTYPES
.
VARCHAR
]]],
this
.
Config
.
AliasTo
);
if
(
id
==
""
||
id
==
null
)
{
columns
=
[
this
.
getColumnCase
(
"
ab_attributerelationid
"
),
this
.
getColumnCase
(
"
ab_attribute_id
"
),
this
.
getColumnCase
(
"
object_type
"
),
this
.
getColumnCase
(
"
object_rowid
"
),
valueColumn
];
this
.
insertData
(
this
.
getTableCase
(
"
ab_attributerelation
"
),
columns
,
null
,
[
util
.
getNewUUID
(),
aid
,
otype
,
oid
,
value
],
this
.
Config
.
AliasTo
);
this
.
getColumnCase
(
"
object_rowid
"
),
valueColumn
];
this
.
insertData
(
this
.
getTableCase
(
"
ab_attributerelation
"
),
columns
,
null
,
[
util
.
getNewUUID
(),
aid
,
otype
,
oid
,
value
],
this
.
Config
.
AliasTo
);
}
else
if
(
this
.
Config
.
ImportCommand
.
indexOf
(
"
update
"
)
!=
-
1
)
{
cond
=
this
.
getColumnCase
(
"
ab_attributerelationid
"
)
+
"
= '
"
+
id
+
"
'
"
;
this
.
updateData
(
this
.
getTableCase
(
"
ab_attributerelation
"
),
[
valueColumn
],
null
,
[
value
],
cond
,
this
.
Config
.
AliasTo
);
...
...
@@ -216,7 +221,7 @@ function iKeywordAttribute(pObject) {
}
var
sql
=
"
select
"
+
this
.
getColumnCase
(
"
ab_keyword_attributeid
"
)
+
"
from
"
+
this
.
getTableCase
(
"
ab_keyword_attribute
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
name
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
container
"
)
+
"
= ?
"
;
+
"
where
"
+
this
.
getColumnCase
(
"
name
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
container
"
)
+
"
= ?
"
;
var
aid
=
db
.
cell
([
sql
,
[[
attribute
,
SQLTYPES
.
VARCHAR
],
[
container
,
SQLTYPES
.
VARCHAR
]]],
this
.
Config
.
AliasTo
);
if
(
aid
==
""
||
aid
==
null
)
{
aid
=
util
.
getNewUUID
();
...
...
@@ -226,16 +231,16 @@ function iKeywordAttribute(pObject) {
if
(
keyword
&&
value
)
{
sql
=
"
select
"
+
this
.
getColumnCase
(
"
keyid
"
)
+
"
from
"
+
this
.
getTableCase
(
"
ab_keyword_entry
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
keyid
"
)
+
"
= ?
"
;
+
this
.
getColumnCase
(
"
keyid
"
)
+
"
= ?
"
;
var
kid
=
db
.
cell
([
sql
,
[[
keyword
,
SQLTYPES
.
CHAR
]]],
this
.
Config
.
AliasTo
);
if
(
kid
==
""
||
kid
==
null
)
{
sql
=
"
select
"
+
this
.
getColumnCase
(
"
keyid
"
)
+
"
from
"
+
this
.
getTableCase
(
"
ab_keyword_entry
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
container
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
title
"
)
+
"
= ?
"
;
+
this
.
getColumnCase
(
"
container
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
title
"
)
+
"
= ?
"
;
kid
=
db
.
cell
([
sql
,
[[
container
,
SQLTYPES
.
VARCHAR
],
[
keyword
,
SQLTYPES
.
VARCHAR
]]],
this
.
Config
.
AliasTo
);
if
(
kid
==
""
||
kid
==
null
)
{
columns
=
[
this
.
getColumnCase
(
"
ab_keyword_entryid
"
),
this
.
getColumnCase
(
"
keyid
"
),
this
.
getColumnCase
(
"
container
"
),
this
.
getColumnCase
(
"
title
"
),
this
.
getColumnCase
(
"
sorting
"
),
this
.
getColumnCase
(
"
isactive
"
),
this
.
getColumnCase
(
"
isessential
"
)];
this
.
getColumnCase
(
"
title
"
),
this
.
getColumnCase
(
"
sorting
"
),
this
.
getColumnCase
(
"
isactive
"
),
this
.
getColumnCase
(
"
isessential
"
)];
sql
=
"
select max(coalesce(sorting, 0))+1 from ab_keyword_entry where container = ?
"
;
var
sort
=
db
.
cell
([
sql
,
[[
container
,
SQLTYPES
.
VARCHAR
]]],
this
.
Config
.
AliasTo
);
if
(
sort
==
""
)
sort
=
"
0
"
;
...
...
@@ -246,11 +251,11 @@ function iKeywordAttribute(pObject) {
}
sql
=
"
select
"
+
this
.
getColumnCase
(
"
ab_keyword_attributerelationid
"
)
+
"
from
"
+
this
.
getTableCase
(
"
ab_keyword_attributerelation
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
ab_keyword_entry_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
ab_keyword_attribute_id
"
)
+
"
= ?
"
;
+
"
where
"
+
this
.
getColumnCase
(
"
ab_keyword_entry_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
ab_keyword_attribute_id
"
)
+
"
= ?
"
;
id
=
db
.
cell
([
sql
,
[[
kid
,
SQLTYPES
.
CHAR
],
[
aid
,
SQLTYPES
.
CHAR
]]],
this
.
Config
.
AliasTo
);
if
(
id
==
""
||
id
==
null
)
{
columns
=
[
this
.
getColumnCase
(
"
ab_keyword_attributerelationid
"
),
this
.
getColumnCase
(
"
ab_keyword_entry_id
"
),
this
.
getColumnCase
(
"
ab_keyword_attribute_id
"
),
valueColumn
];
this
.
getColumnCase
(
"
ab_keyword_attribute_id
"
),
valueColumn
];
id
=
util
.
getNewUUID
();
this
.
insertData
(
this
.
getTableCase
(
"
ab_keyword_attributerelation
"
),
columns
,
null
,
[
id
,
kid
,
aid
,
value
],
this
.
Config
.
AliasTo
);
}
else
{
...
...
@@ -289,13 +294,13 @@ function iComm(pObject) {
if
(
!
address
||
!
medium
||
!
contact
)
return
true
;
var
sql
=
"
select
"
+
this
.
getColumnCase
(
"
communicationid
"
)
+
"
from
"
+
this
.
getTableCase
(
"
communication
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
contact_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
medium_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
isstandard
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
addr
"
)
+
"
= ?
"
+
"
where
"
+
this
.
getColumnCase
(
"
contact_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
medium_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
isstandard
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
addr
"
)
+
"
= ?
"
var
id
=
db
.
cell
([
sql
,
[[
contact
,
SQLTYPES
.
CHAR
],
[
medium
,
SQLTYPES
.
CHAR
],
//TODO: define types dynamically and not hardcoded
[
standard
,
SQLTYPES
.
SMALLINT
],
[
address
,
SQLTYPES
.
VARCHAR
]]],
this
.
Config
.
AliasTo
);
[
standard
,
SQLTYPES
.
SMALLINT
],
[
address
,
SQLTYPES
.
VARCHAR
]]],
this
.
Config
.
AliasTo
);
if
(
id
==
""
||
id
==
null
)
{
var
columns
=
[
this
.
getColumnCase
(
"
communicationid
"
),
this
.
getColumnCase
(
"
addr
"
),
this
.
getColumnCase
(
"
medium_id
"
),
this
.
getColumnCase
(
"
contact_id
"
),
this
.
getColumnCase
(
"
isstandard
"
)];
this
.
getColumnCase
(
"
medium_id
"
),
this
.
getColumnCase
(
"
contact_id
"
),
this
.
getColumnCase
(
"
isstandard
"
)];
this
.
insertData
(
this
.
getTableCase
(
"
communication
"
),
columns
,
null
,
[
util
.
getNewUUID
(),
address
,
medium
,
contact
,
standard
],
this
.
Config
.
AliasTo
);
}
return
true
;
...
...
@@ -327,8 +332,8 @@ function iCommRestriction(pObject) {
if
(
!
medium
||
!
contact
||
!
type
)
return
true
;
var
sql
=
"
select top 1
"
+
this
.
getColumnCase
(
"
type
"
)
+
"
from
"
+
this
.
getTableCase
(
"
commrestriction
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
contact_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
medium
"
)
+
"
= ? order by
"
+
this
.
getColumnCase
(
"
date_edit
"
)
+
"
desc,
"
+
this
.
getColumnCase
(
"
date_new
"
)
+
"
desc
"
;
+
"
where
"
+
this
.
getColumnCase
(
"
contact_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
medium
"
)
+
"
= ? order by
"
+
this
.
getColumnCase
(
"
date_edit
"
)
+
"
desc,
"
+
this
.
getColumnCase
(
"
date_new
"
)
+
"
desc
"
;
var
id
=
db
.
cell
([
sql
,
[[
contact
,
SQLTYPES
.
CHAR
],
[
medium
,
SQLTYPES
.
CHAR
]]],
this
.
Config
.
AliasTo
);
if
(
id
==
""
||
id
==
null
||
id
!=
type
)
{
if
(
reason
==
undefined
||
reason
==
null
)
reason
=
"
NULL
"
;
...
...
@@ -348,35 +353,61 @@ function iCommRestriction(pObject) {
* @param {Object} pObject req the mapping line
* @return {Boolean} true
* */
function
iActivityLink
(
pObject
)
{
if
(
!
this
.
doIfCheck
(
pObject
))
return
true
;
var
aid
=
this
.
InputRecord
[
pObject
.
ActivityID
];
if
(
aid
==
undefined
)
aid
=
this
.
resolveSymbol
(
pObject
,
pObject
.
ActivityID
);
var
otype
=
this
.
InputRecord
[
pObject
.
OType
];
if
(
otype
==
undefined
)
otype
=
this
.
resolveSymbol
(
pObject
,
pObject
.
OType
);
var
oid
=
this
.
InputRecord
[
pObject
.
OID
];
if
(
oid
==
undefined
)
oid
=
this
.
resolveSymbol
(
pObject
,
pObject
.
OID
);
function
iActivityLink
(
pObject
)
{
if
(
!
this
.
doIfCheck
(
pObject
))
return
true
;
var
activityId
=
this
.
InputRecord
[
pObject
.
ActivityID
];
if
(
activityId
==
undefined
)
activityId
=
this
.
resolveSymbol
(
pObject
,
pObject
.
ActivityID
);
var
objectType
=
this
.
InputRecord
[
pObject
.
OType
];
if
(
objectType
==
undefined
)
objectType
=
this
.
resolveSymbol
(
pObject
,
pObject
.
OType
);
var
objectId
=
this
.
InputRecord
[
pObject
.
OID
];
if
(
objectId
==
undefined
)
objectId
=
this
.
resolveSymbol
(
pObject
,
pObject
.
OID
);
if
(
!
activityId
||
!
objectId
||
!
objectType
)
return
true
;
if
(
!
aid
||
!
oid
||
!
otype
)
return
true
;
var
columnCaseActivityLinkId
=
this
.
getColumnCase
(
"
activitylinkid
"
);
var
tableCaseActivityLink
=
this
.
getTableCase
(
"
activitylink
"
);
var
columnCaseActivityId
=
this
.
getColumnCase
(
"
activity_id
"
);
var
columnCaseObjectType
=
this
.
getColumnCase
(
"
object_type
"
);
var
columnCaseObjectRowId
=
this
.
getColumnCase
(
"
object_rowid
"
);
var
configAliasTo
=
this
.
Config
.
AliasTo
;
var
sql
=
"
select
"
+
columnCaseActivityLinkId
+
"
from
"
+
tableCaseActivityLink
+
"
where
"
+
columnCaseActivityId
+
"
= ? and
"
+
columnCaseObjectType
+
"
= ? and
"
+
columnCaseObjectRowId
+
"
= ?
"
;
var
id
=
db
.
cell
([
sql
,
[[
activityId
,
SQLTYPES
.
VARCHAR
],
[
objectType
,
SQLTYPES
.
VARCHAR
],
[
objectId
,
SQLTYPES
.
CHAR
]]],
configAliasTo
);
var
sql
=
"
select
"
+
this
.
getColumnCase
(
"
activitylinkid
"
)
+
"
from
"
+
this
.
getTableCase
(
"
activitylink
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
activity_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
object_type
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
object_rowid
"
)
+
"
= ?
"
;
var
id
=
db
.
cell
([
sql
,
[[
aid
,
SQLTYPES
.
VARCHAR
],
[
otype
,
SQLTYPES
.
VARCHAR
],
[
oid
,
SQLTYPES
.
CHAR
]]],
this
.
Config
.
AliasTo
);
if
(
id
==
""
||
id
==
null
)
{
var
columns
=
[
this
.
getC
olumnCase
(
"
a
ctivity
l
ink
id
"
),
this
.
getC
olumnCase
(
"
a
ctivity
_id
"
),
this
.
getC
olumnCase
(
"
o
bject
_t
ype
"
),
this
.
getC
olumnCase
(
"
o
bject
_rowid
"
)
];
this
.
insertData
(
t
his
.
getT
ableCase
(
"
a
ctivity
l
ink
"
)
,
columns
,
null
,
[
util
.
getNewUUID
(),
a
id
,
otype
,
oid
],
this
.
C
onfig
.
AliasTo
);
var
columns
=
[
c
olumnCase
A
ctivity
L
ink
Id
,
c
olumnCase
A
ctivity
Id
,
c
olumnCase
O
bject
T
ype
,
c
olumnCase
O
bject
RowId
];
this
.
insertData
(
tableCase
A
ctivity
L
ink
,
columns
,
null
,
[
util
.
getNewUUID
(),
a
ctivityId
,
objectType
,
objectId
],
c
onfigAliasTo
);
}
return
true
;
}
/*
* imports an document from a given path
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true, if import of the data was successful, otherwise false
*/
* imports an document from a given path
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true, if import of the data was successful, otherwise false
*/
function
iDocumentByPath
(
pObject
){
var
resultDocument
=
true
;
if
(
!
this
.
doIfCheck
(
pObject
))
return
true
;
...
...
@@ -393,15 +424,15 @@ function iDocumentByPath(pObject){
logging
.
log
(
filename
+
"
"
+
dateNew
)
}
var
sql
=
"
select count(
"
+
this
.
getColumnCase
(
"
row_id
"
)
+
"
) from
"
+
this
.
getTableCase
(
"
asys_binaries
"
)
+
"
where
"
+
this
.
getColumnCase
(
"
row_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
filename
"
)
+
"
= ?
"
;
+
"
where
"
+
this
.
getColumnCase
(
"
row_id
"
)
+
"
= ? and
"
+
this
.
getColumnCase
(
"
filename
"
)
+
"
= ?
"
;
var
count
=
db
.
cell
([
sql
,
[[
row
,
SQLTYPES
.
CHAR
],
[
filename
,
SQLTYPES
.
VARCHAR
]]],
this
.
Config
.
AliasSys
);
if
(
count
==
0
)
{
var
cols
=
[
this
.
getColumnCase
(
"
Id
"
),
this
.
getColumnCase
(
"
Tablename
"
),
this
.
getColumnCase
(
"
Datasize
"
),
this
.
getColumnCase
(
"
date_new
"
),
this
.
getColumnCase
(
"
date_edit
"
),
this
.
getColumnCase
(
"
user_new
"
),
this
.
getColumnCase
(
"
bindata
"
),
this
.
getColumnCase
(
"
containername
"
),
this
.
getColumnCase
(
"
filename
"
),
this
.
getColumnCase
(
"
row_id
"
),
this
.
getColumnCase
(
"
mimetype
"
)];
this
.
getColumnCase
(
"
date_new
"
),
this
.
getColumnCase
(
"
date_edit
"
),
this
.
getColumnCase
(
"
user_new
"
),
this
.
getColumnCase
(
"
bindata
"
),
this
.
getColumnCase
(
"
containername
"
),
this
.
getColumnCase
(
"
filename
"
),
this
.
getColumnCase
(
"
row_id
"
),
this
.
getColumnCase
(
"
mimetype
"
)];
var
vals
=
[
util
.
getNewUUID
(),
"
$!GENERIC!$
"
,
length
,
dateNew
,
dateNew
,
vars
.
getString
(
"
$sys.user
"
),
data
,
"
DOCUMENT
"
,
filename
,
row
,
util
.
getMimeType
(
filename
)];
"
DOCUMENT
"
,
filename
,
row
,
util
.
getMimeType
(
filename
)];
db
.
insertData
(
this
.
getTableCase
(
"
asys_binaries
"
),
cols
,
null
,
vals
,
this
.
Config
.
AliasSys
);
}
}
...
...
@@ -413,14 +444,14 @@ function iDocumentByPath(pObject){
}
/*
* imports an document
* draft: Container: "string", Row: "TBL.COLID", Source: index, Filename: index, Tablename: "string",
* Description: "string", Keywords: "string"
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true, if import of the data was successful, otherwise false
*/
* imports an document
* draft: Container: "string", Row: "TBL.COLID", Source: index, Filename: index, Tablename: "string",
* Description: "string", Keywords: "string"
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true, if import of the data was successful, otherwise false
*/
function
iDocument
(
pObject
)
{
var
resultDocument
=
true
;
...
...
@@ -442,15 +473,15 @@ function iDocument(pObject)
if
(
pObject
.
Rowid
!=
""
&&
pObject
.
Filename
!=
""
)
db
.
insertBinary
(
pObject
.
Tablename
,
pObject
.
Container
,
this
.
getOutput
(
pObject
,
"
Rowid
"
),
null
,
this
.
InputRecord
[
pObject
.
Source
],
this
.
InputRecord
[
pObject
.
Filename
],
desc
,
keyw
,
this
.
Config
.
AliasTo
);
pObject
.
Tablename
,
pObject
.
Container
,
this
.
getOutput
(
pObject
,
"
Rowid
"
),
null
,
this
.
InputRecord
[
pObject
.
Source
],
this
.
InputRecord
[
pObject
.
Filename
],
desc
,
keyw
,
this
.
Config
.
AliasTo
);
}
catch
(
ex
)
{
...
...
@@ -462,14 +493,14 @@ function iDocument(pObject)
}
/*
* move import data to target
*
* @param {Object} pObject req the mapping line
*
* @example: [iMove, { Source: 3, Target: "RELATION.ADDRESS" } ]
*
* @return {Boolean} false, if the import of the row is not possible. otherwise true
*/
* move import data to target
*
* @param {Object} pObject req the mapping line
*
* @example: [iMove, { Source: 3, Target: "RELATION.ADDRESS" } ]
*
* @return {Boolean} false, if the import of the row is not possible. otherwise true
*/
function
iMove
(
pObject
)
{
var
resultMove
=
true
;
...
...
@@ -541,18 +572,18 @@ function iMove(pObject)
/*
* Return word number "Index" from source column.
* Values of the mapping line:
* String Source the source column index
* String Regex the regular expression for the split
* Number Index the word number starting with 0
* String Substring "right" or "left"
* String Separator concatenation string, default is blank
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true
*/
* Return word number "Index" from source column.
* Values of the mapping line:
* String Source the source column index
* String Regex the regular expression for the split
* Number Index the word number starting with 0
* String Substring "right" or "left"
* String Separator concatenation string, default is blank
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true
*/
function
iWord
(
pObject
)
{
var
resultWord
=
true
;
...
...
@@ -607,14 +638,14 @@ function iWord(pObject)
/*
* return a new ID for a key field
* Value of the mapping line:
* String pColumn req the key column
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true
*/
* return a new ID for a key field
* Value of the mapping line:
* String pColumn req the key column
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true
*/
function
iNewID
(
pObject
)
{
//is any DoIf-condition set?
...
...
@@ -632,19 +663,19 @@ function iNewID(pObject)
/*
* join the list of columns into the specified target column
* Values of the mapping line:
* Array pList req array containing result set indexes with joinable columns
* String pDelimiter req the delimiter string
* String pColumn req target column name
*
* @param {Object} pObject req the mapping line
*
* @example1: [iJoin, {Source: [3, 5], Delimiter: "\n", Target: "RELATION.ADDRESS"}]
* @example2: [iJoin, {Value: ["{3}", "{5}"], Delimiter: "\n", Target: "RELATION.ADDRESS"}]
*
* @return {Boolean} true
*/
* join the list of columns into the specified target column
* Values of the mapping line:
* Array pList req array containing result set indexes with joinable columns
* String pDelimiter req the delimiter string
* String pColumn req target column name
*
* @param {Object} pObject req the mapping line
*
* @example1: [iJoin, {Source: [3, 5], Delimiter: "\n", Target: "RELATION.ADDRESS"}]
* @example2: [iJoin, {Value: ["{3}", "{5}"], Delimiter: "\n", Target: "RELATION.ADDRESS"}]
*
* @return {Boolean} true
*/
function
iJoin
(
pObject
)
{
var
s
=
""
;
...
...
@@ -683,17 +714,17 @@ function iJoin(pObject)
}
/*
* executes an sql statement with the data from input result set column in pIndex
* Values of the mapping line:
* Number pIndex req the index into the input result set
* String Command req the sql command (use {0}..{n} to specify source indexes)
* String Alias req the alias name
* String Target req the target column
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true
*/
* executes an sql statement with the data from input result set column in pIndex
* Values of the mapping line:
* Number pIndex req the index into the input result set
* String Command req the sql command (use {0}..{n} to specify source indexes)
* String Alias req the alias name
* String Target req the target column
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true
*/
function
iSql
(
pObject
)
{
//is any DoIf-condition set?
...
...
@@ -713,17 +744,17 @@ function iSql(pObject)
/*
* inserts or updates an relation entry
*
* @param {Object} pObject req the mapping line
*
* @example: [iInsertUpdate, { Table: "RELATION", Alias: "AO_DATEN",
* Columns: ( {Name: "RELATIONID", Source: 4, Required: true },
* {Name: "AOTYPE", Value: "2" },
* {Name: "PERS_ID", Column: "PERS.PERSID" }) } ]
*
* @return {Boolean} true, if insert and update are successful, otherwise false
*/
* inserts or updates an relation entry
*
* @param {Object} pObject req the mapping line
*
* @example: [iInsertUpdate, { Table: "RELATION", Alias: "AO_DATEN",
* Columns: ( {Name: "RELATIONID", Source: 4, Required: true },
* {Name: "AOTYPE", Value: "2" },
* {Name: "PERS_ID", Column: "PERS.PERSID" }) } ]
*
* @return {Boolean} true, if insert and update are successful, otherwise false
*/
function
iInsertUpdate
(
pObject
)
{
var
resultUpdate
=
true
;
...
...
@@ -831,17 +862,17 @@ function iInsertUpdate(pObject)
}
/*
* import a timestamp string in a specified format into a date field
* Values of the mapping line:
* String Source req the column index for the current record
* String Target req target column name
* String Format opt The timestamp format, default is YYYY-MM-DD HH:MI:SS
* String Timezone opt The timezone string, default is UTC
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true, if the import of the timestamp was successfull, otherwise false
*/
* import a timestamp string in a specified format into a date field
* Values of the mapping line:
* String Source req the column index for the current record
* String Target req target column name
* String Format opt The timestamp format, default is YYYY-MM-DD HH:MI:SS
* String Timezone opt The timezone string, default is UTC
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true, if the import of the timestamp was successfull, otherwise false
*/
function
iTimestamp
(
pObject
)
{
var
resultTimestamp
=
true
;
...
...
@@ -873,16 +904,16 @@ function iTimestamp(pObject)
/*
* decode an input entry by searching thru a translation list
* Values of the mapping line:
* String Value -- the input data
* String Target -- the target column
* String List -- the decode list, format: data;replacement;data;replacement.....
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true, if the the decoding was successfull, otherwise false
*/
* decode an input entry by searching thru a translation list
* Values of the mapping line:
* String Value -- the input data
* String Target -- the target column
* String List -- the decode list, format: data;replacement;data;replacement.....
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean} true, if the the decoding was successfull, otherwise false
*/
function
iDecode
(
pObject
)
{
var
resultDecode
=
true
;
...
...
@@ -936,17 +967,17 @@ function iDecode(pObject)
/*
* save an input in a globalvar
* Values of the mapping line:
* String Value -- the input data
* String Name -- the name for the globalvar
*
* @param {Object} pObject req the mapping line
*
* @example [(iGlobalVar {Value: "{3}", Name: "importLogin"} ) --> $global.importLogin]
*
* @return {Boolean}
*/
* save an input in a globalvar
* Values of the mapping line:
* String Value -- the input data
* String Name -- the name for the globalvar
*
* @param {Object} pObject req the mapping line
*
* @example [(iGlobalVar {Value: "{3}", Name: "importLogin"} ) --> $global.importLogin]
*
* @return {Boolean}
*/
function
iGlobalVar
(
pObject
)
{
//is any DoIf-condition set?
...
...
@@ -966,25 +997,25 @@ function iGlobalVar(pObject)
/*
* do character set translation.
* basically works like iMove, but allows to specify a conversion map
* that will be used to process the input data.
* conversion map is a map (directionary, associative array, whatever you call it).
* declare a varaible like theMap = new Array(); theMap("a") = "X"; theMap("b") = "z"; etc. ...
* and specify this a sthe value for the Parameter "Map"
*
* Important! Usage of "Method" parameter value "replaceall" requires ADITO online 3.0.3 or above!
*
* Values of the mapping line:
* String Value -- the input data
* String Target -- the target column
* String Map -- the decode map
* String Method -- which Method to use: "js", "replaceall" (default to "js")]
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean}
*/
* do character set translation.
* basically works like iMove, but allows to specify a conversion map
* that will be used to process the input data.
* conversion map is a map (directionary, associative array, whatever you call it).
* declare a varaible like theMap = new Array(); theMap("a") = "X"; theMap("b") = "z"; etc. ...
* and specify this a sthe value for the Parameter "Map"
*
* Important! Usage of "Method" parameter value "replaceall" requires ADITO online 3.0.3 or above!
*
* Values of the mapping line:
* String Value -- the input data
* String Target -- the target column
* String Map -- the decode map
* String Method -- which Method to use: "js", "replaceall" (default to "js")]
*
* @param {Object} pObject req the mapping line
*
* @return {Boolean}
*/
function
iCharMap
(
pObject
)
{
var
resultMap
=
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