com.groupdocs.metadata.core

Interfaces

Classes

Exceptions

com.groupdocs.metadata.core

Class IptcRecordSet

  • All Implemented Interfaces:
    Iterable<MetadataProperty>


    public final class IptcRecordSet
    extends CustomPackage

    Represents a collection of IPTC records.

    Learn more

    This code sample shows hot to update basic IPTC metadata properties.

    try (Metadata metadata = new Metadata(Constants.InputJpeg)) {
         IIptc root = (IIptc) metadata.getRootPackage();
         // Set the IPTC package if it's missing
         if (root.getIptcPackage() == null) {
             root.setIptcPackage(new IptcRecordSet());
         }
         if (root.getIptcPackage().getEnvelopeRecord() == null) {
             root.getIptcPackage().setEnvelopeRecord(new IptcEnvelopeRecord());
         }
         root.getIptcPackage().getEnvelopeRecord().setDateSent(new Date());
         root.getIptcPackage().getEnvelopeRecord().setProductID("test project id");
         // ...
         if (root.getIptcPackage().getApplicationRecord() == null) {
             root.getIptcPackage().setApplicationRecord(new IptcApplicationRecord());
         }
         root.getIptcPackage().getApplicationRecord().setByLine("GroupDocs");
         root.getIptcPackage().getApplicationRecord().setHeadline("test");
         root.getIptcPackage().getApplicationRecord().setByLineTitle("code sample");
         root.getIptcPackage().getApplicationRecord().setReleaseDate(new Date());
         // ...
         metadata.save(Constants.OutputJpeg);
     }
     
    • Constructor Detail

      • IptcRecordSet

        public IptcRecordSet()

        Initializes a new instance of the IptcRecordSet class.

      • IptcRecordSet

        public IptcRecordSet(IptcDataSet[] dataSets)

        Initializes a new instance of the IptcRecordSet class.

        Parameters:
        dataSets - An array of IPTC dataSets.
    • Method Detail

      • getEnvelopeRecord

        public final IptcEnvelopeRecord getEnvelopeRecord()

        Gets the Envelope Record.

        Returns:
        The Envelope Record.
      • setEnvelopeRecord

        public final void setEnvelopeRecord(IptcEnvelopeRecord value)

        Sets the Envelope Record.

        Parameters:
        value - The Envelope Record.
      • getApplicationRecord

        public final IptcApplicationRecord getApplicationRecord()

        Gets the Application Record.

        Returns:
        The Application Record.
      • setApplicationRecord

        public final void setApplicationRecord(IptcApplicationRecord value)

        Sets the Application Record.

        Parameters:
        value - The Application Record.
      • get_Item

        public final IptcRecord get_Item(byte recordNumber)

        Gets the IptcRecord with the specified number.

        Parameters:
        recordNumber - The record number.
        Returns:
        The IptcRecord with the specified number, if found; otherwise null.
      • get_Item

        public final IptcDataSet get_Item(byte recordNumber,
                           byte dataSetNumber)

        Gets the IptcDataSet with the specified record and dataSet number.

        Parameters:
        recordNumber - The record number.
        dataSetNumber - The dataSet number.
        Returns:
        The IptcDataSet with the specified record and dataSet number.
      • set

        public final void set(IptcDataSet dataSet)

        Adds or updates the specified dataSet in the appropriate record.

        Parameters:
        dataSet - The IPTC dataSet to add/update.
      • add

        public final void add(IptcDataSet dataSet)

        Adds the specified dataSet to the appropriate record. The dataSet is considered as repeatable if a dataSet with the specified number already exists.

        Parameters:
        dataSet - The IPTC dataSet to add.
      • remove

        public final boolean remove(byte recordNumber,
                     byte dataSetNumber)

        Removes the dataSet with the specified record and dataSet number.

        Parameters:
        recordNumber - The record number.
        dataSetNumber - The dataSet number.
        Returns:
        True if the specified IPTC dataSet is found and removed; otherwise, false.
      • clear

        public final void clear()

        Removes all records from the collection.

      • remove

        public final boolean remove(byte recordNumber)

        Removes the record with the specified record number.

        Parameters:
        recordNumber - The record number.
        Returns:
        True if the specified IPTC record is found and removed; otherwise, false.
      • toDataSetList

        public final IReadOnlyList<IptcDataSet> toDataSetList()

        Creates a list of dataSets from the package.

        Returns:
        A list that contains all IPTC dataSets from the package.
      • toList

        public final IReadOnlyList<IptcRecord> toList()

        Creates a list from the package.

        Returns:
        A list that contains all IPTC records from the package.