service.impl/src/main/java/com/hack23/cia/service/impl/rules/RulesEngineImpl.java
private static void insertParty(final KieSession ksession, final ViewRiksdagenPartySummary partyData,
			final List<ViewRiksdagenVoteDataBallotPartySummaryAnnual> dailyList,
			final List<ViewRiksdagenVoteDataBallotPartySummaryMonthly> monthlyList,
			final List<ViewRiksdagenVoteDataBallotPartySummaryDaily> annualList,
			final List<ViewRiksdagenCommitteeBallotDecisionPartySummary> ballotDecisions) {
		if (partyData.isActiveParliament() && dailyList != null && monthlyList != null && annualList != null) {
			Collections.sort(dailyList,
					(e1, e2) -> e1.getEmbeddedId().getVoteDate().compareTo(e2.getEmbeddedId().getVoteDate()));
			final Optional<ViewRiksdagenVoteDataBallotPartySummaryAnnual> dailyListFirst = dailyList.stream()
					.findFirst();
			Collections.sort(monthlyList,
					(e1, e2) -> e1.getEmbeddedId().getVoteDate().compareTo(e2.getEmbeddedId().getVoteDate()));
			final Optional<ViewRiksdagenVoteDataBallotPartySummaryMonthly> monthlyListFirst = monthlyList.stream()
					.findFirst();
			Collections.sort(annualList,
					(e1, e2) -> e1.getEmbeddedId().getVoteDate().compareTo(e2.getEmbeddedId().getVoteDate()));
			final Optional<ViewRiksdagenVoteDataBallotPartySummaryDaily> annualListFirst = annualList.stream()
					.findFirst();

			if (annualListFirst.isPresent() && monthlyListFirst.isPresent() && dailyListFirst.isPresent()) {
				final PartyComplianceCheckImpl politicianComplianceCheckImpl = new PartyComplianceCheckImpl(partyData,
						dailyListFirst.get(), monthlyListFirst.get(), annualListFirst.get(), ballotDecisions);
				ksession.insert(politicianComplianceCheckImpl);
			}
		} else {
			final PartyComplianceCheckImpl politicianComplianceCheckImpl = new PartyComplianceCheckImpl(partyData, null,
					null, null, new ArrayList<>());
			ksession.insert(politicianComplianceCheckImpl);
		}
	}
private static void insertParty(final KieSession ksession, final ViewRiksdagenPartySummary partyData,
			final List<ViewRiksdagenVoteDataBallotPartySummaryAnnual> dailyList,
			final List<ViewRiksdagenVoteDataBallotPartySummaryMonthly> monthlyList,
			final List<ViewRiksdagenVoteDataBallotPartySummaryDaily> annualList,
			final List<ViewRiksdagenCommitteeBallotDecisionPartySummary> ballotDecisions) {
		if (partyData.isActiveParliament() && dailyList != null && monthlyList != null && annualList != null) {
			Collections.sort(dailyList,
					(e1, e2) -> e1.getEmbeddedId().getVoteDate().compareTo(e2.getEmbeddedId().getVoteDate()));
			final Optional<ViewRiksdagenVoteDataBallotPartySummaryAnnual> dailyListFirst = dailyList.stream()
					.findFirst();
			Collections.sort(monthlyList,
					(e1, e2) -> e1.getEmbeddedId().getVoteDate().compareTo(e2.getEmbeddedId().getVoteDate()));
			final Optional<ViewRiksdagenVoteDataBallotPartySummaryMonthly> monthlyListFirst = monthlyList.stream()
					.findFirst();
			Collections.sort(annualList,
					(e1, e2) -> e1.getEmbeddedId().getVoteDate().compareTo(e2.getEmbeddedId().getVoteDate()));
			final Optional<ViewRiksdagenVoteDataBallotPartySummaryDaily> annualListFirst = annualList.stream()
					.findFirst();

			if (annualListFirst.isPresent() && monthlyListFirst.isPresent() && dailyListFirst.isPresent()) {
				final PartyComplianceCheckImpl politicianComplianceCheckImpl = new PartyComplianceCheckImpl(partyData,
						dailyListFirst.get(), monthlyListFirst.get(), annualListFirst.get(), ballotDecisions);
				ksession.insert(politicianComplianceCheckImpl);
			}
		} else {
			final PartyComplianceCheckImpl politicianComplianceCheckImpl = new PartyComplianceCheckImpl(partyData, null,
					null, null, new ArrayList<>());
			ksession.insert(politicianComplianceCheckImpl);
		}
	}
private static void insertParty ( final KieSession ksession , final ViewRiksdagenPartySummary partyData , final List < ViewRiksdagenVoteDataBallotPartySummaryAnnual > dailyList , final List < ViewRiksdagenVoteDataBallotPartySummaryMonthly > monthlyList , final List < ViewRiksdagenVoteDataBallotPartySummaryDaily > annualList , final List < ViewRiksdagenCommitteeBallotDecisionPartySummary > ballotDecisions ) { if ( partyData . isActiveParliament ( ) && dailyList != null && monthlyList != null && annualList != null ) { Collections . sort ( dailyList , ( e1 , e2 ) -> e1 . getEmbeddedId ( ) . getVoteDate ( ) . compareTo ( e2 . getEmbeddedId ( ) . getVoteDate ( ) ) ) ; final Optional < ViewRiksdagenVoteDataBallotPartySummaryAnnual > dailyListFirst = dailyList . stream ( ) . findFirst ( ) ; Collections . sort ( monthlyList , ( e1 , e2 ) -> e1 . getEmbeddedId ( ) . getVoteDate ( ) . compareTo ( e2 . getEmbeddedId ( ) . getVoteDate ( ) ) ) ; final Optional < ViewRiksdagenVoteDataBallotPartySummaryMonthly > monthlyListFirst = monthlyList . stream ( ) . findFirst ( ) ; Collections . sort ( annualList , ( e1 , e2 ) -> e1 . getEmbeddedId ( ) . getVoteDate ( ) . compareTo ( e2 . getEmbeddedId ( ) . getVoteDate ( ) ) ) ; final Optional < ViewRiksdagenVoteDataBallotPartySummaryDaily > annualListFirst = annualList . stream ( ) . findFirst ( ) ; if ( annualListFirst . isPresent ( ) && monthlyListFirst . isPresent ( ) && dailyListFirst . isPresent ( ) ) { final PartyComplianceCheckImpl politicianComplianceCheckImpl = new PartyComplianceCheckImpl ( partyData , dailyListFirst . get ( ) , monthlyListFirst . get ( ) , annualListFirst . get ( ) , ballotDecisions ) ; ksession . insert ( politicianComplianceCheckImpl ) ; } } else { final PartyComplianceCheckImpl politicianComplianceCheckImpl = new PartyComplianceCheckImpl ( partyData , null , null , null , new ArrayList <> ( ) ) ; ksession . insert ( politicianComplianceCheckImpl ) ; } }
Insert party.

@param ksession        the ksession
@param partyData       the party data
@param dailyList       the daily list
@param monthlyList     the monthly list
@param annualList      the annual list
@param ballotDecisions the ballot decisions
Insert party .