ui: bookmarks

can now bookmark tokens
This commit is contained in:
wrongway88
2017-02-12 15:06:07 +01:00
parent e1d2c3a4e0
commit 97fd40fe9b
84 changed files with 5024 additions and 65 deletions
+28
View File
@@ -9,6 +9,10 @@
#include "utility/file/FileInfo.h"
#include "utility/file/FilePath.h"
#include "data/bookmark/Bookmark.h"
#include "data/bookmark/BookmarkCategory.h"
#include "data/bookmark/EdgeBookmark.h"
#include "data/bookmark/NodeBookmark.h"
#include "data/parser/ParseLocation.h"
#include "data/graph/Node.h"
#include "data/search/SearchMatch.h"
@@ -32,9 +36,13 @@ public:
virtual Id getIdForNodeWithNameHierarchy(const NameHierarchy& nameHierarchy) const = 0;
virtual Id getIdForEdge(
Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy) const = 0;
virtual StorageEdge getEdgeById(Id edgeId) const = 0;
virtual bool checkEdgeExists(Id edgeId) const = 0;
virtual NameHierarchy getNameHierarchyForNodeWithId(Id id) const = 0;
virtual Node::NodeType getNodeTypeForNodeWithId(Id id) const = 0;
virtual bool checkNodeExistsByName(const std::string& serializedName) const = 0;
virtual std::shared_ptr<TokenLocationCollection> getFullTextSearchLocations(
const std::string& searchTerm, bool caseSensitive) const = 0;
@@ -76,6 +84,26 @@ public:
virtual void setErrorFilter(const ErrorFilter& filter);
virtual Id addNodeBookmark(const NodeBookmark& bookmark) = 0;
virtual Id addEdgeBookmark(const EdgeBookmark& bookmark) = 0;
virtual Id addBookmarkCategory(const BookmarkCategory& category) = 0;
virtual std::vector<NodeBookmark> getAllNodeBookmarks() const = 0;
virtual NodeBookmark getNodeBookmarkById(const Id bookmarkId) const = 0;
virtual bool checkNodeBookmarkExistsByTokens(const std::vector<std::string>& tokenNames) const = 0;
virtual void removeNodeBookmark(Id id) = 0;
virtual void editNodeBookmark(const NodeBookmark& bookmark) = 0;
virtual std::vector<EdgeBookmark> getAllEdgeBookmarks() const = 0;
virtual EdgeBookmark getEdgeBookmarkById(const Id bookmarkId) const = 0;
virtual bool checkEdgeBookmarkExistsByTokens(const std::vector<std::string>& tokenNames) const = 0;
virtual void removeEdgeBookmark(Id id) = 0;
virtual void editEdgeBookmark(const EdgeBookmark& bookmark) = 0;
virtual std::vector<BookmarkCategory> getAllBookmarkCategories() const = 0;
virtual bool checkBookmarkCategoryExists(const std::string& name) const = 0;
virtual void removeBookmarkCategory(Id id) = 0;
protected:
ErrorFilter m_errorFilter;
};
+177
View File
@@ -57,6 +57,24 @@ Id StorageAccessProxy::getIdForEdge(
return 0;
}
StorageEdge StorageAccessProxy::getEdgeById(Id edgeId) const
{
if (hasSubject())
{
return m_subject->getEdgeById(edgeId);
}
}
bool StorageAccessProxy::checkEdgeExists(Id edgeId) const
{
if (hasSubject())
{
return m_subject->checkEdgeExists(edgeId);
}
return false;
}
Node::NodeType StorageAccessProxy::getNodeTypeForNodeWithId(Id id) const
{
if (hasSubject())
@@ -66,6 +84,15 @@ Node::NodeType StorageAccessProxy::getNodeTypeForNodeWithId(Id id) const
return Node::NODE_NON_INDEXED;
}
bool StorageAccessProxy::checkNodeExistsByName(const std::string& serializedName) const
{
if (hasSubject())
{
return m_subject->checkNodeExistsByName(serializedName);
}
return false;
}
NameHierarchy StorageAccessProxy::getNameHierarchyForNodeWithId(Id id) const
{
if (hasSubject())
@@ -302,6 +329,156 @@ std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getErrorTokenLocati
return std::make_shared<TokenLocationCollection>();
}
Id StorageAccessProxy::addNodeBookmark(const NodeBookmark& bookmark)
{
if (hasSubject())
{
return m_subject->addNodeBookmark(bookmark);
}
return -1;
}
Id StorageAccessProxy::addEdgeBookmark(const EdgeBookmark& bookmark)
{
if (hasSubject())
{
return m_subject->addEdgeBookmark(bookmark);
}
return -1;
}
Id StorageAccessProxy::addBookmarkCategory(const BookmarkCategory& category)
{
if (hasSubject())
{
return m_subject->addBookmarkCategory(category);
}
return -1;
}
std::vector<NodeBookmark> StorageAccessProxy::getAllNodeBookmarks() const
{
if (hasSubject())
{
return m_subject->getAllNodeBookmarks();
}
return std::vector<NodeBookmark>();
}
NodeBookmark StorageAccessProxy::getNodeBookmarkById(const Id bookmarkId) const
{
if (hasSubject())
{
return m_subject->getNodeBookmarkById(bookmarkId);
}
return NodeBookmark();
}
bool StorageAccessProxy::checkNodeBookmarkExistsByTokens(const std::vector<std::string>& tokenNames) const
{
if (hasSubject())
{
return m_subject->checkNodeBookmarkExistsByTokens(tokenNames);
}
return false;
}
void StorageAccessProxy::removeNodeBookmark(Id id)
{
if (hasSubject())
{
m_subject->removeNodeBookmark(id);
}
}
void StorageAccessProxy::editNodeBookmark(const NodeBookmark& bookmark)
{
if (hasSubject())
{
m_subject->editNodeBookmark(bookmark);
}
}
std::vector<EdgeBookmark> StorageAccessProxy::getAllEdgeBookmarks() const
{
if (hasSubject())
{
return m_subject->getAllEdgeBookmarks();
}
return std::vector<EdgeBookmark>();
}
EdgeBookmark StorageAccessProxy::getEdgeBookmarkById(const Id bookmarkId) const
{
if (hasSubject())
{
return m_subject->getEdgeBookmarkById(bookmarkId);
}
return EdgeBookmark();
}
bool StorageAccessProxy::checkEdgeBookmarkExistsByTokens(const std::vector<std::string>& tokenNames) const
{
if (hasSubject())
{
return m_subject->checkEdgeBookmarkExistsByTokens(tokenNames);
}
return false;
}
void StorageAccessProxy::removeEdgeBookmark(Id id)
{
if (hasSubject())
{
m_subject->removeEdgeBookmark(id);
}
}
void StorageAccessProxy::editEdgeBookmark(const EdgeBookmark& bookmark)
{
if (hasSubject())
{
m_subject->editEdgeBookmark(bookmark);
}
}
std::vector<BookmarkCategory> StorageAccessProxy::getAllBookmarkCategories() const
{
if (hasSubject())
{
return m_subject->getAllBookmarkCategories();
}
return std::vector<BookmarkCategory>();
}
bool StorageAccessProxy::checkBookmarkCategoryExists(const std::string& name) const
{
if (hasSubject())
{
return m_subject->checkBookmarkCategoryExists(name);
}
return false;
}
void StorageAccessProxy::removeBookmarkCategory(Id id)
{
if (hasSubject())
{
m_subject->removeBookmarkCategory(id);
}
}
void StorageAccessProxy::setErrorFilter(const ErrorFilter& filter)
{
StorageAccess::setErrorFilter(filter);
+24
View File
@@ -21,9 +21,13 @@ public:
virtual Id getIdForNodeWithNameHierarchy(const NameHierarchy& nameHierarchy) const;
virtual Id getIdForEdge(
Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy) const;
virtual StorageEdge getEdgeById(Id edgeId) const;
virtual bool checkEdgeExists(Id edgeId) const;
virtual NameHierarchy getNameHierarchyForNodeWithId(Id id) const;
virtual Node::NodeType getNodeTypeForNodeWithId(Id id) const;
virtual bool checkNodeExistsByName(const std::string& serializedName) const;
virtual std::shared_ptr<TokenLocationCollection> getFullTextSearchLocations(
const std::string& searchTerm, bool caseSensitive) const;
@@ -66,6 +70,26 @@ public:
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
virtual Id addNodeBookmark(const NodeBookmark& bookmark);
virtual Id addEdgeBookmark(const EdgeBookmark& bookmark);
virtual Id addBookmarkCategory(const BookmarkCategory& category);
virtual std::vector<NodeBookmark> getAllNodeBookmarks() const;
virtual NodeBookmark getNodeBookmarkById(const Id bookmarkId) const;
virtual bool checkNodeBookmarkExistsByTokens(const std::vector<std::string>& tokenNames) const;
virtual void removeNodeBookmark(Id id);
virtual void editNodeBookmark(const NodeBookmark& bookmark);
virtual std::vector<EdgeBookmark> getAllEdgeBookmarks() const;
virtual EdgeBookmark getEdgeBookmarkById(const Id bookmarkId) const;
virtual bool checkEdgeBookmarkExistsByTokens(const std::vector<std::string>& tokenNames) const;
virtual void removeEdgeBookmark(Id id);
virtual void editEdgeBookmark(const EdgeBookmark& bookmark);
virtual virtual std::vector<BookmarkCategory> getAllBookmarkCategories() const;
virtual bool checkBookmarkCategoryExists(const std::string& name) const;
virtual void removeBookmarkCategory(Id id);
protected:
virtual void setErrorFilter(const ErrorFilter& filter);