VMware Cloud Community
NutanNandanwar
Contributor
Contributor
Jump to solution

How to hide some property of scripting Object in model driven archetype

I am using Model driven archetype for developing vRO plugin.

I want to hide some property from my Object For example:

I have a model named Connection.

public class Connection{

     private String ipaddress;

     private String userName;

     private String port;

}

from the above if i want to expose only userName in vRO side so how we can do that, as in inventory annotation archetype we can do it using @VsoProperty(hidden = true).

and same thing for methods as well, how we can expose few methods/property to vRO?

1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

There are 2 modeldriven interfaces - WrapDescriptor and FinderDescriptor - that have a method named hiding(...), which you can use to specify which attributes, etc. you want to 'hide'.

I think it is usually done in your custom mapping class (which extends modeldriven's AbstractMapping class) where you wrap() your model objects.

View solution in original post

4 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

There are 2 modeldriven interfaces - WrapDescriptor and FinderDescriptor - that have a method named hiding(...), which you can use to specify which attributes, etc. you want to 'hide'.

I think it is usually done in your custom mapping class (which extends modeldriven's AbstractMapping class) where you wrap() your model objects.

NutanNandanwar
Contributor
Contributor
Jump to solution

Thanks a lot Ilian..

It worked.

One more thing is regarding changing the display name of the attribute.

For example :  connectionName should be displayed as "Connection Name"

              Say ipaddress should be displayed as IP Address

So how we can achieve this in model driven as in annotation based we use

@VsoProperty(

displayName = "Connection Name")

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Your custom mapping class has a method describeFinderProperties(...) which accepts as a parameter a name of a resource file containing properties to customize your finder definitions (the resource file is usually located at src/main/resources/ folder in the plug-in's Maven module).

Inside the resource file you can put lines that look something like

*.connectionName=Connection Name

or

YourModelObject.connectionName=Connection Name

The first variant should define the display name for finder property named connectionName for all of your model object, and the second variant - only for a particular model object. At least that's I suppose it should work (haven't tried it yet).

NutanNandanwar
Contributor
Contributor
Jump to solution

Thanks Llian for the solution.

We are able to achieve this as well.

Reply
0 Kudos