Skip to content

Commit

Permalink
Fixes to work with 4.x platform
Browse files Browse the repository at this point in the history
  • Loading branch information
nithinphilips committed Aug 30, 2023
1 parent 1140393 commit dedbb1a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Odel
====
Odel is a tool to automate TRIRIGA Data Upload using the Data Integrator tool.
You can use Odel to upload a Data Integrator files in a consistent repeatable
way.

.. Note:: Since TRIRIGA 4.0.0, the Data Integrator feature has several bugs
that are unresolved as of 4.3.0.

For example, you are not able to set values on Locator fields that
point to a module.

Features
--------
Expand Down
17 changes: 11 additions & 6 deletions odel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use crate::tririga::transport::Transport;
use crate::errors::OdelError;
use itertools::Itertools;

const FILE_NAME_MAX_LEN: usize = 50;
const FILE_NAME_MAX_LEN: usize = 40;

const DI_SUCCESS_STATUS_EN_US: &str = "Rollup All Completed";
const MAX_RETRIES: &str = "23";
Expand Down Expand Up @@ -567,29 +567,33 @@ async fn upload_file(
("updateAct", "createSpec"),
("filenames", data_file_trimmed),
("classTypeN", &module_id_str),
("classType", &module_id_str),
("objectTypeN", &business_object_id_str),
("objectType", &business_object_id_str),
("guiIdN", &gui_id_str),
("guiId", &gui_id_str),
("delimiterN", ".TAB"),
("delimiter", ".TAB"),
("charSet", "UTF-8"),
("transactionTypeN", "Insert/New"),
("transactionType", "Insert/New"),
("batch", "NO"),
("actionName", action_name),
("stateName", "triDraft")
("stateName", "triDraft"),
(&security_name, &security_value),
];

info!("DI: Reading file: '{}'", data_file);
let mut f = File::open(data_file)?;
let mut data = Vec::new();
f.read_to_end(&mut data)?;

let the_file = reqwest::multipart::Part::
stream(data)
let the_other_file = reqwest::multipart::Part::stream(data)
.file_name(String::from(data_file_trimmed))
.mime_str("text/plain")?;

let file_parts = reqwest::multipart::Form::new()
.text("updateAct", "createSpec")
.part("theFile", the_file);
.part(String::from(data_file_trimmed), the_other_file);

info!("DI: Upload file");
tranport.client
Expand All @@ -599,6 +603,7 @@ async fn upload_file(
.send().await?;

info!("DI: Create DI job");
// dataSmartUpload.jsp?updateAct=createSpec&classTypeN=8&objectTypeN=10008338&guiIdN=10012038&delimiterN=.TAB&transactionTypeN=Insert/New
tranport.client.post(&format!("{}/html/en/default/common/dataSmartUpload.jsp", &tranport.url))
.header(&security_name, &security_value)
.form(&upload_params)
Expand Down
3 changes: 1 addition & 2 deletions odel/src/soap/soap_envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::str::FromStr;
use yaserde::{YaDeserialize, YaSerialize};
use yaserde_derive::{YaDeserialize, YaSerialize};
use std::fmt::Display;
use serde::export::Formatter;
use std::fmt;

#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
Expand Down Expand Up @@ -75,7 +74,7 @@ pub struct Fault {
}

impl Display for Fault {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for reasontext in &self.reason.text {
write!(f, "{}", reasontext.text)?;
}
Expand Down

0 comments on commit dedbb1a

Please sign in to comment.