Same IS document generating multiple CAF bean classes

If I have a process-level document reference, and a reference to the same document in a web service input/output, CAF generates two different classes, which are a pain to map in Java.

I’ve come up with various bad solutions to this, and no good ones. Here are the bad ones:

  • Write all the mapping manually. This is bad because it takes ages and is pretty unmaintainable.
  • Use BeanUtils.copyProperties(dest,src). This is useless because it only does a shallow copy.
  • Combine the previous two suggestions. This is bad because it’s still pretty unmaintainable, and also brittle.
  • Map the copy in a CAF Action. This is bad because then I generate many, many actions on an already cluttered Bindings view, and have to add document references of all the different types to act as temporary variables.

And here would be two of (possibly many) very good answers:

  • Here’s a setting, Rob, that lets you make bean code recognise that two document types are equivalent, so they use the same document type. It will survive regenerating web service bindings and refreshing business data from IS.
  • Here’s a method, Rob, which is specifically for deep copying from one bean to another of the same structure. Just use that! It’s like a recursive BeanUtils.copyProperties.

Any good answer much appreciated, or if there are none, that would also be helpful to know! Thanks :slight_smile:

The “Use WSDL schema namespace values for generating java package names” designer preference may be useful for this use case. See the attached screenshot.

With that preference set, the output of the web service connector generation would use the namespaces in the schema to determine the java package of the generated java classes. So if two services have the same type in their schema, it would use the same java classes for both web service connectors.

Hi Eric

Thanks, that’ll definitely be useful in the future! But my case is slightly different: one document is from a web service, and the other is a document reference from business data.

The business data doc generates a nice-looking type based on the document’s location is IS, like this:

The web service doc is namespaced to the web service, like this:

And even the new way you’ve shown me is specific to the machine name, and is still specific to the WSD:

If there’s no way to easily do deep copying of bean properties from one “type” to another (even though they’re actually the same document), or specifying that the (really good) structure that the business data uses is also to be used for WSD document types, then I’m not sure what to do, short of just writing a load of mapping code.

Ironically, I’m pretty sure CAF can do this stuff; I think if I mapped in Data Flow from one document type to a structurally identical one, it would just work. Can I access that functionality?

Also, how’s this: there’s a boolean in the document. Generating from Business Data produces an getField() getter, while generating from WSD produces


. Just to make sure that even BeanUtils.copyProperties() won’t work :slight_smile: