Package hudson.model

Interface Item

    • Method Detail

      • getParent

        ItemGroup<? extends Item> getParent()
        Gets the parent that contains this item.
      • getAllJobs

        Collection<? extends Job> getAllJobs()
        Gets all the jobs that this Item contains as descendants.
      • getName

        String getName()
        Gets the name of the item.

        The name must be unique among other Items that belong to the same parent.

        This name is also used for directory name, so it cannot contain any character that's not allowed on the file system.

        See Also:
        getFullName()
      • getDisplayName

        String getDisplayName()
        Gets the human readable short name of this item.

        This method should try to return a short concise human readable string that describes this item. The string need not be unique.

        The returned string should not include the display names of ancestor items.

        Specified by:
        getDisplayName in interface ModelObject
      • getFullDisplayName

        String getFullDisplayName()
        Works like getDisplayName() but return the full path that includes all the display names of the ancestors.
      • getRelativeNameFrom

        @Nullable
        default String getRelativeNameFrom​(@CheckForNull
                                           ItemGroup g)
        Gets the relative name to this item from the specified group.
        Parameters:
        g - The ItemGroup instance used as context to evaluate the relative name of this item
        Returns:
        The name of the current item, relative to g, or null if one of the item's parents is not an Item. Nested ItemGroups are separated by a / character (e.g., ../foo/bar).
        Since:
        1.419
      • getRelativeNameFrom

        @Nullable
        default String getRelativeNameFrom​(@NonNull
                                           Item item)
        Short for getRelativeNameFrom(item.getParent())
        Returns:
        String like "../foo/bar". null if one of item parents is not an Item.
        Since:
        1.419
      • getUrl

        String getUrl()
        Returns the URL of this item relative to the context root of the application.
        Returns:
        URL that ends with '/'.
        See Also:
        for how to implement this.
      • getAbsoluteUrl

        @Deprecated
        default String getAbsoluteUrl()
        Deprecated.
        This method shall NEVER be used during HTML page rendering, as it won't work with network set up like Apache reverse proxy. This method is only intended for the remote API clients who cannot resolve relative references (even this won't work for the same reason, which should be fixed.)
        Returns the absolute URL of this item. This relies on the current StaplerRequest to figure out what the host name is, so can be used only during processing client requests.
        Returns:
        absolute URL.
        Throws:
        IllegalStateException - if the method is invoked outside the HTTP request processing.
      • onLoad

        void onLoad​(ItemGroup<? extends Item> parent,
                    String name)
             throws IOException
        Called right after when a Item is loaded from disk. This is an opportunity to do a post load processing.
        Parameters:
        name - Name of the directory (not a path --- just the name portion) from which the configuration was loaded. This usually becomes the name of this item.
        Throws:
        IOException
      • onCopiedFrom

        void onCopiedFrom​(Item src)
        When a Item is copied from existing one, the files are first copied on the file system, then it will be loaded, then this method will be invoked to perform any implementation-specific work.
      • onCreatedFromScratch

        default void onCreatedFromScratch()
        When an item is created from scratch (instead of copied), this method will be invoked. Used as the post-construction initialization.
        Since:
        1.374