Case 3. Extending matadata of services in front-end |
When registering services in the iPortal portal, metadata information for the input service is supported to facilitate querying and managing the registration service. When the metadata item provided in the front-end registration service page does not meet your actual project requirements, you can extend the metadata information for the service by adding metadata items to the registration service page.
The following is a new "resRefDate" metadata field, for example, in the metadata standard is defined as: relevant date of reference data, in detail for you how to extend the service in the iPortal portal metadata information.
After you find the "resRefDate" meta data field in com.supermap.services.metadata.smmd2007.Metadata, you can do the following:
The metadata.js source file is located in the / staticFiles / portal-src / js / service folder in the iportal-all - *. jar directory in the [SuperMap iPortal product directory] / webapps / iportal / WEB-INF / lib directory.
In the metadata.js source file, you need to write the new "resRefDate" metadata field to the following two methods:
first step: generates the "resRefDate" meta data object and assigns the "resRefDate" metadata information in the metadata.set function in the root._getMetadataInfo = function () method.
Before writing, you need to first confirm that the function already has the metadata information, if it already exists can skip this step directly into the second step, if not, you need to query the metadata of the parent class who (Which can be queried in the metadata standard) and then write the metadata information in its parent class. For example: "resRefDate" metadata parent class is "idCitation", then in the metadata.set function to find the parent class "idCitation", you can directly in the "idCitation" parent class write "resRefDate" metadata information, the code is as follows :
idCitation: new Metadata.Smmd2007Template.DataIdInfo.DataIdent.IdCitation({
......
resRefDate: new Metadata.Smmd2007Template.DataIdInfo.DataIdent.IdCitation.ResRefDate({
refDate: $("#txtREFDATE").val(),
refDateType: $("#txtRefDateType").val()
})
among them:
The second step: Get the front-end input "resRefDate" metadata information and pass to the backend, that is, in the root.getMetadataInfo = function (editOrView) method in the metadata.set function to write "resRefDate" metadata information, the method with the first step, the code reads as follows:
idCitation: new this.Metadata.Smmd2007Template.DataIdInfo.DataIdent.IdCitation({
......
resRefDate: new this.Metadata.Smmd2007Template.DataIdInfo.DataIdent.IdCitation.ResRefDate({
refDate: $("#txtREFDATE").val(),
refDateType: $("#txtRefDateType").val()
})
third step: after the modification is complete, you need to delete or rename the portal folder in the / staticFiles directory of the iportal-all - *. Jar in the [SuperMap iPortal product directory] / webapps / iportal / WEB-INF / lib directory, For example: portal-bak, and then rename the folder portal-src to portal.
Modify the front-end registration service page, the source file for the iportalServiceRegister_zh_CN.ftl, located in the [SuperMap iPortal product directory] / webapps / iportal / WEB-INF / lib directory iportal-all - *. Jar / templates folder. In the "Metadata Information" tab in the "fax" content and its input text box, followed by "update date" content and enter the text box, the code is as follows:
<tr>
<td class="text-right col-xs-p12">Updated:</td>
<td><input id="txtREFDATE" type="text" class="form-control ip-input-txt col-xs-4" ></td>
</tr>
Where the id value is the value in parentheses in the "refDate" field in the first step: "txtREFDATE".
Modify the service details page, the source file for the iportalServiceDetail_zh_CN.ftl, located in the [SuperMap iPortal product directory] / webapps / iportal / WEB-INF / lib directory iportal-all - *. Jar in the / templates folder. The page contains two parts: service metadata editing and service details, you need to modify the two parts at the same time, respectively, in the "fax" content and its input text box, plus "update date" content and enter the text box , The code is as follows:
service metadata editing section:
<td class="text-right">Updated date:</td>
<td>
<input value="${( pmd.metadata.dataIdInfo.dataIdent.idCitation.resRefDate.refDate)!""}" id="txtREFDATE"
type="text" class="form-control ip-input-txt" style="width:265px">
</td>
Service details section:
<tr>
<td class="text-right vt" style="width: 15%;">Updated date:</td>
<td style="width:85%;">${(pmd.metadata.dataIdInfo.dataIdent.idCitation.resRefDate.refDate)!""}</td>
</tr>
Restart the iPortal service. On the Metadata tab of the Registration Services page, the newly added metadata item is displayed, such as the date of the update and the date of the update. After the service registration is completed, the updated date will be displayed on the service details page.