Search This Blog

Thursday, October 10, 2013

Adding Attachments to OA Page

Adding Attachments to OA Page:

1. In your Advanced Table(/Table) Region.
2. Create a new Column
3. Create an Item of type -> attachmentImage
4. By default one entity map will be created.
Set the property, Entity in this item to some text. ->> Example: Your Project Name to identify the attachments easily
5. Right Click on entityMap1, select new  primaryKeys
Set the Property View Attribute to Primar Column in your table(from the VO that attached to the Advanced Table RN)
6. Create a Sortable Header to give the column Name as Attachments

Now, run the page. You can view/create/update/delete attachments using this option.

To make Attachment Read-Only:

OAAttachmentImageBean attachBean = (OAAttachmentImageBean)webBean.findChildRecursive("<ID of your attachmentImage Item>");
Dictionary[] entityMaps = attachBean.getEntityMappings();
if(entityMaps != null)
{
int mapLength = entityMaps.length;
for(int i= 0; i< mapLength; i++)
{
Dictionary entityData = entityMaps[i];
if(entityData!=null && entityData.size() > 0)
{
entityData.put("insertAllowed", false);
entityData.put("updateAllowed", false);
entityData.put("deleteAllowed", false);
} //Entity Data Not NULL
} //FOR Loop
} //Entity Maps Not NULL
attachBean.setEntityMappings(entityMaps);


To Hide the Attachment:
OAAttachmentImageBean attachBean = (OAAttachmentImageBean)webBean.findChildRecursive("<ID of your attachmentImage Item>");
attachBean.setRendered(false);

1 comment:

  1. How can we make adding attachment in the attachment table mandatory?

    ReplyDelete