Zum Hauptinhalt gehen

getReferencedElement as Listable<IDProvider>??

Kommentare

3 Kommentare

  • Zendesk API User
    Author: bIT_sosswald - 11/15/2017 7:25

    Hi Siva,

    why would you like to get a single element as listable?

    The API reference says:

    getReferencedElement

    Returns:
    The referenced node or null.
    Since:
    4.0

    So for each reference entry there is always exactly one referenced element. (Or null will be returned in the case of a broken reference etc. See API documentation.)

    From my point of view it does not make any sense to hold a single value in a listable. Also i cannot find the data type IDProviderList as part of the public API. (At least I cannot find it in the API documentation.)
    So the only thing you want to do is, to put all referenced elements into a list, just use a standard java list.

    List<IDProvider> idProviderList = new ArrayList<>();


    idProviderList.add(_mediaRef )

    Greetings

    Sandro

    0
  • Zendesk API User
    Author: tenter - 11/22/2017 12:32

    Hi @all,

    thanks for your helpful answer Sandro. We tend to ask the same question - why should a single object be returned as a list? The usage of an abstraction over our API (like you already did) seems to be the right tool here.

    Greetings,

    Hannes

    0
  • Zendesk API User
    Author: sivaprasad9394 - 11/23/2017 6:38

    Hello Sandro,

    Thank you for your time and reply for my post.

    Finally i have modified my code like below to get the things,

    for (ReferenceEntry entry : outgoingReferences) {

                         Object referenceElement = entry.getReferencedElement();

                         //_context.logInfo(referenceElement.getClass().getName());

                         if (referenceElement instanceof Media && ((Media) referenceElement).isInReleaseStore() && ((Media) referenceElement).isReleased()) {

                             IDProvider _mediaRef = (IDProvider)referenceElement;

                             _context.logInfo("_mediaRef Name:"+_mediaRef.getName());

                             IDProviderList.add(_mediaRef);

                             _context.logInfo("IDProviderList add..."+_mediaRef);

                   }

                 }

    I am getting the media and page reference names while doing the Hotdeployment via Project file menu selection.

    Thank you

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.