• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ComplexKey类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中org.ektorp.ComplexKey的典型用法代码示例。如果您正苦于以下问题:Java ComplexKey类的具体用法?Java ComplexKey怎么用?Java ComplexKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ComplexKey类属于org.ektorp包,在下文中一共展示了ComplexKey类的38个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: findByAppIdBetween

点赞 3

import org.ektorp.ComplexKey; //导入依赖的package包/类
public List<AppInstanceMetrics> findByAppIdBetween(String appId, long startTimestamp, long endTimestamp)
		throws Exception {

	ComplexKey startKey = ComplexKey.of(appId, startTimestamp);
	ComplexKey endKey = ComplexKey.of(appId, endTimestamp);
	ViewQuery q = createQuery("by_appId_between").includeDocs(true).startKey(startKey).endKey(endKey);

	List<AppInstanceMetrics> returnvalue = null;
	String[] input = beforeConnection("QUERY", new String[] { "by_appId_between", appId,
			String.valueOf(startTimestamp), String.valueOf(endTimestamp) });
	try {
		returnvalue = db.queryView(q, AppInstanceMetrics.class);
	} catch (Exception e) {
		e.printStackTrace();
	}
	afterConnection(input);

	return returnvalue;
}
 

开发者ID:cfibmers,
项目名称:open-Autoscaler,
代码行数:20,
代码来源:AppInstanceMetricsDAOImpl.java

示例2: findByServiceIdBefore

点赞 3

import org.ektorp.ComplexKey; //导入依赖的package包/类
public List<AppInstanceMetrics> findByServiceIdBefore(String serviceId, long olderThan) throws Exception {
	ComplexKey startKey = ComplexKey.of(serviceId, 0);
	ComplexKey endKey = ComplexKey.of(serviceId, olderThan);
	ViewQuery q = createQuery("by_serviceId_before").includeDocs(true).startKey(startKey).endKey(endKey);

	List<AppInstanceMetrics> returnvalue = null;
	String[] input = beforeConnection("QUERY",
			new String[] { "by_serviceId_before", serviceId, String.valueOf(0), String.valueOf(olderThan) });
	try {
		returnvalue = db.queryView(q, AppInstanceMetrics.class);
	} catch (Exception e) {
		e.printStackTrace();
	}
	afterConnection(input);

	return returnvalue;
}
 

开发者ID:cfibmers,
项目名称:open-Autoscaler,
代码行数:18,
代码来源:AppInstanceMetricsDAOImpl.java

示例3: findByScalingTime

点赞 3

import org.ektorp.ComplexKey; //导入依赖的package包/类
public List<ScalingHistory> findByScalingTime(String appId, long startTime, long endTime) {
	ComplexKey startKey = ComplexKey.of(appId, endTime);
	ComplexKey endKey = ComplexKey.of(appId, startTime);
	ViewQuery q = createQuery("findByScalingTime").includeDocs(true).startKey(startKey).endKey(endKey)
			.descending(true);

	List<ScalingHistory> returnvalue = null;
	String[] input = beforeConnection("QUERY",
			new String[] { "findByScalingTime", appId, String.valueOf(startTime), String.valueOf(endTime) });
	try {
		returnvalue = db.queryView(q, ScalingHistory.class);
	} catch (Exception e) {
		e.printStackTrace();
	}
	afterConnection(input);

	return returnvalue;
}
 

开发者ID:cfibmers,
项目名称:open-Autoscaler,
代码行数:19,
代码来源:ScalingHistoryDAOImpl.java

示例4: findByContentIdPiRound

点赞 3

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public List<Answer> findByContentIdPiRound(final String contentId, final int piRound) {
	final String questionId = contentId;
	final ViewResult result = db.queryView(createQuery("by_questionid_piround_text_subject")
					.group(true)
					.startKey(ComplexKey.of(questionId, piRound))
					.endKey(ComplexKey.of(questionId, piRound, ComplexKey.emptyObject())));
	final int abstentionCount = countByContentId(questionId);

	final List<Answer> answers = new ArrayList<>();
	for (final ViewResult.Row d : result) {
		final Answer a = new Answer();
		a.setAnswerCount(d.getValueAsInt());
		a.setAbstentionCount(abstentionCount);
		a.setQuestionId(d.getKeyAsNode().get(0).asText());
		a.setPiRound(piRound);
		final JsonNode answerTextNode = d.getKeyAsNode().get(3);
		a.setAnswerText(answerTextNode.isNull() ? null : answerTextNode.asText());
		answers.add(a);
	}

	return answers;
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:24,
代码来源:CouchDbAnswerRepository.java

示例5: findByContentId

点赞 3

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public List<Answer> findByContentId(final String contentId) {
	final ViewResult result = db.queryView(createQuery("by_questionid_piround_text_subject")
			.group(true)
			.startKey(ComplexKey.of(contentId))
			.endKey(ComplexKey.of(contentId, ComplexKey.emptyObject())));
	final int abstentionCount = countByContentId(contentId);

	final List<Answer> answers = new ArrayList<>();
	for (final ViewResult.Row d : result.getRows()) {
		final Answer a = new Answer();
		a.setAnswerCount(d.getValueAsInt());
		a.setAbstentionCount(abstentionCount);
		a.setQuestionId(d.getKeyAsNode().get(0).asText());
		final JsonNode answerTextNode = d.getKeyAsNode().get(3);
		final JsonNode answerSubjectNode = d.getKeyAsNode().get(4);
		final boolean successfulFreeTextAnswer = d.getKeyAsNode().get(5).asBoolean();
		a.setAnswerText(answerTextNode.isNull() ? null : answerTextNode.asText());
		a.setAnswerSubject(answerSubjectNode.isNull() ? null : answerSubjectNode.asText());
		a.setSuccessfulFreeTextAnswer(successfulFreeTextAnswer);
		answers.add(a);
	}

	return answers;
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:26,
代码来源:CouchDbAnswerRepository.java

示例6: findBySessionId

点赞 3

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
	public List<Comment> findBySessionId(final String sessionId, final int start, final int limit) {
		final int qSkip = start > 0 ? start : -1;
		final int qLimit = limit > 0 ? limit : -1;

		final List<Comment> comments = db.queryView(createQuery("by_sessionid_timestamp")
						.skip(qSkip)
						.limit(qLimit)
						.descending(true)
						.startKey(ComplexKey.of(sessionId, ComplexKey.emptyObject()))
						.endKey(ComplexKey.of(sessionId))
						.includeDocs(true),
				Comment.class);
//		for (Comment comment : comments) {
//			comment.setSessionId(session.getKeyword());
//		}

		return comments;
	}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:20,
代码来源:CouchDbCommentRepository.java

示例7: findBySessionIdAndUser

点赞 3

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
	public List<Comment> findBySessionIdAndUser(final String sessionId, final User user, final int start, final int limit) {
		final int qSkip = start > 0 ? start : -1;
		final int qLimit = limit > 0 ? limit : -1;

		final List<Comment> comments = db.queryView(createQuery("by_sessionid_creator_timestamp")
						.skip(qSkip)
						.limit(qLimit)
						.descending(true)
						.startKey(ComplexKey.of(sessionId, user.getUsername(), ComplexKey.emptyObject()))
						.endKey(ComplexKey.of(sessionId, user.getUsername()))
						.includeDocs(true),
				Comment.class);
//		for (Comment comment : comments) {
//			comment.setSessionId(session.getKeyword());
//		}

		return comments;
	}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:20,
代码来源:CouchDbCommentRepository.java

示例8: deleteBySessionId

点赞 3

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public int deleteBySessionId(final String sessionId) {
	final ViewResult result = db.queryView(createQuery("by_sessionid_variant_active")
			.startKey(ComplexKey.of(sessionId))
			.endKey(ComplexKey.of(sessionId, ComplexKey.emptyObject()))
			.reduce(false));

	final List<BulkDeleteDocument> deleteDocs = new ArrayList<>();
	for (final ViewResult.Row a : result.getRows()) {
		final BulkDeleteDocument d = new BulkDeleteDocument(a.getId(), a.getValueAsNode().get("_rev").asText());
		deleteDocs.add(d);
	}
	List<DocumentOperationResult> errors = db.executeBulk(deleteDocs);

	return deleteDocs.size() - errors.size();
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:17,
代码来源:CouchDbContentRepository.java

示例9: findBySessionIdAndVariantAndActive

点赞 3

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public List<Content> findBySessionIdAndVariantAndActive(final Object... keys) {
	final Object[] endKeys = Arrays.copyOf(keys, keys.length + 1);
	endKeys[keys.length] = ComplexKey.emptyObject();
	final List<Content> contents = db.queryView(createQuery("by_sessionid_variant_active")
					.includeDocs(true)
					.reduce(false)
					.startKey(ComplexKey.of(keys))
					.endKey(ComplexKey.of(endKeys)),
			Content.class);
	for (final Content content : contents) {
		content.updateRoundManagementState();
		//content.setSessionKeyword(session.getKeyword());
	}

	return contents;
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:18,
代码来源:CouchDbContentRepository.java

示例10: getExits

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
/**
 * @param coord Position of the site in the map
 * @return Exits for the room located at (x,y) in the map
 * @throws JsonProcessingException
 */
protected Exits getExits(Coordinates coord) {
    // Query for the neighbors of this node. Use "A" to "Z" to capture the
    // directional index (N/S/E/W/U/D), but skip this node (" "), as we have
    // that already.
    ViewQuery getNeighbors = new ViewQuery()
            .designDocId(DESIGN_DOC)
            .viewName("neighbors")
            .reduce(false) // do not reduce the result
            .includeDocs(true) // include referenced documents
            .startKey(ComplexKey.of(coord.getX(), coord.getY(), "A"))
            .endKey(ComplexKey.of(coord.getX(), coord.getY(), "Z"));

    ViewResult result = db.queryView(getNeighbors);
    Log.mapOperations(Level.FINEST, this, "Found neighbors: {0}", result);

    Exits exits = new Exits();

    for(ViewResult.Row row : result.getRows() ) {
        JsonNode key = row.getKeyAsNode();
        String direction = key.get(2).asText(); // [0, 1, "n"]

        try {
            Site targetSite = mapper.treeToValue(row.getDocAsNode(), Site.class);
            assignExit(exits, direction, targetSite);
        } catch (JsonProcessingException e) {
            // Disagreement between our model class and what is in the data store :(
            Log.log(Level.SEVERE, this, "Unable to assign exit for {0} due to exception {1}", key, e);
            Log.log(Level.SEVERE, this, "Exception reading value from database", e);
        }
    }

    return exits;
}
 

开发者ID:gameontext,
项目名称:gameon-map,
代码行数:39,
代码来源:SiteDocuments.java

示例11: queryView

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
  public List<T> queryView (String viewName, ComplexKey key) {

String[] input = beforeConnection("QUERY",  new String[]{viewName, key.toJson().toString()});
List<T> returnvalue = null;
  	try {
  		returnvalue = super.queryView(viewName, key);
} catch (Exception e){
	logger.error(e.getMessage());
}

  	afterConnection(input);
  	return returnvalue;
  }
 

开发者ID:cfibmers,
项目名称:open-Autoscaler,
代码行数:15,
代码来源:TypedCouchDbRepositorySupport.java

示例12: findByServerNameSegmentSeq

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
public MetricDBSegment findByServerNameSegmentSeq(String serverName, int seq) {
	ComplexKey key = ComplexKey.of(serverName, seq);
	List<MetricDBSegment> dbSegmentList = queryView("by_serverName_segmentSeq", key);
	if (dbSegmentList.size() > 0)
		return dbSegmentList.get(0);
	else
		return null;
}
 

开发者ID:cfibmers,
项目名称:open-Autoscaler,
代码行数:9,
代码来源:MetricDBSegmentDAOImpl.java

示例13: findByAppId

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
public BoundApp findByAppId(String appId) throws Exception {
	List<BoundApp> apps = queryView("by_appId", ComplexKey.of(appId));
	if (apps == null || apps.size() == 0) {
		return null;
	}
	return apps.get(0);
}
 

开发者ID:cfibmers,
项目名称:open-Autoscaler,
代码行数:8,
代码来源:BoundAppDAOImpl.java

示例14: findDuplicateByAppId

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
public List<BoundApp> findDuplicateByAppId(String appId) {
	if (appId == null)
		return null;
	List<BoundApp> apps = queryView("by_appId", ComplexKey.of(appId));
	if (apps == null || apps.size() == 0) {
		return null;
	}
	return apps;
}
 

开发者ID:cfibmers,
项目名称:open-Autoscaler,
代码行数:10,
代码来源:BoundAppDAOImpl.java

示例15: getLastIndexed

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
public static StatementDocument getLastIndexed(CouchDbConnector connector) {
	String nowDateStr = MapQuery.date2String(new Date());

	ViewQuery query = new ViewQuery()
			.viewName(VerbRegistrationQuery.VIEWNAME)
			.designDocId("_design/statements")
			. startKey(ComplexKey.of("ALL", null, null, nowDateStr))
			.limit(1).staleOk(true).descending(true).inclusiveEnd(true)
			.includeDocs(true);

	List<StatementDocument> qResult = connector.queryView(query,
			StatementDocument.class);
	return qResult.size() > 0 ? qResult.get(0) : null;
}
 

开发者ID:Apereo-Learning-Analytics-Initiative,
项目名称:Larissa,
代码行数:15,
代码来源:Util.java

示例16: getStartKey

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
protected Object getStartKey(StatementFilter filter) {
	String since = date2String(filter.getSince());
	IFI agentIFI = filter.getAgent() == null ? null : filter.getAgent()
			.getIdentifier();
	return ComplexKey.of("ALL", getRelatedNumber(filter), agentIFI,
			filter.getActivity(), filter.getVerb(),
			filter.getRegistration(), since);
}
 

开发者ID:Apereo-Learning-Analytics-Initiative,
项目名称:Larissa,
代码行数:10,
代码来源:AgentActivityQuery.java

示例17: getEndKey

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
protected Object getEndKey(StatementFilter filter) {
	Object until = date2String(filter.getUntil());
	if (until == null) {
		until = ComplexKey.emptyObject();
	}
	IFI agentIFI = filter.getAgent() == null ? null : filter.getAgent()
			.getIdentifier();
	return ComplexKey.of("ALL", getRelatedNumber(filter), agentIFI,
			filter.getActivity(), filter.getVerb(),
			filter.getRegistration(), until);
}
 

开发者ID:Apereo-Learning-Analytics-Initiative,
项目名称:Larissa,
代码行数:13,
代码来源:AgentActivityQuery.java

示例18: getEndKey

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
protected Object getEndKey(StatementFilter filter) {
	Object until = date2String(filter.getUntil());
	if (until == null) {
		until = ComplexKey.emptyObject();
	}
	return ComplexKey.of("ALL", filter.getVerb(), filter.getRegistration(),
			until);
}
 

开发者ID:Apereo-Learning-Analytics-Initiative,
项目名称:Larissa,
代码行数:10,
代码来源:VerbRegistrationQuery.java

示例19: if

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@View(name = "by_triggerkey", map = "function(doc) { if (doc.type === 'CouchDbTrigger') emit([doc.trigger_name, doc.trigger_group], doc._id); }")
public List<CouchDbTrigger> getTriggersByKeys(List<TriggerKey> triggerKeys) throws JobPersistenceException {
    List<ComplexKey> keys = new ArrayList<ComplexKey>();
    for (TriggerKey triggerKey : triggerKeys) {
        keys.add(ComplexKey.of(triggerKey.getName(), triggerKey.getGroup()));
    }
    return db.queryView(createQuery("by_triggerkey").includeDocs(true).keys(keys), type);
}
 

开发者ID:motech,
项目名称:quartz-couchdb-store,
代码行数:9,
代码来源:CouchDbTriggerStore.java

示例20: if

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@View(name = "by_jobkey", map = "function(doc) { if (doc.type === 'CouchDbJobDetail') emit([doc.name, doc.group], doc._id); }")
public List<CouchDbJobDetail> getJobs(List<JobKey> jobKeys) {
    List<ComplexKey> keys = new ArrayList<ComplexKey>();
    for (JobKey jobKey : jobKeys) {
        keys.add(ComplexKey.of(jobKey.getName(), jobKey.getGroup()));
    }
    return db.queryView(createQuery("by_jobkey").includeDocs(true).keys(keys), type);
}
 

开发者ID:motech,
项目名称:quartz-couchdb-store,
代码行数:9,
代码来源:CouchDbJobStore.java

示例21: findByUsername

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public List<Session> findByUsername(final String username, final int start, final int limit) {
	final int qSkip = start > 0 ? start : -1;
	final int qLimit = limit > 0 ? limit : -1;

	/* TODO: Only load IDs and check against cache for data. */
	return db.queryView(
			createQuery("partial_by_sessiontype_creator_name")
					.skip(qSkip)
					.limit(qLimit)
					.startKey(ComplexKey.of(null, username))
					.endKey(ComplexKey.of(null, username, ComplexKey.emptyObject()))
					.includeDocs(true),
			Session.class);
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:16,
代码来源:CouchDbSessionRepository.java

示例22: findForPublicPoolByUser

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public List<Session> findForPublicPoolByUser(final User user) {
	/* TODO: Only load IDs and check against cache for data. */
	return db.queryView(
			createQuery("partial_by_sessiontype_creator_name")
					.startKey(ComplexKey.of("public_pool", user.getUsername()))
					.endKey(ComplexKey.of("public_pool", user.getUsername(), ComplexKey.emptyObject()))
					.includeDocs(true),
			Session.class);
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:11,
代码来源:CouchDbSessionRepository.java

示例23: getInfosForSessions

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
private List<SessionInfo> getInfosForSessions(final List<Session> sessions) {
	final List<String> sessionIds = sessions.stream().map(Session::getId).collect(Collectors.toList());
	final ViewQuery questionCountView = createQuery("by_sessionid").designDocId("_design/Content")
			.group(true).keys(sessionIds);
	final ViewQuery answerCountView = createQuery("by_sessionid").designDocId("_design/Answer")
			.group(true).keys(sessionIds);
	final ViewQuery commentCountView = createQuery("by_sessionid").designDocId("_design/Comment")
			.group(true).keys(sessionIds);
	final ViewQuery unreadCommentCountView = createQuery("by_sessionid_read").designDocId("_design/Comment")
			.group(true).keys(sessions.stream().map(session -> ComplexKey.of(session.getId(), false)).collect(Collectors.toList()));

	return getSessionInfoData(sessions, questionCountView, answerCountView, commentCountView, unreadCommentCountView);
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:14,
代码来源:CouchDbSessionRepository.java

示例24: getInfosForVisitedSessions

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
private List<SessionInfo> getInfosForVisitedSessions(final List<Session> sessions, final User user) {
	final ViewQuery answeredQuestionsView = createQuery("by_user_sessionid").designDocId("_design/Answer")
			.keys(sessions.stream().map(session -> ComplexKey.of(user.getUsername(), session.getId())).collect(Collectors.toList()));
	final ViewQuery contentIdsView = createQuery("by_sessionid").designDocId("_design/Content")
			.keys(sessions.stream().map(Session::getId).collect(Collectors.toList()));

	return getVisitedSessionInfoData(sessions, answeredQuestionsView, contentIdsView);
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:9,
代码来源:CouchDbSessionRepository.java

示例25: countByContentId

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public int countByContentId(final String contentId) {
	final ViewResult result = db.queryView(createQuery("by_questionid_piround_text_subject")
			.reduce(true)
			.startKey(ComplexKey.of(contentId))
			.endKey(ComplexKey.of(contentId, ComplexKey.emptyObject())));

	return result.isEmpty() ? 0 : result.getRows().get(0).getValueAsInt();
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:10,
代码来源:CouchDbAnswerRepository.java

示例26: countByContentIdRound

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public int countByContentIdRound(final String contentId, final int round) {
	final ViewResult result = db.queryView(createQuery("by_questionid_piround_text_subject")
			.reduce(true)
			.startKey(ComplexKey.of(contentId, round))
			.endKey(ComplexKey.of(contentId, round, ComplexKey.emptyObject())));

	return result.isEmpty() ? 0 : result.getRows().get(0).getValueAsInt();
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:10,
代码来源:CouchDbAnswerRepository.java

示例27: countReadingBySessionId

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public CommentReadingCount countReadingBySessionId(final String sessionId) {
	final ViewResult result = db.queryView(createQuery("by_sessionid_read")
			.startKey(ComplexKey.of(sessionId))
			.endKey(ComplexKey.of(sessionId, ComplexKey.emptyObject()))
			.reduce(true)
			.group(true));
	return calculateReadingCount(result);
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:10,
代码来源:CouchDbCommentRepository.java

示例28: countReadingBySessionIdAndUser

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public CommentReadingCount countReadingBySessionIdAndUser(final String sessionId, final User user) {
	final ViewResult result = db.queryView(createQuery("by_sessionid_creator_read")
			.startKey(ComplexKey.of(sessionId, user.getUsername()))
			.endKey(ComplexKey.of(sessionId, user.getUsername(), ComplexKey.emptyObject()))
			.reduce(true)
			.group(true));
	return calculateReadingCount(result);
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:10,
代码来源:CouchDbCommentRepository.java

示例29: deleteBySessionIdAndUser

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public int deleteBySessionIdAndUser(final String sessionId, final User user) {
	final ViewResult result = db.queryView(createQuery("by_sessionid_creator_read")
			.startKey(ComplexKey.of(sessionId, user.getUsername()))
			.endKey(ComplexKey.of(sessionId, user.getUsername(), ComplexKey.emptyObject())));

	return delete(result);
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:9,
代码来源:CouchDbCommentRepository.java

示例30: countBySessionId

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public int countBySessionId(final String sessionId) {
	final ViewResult result = db.queryView(createQuery("by_sessionid_variant_active")
			.startKey(ComplexKey.of(sessionId))
			.endKey(ComplexKey.of(sessionId, ComplexKey.emptyObject())));

	return result.getSize();
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:9,
代码来源:CouchDbContentRepository.java

示例31: findUnansweredIdsBySessionIdAndUser

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public List<String> findUnansweredIdsBySessionIdAndUser(final String sessionId, final User user) {
	final ViewResult result = db.queryView(createQuery("questionid_by_user_sessionid_variant")
			.designDocId("_design/Answer")
			.startKey(ComplexKey.of(user.getUsername(), sessionId))
			.endKey(ComplexKey.of(user.getUsername(), sessionId, ComplexKey.emptyObject())));
	final List<String> answeredIds = new ArrayList<>();
	for (final ViewResult.Row row : result.getRows()) {
		answeredIds.add(row.getId());
	}
	return collectUnansweredQuestionIds(findIdsBySessionId(sessionId), answeredIds);
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:13,
代码来源:CouchDbContentRepository.java

示例32: findUnansweredIdsBySessionIdAndUserOnlyLectureVariant

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public List<String> findUnansweredIdsBySessionIdAndUserOnlyLectureVariant(final String sessionId, final User user) {
	final ViewResult result = db.queryView(createQuery("questionid_piround_by_user_sessionid_variant")
			.designDocId("_design/Answer")
			.key(ComplexKey.of(user.getUsername(), sessionId, "lecture")));
	final Map<String, Integer> answeredQuestions = new HashMap<>();
	for (final ViewResult.Row row : result.getRows()) {
		answeredQuestions.put(row.getId(), row.getKeyAsNode().get(2).asInt());
	}

	return collectUnansweredQuestionIdsByPiRound(findBySessionIdOnlyLectureVariantAndActive(sessionId), answeredQuestions);
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:13,
代码来源:CouchDbContentRepository.java

示例33: findUnansweredIdsBySessionIdAndUserOnlyPreparationVariant

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public List<String> findUnansweredIdsBySessionIdAndUserOnlyPreparationVariant(final String sessionId, final User user) {
	final ViewResult result = db.queryView(createQuery("questionid_piround_by_user_sessionid_variant")
			.designDocId("_design/Answer")
			.key(ComplexKey.of(user.getUsername(), sessionId, "preparation")));
	final Map<String, Integer> answeredQuestions = new HashMap<>();
	for (final ViewResult.Row row : result.getRows()) {
		answeredQuestions.put(row.getId(), row.getKeyAsNode().get(2).asInt());
	}

	return collectUnansweredQuestionIdsByPiRound(findBySessionIdOnlyPreparationVariantAndActive(sessionId), answeredQuestions);
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:13,
代码来源:CouchDbContentRepository.java

示例34: countLectureVariantBySessionId

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public int countLectureVariantBySessionId(final String sessionId) {
	/* TODO: reduce code duplication */
	final ViewResult result = db.queryView(createQuery("by_sessionid_variant_active")
			.startKey(ComplexKey.of(sessionId, "lecture"))
			.endKey(ComplexKey.of(sessionId, "lecture", ComplexKey.emptyObject())));

	return result.isEmpty() ? 0 : result.getRows().get(0).getValueAsInt();
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:10,
代码来源:CouchDbContentRepository.java

示例35: countFlashcardVariantBySessionId

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public int countFlashcardVariantBySessionId(final String sessionId) {
	/* TODO: reduce code duplication */
	final ViewResult result = db.queryView(createQuery("by_sessionid_variant_active")
			.startKey(ComplexKey.of(sessionId, "flashcard"))
			.endKey(ComplexKey.of(sessionId, "flashcard", ComplexKey.emptyObject())));

	return result.isEmpty() ? 0 : result.getRows().get(0).getValueAsInt();
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:10,
代码来源:CouchDbContentRepository.java

示例36: countPreparationVariantBySessionId

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public int countPreparationVariantBySessionId(final String sessionId) {
	/* TODO: reduce code duplication */
	final ViewResult result = db.queryView(createQuery("by_sessionid_variant_active")
			.startKey(ComplexKey.of(sessionId, "preparation"))
			.endKey(ComplexKey.of(sessionId, "preparation", ComplexKey.emptyObject())));

	return result.isEmpty() ? 0 : result.getRows().get(0).getValueAsInt();
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:10,
代码来源:CouchDbContentRepository.java

示例37: findIdsBySessionIdAndVariantAndSubject

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public List<String> findIdsBySessionIdAndVariantAndSubject(final String sessionId, final String questionVariant, final String subject) {
	final ViewResult result = db.queryView(createQuery("by_sessionid_variant_active")
			.startKey(ComplexKey.of(sessionId, questionVariant, 1, subject))
			.endKey(ComplexKey.of(sessionId, questionVariant, 1, subject, ComplexKey.emptyObject())));

	final List<String> qids = new ArrayList<>();

	for (final ViewResult.Row row : result.getRows()) {
		final String s = row.getId();
		qids.add(s);
	}

	return qids;
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:16,
代码来源:CouchDbContentRepository.java

示例38: findSubjectsBySessionIdAndVariant

点赞 2

import org.ektorp.ComplexKey; //导入依赖的package包/类
@Override
public List<String> findSubjectsBySessionIdAndVariant(final String sessionId, final String questionVariant) {
	final ViewResult result = db.queryView(createQuery("by_sessionid_variant_active")
			.startKey(ComplexKey.of(sessionId, questionVariant))
			.endKey(ComplexKey.of(sessionId, questionVariant, ComplexKey.emptyObject())));

	final Set<String> uniqueSubjects = new HashSet<>();

	for (final ViewResult.Row row : result.getRows()) {
		uniqueSubjects.add(row.getKeyAsNode().get(3).asText());
	}

	return new ArrayList<>(uniqueSubjects);
}
 

开发者ID:thm-projects,
项目名称:arsnova-backend,
代码行数:15,
代码来源:CouchDbContentRepository.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)