This step is identical to that in You want to read some data from a database table above.
This step is identical to that in You want to read some data from a database table above.
This step is identical to that in You want to insert a new row onto a database table above.
For facades which contain both of these kinds of methods, it is likely that the steps to map client data to setters are very similar. Any identical processing should be factored into a common method:
// ... /** * Maps client details to the setters on the service-layer API * * @param someEntity * the service-layer instance of the entity * @param someEntityDtls * the client details to map * */ private void setSomeEntityDetails(final SomeEntity someEntity, final SomeEntityDtls someEntityDtls) { // map the details someEntity.setName(someEntityDtls.name); final DateRange dateRange = new DateRange(someEntityDtls.startDate, someEntityDtls.endDate); someEntity.setDateRange(dateRange); // ...more mappings } // ...
Note that this method cannot be modeled as the entity interface argument is not present in the Cúram model; thus this method is private to the Java implementation.
Once the entity instance has been populated with data supplied by the client, you must code a call for the entity instance to store its changes:
// do the modify, passing the version number from the client someEntity.modify(details.details.versionNo);
/** ********** VERY VERY BAD - DO NOT DO THIS! ********** */ // do the modify, passing the version number from the entity // instance someEntity.modify(someEntity.getVersionNo()); /** ********** VERY VERY BAD - DO NOT DO THIS! ********** */