Refresh tag cell
This commit is contained in:
parent
b16941777e
commit
ee8ed8f563
@ -58,27 +58,23 @@ import com.google.refine.preference.PreferenceStore;
|
|||||||
import com.google.refine.preference.TopList;
|
import com.google.refine.preference.TopList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProjectManager is responsible for loading and saving the workspace and
|
* ProjectManager is responsible for loading and saving the workspace and projects.
|
||||||
* projects.
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class ProjectManager {
|
public abstract class ProjectManager {
|
||||||
|
|
||||||
// last n expressions used across all projects
|
// last n expressions used across all projects
|
||||||
static protected final int s_expressionHistoryMax = 100;
|
static protected final int s_expressionHistoryMax = 100;
|
||||||
|
|
||||||
// If a project has been idle this long, flush it from memory
|
// If a project has been idle this long, flush it from memory
|
||||||
static protected final int PROJECT_FLUSH_DELAY = 1000 * 60 * 15; // 15
|
static protected final int PROJECT_FLUSH_DELAY = 1000 * 60 * 15; // 15 minutes
|
||||||
// minutes
|
|
||||||
|
|
||||||
// Don't spend more than this much time saving projects if doing a quick
|
// Don't spend more than this much time saving projects if doing a quick save
|
||||||
// save
|
|
||||||
static protected final int QUICK_SAVE_MAX_TIME = 1000 * 30; // 30 secs
|
static protected final int QUICK_SAVE_MAX_TIME = 1000 * 30; // 30 secs
|
||||||
|
|
||||||
|
|
||||||
protected Map<Long, ProjectMetadata> _projectsMetadata;
|
protected Map<Long, ProjectMetadata> _projectsMetadata;
|
||||||
protected Map<String, Integer> _projectsTags;// TagName, number of projects
|
protected Map<String, Integer> _projectsTags;// TagName, number of projects having that tag
|
||||||
// having that tag
|
|
||||||
protected PreferenceStore _preferenceStore;
|
protected PreferenceStore _preferenceStore;
|
||||||
|
|
||||||
final static Logger logger = LoggerFactory.getLogger("ProjectManager");
|
final static Logger logger = LoggerFactory.getLogger("ProjectManager");
|
||||||
@ -89,17 +85,15 @@ public abstract class ProjectManager {
|
|||||||
transient protected InterProjectModel _interProjectModel = new InterProjectModel();
|
transient protected InterProjectModel _interProjectModel = new InterProjectModel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag for heavy operations like creating or importing projects. Workspace
|
* Flag for heavy operations like creating or importing projects. Workspace saves are skipped while it's set.
|
||||||
* saves are skipped while it's set.
|
|
||||||
*/
|
*/
|
||||||
transient protected int _busy = 0;
|
transient protected int _busy = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While each project's metadata is loaded completely at start-up, each
|
* While each project's metadata is loaded completely at start-up, each project's raw data
|
||||||
* project's raw data is loaded only when the project is accessed by the
|
* is loaded only when the project is accessed by the user. This is because project
|
||||||
* user. This is because project metadata is tiny compared to raw project
|
* metadata is tiny compared to raw project data. This hash map from project ID to project
|
||||||
* data. This hash map from project ID to project is more like a last
|
* is more like a last accessed-last out cache.
|
||||||
* accessed-last out cache.
|
|
||||||
*/
|
*/
|
||||||
transient protected Map<Long, Project> _projects;
|
transient protected Map<Long, Project> _projects;
|
||||||
|
|
||||||
@ -129,7 +123,6 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the project in the memory of the current session
|
* Registers the project in the memory of the current session
|
||||||
*
|
|
||||||
* @param project
|
* @param project
|
||||||
* @param projectMetadata
|
* @param projectMetadata
|
||||||
*/
|
*/
|
||||||
@ -137,10 +130,8 @@ public abstract class ProjectManager {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
_projects.put(project.id, project);
|
_projects.put(project.id, project);
|
||||||
_projectsMetadata.put(project.id, projectMetadata);
|
_projectsMetadata.put(project.id, projectMetadata);
|
||||||
if (_projectsTags == null) {
|
if (_projectsTags == null)
|
||||||
_projectsTags = new HashMap<String, Integer>();
|
_projectsTags = new HashMap<String, Integer>();
|
||||||
<<<<<<< Upstream, based on origin/master
|
|
||||||
}
|
|
||||||
String[] tags = projectMetadata.getTags();
|
String[] tags = projectMetadata.getTags();
|
||||||
if (tags != null) {
|
if (tags != null) {
|
||||||
for (String tag : tags) {
|
for (String tag : tags) {
|
||||||
@ -149,16 +140,6 @@ public abstract class ProjectManager {
|
|||||||
} else {
|
} else {
|
||||||
_projectsTags.put(tag, 1);
|
_projectsTags.put(tag, 1);
|
||||||
}
|
}
|
||||||
=======
|
|
||||||
String[] tags = projectMetadata.getTags();
|
|
||||||
if (tags != null) {
|
|
||||||
for (String tag : tags) {
|
|
||||||
if (_projectsTags.containsKey(tag)) {
|
|
||||||
_projectsTags.put(tag, _projectsTags.get(tag) + 1);
|
|
||||||
} else {
|
|
||||||
_projectsTags.put(tag, 1);
|
|
||||||
}
|
|
||||||
>>>>>>> 529b6bd Modified tags in metadata dialog and moved column right to name
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,7 +147,6 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load project metadata from data storage
|
* Load project metadata from data storage
|
||||||
*
|
|
||||||
* @param projectID
|
* @param projectID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -174,7 +154,6 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a project from the data store into memory
|
* Loads a project from the data store into memory
|
||||||
*
|
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -182,28 +161,24 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Import project from a Refine archive
|
* Import project from a Refine archive
|
||||||
*
|
|
||||||
* @param projectID
|
* @param projectID
|
||||||
* @param inputStream
|
* @param inputStream
|
||||||
* @param gziped
|
* @param gziped
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public abstract void importProject(long projectID, InputStream inputStream, boolean gziped)
|
public abstract void importProject(long projectID, InputStream inputStream, boolean gziped) throws IOException;
|
||||||
throws IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export project to a Refine archive
|
* Export project to a Refine archive
|
||||||
*
|
|
||||||
* @param projectId
|
* @param projectId
|
||||||
* @param tos
|
* @param tos
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public abstract void exportProject(long projectId, TarOutputStream tos)
|
public abstract void exportProject(long projectId, TarOutputStream tos) throws IOException;
|
||||||
throws IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves a project and its metadata to the data store
|
* Saves a project and its metadata to the data store
|
||||||
*
|
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
public void ensureProjectSaved(long id) {
|
public void ensureProjectSaved(long id) {
|
||||||
@ -215,8 +190,7 @@ public abstract class ProjectManager {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} // FIXME what should be the behaviour if metadata is null? i.e.
|
}//FIXME what should be the behaviour if metadata is null? i.e. not found
|
||||||
// not found
|
|
||||||
|
|
||||||
Project project = getProject(id);
|
Project project = getProject(id);
|
||||||
if (project != null && metadata != null && metadata.getModified().after(project.getLastSave())) {
|
if (project != null && metadata != null && metadata.getModified().after(project.getLastSave())) {
|
||||||
@ -225,36 +199,29 @@ public abstract class ProjectManager {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} // FIXME what should be the behaviour if project is null? i.e. not
|
}//FIXME what should be the behaviour if project is null? i.e. not found or loaded.
|
||||||
// found or loaded.
|
//FIXME what should happen if the metadata is found, but not the project? or vice versa?
|
||||||
// FIXME what should happen if the metadata is found, but not the
|
|
||||||
// project? or vice versa?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save project metadata to the data store
|
* Save project metadata to the data store
|
||||||
*
|
|
||||||
* @param metadata
|
* @param metadata
|
||||||
* @param projectId
|
* @param projectId
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public abstract void saveMetadata(ProjectMetadata metadata, long projectId)
|
public abstract void saveMetadata(ProjectMetadata metadata, long projectId) throws Exception;
|
||||||
throws Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save project to the data store
|
* Save project to the data store
|
||||||
*
|
|
||||||
* @param project
|
* @param project
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
protected abstract void saveProject(Project project)
|
protected abstract void saveProject(Project project) throws IOException;
|
||||||
throws IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save workspace and all projects to data store
|
* Save workspace and all projects to data store
|
||||||
*
|
|
||||||
* @param allModified
|
* @param allModified
|
||||||
*/
|
*/
|
||||||
public void save(boolean allModified) {
|
public void save(boolean allModified) {
|
||||||
@ -270,11 +237,10 @@ public abstract class ProjectManager {
|
|||||||
protected abstract void saveWorkspace();
|
protected abstract void saveWorkspace();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A utility class to prioritize projects for saving, depending on how long
|
* A utility class to prioritize projects for saving, depending on how long ago
|
||||||
* ago they have been changed but have not been saved.
|
* they have been changed but have not been saved.
|
||||||
*/
|
*/
|
||||||
static protected class SaveRecord {
|
static protected class SaveRecord {
|
||||||
|
|
||||||
final Project project;
|
final Project project;
|
||||||
final long overdue;
|
final long overdue;
|
||||||
|
|
||||||
@ -286,7 +252,6 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves all projects to the data store
|
* Saves all projects to the data store
|
||||||
*
|
|
||||||
* @param allModified
|
* @param allModified
|
||||||
*/
|
*/
|
||||||
protected void saveProjects(boolean allModified) {
|
protected void saveProjects(boolean allModified) {
|
||||||
@ -296,16 +261,13 @@ public abstract class ProjectManager {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
for (long id : _projectsMetadata.keySet()) {
|
for (long id : _projectsMetadata.keySet()) {
|
||||||
ProjectMetadata metadata = getProjectMetadata(id);
|
ProjectMetadata metadata = getProjectMetadata(id);
|
||||||
Project project = _projects.get(id); // don't call getProject()
|
Project project = _projects.get(id); // don't call getProject() as that will load the project.
|
||||||
// as that will load the
|
|
||||||
// project.
|
|
||||||
|
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
boolean hasUnsavedChanges = metadata.getModified().getTime() >= project.getLastSave().getTime();
|
boolean hasUnsavedChanges =
|
||||||
// We use >= instead of just > to avoid the case where a
|
metadata.getModified().getTime() >= project.getLastSave().getTime();
|
||||||
// newly created project
|
// We use >= instead of just > to avoid the case where a newly created project
|
||||||
// has the same modified and last save times, resulting in
|
// has the same modified and last save times, resulting in the project not getting
|
||||||
// the project not getting
|
|
||||||
// saved at all.
|
// saved at all.
|
||||||
|
|
||||||
if (hasUnsavedChanges) {
|
if (hasUnsavedChanges) {
|
||||||
@ -317,9 +279,8 @@ public abstract class ProjectManager {
|
|||||||
&& startTimeOfSave.getTime() - project.getLastSave().getTime() > PROJECT_FLUSH_DELAY) {
|
&& startTimeOfSave.getTime() - project.getLastSave().getTime() > PROJECT_FLUSH_DELAY) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It's been a while since the project was last saved
|
* It's been a while since the project was last saved and it hasn't been
|
||||||
* and it hasn't been modified. We can safely remove it
|
* modified. We can safely remove it from the cache to save some memory.
|
||||||
* from the cache to save some memory.
|
|
||||||
*/
|
*/
|
||||||
_projects.remove(id).dispose();
|
_projects.remove(id).dispose();
|
||||||
}
|
}
|
||||||
@ -329,7 +290,6 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
if (records.size() > 0) {
|
if (records.size() > 0) {
|
||||||
Collections.sort(records, new Comparator<SaveRecord>() {
|
Collections.sort(records, new Comparator<SaveRecord>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(SaveRecord o1, SaveRecord o2) {
|
public int compare(SaveRecord o1, SaveRecord o2) {
|
||||||
if (o1.overdue < o2.overdue) {
|
if (o1.overdue < o2.overdue) {
|
||||||
@ -342,17 +302,21 @@ public abstract class ProjectManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info(allModified ? "Saving all modified projects ..." : "Saving some modified projects ...");
|
logger.info(allModified ?
|
||||||
|
"Saving all modified projects ..." :
|
||||||
|
"Saving some modified projects ..."
|
||||||
|
);
|
||||||
|
|
||||||
for (int i = 0; i < records.size()
|
for (int i = 0;
|
||||||
&& (allModified || (new Date().getTime() - startTimeOfSave.getTime() < QUICK_SAVE_MAX_TIME)); i++) {
|
i < records.size() &&
|
||||||
|
(allModified || (new Date().getTime() - startTimeOfSave.getTime() < QUICK_SAVE_MAX_TIME));
|
||||||
|
i++) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
saveProject(records.get(i).project);
|
saveProject(records.get(i).project);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// In case we're running low on memory, free as much as we
|
// In case we're running low on memory, free as much as we can
|
||||||
// can
|
|
||||||
disposeUnmodifiedProjects();
|
disposeUnmodifiedProjects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -382,10 +346,10 @@ public abstract class ProjectManager {
|
|||||||
return _interProjectModel;
|
return _interProjectModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the project metadata from memory Requires that the metadata has
|
* Gets the project metadata from memory
|
||||||
* already been loaded from the data store
|
* Requires that the metadata has already been loaded from the data store
|
||||||
*
|
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -394,9 +358,8 @@ public abstract class ProjectManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the project metadata from memory Requires that the metadata has
|
* Gets the project metadata from memory
|
||||||
* already been loaded from the data store
|
* Requires that the metadata has already been loaded from the data store
|
||||||
*
|
|
||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -410,12 +373,12 @@ public abstract class ProjectManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to find the project id when given a project name Requires that all
|
* Tries to find the project id when given a project name
|
||||||
* project metadata exists has been loaded to memory from the data store
|
* Requires that all project metadata exists has been loaded to memory from the data store
|
||||||
*
|
|
||||||
* @param name
|
* @param name
|
||||||
* The name of the project
|
* The name of the project
|
||||||
* @return The id of the project, or -1 if it cannot be found
|
* @return
|
||||||
|
* The id of the project, or -1 if it cannot be found
|
||||||
*/
|
*/
|
||||||
public long getProjectID(String name) {
|
public long getProjectID(String name) {
|
||||||
for (Entry<Long, ProjectMetadata> entry : _projectsMetadata.entrySet()) {
|
for (Entry<Long, ProjectMetadata> entry : _projectsMetadata.entrySet()) {
|
||||||
@ -428,18 +391,18 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A valid user meta data definition should have name and display property
|
* A valid user meta data definition should have name and display property
|
||||||
*
|
|
||||||
* @param placeHolderJsonObj
|
* @param placeHolderJsonObj
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean isValidUserMetadataDefinition(JSONObject placeHolderJsonObj) {
|
private boolean isValidUserMetadataDefinition(JSONObject placeHolderJsonObj) {
|
||||||
return (placeHolderJsonObj != null && placeHolderJsonObj.has("name") && placeHolderJsonObj.has("display"));
|
return (placeHolderJsonObj != null &&
|
||||||
|
placeHolderJsonObj.has("name") &&
|
||||||
|
placeHolderJsonObj.has("display"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mergeEmptyUserMetadata(ProjectMetadata metadata) {
|
public void mergeEmptyUserMetadata(ProjectMetadata metadata) {
|
||||||
if (metadata == null) {
|
if (metadata == null)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// place holder
|
// place holder
|
||||||
JSONArray userMetadataPreference = null;
|
JSONArray userMetadataPreference = null;
|
||||||
@ -450,13 +413,11 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
String userMeta = (String)_preferenceStore.get(PreferenceStore.USER_METADATA_KEY);
|
String userMeta = (String)_preferenceStore.get(PreferenceStore.USER_METADATA_KEY);
|
||||||
if (userMeta == null) {
|
if (userMeta == null)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
userMetadataPreference = new JSONArray(userMeta);
|
userMetadataPreference = new JSONArray(userMeta);
|
||||||
} catch (JSONException e1) {
|
} catch (JSONException e1) {
|
||||||
logger.warn(
|
logger.warn("wrong definition of userMetadata format. Please use form [{\"name\": \"client name\", \"display\":true}, {\"name\": \"progress\", \"display\":false}]");
|
||||||
"wrong definition of userMetadata format. Please use form [{\"name\": \"client name\", \"display\":true}, {\"name\": \"progress\", \"display\":false}]");
|
|
||||||
logger.error(ExceptionUtils.getFullStackTrace(e1));
|
logger.error(ExceptionUtils.getFullStackTrace(e1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +443,8 @@ public abstract class ProjectManager {
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
placeHolderJsonObj.put("value", "");
|
placeHolderJsonObj.put("value", "");
|
||||||
metadata.getUserMetadata().put(placeHolderJsonObj);
|
metadata.getUserMetadata().put(placeHolderJsonObj);
|
||||||
logger.info("Put the placeholder {} for project {}", placeHolderJsonObj.getString("name"),
|
logger.info("Put the placeholder {} for project {}",
|
||||||
|
placeHolderJsonObj.getString("name"),
|
||||||
metadata.getName());
|
metadata.getName());
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
@ -493,7 +455,6 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* honor the meta data preference
|
* honor the meta data preference
|
||||||
*
|
|
||||||
* @param jsonObjArray
|
* @param jsonObjArray
|
||||||
*/
|
*/
|
||||||
private void initDisplay(JSONArray jsonObjArray) {
|
private void initDisplay(JSONArray jsonObjArray) {
|
||||||
@ -509,7 +470,6 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the project Metadata currently held in memory.
|
* Gets all the project Metadata currently held in memory.
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Map<Long, ProjectMetadata> getAllProjectMetadata() {
|
public Map<Long, ProjectMetadata> getAllProjectMetadata() {
|
||||||
@ -530,12 +490,12 @@ public abstract class ProjectManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the required project from the data store If project does not already
|
* Gets the required project from the data store
|
||||||
* exist in memory, it is loaded from the data store
|
* If project does not already exist in memory, it is loaded from the data store
|
||||||
*
|
|
||||||
* @param id
|
* @param id
|
||||||
* the id of the project
|
* the id of the project
|
||||||
* @return the project with the matching id, or null if it can't be found
|
* @return
|
||||||
|
* the project with the matching id, or null if it can't be found
|
||||||
*/
|
*/
|
||||||
public Project getProject(long id) {
|
public Project getProject(long id) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
@ -553,7 +513,6 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the preference store
|
* Gets the preference store
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PreferenceStore getPreferenceStore() {
|
public PreferenceStore getPreferenceStore() {
|
||||||
@ -562,7 +521,6 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all expressions from the preference store
|
* Gets all expressions from the preference store
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<String> getExpressions() {
|
public List<String> getExpressions() {
|
||||||
@ -571,14 +529,13 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The history entry manager deals with changes
|
* The history entry manager deals with changes
|
||||||
*
|
|
||||||
* @return manager for handling history
|
* @return manager for handling history
|
||||||
*/
|
*/
|
||||||
public abstract HistoryEntryManager getHistoryEntryManager();
|
public abstract HistoryEntryManager getHistoryEntryManager();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the project from the data store
|
* Remove the project from the data store
|
||||||
*
|
|
||||||
* @param project
|
* @param project
|
||||||
*/
|
*/
|
||||||
public void deleteProject(Project project) {
|
public void deleteProject(Project project) {
|
||||||
@ -587,14 +544,12 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove project from data store
|
* Remove project from data store
|
||||||
*
|
|
||||||
* @param projectID
|
* @param projectID
|
||||||
*/
|
*/
|
||||||
public abstract void deleteProject(long projectID);
|
public abstract void deleteProject(long projectID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes project from memory
|
* Removes project from memory
|
||||||
*
|
|
||||||
* @param projectID
|
* @param projectID
|
||||||
*/
|
*/
|
||||||
protected void removeProject(long projectID){
|
protected void removeProject(long projectID){
|
||||||
@ -606,10 +561,10 @@ public abstract class ProjectManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the flag for long running operations. This will prevent workspace
|
* Sets the flag for long running operations. This will prevent
|
||||||
* saves from happening while it's set.
|
* workspace saves from happening while it's set.
|
||||||
*
|
|
||||||
* @param busy
|
* @param busy
|
||||||
*/
|
*/
|
||||||
public void setBusy(boolean busy) {
|
public void setBusy(boolean busy) {
|
||||||
@ -622,9 +577,10 @@ public abstract class ProjectManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the latest expression to the preference store
|
* Add the latest expression to the preference store
|
||||||
*
|
|
||||||
* @param s
|
* @param s
|
||||||
*/
|
*/
|
||||||
public void addLatestExpression(String s) {
|
public void addLatestExpression(String s) {
|
||||||
@ -633,6 +589,7 @@ public abstract class ProjectManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param ps
|
* @param ps
|
||||||
|
@ -94,15 +94,9 @@ public class ProjectManagerTests extends RefineTest {
|
|||||||
|
|
||||||
SUT.registerProject(project, metadata);
|
SUT.registerProject(project, metadata);
|
||||||
|
|
||||||
<<<<<<< Upstream, based on origin/master
|
|
||||||
AssertProjectRegistered();
|
AssertProjectRegistered();
|
||||||
verify(metadata, times(1)).getTags();
|
verify(metadata, times(1)).getTags();
|
||||||
|
|
||||||
=======
|
|
||||||
AssertProjectRegistered();
|
|
||||||
verify(metadata, times(1)).getTags();
|
|
||||||
|
|
||||||
>>>>>>> 529b6bd Modified tags in metadata dialog and moved column right to name
|
|
||||||
verifyNoMoreInteractions(project);
|
verifyNoMoreInteractions(project);
|
||||||
verifyNoMoreInteractions(metadata);
|
verifyNoMoreInteractions(metadata);
|
||||||
}
|
}
|
||||||
@ -127,11 +121,7 @@ public class ProjectManagerTests extends RefineTest {
|
|||||||
this.verifySaveTimeCompared(1);
|
this.verifySaveTimeCompared(1);
|
||||||
verify(SUT, times(1)).saveProject(project);
|
verify(SUT, times(1)).saveProject(project);
|
||||||
verify(metadata, times(1)).getTags();
|
verify(metadata, times(1)).getTags();
|
||||||
<<<<<<< Upstream, based on origin/master
|
|
||||||
|
|
||||||
=======
|
|
||||||
|
|
||||||
>>>>>>> 529b6bd Modified tags in metadata dialog and moved column right to name
|
|
||||||
//ensure end
|
//ensure end
|
||||||
verifyNoMoreInteractions(project);
|
verifyNoMoreInteractions(project);
|
||||||
verifyNoMoreInteractions(metadata);
|
verifyNoMoreInteractions(metadata);
|
||||||
|
@ -351,15 +351,9 @@ Refine.TagsManager._getAllProjectTags = function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
array.map(function(item){
|
array.map(function(item){
|
||||||
<<<<<<< Upstream, based on origin/master
|
|
||||||
self.allProjectTags.push(item);
|
|
||||||
=======
|
|
||||||
self.allProjectTags.push(item);
|
self.allProjectTags.push(item);
|
||||||
});
|
});
|
||||||
},
|
|
||||||
async : false
|
|
||||||
>>>>>>> 529b6bd Modified tags in metadata dialog and moved column right to name
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
async : false
|
async : false
|
||||||
});
|
});
|
||||||
|
@ -23,10 +23,10 @@ function EditMetadataDialog(metaData, targetRowElem) {
|
|||||||
|
|
||||||
if(key==="tags"){
|
if(key==="tags"){
|
||||||
$('<button class="button">').text($.i18n._('core-index')["edit"]).appendTo(td2).click(function() {
|
$('<button class="button">').text($.i18n._('core-index')["edit"]).appendTo(td2).click(function() {
|
||||||
var oldTags = $(td1).text().replace("\"","").replace("[","").replace("]","");
|
var oldTags = $(td1).text().replace("[","").replace("]","");
|
||||||
oldTags = replaceAll(oldTags,"\"","");
|
oldTags = replaceAll(oldTags,"\"","");
|
||||||
var newTags = window.prompt($.i18n._('core-index')["change-metadata-value"]+" " + key, value);
|
var newTags = window.prompt($.i18n._('core-index')["change-metadata-value"]+" " + key, $(td1).text());
|
||||||
newTags = newTags.replace("\"","").replace("[","").replace("]","");
|
newTags = newTags.replace("[","").replace("]","");
|
||||||
newTags = replaceAll(newTags,"\"","");
|
newTags = replaceAll(newTags,"\"","");
|
||||||
if (newTags !== null) {
|
if (newTags !== null) {
|
||||||
$(td1).text(newTags);
|
$(td1).text(newTags);
|
||||||
@ -43,7 +43,7 @@ function EditMetadataDialog(metaData, targetRowElem) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Refine.OpenProjectUI.refreshProject(targetRowElem, metaData);
|
Refine.OpenProjectUI.refreshProject(targetRowElem, metaData, project);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ function EditMetadataDialog(metaData, targetRowElem) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Refine.OpenProjectUI.refreshProject(targetRowElem, metaData);
|
Refine.OpenProjectUI.refreshProject(targetRowElem, metaData, project);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -275,41 +275,6 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var editTagsLink = $('<a></a>')
|
|
||||||
.text($.i18n._('core-index-open')["rename"])
|
|
||||||
.addClass("secondary")
|
|
||||||
.addClass("edit-project-tags")
|
|
||||||
.css("visibility", "hidden")
|
|
||||||
.attr("href", "")
|
|
||||||
.attr("title", $.i18n._('core-index-open')["edit-tags"])
|
|
||||||
.html('<img src="images/edit.png" />')
|
|
||||||
.click(function() {
|
|
||||||
var oldTags = project.tags.join(",");
|
|
||||||
var newTags = window.prompt($.i18n._('core-index-open')["edit-tags-desc"],oldTags);
|
|
||||||
if (newTags === null || newTags === oldTags) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type : "POST",
|
|
||||||
url : "command/core/set-project-tags",
|
|
||||||
data : {
|
|
||||||
"project" : project.id,
|
|
||||||
"old" : oldTags,
|
|
||||||
"new" : newTags
|
|
||||||
},
|
|
||||||
dataType : "json",
|
|
||||||
success : function(data) {
|
|
||||||
if (data && typeof data.code != 'undefined' && data.code == "ok") {
|
|
||||||
Refine.TagsManager.allProjectTags = [];
|
|
||||||
self._buildTagsAndFetchProjects();
|
|
||||||
} else {
|
|
||||||
alert($.i18n._('core-index-open')["warning-tags-update"]+ " "+ data.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}).appendTo(tagsCell);
|
|
||||||
|
|
||||||
var appendMetaField = function(data) {
|
var appendMetaField = function(data) {
|
||||||
$('<div></div>')
|
$('<div></div>')
|
||||||
.html(data)
|
.html(data)
|
||||||
@ -329,11 +294,6 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(tr).mouseenter(function() {
|
|
||||||
editTagsLink.css("visibility", "visible");
|
|
||||||
}).mouseleave(function() {
|
|
||||||
editTagsLink.css("visibility", "hidden");
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -388,7 +348,7 @@ Refine.OpenProjectUI.prototype._onClickUploadFileButton = function(evt) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.OpenProjectUI.refreshProject = function(tr, metaData) {
|
Refine.OpenProjectUI.refreshProject = function(tr, metaData, project) {
|
||||||
|
|
||||||
var refreshMetaField = function(data, index) {
|
var refreshMetaField = function(data, index) {
|
||||||
if (index === 3) {
|
if (index === 3) {
|
||||||
@ -409,43 +369,9 @@ Refine.OpenProjectUI.refreshProject = function(tr, metaData) {
|
|||||||
.text(tag)
|
.text(tag)
|
||||||
.attr("title", $.i18n._('core-index-open')["edit-tags"])
|
.attr("title", $.i18n._('core-index-open')["edit-tags"])
|
||||||
.appendTo(tagCol);
|
.appendTo(tagCol);
|
||||||
|
|
||||||
var editTagsLink = $('<a></a>')
|
|
||||||
.text($.i18n._('core-index-open')["rename"])
|
|
||||||
.addClass("secondary")
|
|
||||||
.addClass("edit-project-tags")
|
|
||||||
.css("visibility", "hidden")
|
|
||||||
.attr("href", "")
|
|
||||||
.attr("title", $.i18n._('core-index-open')["edit-tags"])
|
|
||||||
.html('<img src="images/edit.png" />')
|
|
||||||
.click(function() {
|
|
||||||
var oldTags = project.tags.join(",");
|
|
||||||
var newTags = window.prompt($.i18n._('core-index-open')["edit-tags-desc"],oldTags);
|
|
||||||
if (newTags === null || newTags === oldTags) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type : "POST",
|
|
||||||
url : "command/core/set-project-tags",
|
|
||||||
data : {
|
|
||||||
"project" : project.id,
|
|
||||||
"old" : oldTags,
|
|
||||||
"new" : newTags
|
|
||||||
},
|
|
||||||
dataType : "json",
|
|
||||||
success : function(data) {
|
|
||||||
if (data && typeof data.code != 'undefined' && data.code == "ok") {
|
|
||||||
Refine.TagsManager.allProjectTags = [];
|
|
||||||
self._buildTagsAndFetchProjects();
|
|
||||||
} else {
|
|
||||||
alert($.i18n._('core-index-open')["warning-tags-update"]+ " "+ data.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}).appendTo(tagCol);
|
|
||||||
tagCol.parent().addClass(tag);
|
tagCol.parent().addClass(tag);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
data.split(",").map(function(tag){
|
data.split(",").map(function(tag){
|
||||||
var tagsCell = $("<span/>")
|
var tagsCell = $("<span/>")
|
||||||
@ -453,44 +379,11 @@ Refine.OpenProjectUI.refreshProject = function(tr, metaData) {
|
|||||||
.text(tag)
|
.text(tag)
|
||||||
.attr("title", $.i18n._('core-index-open')["edit-tags"])
|
.attr("title", $.i18n._('core-index-open')["edit-tags"])
|
||||||
.appendTo(tagCol);
|
.appendTo(tagCol);
|
||||||
|
|
||||||
var editTagsLink = $('<a></a>')
|
|
||||||
.text($.i18n._('core-index-open')["rename"])
|
|
||||||
.addClass("secondary")
|
|
||||||
.addClass("edit-project-tags")
|
|
||||||
.css("visibility", "hidden")
|
|
||||||
.attr("href", "")
|
|
||||||
.attr("title", $.i18n._('core-index-open')["edit-tags"])
|
|
||||||
.html('<img src="images/edit.png" />')
|
|
||||||
.click(function() {
|
|
||||||
var oldTags = project.tags.join(",");
|
|
||||||
var newTags = window.prompt($.i18n._('core-index-open')["edit-tags-desc"],oldTags);
|
|
||||||
if (newTags === null || newTags === oldTags) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
type : "POST",
|
|
||||||
url : "command/core/set-project-tags",
|
|
||||||
data : {
|
|
||||||
"project" : project.id,
|
|
||||||
"old" : oldTags,
|
|
||||||
"new" : newTags
|
|
||||||
},
|
|
||||||
dataType : "json",
|
|
||||||
success : function(data) {
|
|
||||||
if (data && typeof data.code != 'undefined' && data.code == "ok") {
|
|
||||||
Refine.TagsManager.allProjectTags = [];
|
|
||||||
self._buildTagsAndFetchProjects();
|
|
||||||
} else {
|
|
||||||
alert($.i18n._('core-index-open')["warning-tags-update"]+ " "+ data.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}).appendTo(tagCol);
|
|
||||||
tagCol.parent().addClass(tag);
|
tagCol.parent().addClass(tag);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var index = 3;
|
var index = 3;
|
||||||
|
Loading…
Reference in New Issue
Block a user