on 10-07-2008 12:51 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.