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
Ellis<michael_el...@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:t...@chaka.net]
> Sent: August-14-09 3:15 PM
> To: Michael Ellis
> Cc: rt Users; jsmor...@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
> Ellis<michael_el...@umanitoba.ca> wrote:
>> Yes, I should have mentioned that.
>>
>> -Mike
>>
>> -----Original Message-----
>> From: Todd Chapman [mailto:t...@chaka.net]
>> Sent: August-14-09 2:56 PM
>> To: Michael Ellis
>> Cc: rt Users; jsmor...@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
>> Ellis<michael_el...@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:t...@chaka.net]
>>> Sent: August-14-09 1:09 PM
>>> To: Michael Ellis
>>> Cc: rt Users; jsmor...@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
>>> Ellis<michael_el...@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:t...@chaka.net]
>>>> Sent: August-12-09 3:46 PM
>>>> To: Michael Ellis
>>>> Cc: rt Users; jsmor...@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
>>>> Ellis<michael_el...@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-boun...@lists.bestpractical.com 
>>>>> [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Todd 
>>>>> Chapman
>>>>> Sent: August-12-09 12:04 PM
>>>>> To: Michael Ellis
>>>>> Cc: rt Users; jsmor...@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
>>>>> Ellis<michael_el...@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: sa...@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: sa...@bestpractical.com


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

Reply via email to