List of usage examples for com.mongodb BasicDBList BasicDBList
BasicDBList
From source file:org.opentestsystem.delivery.AccValidator.handlers.ValidationHandler.java
License:Open Source License
/** * @param resourceFamilies//from w w w . j a v a 2 s . c o m */ public void storeResourceFamiliesIntoDB(List<ResourceFamily> resourceFamilies) throws StoringException { DB database = getMongoDBConnection(); DBCollection collection = database.getCollection("resourceFamily"); collection.drop(); String name = null; String language = null; String label = null; String message = null; String description = null; String code = null; Integer order = null; String defaultSelection = null; String resourceType = null; Boolean mutuallyExclusive; Boolean disabled; for (ResourceFamily rf : resourceFamilies) { BasicDBObject resourceFamily = new BasicDBObject(); BasicDBList subjects = new BasicDBList(); List<AccFamilySubject> accFamilySubjects = rf.getSubject(); for (int i = 0; i < accFamilySubjects.size(); i++) { BasicDBObject subject = new BasicDBObject(); AccFamilySubject sub = accFamilySubjects.get(i); code = sub.getCode(); if (code != null) subject.append("code", code); name = sub.getName(); if (name != null) subject.append("name", name); subjects.add(subject); } BasicDBList grade = new BasicDBList(); List<String> dbGrades = rf.getGrade(); for (int j = 0; j < dbGrades.size(); j++) { grade.add(dbGrades.get(j).toString()); } List<MasterResourceAccommodation> accommodations = rf.getMasterResourceAccommodation(); BasicDBList masterResourceAccommodation = new BasicDBList(); for (int k = 0; k < accommodations.size(); k++) { MasterResourceAccommodation mracc = accommodations.get(k); BasicDBObject accommodation = new BasicDBObject(); BasicDBObject header = new BasicDBObject(); BasicDBList headersList = new BasicDBList(); BasicDBList options = new BasicDBList(); List<AccommodationText> headerTexts = mracc.getHeader(); if (headerTexts != null) { for (AccommodationText headerText : headerTexts) { if (headerText != null) { language = headerText.getLanguage(); if (language != null) header.append("language", language); label = headerText.getLabel(); if (label != null) header.append("label", label); message = headerText.getMessage(); if (message != null) header.append("message", message); description = headerText.getDescription(); if (description != null) header.append("description", description); headersList.add(header); } } } code = mracc.getCode(); if (code != null) accommodation.append("code", code); order = mracc.getOrder(); if (order != 0) accommodation.append("order", order); defaultSelection = mracc.getDefaultSelection(); if (defaultSelection != null) accommodation.append("defaultSelection", defaultSelection); if (header.size() > 0) accommodation.append("header", headersList); resourceType = mracc.getResourceType(); if (mracc.getResourceType() != null) accommodation.append("resourceType", resourceType); disabled = mracc.isDisabled(); if (mracc.isDisabled() != false) { accommodation.append("disabled", disabled); } List<AccommodationOption> accOptions = mracc.getOptions(); for (int i = 0; i < accOptions.size(); i++) { AccommodationOption accOption = accOptions.get(i); if (accOption != null) { BasicDBObject option = new BasicDBObject(); code = accOption.getCode(); if (code != null) option.append("code", code); order = accOption.getOrder(); if (order != null && Integer.valueOf(order) != 0) option.append("order", order); mutuallyExclusive = accOption.isMutuallyExclusive(); if (mutuallyExclusive != false) option.append("mutuallyExclusive", mutuallyExclusive); BasicDBList textList = new BasicDBList(); List<AccommodationText> accTexts = accOption.getText(); if (accTexts != null) { for (AccommodationText accText : accTexts) { if (accText != null) { BasicDBObject text = new BasicDBObject(); language = accText.getLanguage(); if (language != null) text.append("language", language); label = accText.getLabel(); if (label != null) text.append("label", label); description = accText.getDescription(); if (description != null) text.append("description", description); message = accText.getMessage(); if (message != null) text.append("message", message); textList.add(text); } if (textList.size() > 0) option.append("text", textList); } } if (option.size() > 0) options.add(option); } } if (options.size() > 0) accommodation.append("options", options); if (accommodation.size() > 0) masterResourceAccommodation.add(accommodation); } resourceFamily.append("subject", subjects); resourceFamily.append("grade", grade); resourceFamily.append("masterResourceAccommodation", masterResourceAccommodation); collection.insert(resourceFamily); } }
From source file:org.opentestsystem.delivery.AccValidator.handlers.ValidationHandler.java
License:Open Source License
/** * @param masterResourceAccommodations//from w ww . ja va 2s .co m */ public void storeMasterResourceAccommodationIntoDB( List<MasterResourceAccommodation> masterResourceAccommodations) throws StoringException { String language = null; String label = null; String message = null; String description = null; String code = null; Integer order = null; String defaultSelection = null; String resourceType = null; Boolean mutuallyExclusive; try { DB database = getMongoDBConnection(); DBCollection collection = database.getCollection("masterResourceAccommodation"); collection.drop(); for (MasterResourceAccommodation mracc : masterResourceAccommodations) { BasicDBObject accommodation = new BasicDBObject(); BasicDBList headers = new BasicDBList(); BasicDBObject header = new BasicDBObject(); BasicDBList options = new BasicDBList(); List<AccommodationText> headerTexts = mracc.getHeader(); if (headerTexts != null) { for (AccommodationText headerText : headerTexts) { language = headerText.getLanguage(); if (language != null) header.append("language", language); label = headerText.getLabel(); if (label != null) header.append("label", label); message = headerText.getMessage(); if (message != null) header.append("message", message); description = headerText.getDescription(); if (description != null) header.append("description", description); headers.add(header); } } code = mracc.getCode(); if (code != null) accommodation.append("code", code); order = mracc.getOrder(); if (order != null && Integer.valueOf(order) != 0) accommodation.append("order", order); defaultSelection = mracc.getDefaultSelection(); if (defaultSelection != null) accommodation.append("defaultSelection", defaultSelection); accommodation.append("header", headers); resourceType = mracc.getResourceType(); if (mracc.getResourceType() != null) accommodation.append("resourceType", resourceType); List<AccommodationOption> accOptions = mracc.getOptions(); for (int i = 0; i < accOptions.size(); i++) { AccommodationOption accOption = accOptions.get(i); BasicDBObject option = new BasicDBObject(); code = accOption.getCode(); if (code != null) option.append("code", code); order = accOption.getOrder(); if (order != null) option.append("order", order); mutuallyExclusive = accOption.isMutuallyExclusive(); if (mutuallyExclusive != false) option.append("mutuallyExclusive", mutuallyExclusive); List<AccommodationText> accTexts = accOption.getText(); if (accTexts != null) { BasicDBList textList = new BasicDBList(); for (AccommodationText accText : accTexts) { BasicDBObject text = new BasicDBObject(); language = accText.getLanguage(); if (language != null) text.append("language", language); label = accText.getLabel(); if (label != null) text.append("label", label); description = accText.getDescription(); if (description != null) text.append("description", description); message = accText.getMessage(); if (message != null) text.append("message", message); textList.add(text); } if (textList.size() > 0) option.append("text", textList); } if (option.size() > 0) options.add(option); } if (options.size() > 0) accommodation.append("options", options); if (accommodation != null) collection.insert(accommodation); } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.ossmeter.metricprovider.historic.bugs.bugs.model.BugsBugsHistoricMetric.java
License:Open Source License
public BugsBugsHistoricMetric() { super();//from w w w. j a va 2 s . c o m dbObject.put("bugTrackers", new BasicDBList()); NUMBEROFBUGS.setOwningType("org.ossmeter.metricprovider.historic.bugs.bugs.model.BugsBugsHistoricMetric"); AVERAGECOMMENTSPERBUG .setOwningType("org.ossmeter.metricprovider.historic.bugs.bugs.model.BugsBugsHistoricMetric"); AVERAGEREQUESTSPERBUG .setOwningType("org.ossmeter.metricprovider.historic.bugs.bugs.model.BugsBugsHistoricMetric"); AVERAGEREPLIESPERBUG .setOwningType("org.ossmeter.metricprovider.historic.bugs.bugs.model.BugsBugsHistoricMetric"); AVERAGECOMMENTSPERUSER .setOwningType("org.ossmeter.metricprovider.historic.bugs.bugs.model.BugsBugsHistoricMetric"); AVERAGEREQUESTSPERUSER .setOwningType("org.ossmeter.metricprovider.historic.bugs.bugs.model.BugsBugsHistoricMetric"); AVERAGEREPLIESPERUSER .setOwningType("org.ossmeter.metricprovider.historic.bugs.bugs.model.BugsBugsHistoricMetric"); }
From source file:org.ossmeter.metricprovider.historic.bugs.comments.model.BugsCommentsHistoricMetric.java
License:Open Source License
public BugsCommentsHistoricMetric() { super();// www . j ava 2s .c o m dbObject.put("bugs", new BasicDBList()); NUMBEROFCOMMENTS.setOwningType( "org.ossmeter.metricprovider.historic.bugs.comments.model.BugsCommentsHistoricMetric"); CUMULATIVENUMBEROFCOMMENTS.setOwningType( "org.ossmeter.metricprovider.historic.bugs.comments.model.BugsCommentsHistoricMetric"); }
From source file:org.ossmeter.metricprovider.historic.bugs.emotions.model.BugsEmotionsHistoricMetric.java
License:Open Source License
public BugsEmotionsHistoricMetric() { super();/* w w w. j ava2s.com*/ dbObject.put("bugData", new BasicDBList()); dbObject.put("dimensions", new BasicDBList()); }
From source file:org.ossmeter.metricprovider.historic.bugs.newbugs.model.BugsNewBugsHistoricMetric.java
License:Open Source License
public BugsNewBugsHistoricMetric() { super();/*from w ww . j a v a 2s . c o m*/ dbObject.put("bugs", new BasicDBList()); NUMBEROFBUGS .setOwningType("org.ossmeter.metricprovider.historic.bugs.newbugs.model.BugsNewBugsHistoricMetric"); CUMULATIVENUMBEROFBUGS .setOwningType("org.ossmeter.metricprovider.historic.bugs.newbugs.model.BugsNewBugsHistoricMetric"); }
From source file:org.ossmeter.metricprovider.historic.bugs.newusers.model.BugsNewUsersHistoricMetric.java
License:Open Source License
public BugsNewUsersHistoricMetric() { super();/*w w w. ja v a2s. c o m*/ dbObject.put("bugTrackers", new BasicDBList()); NUMBEROFNEWUSERS.setOwningType( "org.ossmeter.metricprovider.historic.bugs.newusers.model.BugsNewUsersHistoricMetric"); CUMULATIVENUMBEROFNEWUSERS.setOwningType( "org.ossmeter.metricprovider.historic.bugs.newusers.model.BugsNewUsersHistoricMetric"); }
From source file:org.ossmeter.metricprovider.historic.bugs.patches.model.BugsPatchesHistoricMetric.java
License:Open Source License
public BugsPatchesHistoricMetric() { super();//from w ww.j a v a 2 s .com dbObject.put("bugs", new BasicDBList()); NUMBEROFPATCHES .setOwningType("org.ossmeter.metricprovider.historic.bugs.patches.model.BugsPatchesHistoricMetric"); CUMULATIVENUMBEROFPATCHES .setOwningType("org.ossmeter.metricprovider.historic.bugs.patches.model.BugsPatchesHistoricMetric"); }
From source file:org.ossmeter.metricprovider.historic.bugs.requestsreplies.model.BugsRequestsRepliesHistoricMetric.java
License:Open Source License
public BugsRequestsRepliesHistoricMetric() { super();//from w w w . j av a2s. com dbObject.put("bugs", new BasicDBList()); NUMBEROFREQUESTS.setOwningType( "org.ossmeter.metricprovider.historic.bugs.requestsreplies.model.BugsRequestsRepliesHistoricMetric"); NUMBEROFREPLIES.setOwningType( "org.ossmeter.metricprovider.historic.bugs.requestsreplies.model.BugsRequestsRepliesHistoricMetric"); CUMULATIVENUMBEROFREQUESTS.setOwningType( "org.ossmeter.metricprovider.historic.bugs.requestsreplies.model.BugsRequestsRepliesHistoricMetric"); CUMULATIVENUMBEROFREPLIES.setOwningType( "org.ossmeter.metricprovider.historic.bugs.requestsreplies.model.BugsRequestsRepliesHistoricMetric"); }
From source file:org.ossmeter.metricprovider.historic.bugs.severity.model.BugsSeveritiesHistoricMetric.java
License:Open Source License
public BugsSeveritiesHistoricMetric() { super();/*w ww .ja v a 2 s . co m*/ dbObject.put("bugData", new BasicDBList()); dbObject.put("severityLevels", new BasicDBList()); }