Class Descriptor

java.lang.Object
org.apache.creadur.whisker.model.Descriptor

public class Descriptor extends Object
High level description of licensing qualities.
  • Constructor Details

    • Descriptor

      public Descriptor(License primaryLicense, String primaryOrganisationId, String primaryNotice, Map<String,License> licenses, Map<String,String> notices, Map<String,Organisation> organisations, Collection<WithinDirectory> contents)
      Constructs a description of the expected licensing qualities of a distribution, with no additional primary copyright notice.
      Parameters:
      primaryLicense - not null
      primaryOrganisationId - not null
      primaryNotice - possibly null
      licenses - not null, possibly empty
      notices - not null, possibly empty
      organisations - not null, possibly empty
      contents - not null, possibly empty
    • Descriptor

      public Descriptor(License primaryLicense, String primaryCopyrightNotice, String primaryOrganisationId, String primaryNotice, Map<String,License> licenses, Map<String,String> notices, Map<String,Organisation> organisations, Collection<WithinDirectory> contents)
      Constructs a description of the expected licensing qualities of a distribution, with a primary additional copyright notice.
      Parameters:
      primaryLicense - not null
      primaryCopyrightNotice - optional primary copyright notice, possibly null
      primaryOrganisationId - not null
      primaryNotice - possibly null
      licenses - not null, possibly empty
      notices - not null, possibly empty
      organisations - not null, possibly empty
      contents - not null, possibly empty
  • Method Details

    • getPrimaryCopyrightNotice

      public String getPrimaryCopyrightNotice()
      Gets an additional copyright notice needed for some primary licenses.
      Returns:
      optional primary copyright notice, possibly null
    • isPrimaryCopyrightNotice

      public boolean isPrimaryCopyrightNotice()
      Is there a primary copyright notice?
      Returns:
      true if a primary copyright notice has been set, false otherwise
    • getPrimaryNotice

      public String getPrimaryNotice()
      Gets the principle NOTICE for the main work.
      Returns:
      the primaryNotice
    • getResourceNotices

      public Map<String,Collection<Resource>> getResourceNotices()
      Collates NOTICE meta-data for resources.
      Returns:
      not null, possibly empty
    • getOrganisations

      public Map<String,Organisation> getOrganisations()
      Gets the organisations described.
      Returns:
      organisations indexed by id, not null
    • getOtherNotices

      public Set<String> getOtherNotices()
      Collates NOTICE meta-data not linked to any resource.
      Returns:
      not null, possibly empty
    • license

      public License license(String id)
      Gets the license with the given id.
      Parameters:
      id - not null
      Returns:
      the license with the given id, or null
    • getPrimaryLicense

      public License getPrimaryLicense()
      Gets the principle license under which the work is licensed.
      Returns:
      the principle license, not null
    • getContents

      public Collection<WithinDirectory> getContents()
      Gets the contents expected in the distribution.
      Returns:
      not null, possibly null
    • isPrimary

      public boolean isPrimary(License license)
      Is the given license the principle license for the main work?
      Parameters:
      license - not null
      Returns:
      true when the given license is the primary license, not null
    • isPrimary

      public boolean isPrimary(ByOrganisation byOrganisation)
      Is the given individual or group the principle organisation with responsibility for the main work.
      Parameters:
      byOrganisation - not null
      Returns:
      true when the given organisation is primary
    • isOnlyPrimary

      public boolean isOnlyPrimary(ContentElement contentElement)
      Is this collection of resources expected to contain only material licensed under the primary license by the primary organisation with the primary copyright notice?
      Parameters:
      contentElement - not null
      Returns:
      true when the contents are all licensed under the primary license by the primary organisation
    • traverse

      public void traverse(Visitor visitor)
      Traverses the content directories.
      Parameters:
      visitor - possibly null
    • traverseDirectory

      public void traverseDirectory(Visitor visitor, String directoryName)
      Traverses the given directory.
      Parameters:
      visitor - possibly null
      directoryName - not null
    • isNoticeRequired

      public boolean isNoticeRequired()
      Is a NOTICE document required?
      Returns:
      true when a NOTICE is required, false otherwise
    • resourceNoticesExist

      public boolean resourceNoticesExist()
      Does any resource have a required notice?
      Returns:
      true when at least one required third party notice exists, false otherwise
    • primaryNoticeExists

      public boolean primaryNoticeExists()
      Does the work described have a primary notice?
      Returns:
      true unless the primary notice is null or whitespace
    • isPrimaryOnly

      public boolean isPrimaryOnly()
      Is this the work of the primary organisation only?
      Returns:
      true when no third party resources are contained, false when third party resources exist. In particular, true when contents are empty.