Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ejercicio2-framework-back
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Josue
ejercicio2-framework-back
Commits
a0d2f14c
Commit
a0d2f14c
authored
Dec 29, 2021
by
Roberto Loayza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SchedulerTaskService actualización
parent
e7e53f02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
SchedulerTaskService.java
...java/com/bytesw/bytebot/service/SchedulerTaskService.java
+35
-0
No files found.
src/main/java/com/bytesw/bytebot/service/SchedulerTaskService.java
View file @
a0d2f14c
...
...
@@ -6,6 +6,7 @@ import com.bytesw.bytebot.model.Calendar;
import
com.bytesw.bytebot.model.SchedulerTask
;
import
com.bytesw.bytebot.repository.CalendarRepository
;
import
com.bytesw.bytebot.repository.SchedulerTaskRepository
;
import
com.bytesw.xdf.exception.AlreadyExistsException
;
import
com.bytesw.xdf.exception.NotFoundException
;
import
com.bytesw.xdf.service.XDFService
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -26,6 +27,9 @@ public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTas
@Autowired
private
CalendarRepository
calendarRepository
;
@Autowired
private
SchedulerTaskRepository
schedulerTaskRepository
;
protected
SchedulerTaskService
(
SchedulerTaskRepository
repository
)
{
super
(
repository
);
}
...
...
@@ -73,4 +77,35 @@ public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTas
initialData
.
put
(
"calendarList"
,
calendarBeanList
);
return
initialData
;
}
@Override
public
SchedulerTaskBean
create
(
SchedulerTaskBean
schedulerTaskBean
)
{
SchedulerTask
schedulerTask
=
new
SchedulerTask
();
schedulerTask
=
toModel
(
schedulerTask
,
schedulerTaskBean
);
schedulerTask
=
schedulerTaskRepository
.
save
(
schedulerTask
);
System
.
out
.
println
(
schedulerTask
);
return
toBean
(
schedulerTask
);
}
@Override
public
SchedulerTaskBean
update
(
SchedulerTaskBean
bean
,
BigInteger
id
)
{
Optional
<
SchedulerTask
>
model
=
schedulerTaskRepository
.
findById
(
id
);
if
(!
model
.
isPresent
())
{
throw
new
NotFoundException
();
}
SchedulerTask
schedulerTask
=
new
SchedulerTask
();
schedulerTask
=
toModel
(
schedulerTask
,
bean
);
schedulerTask
=
schedulerTaskRepository
.
save
(
schedulerTask
);
return
toBean
(
schedulerTask
);
}
@Override
public
void
delete
(
BigInteger
id
)
{
Optional
<
SchedulerTask
>
model
=
schedulerTaskRepository
.
findById
(
id
);
if
(!
model
.
isPresent
())
{
throw
new
NotFoundException
();
}
schedulerTaskRepository
.
deleteById
(
id
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment