List of usage examples for org.springframework.data.mongodb.core.query Update set
public Update set(String key, Object value)
From source file:quanlyhocvu.api.mongodb.DAO.LopHocDAO.java
public boolean update(LopHocDTO dto) { boolean res = true; Query query = Query.query(Criteria.where("id").is(dto.getid())); Update update = new Update(); update.set("giaoVien", dto.getgiaoVien()); update.set("khoiLop", dto.getkhoiLop()); update.set("namHoc", dto.getnamHoc()); update.set("moTa", dto.getmoTa()); update.set("listHocSinh", dto.getlistHocSinh()); mongoOperation.findAndModify(query, update, LopHocDTO.class); return res;//from w ww . ja va 2 s .c o m }
From source file:app.data.local.CollectionBindingRepositoryImpl.java
@Override public void updateTags(long colId, @Nullable List<String> tags) { Query query = new Query(); query.addCriteria(Criteria.where("collectionId").is(colId)); Update update = new Update(); update.set("tags", tags); mMongoTemplate.upsert(query, update, CollectionBinding.class); }
From source file:net.cit.tetrad.dao.management.impl.IndexDaoImpl.java
/** * idx ? ? +1/*from ww w .j ava 2 s.c om*/ * @throws Exception */ public int createIdx(String tablenm) throws Exception { Index idto = new Index(); Query query = new Query(); query = setCollection(tablenm);//collecionname idto = (Index) monadService.getFind(query, Index.class);//collectionname? Device? idx int idx = 0; if (idto == null) { //index collection? ? ?? idto = new Index(); idto.setIdx(1); idto.setCollectionnm(tablenm); monadService.add(idto, Index.class); idx = 1;// ?? idx 1 ? } else { //index? idx update Update update = new Update(); // update.inc("idx",1); idx = idto.getIdx() + 1; update.set("idx", idx); monadService.update(query, update, Index.class); } return idx; }
From source file:quanlyhocvu.api.mongodb.DAO.DiemDAO.java
public boolean update(DiemDTO dto) { Query query = Query.query(Criteria.where("id").is(dto.getid())); Update update = new Update(); update.set("hocSinh", dto.getHocSinh().getid()); update.set("chiTietMonHoc", dto.getChiTietMonHoc()); update.set("listDiemKTMieng", dto.getListDiemKTMieng()); update.set("listDiemKT15", dto.getListDiemKT15()); update.set("listDiemKT1Tiet", dto.getListDiemKT1Tiet()); update.set("diemGiuaKy", dto.getDiemGiuaKy()); update.set("diemCuoiKy", dto.getDiemCuoiKy()); update.set("diemTB", dto.getDiemTB()); mongoOperation.findAndModify(query, update, DiemDTO.class); return true;/* w w w .java 2 s .co m*/ }
From source file:com.card.loop.xyz.dao.LearningObjectDAO.java
public boolean assignReviewer(String id, String reviewer) throws UnknownHostException { boolean ok = false; Update assigner = new Update(); assigner.set("rev", reviewer); mongoOps.findAndModify(query(where("id").is(id)), assigner, LearningObject.class); ok = true;/*from ww w . java2 s .co m*/ return ok; }
From source file:quanlyhocvu.api.mongodb.DAO.AuthorityDAO.java
/** * update user by current user/*from ww w. j av a 2s. com*/ * @param user */ public void updateUser(UserDTO user) { Query query = Query.query(Criteria.where("username").is(user.getUsername())); Update update = new Update(); update.set("enabled", user.isEnabled()); update.set("nonlocked", user.isNonlocked()); if (user.getRoles().size() > 0) { update.set("roles", user.getRoles()); } if (!"".equals(user.getPassword())) { update.set("password", MD5.getMD5(user.getPassword())); } mongoOperation.findAndModify(query, update, UserDTO.class); }
From source file:com.epam.ta.reportportal.database.dao.ProjectRepositoryCustomImpl.java
@Override public void addUsers(String projectId, Map<String, UserConfig> users) { Query query = Query.query(Criteria.where("_id").is(projectId)); Update update = new Update(); // TODO possible bug, only one update! for (Map.Entry<String, UserConfig> entry : users.entrySet()) { update.set("users." + entry.getKey(), entry.getValue()); }//from w w w . ja v a 2 s .co m mongoTemplate.updateFirst(query, update, Project.class); }
From source file:com.card.loop.xyz.dao.UserDAO.java
public boolean editUser(User user) throws UnknownHostException { boolean ok = false; if (user != null) { Update userUpdate = new Update(); if (user.getPassword() != null) { userUpdate.set("password", user.getPassword()); }/*from www.j a v a 2 s.co m*/ if (user.getEmail() != null) { userUpdate.set("email", user.getEmail()); } this.user.findAndModify(query(where("username").is(user.getUsername())), userUpdate, User.class); ok = true; } return ok; }
From source file:it.f2informatica.core.gateway.mongodb.ConsultantRepositoryGatewayMongoDB.java
private void mapAddressData(Update update, AddressModel address, String field) { update.set(field + ".street", address.getStreet()); update.set(field + ".houseNo", address.getHouseNo()); update.set(field + ".zipCode", address.getZipCode()); update.set(field + ".city", address.getCity()); update.set(field + ".province", address.getProvince()); update.set(field + ".region", address.getRegion()); update.set(field + ".country", address.getCountry()); }
From source file:com.card.loop.xyz.dao.LearningElementDAO.java
public boolean assignReviewer(String id, String reviewer) throws UnknownHostException { boolean ok = false; Update assigner = new Update(); assigner.set("rev", reviewer); mongoOps.findAndModify(query(where("id").is(id)), assigner, LearningElement.class); ok = true;//from w w w . ja v a 2s . c o m return ok; }