cancel
Showing results for 
Search instead for 
Did you mean: 

Mixed Java Bean - RFC Model

former_member190457
Contributor
0 Kudos

Hi developers,

I have a RFC generated model (RFCModel) with one class (Z_Employer).

I have a plain java class (Employee) with several attributes, getters and setters.

An attribute of type Z_Employer has been defined for Employee.

Employee

|--- String: name

|--- String: surname

|--- String: address

|--- Z_Employer: the_employer

Upon importing Employee in NWDS as Java Bean model, I found out that the Z_Employer field was modelled as a node attribute and not with a relationship/association. As a consequence, a model node based on Employee class would not have a childnode Employer, but only a model attribute Employer.

Build dependency and paths are appropriately set.

Can anyone please explain how to get Employer to be a childnode and not an attribute?

Thanks indeed,

Vincenzo

Accepted Solutions (1)

Accepted Solutions (1)

former_member197348
Active Contributor
0 Kudos

Hi Vincenzo,

If I understood your requirement correctly, you have a Employee.java and want to represent it as a child node.

Directly you can not bind a java class to a node, you can bind it to an attribute only.

You have two options here.

1.If you have plain getters and setters in java class (Employee), you can create structures in dictionary of your WD aplication.

Then create a node with this structure binding (you can check this option while creating a node)

2. If you have some more business logic other than getters and setters in java class (Employee).

Create a method which returns java.util.Collection

Create a node and attributes of respective types.

Call the above method and fill your node in wdDoInit().

Regards,

Siva

former_member190457
Contributor
0 Kudos

Thanks for your replies.

Let me elaborate. I have several RFC-generated model classes (such as Z_EmployeR) which provide useful facilities such as type validation when bound to UI elements, I don't want to rewrite them from scratch.

However I want to be able to reorganize them in a more logical structure according to my UML model, under class Employee as associations.

Employee (plain java bean)

| String: name

| String: surname

|----


Z_Company (RFC model class)

|----


Z_Employer (RFC model class)

|----


Z_Department (RFC model class)

-


methods:

getCompany (executes z_get_company RFC)

getEmployer (executes z_get_emplyer RFC)

getDepartment (executes z_get_department RFC)

At design time, upon creating a model node bound to Employee I would like the Z_company,z_employer,z_department child model nodes to be created automatically just the way it normally does when rather than rfc classes you have associations with other javabeans.

Moreover, I cannot create these relationships in the relationship editor when importing the javabean, as they actually belong to another model and are not displayed in the drop down menu for relationship creation. In other words: you cannot create relationship between model class A (belonging to model Foo) and model class B (belonging to a different model Boo).

Can anyone please help?

Thanks, Vincenzo

Former Member
0 Kudos

Hi Vincenzo, Hi all

I am happy to read your post.

I have the same problem and I am trying to enlarge my imagitation to solve it.

Hoping to read your replies about it, enjoy WDJ.

Regards,

Mirco.

former_member190457
Contributor
0 Kudos

Upon massive testing and attempts, I actually doubt this can be achieved.

What you can do is extending the auto-generated model class and use this child class when programmatically binding an object to a model node.

Thanks, kind regards, Vincenzo

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Vincenzo,

I am in the same problem area as well. Complex as it is.

Though, I would like to ask: does your Z_Employer attribute have its own getter/setter? I believe it should have - As I have. After mapping, my node should look like this:

Employer

.. - name

.. - id

.... - Z_Employer

...... - employerID

...... - employerName

Cheers!

-Jan