|
An image can be inserted in a DOORS object. Here are the supported image file formats:
Here is a sample code that inserts an image in a DOORS Object:
import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import com.sodius.mdw.corext.model.ImportedImage; import com.sodius.mdw.metamodel.doors.*; ... com.sodius.mdw.metamodel.doors.Object object = ...; ImportedImage importedImage = ImportedImage.importFile(imageFile, null); object.setImage(importedImage.toString());
OLE objects can be inserted in a DOORS Object Text.
In that case the Object.objectText
attribute must contains HTML tags that references the OLE objects, e.g.:
<html><body><p><object data="path_to_ole_object"/></p></body></html>
Here is a sample code that sets an OLE Object Text:
import com.sodius.mdw.core.model.RichText; import com.sodius.mdw.metamodel.doors.*; ... com.sodius.mdw.metamodel.doors.Object object = ...; object.setObjectText(RichText.valueOf("<html><body><p><object data=\"path_to_ole_object\"/></p></body></html>"));
When writing the model into DOORS, an AttachmentResolver
is used to retrieve the physical location
of OLE objects files to be inserted in DOORS:
import com.sodius.mdw.metamodel.doors.*; import com.sodius.mdw.metamodel.doors.richtext.AttachmentResolver; import com.sodius.mdw.metamodel.doors.richtext.RichTextUtils; ... File myFolder = new File(<folder containing OLE object files>); AttachmentResolver resolver = RichTextUtils.createAttachmentResolver(myFolder); Map<String, Object> options = new HashMap<String, Object>(); options.put("doors.attachmentResolver", resolver); myDoorsModel.write("Application", null, options); resolver.dispose();