How to Manage Nickname with API

Most of the case, your model just needs to be share by your team, and they are in single language. But in some organizations, especially those with branches in multiple countries, you may need to share your model with different teams, and probably they are using different language. It is painful that you need to maintain multiple sets of models, each on one language. Every time when you need to make modification, you need apply the same modification on all the models you have. This is time very annoying and consuming.

This is why we introduced the nickname feature. The nickname feature allows you to define nicknames on your model. By using nickname, you can define different naming layer on the same set of models. That means you only need to maintain one set of model, no matter they are in what language.

Starting from VP Suite 5.2 (build 20110629b), we introduced new interface to let you specify control the nickname in your projects. This article will teach you how to create nickname in your project using Open API.

Creating nickname

You can call the method IProject.addNickname(String name) to create a new nickname to your project. This method will return true of the operation is success, and false if fail.

Listing nickname in your project

To list out all the nicknames within your project, you can call IProject.getNicknames(). This method will return a String array containing the name for all nicknames.

Switch between nicknames

Once you listed out the nicknames, you can walk through it and use the IProject.setNicknames(String name) to change the nickname. To switch back to the original name, you can simply pass null to the setNicknames() method. This method will throw an IllegalArgumentException if the nickname you try to set does not exist in project.

Sample plugins

This sample plugin demonstrate how to work with nickname using Open API. Once you have deployed the plugin into VP Application, you will find 3 buttons in your application toolbar (for standalone VP application only). You can use these buttons to create nickname for your project, list out all the nickname in your project, also switch between nicknames.

Buttons created Open API for accessing nickname

Buttons created Open API for accessing nickname

Download Sample Plugin

You can download the sample plugins at here.

API Requirement

This method supported since VP Suite 5.2 build 20110629b. The API documentation can be found at here.

Related Articles

Related Links

1588 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply