Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
b6e1d946
Verified
Commit
b6e1d946
authored
4 years ago
by
Florian Azizian
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #15047 TIME 3 get archivalAgreements and ArchiveEntities
parent
14de8283
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/export_seda/xml/config.xml.default
+20
-0
20 additions, 0 deletions
modules/export_seda/xml/config.xml.default
src/app/external/exportSeda/controllers/SedaController.php
+143
-1
143 additions, 1 deletion
src/app/external/exportSeda/controllers/SedaController.php
with
163 additions
and
1 deletion
modules/export_seda/xml/config.xml.default
+
20
−
0
View file @
b6e1d946
...
@@ -28,6 +28,26 @@
...
@@ -28,6 +28,26 @@
<label>
label2
</label>
<label>
label2
</label>
</retentionRule>
</retentionRule>
</retentionRules>
</retentionRules>
<archiveEntities>
<archiveEntity>
<id>
id1
</id>
<label>
label1
</label>
</archiveEntity>
<archiveEntity>
<id>
id2
</id>
<label>
label2
</label>
</archiveEntity>
</archiveEntities>
<archivalAgreements>
<archivalAgreement>
<id>
id1
</id>
<label>
label1
</label>
</archivalAgreement>
<archivalAgreement>
<id>
id2
</id>
<label>
label2
</label>
</archivalAgreement>
</archivalAgreements>
</externalSAE>
</externalSAE>
<TABLENAME/>
<TABLENAME/>
<HISTORY>
<HISTORY>
...
...
This diff is collapsed.
Click to expand it.
src/app/external/exportSeda/controllers/SedaController.php
+
143
−
1
View file @
b6e1d946
...
@@ -181,10 +181,152 @@ class SedaController
...
@@ -181,10 +181,152 @@ class SedaController
'descriptionLevel'
=>
'Item'
'descriptionLevel'
=>
'Item'
];
];
}
}
$archivalAgreements
=
SedaController
::
getArchivalAgreements
([
'configXml'
=>
$sedaXml
,
'senderArchiveEntity'
=>
(
string
)
$sedaXml
->
CONFIG
->
senderOrgRegNumber
,
'producerService'
=>
$entity
[
'producer_service'
]
]);
if
(
!
empty
(
$archivalAgreements
[
'error'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'ArchivalAgreements error : '
.
$archivalAgreements
[
'error'
]]);
}
$recipientArchiveEntities
=
SedaController
::
getRecipientArchiveEntities
([
'configXml'
=>
$sedaXml
,
'archivalAgreements'
=>
$archivalAgreements
[
'archivalAgreements'
]]);
if
(
!
empty
(
$recipientArchiveEntities
[
'error'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'ArchivalEntities error : '
.
$recipientArchiveEntities
[
'error'
]]);
}
$return
[
'archivalAgreements'
]
=
$archivalAgreements
[
'archivalAgreements'
];
$return
[
'recipientArchiveEntities'
]
=
$recipientArchiveEntities
[
'archiveEntities'
];
return
$response
->
withJson
(
$return
);
return
$response
->
withJson
(
$return
);
}
}
public
function
getRecipientArchiveEntities
(
$args
=
[])
{
$archiveEntities
=
[];
if
(
strtolower
((
string
)
$args
[
'configXml'
]
->
CONFIG
->
sae
)
==
'maarchrm'
)
{
$curlResponse
=
CurlModel
::
execSimple
([
'url'
=>
rtrim
((
string
)
$args
[
'configXml'
]
->
CONFIG
->
urlSAEService
,
'/'
)
.
'/organization/organization/Byrole/archiver'
,
'method'
=>
'GET'
,
'cookie'
=>
'LAABS-AUTH='
.
urlencode
((
string
)
$args
[
'configXml'
]
->
CONFIG
->
token
),
'headers'
=>
[
'Accept: application/json'
,
'Content-Type: application/json'
,
'User-Agent: '
.
(
string
)
$args
[
'configXml'
]
->
CONFIG
->
userAgent
]
]);
if
(
!
empty
(
$curlResponse
[
'errors'
]))
{
return
[
'error'
=>
'Error during processing in getRecipientArchiveEntities : '
.
$curlResponse
[
'errors'
]];
}
$archiveEntitiesAllowed
=
array_column
(
$args
[
'archivalAgreements'
],
'archiveEntityRegNumber'
);
$archiveEntities
[]
=
[
'id'
=>
""
,
'label'
=>
null
];
foreach
(
$curlResponse
[
'response'
]
as
$retentionRule
)
{
if
(
in_array
(
$retentionRule
[
'registrationNumber'
],
$archiveEntitiesAllowed
))
{
$archiveEntities
[]
=
[
'id'
=>
$retentionRule
[
'registrationNumber'
],
'label'
=>
$retentionRule
[
'displayName'
]
];
}
}
}
else
{
foreach
(
$args
[
'configXml'
]
->
externalSAE
as
$value
)
{
if
((
string
)
$value
->
id
==
(
string
)
$args
[
'configXml'
]
->
CONFIG
->
sae
)
{
foreach
(
$value
->
archiveEntities
->
archiveEntity
as
$rule
)
{
$archiveEntities
[]
=
[
'id'
=>
(
string
)
$rule
->
id
,
'label'
=>
(
string
)
$rule
->
label
];
}
break
;
}
}
}
return
[
'archiveEntities'
=>
$archiveEntities
];
}
public
function
getArchivalAgreements
(
$args
=
[])
{
$archivalAgreements
=
[];
if
(
strtolower
((
string
)
$args
[
'configXml'
]
->
CONFIG
->
sae
)
==
'maarchrm'
)
{
$curlResponse
=
CurlModel
::
execSimple
([
'url'
=>
rtrim
((
string
)
$args
[
'configXml'
]
->
CONFIG
->
urlSAEService
,
'/'
)
.
'/medona/archivalAgreement/Index'
,
'method'
=>
'GET'
,
'cookie'
=>
'LAABS-AUTH='
.
urlencode
((
string
)
$args
[
'configXml'
]
->
CONFIG
->
token
),
'headers'
=>
[
'Accept: application/json'
,
'Content-Type: application/json'
,
'User-Agent: '
.
(
string
)
$args
[
'configXml'
]
->
CONFIG
->
userAgent
]
]);
if
(
!
empty
(
$curlResponse
[
'errors'
]))
{
return
[
'error'
=>
'Error during processing in getArchivalAgreements : '
.
$curlResponse
[
'errors'
]];
}
$producerService
=
SedaController
::
getProducerServiceInfo
([
'configXml'
=>
$args
[
'configXml'
],
'producerServiceName'
=>
$args
[
'producerService'
]]);
if
(
!
empty
(
$producerService
[
'errors'
]))
{
return
[
'error'
=>
'Error during processing in getArchivalAgreements producer service info : '
.
$curlResponse
[
'errors'
]];
}
elseif
(
empty
(
$producerService
[
'producerServiceInfo'
]))
{
return
[
'error'
=>
'ProducerService does not exists in MaarchRM'
];
}
$archivalAgreements
[]
=
[
'id'
=>
""
,
'label'
=>
null
];
foreach
(
$curlResponse
[
'response'
]
as
$retentionRule
)
{
if
(
$retentionRule
[
'depositorOrgRegNumber'
]
==
$args
[
'senderArchiveEntity'
]
&&
in_array
(
$producerService
[
'producerServiceInfo'
][
'orgId'
],
$retentionRule
[
'originatorOrgIds'
]))
{
$archivalAgreements
[]
=
[
'id'
=>
$retentionRule
[
'reference'
],
'label'
=>
$retentionRule
[
'name'
],
'archiveEntityRegNumber'
=>
$retentionRule
[
'archiverOrgRegNumber'
]
];
}
}
}
else
{
foreach
(
$args
[
'configXml'
]
->
externalSAE
as
$value
)
{
if
((
string
)
$value
->
id
==
(
string
)
$args
[
'configXml'
]
->
CONFIG
->
sae
)
{
foreach
(
$value
->
archivalAgreements
->
archivalAgreement
as
$rule
)
{
$archivalAgreements
[]
=
[
'id'
=>
(
string
)
$rule
->
id
,
'label'
=>
(
string
)
$rule
->
label
];
}
break
;
}
}
}
return
[
'archivalAgreements'
=>
$archivalAgreements
];
}
public
function
getProducerServiceInfo
(
$args
=
[])
{
$curlResponse
=
CurlModel
::
execSimple
([
'url'
=>
rtrim
((
string
)
$args
[
'configXml'
]
->
CONFIG
->
urlSAEService
,
'/'
)
.
'/organization/organization/Search?term='
.
$args
[
'producerServiceName'
],
'method'
=>
'GET'
,
'cookie'
=>
'LAABS-AUTH='
.
urlencode
((
string
)
$args
[
'configXml'
]
->
CONFIG
->
token
),
'headers'
=>
[
'Accept: application/json'
,
'Content-Type: application/json'
,
'User-Agent: '
.
(
string
)
$args
[
'configXml'
]
->
CONFIG
->
userAgent
]
]);
if
(
!
empty
(
$curlResponse
[
'errors'
]))
{
return
[
'error'
=>
$curlResponse
[
'errors'
]];
}
return
[
'producerServiceInfo'
=>
$curlResponse
[
'response'
][
0
]];
}
public
function
getRetentionRules
(
Request
$request
,
Response
$response
)
public
function
getRetentionRules
(
Request
$request
,
Response
$response
)
{
{
if
(
!
PrivilegeController
::
hasPrivilege
([
'privilegeId'
=>
'admin_architecture'
,
'userId'
=>
$GLOBALS
[
'id'
]]))
{
if
(
!
PrivilegeController
::
hasPrivilege
([
'privilegeId'
=>
'admin_architecture'
,
'userId'
=>
$GLOBALS
[
'id'
]]))
{
...
@@ -210,7 +352,7 @@ class SedaController
...
@@ -210,7 +352,7 @@ class SedaController
]);
]);
if
(
!
empty
(
$curlResponse
[
'errors'
]))
{
if
(
!
empty
(
$curlResponse
[
'errors'
]))
{
return
[
'error'
=>
'Error during processing in getRetentionRules : '
.
$curlResponse
[
'errors'
]];
return
$response
->
withStatus
(
400
)
->
withJson
(
[
'error
s
'
=>
'Error during processing in getRetentionRules : '
.
$curlResponse
[
'errors'
]]
)
;
}
}
$retentionRules
[]
=
[
$retentionRules
[]
=
[
...
...
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