Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    4.0 - operationTypeAdd in conjunction with DSRequest.setValues(LIST of Maps)

    hi,

    usecase:
    in a DMI I add records in another DataSource, I start a new DSRequest and paste a list!! of Records in the DSRequest "request.setValues​(List of Maps)" to insert multiple records at once.

    Unfortunately, the UserID (type="modifier") AND the field ORIGIN (filled by the operational binding definition) is filled only at the first!! insert.

    Datasource:
    Code:
    <DataSource ID="TVCKF" >
    <!-- snipped -->
    
    <field name="USERID" title="UserID" type="modifier" length="8" required="false" detail="true" hidden="false" canEdit="false">	</field>
    <field name="ORIGIN" title="Herkunft des Satzes" type="text" length="1" required="false" detail="true" hidden="false">
    
    <operationBinding operationType="add" canSyncCache="true" skipRowCount="true">
    	<values fieldName="ORIGIN" value="C" />
    </operationBinding>
    
    <!-- snipped -->
    DMI:
    Code:
    public DSResponse csvUpload(DSRequest dsRequest, HttpServletRequest servletRequest)throws Exception{
    	DSResponse dsResponse = new DSResponse(DSResponse.STATUS_SUCCESS);
    
    	// create a new add request for another DataSource.
    	DSRequest request = new DSRequest("TVCKF", "add", dsRequest.getRPCManager());
    
    	// get upload File
    	uploadFile = new UploadFile(dsRequest.getUploadedFiles());
    
    	// snipped - start
    	// create List of TVCKF records
    	List<Map<String, Object>> recordList = csvFactory.getCsvRecordList(uploadFile.getReader());
    	// snipped - end
    
    	// fill the list of records. 
    	request.setValues(recordList);
    	dsResponse = request.execute();
    
    	return dsResponse;
    }
    Server log during insert of two records.
    Code:
    === 2013-04-29 14:39:15,162 [l0-0] DEBUG DSRequest - Caching instance 104 of DS TVCKF from DSRequest.getDataSource()
    === 2013-04-29 14:39:15,162 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,162 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,162 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,162 [l0-0] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
    === 2013-04-29 14:39:15,164 [l0-0] DEBUG DeclarativeSecurity - DataSource TVCKF is not in the pre-checked list, processing...
    === 2013-04-29 14:39:15,164 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,164 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,164 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,164 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,164 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,164 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,164 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,164 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,165 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,165 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,165 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,165 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,165 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,165 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,166 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,166 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,166 [l0-0] WARN  DSRequest - getValues() called on dsRequest containing multiple sets of values, returning first in list.
    === 2013-04-29 14:39:15,166 [l0-0] DEBUG AppBase - [builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application
    === 2013-04-29 14:39:15,166 [l0-0] DEBUG AppBase - [builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation
    === 2013-04-29 14:39:15,167 [l0-0] INFO  SQLDataSource - [builtinApplication.null] Performing add operation with
    	criteria: {V_ZIPCODE:"80123",V_COUNTRYCODE:"DE",VALID_FROM:"30.04.2013",VALID_UNTIL:"31.12.2099",FILENAME:"test mirko.csv",CUSTOMER_ID:"VA20730014201304030000000166",V_NAME2:"Zentrale",V_STREET:"Mustergasse 47",ORIGIN:"C",V_IBAN:"DE40207300140000000050",V_NAME1:"FALL1",V_CITY:"Muenchen",ACTION:"INS",WORK_STATUS:"INS",USERID:"ex70375"}	values: 2 valueSets
    === 2013-04-29 14:39:15,167 [l0-0] INFO  SQLDataSource - [builtinApplication.null] Performing add operation with
    	criteria: {V_ZIPCODE:"80123",V_COUNTRYCODE:"DE",VALID_FROM:"30.04.2013",VALID_UNTIL:"31.12.2099",FILENAME:"test mirko.csv",CUSTOMER_ID:"VA20730014201304030000000166",V_NAME2:"Zentrale",V_STREET:"Mustergasse 47",ORIGIN:"C",V_IBAN:"DE40207300140000000050",V_NAME1:"FALL1",V_CITY:"Muenchen",ACTION:"INS",WORK_STATUS:"INS",USERID:"ex70375"}	values: {V_ZIPCODE:"80123",V_COUNTRYCODE:"DE",VALID_FROM:"30.04.2013",VALID_UNTIL:"31.12.2099",FILENAME:"test mirko.csv",CUSTOMER_ID:"VA20730014201304030000000166",V_NAME2:"Zentrale",V_STREET:"Mustergasse 47",ORIGIN:"C",V_IBAN:"DE40207300140000000050",V_NAME1:"FALL1",V_CITY:"Muenchen",ACTION:"INS",WORK_STATUS:"INS",USERID:"ex70375"}
    === 2013-04-29 14:39:15,190 [l0-0] DEBUG SQLValuesClause - [builtinApplication.null] Sequences: {}
    === 2013-04-29 14:39:15,190 [l0-0] DEBUG SQLConnectionManager - [builtinApplication.null] Borrowed connection '28990315'
    === 2013-04-29 14:39:15,190 [l0-0] DEBUG SQLTransaction - [builtinApplication.null] Started new DB2 transaction "28990315"
    === 2013-04-29 14:39:15,190 [l0-0] DEBUG SQLDriver - [builtinApplication.null] About to execute SQL update in 'DB2' using connection'28990315'
    === 2013-04-29 14:39:15,190 [l0-0] INFO  SQLDriver - [builtinApplication.null] Executing SQL update on 'DB2': INSERT INTO OWQCKCQE.TVCKF (ACTION, CUSTOMER_ID, FILENAME, ORIGIN, USERID, VALID_FROM, VALID_UNTIL, V_CITY, V_COUNTRYCODE, V_IBAN, V_NAME1, V_NAME2, V_STREET, V_ZIPCODE, WORK_STATUS) VALUES (RPAD('INS', 3,' '), RPAD('VA20730014201304030000000166', 33,' '), 'test mirko.csv', 'C', 'ex70375', RPAD('30.04.2013', 15,' '), RPAD('31.12.2099', 15,' '), RPAD('Muenchen', 29,' '), RPAD('DE', 7,' '), RPAD('DE40207300140000000050', 39,' '), RPAD('FALL1', 37,' '), RPAD('Zentrale', 37,' '), RPAD('Mustergasse 47', 35,' '), RPAD('80123', 10,' '), RPAD('INS', 3,' '))
    === 2013-04-29 14:39:15,265 [l0-0] DEBUG SQLDataSource - [builtinApplication.null] add operation affected 1 rows
    === 2013-04-29 14:39:15,265 [l0-0] INFO  SQLDataSource - [builtinApplication.null] primaryKeys: {}
    === 2013-04-29 14:39:15,265 [l0-0] INFO  SQLDataSource - [builtinApplication.null] DB2 getLastRow(): using default operationBinding
    === 2013-04-29 14:39:15,265 [l0-0] DEBUG DeclarativeSecurity - [builtinApplication.null] Processing security checks for DataSource null, field null
    === 2013-04-29 14:39:15,265 [l0-0] DEBUG DeclarativeSecurity - [builtinApplication.null] DataSource TVCKF is not in the pre-checked list, processing...
    === 2013-04-29 14:39:15,266 [l0-0] DEBUG AppBase - [builtinApplication.null, builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application
    === 2013-04-29 14:39:15,266 [l0-0] DEBUG AppBase - [builtinApplication.null, builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation
    === 2013-04-29 14:39:15,267 [l0-0] INFO  SQLDataSource - [builtinApplication.null, builtinApplication.null] Performing fetch operation with
    	criteria: {}	values: {}
    === 2013-04-29 14:39:15,274 [l0-0] INFO  SQLWhereClause - [builtinApplication.null, builtinApplication.null] empty condition
    === 2013-04-29 14:39:15,274 [l0-0] INFO  SQLDataSource - [builtinApplication.null, builtinApplication.null] derived query: SELECT 
                		DATE(TS_SQL) AS TS_SQL_DATETIME, $defaultSelectClause
            		 FROM $defaultTableClause WHERE $defaultWhereClause
    === 2013-04-29 14:39:15,274 [l0-0] INFO  SQLDataSource - [builtinApplication.null, builtinApplication.null] 104: Executing SQL query on 'DB2': SELECT 
                		DATE(TS_SQL) AS TS_SQL_DATETIME, TRIM(ACTION) AS ACTION, TRIM(CUSTOMER_ID) AS CUSTOMER_ID, OWQCKCQE.TVCKF.FILENAME, OWQCKCQE.TVCKF.ORIGIN, OWQCKCQE.TVCKF.RETURNCODE, CAST(TS_INS AS VARCHAR(26)) AS TS_INS, CAST(TS_SQL AS VARCHAR(26)) AS TS_SQL, DATE(TS_SQL) AS TS_SQL_DATETIME, OWQCKCQE.TVCKF.USERID, TRIM(VALID_FROM) AS VALID_FROM, TRIM(VALID_UNTIL) AS VALID_UNTIL, TRIM(V_CITY) AS V_CITY, TRIM(V_COUNTRYCODE) AS V_COUNTRYCODE, TRIM(V_IBAN) AS V_IBAN, TRIM(V_NAME1) AS V_NAME1, TRIM(V_NAME2) AS V_NAME2, TRIM(V_STREET) AS V_STREET, TRIM(V_ZIPCODE) AS V_ZIPCODE, TRIM(WORK_STATUS) AS WORK_STATUS
            		 FROM OWQCKCQE.TVCKF WHERE ('1'='1')
    === 2013-04-29 14:39:15,274 [l0-0] DEBUG SQLDriver - [builtinApplication.null, builtinApplication.null] About to execute SQL query in 'DB2' using connection '28990315'
    === 2013-04-29 14:39:15,274 [l0-0] INFO  SQLDriver - [builtinApplication.null, builtinApplication.null] Executing SQL query on 'DB2': SELECT 
                		DATE(TS_SQL) AS TS_SQL_DATETIME, TRIM(ACTION) AS ACTION, TRIM(CUSTOMER_ID) AS CUSTOMER_ID, OWQCKCQE.TVCKF.FILENAME, OWQCKCQE.TVCKF.ORIGIN, OWQCKCQE.TVCKF.RETURNCODE, CAST(TS_INS AS VARCHAR(26)) AS TS_INS, CAST(TS_SQL AS VARCHAR(26)) AS TS_SQL, DATE(TS_SQL) AS TS_SQL_DATETIME, OWQCKCQE.TVCKF.USERID, TRIM(VALID_FROM) AS VALID_FROM, TRIM(VALID_UNTIL) AS VALID_UNTIL, TRIM(V_CITY) AS V_CITY, TRIM(V_COUNTRYCODE) AS V_COUNTRYCODE, TRIM(V_IBAN) AS V_IBAN, TRIM(V_NAME1) AS V_NAME1, TRIM(V_NAME2) AS V_NAME2, TRIM(V_STREET) AS V_STREET, TRIM(V_ZIPCODE) AS V_ZIPCODE, TRIM(WORK_STATUS) AS WORK_STATUS
            		 FROM OWQCKCQE.TVCKF WHERE ('1'='1')
    === 2013-04-29 14:39:15,295 [l0-0] DEBUG SQLTransform - [builtinApplication.null, builtinApplication.null] isBeforeFirst()/isAfterLast() throwing exceptions - attempting workaround
    === 2013-04-29 14:39:15,300 [l0-0] INFO  DSResponse - [builtinApplication.null, builtinApplication.null] DSResponse: List with 20 items
    === 2013-04-29 14:39:15,301 [l0-0] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 20 items
    === 2013-04-29 14:39:15,301 [l0-0] INFO  SQLDataSource - [builtinApplication.null] Performing add operation with
    	criteria: {V_ZIPCODE:"80123",V_COUNTRYCODE:"DE",VALID_FROM:"30.04.2013",VALID_UNTIL:"31.12.2099",FILENAME:"test mirko.csv",CUSTOMER_ID:"VA20730014201304030000000166",V_NAME2:"Zentrale",V_STREET:"Mustergasse 47",ORIGIN:"C",V_IBAN:"DE40207300140000000050",V_NAME1:"FALL1",V_CITY:"Muenchen",ACTION:"INS",WORK_STATUS:"INS",USERID:"ex70375"}	values: {V_ZIPCODE:"80123",V_COUNTRYCODE:"DE",VALID_FROM:"30.04.2013",VALID_UNTIL:"31.12.2099",FILENAME:"test mirko.csv",CUSTOMER_ID:"VA20730014201304030000000166",V_NAME2:"Zentrale",V_STREET:"Mustergasse 47",V_IBAN:"DE40207300140000000050",V_NAME1:"FALL1-update",V_CITY:"Muenchen",ACTION:"UPD",WORK_STATUS:"INS"}
    === 2013-04-29 14:39:15,324 [l0-0] DEBUG SQLValuesClause - [builtinApplication.null] Sequences: {}
    === 2013-04-29 14:39:15,328 [l0-0] DEBUG SQLDriver - [builtinApplication.null] About to execute SQL update in 'DB2' using connection'28990315'
    === 2013-04-29 14:39:15,329 [l0-0] INFO  SQLDriver - [builtinApplication.null] Executing SQL update on 'DB2': INSERT INTO OWQCKCQE.TVCKF (ACTION, CUSTOMER_ID, FILENAME, VALID_FROM, VALID_UNTIL, V_CITY, V_COUNTRYCODE, V_IBAN, V_NAME1, V_NAME2, V_STREET, V_ZIPCODE, WORK_STATUS) VALUES (RPAD('UPD', 3,' '), RPAD('VA20730014201304030000000166', 33,' '), 'test mirko.csv', RPAD('30.04.2013', 15,' '), RPAD('31.12.2099', 15,' '), RPAD('Muenchen', 29,' '), RPAD('DE', 7,' '), RPAD('DE40207300140000000050', 39,' '), RPAD('FALL1-update', 37,' '), RPAD('Zentrale', 37,' '), RPAD('Mustergasse 47', 35,' '), RPAD('80123', 10,' '), RPAD('INS', 3,' '))
    === 2013-04-29 14:39:15,345 [l0-0] DEBUG SQLDataSource - [builtinApplication.null] add operation affected 1 rows
    === 2013-04-29 14:39:15,345 [l0-0] INFO  SQLDataSource - [builtinApplication.null] primaryKeys: {}
    === 2013-04-29 14:39:15,345 [l0-0] INFO  SQLDataSource - [builtinApplication.null] DB2 getLastRow(): using default operationBinding
    === 2013-04-29 14:39:15,345 [l0-0] DEBUG DeclarativeSecurity - [builtinApplication.null] Processing security checks for DataSource null, field null
    === 2013-04-29 14:39:15,345 [l0-0] DEBUG DeclarativeSecurity - [builtinApplication.null] DataSource TVCKF is not in the pre-checked list, processing...
    === 2013-04-29 14:39:15,345 [l0-0] DEBUG AppBase - [builtinApplication.null, builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application
    === 2013-04-29 14:39:15,346 [l0-0] DEBUG AppBase - [builtinApplication.null, builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation
    === 2013-04-29 14:39:15,346 [l0-0] INFO  SQLDataSource - [builtinApplication.null, builtinApplication.null] Performing fetch operation with
    	criteria: {}	values: {}
    === 2013-04-29 14:39:15,351 [l0-0] INFO  SQLWhereClause - [builtinApplication.null, builtinApplication.null] empty condition
    === 2013-04-29 14:39:15,352 [l0-0] INFO  SQLDataSource - [builtinApplication.null, builtinApplication.null] derived query: SELECT 
                		DATE(TS_SQL) AS TS_SQL_DATETIME, $defaultSelectClause
            		 FROM $defaultTableClause WHERE $defaultWhereClause
    === 2013-04-29 14:39:15,353 [l0-0] INFO  SQLDataSource - [builtinApplication.null, builtinApplication.null] 104: Executing SQL query on 'DB2': SELECT 
                		DATE(TS_SQL) AS TS_SQL_DATETIME, TRIM(ACTION) AS ACTION, TRIM(CUSTOMER_ID) AS CUSTOMER_ID, OWQCKCQE.TVCKF.FILENAME, OWQCKCQE.TVCKF.ORIGIN, OWQCKCQE.TVCKF.RETURNCODE, CAST(TS_INS AS VARCHAR(26)) AS TS_INS, CAST(TS_SQL AS VARCHAR(26)) AS TS_SQL, DATE(TS_SQL) AS TS_SQL_DATETIME, OWQCKCQE.TVCKF.USERID, TRIM(VALID_FROM) AS VALID_FROM, TRIM(VALID_UNTIL) AS VALID_UNTIL, TRIM(V_CITY) AS V_CITY, TRIM(V_COUNTRYCODE) AS V_COUNTRYCODE, TRIM(V_IBAN) AS V_IBAN, TRIM(V_NAME1) AS V_NAME1, TRIM(V_NAME2) AS V_NAME2, TRIM(V_STREET) AS V_STREET, TRIM(V_ZIPCODE) AS V_ZIPCODE, TRIM(WORK_STATUS) AS WORK_STATUS
            		 FROM OWQCKCQE.TVCKF WHERE ('1'='1')
    === 2013-04-29 14:39:15,354 [l0-0] DEBUG SQLDriver - [builtinApplication.null, builtinApplication.null] About to execute SQL query in 'DB2' using connection '28990315'
    === 2013-04-29 14:39:15,354 [l0-0] INFO  SQLDriver - [builtinApplication.null, builtinApplication.null] Executing SQL query on 'DB2': SELECT 
                		DATE(TS_SQL) AS TS_SQL_DATETIME, TRIM(ACTION) AS ACTION, TRIM(CUSTOMER_ID) AS CUSTOMER_ID, OWQCKCQE.TVCKF.FILENAME, OWQCKCQE.TVCKF.ORIGIN, OWQCKCQE.TVCKF.RETURNCODE, CAST(TS_INS AS VARCHAR(26)) AS TS_INS, CAST(TS_SQL AS VARCHAR(26)) AS TS_SQL, DATE(TS_SQL) AS TS_SQL_DATETIME, OWQCKCQE.TVCKF.USERID, TRIM(VALID_FROM) AS VALID_FROM, TRIM(VALID_UNTIL) AS VALID_UNTIL, TRIM(V_CITY) AS V_CITY, TRIM(V_COUNTRYCODE) AS V_COUNTRYCODE, TRIM(V_IBAN) AS V_IBAN, TRIM(V_NAME1) AS V_NAME1, TRIM(V_NAME2) AS V_NAME2, TRIM(V_STREET) AS V_STREET, TRIM(V_ZIPCODE) AS V_ZIPCODE, TRIM(WORK_STATUS) AS WORK_STATUS
            		 FROM OWQCKCQE.TVCKF WHERE ('1'='1')
    === 2013-04-29 14:39:15,370 [l0-0] DEBUG SQLTransform - [builtinApplication.null, builtinApplication.null] isBeforeFirst()/isAfterLast() throwing exceptions - attempting workaround
    === 2013-04-29 14:39:15,373 [l0-0] INFO  DSResponse - [builtinApplication.null, builtinApplication.null] DSResponse: List with 21 items
    === 2013-04-29 14:39:15,373 [l0-0] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 21 items
    === 2013-04-29 14:39:15,373 [l0-0] INFO  DSResponse - [builtinApplication.null] DSResponse: List with 2 items
    === 2013-04-29 14:39:15,373 [l0-0] DEBUG RPCManager - Content type for RPC transaction: text/html; charset=UTF-8
    === 2013-04-29 14:39:15,373 [l0-0] DEBUG SQLTransaction - Committing DB2 transaction "28990315"
    === 2013-04-29 14:39:15,387 [l0-0] DEBUG RPCManager - DMI response, dropExtraFields: false
    === 2013-04-29 14:39:15,388 [l0-0] DEBUG SQLTransaction - Returning transactional connection for DB2 with hashcode "28990315"
    === 2013-04-29 14:39:15,388 [l0-0] DEBUG SQLTransaction - Ending DB2 transaction "28990315"
    === 2013-04-29 14:39:15,400 [l0-0] DEBUG SQLConnectionManager - About to close PoolableConnection with hashcode "28990315"
    === 2013-04-29 14:39:15,401 [l0-0] INFO  Compression - /payweb/sc/IDACall: 1631 -> 724 bytes
    javadoc:
    Code:
    public DSRequest setValues(java.lang.Object values)
    
    The List type is typically used for a DataSource.OP_ADD operation 
    with multiple records.
    Please check the behavior at this point, I was expecting that the columns are filled for all records.

    best regards,
    mirko

    i used Isomorphic SmartClient/SmartGWT Framework (SNAPSHOT_v9.0d_2013-04-23/PowerEdition Deployment 2013-04-23)

    #2
    To do multiple "add" operations, or in general multiple operations of any type, use one DSRequest per operation. The ability to provide multiple Maps of values on the "add" operation is an advanced use case not commonly used, and does not apply here.

    Comment


      #3
      Hi Isomorphic. Is this still true in v6.0? I do want to add several records as well using a List<Map<String,Object>> which contains all my record information...

      Comment

      Working...
      X