Closed GoogleCodeExporter closed 9 years ago
Version 2386
Original comment by danpaulsmith
on 23 Nov 2011 at 2:38
Dan, could you use the preference store instead? That has a command for saving,
too.
Original comment by dfhu...@gmail.com
on 27 Nov 2011 at 9:19
Ah yes, I've seen that.
Does that save preferences specific to a single project or just for Refine in
general? We need the former.
We'll be running a single instance of Refine on a remote server for multiple
users - so we need to store metadata per dataset - and during "create/import
project" (on the /index page as opposed to saving the data on the /project
page).
Original comment by danpaulsmith
on 28 Nov 2011 at 11:10
Each project has a preference store and the whole workspace also has one.
(I'm marking this as WontFix.)
Original comment by dfhu...@gmail.com
on 29 Nov 2011 at 8:09
Oh right, how can we get & save to a project's preference store?
Original comment by danpaulsmith
on 30 Nov 2011 at 11:08
http://code.google.com/p/google-refine/source/browse/trunk/main/src/com/google/r
efine/commands/SetPreferenceCommand.java uses a particular project's preference
store if there is a "project" parameter specifying its ID.
Original comment by dfhu...@gmail.com
on 30 Nov 2011 at 5:41
Ok, I can use that instead now.
As a side note, there's still the issue of accessing the project ID on the
index page moments before being redirected to the project page.
I'm overriding pollImportJob() for now:
/*
* Override Refine's 'pollImportJob' function
*
* This is necessesary so that we can capture the project's ID (not the import job ID),
* which must be used to access and write to the metadata.json file.
*
* We place our own "LinkedGov.saveMetadata()" function inside the block of
* code that is able to see the project ID, just before sending the user to the
* "project" page.
*/
/*
* Store the original 'pollImportJob' before we overwrite Refine's version.
*/
LinkedGov.pollImportJob = Refine.CreateProjectUI.prototype.pollImportJob;
Refine.CreateProjectUI.prototype.pollImportJob = function(start, jobID,
timerID, checkDone, callback, onError) {
/*
* Create our own "callback" function
*/
lgCallback = function(jobID,job) {
/*
* This function is accessed twice by Refine, the first time to
* send the user to the "preview" panel when they can modify the
* import options, and the second time, with the projectID to the
* "project" page.
*
* The second time round is when the projectID is present, so we
* intercept it to make a call to save our custom metadata.
*/
if(typeof job.config.projectID != 'undefined'){
LinkedGov.saveMetadata(jobID, job.config.projectID, function(jobID, projectID){
Refine.CreateProjectUI.cancelImportinJob(jobID);
document.location = "project?project=" + projectID;
});
} else {
callback(jobID,job);
}
};
/*
* Call the original 'pollImportJob' function that was stored at the end of our new
* 'pollImportJob' function.
*/
LinkedGov.pollImportJob(start, jobID, timerID, checkDone, lgCallback, onError);
}
Original comment by danpaulsmith
on 1 Dec 2011 at 10:52
Original issue reported on code.google.com by
danpaulsmith
on 23 Nov 2011 at 12:55