List of usage examples for com.mongodb BasicDBObjectBuilder start
public static BasicDBObjectBuilder start()
From source file:ezbake.services.centralPurge.helpers.EzCentralPurgeServiceHelpers.java
License:Apache License
public static DBObject encodePurgeInitiationResult(PurgeInitiationResult purgeInitiationResult) { BasicDBList basicDBList = new BasicDBList(); for (String uri : purgeInitiationResult.getUrisNotFound()) { BasicDBObject dbURI = new BasicDBObject(); dbURI.append(URI, uri);//w ww.j a v a 2 s .c om basicDBList.add(dbURI); } DBObject setToBePurged = encodeURISet(purgeInitiationResult.getToBePurged()); BasicDBObjectBuilder purgeInitiationResultBuilder = BasicDBObjectBuilder.start() .add(PurgeId, purgeInitiationResult.getPurgeId()).add(ToBePurged, setToBePurged) .add(URIsNotFoundSet, basicDBList); return purgeInitiationResultBuilder.get(); }
From source file:ezbake.services.centralPurge.helpers.EzCentralPurgeServiceHelpers.java
License:Apache License
public static DBObject encodePurgeState(PurgeState purgeState) { BasicDBObjectBuilder purgeStateBuilder = BasicDBObjectBuilder.start().add(PurgeId, purgeState.getPurgeId()) .add(ApplicationPurgeStatus, purgeState.getPurgeStatus().getValue()) .add(Purged, encodeURISet(purgeState.getPurged())) .add(NotPurgedSet, encodeURISet(purgeState.getNotPurged())) .add(SuggestedPollPeriord, purgeState.getSuggestedPollPeriod()) .add(TimeStampString, encodeDateTime(purgeState.getTimeStamp())) .add(Cancel_Status, purgeState.getCancelStatus().getValue()); return purgeStateBuilder.get(); }
From source file:ezbake.services.centralPurge.helpers.EzCentralPurgeServiceHelpers.java
License:Apache License
public static DBObject encodeServicePurgeState(ServicePurgeState servicePurgeState) { BasicDBObjectBuilder servicePurgeStateBuilder = BasicDBObjectBuilder.start() .add(PurgeStateString, encodePurgeState(servicePurgeState.getPurgeState())) .add(TimeInitiated, encodeDateTime(servicePurgeState.getTimeInitiated())) .add(TimeLastPoll, encodeDateTime(servicePurgeState.getTimeLastPoll())); return servicePurgeStateBuilder.get(); }
From source file:ezbake.services.centralPurge.helpers.EzCentralPurgeServiceHelpers.java
License:Apache License
public static DBObject encodeAgeOffEventInfo(AgeOffEventInfo ageOffEventInfo) { BasicDBObjectBuilder ageOffEventInfoBuilder = BasicDBObjectBuilder.start() .add(User, ageOffEventInfo.getUser()) .add(CompletelyPurged, encodeURISet(ageOffEventInfo.getCompletelyPurgedSet())) .add(AgeOffEventId, ageOffEventInfo.getId()) .add(PurgeBitVector, encodeURISet(ageOffEventInfo.getPurgeSet())) .add(TimeCreated, encodeDateTime(ageOffEventInfo.getTimeCreated())) .add(Description, ageOffEventInfo.getDescription()).add(Resolved, ageOffEventInfo.isResolved()); return ageOffEventInfoBuilder.get(); }
From source file:ezbake.services.centralPurge.helpers.EzCentralPurgeServiceHelpers.java
License:Apache License
public static DBObject encodeCentralAgeOffEventState(CentralAgeOffEventState centralAgeOffEventState) { BasicDBObjectBuilder centralAgeOffEventStateBuilder = BasicDBObjectBuilder.start() .add(AgeOffEventInfoString, encodeAgeOffEventInfo(centralAgeOffEventState.getAgeOffEventInfo())) .add(AppStates, encodeApplicationStateMap(centralAgeOffEventState.getApplicationStates())) .add(CentralPurgeStatusString, centralAgeOffEventState.getCentralStatus().getValue()) .add(AgeOffRuleId, centralAgeOffEventState.getAgeOffRuleId()); return centralAgeOffEventStateBuilder.get(); }
From source file:ezbake.services.centralPurge.helpers.EzCentralPurgeServiceHelpers.java
License:Apache License
public static DBObject encodePurgeInfo(PurgeInfo purgeInfo) { BasicDBList basicDBListUris = new BasicDBList(); for (String uri : purgeInfo.getDocumentUris()) { BasicDBObject dbURI = new BasicDBObject(); dbURI.append(URI, uri);/*ww w. j a v a 2s . c o m*/ basicDBListUris.add(dbURI); } BasicDBList basicDBListUrisNotFound = new BasicDBList(); for (String uriNotFound : purgeInfo.getDocumentUrisNotFound()) { BasicDBObject dbURINotFound = new BasicDBObject(); dbURINotFound.append(URI, uriNotFound); basicDBListUris.add(dbURINotFound); } BasicDBObjectBuilder purgeInfoBuilder = BasicDBObjectBuilder.start().add(PurgeId, purgeInfo.getId()) .add(PurgeBitVector, encodeURISet(purgeInfo.getPurgeDocumentIds())) .add(Description, purgeInfo.getDescription()).add(PurgeName, purgeInfo.getName()) .add(User, purgeInfo.getUser()) .add(CompletelyPurged, encodeURISet(purgeInfo.getCompletelyPurgedDocumentIds())) .add(Resolved, purgeInfo.isResolved()).add(URIsFoundSet, basicDBListUris) .add(URIsNotFoundSet, basicDBListUrisNotFound) .add(TimeStampString, encodeDateTime(purgeInfo.getTimeStamp())); return purgeInfoBuilder.get(); }
From source file:ezbake.services.centralPurge.helpers.EzCentralPurgeServiceHelpers.java
License:Apache License
public static DBObject encodeCentralPurgeState(CentralPurgeState centralPurgeState) { BasicDBObjectBuilder centralPurgeStateBuilder = BasicDBObjectBuilder.start() .add(PurgeInfo, encodePurgeInfo(centralPurgeState.getPurgeInfo())) .add(AppStates, encodeApplicationStateMap(centralPurgeState.getApplicationStates())) .add(CentralPurgeStatusString, centralPurgeState.getCentralStatus().getValue()) .add(CentralPurgeTypeString, centralPurgeState.getCentralPurgeType().getValue()); return centralPurgeStateBuilder.get(); }
From source file:fr.ensimag.biblio.converter.UserConverter.java
public static DBObject toDBObject(User user) { BasicDBObjectBuilder builder = BasicDBObjectBuilder.start().append("lastName", user.getLastName()) .append("firstName", user.getFirstName()).append("login", user.getLogin()) .append("password", user.getPassword()).append("isMale", user.getIsMale()) .append("age", user.getAge()).append("town", user.getTown()); if (user.getId() != null) builder = builder.append("_id", new ObjectId(user.getId())); return builder.get(); }
From source file:fr.ensimag.biblio.dao.impl.MongoDBUserDAO.java
public void updateUser(User user) { DBObject query = BasicDBObjectBuilder.start().append("_id", new ObjectId(user.getId())).get(); this.col.update(query, UserConverter.toDBObject(user)); }
From source file:fr.ensimag.biblio.dao.impl.MongoDBUserDAO.java
public User readUser(User user) { DBObject query = BasicDBObjectBuilder.start().append("_id", new ObjectId(user.getId())).get(); DBObject data = this.col.findOne(query); return UserConverter.toUser(data); }