Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
wendelin
Commits
f68899a8
Commit
f68899a8
authored
Jan 03, 2019
by
Klaus Wölfel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow to get ingestion parameters and operation without creating data ingestion
parent
e08b1192
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
144 additions
and
78 deletions
+144
-78
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/ERP5Site_createDataIngestion.py
...ortal_skins/erp5_wendelin/ERP5Site_createDataIngestion.py
+51
-0
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/ERP5Site_createDataIngestion.xml
...rtal_skins/erp5_wendelin/ERP5Site_createDataIngestion.xml
+62
-0
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/IngestionPolicy_getIngestionOperationAndParameterDict.py
.../IngestionPolicy_getIngestionOperationAndParameterDict.py
+30
-77
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/IngestionPolicy_getIngestionOperationAndParameterDict.xml
...IngestionPolicy_getIngestionOperationAndParameterDict.xml
+1
-1
No files found.
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/ERP5Site_createDataIngestion.py
0 → 100644
View file @
f68899a8
from
DateTime
import
DateTime
if
data_ingestion_id
is
None
:
now
=
DateTime
()
today_string
=
now
.
strftime
(
'%Y%m%d'
)
data_ingestion_id
=
"%s-%s"
%
(
today_string
,
data_ingestion_reference
)
portal
=
context
.
getPortalObject
()
data_ingestion
=
portal
.
data_ingestion_module
.
newContent
(
id
=
data_ingestion_id
,
portal_type
=
"Data Ingestion"
,
reference
=
data_ingestion_reference
,
specialise_list
=
specialise_list
)
composed
=
data_ingestion
.
asComposedDocument
()
property_list
=
[
"title"
,
"source"
,
"source_section"
,
"source_project"
,
"destination"
,
"destination_section"
,
"destination_project"
,
"specialise"
]
property_dict
=
{
p
:
composed
.
getProperty
(
p
)
for
p
in
property_list
}
property_dict
[
"start_date"
]
=
composed
.
getEffectiveDate
()
property_dict
[
"stop_date"
]
=
composed
.
getExpirationDate
()
data_ingestion
.
edit
(
**
property_dict
)
# create ingestion lines from specialise lines
for
supply_line
in
composed
.
objectValues
(
portal_type
=
'Data Supply Line'
):
current_line
=
data_ingestion
.
newContent
(
portal_type
=
"Data Ingestion Line"
,
title
=
supply_line
.
getTitle
(),
aggregate
=
supply_line
.
getAggregateList
(),
int_index
=
supply_line
.
getIntIndex
(),
quantity
=
supply_line
.
getQuantity
(),
reference
=
supply_line
.
getReference
(),
resource
=
supply_line
.
getResource
(),
use
=
supply_line
.
getUse
()
)
if
current_line
.
getResourceValue
().
getPortalType
()
==
"Data Product"
:
# we set quantity=0 for the data product lines
current_line
.
setQuantity
(
0
)
data_ingestion
.
start
()
return
data_ingestion
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/ERP5Site_createDataIngestion.xml
0 → 100644
View file @
f68899a8
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
specialise_list, data_ingestion_reference, data_ingestion_id=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_createDataIngestion
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/IngestionPolicy_getIngestionOperationAndParameterDict.py
View file @
f68899a8
...
...
@@ -14,7 +14,7 @@ specialise_reference = movement_dict.get('specialise_reference', None)
data_ingestion
=
portal_catalog
.
getResultValue
(
portal_type
=
'Data Ingestion'
,
simulation_state
=
[
'started'
,
'stopped'
],
reference
=
data_ingestion_reference
)
reference
=
data_ingestion_reference
)
def
init_input_line
(
input_line
,
operation_line
):
# copy device and configuration from operation line to input line
...
...
@@ -95,79 +95,32 @@ if data_ingestion is None:
if
(
document
is
not
None
)
and
document
.
getSimulationState
()
==
'started'
:
data_ingestion
=
document
if
data_ingestion
is
None
:
specialise_
value_list
=
[
x
.
getObject
()
for
x
in
portal_catalog
.
searchResults
(
if
modify
and
data_ingestion
is
None
:
specialise_
list
=
[
x
.
getRelativeUrl
()
for
x
in
portal_catalog
.
searchResults
(
portal_type
=
'Data Supply'
,
reference
=
specialise_reference
,
validation_state
=
'validated'
)]
# if we do not find a validated data supply, we look for a default data supply
if
not
specialise_
value_
list
:
specialise_
value_list
=
[
x
.
getObject
()
for
x
in
portal_catalog
.
searchResults
(
if
not
specialise_list
:
specialise_
list
=
[
x
.
getRelativeUrl
()
for
x
in
portal_catalog
.
searchResults
(
portal_type
=
'Data Supply'
,
reference
=
specialise_reference
,
validation_state
=
'default'
)]
# create a new data ingestion
data_ingestion
=
portal
.
data_ingestion_module
.
newContent
(
id
=
data_ingestion_id
,
portal_type
=
"Data Ingestion"
,
reference
=
data_ingestion_reference
,
specialise_value_list
=
specialise_value_list
)
composed
=
data_ingestion
.
asComposedDocument
()
property_list
=
[
"title"
,
"source"
,
"source_section"
,
"source_project"
,
"destination"
,
"destination_section"
,
"destination_project"
,
"specialise"
]
property_dict
=
{
p
:
composed
.
getProperty
(
p
)
for
p
in
property_list
}
property_dict
[
"start_date"
]
=
composed
.
getEffectiveDate
()
property_dict
[
"stop_date"
]
=
composed
.
getExpirationDate
()
data_ingestion
.
edit
(
**
property_dict
)
# create ingestion lines from specialise lines and assign input line
# and operation line
input_line
=
None
operation_line
=
None
for
supply_line
in
composed
.
objectValues
(
portal_type
=
'Data Supply Line'
):
current_line
=
data_ingestion
.
newContent
(
portal_type
=
"Data Ingestion Line"
,
title
=
supply_line
.
getTitle
(),
aggregate
=
supply_line
.
getAggregateList
(),
int_index
=
supply_line
.
getIntIndex
(),
quantity
=
supply_line
.
getQuantity
(),
reference
=
supply_line
.
getReference
(),
resource
=
supply_line
.
getResource
(),
use
=
supply_line
.
getUse
()
)
if
current_line
.
getResourceReference
()
==
resource_reference
:
input_line
=
current_line
elif
current_line
.
getResourceValue
().
getPortalType
()
==
"Data Operation"
:
operation_line
=
current_line
else
:
# we set quantity=0 for the empty line
current_line
.
setQuantity
(
0
)
init_input_line
(
input_line
,
operation_line
)
data_ingestion
.
start
()
data_ingestion
=
portal
.
ERP5Site_createDataIngestion
(
specialise_list
,
data_ingestion_reference
,
data_ingestion_id
)
else
:
# find ingestion line for current resource
for
line
in
data_ingestion
.
objectValues
(
portal_type
=
"Data Ingestion Line"
):
# find ingestion line for current resource
for
line
in
data_ingestion
.
objectValues
(
portal_type
=
"Data Ingestion Line"
):
if
line
.
getResourceReference
()
==
resource_reference
:
input_line
=
line
elif
line
.
getResourceValue
().
getPortalType
()
==
"Data Operation"
:
operation_line
=
line
if
input_line
.
getQuantity
()
==
0
:
if
modify
and
input_line
.
getQuantity
()
==
0
:
init_input_line
(
input_line
,
operation_line
)
data_operation
=
operation_line
.
getResourceValue
()
...
...
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/IngestionPolicy_getIngestionOperationAndParameterDict.xml
View file @
f68899a8
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
movement_dict, reference
</string>
</value>
<value>
<string>
movement_dict, reference
, modify=True
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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