We are having LCDS Data management services which is using Abstract 
Assembler approach . Autos sync is enabled for the service. 
Situation is like this 

Two clients are seeing same fill method 

First client deletes one row 

Second client inserts one record before sync happens 

Second Client gets DataServiceFaultEvent but backend everything 
works fine, data gets inserted in DB no error in assembler as well.

 

Assembler code is below :

 

public class TrackDataAssembler extends AbstractAssembler {

      private Log _logger = LogFactory.getLog(this.getClass());

      private DataAdminService adminService;

            

            /**

             * 

             * @param fillArgs 

             *          First Arg is elementId, second arg should be 
in the form of map which will be passed to dao as sqlmap parameters

             * @return 

             */

            public Collection fill(List fillArgs)  {

                  _logger.info("inside Track fill method");

                  try{

                        Map argsMap = new HashMap();

                        argsMap.put("STLTID", fillArgs.get(0));

                        return new ArrayList
(adminService.getTrackData(argsMap));

                  }

                  catch(ApplicationException ex){

                        _logger.error(ex.getMessage());

                        throw new DataSyncException(fillArgs,null);

                  }

            }

            /**

             * Delete the item.

             * 

             * @param arg0 - the item with which to perform the 
delete

             *          

             * @return void 

             */

            public void deleteItem(Object arg0) {

                  DataAdminVO deletedRow = (DataAdminVO)arg0;

                  try{

                  

                        _logger.error("****************** Inside 
Delete Track ********************");

                        adminService.deleteTrack(deletedRow);

                  

                  }

                  

                  catch(Exception ex){

                        _logger.error(ex.getMessage());

                        throw new DataSyncException(deletedRow, 
null);

                  }

            }

            /**

             * Updates the item.

             * 

             * @param arg0 - the new version of the item with which 
to perform the update

             * @param arg1 - the original version of the item before 
these changes were made (used for conflict detection).

             * @param arg2 - the list of changed property names.

             *          

             * @return void 

             */

            public void updateItem(Object arg0, Object arg1, List 
arg2) {

                  _logger.info("++++++++++++++++++++++++++++++ 
Calling Track Update +++++++++++++++++++++++++++++");

                  DataAdminVO updatedRow = (DataAdminVO)arg0; 

                  if (updatedRow.getNewId() != null) {

                        try{

                              _logger.info("****************** 
Inside Track Update ********************");

                              adminService.updateTrack(updatedRow);

                        }

                        catch(ApplicationException ex){

                              _logger.error(ex.getMessage());

                              throw new DataSyncException
(updatedRow, null);

                        }

                  }

            }

            /**

             * Creates the item.

             * 

             * @param arg0 - the initial instance of the item to 
create.

             *          

             * @return void 

             */

            public void createItem(Object arg0) {

                  DataAdminVO insertedRow = (DataAdminVO)arg0;

                  try{

                        adminService.insertTrack(insertedRow);

                  }

                  catch(ApplicationException ex){

                        _logger.error(ex.getMessage());

                        throw new DataSyncException(insertedRow, 
null);

                  }     

            }

            /**

             * @return Returns the adminService.

             */

            public DataAdminService getAdminService() {

                  return adminService;

            }

            /**

             * @param adminService The adminService to set.

             */

            public void setAdminService(DataAdminService 
adminService) {

                  this.adminService = adminService;

            }

            /**

             * Called when a client adds an item to a filled 
collection.

             * 

             * @param arg0 - the list of parameters which identify 
the fill that the client changed.

             * @param arg1 - the index where a new item was added.

             * @param arg2 - the identity of the item added at the 
specified position.

             *          

             * @return void 

             */

            public boolean autoRefreshFill(List arg0) {

                  _logger.info("inside autoRefreshFill");

                  return false;

            }

            /**

             * This method can be used to help control how fill 
methods are refreshed by Data Management Services.

             * 

             * @param arg0 - Client-side parameters to a fill method 
that created a managed collection still managed by one or more 
clients.

             * 

             * @return void 

             */

            public int refreshFill(List arg0, Object arg1, boolean 
arg2) {

                  

                  DataAdminVO updatedRow = (DataAdminVO)arg1;

                  _logger.info("inside Track refreshFill--------
"+updatedRow.getNewId());

                  updatedRow.setNewId(null);

                        return DO_NOT_EXECUTE_FILL;

            }

 

      }

 

Configuration is 

 

     <destination id="trackDS">

       <channels>

           <channel ref="my-secure-amf"/>

            <channel ref="my-amf"/>

            </channels>

        <adapter ref="java-dao" />      

 

        <properties>

            <use-transactions>false</use-transactions>

            <source>trackDS</source>     

             <factory>spring</factory>     

            <metadata>

                <identity property="trackId"/>

            </metadata>

 

            <network>

                <session-timeout>0</session-timeout>

                <paging enabled="false" pageSize="10" />

                <throttle-inbound policy="ERROR" max-
frequency="500"/>

                <throttle-outbound policy="REPLACE" max-
frequency="500"/>

            </network>

        </properties>

    </destination>

 

Thanks and Regards

Deepali Kaul

 



Reply via email to