Asset Tracker API

(I’m sorry, I’m not sure if this is the right forum for this, If it isn’t
I’d love to know what is.)

I’ve set up AT 1.2.4b1 with RT 3.8.4 and used a script written by
Jean-Sebastien Morisset to import my assets from our old DB. I now want to
recreated the links between assets.

I’m wondering if anyone could point me in the right direction for finding
what the set links equivalent to the set fields code below:

my ($id, $t, $msg) = $at->Create (

                            Name => $csv[$csv_map{"Name"}],

                            Status => $csv[$csv_map{"Status"}],

                            Type => $csv[$csv_map{"Type"}],

What file in AT contains the handlers for these so that I can just inspect
it to see what else it can do?

Thanks,

Mike

It should be similar to adding links to tickets.

Ticket example: $TicketObj->AddLink(Type=>‘RefersTo’,Target=>$ticket->id);

So asset would be: $at->AddLink(Type=>‘RefersTo’,Target=> $at->URI);

The default link types are:

RefersTo
ReferredToBy
RunsOn
IsRunning
DependsOn
DependedOnBy
ComponentOf
HasComponent
Components

Unlike RT, AT’s link types are configurable. See AT_Config.pm.On Wed, Aug 12, 2009 at 12:06 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

(I’m sorry, I’m not sure if this is the right forum for this, If it isn’t
I’d love to know what is.)

I’ve set up AT 1.2.4b1 with RT 3.8.4 and used a script written by
Jean-Sebastien Morisset to import my assets from our old DB. I now want to
recreated the links between assets.

I’m wondering if anyone could point me in the right direction for finding
what the set links equivalent to the set fields code below:

my ($id, $t, $msg) = $at->Create (

                            Name => $csv[$csv_map{"Name"}],

                            Status => $csv[$csv_map{"Status"}],

                            Type => $csv[$csv_map{"Type"}],

What file in AT contains the handlers for these so that I can just inspect
it to see what else it can do?

Thanks,

Mike

Just to clarify, in…

 $at->AddLink(Type=>'RefersTo',Target=> $at->URI);

… “Target” is the URI of the RefersTo link, while the URI at the end of the line becomes the corresponding ReferredToBy?

-MikeFrom: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Todd Chapman
Sent: August-12-09 12:04 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

It should be similar to adding links to tickets.

Ticket example: $TicketObj->AddLink(Type=>‘RefersTo’,Target=>$ticket->id);

So asset would be: $at->AddLink(Type=>‘RefersTo’,Target=> $at->URI);

The default link types are:

RefersTo
ReferredToBy
RunsOn
IsRunning
DependsOn
DependedOnBy
ComponentOf
HasComponent
Components

Unlike RT, AT’s link types are configurable. See AT_Config.pm.

My bad. If you want to link $at to $other_at:

$at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

Try it and see.On Wed, Aug 12, 2009 at 4:38 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Just to clarify, in…

    $at->AddLink(Type=>'RefersTo',Target=> $at->URI);

… “Target” is the URI of the RefersTo link, while the URI at the end of the line becomes the corresponding ReferredToBy?

-Mike

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Todd Chapman
Sent: August-12-09 12:04 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

It should be similar to adding links to tickets.

Ticket example: $TicketObj->AddLink(Type=>‘RefersTo’,Target=>$ticket->id);

So asset would be: $at->AddLink(Type=>‘RefersTo’,Target=> $at->URI);

The default link types are:

RefersTo
ReferredToBy
RunsOn
IsRunning
DependsOn
DependedOnBy
ComponentOf
HasComponent
Components

Unlike RT, AT’s link types are configurable. See AT_Config.pm.

On Wed, Aug 12, 2009 at 12:06 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

(I’m sorry, I’m not sure if this is the right forum for this, If it isn’t
I’d love to know what is.)

I’ve set up AT 1.2.4b1 with RT 3.8.4 and used a script written by
Jean-Sebastien Morisset to import my assets from our old DB. I now want to
recreated the links between assets.

I’m wondering if anyone could point me in the right direction for finding
what the set links equivalent to the set fields code below:

my ($id, $t, $msg) = $at->Create (

                            Name => $csv[$csv_map{"Name"}],

                            Status => $csv[$csv_map{"Status"}],

                            Type => $csv[$csv_map{"Type"}],

What file in AT contains the handlers for these so that I can just inspect
it to see what else it can do?

Thanks,

Mike


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Either I not understanding something or I think I might have confused the issue by leaving some ambiguity in what I was asking. I’m just dealing with one DB now. Here’s the situation:

-I have imported the assets themselves from our old helpdesk software’s DB into RTAT’s DB.
-I have a table of linked assets from the old system.
-I want to use this table as input to create links in the new RTAT. I can massage the input data as needed to have it in “Name”, “URI”, or whatever.

I’m a perl newbie so I want to make sure I understand this: $at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

$at = RTx::AssetTracker::Asset->new(RT->SystemUser)
AddLink is presumably a function in AssetTracker
RefersTo is the type of link
Target is the asset to create the ReferTo link to? And what kind of info does it want here (Name, URI, ?)?
$other_at = ??? (or did I make you think I was trying to link between two different RTAT systems?)
URI is the uri of the asset the link is created in/from?

Does the reverse link get created automatically, or should I repeat the statement, reversing Target and URI and flip the linktype?

Thanks,

MikeFrom: Todd Chapman [mailto:todd@chaka.net]
Sent: August-12-09 3:46 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

My bad. If you want to link $at to $other_at:

$at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

Try it and see.

After callin $at->new you have to call $at->Load. Once the asset is
loaded you can call AddLink. Links are bi-directional so you don’t
have to add the reverse link.On Thu, Aug 13, 2009 at 11:41 AM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Either I not understanding something or I think I might have confused the issue by leaving some ambiguity in what I was asking. I’m just dealing with one DB now. Here’s the situation:

-I have imported the assets themselves from our old helpdesk software’s DB into RTAT’s DB.
-I have a table of linked assets from the old system.
-I want to use this table as input to create links in the new RTAT. I can massage the input data as needed to have it in “Name”, “URI”, or whatever.

I’m a perl newbie so I want to make sure I understand this: $at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

$at = RTx::AssetTracker::Asset->new(RT->SystemUser)
AddLink is presumably a function in AssetTracker
RefersTo is the type of link
Target is the asset to create the ReferTo link to? And what kind of info does it want here (Name, URI, ?)?
$other_at = ??? (or did I make you think I was trying to link between two different RTAT systems?)
URI is the uri of the asset the link is created in/from?

Does the reverse link get created automatically, or should I repeat the statement, reversing Target and URI and flip the linktype?

Thanks,

Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-12-09 3:46 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

My bad. If you want to link $at to $other_at:

$at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

Try it and see.

On Wed, Aug 12, 2009 at 4:38 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Just to clarify, in…

    $at->AddLink(Type=>'RefersTo',Target=> $at->URI);

… “Target” is the URI of the RefersTo link, while the URI at the end of the line becomes the corresponding ReferredToBy?

-Mike

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Todd Chapman
Sent: August-12-09 12:04 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

It should be similar to adding links to tickets.

Ticket example: $TicketObj->AddLink(Type=>‘RefersTo’,Target=>$ticket->id);

So asset would be: $at->AddLink(Type=>‘RefersTo’,Target=> $at->URI);

The default link types are:

RefersTo
ReferredToBy
RunsOn
IsRunning
DependsOn
DependedOnBy
ComponentOf
HasComponent
Components

Unlike RT, AT’s link types are configurable. See AT_Config.pm.

On Wed, Aug 12, 2009 at 12:06 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

(I’m sorry, I’m not sure if this is the right forum for this, If it isn’t
I’d love to know what is.)

I’ve set up AT 1.2.4b1 with RT 3.8.4 and used a script written by
Jean-Sebastien Morisset to import my assets from our old DB. I now want to
recreated the links between assets.

I’m wondering if anyone could point me in the right direction for finding
what the set links equivalent to the set fields code below:

my ($id, $t, $msg) = $at->Create (

                            Name => $csv[$csv_map{"Name"}],

                            Status => $csv[$csv_map{"Status"}],

                            Type => $csv[$csv_map{"Type"}],

What file in AT contains the handlers for these so that I can just inspect
it to see what else it can do?

Thanks,

Mike


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Ah Cool, thanks. I really appreciate the help. My manager’s confidence in AT is bolstered by the fact that the developer is still answering questions.

I managed to make some headway before seeing your email, I’ve got a script that can add the links and they are showing up in rt3.Link in the DB. However, the links are not showing in the UI.

Here is my test script:

#!/usr/bin/perl
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
use RT;
use RTx::AssetTracker::Asset;
use Getopt::Std;
use strict;
RT::LoadConfig();
RT::Init();
my $at = RTx::AssetTracker::Asset->new(RT->SystemUser);
my $URI = ‘at://rt.lib.umanitoba.ca/asset/4189’;
if (my $id = $at->Load(“labdaf01”)){
$at->AddLink(Type=>‘HasComponent’,Target=> $URI);
exit 0;}
else {die ‘invalid asset’;}

rt3.Links has a corresponding:

17 | at://rt.lib.umanitoba.ca/asset/3889 | at://rt.lib.umanitoba.ca/asset/4189 | HasComponent | 0 | 0 | 1 | 2009-08-14 18:30:45 | 1 | 2009-08-14 18:30:45
Where 3389 is the URI for labdaf01

But the UI doesn’t show the link. I thought maybe I’m missing a privilege, but I’m SuperUser in the UI. What am I missing?

-MikeFrom: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 1:09 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

After callin $at->new you have to call $at->Load. Once the asset is
loaded you can call AddLink. Links are bi-directional so you don’t
have to add the reverse link.

Not sure why. Do links created in the UI show up?On Fri, Aug 14, 2009 at 3:26 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Ah Cool, thanks. I really appreciate the help. My manager’s confidence in AT is bolstered by the fact that the developer is still answering questions.

I managed to make some headway before seeing your email, I’ve got a script that can add the links and they are showing up in rt3.Link in the DB. However, the links are not showing in the UI.

Here is my test script:

#!/usr/bin/perl
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
use RT;
use RTx::AssetTracker::Asset;
use Getopt::Std;
use strict;
RT::LoadConfig();
RT::Init();
my $at = RTx::AssetTracker::Asset->new(RT->SystemUser);
my $URI = ‘at://rt.lib.umanitoba.ca/asset/4189’;
if (my $id = $at->Load(“labdaf01”)){
$at->AddLink(Type=>‘HasComponent’,Target=> $URI);
exit 0;}
else {die ‘invalid asset’;}

rt3.Links has a corresponding:

17 | at://rt.lib.umanitoba.ca/asset/3889 | at://rt.lib.umanitoba.ca/asset/4189 | HasComponent | 0 | 0 | 1 | 2009-08-14 18:30:45 | 1 | 2009-08-14 18:30:45
Where 3389 is the URI for labdaf01

But the UI doesn’t show the link. I thought maybe I’m missing a privilege, but I’m SuperUser in the UI. What am I missing?

-Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 1:09 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

After callin $at->new you have to call $at->Load. Once the asset is
loaded you can call AddLink. Links are bi-directional so you don’t
have to add the reverse link.

On Thu, Aug 13, 2009 at 11:41 AM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Either I not understanding something or I think I might have confused the issue by leaving some ambiguity in what I was asking. I’m just dealing with one DB now. Here’s the situation:

-I have imported the assets themselves from our old helpdesk software’s DB into RTAT’s DB.
-I have a table of linked assets from the old system.
-I want to use this table as input to create links in the new RTAT. I can massage the input data as needed to have it in “Name”, “URI”, or whatever.

I’m a perl newbie so I want to make sure I understand this: $at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

$at = RTx::AssetTracker::Asset->new(RT->SystemUser)
AddLink is presumably a function in AssetTracker
RefersTo is the type of link
Target is the asset to create the ReferTo link to? And what kind of info does it want here (Name, URI, ?)?
$other_at = ??? (or did I make you think I was trying to link between two different RTAT systems?)
URI is the uri of the asset the link is created in/from?

Does the reverse link get created automatically, or should I repeat the statement, reversing Target and URI and flip the linktype?

Thanks,

Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-12-09 3:46 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

My bad. If you want to link $at to $other_at:

$at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

Try it and see.

On Wed, Aug 12, 2009 at 4:38 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Just to clarify, in…

    $at->AddLink(Type=>'RefersTo',Target=> $at->URI);

… “Target” is the URI of the RefersTo link, while the URI at the end of the line becomes the corresponding ReferredToBy?

-Mike

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Todd Chapman
Sent: August-12-09 12:04 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

It should be similar to adding links to tickets.

Ticket example: $TicketObj->AddLink(Type=>‘RefersTo’,Target=>$ticket->id);

So asset would be: $at->AddLink(Type=>‘RefersTo’,Target=> $at->URI);

The default link types are:

RefersTo
ReferredToBy
RunsOn
IsRunning
DependsOn
DependedOnBy
ComponentOf
HasComponent
Components

Unlike RT, AT’s link types are configurable. See AT_Config.pm.

On Wed, Aug 12, 2009 at 12:06 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

(I’m sorry, I’m not sure if this is the right forum for this, If it isn’t
I’d love to know what is.)

I’ve set up AT 1.2.4b1 with RT 3.8.4 and used a script written by
Jean-Sebastien Morisset to import my assets from our old DB. I now want to
recreated the links between assets.

I’m wondering if anyone could point me in the right direction for finding
what the set links equivalent to the set fields code below:

my ($id, $t, $msg) = $at->Create (

                            Name => $csv[$csv_map{"Name"}],

                            Status => $csv[$csv_map{"Status"}],

                            Type => $csv[$csv_map{"Type"}],

What file in AT contains the handlers for these so that I can just inspect
it to see what else it can do?

Thanks,

Mike


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Yes, I should have mentioned that.

-MikeFrom: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 2:56 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

Not sure why. Do links created in the UI show up?

| 17 | at://rt.lib.umanitoba.ca/asset/3889 | at://rt.lib.umanitoba.ca/asset/4189 | HasComponent | 0 | 0 | 1 | 2009-08-14 18:30:45 | 1 | 2009-08-14 18:30:45 |
| 18 | at://rt.lib.umanitoba.ca/asset/4189 | at://rt.lib.umanitoba.ca/asset/3890 | ComponentOf | 0 | 0 | 12 | 2009-08-14 18:36:10 | 12 | 2009-08-14 18:36:10 |

17 created by my script doesn’t display in the UI, while 18 created by root in the UI does. The only difference seems to be the LastUpdatedBy and Creator fields.

Thinking that it might be a privileges issue, I even tried setting the creator field manually after creating a link with the script:

| 16 | at://rt.lib.umanitoba.ca/asset/3889 | at://rt.lib.umanitoba.ca/asset/2904 | HasComponent | 0 | 0 | 1 | 2009-08-14 18:20:28 | 12 | 2009-08-14 18:20:28 |

Here, in 16, the Creator was changed to 12 using a set command, however it is still not visible in the UI.

-MikeFrom: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 3:15 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

What do the DB entries look like for asset that do show up in the UI?

What do the DB entries look like for asset that do show up in the UI?On Fri, Aug 14, 2009 at 4:11 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Yes, I should have mentioned that.

-Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 2:56 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

Not sure why. Do links created in the UI show up?

On Fri, Aug 14, 2009 at 3:26 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Ah Cool, thanks. I really appreciate the help. My manager’s confidence in AT is bolstered by the fact that the developer is still answering questions.

I managed to make some headway before seeing your email, I’ve got a script that can add the links and they are showing up in rt3.Link in the DB. However, the links are not showing in the UI.

Here is my test script:

#!/usr/bin/perl
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
use RT;
use RTx::AssetTracker::Asset;
use Getopt::Std;
use strict;
RT::LoadConfig();
RT::Init();
my $at = RTx::AssetTracker::Asset->new(RT->SystemUser);
my $URI = ‘at://rt.lib.umanitoba.ca/asset/4189’;
if (my $id = $at->Load(“labdaf01”)){
$at->AddLink(Type=>‘HasComponent’,Target=> $URI);
exit 0;}
else {die ‘invalid asset’;}

rt3.Links has a corresponding:

17 | at://rt.lib.umanitoba.ca/asset/3889 | at://rt.lib.umanitoba.ca/asset/4189 | HasComponent | 0 | 0 | 1 | 2009-08-14 18:30:45 | 1 | 2009-08-14 18:30:45
Where 3389 is the URI for labdaf01

But the UI doesn’t show the link. I thought maybe I’m missing a privilege, but I’m SuperUser in the UI. What am I missing?

-Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 1:09 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

After callin $at->new you have to call $at->Load. Once the asset is
loaded you can call AddLink. Links are bi-directional so you don’t
have to add the reverse link.

On Thu, Aug 13, 2009 at 11:41 AM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Either I not understanding something or I think I might have confused the issue by leaving some ambiguity in what I was asking. I’m just dealing with one DB now. Here’s the situation:

-I have imported the assets themselves from our old helpdesk software’s DB into RTAT’s DB.
-I have a table of linked assets from the old system.
-I want to use this table as input to create links in the new RTAT. I can massage the input data as needed to have it in “Name”, “URI”, or whatever.

I’m a perl newbie so I want to make sure I understand this: $at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

$at = RTx::AssetTracker::Asset->new(RT->SystemUser)
AddLink is presumably a function in AssetTracker
RefersTo is the type of link
Target is the asset to create the ReferTo link to? And what kind of info does it want here (Name, URI, ?)?
$other_at = ??? (or did I make you think I was trying to link between two different RTAT systems?)
URI is the uri of the asset the link is created in/from?

Does the reverse link get created automatically, or should I repeat the statement, reversing Target and URI and flip the linktype?

Thanks,

Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-12-09 3:46 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

My bad. If you want to link $at to $other_at:

$at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

Try it and see.

On Wed, Aug 12, 2009 at 4:38 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Just to clarify, in…

    $at->AddLink(Type=>'RefersTo',Target=> $at->URI);

… “Target” is the URI of the RefersTo link, while the URI at the end of the line becomes the corresponding ReferredToBy?

-Mike

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Todd Chapman
Sent: August-12-09 12:04 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

It should be similar to adding links to tickets.

Ticket example: $TicketObj->AddLink(Type=>‘RefersTo’,Target=>$ticket->id);

So asset would be: $at->AddLink(Type=>‘RefersTo’,Target=> $at->URI);

The default link types are:

RefersTo
ReferredToBy
RunsOn
IsRunning
DependsOn
DependedOnBy
ComponentOf
HasComponent
Components

Unlike RT, AT’s link types are configurable. See AT_Config.pm.

On Wed, Aug 12, 2009 at 12:06 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

(I’m sorry, I’m not sure if this is the right forum for this, If it isn’t
I’d love to know what is.)

I’ve set up AT 1.2.4b1 with RT 3.8.4 and used a script written by
Jean-Sebastien Morisset to import my assets from our old DB. I now want to
recreated the links between assets.

I’m wondering if anyone could point me in the right direction for finding
what the set links equivalent to the set fields code below:

my ($id, $t, $msg) = $at->Create (

                            Name => $csv[$csv_map{"Name"}],

                            Status => $csv[$csv_map{"Status"}],

                            Type => $csv[$csv_map{"Type"}],

What file in AT contains the handlers for these so that I can just inspect
it to see what else it can do?

Thanks,

Mike


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Might be a bug in AT. In your script change:

$at->AddLink(Type=>‘HasComponent’,Target=> $URI);

to:

$at->AddLink(Type=>‘HasComponent’,Base=> $URI);

All links of the type should be stored as “ComponentOf”.On Fri, Aug 14, 2009 at 4:21 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

| 17 | at://rt.lib.umanitoba.ca/asset/3889 | at://rt.lib.umanitoba.ca/asset/4189 | HasComponent | 0 | 0 | 1 | 2009-08-14 18:30:45 | 1 | 2009-08-14 18:30:45 |
| 18 | at://rt.lib.umanitoba.ca/asset/4189 | at://rt.lib.umanitoba.ca/asset/3890 | ComponentOf | 0 | 0 | 12 | 2009-08-14 18:36:10 | 12 | 2009-08-14 18:36:10 |

17 created by my script doesn’t display in the UI, while 18 created by root in the UI does. The only difference seems to be the LastUpdatedBy and Creator fields.

Thinking that it might be a privileges issue, I even tried setting the creator field manually after creating a link with the script:

| 16 | at://rt.lib.umanitoba.ca/asset/3889 | at://rt.lib.umanitoba.ca/asset/2904 | HasComponent | 0 | 0 | 1 | 2009-08-14 18:20:28 | 12 | 2009-08-14 18:20:28 |

Here, in 16, the Creator was changed to 12 using a set command, however it is still not visible in the UI.

-Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 3:15 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

What do the DB entries look like for asset that do show up in the UI?

On Fri, Aug 14, 2009 at 4:11 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Yes, I should have mentioned that.

-Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 2:56 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

Not sure why. Do links created in the UI show up?

On Fri, Aug 14, 2009 at 3:26 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Ah Cool, thanks. I really appreciate the help. My manager’s confidence in AT is bolstered by the fact that the developer is still answering questions.

I managed to make some headway before seeing your email, I’ve got a script that can add the links and they are showing up in rt3.Link in the DB. However, the links are not showing in the UI.

Here is my test script:

#!/usr/bin/perl
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
use RT;
use RTx::AssetTracker::Asset;
use Getopt::Std;
use strict;
RT::LoadConfig();
RT::Init();
my $at = RTx::AssetTracker::Asset->new(RT->SystemUser);
my $URI = ‘at://rt.lib.umanitoba.ca/asset/4189’;
if (my $id = $at->Load(“labdaf01”)){
$at->AddLink(Type=>‘HasComponent’,Target=> $URI);
exit 0;}
else {die ‘invalid asset’;}

rt3.Links has a corresponding:

17 | at://rt.lib.umanitoba.ca/asset/3889 | at://rt.lib.umanitoba.ca/asset/4189 | HasComponent | 0 | 0 | 1 | 2009-08-14 18:30:45 | 1 | 2009-08-14 18:30:45
Where 3389 is the URI for labdaf01

But the UI doesn’t show the link. I thought maybe I’m missing a privilege, but I’m SuperUser in the UI. What am I missing?

-Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 1:09 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

After callin $at->new you have to call $at->Load. Once the asset is
loaded you can call AddLink. Links are bi-directional so you don’t
have to add the reverse link.

On Thu, Aug 13, 2009 at 11:41 AM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Either I not understanding something or I think I might have confused the issue by leaving some ambiguity in what I was asking. I’m just dealing with one DB now. Here’s the situation:

-I have imported the assets themselves from our old helpdesk software’s DB into RTAT’s DB.
-I have a table of linked assets from the old system.
-I want to use this table as input to create links in the new RTAT. I can massage the input data as needed to have it in “Name”, “URI”, or whatever.

I’m a perl newbie so I want to make sure I understand this: $at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

$at = RTx::AssetTracker::Asset->new(RT->SystemUser)
AddLink is presumably a function in AssetTracker
RefersTo is the type of link
Target is the asset to create the ReferTo link to? And what kind of info does it want here (Name, URI, ?)?
$other_at = ??? (or did I make you think I was trying to link between two different RTAT systems?)
URI is the uri of the asset the link is created in/from?

Does the reverse link get created automatically, or should I repeat the statement, reversing Target and URI and flip the linktype?

Thanks,

Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-12-09 3:46 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

My bad. If you want to link $at to $other_at:

$at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

Try it and see.

On Wed, Aug 12, 2009 at 4:38 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Just to clarify, in…

    $at->AddLink(Type=>'RefersTo',Target=> $at->URI);

… “Target” is the URI of the RefersTo link, while the URI at the end of the line becomes the corresponding ReferredToBy?

-Mike

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Todd Chapman
Sent: August-12-09 12:04 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

It should be similar to adding links to tickets.

Ticket example: $TicketObj->AddLink(Type=>‘RefersTo’,Target=>$ticket->id);

So asset would be: $at->AddLink(Type=>‘RefersTo’,Target=> $at->URI);

The default link types are:

RefersTo
ReferredToBy
RunsOn
IsRunning
DependsOn
DependedOnBy
ComponentOf
HasComponent
Components

Unlike RT, AT’s link types are configurable. See AT_Config.pm.

On Wed, Aug 12, 2009 at 12:06 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

(I’m sorry, I’m not sure if this is the right forum for this, If it isn’t
I’d love to know what is.)

I’ve set up AT 1.2.4b1 with RT 3.8.4 and used a script written by
Jean-Sebastien Morisset to import my assets from our old DB. I now want to
recreated the links between assets.

I’m wondering if anyone could point me in the right direction for finding
what the set links equivalent to the set fields code below:

my ($id, $t, $msg) = $at->Create (

                            Name => $csv[$csv_map{"Name"}],

                            Status => $csv[$csv_map{"Status"}],

                            Type => $csv[$csv_map{"Type"}],

What file in AT contains the handlers for these so that I can just inspect
it to see what else it can do?

Thanks,

Mike


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Tried, no change. The new links are showing up in tables but not in the UI.

Is there any ACL for seeing links? Do links touch any other tables somehow?

-MikeFrom: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 4:17 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

Might be a bug in AT. In your script change:

$at->AddLink(Type=>‘HasComponent’,Target=> $URI);

to:

$at->AddLink(Type=>‘HasComponent’,Base=> $URI);

All links of the type should be stored as “ComponentOf”.

I should add that in the history for the asset in the ui it shows the
adding of the asset, but not in the links area.

MikeOn 2009-08-14, at 7:15 PM, “Michael Ellis” Michael_Ellis@umanitoba.ca wrote:

Tried, no change. The new links are showing up in tables but not in
the UI.

Is there any ACL for seeing links? Do links touch any other tables
somehow?

-Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 4:17 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

Might be a bug in AT. In your script change:

$at->AddLink(Type=>‘HasComponent’,Target=> $URI);

to:

$at->AddLink(Type=>‘HasComponent’,Base=> $URI);

All links of the type should be stored as “ComponentOf”.

On Fri, Aug 14, 2009 at 4:21 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

| 17 | at://rt.lib.umanitoba.ca/asset/3889 | at://
rt.lib.umanitoba.ca/asset/4189 | HasComponent
| 0 | 0 | 1 | 2009-08-14 18:30:45
| 1 | 2009-08-14 18:30:45 |
| 18 | at://rt.lib.umanitoba.ca/asset/4189 | at://
rt.lib.umanitoba.ca/asset/3890 | ComponentOf
| 0 | 0 | 12 | 2009-08-14 18:36:10
| 12 | 2009-08-14 18:36:10 |

17 created by my script doesn’t display in the UI, while 18 created
by root in the UI does. The only difference seems to be the
LastUpdatedBy and Creator fields.

Thinking that it might be a privileges issue, I even tried setting
the creator field manually after creating a link with the script:

| 16 | at://rt.lib.umanitoba.ca/asset/3889 | at://
rt.lib.umanitoba.ca/asset/2904 | HasComponent
| 0 | 0 | 1 | 2009-08-14 18:20:28
| 12 | 2009-08-14 18:20:28 |

Here, in 16, the Creator was changed to 12 using a set command,
however it is still not visible in the UI.

-Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 3:15 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

What do the DB entries look like for asset that do show up in the UI?

On Fri, Aug 14, 2009 at 4:11 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Yes, I should have mentioned that.

-Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 2:56 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

Not sure why. Do links created in the UI show up?

On Fri, Aug 14, 2009 at 3:26 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Ah Cool, thanks. I really appreciate the help. My manager’s
confidence in AT is bolstered by the fact that the developer is
still answering questions.

I managed to make some headway before seeing your email, I’ve got
a script that can add the links and they are showing up in
rt3.Link in the DB. However, the links are not showing in the UI.

Here is my test script:

#!/usr/bin/perl
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
use RT;
use RTx::AssetTracker::Asset;
use Getopt::Std;
use strict;
RT::LoadConfig();
RT::Init();
my $at = RTx::AssetTracker::Asset->new(RT->SystemUser);
my $URI = ‘at://rt.lib.umanitoba.ca/asset/4189’;
if (my $id = $at->Load(“labdaf01”)){
$at->AddLink(Type=>‘HasComponent’,Target=> $URI);
exit 0;}
else {die ‘invalid asset’;}

rt3.Links has a corresponding:

17 | at://rt.lib.umanitoba.ca/asset/3889 | at://
rt.lib.umanitoba.ca/asset/4189 | HasComponent
| 0 | 0 | 1 | 2009-08-14 18:30:45
| 1 | 2009-08-14 18:30:45
Where 3389 is the URI for labdaf01

But the UI doesn’t show the link. I thought maybe I’m missing a
privilege, but I’m SuperUser in the UI. What am I missing?

-Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-14-09 1:09 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

After callin $at->new you have to call $at->Load. Once the asset is
loaded you can call AddLink. Links are bi-directional so you don’t
have to add the reverse link.

On Thu, Aug 13, 2009 at 11:41 AM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Either I not understanding something or I think I might have
confused the issue by leaving some ambiguity in what I was
asking. I’m just dealing with one DB now. Here’s the situation:

-I have imported the assets themselves from our old helpdesk
software’s DB into RTAT’s DB.
-I have a table of linked assets from the old system.
-I want to use this table as input to create links in the new
RTAT. I can massage the input data as needed to have it in
"Name", “URI”, or whatever.

I’m a perl newbie so I want to make sure I understand this: $at-

AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

$at = RTx::AssetTracker::Asset->new(RT->SystemUser)
AddLink is presumably a function in AssetTracker
RefersTo is the type of link
Target is the asset to create the ReferTo link to? And what kind
of info does it want here (Name, URI, ?)?
$other_at = ??? (or did I make you think I was trying to link
between two different RTAT systems?)
URI is the uri of the asset the link is created in/from?

Does the reverse link get created automatically, or should I
repeat the statement, reversing Target and URI and flip the
linktype?

Thanks,

Mike

-----Original Message-----
From: Todd Chapman [mailto:todd@chaka.net]
Sent: August-12-09 3:46 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

My bad. If you want to link $at to $other_at:

$at->AddLink(Type=>‘RefersTo’,Target=> $other_at->URI);

Try it and see.

On Wed, Aug 12, 2009 at 4:38 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

Just to clarify, in…

   $at->AddLink(Type=>'RefersTo',Target=> $at->URI);

… “Target” is the URI of the RefersTo link, while the URI at
the end of the line becomes the corresponding ReferredToBy?

-Mike

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-
bounces@lists.bestpractical.com] On Behalf Of Todd Chapman
Sent: August-12-09 12:04 PM
To: Michael Ellis
Cc: rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

It should be similar to adding links to tickets.

Ticket example: $TicketObj->AddLink(Type=>‘RefersTo’,Target=>
$ticket->id);

So asset would be: $at->AddLink(Type=>‘RefersTo’,Target=> $at-

URI);

The default link types are:

RefersTo
ReferredToBy
RunsOn
IsRunning
DependsOn
DependedOnBy
ComponentOf
HasComponent
Components

Unlike RT, AT’s link types are configurable. See AT_Config.pm.

On Wed, Aug 12, 2009 at 12:06 PM, Michael EllisMichael_Ellis@umanitoba.ca wrote:

(I’m sorry, I’m not sure if this is the right forum for
this, If it isn’t
I’d love to know what is.)

I’ve set up AT 1.2.4b1 with RT 3.8.4 and used a script w
ritten by
Jean-Sebastien Morisset to import my assets from our old DB. I
now want to
recreated the links between assets.

I’m wondering if anyone could point me in the right dire
ction for finding
what the set links equivalent to the set fields code below:

my ($id, $t, $msg) = $at->Create (

                           Name => $csv[$csv_map{"Name"}],

                           Status => $csv[$csv_map 

{“Status”}],

                           Type => $csv[$csv_map{"Type"}],

What file in AT contains the handlers for these so that I can
just inspect
it to see what else it can do?

Thanks,

Mike


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly
Media.
Buy a copy at http://rtbook.bestpractical.com


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

All of a sudden this morning it’s working. I can’t explain, but am happy.

-MikeFrom: Michael Ellis [mailto:michael_ellis@umanitoba.ca]
Sent: August-14-09 10:11 PM
To: Michael Ellis
Cc: Todd Chapman; rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

I should add that in the history for the asset in the ui it shows the
adding of the asset, but not in the links area.

Mike

I thought one day, someone might find this asset linking script useful. It takes quoted, comma-separated Names and URI’s and links the URI as a component of asset with Name.

It’s a butchered version of the asset import script mentioned earlier in the thread written by Jean-Sebastien Morisset.

Input file should look like:
“Name”,“URI”
“computer1”,“at://rt.someplace.com/asset/1234
"computer2”,“at://rt.someplace.com/asset/4321”

-Mike

#!/usr/bin/perl
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);

use RT;
use RTx::AssetTracker::Asset;
use Getopt::Std;
use strict;

our ($opt_h, $opt_d, $opt_c, $opt_f);
getopts(‘hcdf:’);

RT::LoadConfig();
RT::Init();
my $at = RTx::AssetTracker::Asset->new(RT->SystemUser);
my %csv_map;
my $csv_col;
my $ln;
my $status;
my $msg;

if ($opt_h || !$opt_f) {
print “syntax: $0 [-h] [-c] [-d] -f {csvfile}\n”;
print “\t-c: don’t use this it doesn’t do anything anymore\n”;
print “\t-d: don’t use this it doesn’t do anything anymore \n”;
exit 0;
}

open(CSV, “< $opt_f”) or die “$!\n”;

while () {
chomp;
$ln++;
my $lv = $;
# fix empty fields without double-quotes
while (s/",(,+")/",""$1/g) {};
# csv fields should be padded with double quotes,
# which allows the use of commas in field values.
s/^"//; s/"$//;
my @csv = split(/","/);
# the first line should be a header “Name”,”URI”
if ($ln == 1) {
if ($lv !~ /“Name”/ ||
$lv !~ /“URI”/) {
print “error: need the Name and URI headers\n”;
exit 1;
}
# remember the column number for each field name.
# this allows us to include only those columns we
# want in the csv, and in whatever order we want.
for (@csv) { $csv_map{$
} = $csv_col++; }
next;
}
if (!$csv[$csv_map{“Name”}]) {
print “error: cannot load blank asset Name in $lv\n”;
next;
}
print $csv[$csv_map{“Name”}].":\n";
print $csv[$csv_map{“URI”}].":\n";
# load the asset, and on failure, create the asset.
if (my $id = $at->Load($csv[$csv_map{“Name”}])) {
$at->AddLink(Type=>‘ComponentOf’,Base=>$csv[$csv_map{“URI”}]);

    }

}From: Michael Ellis [mailto:Michael_Ellis@UManitoba.CA]
Sent: August-17-09 9:01 AM
To: 'Michael Ellis’
Cc: ‘Todd Chapman’; ‘rt Users’; jsmoriss@mvlan.net; william_moore@UManitoba.CA
Subject: RE: [rt-users] Asset Tracker API

All of a sudden this morning it’s working. I can’t explain, but am happy.

-Mike

From: Michael Ellis [mailto:michael_ellis@umanitoba.ca]
Sent: August-14-09 10:11 PM
To: Michael Ellis
Cc: Todd Chapman; rt Users; jsmoriss@mvlan.net
Subject: Re: [rt-users] Asset Tracker API

I should add that in the history for the asset in the ui it shows the
adding of the asset, but not in the links area.

Mike