How to create instance (Java)?

Description
vanlik
Posts: 3
Joined: Mon Apr 22, 2013 2:55 pm

How to create instance (Java)?

Postby vanlik » Mon Apr 22, 2013 3:47 pm

Hi All,

I'm trying to create some code on Wiki page. And I have a question about how I can create new instance of Object? For example, I need do some string manipulation. And I've found Class StringTokenizer wich will help me to manipulate with strings. But I don't understand how to create object of class StringTokenizer. I now that in Java it easy just: "StringTokenizer st = new StringTokenizer("this is a test");" But how it can be done in polarion with "#set"?
Best Regards,
Vladimir

Flominator
Posts: 12
Joined: Thu Apr 11, 2013 12:24 pm

Re: How to create instance (Java)?

Postby Flominator » Mon May 13, 2013 7:10 am

I've come accross the same problem and didn't find the real solution, yet.

Once I had this problem when it came to create a new role for a linked workitem. Since I wasn't able to create a new one, I read one from an existing workitem and assigned that to my object.

A solution how to invoke the new operator would be fine, though!

Sandro_F
Posts: 19
Joined: Wed Jan 19, 2011 8:40 am

Re: How to create instance (Java)?

Postby Sandro_F » Thu Jun 27, 2013 11:12 am

You can put your "own" objects to wiki context. Have a look in implementation of this extension:
http://extensions.polarion.com/polarion ... ion=PE-174

First configure a service point and define an implementation class:

<service-point id="polarionTool"
interface="com.polarion.alm.extension.vcontext.PolarionTool"
visibility="private">
<invoke-factory>
<construct class="com.polarion.alm.extension.vcontext.PolarionToolImpl">
<service>com.polarion.platform.repository.repositoryService</service>
</construct>
</invoke-factory>
</service-point>

So you can create a object within a custom plugin like this:

public class PolarionToolImpl {

private StringTokenizer st = new StringTokenizer ();

public PolarionToolImpl() {
super();
}

public StringTokenizer getTokenizerObj() {
return st;
}

}

At a wiki page you can do something like this to get your StringTokenizer object:

$polarionTool.getTokenizerObj()


Regards,
Sandro


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 4 guests