Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dad
Cines Vitamui
Commits
4ce24e6e
Commit
4ce24e6e
authored
Sep 23, 2021
by
couzinie
Browse files
Fix problem while importing twice a profile with nsName attribute
parent
3ea17089
Changes
1
Hide whitespace changes
Inline
Side-by-side
ui/ui-frontend/projects/pastis/src/app/core/services/file.service.ts
View file @
4ce24e6e
...
...
@@ -117,40 +117,42 @@ export class FileService implements OnDestroy {
Array
.
prototype
.
forEach
.
call
(
nodes
,
(
node
:
FileNode
)
=>
{
node
.
parent
=
parent
;
let
nodeName
:
string
=
(
node
.
name
===
'
xml:id
'
)
?
'
id
'
:
node
.
name
;
let
sedaDataMatch
:
SedaData
;
if
(
nodeName
)
{
let
sedaDataMatch
:
SedaData
;
// Si le node en cours est une ArchiveUnit, lui même enfant d'une ArchiveUnit...
if
(
nodeName
===
'
ArchiveUnit
'
&&
this
.
sedaDataArchiveUnit
!=
undefined
)
{
// Alors on utilise la définition SEDA de l'ArchiveUnit mère..
sedaDataMatch
=
this
.
sedaDataArchiveUnit
;
}
else
{
// Sinon on recherche la définition SEDA dans l'arbre
sedaDataMatch
=
sedaData
.
find
(
seda
=>
seda
.
Name
===
nodeName
);
//sedaDataMatch = this.sedaService.getSedaNodeRecursively(sedaData[0],nodeName)
}
if
(
!
sedaDataMatch
){
// Sometimes,the sedaData has no property children, but many siblings (e.g. elements on the same level of the tree)
// In this case, the recursivity must be used on each symbling since the service getSedaNodeRecursively
// expects a tree root element with Children key
for
(
const
element
of
sedaData
)
{
let
resultRecursity
=
this
.
sedaService
.
getSedaNodeRecursively
(
element
,
nodeName
);
if
(
resultRecursity
)
{
sedaDataMatch
=
resultRecursity
;
break
;
// Si le node en cours est une ArchiveUnit, lui même enfant d'une ArchiveUnit...
if
(
nodeName
===
'
ArchiveUnit
'
&&
this
.
sedaDataArchiveUnit
!=
undefined
)
{
// Alors on utilise la définition SEDA de l'ArchiveUnit mère..
sedaDataMatch
=
this
.
sedaDataArchiveUnit
;
}
else
{
// Sinon on recherche la définition SEDA dans l'arbre
sedaDataMatch
=
sedaData
.
find
(
seda
=>
seda
.
Name
===
nodeName
);
//sedaDataMatch = this.sedaService.getSedaNodeRecursively(sedaData[0],nodeName)
}
if
(
!
sedaDataMatch
){
// Sometimes,the sedaData has no property children, but many siblings (e.g. elements on the same level of the tree)
// In this case, the recursivity must be used on each symbling since the service getSedaNodeRecursively
// expects a tree root element with Children key
for
(
const
element
of
sedaData
)
{
let
resultRecursity
=
this
.
sedaService
.
getSedaNodeRecursively
(
element
,
nodeName
);
if
(
resultRecursity
)
{
sedaDataMatch
=
resultRecursity
;
break
;
}
}
}
else
{
// Si le node en cours est l'achive ArchiveUnit mère, on la sauvegarde pour l'utiliser pour les ArchivesUnit enfants
if
(
sedaDataMatch
.
Name
===
'
ArchiveUnit
'
&&
this
.
sedaDataArchiveUnit
==
undefined
){
this
.
sedaDataArchiveUnit
=
sedaDataMatch
;
// On introduit la récursivité sur les ArchivesUnit
this
.
sedaDataArchiveUnit
.
Children
.
find
((
c
:
{
Name
:
string
;
})
=>
c
.
Name
==
'
ArchiveUnit
'
).
Children
=
this
.
sedaDataArchiveUnit
.
Children
;
}
}
}
else
{
// Si le node en cours est l'achive ArchiveUnit mère, on la sauvegarde pour l'utiliser pour les ArchivesUnit enfants
if
(
sedaDataMatch
.
Name
===
'
ArchiveUnit
'
&&
this
.
sedaDataArchiveUnit
==
undefined
){
this
.
sedaDataArchiveUnit
=
sedaDataMatch
;
// On introduit la récursivité sur les ArchivesUnit
this
.
sedaDataArchiveUnit
.
Children
.
find
((
c
:
{
Name
:
string
;
})
=>
c
.
Name
==
'
ArchiveUnit
'
).
Children
=
this
.
sedaDataArchiveUnit
.
Children
;
node
.
sedaData
=
sedaDataMatch
;
if
(
node
.
children
.
length
>
0
){
this
.
linkFileNodeToSedaData
(
node
,
node
.
children
,
node
.
sedaData
.
Children
);
}
}
node
.
sedaData
=
sedaDataMatch
;
if
(
node
.
children
.
length
>
0
){
this
.
linkFileNodeToSedaData
(
node
,
node
.
children
,
node
.
sedaData
.
Children
);
}
});
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment