Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
786be2e7
Commit
786be2e7
authored
9 years ago
by
Mauricio Giacomini Girardello
Browse files
Options
Downloads
Patches
Plain Diff
raise an exception when p_id of orientdb user class will be duplicated
parent
89bb5f07
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/duplicated_user_index_error.rb
+2
-0
2 additions, 0 deletions
app/models/duplicated_user_index_error.rb
app/repositories/orient_db/user_repository.rb
+9
-3
9 additions, 3 deletions
app/repositories/orient_db/user_repository.rb
with
11 additions
and
3 deletions
app/models/duplicated_user_index_error.rb
0 → 100644
+
2
−
0
View file @
786be2e7
class
DuplicatedUserIndexError
<
Orientdb4r
::
ServerError
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/repositories/orient_db/user_repository.rb
+
9
−
3
View file @
786be2e7
...
@@ -2,9 +2,15 @@ module OrientDb
...
@@ -2,9 +2,15 @@ module OrientDb
class
UserRepository
<
Base
class
UserRepository
<
Base
def
create_graph_node
(
user
)
def
create_graph_node
(
user
)
if
user
.
persisted?
begin
connection
.
command
sprintf
(
"create vertex User set p_id = %d"
,
user
.
id
)
if
user
.
persisted?
return
true
connection
.
command
sprintf
(
"create vertex User set p_id = %d"
,
user
.
id
)
return
true
end
rescue
Orientdb4r
::
ServerError
=>
e
if
e
.
message
=~
/ORecordDuplicatedException/
raise
DuplicatedUserIndexError
,
'The OrientDB index p_id of User class cannot be duplicated.'
end
end
end
raise
NotPersistedRecordError
,
'The user wasn`t persisted yet.'
raise
NotPersistedRecordError
,
'The user wasn`t persisted yet.'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment