12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- /*******************************************************************************
- * IBM Confidential
- *
- * OCO Source Materials
- *
- * A and PM: PD
- *
- * (c) Copyright IBM Corp. 2015
- *
- * The source code for this program is not published or otherwise divested of
- * its trade secrets, irrespective of what has been deposited with the U.S.
- * Copyright Office.
- ******************************************************************************/
- require([
- "dojo/_base/declare",
- "pd/ui/_base",
- "pd/controller/mdsrvRequest",
- "pd/data/PdColumnAnalyser",
- "pd/widgets/MDAnalyseDialog",
- "dojo/domReady!"
- ],function(declare, _base, mdsrvRequest, PdColumnAnalyser, MDAnalyseDialog){
- declare("pd/ui/metadataEditor", [_base], {
- mode: pd.statics.MODE_EDIT,
- mdAnalyseDlg: null,
-
- renderMainContent: function(pdSpecValue) {
- if (this.mode == pd.statics.MODE_REFRESH) {
- this.showAnalyseDialog(pdSpecValue);
- } else {
- this._renderMainContent(pdSpecValue);
- this._setRefreshMode();
- }
- },
-
- _setRefreshMode: function() {
- this.mode = pd.statics.MODE_REFRESH;
- pd_uploader.uploadUrl = g_pd_gateway + "/metadataUIService?pid=pdm_process&c=processLOBData";
- pd_uploader.uploadUrl += "&dataSetStoreID="+encodeURIComponent(this.dataSetStoreID);
- pd_uploader.uploadUrl += "&repositoryName="+encodeURIComponent(this.repositoryName);
- pd_uploader.uploadUrl += "&repositoryConnection="+encodeURIComponent(this.repositoryConnection);
- pd_uploader.uploadUrl += "&repositorySignon="+encodeURIComponent(this.repositorySignon);
- },
-
- getTargetUrl: function() {
- return g_pd_gateway + "/metadataUIService?pid=pdm_process&c=readLOBDataSpec"
- + "&dataSetStoreID="+encodeURIComponent(this.dataSetStoreID)
- + "&repositoryName="+encodeURIComponent(this.repositoryName)
- + "&repositoryConnection="+encodeURIComponent(this.repositoryConnection)
- + "&repositorySignon="+encodeURIComponent(this.repositorySignon);
-
- },
-
- showAnalyseDialog: function(pdSpecValue) {
- var analyser = new PdColumnAnalyser({xmlInput: pdSpecValue});
- var prunedPdSpec = analyser.getSpecFromXml();
- this.mdAnalyseDlg = new MDAnalyseDialog({
- okHandler: dojo.hitch(this, this._applyChange, pdSpecValue, prunedPdSpec),
- cancelHandler: dojo.hitch(this, this._cancelChange),
- delta: analyser.getDeltaFromXml()
- });
- this.mdAnalyseDlg.show();
- },
-
- _closeAnalyseDialog: function(pdSpec) {
- if (this.mdAnalyseDlg){
- this.mdAnalyseDlg.hide();
- }
- this._renderMainContent(pdSpec);
- },
-
- _applyChange: function(pdSpec, pdPrunedSpec) {
- mdsrvRequest.saveDataSet(this.dataSetStoreID, this.repositoryName, this.repositoryConnection, this.repositorySignon, pdPrunedSpec,
- dojo.hitch(this, this._closeAnalyseDialog, pdSpec));
- },
-
- _cancelChange: function() {
- mdsrvRequest.cancelDataSet(this.dataSetStoreID, this.repositoryName, this.repositoryConnection, this.repositorySignon);
- },
-
- startup: function() {
- this.inherited(arguments);
- this.setStatus(pd.statics.STATUS_PROCESS);
- pd_uploader.submit();
- },
-
- getDataSetName: function() {
- return this.dataSetName;
- }
- });
- });
|