GroupDocs.Metadata for Java 21.4 Release Notes

Major Features

There are the following features, enhancements and fixes in this release:

  • Implement metadata property interpreters
  • Implement the ability to edit email fields
  • Image export failed.

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
METADATANET-3752Implement metadata property interpretersNew Feature
METADATANET-3758Implement the ability to edit email fieldsImprovement
METADATANET-3751Image export failedBug

Public API and Backward Incompatible Changes

Implement metadata property interpreters

This new feature allows the user to get a user-friendly interpretation of a metadata property value. Please refer to this article for more information.

Public API changes

The ValueInterpreter class has been added to the com.groupdocs.metadata.core package

The IEnumValueInterpreter interface has been added to the com.groupdocs.metadata.core package

The getInterpretedValue method has been added to the MetadataProperty class

The getDescriptor method has been added to the MetadataProperty class

The getInterpreter method has been added to the PropertyDescriptor class

Use cases

Obtain a full list of properties that provide an interpreted value

public class WorkingWithInterpretedValues {
     public static void run() {
        File folder = new File(Constants.InputPath);
        for (File file : folder.listFiles()) {
            try (Metadata metadata = new Metadata(file.getAbsolutePath())) {
                if (metadata.getFileFormat() != FileFormat.Unknown && !metadata.getDocumentInfo().isEncrypted()) {
                    System.out.println();
                    System.out.println(file.getName());

                    IReadOnlyList<MetadataProperty> properties = metadata.findProperties(
                            new WorkingWithInterpretedValues().new InterpretedValueIsNotNullSpecification());
                    for (MetadataProperty property : properties) {
                            System.out.println(property.getName());
                            System.out.println(property.getValue().getRawValue());
                            System.out.println(property.getInterpretedValue().getRawValue());
                    }
                }
            }
        }
    }

    private class InterpretedValueIsNotNullSpecification extends Specification {
        public /*override*/ boolean isSatisfiedBy(MetadataProperty candidate) {
            return candidate.getInterpretedValue() != null;
        }
    }
}

Implement the ability to edit email fields

This improvement allows the user to update some common email fields.

Public API changes

The setSubject method has been added to the EmailPackage class

The setRecipients method has been added to the EmailPackage class

The setCarbonCopyRecipients method has been added to the EmailPackage class

The setBlindCarbonCopyRecipients method has been added to the EmailPackage class

Use cases

Update the email subject and recipients

try (Metadata metadata = new Metadata(Constants.InputEml)) {
    EmailRootPackage root = metadata.getRootPackageGeneric();
    root.getEmailPackage().setRecipients(new String[] { "sample@aspose.com" });
    root.getEmailPackage().setCarbonCopyRecipients(new String[] { "sample@groupdocs.com" });
    root.getEmailPackage().setSubject("RE: test subject");
    metadata.save(Constants.OutputEml);
}

Other API changes

The getKnowPropertyDescriptors method has been marked as deprecated. Please use the getPropertyDescriptors method instead.