service.impl/src/main/java/com/hack23/cia/service/impl/rules/RulesEngineImpl.java
private void insertParties(final KieSession ksession, final List<ViewRiksdagenPartySummary> list) {
		final Map<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>> politicanBallotSummaryAnnualMap = dataViewer
				.getAll(ViewRiksdagenVoteDataBallotPartySummaryDaily.class).stream()
				.collect(Collectors.groupingBy(p -> p.getEmbeddedId().getParty()));
		final Map<String, List<ViewRiksdagenVoteDataBallotPartySummaryMonthly>> politicanBallotSummaryMontlyMap = dataViewer
				.getAll(ViewRiksdagenVoteDataBallotPartySummaryMonthly.class).stream()
				.collect(Collectors.groupingBy(p -> p.getEmbeddedId().getParty()));
		final Map<String, List<ViewRiksdagenVoteDataBallotPartySummaryAnnual>> politicanBallotSummaryDailyMap = dataViewer
				.getAll(ViewRiksdagenVoteDataBallotPartySummaryAnnual.class).stream()
				.collect(Collectors.groupingBy(p -> p.getEmbeddedId().getParty()));

		final Map<String, List<ViewRiksdagenCommitteeBallotDecisionPartySummary>> decisionMap = dataViewer
				.findListByProperty(ViewRiksdagenCommitteeBallotDecisionPartySummary.class,
						new String[] { "2007/08", "FöU15" }, ViewRiksdagenCommitteeBallotDecisionPartySummary_.rm,
						ViewRiksdagenCommitteeBallotDecisionPartySummary_.committeeReport)
				.stream().collect(Collectors.groupingBy(p -> p.getEmbeddedId().getParty()));

		for (final ViewRiksdagenPartySummary partyData : list) {
			if (partyData != null) {

				List<ViewRiksdagenCommitteeBallotDecisionPartySummary> ballotDecisions = decisionMap
						.get(partyData.getParty());
				if (ballotDecisions == null) {
					ballotDecisions = new ArrayList<>();
				}

				insertParty(ksession, partyData, politicanBallotSummaryDailyMap.get(partyData.getParty()),
						politicanBallotSummaryMontlyMap.get(partyData.getParty()),
						politicanBallotSummaryAnnualMap.get(partyData.getParty()), ballotDecisions);
			}
		}
	}
private void insertParties(final KieSession ksession, final List<ViewRiksdagenPartySummary> list) {
		final Map<String, List<ViewRiksdagenVoteDataBallotPartySummaryDaily>> politicanBallotSummaryAnnualMap = dataViewer
				.getAll(ViewRiksdagenVoteDataBallotPartySummaryDaily.class).stream()
				.collect(Collectors.groupingBy(p -> p.getEmbeddedId().getParty()));
		final Map<String, List<ViewRiksdagenVoteDataBallotPartySummaryMonthly>> politicanBallotSummaryMontlyMap = dataViewer
				.getAll(ViewRiksdagenVoteDataBallotPartySummaryMonthly.class).stream()
				.collect(Collectors.groupingBy(p -> p.getEmbeddedId().getParty()));
		final Map<String, List<ViewRiksdagenVoteDataBallotPartySummaryAnnual>> politicanBallotSummaryDailyMap = dataViewer
				.getAll(ViewRiksdagenVoteDataBallotPartySummaryAnnual.class).stream()
				.collect(Collectors.groupingBy(p -> p.getEmbeddedId().getParty()));

		final Map<String, List<ViewRiksdagenCommitteeBallotDecisionPartySummary>> decisionMap = dataViewer
				.findListByProperty(ViewRiksdagenCommitteeBallotDecisionPartySummary.class,
						new String[] { "2007/08", "FöU15" }, ViewRiksdagenCommitteeBallotDecisionPartySummary_.rm,
						ViewRiksdagenCommitteeBallotDecisionPartySummary_.committeeReport)
				.stream().collect(Collectors.groupingBy(p -> p.getEmbeddedId().getParty()));

		for (final ViewRiksdagenPartySummary partyData : list) {
			if (partyData != null) {

				List<ViewRiksdagenCommitteeBallotDecisionPartySummary> ballotDecisions = decisionMap
						.get(partyData.getParty());
				if (ballotDecisions == null) {
					ballotDecisions = new ArrayList<>();
				}

				insertParty(ksession, partyData, politicanBallotSummaryDailyMap.get(partyData.getParty()),
						politicanBallotSummaryMontlyMap.get(partyData.getParty()),
						politicanBallotSummaryAnnualMap.get(partyData.getParty()), ballotDecisions);
			}
		}
	}
Insert parties.

@param ksession the ksession
@param list     the list