@Override public void alterarTemplate(Template templateAtualizado) throws ColetorMongoException { Template templateTemp = null; try { templateTemp = this.buscarPorId(templateAtualizado.getId()); mongoOperations.save(templateAtualizado); } catch (Exception e) { mongoOperations.save(templateTemp); throw new ColetorMongoException(e); } }
/** {@link RepositoryOperations#update} */ public <S extends T> S update(S s) { if (exists(s.getId())) { mongoOperations.save(s); return s; } return null; }
@Override public void rollback(Change change) { OperationType operationType = change.getOperationType(); try { switch (operationType) { case CREATE: { Object targetObject = change.getNewObject(); Query removeQuery = createFindQuery(targetObject); Object removedObject = mongoOperations.findOne(removeQuery, targetObject.getClass()); if (removedObject != null) { mongoOperations.remove(removedObject); } break; } case UPDATE: case DELETE: { mongoOperations.save(change.getOldObject()); break; } } } catch (Exception exc) { exc.printStackTrace(); } }
@Override public void inserirTemplate(Template template) throws ColetorMongoException { try { mongoOperations.save(template); } catch (Exception e) { mongoOperations.remove(template); throw new ColetorMongoException(e); } }
@Override public void createUser(UserDetails userDetails) { if (!userExists(userDetails.getUsername())) { String password = userDetails.getPassword(); String hashedPassword = PasswordEncoderGenerator.generateHashedPassword(password); User user = (User) userDetails; user.setPassword(hashedPassword); mongoOperations.save((User) userDetails); } }
public void createUserWithoutHashingPassword(UserDetails userDetails) { if (!userExists(userDetails.getUsername())) { mongoOperations.save((User) userDetails); } }
public boolean editCreditTransaction(CreditTransaction transaction) throws UnknownHostException { transactionMongoOps.save(transaction); return true; }
public void save(InterviewDetails interview) { mongoOperation.save(interview); }
@Override public void create(Season season) { mongoOperation.save(season); }
public void saveComment(Comment comment) { operations.save(comment); }
public void saveArticle(Article article) { operations.save(article); }
public boolean addArticle(Article article) { operations.save(article); return true; }
@Override public void enregistrerCompte(Compte compte) { mongoOperations.save(compte); }
/* (non-Javadoc) * @see de.mq.portfolio.exchangerate.support.ExchangeRateDatebaseRepository#save(de.mq.portfolio.exchangerate.ExchangeRate) */ @Override public final void save(final ExchangeRate exchangeRate) { mongoOperations.save(exchangeRate); }
@Override public void save(User entity) { mongoOperations.save(entity); }