com.sap.mdm.data.commands
Class DeleteRecordsCommand

java.lang.Object
  extended bycom.sap.mdm.commands.AbstractCommandBase
      extended bycom.sap.mdm.commands.AbstractCommand
          extended bycom.sap.mdm.session.AbstractSessionCommand
              extended bycom.sap.mdm.session.AbstractUserSessionCommand
                  extended bycom.sap.mdm.data.commands.DeleteRecordsCommand
All Implemented Interfaces:
Command, PassportSupport

public class DeleteRecordsCommand
extends AbstractUserSessionCommand

This command is responsible for deleting a set of records. In order to specify set of records that should be deleted the user can supply either record IDs or instances of Record interface. In case the instances of Record interface are supplied the change stamp stored in the Record will be used for delete process and if this change stamp is out-of-date this record will be deleted only if the 'isDeleteAnyway' parameter is true. The record specified by record ID or by Record without change stamp will always be deleted. Mandatory input parameters: - Set of records or record IDs, it should include at least one record/ID value. - Table ID Optional input parameters: - isDeleteAnyway. By default it is false Output parameter: - none


Constructor Summary
DeleteRecordsCommand(ConnectionAccessor connection)
          Constructor
DeleteRecordsCommand(UserSessionContext ctx)
          Creates a new instance of this command by context.
 
Method Summary
 void addRecord(Record record)
          Adds a record to the list of records that should be deleted from repository (required*).
 void addRecord(RecordId recordId)
          Adds a record to the list of records that should be deleted from repository (required*).
 void addRecords(Record[] records)
          Adds records that should be deleted from repository (required*).
 void addRecords(RecordId[] recordIds)
          Adds records that should be deleted from repository (required*).
 RecordId[] getFailedRecords()
          Returns the records that failed deletion.
 Integer getReturnCode(RecordId recordId)
          Returns the reason the record failed deletion.
 RecordId[] getSucceededRecords()
          Returns the records that were successfully deleted.
 TableId getTable()
          Returns table ID.
 boolean isDeleteAnyway()
          Specify if the record should be deleted even if the change stamps are out-of-date.
 boolean isSlice()
          Returns whether slicing is enabled.
 void setDeleteAnyway(boolean isDeleteAnyway)
          Specify if the records should be deleted even if the change stamps are out-of-date (optional).
 void setSlice(boolean isSlice)
          Enable slicing during record deletion.
 void setTable(TableId tableId)
          Sets the table Id the records are from (required).
 
Methods inherited from class com.sap.mdm.commands.AbstractCommand
getSession, setSession
 
Methods inherited from class com.sap.mdm.commands.AbstractCommandBase
execute, getPassport, isCommandComplete, setPassport
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeleteRecordsCommand

public DeleteRecordsCommand(ConnectionAccessor connection)
Constructor

Parameters:
connection - a connection to the MDM server

DeleteRecordsCommand

public DeleteRecordsCommand(UserSessionContext ctx)
                     throws ConnectionException,
                            SessionException
Creates a new instance of this command by context.

Parameters:
ctx - the user session context.
Method Detail

getTable

public TableId getTable()
Returns table ID.

Returns:
table ID

setTable

public void setTable(TableId tableId)
Sets the table Id the records are from (required).

Parameters:
tableId - the table Id

addRecords

public void addRecords(Record[] records)
Adds records that should be deleted from repository (required*).

Parameters:
records - array of record

addRecords

public void addRecords(RecordId[] recordIds)
Adds records that should be deleted from repository (required*).

Parameters:
recordIds - array of record IDs

addRecord

public void addRecord(Record record)
Adds a record to the list of records that should be deleted from repository (required*).

Parameters:
record - record

addRecord

public void addRecord(RecordId recordId)
Adds a record to the list of records that should be deleted from repository (required*).

Parameters:
recordId - the record Id

setDeleteAnyway

public void setDeleteAnyway(boolean isDeleteAnyway)
Specify if the records should be deleted even if the change stamps are out-of-date (optional). The default is false.

Parameters:
isDeleteAnyway - specify if the record should be deleted anyway

isDeleteAnyway

public boolean isDeleteAnyway()
Specify if the record should be deleted even if the change stamps are out-of-date.

Returns:
true if the record should be deleted anyway, false otherwise

setSlice

public void setSlice(boolean isSlice)
Enable slicing during record deletion.

Parameters:
isSlice - true to enable, false to disable
Since:
7.1 SP7

isSlice

public boolean isSlice()
Returns whether slicing is enabled.

Returns:
true to enable, false to disable
Since:
7.1 SP7

getFailedRecords

public RecordId[] getFailedRecords()
Returns the records that failed deletion.

Note: When slicing is enabled, records are divided into subsets. For a given subset of records, if a record failed the operation, the whole subset of records are marked as failed. It is not possible to determine which record in the subset triggered the failure.

Returns:
the list of failed records
Since:
7.1 SP7

getSucceededRecords

public RecordId[] getSucceededRecords()
Returns the records that were successfully deleted.

Returns:
the list of succeeded records
Since:
7.1 SP7

getReturnCode

public Integer getReturnCode(RecordId recordId)
Returns the reason the record failed deletion.

Parameters:
recordId - a record Id
Returns:
returns the return code for the failed record; if it's not a failed record, return null
Since:
7.1 SP7
See Also:
RC


Copyright 2004-2007 by SAP AG. All Rights Reserved.

SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.