In this lesson, you create a task command that builds a
PushUser request SDO. You use the MyCompanyMember client API to transmit
the message and handle the PushUserConfirmation response SDO.
Procedure
- Create the MyCompanyPushUserCmd command interface.
- In the Enterprise Explorer view,
expand the WebSphereCommerceServerExtensionsLogic project.
- Right-click the src folder.
- Select .
- In the name field, type
com.mycompany.commerce.member.client.commands
.
- Click Finish.
- Right-click the com.mycompany.commerce.member.client.commands package.
- Select .
- In the name field, type: MyCompanyPushUserCmd.
- Click the Add button next to the field
Extended interfaces.
- Enter TaskCommand in the Choose
interfaces input field.
- Click OK.
- Click Finish.
- Add the following import statements to the interface:
import com.ibm.commerce.user.objects.UserAccessBean;
import
com.mycompany.commerce.member.facade.datatypes.PushUserConfirmationType;
- Add the following into the interface body:
/**
* The full name of this command.
*/
public static final String NAME =
"com.mycompany.commerce.member.client.commands.MyCompanyPushUserCmd";
/**
* The default implementation of this command.
*/
public static final String defaultCommandClassName = NAME + "Impl";
/**
* The invocation service action
<code>CreateUser</code>.
*/
public static final String ACTION_CREATE_USER = "CreateUser";
/**
* The invocation service action
<code>UpdateUser</code>.
*/
public static final String ACTION_UPDATE_USER = "UpdateUser";
/**
* Sets the invocation service action.
* @param action the invocation service action.
*/
public void setAction(String action);
/**
* Sets the user ID.
* @param userID the user ID.
*/
public void setPushUserID(Long userID);
/**
* Sets the user access bean.
* @param user the user access bean.
*/
public void setPushUser(UserAccessBean user );
/**
* Returns the PushUserConfirmation SDO.
* @return the PushUserConfirmation SDO.
*/
public PushUserConfirmationType getResponse();
- Save and close the file.
- Create the MyCompanyPushUserCmdImpl task command to populate
the request message.
- Right-click the com.mycompany.commerce.member.client.commands package.
- Select .
- In the field Name, type: MyCompanyPushUserCmdImpl
- Click the Browse button next to the field
Superclass.
- Enter TaskCommandImpl in the Choose
a type input field.
- Click OK.
- Click the Add button next to the field
interfaces.
- Enter MyCompanyPushUserCmd in the Choose
interfaces input field.
- Click OK.
- Click Finish.
- Replace the contents of this class with the contents
of the following downloadable sample code: MyCompanyPushUserCmdImpl.java
- Save and close the file.