Wednesday, October 26, 2016

Workaround To Prevent user from inserting Filename without Extension in UCM Attachment Dialog

in this article i'am going to show you a workaround that may be useful to deal with Extension issue that appear when integrate UCM with BPM .

as you may know when you check use package checkbox in human task(document tab) and before that you were did the required configuration to integrate BPM and UCM(such as defining credentials and UCM IP in workflow properties) the attachment Dialog in pages will appear with extra fields such bellow :


when use fill the data form and then he click OK, the dialog will disappear and the file will be added to table of files which exist at the bottom of page . but the name of link will be like the value of name field in popup above  and without extension this means that user will get undetermined extension file and when he try to download it ,  the file will not be opened in the proper application directly instead of  it's need manual work to associate it with suitable software such as word ..etc using open With and that will cause a headache for users specially those with low computer skills .

To work around this issue i have added regex validator  to input Text to control the input and prevent filenames without real extensions . the solution is sound simple but actually it's take some efforts to catch . such as any other customization for BPM workspace .

Please follow the steps below :
  •  Go to similar path on your server  C:\Users\alaayacoub\AppData\Roaming\JDeveloper\system12.2.1.0.42.151011.0031\DefaultDomain\servers\DefaultServer\tmp\_WL_user\oracle.soa.worklist.webapp\km13lp\WEB-INF\lib

  •  Open jar adflibWorklistComponents in winrar
  •  Copy page manageDocuments.jspx outside and open it
  •  Search for inputtext with name “dc_it1” which used for all inputtexts on Dialog using Foreach
  •  Replace the Input text with following block

<af:switcher facetName="#{def.propertyDef.id != 'dDocTitle' and  def.propertyDef.id != 'cmis:name'}" defaultFacet="true" id="dc_s88777">
                                    <f:facet name="true">
                                                <af:inputText label="#{def.displayName}" value="#def.providedValue}"
                                                                                          contentStyle="width:200px" columns="35" visible="#{def.visible}"
                                                                                          required="#{def.required}" readOnly="#{def.updatability eq 'READONLY'}" id="dc_it1"/>
                                    </f:facet>
                                    <f:facet name="false">
                                                <af:inputText label="#{def.displayName}" value="#{def.providedValue}"
                                                                                          contentStyle="width:200px" columns="35" visible="#{def.visible}"
                                                                                          required="#{def.required}" readOnly="#{def.updatability eq 'READONLY'}" id="dc_it_name">
                                                            <f:validateRegex pattern="([^\\s]+(\\.(?i)(doc|csv|pdf|xlsx))$)"   />
                                                </af:inputText>
                                    </f:facet>
                        </af:switcher>

  •        The goal of above code is 2 things
a.       Separate the name inputtext from others and give him special manipulation
b.      Add Validate Regex to validate Filename and extension on it

  • .       Replace adflibWorklistComponents jar with updated on Lib folder
  • .       Restart is not required

No comments:

Post a Comment