use of com.furyviewer.domain.Social in project FuryViewer by TheDoctor-95.
the class SocialResourceIntTest method updateSocial.
@Test
@Transactional
public void updateSocial() throws Exception {
// Initialize the database
socialRepository.saveAndFlush(social);
int databaseSizeBeforeUpdate = socialRepository.findAll().size();
// Update the social
Social updatedSocial = socialRepository.findOne(social.getId());
updatedSocial.url(UPDATED_URL).type(UPDATED_TYPE);
restSocialMockMvc.perform(put("/api/socials").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedSocial))).andExpect(status().isOk());
// Validate the Social in the database
List<Social> socialList = socialRepository.findAll();
assertThat(socialList).hasSize(databaseSizeBeforeUpdate);
Social testSocial = socialList.get(socialList.size() - 1);
assertThat(testSocial.getUrl()).isEqualTo(UPDATED_URL);
assertThat(testSocial.getType()).isEqualTo(UPDATED_TYPE);
}
use of com.furyviewer.domain.Social in project FuryViewer by TheDoctor-95.
the class MarksService method markTransformationSeries.
/**
* Convierte la informacion de los votos de paginas externas proporcionados por la api al formato FuryViewer.
* @param ratings List | Lista con as diferentes votaciones proporcionadas por la api.
* @param ss Series | Series de la cual se quiere guardar las votaciones.
*/
public void markTransformationSeries(List<Rating> ratings, Series ss) {
for (Rating r : ratings) {
Optional<Social> seriesOptional = socialRepository.findBySeriesAndType(ss, r.getSource());
if (!seriesOptional.isPresent()) {
Social s = new Social();
s.setType(r.getSource());
if (s.getType().equalsIgnoreCase("internet movie database")) {
s.setType("IMDB");
}
s.setSeries(ss);
s.setUrl(markTranformation(r.getSource(), r.getValue()));
socialRepository.save(s);
}
}
}
use of com.furyviewer.domain.Social in project FuryViewer by TheDoctor-95.
the class MarksService method markTransformationMovie.
/**
* Convierte la informacion de los votos de paginas externas proporcionados por la api al formato FuryViewer.
* @param ratings List | Lista con as diferentes votaciones proporcionadas por la api.
* @param m Movie | Movie de la cual se quiere guardar las votaciones.
*/
public void markTransformationMovie(List<Rating> ratings, Movie m) {
for (Rating r : ratings) {
Optional<Social> movieOptional = socialRepository.findByMovieAndType(m, r.getSource());
if (!movieOptional.isPresent()) {
Social s = new Social();
s.setMovie(m);
s.setType(r.getSource());
s.setUrl(markTranformation(r.getSource(), r.getValue()));
socialRepository.save(s);
}
}
}
use of com.furyviewer.domain.Social in project FuryViewer by TheDoctor-95.
the class SocialResource method createSocial.
/**
* POST /socials : Create a new social.
*
* @param social the social to create
* @return the ResponseEntity with status 201 (Created) and with body the new social, or with status 400 (Bad Request) if the social has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/socials")
@Timed
public ResponseEntity<Social> createSocial(@RequestBody Social social) throws URISyntaxException {
log.debug("REST request to save Social : {}", social);
if (social.getId() != null) {
throw new BadRequestAlertException("A new social cannot already have an ID", ENTITY_NAME, "idexists");
}
Social result = socialRepository.save(social);
return ResponseEntity.created(new URI("/api/socials/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
use of com.furyviewer.domain.Social in project FuryViewer by TheDoctor-95.
the class SocialResourceIntTest method equalsVerifier.
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(Social.class);
Social social1 = new Social();
social1.setId(1L);
Social social2 = new Social();
social2.setId(social1.getId());
assertThat(social1).isEqualTo(social2);
social2.setId(2L);
assertThat(social1).isNotEqualTo(social2);
social1.setId(null);
assertThat(social1).isNotEqualTo(social2);
}
Aggregations