use of py.org.fundacionparaguaya.pspserver.security.entities.TermCondPolEntity in project FP-PSP-SERVER by FundacionParaguaya.
the class SnapshotEconomicMapper method newSnapshotToEconomicEntity.
public SnapshotEconomicEntity newSnapshotToEconomicEntity(NewSnapshot snapshot, SnapshotIndicatorEntity indicator) {
UserEntity user = null;
TermCondPolEntity termCond = null;
TermCondPolEntity privPol = null;
if (snapshot.getUserName() != null) {
user = userRepository.findOneByUsername(snapshot.getUserName()).get();
}
if (snapshot.getTermCondId() != null) {
termCond = termCondPolRepository.findOne(snapshot.getTermCondId());
}
if (snapshot.getPrivPolId() != null) {
privPol = termCondPolRepository.findOne(snapshot.getPrivPolId());
}
return new SnapshotEconomicEntity().surveyDefinition(new SurveyEntity(snapshot.getSurveyId())).surveyIndicator(indicator).staticProperties(snapshot.getMappedEconomicSurveyData(propertyAttributeSupport.staticEconomic(), propertyAttributeSupport::propertySchemaToSystemName)).additionalProperties(snapshot.getEconomicSurveyData(propertyAttributeSupport.additional())).user(user).termCond(termCond).privPol(privPol);
}
use of py.org.fundacionparaguaya.pspserver.security.entities.TermCondPolEntity in project FP-PSP-SERVER by FundacionParaguaya.
the class TermCondPolServiceImpl method saveTerms.
@Override
public TermCondPolDTO saveTerms(MultipartFile htmlFile, TermCondPolDTO termCondPolDTO) {
try {
String htmlContent = new String(htmlFile.getBytes(), "UTF-8");
TermCondPolEntity entity = mapper.dtoToEntity(termCondPolDTO);
entity.setHtml(htmlContent);
return mapper.entityToDto(repository.save(entity));
} catch (IOException e) {
throw new InternalServerErrorException(e);
}
}
Aggregations