What to do with the "category" of external links

Peter_Jodeleit
Crownpeak employee
Crownpeak employee
4 5 1,512

With FirstSpirit 4.2 external links could be grouped in categories:

external_link.jpg

All links inherit the category of their link template (at creation time).

There are only two predefined categories ("url" and "email") but your can define your own categories.

The categories could be used as filter in the api method "getExternalReferences". The call below collects all external references with the catogory "email":

ReferenceEntry[] email_references_release = context.getProject().getExternalReferences("email", true);


René has posted a use case where categories come in handy: Periodically check of external urls.

Tested with FS4.2R2

5 Comments
Peter_Jodeleit
Crownpeak employee
Crownpeak employee

I got some personal messages requesting how to define new categories. First i didn't understand the question until someone pointed out that there is a bug in the gui for the drop down box Category. If you type in some text and then directly switches to View mode the category is not saved. You have to click elswhere befor leaving the edit mode, then the value is saved. Refer to the (internal) issue id  #83090, the status for the upcoming R4 release is resolved Smiley Wink

guido_tesch
I'm new here

I'm trying to script an external link checker and would like to use the category to define which links are to be checked. We have a total of 7 link templates, and only two of them should be checked. As category for these two templates, I typed "externalurl" into the combobox. (And clicked elsewhere before I saved. Smiley Wink)

If I now use the following code, I get a refCount of zero:

    refCount = 0;

    // Check all released external links (selected via category "external_url", which is set in the link templates)

    for (ref : context.project.getExternalReferences("externalurl", true)) {

        refCount++;

        // Perform the link check and react accordingly...

   }

If I do the same code with "for (ref : context.project.getExternalReferences(true)) {", it works fine, except that of course all links are checked and not only the external URLs.

Could you give me some hint as to what I am doing wrong? I couldn't find any further documentation for the method "getExternalReferences" that would help...

Is there a way to access the category of a reference? (something like "ref.getcategory()")

Thanks

Guido

Peter_Jodeleit
Crownpeak employee
Crownpeak employee

The gui-bug I referred to is fixed since version 4.2.401.

I'll try to check your code soon. In the meantime could you name your FirstSpirit version?

guido_tesch
I'm new here

We currently use server version 4.2.223.40456

Peter_Jodeleit
Crownpeak employee
Crownpeak employee

Your code works for me. Perhaps your content is not yet released? Try to iterate over the current references.

Version history
Last update:
‎07-05-2010 02:26 AM
Updated by: