Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
BackEnd-V2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joel Andres Molina Velez
BackEnd-V2
Commits
d5eb27e4
Commit
d5eb27e4
authored
Aug 15, 2023
by
Joel Andres Molina Velez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se realizan cambios en el UzyTavInstProyMapper
parent
080d86c5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
UzyTavInstProyMapper.java
...lidadWS/Mapper/Components_Class/UzyTavInstProyMapper.java
+32
-2
No files found.
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Mapper/Components_Class/UzyTavInstProyMapper.java
View file @
d5eb27e4
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Mapper
.
Components_Class
;
import
ec.edu.espe.movilidad.MovilidadWS.Dto.DtoUzyTavInstProy
;
import
ec.edu.espe.movilidad.MovilidadWS.Model.ModelUzyTavInstProy
;
import
ec.edu.espe.movilidad.MovilidadWS.Model.ModelUzyTavParametros_Det
;
import
org.modelmapper.ModelMapper
;
import
org.modelmapper.PropertyMap
;
import
org.springframework.stereotype.Component
;
import
javax.persistence.EntityManager
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -13,8 +17,12 @@ public class UzyTavInstProyMapper {
private
final
ModelMapper
mapper
;
public
UzyTavInstProyMapper
(
ModelMapper
mapper
)
{
private
final
EntityManager
entityManager
;
public
UzyTavInstProyMapper
(
ModelMapper
mapper
,
EntityManager
entityManager
)
{
this
.
mapper
=
mapper
;
this
.
entityManager
=
entityManager
;
configureMappings
();
}
public
DtoUzyTavInstProy
entityToDto
(
ModelUzyTavInstProy
entity
)
{
...
...
@@ -22,7 +30,18 @@ public class UzyTavInstProyMapper {
}
public
ModelUzyTavInstProy
dtoToEntity
(
DtoUzyTavInstProy
dto
)
{
return
mapper
.
map
(
dto
,
ModelUzyTavInstProy
.
class
);
ModelUzyTavInstProy
entity
=
mapper
.
map
(
dto
,
ModelUzyTavInstProy
.
class
);
Long
idEntidad
=
dto
.
getUzytparametros_det_id_entidad
();
Long
idOrganizacion
=
dto
.
getUzytparametros_det_id_organizacion
();
if
(
idEntidad
!=
null
)
{
ModelUzyTavParametros_Det
parametrosDetEntidad
=
entityManager
.
find
(
ModelUzyTavParametros_Det
.
class
,
idEntidad
);
entity
.
setUzytparametrosDetIdEntidad
(
parametrosDetEntidad
);
}
if
(
idOrganizacion
!=
null
)
{
ModelUzyTavParametros_Det
parametrosDetOrganizacion
=
entityManager
.
find
(
ModelUzyTavParametros_Det
.
class
,
idOrganizacion
);
entity
.
setUzytparametrosDetIdOrganizacion
(
parametrosDetOrganizacion
);
}
return
entity
;
}
public
List
<
DtoUzyTavInstProy
>
entitiesToDtos
(
List
<
ModelUzyTavInstProy
>
entities
)
{
...
...
@@ -30,4 +49,15 @@ public class UzyTavInstProyMapper {
.
map
(
this
::
entityToDto
)
.
collect
(
Collectors
.
toList
());
}
private
void
configureMappings
()
{
mapper
.
addMappings
(
new
PropertyMap
<
ModelUzyTavInstProy
,
DtoUzyTavInstProy
>()
{
@Override
protected
void
configure
()
{
map
().
setUzytparametros_det_id_organizacion
(
source
.
getUzytparametrosDetIdOrganizacion
().
getUzytparametros_det_id
());
map
().
setUzytparametros_det_id_entidad
(
source
.
getUzytparametrosDetIdEntidad
().
getUzytparametros_det_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