@Override
	public void createPagingControls(final AbstractOrderedLayout content, final String name, final String pageId, final Long size, final int pageNr,
			final int resultPerPage) {
				final HorizontalLayout pagingControls = new HorizontalLayout();
				pagingControls.setSpacing(true);
				pagingControls.setMargin(true);

				final long maxPages = (size +resultPerPage-1) / resultPerPage;

				final StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.append(PAGE_HEADER)
				.append(pageNr)
				.append(PAGE_SEPARATOR)
				.append(maxPages)
				.append(PAGES_TOTAL_RESULTS)
				.append(size)
				.append(RESULTS_PER_PAGE)
				.append(resultPerPage)
				.append(SHOW);
				final Label pageInfo = new Label(stringBuilder.toString());
				pagingControls.addComponent(pageInfo);
				pagingControls.setExpandRatio(pageInfo, ContentRatio.SMALL);

				if (pageNr > PAGE_ONE) {
					addPagingLink(PREVIOUS_PAGE,name, pageId, pageNr -1L,pagingControls);
				}

				if (maxPages > PAGE_ONE && pageNr < maxPages) {
					addPagingLink(NEXT_PAGE,name, pageId, pageNr +1L,pagingControls);
				}

				if (maxPages > LIMIT_FOR_DISPLAYING_START_END_LINKS && pageNr > PAGE_ONE) {
					addPagingLink(FIRST_PAGE,name, pageId, 1,pagingControls);
				}

				if (maxPages > LIMIT_FOR_DISPLAYING_START_END_LINKS && pageNr < maxPages) {
					addPagingLink(LAST_PAGE,name, pageId, maxPages,pagingControls);
				}

				content.addComponent(pagingControls);
				content.setExpandRatio(pagingControls, ContentRatio.SMALL2);

			}

@ Override public void createPagingControls ( final AbstractOrderedLayout content , final String name , final String pageId , final Long size , final int pageNr , final int resultPerPage ) { final HorizontalLayout pagingControls = new HorizontalLayout ( ) ; pagingControls . setSpacing ( true ) ; pagingControls . setMargin ( true ) ; final long maxPages = ( size + resultPerPage - 1 ) / resultPerPage ; final StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( PAGE_HEADER ) . append ( pageNr ) . append ( PAGE_SEPARATOR ) . append ( maxPages ) . append ( PAGES_TOTAL_RESULTS ) . append ( size ) . append ( RESULTS_PER_PAGE ) . append ( resultPerPage ) . append ( SHOW ) ; final Label pageInfo = new Label ( stringBuilder . toString ( ) ) ; pagingControls . addComponent ( pageInfo ) ; pagingControls . setExpandRatio ( pageInfo , ContentRatio . SMALL ) ; if ( pageNr > PAGE_ONE ) { addPagingLink ( PREVIOUS_PAGE , name , pageId , pageNr - 1L , pagingControls ) ; } if ( maxPages > PAGE_ONE && pageNr < maxPages ) { addPagingLink ( NEXT_PAGE , name , pageId , pageNr + 1L , pagingControls ) ; } if ( maxPages > LIMIT_FOR_DISPLAYING_START_END_LINKS && pageNr > PAGE_ONE ) { addPagingLink ( FIRST_PAGE , name , pageId , 1 , pagingControls ) ; } if ( maxPages > LIMIT_FOR_DISPLAYING_START_END_LINKS && pageNr < maxPages ) { addPagingLink ( LAST_PAGE , name , pageId , maxPages , pagingControls ) ; } content . addComponent ( pagingControls ) ; content . setExpandRatio ( pagingControls , ContentRatio . SMALL2 ) ; }

Creates the paging controls.

@param content       the content
@param name          the name
@param pageId        the page id
@param size          the size
@param pageNr        the page nr
@param resultPerPage the result per page


private void addPagingLink(final String label, final String name, final String pageId, final long maxPages, final HorizontalLayout pagingControls) {
		final Link previousPageLink = pageLinkFactory.createAdminPagingLink(label,name, pageId, String.valueOf(maxPages));
		pagingControls.addComponent(previousPageLink);
		pagingControls.setExpandRatio(previousPageLink, ContentRatio.SMALL);
	}

private void addPagingLink ( final String label , final String name , final String pageId , final long maxPages , final HorizontalLayout pagingControls ) { final Link previousPageLink = pageLinkFactory . createAdminPagingLink ( label , name , pageId , String . valueOf ( maxPages ) ) ; pagingControls . addComponent ( previousPageLink ) ; pagingControls . setExpandRatio ( previousPageLink , ContentRatio . SMALL ) ; }

Adds the paging link.

@param label          the label
@param name           the name
@param pageId         the page id
@param maxPages       the max pages
@param pagingControls the paging controls


private static void insertPolitician(final KieSession ksession, final ViewRiksdagenPolitician politicianData,
			final List<ViewRiksdagenVoteDataBallotPoliticianSummaryDaily> dailyList,
			final List<ViewRiksdagenVoteDataBallotPoliticianSummaryMonthly> monthlyList,
			final List<ViewRiksdagenVoteDataBallotPoliticianSummaryAnnual> annualList,
			final List<ViewRiksdagenCommitteeBallotDecisionPoliticianSummary> decisionList) {
		if (politicianData.isActiveParliament() && dailyList != null && monthlyList != null && annualList != null) {
			Collections.sort(dailyList,
					(e1, e2) -> e1.getEmbeddedId().getVoteDate().compareTo(e2.getEmbeddedId().getVoteDate()));
			final Optional<ViewRiksdagenVoteDataBallotPoliticianSummaryDaily> dailyListFirst = dailyList.stream()
					.findFirst();

			Collections.sort(monthlyList,
					(e1, e2) -> e1.getEmbeddedId().getVoteDate().compareTo(e2.getEmbeddedId().getVoteDate()));
			final Optional<ViewRiksdagenVoteDataBallotPoliticianSummaryMonthly> monthlyListFirst = monthlyList.stream()
					.findFirst();
			Collections.sort(annualList,
					(e1, e2) -> e1.getEmbeddedId().getVoteDate().compareTo(e2.getEmbeddedId().getVoteDate()));
			final Optional<ViewRiksdagenVoteDataBallotPoliticianSummaryAnnual> annualListFirst = annualList.stream()
					.findFirst();

			if (annualListFirst.isPresent() && monthlyListFirst.isPresent() && dailyListFirst.isPresent()) {
				final PoliticianComplianceCheckImpl politicianComplianceCheckImpl = new PoliticianComplianceCheckImpl(
						politicianData, dailyListFirst.get(), monthlyListFirst.get(), annualListFirst.get(),
						decisionList);
				ksession.insert(politicianComplianceCheckImpl);
			}
		} else {
			final PoliticianComplianceCheckImpl politicianComplianceCheckImpl = new PoliticianComplianceCheckImpl(
					politicianData, null, null, null, new ArrayList<>());
			ksession.insert(politicianComplianceCheckImpl);
		}
	}

Insert politician.

@param ksession       the ksession
@param politicianData the politician data
@param dailyList      the daily list
@param monthlyList    the monthly list
@param annualList     the annual list
@param decisionList   the decision list


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


@OneToMany(targetEntity = AgainstProposalData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "AGAINST_PROPOSAL_LIST_AGAINS_0")
    public List<AgainstProposalData> getAgainstProposalList() {
        return this.againstProposalList;
    }

@ OneToMany ( targetEntity = AgainstProposalData . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "AGAINST_PROPOSAL_LIST_AGAINS_0" ) public List < AgainstProposalData > getAgainstProposalList ( ) { return this . againstProposalList ; }

Gets the against proposal list.

@return the against proposal list


private static void addDataSerieValue(final DataSeries dataSeries, final Entry entry,
			final int value) {
		if (entry.getKey() != null && value > 0) {
			dataSeries.add(FIRST_OF_JAN + entry.getKey(), value);
		}
	}

private static void addDataSerieValue ( final DataSeries dataSeries , final Entry entry , final int value ) { if ( entry . getKey ( ) != null && value > 0 ) { dataSeries . add ( FIRST_OF_JAN + entry . getKey ( ) , value ) ; } }

Adds the data serie value.

@param dataSeries the data series
@param entry      the entry
@param value      the value


private void addAnnualSummary(final Map<String, List<GovernmentBodyAnnualOutcomeSummary>> report, final VerticalLayout content,
			final String label) {

		final DataSeries dataSeries = new DataSeries();
		final Series series = new Series();

		for (final Entry<String, List<GovernmentBodyAnnualOutcomeSummary>> entry : report.entrySet()) {

			final List<GovernmentBodyAnnualOutcomeSummary> allValues = entry.getValue();

			if (!allValues.isEmpty()) {
				addAnnualSummaryData(dataSeries, series, entry, allValues);
			}
		}

		addChart(content, label,
				new DCharts().setDataSeries(dataSeries)
						.setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(),
				true);
	}

Adds the annual summary.

@param report
the report
@param content
the content
@param label
the label


private static void addAnnualSummaryData(final DataSeries dataSeries, final Series series,
			final Entry<String, List<GovernmentBodyAnnualOutcomeSummary>> entry,
			final List<GovernmentBodyAnnualOutcomeSummary> allValues) {
		series.addSeries(new XYseries().setLabel(entry.getKey()).setShowLabel(true));
		dataSeries.newSeries();

		final Map<Integer, List<GovernmentBodyAnnualOutcomeSummary>> map = allValues.stream()
				.collect(Collectors.groupingBy(GovernmentBodyAnnualOutcomeSummary::getYear));

		for (final Entry<Integer, List<GovernmentBodyAnnualOutcomeSummary>> data : map.entrySet()) {
			final List<GovernmentBodyAnnualOutcomeSummary> values = data.getValue();
			final double sum = values.stream().mapToDouble(GovernmentBodyAnnualOutcomeSummary::getYearTotal).sum();
			if (sum > 0) {
				dataSeries.add(data.getKey() + FIRST_JAN_DATA_SUFFIX, (int) sum);
			}
		}
	}

private static void addAnnualSummaryData ( final DataSeries dataSeries , final Series series , final Entry < String , List < GovernmentBodyAnnualOutcomeSummary > > entry , final List < GovernmentBodyAnnualOutcomeSummary > allValues ) { series . addSeries ( new XYseries ( ) . setLabel ( entry . getKey ( ) ) . setShowLabel ( true ) ) ; dataSeries . newSeries ( ) ; final Map < Integer , List < GovernmentBodyAnnualOutcomeSummary > > map = allValues . stream ( ) . collect ( Collectors . groupingBy ( GovernmentBodyAnnualOutcomeSummary :: getYear ) ) ; for ( final Entry < Integer , List < GovernmentBodyAnnualOutcomeSummary > > data : map . entrySet ( ) ) { final List < GovernmentBodyAnnualOutcomeSummary > values = data . getValue ( ) ; final double sum = values . stream ( ) . mapToDouble ( GovernmentBodyAnnualOutcomeSummary :: getYearTotal ) . sum ( ) ; if ( sum > 0 ) { dataSeries . add ( data . getKey ( ) + FIRST_JAN_DATA_SUFFIX , ( int ) sum ) ; } } }

Adds the annual summary data.

@param dataSeries the data series
@param series     the series
@param entry      the entry
@param allValues  the all values


private void addAnnualData(final VerticalLayout content, final String name, final String label,
			final Map<String, List<GovernmentBodyAnnualOutcomeSummary>> collect) {
		final DataSeries dataSeries = new DataSeries();
		final Series series = new Series();

		final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd",Locale.ENGLISH);
		for (final Entry<String, List<GovernmentBodyAnnualOutcomeSummary>> entry : collect.entrySet()) {
			series.addSeries(new XYseries().setLabel(entry.getKey()));
			dataSeries.newSeries();

			addEntryData(dataSeries, simpleDateFormat, entry);
		}

		addChart(content, name + label,
				new DCharts().setDataSeries(dataSeries)
						.setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(),
				true);
	}

Adds the annual data.

@param content
the content
@param name
the name
@param label
the label
@param collect
the collect


private static void addEntryData(final DataSeries dataSeries, final SimpleDateFormat simpleDateFormat,
			final Entry<String, List<GovernmentBodyAnnualOutcomeSummary>> entry) {
		for (final GovernmentBodyAnnualOutcomeSummary data : entry.getValue()) {
			final Map<Date, Double> valueMap = data.getValueMap();

			for (final Entry<Date, Double> entryData : valueMap.entrySet()) {
				if (entryData.getValue() != null && entryData.getValue().intValue() > 0) {
					dataSeries.add(simpleDateFormat.format(entryData.getKey()) , entryData.getValue().intValue());
				}
			}
		}
	}

private static void addEntryData ( final DataSeries dataSeries , final SimpleDateFormat simpleDateFormat , final Entry < String , List < GovernmentBodyAnnualOutcomeSummary > > entry ) { for ( final GovernmentBodyAnnualOutcomeSummary data : entry . getValue ( ) ) { final Map < Date , Double > valueMap = data . getValueMap ( ) ; for ( final Entry < Date , Double > entryData : valueMap . entrySet ( ) ) { if ( entryData . getValue ( ) != null && entryData . getValue ( ) . intValue ( ) > 0 ) { dataSeries . add ( simpleDateFormat . format ( entryData . getKey ( ) ) , entryData . getValue ( ) . intValue ( ) ) ; } } } }

Adds the entry data.

@param dataSeries       the data series
@param simpleDateFormat the simple date format
@param entry            the entry


private void createMinistrySummary(final AbstractOrderedLayout content, final String field, final String label) {
		final DataSeries dataSeries = new DataSeries();
		final Series series = new Series();

		final Map<String, List<GovernmentBodyAnnualOutcomeSummary>> reportByMinistry = esvApi.getGovernmentBodyReportByMinistry();

		for (final Entry<String, List<GovernmentBodyAnnualOutcomeSummary>> entry : reportByMinistry.entrySet()) {
			series.addSeries(new XYseries().setLabel(entry.getKey()));
			dataSeries.newSeries();
			final Map<Integer, Double> annualSummaryMap = entry.getValue().stream().filter(t -> t.getDescriptionFields().get(field) != null).collect(Collectors.groupingBy(GovernmentBodyAnnualOutcomeSummary::getYear,Collectors.summingDouble(GovernmentBodyAnnualOutcomeSummary::getYearTotal)));

			for (final Entry<Integer, Double> entryData : annualSummaryMap.entrySet()) {
				if (entryData.getValue() != null && entryData.getValue().intValue() > 0) {
					dataSeries.add(entryData.getKey() +1  +"-01-01" , entryData.getValue());
				}
			}
		}

		addChart(content, label,
				new DCharts().setDataSeries(dataSeries)
						.setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(),
				true);
	}

Creates the ministry summary.

@param content the content
@param field   the field
@param label   the label


private void createRoleList(final VerticalLayout roleSummaryLayoutTabsheet,
			final List<AssignmentData> assignmentList) {

		final Comparator<AssignmentData> compare = (o1, o2) -> o1.getFromDate().compareTo(o2.getFromDate());

		Collections.sort(assignmentList, compare);

		getGridFactory().createBasicBeanItemGrid(roleSummaryLayoutTabsheet, AssignmentData.class, assignmentList,
				ASSIGNMENTS, COLUMN_ORDER, HIDE_COLUMNS, null, null, null);

	}

private void createRoleList ( final VerticalLayout roleSummaryLayoutTabsheet , final List < AssignmentData > assignmentList ) { final Comparator < AssignmentData > compare = ( o1 , o2 ) -> o1 . getFromDate ( ) . compareTo ( o2 . getFromDate ( ) ) ; Collections . sort ( assignmentList , compare ) ; getGridFactory ( ) . createBasicBeanItemGrid ( roleSummaryLayoutTabsheet , AssignmentData . class , assignmentList , ASSIGNMENTS , COLUMN_ORDER , HIDE_COLUMNS , null , null , null ) ; }

Creates the role list.

@param roleSummaryLayoutTabsheet the role summary layout tabsheet
@param assignmentList the assignment list


private static void processAll(final List<DocumentElement> dokument,
			final ProcessDataStrategy<DocumentElement> processStrategy) {
		for (final DocumentElement documentElement : dokument) {

			try {
				processStrategy.process(documentElement);
			} catch (final RuntimeException e) {
				LOGGER.warn(ERROR_PROCESSING_DOCUMENT, documentElement.getId(), e);
			}
		}
	}

private static void processAll ( final List < DocumentElement > dokument , final ProcessDataStrategy < DocumentElement > processStrategy ) { for ( final DocumentElement documentElement : dokument ) { try { processStrategy . process ( documentElement ) ; } catch ( final RuntimeException e ) { LOGGER . warn ( ERROR_PROCESSING_DOCUMENT , documentElement . getId ( ) , e ) ; } } }

Process all.

@param dokument
the dokument
@param processStrategy
the process strategy


private void loadAndProcessDocumentList(final String url,
			final ProcessDataStrategy<DocumentElement> processStrategy) throws XmlAgentException {
		final DocumentContainerElement dokumentLista = ((JAXBElement<DocumentContainerElement>) xmlAgent.unmarshallXml(
				riksdagenDocumentListMarshaller, url, HTTP_DOKUMENTLISTA_RIKSDAGEN_EXTERNAL_MODEL_CIA_HACK23_COM_IMPL,
				null, null)).getValue();

		int resultSize = dokumentLista.getDokument().size();
		processAll(dokumentLista.getDokument(), processStrategy);
		final BigInteger pages = dokumentLista.getTotalPages();
		for (int i = 1; i < pages.intValue(); i++) {
			final DocumentContainerElement otherPagesdokumentLista = ((JAXBElement<DocumentContainerElement>) xmlAgent
					.unmarshallXml(riksdagenDocumentListMarshaller, url + PAGE_PROPERTY + i,
							HTTP_DOKUMENTLISTA_RIKSDAGEN_EXTERNAL_MODEL_CIA_HACK23_COM_IMPL, null, null)).getValue();
			resultSize = resultSize + otherPagesdokumentLista.getDokument().size();
			processAll(otherPagesdokumentLista.getDokument(), processStrategy);
			LOGGER.info(LOADING_DOCUMENTS, resultSize, dokumentLista.getHits());
		}
	}

Load and process document list.

@param url
the url
@param processStrategy
the process strategy
@throws XmlAgentException
the xml agent exception


private List<DocumentElement> loadDocumentList(final String url, final int maxNumberPages) throws XmlAgentException {
		final List<DocumentElement> result = new ArrayList<>();

		DocumentContainerElement dokumentLista = ((JAXBElement<DocumentContainerElement>) xmlAgent.unmarshallXml(
				riksdagenDocumentListMarshaller, url, HTTP_DOKUMENTLISTA_RIKSDAGEN_EXTERNAL_MODEL_CIA_HACK23_COM_IMPL,
				null, null)).getValue();
		result.addAll(dokumentLista.getDokument());
		final BigInteger pages = dokumentLista.getTotalPages();
		for (int i = 1; i < pages.intValue() && i < maxNumberPages; i++) {
			dokumentLista = ((JAXBElement<DocumentContainerElement>) xmlAgent.unmarshallXml(
					riksdagenDocumentListMarshaller, fixBrokenUrl(dokumentLista.getNextPage()),
					HTTP_DOKUMENTLISTA_RIKSDAGEN_EXTERNAL_MODEL_CIA_HACK23_COM_IMPL, null, null)).getValue();
			result.addAll(dokumentLista.getDokument());
			LOGGER.info(LOADING_DOCUMENTS, result.size(), dokumentLista.getHits());
		}

		return result;
	}

Load document list.

@param url
the url
@param maxNumberPages
the max number pages
@return the list
@throws XmlAgentException
the xml agent exception


private static String readWithStringBuffer(final Reader fr) throws IOException {

		final BufferedReader br = new BufferedReader(fr);
		String line;
		final StringBuilder result = new StringBuilder();
		while ((line = br.readLine()) != null) {
			result.append(line);
		}

		return result.toString();
	}

private static String readWithStringBuffer ( final Reader fr ) throws IOException { final BufferedReader br = new BufferedReader ( fr ) ; String line ; final StringBuilder result = new StringBuilder ( ) ; while ( ( line = br . readLine ( ) ) != null ) { result . append ( line ) ; } return result . toString ( ) ; }

Read with string buffer.

@param fr
the fr
@return the string
@throws IOException
Signals that an I/O exception has occurred.


private static String readInputStream(final String accessUrl) throws IOException {
		final URL url = new URL(accessUrl.replace(" ", ""));
		return readWithStringBuffer(new BufferedReader(new InputStreamReader(url.openConnection().getInputStream(), StandardCharsets.UTF_8)));
	}

private
static
String
readInputStream
(
final
String
accessUrl
)
throws
IOException
{
final
URL
url
=
new
URL
(
accessUrl
.
replace
(
" "
,
""
)
)
;
return
readWithStringBuffer
(
new
BufferedReader
(
new
InputStreamReader
(
url
.
openConnection
(
)
.
getInputStream
(
)
,
StandardCharsets
.
UTF_8
)
)
)
;
}

Read input stream.

@param accessUrl
the access url
@return the string
@throws IOException
Signals that an I/O exception has occurred.


@OneToMany(targetEntity = BallotDocumentElement.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "VOTERING_VOTE_LIST_CONTAINER_0")
    public List<BallotDocumentElement> getVotering() {
        return this.votering;
    }

@ OneToMany ( targetEntity = BallotDocumentElement . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "VOTERING_VOTE_LIST_CONTAINER_0" ) public List < BallotDocumentElement > getVotering ( ) { return this . votering ; }

Gets the votering.

@return the votering


private List<GovernmentBodyAnnualOutcomeSummary> getGovernmentBodyList() {
		final List<GovernmentBodyAnnualOutcomeSummary> result = new ArrayList<>();
		try {
			result.addAll(esvGovernmentBodyOperationOutcomeReader.readIncomeCsv());
			result.addAll(esvGovernmentBodyOperationOutcomeReader.readOutgoingCsv());
		} catch (final IOException e) {
			LOGGER.error(GET_GOVERNMENT_BODY_REPORT,e);
			return result;
		}
		return result;
	}

private List < GovernmentBodyAnnualOutcomeSummary > getGovernmentBodyList ( ) { final List < GovernmentBodyAnnualOutcomeSummary > result = new ArrayList <> ( ) ; try { result . addAll ( esvGovernmentBodyOperationOutcomeReader . readIncomeCsv ( ) ) ; result . addAll ( esvGovernmentBodyOperationOutcomeReader . readOutgoingCsv ( ) ) ; } catch ( final IOException e ) { LOGGER . error ( GET_GOVERNMENT_BODY_REPORT , e ) ; return result ; } return result ; }

Gets the government body list.

@return the government body list


@ManyToOne(targetEntity = PersonAssignmentElement.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "PERSON_ASSIGNMENT_ELEMENT_PE_0")
    public PersonAssignmentElement getPersonAssignmentElement() {
        return personAssignmentElement;
    }

@ ManyToOne ( targetEntity = PersonAssignmentElement . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "PERSON_ASSIGNMENT_ELEMENT_PE_0" ) public PersonAssignmentElement getPersonAssignmentElement ( ) { return personAssignmentElement ; }

Gets the person assignment element.

@return the person assignment element


@ManyToOne(targetEntity = PersonDetailElement.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "PERSON_DETAIL_ELEMENT_PERSON_0")
    public PersonDetailElement getPersonDetailElement() {
        return personDetailElement;
    }

@ ManyToOne ( targetEntity = PersonDetailElement . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "PERSON_DETAIL_ELEMENT_PERSON_0" ) public PersonDetailElement getPersonDetailElement ( ) { return personDetailElement ; }

Gets the person detail element.

@return the person detail element


private UserAccount createUserAccount(final RegisterUserRequest serviceRequest) {

		final ApplicationConfiguration registeredUsersGetAdminConfig = applicationConfigurationService
				.checkValueOrLoadDefault("Registered User All get Role Admin", "Registered User All get Role Admin",
						ConfigurationGroup.AUTHORIZATION, RegisterUserService.class.getSimpleName(),
						"Register User Service", "Responsible for create of useraccounts", "registered.users.get.admin",
						"true");

		final UserAccount userAccount = new UserAccount();
		userAccount.setCountry(serviceRequest.getCountry());
		userAccount.setEmail(serviceRequest.getEmail());
		userAccount.setUsername(serviceRequest.getUsername());
		userAccount.setUserId(UUID.randomUUID().toString());
		userAccount.setUserpassword(
				passwordEncoder.encode(userAccount.getUserId() + ".uuid" + serviceRequest.getUserpassword()));
		userAccount.setNumberOfVisits(1);

		if ( serviceRequest.getUserType() == null) {
			userAccount.setUserType(UserType.PRIVATE);
		} else {
			userAccount.setUserType(serviceRequest.getUserType());
		}

		userAccount.setUserEmailStatus(UserEmailStatus.UNKNOWN);
		userAccount.setUserLockStatus(UserLockStatus.UNLOCKED);
		userAccount.setCreatedDate(new Date());
		getUserDAO().persist(userAccount);

		final Collection<SimpleGrantedAuthority> authorities = new ArrayList<>();
		if ("true".equals(registeredUsersGetAdminConfig.getPropertyValue())) {
			userAccount.setUserRole(UserRole.ADMIN);
			authorities.add(new SimpleGrantedAuthority("ROLE_ADMIN"));
		} else {
			userAccount.setUserRole(UserRole.USER);
			authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
		}

		SecurityContextHolder.getContext().setAuthentication(
				new UsernamePasswordAuthenticationToken(userAccount.getUserId(), "n/a", authorities));
		return userAccount;
	}

Creates the user account.

@param serviceRequest the service request
@return the user account


public static void createRowItem(final ResponsiveRow row, final Button button, final String description) {
		final CssLayout layout = new CssLayout();
		layout.addStyleName("v-layout-content-overview-panel-level2");
		Responsive.makeResponsive(layout);
		layout.setSizeUndefined();

		button.addStyleName(ITEMBOX);
		button.addStyleName(TITLE);
		Responsive.makeResponsive(button);
		button.setWidth(100, Unit.PERCENTAGE);
		layout.addComponent(button);

		final Label descriptionLabel = new Label(description);
		descriptionLabel.addStyleName(ITEMBOX);
		Responsive.makeResponsive(descriptionLabel);
		descriptionLabel.setWidth(100, Unit.PERCENTAGE);
		layout.addComponent(descriptionLabel);

		row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE, DISPLAYS_SIZE_XM_DEVICE, DISPLAY_SIZE_MD_DEVICE,
				DISPLAY_SIZE_LG_DEVICE).withComponent(layout);
	}

Creates the row item.

@param row         the row
@param button      the button
@param description the description


public static ResponsiveRow createGridLayout(final AbstractOrderedLayout panelContent) {
		final ResponsiveLayout layout = new ResponsiveLayout();
		Responsive.makeResponsive(layout);
		layout.addStyleName("v-layout-content-overview-panel-level1");
		layout.setWidth(100, Unit.PERCENTAGE);
		layout.setHeight(100, Unit.PERCENTAGE);
		panelContent.addComponent(layout);
		panelContent.setExpandRatio(layout, ContentRatio.LARGE);
		return layout.addRow();
	}

Creates the grid layout.

@param panelContent the panel content
@return the responsive row


private void sendCountryIndicatorWorkOrder(final Map<String, String> currentSaved, final List<String> indicators,
			final String countryIso2Code) {
		for (final String indicator : indicators) {
			if (countryIso2Code != null && countryIso2Code.length() > 0
					&& !currentSaved.containsKey(countryIso2Code + '.' + indicator)) {
				final List<String> load = new ArrayList<>();
				load.add(countryIso2Code);
				load.add(indicator);
				getJmsSender().send(dataWorkdestination, (Serializable) load);
			}
		}

	}

private void sendCountryIndicatorWorkOrder ( final Map < String , String > currentSaved , final List < String > indicators , final String countryIso2Code ) { for ( final String indicator : indicators ) { if ( countryIso2Code != null && countryIso2Code . length ( ) > 0 && ! currentSaved . containsKey ( countryIso2Code + ' ' + indicator ) ) { final List < String > load = new ArrayList <> ( ) ; load . add ( countryIso2Code ) ; load . add ( indicator ) ; getJmsSender ( ) . send ( dataWorkdestination , ( Serializable ) load ) ; } } }

Send country indicator work order.

@param currentSaved    the current saved
@param indicators      the indicators
@param countryIso2Code the country iso 2 code


@ManyToOne(targetEntity = DocumentProposalContainer.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "DOCUMENT_PROPOSAL_DOCUMENT_S_0")
    public DocumentProposalContainer getDocumentProposal() {
        return documentProposal;
    }

@ ManyToOne ( targetEntity = DocumentProposalContainer . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "DOCUMENT_PROPOSAL_DOCUMENT_S_0" ) public DocumentProposalContainer getDocumentProposal ( ) { return documentProposal ; }

Gets the document proposal.

@return the document proposal


@ManyToOne(targetEntity = DocumentActivityContainer.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "DOCUMENT_ACTIVITY_CONTAINER__0")
    public DocumentActivityContainer getDocumentActivityContainer() {
        return documentActivityContainer;
    }

@ ManyToOne ( targetEntity = DocumentActivityContainer . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "DOCUMENT_ACTIVITY_CONTAINER__0" ) public DocumentActivityContainer getDocumentActivityContainer ( ) { return documentActivityContainer ; }

Gets the document activity container.

@return the document activity container


@ManyToOne(targetEntity = DocumentDetailContainer.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "DOCUMENT_DETAIL_CONTAINER_DO_0")
    public DocumentDetailContainer getDocumentDetailContainer() {
        return documentDetailContainer;
    }

@ ManyToOne ( targetEntity = DocumentDetailContainer . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "DOCUMENT_DETAIL_CONTAINER_DO_0" ) public DocumentDetailContainer getDocumentDetailContainer ( ) { return documentDetailContainer ; }

Gets the document detail container.

@return the document detail container


@ManyToOne(targetEntity = DocumentAttachmentContainer.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "DOCUMENT_ATTACHMENT_CONTAINE_0")
    public DocumentAttachmentContainer getDocumentAttachmentContainer() {
        return documentAttachmentContainer;
    }

@ ManyToOne ( targetEntity = DocumentAttachmentContainer . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "DOCUMENT_ATTACHMENT_CONTAINE_0" ) public DocumentAttachmentContainer getDocumentAttachmentContainer ( ) { return documentAttachmentContainer ; }

Gets the document attachment container.

@return the document attachment container

Gets the document attachment container .


@ManyToOne(targetEntity = DocumentReferenceContainer.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "DOCUMENT_REFERENCE_CONTAINER_0")
    public DocumentReferenceContainer getDocumentReferenceContainer() {
        return documentReferenceContainer;
    }

@ ManyToOne ( targetEntity = DocumentReferenceContainer . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "DOCUMENT_REFERENCE_CONTAINER_0" ) public DocumentReferenceContainer getDocumentReferenceContainer ( ) { return documentReferenceContainer ; }

Gets the document reference container.

@return the document reference container


@ManyToOne(targetEntity = DocumentPersonReferenceContainer.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "DOCUMENT_PERSON_REFERENCE_CO_1")
    public DocumentPersonReferenceContainer getDocumentPersonReferenceContainer() {
        return documentPersonReferenceContainer;
    }

@ ManyToOne ( targetEntity = DocumentPersonReferenceContainer . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "DOCUMENT_PERSON_REFERENCE_CO_1" ) public DocumentPersonReferenceContainer getDocumentPersonReferenceContainer ( ) { return documentPersonReferenceContainer ; }

Gets the document person reference container.

@return the document person reference container

Gets the document person reference container .


private Map<String, List<ViewRiksdagenPartyDocumentDailySummary>> getViewRiksdagenPartyDocumentDailySummaryMap() {
		final DataContainer<ViewRiksdagenPartyDocumentDailySummary, RiksdagenDocumentPartySummaryEmbeddedId> politicianBallotSummaryDailyDataContainer = getApplicationManager()
				.getDataContainer(ViewRiksdagenPartyDocumentDailySummary.class);

		return politicianBallotSummaryDailyDataContainer.getAll().parallelStream().filter(Objects::nonNull)
				.collect(Collectors.groupingBy(t -> t.getEmbeddedId().getPartyShortCode().toUpperCase(Locale.ENGLISH)
						.replace(UNDER_SCORE, EMPTY_STRING).trim()));
	}

Gets the view riksdagen party document daily summary map.

@return the view riksdagen party document daily summary map

Gets the view riksdagen party document daily summary map .


private static void addDocumentHistoryByPartyData(final DataSeries dataSeries, final Series series,
			final Map<String, List<ViewRiksdagenPartyDocumentDailySummary>> map) {
		final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH);

		for (final Entry<String, List<ViewRiksdagenPartyDocumentDailySummary>> entry : map.entrySet()) {

			series.addSeries(new XYseries().setLabel(entry.getKey()));

			dataSeries.newSeries();
			if (entry.getValue() != null) {
				for (final ViewRiksdagenPartyDocumentDailySummary item : entry.getValue()) {
					dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getPublicDate()), item.getTotal());
				}
			} else {
				LOGGER.info(LOG_MSG_MISSING_DATA_FOR_KEY, entry);
			}

		}
	}

private static void addDocumentHistoryByPartyData ( final DataSeries dataSeries , final Series series , final Map < String , List < ViewRiksdagenPartyDocumentDailySummary > > map ) { final SimpleDateFormat simpleDateFormat = new SimpleDateFormat ( DD_MMM_YYYY , Locale . ENGLISH ) ; for ( final Entry < String , List < ViewRiksdagenPartyDocumentDailySummary > > entry : map . entrySet ( ) ) { series . addSeries ( new XYseries ( ) . setLabel ( entry . getKey ( ) ) ) ; dataSeries . newSeries ( ) ; if ( entry . getValue ( ) != null ) { for ( final ViewRiksdagenPartyDocumentDailySummary item : entry . getValue ( ) ) { dataSeries . add ( simpleDateFormat . format ( item . getEmbeddedId ( ) . getPublicDate ( ) ) , item . getTotal ( ) ) ; } } else { LOGGER . info ( LOG_MSG_MISSING_DATA_FOR_KEY , entry ) ; } } }

Adds the document history by party data.

@param dataSeries the data series
@param series the series
@param map the map

Adds the document history by party data .


private static String[] readMissingPersonList() {

		final Scanner sc = new Scanner(RiksdagenPersonsWorkGeneratorImpl.class.getResourceAsStream("/personlist.txt"),StandardCharsets.UTF_8.name());
		final List<String> lines = new ArrayList<>();
		while (sc.hasNextLine()) {
			lines.add(sc.nextLine());
		}
		sc.close();
		return lines.toArray(new String[0]);
	}

private static String [ ] readMissingPersonList ( ) { final Scanner sc = new Scanner ( RiksdagenPersonsWorkGeneratorImpl . class . getResourceAsStream ( "/personlist.txt" ) , StandardCharsets . UTF_8 . name ( ) ) ; final List < String > lines = new ArrayList <> ( ) ; while ( sc . hasNextLine ( ) ) { lines . add ( sc . nextLine ( ) ) ; } sc . close ( ) ; return lines . toArray ( new String [ 0 ] ) ; }

Read missing person list.

@return the string[]


private void appendObjectPresentation(final StringBuilder stringBuilder, final Object object) {
		try {
			final String beanProperty = BeanUtils.getProperty(object, property);

			if (beanProperty != null) {
				stringBuilder.append(beanProperty);
			} else {
				addFallbackValue(stringBuilder, object);
			}

		} catch (final IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
			LOGGER.warn("Problem getting property {}, object {} , exception {}", property, object, e);
		}
		stringBuilder.append(CONTENT_SEPARATOR);
	}

Append object presentation.

@param stringBuilder
the string builder
@param object
the object


private void addFallbackValue(final StringBuilder stringBuilder, final Object object)
			throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
		if (fallbackColumn != null) {
			final String beanPropertyFallBack = BeanUtils.getProperty(object, fallbackColumn);
			if (beanPropertyFallBack != null) {
				stringBuilder.append(beanPropertyFallBack);
			}
		}
	}

private void addFallbackValue ( final StringBuilder stringBuilder , final Object object ) throws IllegalAccessException , InvocationTargetException , NoSuchMethodException { if ( fallbackColumn != null ) { final String beanPropertyFallBack = BeanUtils . getProperty ( object , fallbackColumn ) ; if ( beanPropertyFallBack != null ) { stringBuilder . append ( beanPropertyFallBack ) ; } } }

Adds the fallback value.

@param stringBuilder the string builder
@param object        the object
@throws IllegalAccessException    the illegal access exception
@throws InvocationTargetException the invocation target exception
@throws NoSuchMethodException     the no such method exception


private void reencryptVaultValues(final ChangePasswordRequest serviceRequest, final UserAccount userAccount) {
		final String authKey= vaultManager.getEncryptedValue(serviceRequest.getCurrentPassword(), userAccount);
		if (authKey != null) {
			final EncryptedValue encryptedValue = encryptedValueDAO.findFirstByProperty(EncryptedValue_.userId, userAccount.getUserId());
			encryptedValue.setStorage(vaultManager.encryptValue(serviceRequest.getNewPassword(), userAccount.getUserId(), authKey));
			encryptedValueDAO.merge(encryptedValue);
		}
	}

private void reencryptVaultValues ( final ChangePasswordRequest serviceRequest , final UserAccount userAccount ) { final String authKey = vaultManager . getEncryptedValue ( serviceRequest . getCurrentPassword ( ) , userAccount ) ; if ( authKey != null ) { final EncryptedValue encryptedValue = encryptedValueDAO . findFirstByProperty ( EncryptedValue_ . userId , userAccount . getUserId ( ) ) ; encryptedValue . setStorage ( vaultManager . encryptValue ( serviceRequest . getNewPassword ( ) , userAccount . getUserId ( ) , authKey ) ) ; encryptedValueDAO . merge ( encryptedValue ) ; } }

Reencrypt vault values.

@param serviceRequest the service request
@param userAccount    the user account


@OneToMany(targetEntity = SwedenCountyElectoralArea.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "LANDSTINGSVALKRETS_SWEDEN_CO_0")
    public List<SwedenCountyElectoralArea> getLandstingsvalkrets() {
        return this.landstingsvalkrets;
    }

@ OneToMany ( targetEntity = SwedenCountyElectoralArea . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "LANDSTINGSVALKRETS_SWEDEN_CO_0" ) public List < SwedenCountyElectoralArea > getLandstingsvalkrets ( ) { return this . landstingsvalkrets ; }

Gets the landstingsvalkrets.

@return the landstingsvalkrets


private static void addCommiteeSummary(final StringBuilder stringBuilder,
			final Entry<String, List<ProposalCommitteeeSummary>> entry,
			final Optional<ViewRiksdagenCommittee> vewRiksdagenCommittee) {
		if (vewRiksdagenCommittee.isPresent()) {

			final Map<String, List<ProposalCommitteeeSummary>> docTypeMap = entry.getValue().stream()
					.collect(Collectors.groupingBy(ProposalCommitteeeSummary::getDocType));

			stringBuilder.append('\n').append(vewRiksdagenCommittee.get().getEmbeddedId().getDetail());
			for (final Entry<String, List<ProposalCommitteeeSummary>> docEntry : docTypeMap.entrySet()) {
				if (docEntry.getKey().length() > 0 && entry.getKey().length() > 0) {
					addEntry(stringBuilder, entry, docEntry);
				}
			}
		}
	}

private static void addCommiteeSummary ( final StringBuilder stringBuilder , final Entry < String , List < ProposalCommitteeeSummary > > entry , final Optional < ViewRiksdagenCommittee > vewRiksdagenCommittee ) { if ( vewRiksdagenCommittee . isPresent ( ) ) { final Map < String , List < ProposalCommitteeeSummary > > docTypeMap = entry . getValue ( ) . stream ( ) . collect ( Collectors . groupingBy ( ProposalCommitteeeSummary :: getDocType ) ) ; stringBuilder . append ( ' ' ) . append ( vewRiksdagenCommittee . get ( ) . getEmbeddedId ( ) . getDetail ( ) ) ; for ( final Entry < String , List < ProposalCommitteeeSummary > > docEntry : docTypeMap . entrySet ( ) ) { if ( docEntry . getKey ( ) . length ( ) > 0 && entry . getKey ( ) . length ( ) > 0 ) { addEntry ( stringBuilder , entry , docEntry ) ; } } } }

Adds the commitee summary.

@param stringBuilder         the string builder
@param entry                 the entry
@param vewRiksdagenCommittee the vew riksdagen committee


private static void addEntry(final StringBuilder stringBuilder,
			final Entry<String, List<ProposalCommitteeeSummary>> entry,
			final Entry<String, List<ProposalCommitteeeSummary>> docEntry) {
		stringBuilder.append("( ").append(docEntry.getValue().size()).append(' ').append(docEntry.getKey()).append(" -> ");

		final Map<String, List<ProposalCommitteeeSummary>> decisionMap = docEntry.getValue().stream()
				.collect(Collectors.groupingBy(ProposalCommitteeeSummary::getDecision));

		for (final Entry<String, List<ProposalCommitteeeSummary>> decisionEntry : decisionMap.entrySet()) {
			if (decisionEntry.getKey().length() > 0 && entry.getKey().length() > 0) {
				stringBuilder.append(decisionEntry.getValue().size()).append(' ').append(decisionEntry.getKey()).append(' ');

			}
		}
		stringBuilder.append(')');
	}

private
static
void
addEntry
(
final
StringBuilder
stringBuilder
,
final
Entry
<
String
,
List
<
ProposalCommitteeeSummary
>
>
entry
,
final
Entry
<
String
,
List
<
ProposalCommitteeeSummary
>
>
docEntry
)
{
stringBuilder
.
append
(
"( "
)
.
append
(
docEntry
.
getValue
(
)
.
size
(
)
)
.
append
(
'
'
)
.
append
(
docEntry
.
getKey
(
)
)
.
append
(
" -> "
)
;
final
Map
<
String
,
List
<
ProposalCommitteeeSummary
>
>
decisionMap
=
docEntry
.
getValue
(
)
.
stream
(
)
.
collect
(
Collectors
.
groupingBy
(
ProposalCommitteeeSummary
::
getDecision
)
)
;
for
(
final
Entry
<
String
,
List
<
ProposalCommitteeeSummary
>
>
decisionEntry
:
decisionMap
.
entrySet
(
)
)
{
if
(
decisionEntry
.
getKey
(
)
.
length
(
)
>
0
&&
entry
.
getKey
(
)
.
length
(
)
>
0
)
{
stringBuilder
.
append
(
decisionEntry
.
getValue
(
)
.
size
(
)
)
.
append
(
'
'
)
.
append
(
decisionEntry
.
getKey
(
)
)
.
append
(
'
'
)
;
}
}
stringBuilder
.
append
(
'
'
)
;
}

Adds the entry.

@param stringBuilder the string builder
@param entry         the entry
@param docEntry      the doc entry


private static void addDecisionDataRows(final SankeyChart chart,
			final Entry<String, List<ProposalCommitteeeSummary>> entry,
			final ViewRiksdagenCommittee vewRiksdagenCommittee) {
		final Map<String, List<ProposalCommitteeeSummary>> decisionMap = entry.getValue().stream()
				.collect(Collectors.groupingBy(ProposalCommitteeeSummary::getDecision));

		for (final Entry<String, List<ProposalCommitteeeSummary>> decisionEntry : decisionMap.entrySet()) {
			if (decisionEntry.getKey().length() > 0 && entry.getKey().length() > 0) {
				chart.addDataRow(vewRiksdagenCommittee.getEmbeddedId().getDetail(), decisionEntry.getKey(),
						decisionEntry.getValue().size());
			}
		}
	}

private static void addDecisionDataRows ( final SankeyChart chart , final Entry < String , List < ProposalCommitteeeSummary > > entry , final ViewRiksdagenCommittee vewRiksdagenCommittee ) { final Map < String , List < ProposalCommitteeeSummary > > decisionMap = entry . getValue ( ) . stream ( ) . collect ( Collectors . groupingBy ( ProposalCommitteeeSummary :: getDecision ) ) ; for ( final Entry < String , List < ProposalCommitteeeSummary > > decisionEntry : decisionMap . entrySet ( ) ) { if ( decisionEntry . getKey ( ) . length ( ) > 0 && entry . getKey ( ) . length ( ) > 0 ) { chart . addDataRow ( vewRiksdagenCommittee . getEmbeddedId ( ) . getDetail ( ) , decisionEntry . getKey ( ) , decisionEntry . getValue ( ) . size ( ) ) ; } } }

Adds the decision data rows.

@param chart
the chart
@param entry
the entry
@param vewRiksdagenCommittee
the vew riksdagen committee


private static void addDocTypeDataRows(final SankeyChart chart,
			final Entry<String, List<ProposalCommitteeeSummary>> entry,
			final ViewRiksdagenCommittee vewRiksdagenCommittee) {
		final Map<String, List<ProposalCommitteeeSummary>> docTypeMap = entry.getValue().stream()
				.collect(Collectors.groupingBy(ProposalCommitteeeSummary::getDocType));

		for (final Entry<String, List<ProposalCommitteeeSummary>> docEntry : docTypeMap.entrySet()) {
			if (docEntry.getKey().length() > 0 && entry.getKey().length() > 0) {
				chart.addDataRow(docEntry.getKey(), vewRiksdagenCommittee.getEmbeddedId().getDetail(),
						docEntry.getValue().size());

			}
		}
	}

private static void addDocTypeDataRows ( final SankeyChart chart , final Entry < String , List < ProposalCommitteeeSummary > > entry , final ViewRiksdagenCommittee vewRiksdagenCommittee ) { final Map < String , List < ProposalCommitteeeSummary > > docTypeMap = entry . getValue ( ) . stream ( ) . collect ( Collectors . groupingBy ( ProposalCommitteeeSummary :: getDocType ) ) ; for ( final Entry < String , List < ProposalCommitteeeSummary > > docEntry : docTypeMap . entrySet ( ) ) { if ( docEntry . getKey ( ) . length ( ) > 0 && entry . getKey ( ) . length ( ) > 0 ) { chart . addDataRow ( docEntry . getKey ( ) , vewRiksdagenCommittee . getEmbeddedId ( ) . getDetail ( ) , docEntry . getValue ( ) . size ( ) ) ; } } }

Adds the doc type data rows.

@param chart
the chart
@param entry
the entry
@param vewRiksdagenCommittee
the vew riksdagen committee


private static void addDocTypeDecisionDataRows(final SankeyChart chart,
			final Entry<String, List<ProposalCommitteeeSummary>> entry) {
		final Map<String, List<ProposalCommitteeeSummary>> docTypeMap = entry.getValue().stream()
				.collect(Collectors.groupingBy(ProposalCommitteeeSummary::getDocType));

		for (final Entry<String, List<ProposalCommitteeeSummary>> docEntry : docTypeMap.entrySet()) {

			final Map<String, List<ProposalCommitteeeSummary>> decisionMap = docEntry.getValue().stream()
					.collect(Collectors.groupingBy(ProposalCommitteeeSummary::getDecision));

			for (final Entry<String, List<ProposalCommitteeeSummary>> decisionEntry : decisionMap.entrySet()) {
				if (decisionEntry.getKey().length() > 0 && entry.getKey().length() > 0) {
					chart.addDataRow(docEntry.getKey(), decisionEntry.getKey(), decisionEntry.getValue().size());
				}
			}
		}
	}

private static void addDocTypeDecisionDataRows ( final SankeyChart chart , final Entry < String , List < ProposalCommitteeeSummary > > entry ) { final Map < String , List < ProposalCommitteeeSummary > > docTypeMap = entry . getValue ( ) . stream ( ) . collect ( Collectors . groupingBy ( ProposalCommitteeeSummary :: getDocType ) ) ; for ( final Entry < String , List < ProposalCommitteeeSummary > > docEntry : docTypeMap . entrySet ( ) ) { final Map < String , List < ProposalCommitteeeSummary > > decisionMap = docEntry . getValue ( ) . stream ( ) . collect ( Collectors . groupingBy ( ProposalCommitteeeSummary :: getDecision ) ) ; for ( final Entry < String , List < ProposalCommitteeeSummary > > decisionEntry : decisionMap . entrySet ( ) ) { if ( decisionEntry . getKey ( ) . length ( ) > 0 && entry . getKey ( ) . length ( ) > 0 ) { chart . addDataRow ( docEntry . getKey ( ) , decisionEntry . getKey ( ) , decisionEntry . getValue ( ) . size ( ) ) ; } } } }

Adds the doc type decision data rows.

@param chart
the chart
@param entry
the entry


public static String getUserIdFromSecurityContext() {
		final SecurityContext context = SecurityContextHolder.getContext();
		if (context != null) {
			final Authentication authentication = context.getAuthentication();
			if (authentication != null) {
				return authentication.getPrincipal().toString();
			}
		}
		return null;
	}

public static String getUserIdFromSecurityContext ( ) { final SecurityContext context = SecurityContextHolder . getContext ( ) ; if ( context != null ) { final Authentication authentication = context . getAuthentication ( ) ; if ( authentication != null ) { return authentication . getPrincipal ( ) . toString ( ) ; } } return null ; }

Gets the user id from security context.

@return the user id from security context

Gets the user id from security context .


public static String getRequestUrl(final Page current) {
		if (current != null) {
			return current.getLocation().toString();

		} else {
			final HttpServletRequest httpRequest=((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
			return httpRequest.getRequestURL().toString();
		}
	}

public static String getRequestUrl ( final Page current ) { if ( current != null ) { return current . getLocation ( ) . toString ( ) ; } else { final HttpServletRequest httpRequest = ( ( ServletRequestAttributes ) RequestContextHolder . currentRequestAttributes ( ) ) . getRequest ( ) ; return httpRequest . getRequestURL ( ) . toString ( ) ; } }

Gets the request url.

@param current
the current
@return the request url


public static boolean allowRoleInSecurityContext(final String role) {
		boolean result = false;
		final SecurityContext context = SecurityContextHolder.getContext();
		if (context != null && context.getAuthentication() != null) {
			final Collection<? extends GrantedAuthority> authorities = context.getAuthentication().getAuthorities();

			for (final GrantedAuthority grantedAuthority : authorities) {
				if (role.equalsIgnoreCase(grantedAuthority.getAuthority())) {
					result = true;
				}
			}
		}
		return result;
	}

public static boolean allowRoleInSecurityContext ( final String role ) { boolean result = false ; final SecurityContext context = SecurityContextHolder . getContext ( ) ; if ( context != null && context . getAuthentication ( ) != null ) { final Collection < ? extends GrantedAuthority > authorities = context . getAuthentication ( ) . getAuthorities ( ) ; for ( final GrantedAuthority grantedAuthority : authorities ) { if ( role . equalsIgnoreCase ( grantedAuthority . getAuthority ( ) ) ) { result = true ; } } } return result ; }

Allow role in security context.

@param role
the role
@return true, if successful


private Map<String, List<ViewApplicationActionEventPageDailySummary>> getApplicationActionEventPageDailySummaryMap() {
		final DataContainer<ViewApplicationActionEventPageDailySummary, ApplicationActionEventPagePeriodSummaryEmbeddedId> documentTypeSummaryDailyDataContainer = getApplicationManager()
				.getDataContainer(ViewApplicationActionEventPageDailySummary.class);

		return documentTypeSummaryDailyDataContainer.getAll().parallelStream().filter(Objects::nonNull)
				.collect(Collectors.groupingBy(t -> t.getEmbeddedId().getPage()));
	}

Gets the application action event page daily summary map.

@return the application action event page daily summary map

Gets the application action event page daily summary map .


private Map<String, List<ViewApplicationActionEventPageModeDailySummary>> getApplicationActionEventPageModeDailySummaryMap(
			final String page) {
		final DataContainer<ViewApplicationActionEventPageModeDailySummary, ApplicationActionEventPageModePeriodSummaryEmbeddedId> documentTypeSummaryDailyDataContainer = getApplicationManager()
				.getDataContainer(ViewApplicationActionEventPageModeDailySummary.class);

		final List<ViewApplicationActionEventPageModeDailySummary> findOrderedListByEmbeddedProperty = documentTypeSummaryDailyDataContainer
				.findOrderedListByEmbeddedProperty(ViewApplicationActionEventPageModeDailySummary.class,
						ViewApplicationActionEventPageModeDailySummary_.embeddedId,
						ApplicationActionEventPageModePeriodSummaryEmbeddedId.class,
						ApplicationActionEventPageModePeriodSummaryEmbeddedId_.page, page,
						ApplicationActionEventPageModePeriodSummaryEmbeddedId_.createdDate);

		return findOrderedListByEmbeddedProperty.parallelStream().filter(Objects::nonNull)
				.collect(Collectors.groupingBy(t -> t.getEmbeddedId().getPageMode()));
	}

Gets the application action event page mode daily summary map.

@param page the page
@return the application action event page mode daily summary map

Gets the application action event page mode daily summary map .


private List<ViewApplicationActionEventPageElementDailySummary> getApplicationActionEventPageElementDailySummaryList(
			final String page, final String elementId) {
		final DataContainer<ViewApplicationActionEventPageElementDailySummary, ApplicationActionEventPageElementPeriodSummaryEmbeddedId> documentTypeSummaryDailyDataContainer = getApplicationManager()
				.getDataContainer(ViewApplicationActionEventPageElementDailySummary.class);

		final List<ViewApplicationActionEventPageElementDailySummary> findOrderedListByEmbeddedProperty = documentTypeSummaryDailyDataContainer
				.findOrderedListByEmbeddedProperty(ViewApplicationActionEventPageElementDailySummary.class,
						ViewApplicationActionEventPageElementDailySummary_.embeddedId,
						ApplicationActionEventPageElementPeriodSummaryEmbeddedId.class,
						ApplicationActionEventPageElementPeriodSummaryEmbeddedId_.elementId, elementId,
						ApplicationActionEventPageElementPeriodSummaryEmbeddedId_.createdDate);

		return findOrderedListByEmbeddedProperty.parallelStream()
				.filter(t -> t != null && t.getEmbeddedId().getPage().equals(page)).collect(Collectors.toList());
	}

Gets the application action event page element daily summary list.

@param page the page
@param elementId the element id
@return the application action event page element daily summary list

Gets the application action event page element daily summary list .


private static void addViewApplicationActionEventPageElementDailySummaryValues(final String label,
			final Series series, final List<ViewApplicationActionEventPageElementDailySummary> list,
			final DataSeries dataSeries, final SimpleDateFormat simpleDateFormat,
			final ToLongFunction<ViewApplicationActionEventPageElementDailySummary> t) {
		series.addSeries(new XYseries().setLabel(label));
		dataSeries.newSeries();

		for (final ViewApplicationActionEventPageElementDailySummary item : list) {
			dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getCreatedDate()), t.applyAsLong(item));
		}
	}

Adds the view application action event page element daily summary values.

@param label the label
@param series the series
@param list the list
@param dataSeries the data series
@param simpleDateFormat the simple date format
@param t the t

Adds the view application action event page element daily summary values .


private static void updatePersonAssignmentData(final PersonAssignmentData exist, final PersonAssignmentData update) {

		final List<AssignmentData> assignmentList = update.getAssignmentList();

		for (final AssignmentData assignmentData : assignmentList) {
			updateAssignmentData(exist.getAssignmentList(), assignmentData);
		}
	}

private static void updatePersonAssignmentData ( final PersonAssignmentData exist , final PersonAssignmentData update ) { final List < AssignmentData > assignmentList = update . getAssignmentList ( ) ; for ( final AssignmentData assignmentData : assignmentList ) { updateAssignmentData ( exist . getAssignmentList ( ) , assignmentData ) ; } }

Update person assignment data.

@param exist  the exist
@param update the update


private static void updateAssignmentData(final List<AssignmentData> assignmentList, final AssignmentData assignmentData) {
		for (final AssignmentData matchAssignmentData : assignmentList) {
			if (matchAssignmentData.getFromDate().equals(assignmentData.getFromDate())
					&& matchAssignmentData.getOrgCode().equals(assignmentData.getOrgCode()) && matchAssignmentData.getRoleCode().equals(assignmentData.getRoleCode())) {

				matchAssignmentData.setStatus(assignmentData.getStatus());
				matchAssignmentData.setToDate(assignmentData.getToDate());
				return;
			}
		}
		assignmentList.add(assignmentData);
	}

private static void updateAssignmentData ( final List < AssignmentData > assignmentList , final AssignmentData assignmentData ) { for ( final AssignmentData matchAssignmentData : assignmentList ) { if ( matchAssignmentData . getFromDate ( ) . equals ( assignmentData . getFromDate ( ) ) && matchAssignmentData . getOrgCode ( ) . equals ( assignmentData . getOrgCode ( ) ) && matchAssignmentData . getRoleCode ( ) . equals ( assignmentData . getRoleCode ( ) ) ) { matchAssignmentData . setStatus ( assignmentData . getStatus ( ) ) ; matchAssignmentData . setToDate ( assignmentData . getToDate ( ) ) ; return ; } } assignmentList . add ( assignmentData ) ; }

Update assignment data.

@param assignmentList the assignment list
@param assignmentData the assignment data


protected final V inputValidation(final T serviceRequest) {
		final Set<ConstraintViolation<T>> validateRequest = validateRequest(serviceRequest);
		if (!validateRequest.isEmpty()) {
			final CreateApplicationEventRequest eventRequest = createApplicationEventForService(serviceRequest);
			final V response = createErrorResponse();
			handleInputViolations(eventRequest, validateRequest, response);
			createApplicationEventService.processService(eventRequest);
			return response;
		} else {
			return null;
		}
	}

protected final V inputValidation ( final T serviceRequest ) { final Set < ConstraintViolation < T > > validateRequest = validateRequest ( serviceRequest ) ; if ( ! validateRequest . isEmpty ( ) ) { final CreateApplicationEventRequest eventRequest = createApplicationEventForService ( serviceRequest ) ; final V response = createErrorResponse ( ) ; handleInputViolations ( eventRequest , validateRequest , response ) ; createApplicationEventService . processService ( eventRequest ) ; return response ; } else { return null ; } }

Input validation.

@param serviceRequest
the service request
@return the v


protected final CreateApplicationEventRequest createBaseApplicationEventRequest() {
		final CreateApplicationEventRequest eventRequest = new CreateApplicationEventRequest();
		final UserAccount userAccount = getUserAccountFromSecurityContext();

		if (userAccount != null) {
			eventRequest.setUserId(userAccount.getUserId());
		}
		return eventRequest;
	}

protected final CreateApplicationEventRequest createBaseApplicationEventRequest ( ) { final CreateApplicationEventRequest eventRequest = new CreateApplicationEventRequest ( ) ; final UserAccount userAccount = getUserAccountFromSecurityContext ( ) ; if ( userAccount != null ) { eventRequest . setUserId ( userAccount . getUserId ( ) ) ; } return eventRequest ; }

Creates the base application event request.

@return the creates the application event request

Creates the base application event request .


private Set<ConstraintViolation<T>> validateRequest(final T request) {
        final ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
        return factory.getValidator().validate( request );
	}

private Set < ConstraintViolation < T > > validateRequest ( final T request ) { final ValidatorFactory factory = Validation . buildDefaultValidatorFactory ( ) ; return factory . getValidator ( ) . validate ( request ) ; }

Validate request.

@param request
the request
@return the sets the


private String getHumanMessage(final Set<ConstraintViolation<T>> requestConstraintViolations) {
		return requestConstraintViolations.stream()
				.sorted((p1, p2) -> p1.getPropertyPath().toString().compareTo(p2.getPropertyPath().toString()))
				.map(p -> p.getPropertyPath().toString() + " " + p.getMessage()).collect(Collectors.joining(", "));
	}

private
String
getHumanMessage
(
final
Set
<
ConstraintViolation
<
T
>
>
requestConstraintViolations
)
{
return
requestConstraintViolations
.
stream
(
)
.
sorted
(
(
p1
,
p2
)
->
p1
.
getPropertyPath
(
)
.
toString
(
)
.
compareTo
(
p2
.
getPropertyPath
(
)
.
toString
(
)
)
)
.
map
(
p
->
p
.
getPropertyPath
(
)
.
toString
(
)
+
" "
+
p
.
getMessage
(
)
)
.
collect
(
Collectors
.
joining
(
", "
)
)
;
}

Gets the human message.

@param requestConstraintViolations
the request constraint violations
@return the human message


private void handleInputViolations(final CreateApplicationEventRequest eventRequest,
			final Set<ConstraintViolation<T>> requestConstraintViolations,final V response) {
		final String errorMessage = getHumanMessage(requestConstraintViolations);
		((AbstractResponse) response).setErrorMessage(errorMessage);
		eventRequest.setErrorMessage(errorMessage);
	}

private void handleInputViolations ( final CreateApplicationEventRequest eventRequest , final Set < ConstraintViolation < T > > requestConstraintViolations , final V response ) { final String errorMessage = getHumanMessage ( requestConstraintViolations ) ; ( ( AbstractResponse ) response ) . setErrorMessage ( errorMessage ) ; eventRequest . setErrorMessage ( errorMessage ) ; }

Handle input violations.

@param eventRequest
the event request
@param requestConstraintViolations
the request constraint violations
@param response
the response
@return the v


private void createDataIndicatorSummaryChartPanel(final VerticalLayout verticalLayout,final String indicator) {

		final DataContainer<ViewWorldbankIndicatorDataCountrySummary, WorldbankIndicatorDataCountrySummaryEmbeddedId> indicatorDataCountrSummaryDailyDataContainer = getApplicationManager()
				.getDataContainer(ViewWorldbankIndicatorDataCountrySummary.class);

		final Optional<ViewWorldbankIndicatorDataCountrySummary> indicatorSummary = indicatorDataCountrSummaryDailyDataContainer
				.getAll()
				.parallelStream()
				.filter(t -> t != null && t.getEmbeddedId().getIndicatorId().equals(indicator)).findFirst();

		ViewWorldbankIndicatorDataCountrySummary indicatorSummaryValue = null;
		if (indicatorSummary.isPresent()) {
			indicatorSummaryValue = indicatorSummary.get();

			getFormFactory().addFormPanelTextFields(verticalLayout,
					indicatorSummaryValue,
							ViewWorldbankIndicatorDataCountrySummary.class,
							AS_LIST);
		}

		final DataContainer<WorldBankData, Serializable> dataContainer = getApplicationManager()
		.getDataContainer(WorldBankData.class);

		final List<WorldBankData> dataList = dataContainer.findListByEmbeddedProperty(WorldBankData.class, WorldBankData_.indicator, Indicator.class, Indicator_.id, indicator);

		chartDataManager.createIndicatorChart(verticalLayout,dataList,indicatorSummaryValue);

	}

Creates the data indicator summary chart panel.

@param verticalLayout
the vertical layout
@param indicator
the indicator

Creates the data indicator summary chart panel .


protected final void initApplicationMenuBar(final MenuBar menuBar) {
		menuBar.removeItems();
		menuBar.setWidth(MENU_BAR_WIDTH);
		menuBar.setStyleName(HEADER_STYLE_NAME);
		final MenuItem mainViewItem = menuBar.addItem(APPLICATION, VaadinIcons.SERVER, null);

		mainViewItem.addItem(START_TEXT, VaadinIcons.STAR, COMMAND_MAINVIEW_OVERVIEW);

		final MenuItem mainItem = mainViewItem.addItem(MAIN, VaadinIcons.STAR, null);

		mainItem.addItem(PAGE_VISIT_HISTORY_TEXT, VaadinIcons.LINE_CHART, COMMAND_MAINVIEW_PAGEVISITHISTORY);

		if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN) || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) {
			mainViewItem.addItem(USERHOME, VaadinIcons.USER,COMMAND_USERHOME);
			createAdminMenu(mainViewItem);
			mainViewItem.addItem(LOGOUT, VaadinIcons.SIGN_OUT, COMMAND_LOGOUT);
		} else {
			mainViewItem.addItem(LOGIN, VaadinIcons.SIGN_IN, COMMAND_LOGIN);
			mainViewItem.addItem(REGISTER, VaadinIcons.FILE_ADD, COMMAND_REGISTER);
		}

	}

protected final void initApplicationMenuBar ( final MenuBar menuBar ) { menuBar . removeItems ( ) ; menuBar . setWidth ( MENU_BAR_WIDTH ) ; menuBar . setStyleName ( HEADER_STYLE_NAME ) ; final MenuItem mainViewItem = menuBar . addItem ( APPLICATION , VaadinIcons . SERVER , null ) ; mainViewItem . addItem ( START_TEXT , VaadinIcons . STAR , COMMAND_MAINVIEW_OVERVIEW ) ; final MenuItem mainItem = mainViewItem . addItem ( MAIN , VaadinIcons . STAR , null ) ; mainItem . addItem ( PAGE_VISIT_HISTORY_TEXT , VaadinIcons . LINE_CHART , COMMAND_MAINVIEW_PAGEVISITHISTORY ) ; if ( UserContextUtil . allowRoleInSecurityContext ( ROLE_ADMIN ) || UserContextUtil . allowRoleInSecurityContext ( ROLE_USER ) ) { mainViewItem . addItem ( USERHOME , VaadinIcons . USER , COMMAND_USERHOME ) ; createAdminMenu ( mainViewItem ) ; mainViewItem . addItem ( LOGOUT , VaadinIcons . SIGN_OUT , COMMAND_LOGOUT ) ; } else { mainViewItem . addItem ( LOGIN , VaadinIcons . SIGN_IN , COMMAND_LOGIN ) ; mainViewItem . addItem ( REGISTER , VaadinIcons . FILE_ADD , COMMAND_REGISTER ) ; } }

Inits the application menu bar.

@param menuBar
the menu bar


private static void createAdminMenu(final MenuItem mainViewItem) {
		if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN)) {
			final MenuItem adminMenuItem = mainViewItem.addItem(ADMIN_TEXT, VaadinIcons.SERVER, null);

			final MenuItem configurationMenuItem = adminMenuItem.addItem(CONFIGURATION, VaadinIcons.TOOLS, null);
			configurationMenuItem.addItem(APPLICATION_CONFIGURATION,VaadinIcons.TOOLS, COMMAND_APPLICATION_CONFIGURATION);

			configurationMenuItem.addItem(AGENCY,VaadinIcons.SERVER, COMMAND_AGENCY);
			configurationMenuItem.addItem(PORTAL, VaadinIcons.SITEMAP,COMMAND_PORTAL);
			configurationMenuItem.addItem(COUNTRY,VaadinIcons.FLAG, COMMAND_COUNTRY);
			configurationMenuItem.addItem(LANGUAGE,VaadinIcons.ACCESSIBILITY, COMMAND_LANGUAGE);
			configurationMenuItem.addItem(LANGUAGE_CONTENT,VaadinIcons.FILE_TEXT, COMMAND_LANGUAGE_CONTENT);

			final MenuItem managementMenuItem = adminMenuItem.addItem(MANAGEMENT, VaadinIcons.SERVER, null);

			managementMenuItem.addItem(AGENT_OPERATIONS_TEXT,VaadinIcons.BRIEFCASE, COMMAND_AGENT_OPERATION);

			managementMenuItem.addItem(DATA_SUMMARY_TEXT,VaadinIcons.DATABASE, COMMAND_DATASUMMARY);
			managementMenuItem.addItem(DATA_AUTHOR_SUMMARY,VaadinIcons.DATABASE, COMMAND_AUTHOR_DATASUMMARY);

			managementMenuItem.addItem(EMAIL,VaadinIcons.MAILBOX, COMMAND_EMAIL);

			managementMenuItem.addItem(SYSTEM_PERFORMANCE,VaadinIcons.DASHBOARD, COMMAND_MONITORING);

			final MenuItem userActivityMenuItem = adminMenuItem.addItem(USER_ACTIVITY, VaadinIcons.DATABASE, null);
			userActivityMenuItem.addItem(APPLICATION_SESSION,VaadinIcons.LAPTOP, COMMAND_APPLICATION_SESSION);
			userActivityMenuItem.addItem(APPLICATION_EVENT,VaadinIcons.ARROWS, COMMAND_APPLICATION_EVENTS);
			userActivityMenuItem.addItem(APPLICATION_EVENT_CHARTS,VaadinIcons.ARROWS, COMMAND_APPLICATION_EVENTS_CHARTS);

			userActivityMenuItem.addItem(USERACCOUNT,VaadinIcons.GROUP, COMMAND_USERACCOUNT);

		}
	}

private static void createAdminMenu ( final MenuItem mainViewItem ) { if ( UserContextUtil . allowRoleInSecurityContext ( ROLE_ADMIN ) ) { final MenuItem adminMenuItem = mainViewItem . addItem ( ADMIN_TEXT , VaadinIcons . SERVER , null ) ; final MenuItem configurationMenuItem = adminMenuItem . addItem ( CONFIGURATION , VaadinIcons . TOOLS , null ) ; configurationMenuItem . addItem ( APPLICATION_CONFIGURATION , VaadinIcons . TOOLS , COMMAND_APPLICATION_CONFIGURATION ) ; configurationMenuItem . addItem ( AGENCY , VaadinIcons . SERVER , COMMAND_AGENCY ) ; configurationMenuItem . addItem ( PORTAL , VaadinIcons . SITEMAP , COMMAND_PORTAL ) ; configurationMenuItem . addItem ( COUNTRY , VaadinIcons . FLAG , COMMAND_COUNTRY ) ; configurationMenuItem . addItem ( LANGUAGE , VaadinIcons . ACCESSIBILITY , COMMAND_LANGUAGE ) ; configurationMenuItem . addItem ( LANGUAGE_CONTENT , VaadinIcons . FILE_TEXT , COMMAND_LANGUAGE_CONTENT ) ; final MenuItem managementMenuItem = adminMenuItem . addItem ( MANAGEMENT , VaadinIcons . SERVER , null ) ; managementMenuItem . addItem ( AGENT_OPERATIONS_TEXT , VaadinIcons . BRIEFCASE , COMMAND_AGENT_OPERATION ) ; managementMenuItem . addItem ( DATA_SUMMARY_TEXT , VaadinIcons . DATABASE , COMMAND_DATASUMMARY ) ; managementMenuItem . addItem ( DATA_AUTHOR_SUMMARY , VaadinIcons . DATABASE , COMMAND_AUTHOR_DATASUMMARY ) ; managementMenuItem . addItem ( EMAIL , VaadinIcons . MAILBOX , COMMAND_EMAIL ) ; managementMenuItem . addItem ( SYSTEM_PERFORMANCE , VaadinIcons . DASHBOARD , COMMAND_MONITORING ) ; final MenuItem userActivityMenuItem = adminMenuItem . addItem ( USER_ACTIVITY , VaadinIcons . DATABASE , null ) ; userActivityMenuItem . addItem ( APPLICATION_SESSION , VaadinIcons . LAPTOP , COMMAND_APPLICATION_SESSION ) ; userActivityMenuItem . addItem ( APPLICATION_EVENT , VaadinIcons . ARROWS , COMMAND_APPLICATION_EVENTS ) ; userActivityMenuItem . addItem ( APPLICATION_EVENT_CHARTS , VaadinIcons . ARROWS , COMMAND_APPLICATION_EVENTS_CHARTS ) ; userActivityMenuItem . addItem ( USERACCOUNT , VaadinIcons . GROUP , COMMAND_USERACCOUNT ) ; } }

Creates the admin menu.

@param mainViewItem
the main view item


protected final void createButtonLink(final ResponsiveRow row,final String linkText,final Resource icon, final ClickListener command, final String description) {
		final CssLayout layout = new CssLayout();
		layout.addStyleName("v-layout-content-overview-panel-level2");
		Responsive.makeResponsive(layout);
		layout.setSizeUndefined();

		final Button button = new Button(linkText);
		Responsive.makeResponsive(button);
		button.setStyleName(LINK_STYLE_NAME);
		button.addStyleName("title");
		button.addClickListener(command);
		button.setIcon(icon);
		button.setWidth(100, Unit.PERCENTAGE);

		layout.addComponent(button);

		final Label descriptionLabel = new Label(description);
		descriptionLabel.addStyleName("itembox");
		Responsive.makeResponsive(descriptionLabel);
		descriptionLabel.setWidth(100, Unit.PERCENTAGE);
		layout.addComponent(descriptionLabel);

		row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE,DISPLAYS_SIZE_XM_DEVICE,DISPLAY_SIZE_MD_DEVICE,DISPLAY_SIZE_LG_DEVICE).withComponent(layout);
	}

Creates the button link.

@param row
the panel content
@param linkText
the link text
@param icon
the icon
@param command
the command
@param description
the description


public void setResultElement(final List<DocumentElement> resultElement) {
		if (resultElement != null) {
			this.resultElement = resultElement.stream().collect(Collectors.toList());
		}
	}

public void setResultElement ( final List < DocumentElement > resultElement ) { if ( resultElement != null ) { this . resultElement = resultElement . stream ( ) . collect ( Collectors . toList ( ) ) ; } }

Sets the result element.

@param resultElement
the new result element


@Bean
	public KieContainer kieContainer() {
		final KieServices kieServices = KieServices.Factory.get();

		final KieContainer kContainer = kieServices.getKieClasspathContainer();
		LOGGER.info("Using classloader {}, parent {}",kContainer.getClassLoader(),kContainer.getClassLoader().getParent());

		final Results verifyResults = kContainer.verify();
		for (final Message m : verifyResults.getMessages()) {
			LOGGER.warn("Kie container message: {}", m);
		}

		final KieBase kieBase = kContainer.getKieBase();
		for (final KiePackage kp : kieBase.getKiePackages()) {
			for (final Rule rule : kp.getRules()) {
				LOGGER.info("Loadded Rule: {} {}", kp, rule.getName());
			}
		}

		return kContainer;
	}

@
Bean
public
KieContainer
kieContainer
(
)
{
final
KieServices
kieServices
=
KieServices
.
Factory
.
get
(
)
;
final
KieContainer
kContainer
=
kieServices
.
getKieClasspathContainer
(
)
;
LOGGER
.
info
(
"Using classloader {}, parent {}"
,
kContainer
.
getClassLoader
(
)
,
kContainer
.
getClassLoader
(
)
.
getParent
(
)
)
;
final
Results
verifyResults
=
kContainer
.
verify
(
)
;
for
(
final
Message
m
:
verifyResults
.
getMessages
(
)
)
{
LOGGER
.
warn
(
"Kie container message: {}"
,
m
)
;
}
final
KieBase
kieBase
=
kContainer
.
getKieBase
(
)
;
for
(
final
KiePackage
kp
:
kieBase
.
getKiePackages
(
)
)
{
for
(
final
Rule
rule
:
kp
.
getRules
(
)
)
{
LOGGER
.
info
(
"Loadded Rule: {} {}"
,
kp
,
rule
.
getName
(
)
)
;
}
}
return
kContainer
;
}

Kie container.

@return the kie container


@Bean
	public Javers getJavers(final PlatformTransactionManager txManager) {
		final JaversSqlRepository sqlRepository = SqlRepositoryBuilder.sqlRepository()
				.withConnectionProvider(new ConnectionProvider() {

					@Override
					public Connection getConnection() {
						final SessionImpl session = (SessionImpl) entityManager.unwrap(Session.class);

						return session.connection();
					}
				}).withDialect(DialectName.POSTGRES).build();

		return TransactionalJaversBuilder.javers().withTxManager(txManager)
				.withObjectAccessHook(new HibernateUnproxyObjectAccessHook()).registerJaversRepository(sqlRepository)
				.withMappingStyle(MappingStyle.BEAN).build();
	}

@ Bean public Javers getJavers ( final PlatformTransactionManager txManager ) { final JaversSqlRepository sqlRepository = SqlRepositoryBuilder . sqlRepository ( ) . withConnectionProvider ( new ConnectionProvider ( ) { @ Override public Connection getConnection ( ) { final SessionImpl session = ( SessionImpl ) entityManager . unwrap ( Session . class ) ; return session . connection ( ) ; } } ) . withDialect ( DialectName . POSTGRES ) . build ( ) ; return TransactionalJaversBuilder . javers ( ) . withTxManager ( txManager ) . withObjectAccessHook ( new HibernateUnproxyObjectAccessHook ( ) ) . registerJaversRepository ( sqlRepository ) . withMappingStyle ( MappingStyle . BEAN ) . build ( ) ; }

Gets the javers.

@param txManager the tx manager
@return the javers


@Bean
	public JaversAuditableAspect javersAuditableAspect(final Javers javers, final AuthorProvider authorProvider,
			final CommitPropertiesProvider commitPropertiesProvider) {
		return new JaversAuditableAspect(javers, authorProvider, commitPropertiesProvider);
	}

@ Bean public JaversAuditableAspect javersAuditableAspect ( final Javers javers , final AuthorProvider authorProvider , final CommitPropertiesProvider commitPropertiesProvider ) { return new JaversAuditableAspect ( javers , authorProvider , commitPropertiesProvider ) ; }

Javers auditable aspect.

@param javers                   the javers
@param authorProvider           the author provider
@param commitPropertiesProvider the commit properties provider
@return the javers auditable aspect


@Bean
	public AuthorProvider authorProvider() {
		return () -> {
			final SecurityContext context = SecurityContextHolder.getContext();
			if (context != null && context.getAuthentication() != null) {
				return context.getAuthentication().getPrincipal().toString();
			} else {
				return "system";
			}
		};
	}

@ Bean public AuthorProvider authorProvider ( ) { return ( ) -> { final SecurityContext context = SecurityContextHolder . getContext ( ) ; if ( context != null && context . getAuthentication ( ) != null ) { return context . getAuthentication ( ) . getPrincipal ( ) . toString ( ) ; } else { return "system" ; } } ; }

Author provider.

@return the author provider


private void createRoleSummary(final VerticalLayout roleSummaryLayoutTabsheet,
			final List<AssignmentData> assignmentList, final ViewRiksdagenPolitician viewRiksdagenPolitician) {

		final VerticalLayout layout = new VerticalLayout();
		layout.setSizeFull();

		layout.addComponent(new Label(TOTAL_ASSIGNMENTS + assignmentList.size()));

		if (viewRiksdagenPolitician != null) {

			layout.addComponent(new Label(GOVERNMENT_EXPERIENCE
					+ convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedGovernment())));
			layout.addComponent(new Label(
					SPEAKER_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedSpeaker())));
			layout.addComponent(new Label(COMMITTEE_EXPERIENCE
					+ convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedCommittee())));
			layout.addComponent(
					new Label(EU_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedEu())));
			layout.addComponent(new Label(PARLIAMENT_EXPERIENCE
					+ convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedParliament())));
			layout.addComponent(new Label(
					PARTY_EXPERIENCE + convertToYearsString(viewRiksdagenPolitician.getTotalDaysServedParty())));
		}

		roleSummaryLayoutTabsheet.addComponent(layout);
		roleSummaryLayoutTabsheet.setExpandRatio(layout, ContentRatio.GRID);

	}

private void createRoleSummary ( final VerticalLayout roleSummaryLayoutTabsheet , final List < AssignmentData > assignmentList , final ViewRiksdagenPolitician viewRiksdagenPolitician ) { final VerticalLayout layout = new VerticalLayout ( ) ; layout . setSizeFull ( ) ; layout . addComponent ( new Label ( TOTAL_ASSIGNMENTS + assignmentList . size ( ) ) ) ; if ( viewRiksdagenPolitician != null ) { layout . addComponent ( new Label ( GOVERNMENT_EXPERIENCE + convertToYearsString ( viewRiksdagenPolitician . getTotalDaysServedGovernment ( ) ) ) ) ; layout . addComponent ( new Label ( SPEAKER_EXPERIENCE + convertToYearsString ( viewRiksdagenPolitician . getTotalDaysServedSpeaker ( ) ) ) ) ; layout . addComponent ( new Label ( COMMITTEE_EXPERIENCE + convertToYearsString ( viewRiksdagenPolitician . getTotalDaysServedCommittee ( ) ) ) ) ; layout . addComponent ( new Label ( EU_EXPERIENCE + convertToYearsString ( viewRiksdagenPolitician . getTotalDaysServedEu ( ) ) ) ) ; layout . addComponent ( new Label ( PARLIAMENT_EXPERIENCE + convertToYearsString ( viewRiksdagenPolitician . getTotalDaysServedParliament ( ) ) ) ) ; layout . addComponent ( new Label ( PARTY_EXPERIENCE + convertToYearsString ( viewRiksdagenPolitician . getTotalDaysServedParty ( ) ) ) ) ; } roleSummaryLayoutTabsheet . addComponent ( layout ) ; roleSummaryLayoutTabsheet . setExpandRatio ( layout , ContentRatio . GRID ) ; }

Creates the role summary.

@param roleSummaryLayoutTabsheet the role summary layout tabsheet
@param assignmentList the assignment list
@param viewRiksdagenPolitician the view riksdagen politician


private static void addMinistryPerYearToMap(final String name,
			final Map<Integer, List<GovernmentBodyAnnualSummary>> map, final HSSFSheet mySheet) {
		if (mySheet.getSheetName().chars().allMatch(Character::isDigit)) {

			final int year = Integer.parseInt(mySheet.getSheetName());

			final List<GovernmentBodyAnnualSummary> yearList = new ArrayList<>();
			final Iterator<Row> rowIterator = mySheet.iterator();

			// Skip header row, ignore first
			rowIterator.next();

			while (rowIterator.hasNext()) {
				addGovernmentBodyAnnualSummaryToList(name, year, yearList, rowIterator.next());
			}
			map.put(year, yearList);
		}
	}

private
static
void
addMinistryPerYearToMap
(
final
String
name
,
final
Map
<
Integer
,
List
<
GovernmentBodyAnnualSummary
>
>
map
,
final
HSSFSheet
mySheet
)
{
if
(
mySheet
.
getSheetName
(
)
.
chars
(
)
.
allMatch
(
Character
::
isDigit
)
)
{
final
int
year
=
Integer
.
parseInt
(
mySheet
.
getSheetName
(
)
)
;
final
List
<
GovernmentBodyAnnualSummary
>
yearList
=
new
ArrayList
<>
(
)
;
final
Iterator
<
Row
>
rowIterator
=
mySheet
.
iterator
(
)
;
// Skip header row, ignore first
rowIterator
.
next
(
)
;
while
(
rowIterator
.
hasNext
(
)
)
{
addGovernmentBodyAnnualSummaryToList
(
name
,
year
,
yearList
,
rowIterator
.
next
(
)
)
;
}
map
.
put
(
year
,
yearList
)
;
}
}

Adds the ministry per year to map.

@param name
the name
@param map
the map
@param mySheet
the my sheet


private static void addGovernmentBodyAnnualSummaryToList(final String name, final int year,
			final List<GovernmentBodyAnnualSummary> yearList, final Row row) {
		if (row.getLastCellNum() >= EXPECTED_COLUMN_LENGTH) {

			final GovernmentBodyAnnualSummary governmentBodyAnnualSummary = createGovernmentBodyAnnualSummaryFromRow(
					year, row);

			if (name == null || name.equalsIgnoreCase(governmentBodyAnnualSummary.getMinistry())) {
				yearList.add(governmentBodyAnnualSummary);
			}
		}
	}

Adds the government body annual summary to list.

@param name
the name
@param year
the year
@param yearList
the year list
@param row
the row

Adds the government body annual summary to list .


private static int getInteger(final String str) {
		if (str == null || str.trim().length() == 0) {
			return 0;
		} else {
			return Integer.parseInt(str);
		}
	}

private static int getInteger ( final String str ) { if ( str == null || str . trim ( ) . length ( ) == 0 ) { return 0 ; } else { return Integer . parseInt ( str ) ; } }

Gets the integer.

@param str
the str
@return the integer


private static void addDataForYearToMap(final String name, final Map<Integer, GovernmentBodyAnnualSummary> map,
			final HSSFSheet mySheet) {
		if (mySheet.getSheetName().chars().allMatch(Character::isDigit)) {
			final int year = Integer.parseInt(mySheet.getSheetName());
			final Iterator<Row> rowIterator = mySheet.iterator();

			rowIterator.next();

			while (rowIterator.hasNext()) {
				addGovernmentBodyAnnualSummaryToMap(name, map, year, rowIterator.next());
			}
		}
	}

private static void addDataForYearToMap ( final String name , final Map < Integer , GovernmentBodyAnnualSummary > map , final HSSFSheet mySheet ) { if ( mySheet . getSheetName ( ) . chars ( ) . allMatch ( Character :: isDigit ) ) { final int year = Integer . parseInt ( mySheet . getSheetName ( ) ) ; final Iterator < Row > rowIterator = mySheet . iterator ( ) ; rowIterator . next ( ) ; while ( rowIterator . hasNext ( ) ) { addGovernmentBodyAnnualSummaryToMap ( name , map , year , rowIterator . next ( ) ) ; } } }

Adds the data for year to map.

@param name
the name
@param map
the map
@param mySheet
the my sheet


private static void addGovernmentBodyAnnualSummaryToMap(final String name, final Map<Integer, GovernmentBodyAnnualSummary> map,
			final int year, final Row row) {
		if (row.getLastCellNum() >= EXPECTED_COLUMN_LENGTH) {

			final GovernmentBodyAnnualSummary governmentBodyAnnualSummary = createGovernmentBodyAnnualSummaryFromRow(
					year, row);
			if (name == null || name.equalsIgnoreCase(governmentBodyAnnualSummary.getName())) {
				map.put(year, governmentBodyAnnualSummary);
			}
		}
	}

Adds the government body annual summary to map.

@param name
the name
@param map
the map
@param year
the year
@param row
the row

Adds the government body annual summary to map .


private static GovernmentBodyAnnualSummary createGovernmentBodyAnnualSummaryFromRow(final int year, final Row row) {
		return new GovernmentBodyAnnualSummary(year, defaultValueIfNull(row.getCell(NAME_CELL)), getInteger(defaultValueIfNull(row.getCell(CONSECUTIVE_NUMBER_CELL))),
				defaultValueIfNull(row.getCell(GOVERNMENT_BODY_ID_CELL)), defaultValueIfNull(row.getCell(MCODE_CELL)), defaultValueIfNull(row.getCell(MINISTRY_CELL)),
				defaultValueIfNull(row.getCell(ORG_NUMBER_CELL)), getInteger(defaultValueIfNull(row.getCell(HEADCOUNT_CELL))), getInteger(defaultValueIfNull(row.getCell(ANNUAL_HEADCOUNT_CELL))),
				defaultValueIfNull(row.getCell(VAT_CELL)), defaultValueIfNull(row.getCell(COMMENT_CELL)));
	}

Creates the government body annual summary from row.

@param year
the year
@param row
the row
@return the government body annual summary

Creates the government body annual summary from row .


@ManyToOne(targetEntity = PersonAssignmentData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "PERSON_ASSIGNMENT_DATA_PERSO_0")
    public PersonAssignmentData getPersonAssignmentData() {
        return personAssignmentData;
    }

@ ManyToOne ( targetEntity = PersonAssignmentData . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "PERSON_ASSIGNMENT_DATA_PERSO_0" ) public PersonAssignmentData getPersonAssignmentData ( ) { return personAssignmentData ; }

Gets the person assignment data.

@return the person assignment data


@ManyToOne(targetEntity = PersonDetailData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "PERSON_DETAIL_DATA_PERSON_DA_0")
    public PersonDetailData getPersonDetailData() {
        return personDetailData;
    }

@ ManyToOne ( targetEntity = PersonDetailData . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "PERSON_DETAIL_DATA_PERSON_DA_0" ) public PersonDetailData getPersonDetailData ( ) { return personDetailData ; }

Gets the person detail data.

@return the person detail data


private Map<String, List<ViewRiksdagenCommitteeDecisionTypeDailySummary>> getCommitteeDecisionTypeMap() {
		final DataContainer<ViewRiksdagenCommitteeDecisionTypeDailySummary, RiksdagenCommitteeDecisionTypeSummaryEmbeddedId> committeeBallotDecisionPartyDataContainer = getApplicationManager()
				.getDataContainer(ViewRiksdagenCommitteeDecisionTypeDailySummary.class);

		final Date now = new Date();
		final Date notBefore = new GregorianCalendar(2000, Calendar.JANUARY, 1).getTime();
		return committeeBallotDecisionPartyDataContainer.getAll().parallelStream()
				.filter(t -> t != null && !t.getEmbeddedId().getDecisionDate().after(now)
						&& !notBefore.after(t.getEmbeddedId().getDecisionDate()))
				.collect(Collectors.groupingBy(t -> t.getEmbeddedId().getDecisionType()));
	}

Gets the committee decision type map.

@return the committee decision type map


private Map<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> getCommitteeDecisionTypeOrgMap() {
		final DataContainer<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary, RiksdagenCommitteeDecisionTypeOrgSummaryEmbeddedId> committeeBallotDecisionPartyDataContainer = getApplicationManager()
				.getDataContainer(ViewRiksdagenCommitteeDecisionTypeOrgDailySummary.class);

		return committeeBallotDecisionPartyDataContainer.getAll().parallelStream().filter(Objects::nonNull)
				.collect(Collectors.groupingBy(t -> t.getEmbeddedId().getOrg()));
	}

Gets the committee decision type org map.

@return the committee decision type org map

Gets the committee decision type org map .


private static void addDecisionTypeByOrgData(final SimpleDateFormat simpleDateFormat, final DataSeries dataSeries,
			final Series series, final Map<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> map) {
		for (final Entry<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> entry : map.entrySet()) {
			if (!EMPTY_STRING.equals(entry.getKey())) {

				final XYseries label = new XYseries();
				label.setLabel(entry.getKey());

				series.addSeries(label);

				dataSeries.newSeries();
				for (final ViewRiksdagenCommitteeDecisionTypeOrgDailySummary item : entry.getValue()) {
						dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getDecisionDate()),
								item.getTotal());
				}
			}
		}
	}

Adds the decision type by org data.

@param simpleDateFormat the simple date format
@param dataSeries the data series
@param series the series
@param map the map


private static void displayDocumentAttachements(final VerticalLayout panelContent,
			final List<DocumentAttachment> documentAttachmentList) {
		for (final DocumentAttachment documentAttachment : documentAttachmentList) {

			if (PDF.equalsIgnoreCase(documentAttachment.getFileType())) {
				final WTPdfViewer wtPdfViewer = new WTPdfViewer();
				wtPdfViewer.setSizeFull();

				wtPdfViewer.setResource(new StreamResource(new StreamSourceImplementation(documentAttachment.getFileUrl()), documentAttachment.getFileName()));

				panelContent.addComponent(wtPdfViewer);
				panelContent.setExpandRatio(wtPdfViewer, ContentRatio.LARGE);
			} else {
				final VerticalLayout verticalLayout = new VerticalLayout();
				panelContent.addComponent(verticalLayout);
				panelContent.setExpandRatio(verticalLayout, ContentRatio.SMALL);
				final ExternalAttachmentDownloadLink link = new ExternalAttachmentDownloadLink(
						documentAttachment.getFileName(), documentAttachment.getFileType(),
						documentAttachment.getFileUrl());
				verticalLayout.addComponent(link);
			}
		}
	}

private static void displayDocumentAttachements ( final VerticalLayout panelContent , final List < DocumentAttachment > documentAttachmentList ) { for ( final DocumentAttachment documentAttachment : documentAttachmentList ) { if ( PDF . equalsIgnoreCase ( documentAttachment . getFileType ( ) ) ) { final WTPdfViewer wtPdfViewer = new WTPdfViewer ( ) ; wtPdfViewer . setSizeFull ( ) ; wtPdfViewer . setResource ( new StreamResource ( new StreamSourceImplementation ( documentAttachment . getFileUrl ( ) ) , documentAttachment . getFileName ( ) ) ) ; panelContent . addComponent ( wtPdfViewer ) ; panelContent . setExpandRatio ( wtPdfViewer , ContentRatio . LARGE ) ; } else { final VerticalLayout verticalLayout = new VerticalLayout ( ) ; panelContent . addComponent ( verticalLayout ) ; panelContent . setExpandRatio ( verticalLayout , ContentRatio . SMALL ) ; final ExternalAttachmentDownloadLink link = new ExternalAttachmentDownloadLink ( documentAttachment . getFileName ( ) , documentAttachment . getFileType ( ) , documentAttachment . getFileUrl ( ) ) ; verticalLayout . addComponent ( link ) ; } } }

Display document attachements.

@param panelContent the panel content
@param documentAttachmentList the document attachment list


public static void createHeader2Label(final AbstractOrderedLayout panel,final String content) {
		final Label label = new Label(content);
		label.setStyleName("Level2Header");

		panel.addComponent(label);
		panel.setExpandRatio(label,ContentRatio.SMALL);
	}

public static void createHeader2Label ( final AbstractOrderedLayout panel , final String content ) { final Label label = new Label ( content ) ; label . setStyleName ( "Level2Header" ) ; panel . addComponent ( label ) ; panel . setExpandRatio ( label , ContentRatio . SMALL ) ; }

Creates a new Label object.

@param panel
the panel
@param content
the content


private static Key buildKey(final String userid, final String password) {
		return new SecretKeySpec(Arrays.copyOf(
				new SHA3.Digest512().digest((userid + ".uuid" + password).getBytes(StandardCharsets.UTF_8)), KEY_SIZE_IN_BYTES),
				ALGORITHM);
	}

private static Key buildKey ( final String userid , final String password ) { return new SecretKeySpec ( Arrays . copyOf ( new SHA3 . Digest512 ( ) . digest ( ( userid + ".uuid" + password ) . getBytes ( StandardCharsets . UTF_8 ) ) , KEY_SIZE_IN_BYTES ) , ALGORITHM ) ; }

Builds the key.

@param userid
the userid
@param password
the password
@return the key


@Override
	public final String getRuleSummary() {
		final Collection<RuleViolation> values = ruleViolationMap.values();
		final StringBuilder builder = new StringBuilder();
		for (final RuleViolation ruleViolation : values) {
			builder.append('[').append(ruleViolation.getRuleName()).append('/').append(ruleViolation.getStatus()) .append(']');
		}
		return builder.toString();
	}

@ Override public final String getRuleSummary ( ) { final Collection < RuleViolation > values = ruleViolationMap . values ( ) ; final StringBuilder builder = new StringBuilder ( ) ; for ( final RuleViolation ruleViolation : values ) { builder . append ( ' ' ) . append ( ruleViolation . getRuleName ( ) ) . append ( ' ' ) . append ( ruleViolation . getStatus ( ) ) . append ( ' ' ) ; } return builder . toString ( ) ; }

Gets the rule summary.

@return the rule summary


public final void addViolation(final Status status,final String ruleName,final String ruleGroup,final String ruleDescription,final String positive) {
		final RuleViolation currentRuleViolation = ruleViolationMap.get(ruleName);
		if (currentRuleViolation == null || status.ordinal() > currentRuleViolation.getStatus().ordinal()) {
			ruleViolationMap.put(ruleName, new RuleViolation(getId(),getName(),resourceType,ruleName,ruleDescription,ruleGroup,status,positive));
		}
	}

public final void addViolation ( final Status status , final String ruleName , final String ruleGroup , final String ruleDescription , final String positive ) { final RuleViolation currentRuleViolation = ruleViolationMap . get ( ruleName ) ; if ( currentRuleViolation == null || status . ordinal ( ) > currentRuleViolation . getStatus ( ) . ordinal ( ) ) { ruleViolationMap . put ( ruleName , new RuleViolation ( getId ( ) , getName ( ) , resourceType , ruleName , ruleDescription , ruleGroup , status , positive ) ) ; } }

Adds the violation.

@param status
the status
@param ruleName
the rule name
@param ruleGroup
the rule group
@param ruleDescription
the rule description
@param positive
the positive


private static Map<String, String> createMapFromListVote(final List<VoteDataEmbeddedId> list) {
		final Map<String, String> map = new ConcurrentHashMap<>();

		for (final VoteDataEmbeddedId documentElement : list) {
			map.put(documentElement.getBallotId(), documentElement.getBallotId());
		}
		return map;
	}

private static Map < String , String > createMapFromListVote ( final List < VoteDataEmbeddedId > list ) { final Map < String , String > map = new ConcurrentHashMap <> ( ) ; for ( final VoteDataEmbeddedId documentElement : list ) { map . put ( documentElement . getBallotId ( ) , documentElement . getBallotId ( ) ) ; } return map ; }

Creates the map from list vote.

@param list
the list
@return the map


private static boolean checkIncludeDate(final Date after, final List<String> documentTypeValues,
			final DocumentElement documentElement) {
		try {
			if (documentElement.getMadePublicDate() != null && documentElement.getMadePublicDate().length() > 0) {
				return getDate(documentElement.getMadePublicDate()).after(after)
						&& documentTypeValues.contains(documentElement.getDocumentType());
			} else {
				return getDate(documentElement.getCreatedDate()).after(after)
						&& documentTypeValues.contains(documentElement.getDocumentType());
			}
		} catch (final ParseException e) {
			LOGGER.warn("Problem getting date from{} : exception:{}", documentElement, e);
			return false;
		}
	}

Check include date.

@param after
the after
@param documentTypeValues
the document type values
@param documentElement
the document element
@return true, if successful


private static Date getDate(final String date) throws ParseException {
		if (RIKSDAGEN_JAVA_SIMPLE_DATE_FORMAT.length() > date.length()) {
			return new SimpleDateFormat(RIKSDAGEN_JAVA_SIMPLE_DATE_TIME_FORMAT, Locale.ENGLISH).parse(date);
		} else {
			return new SimpleDateFormat(RIKSDAGEN_JAVA_SIMPLE_DATE_FORMAT, Locale.ENGLISH).parse(date);
		}
	}

private static Date getDate ( final String date ) throws ParseException { if ( RIKSDAGEN_JAVA_SIMPLE_DATE_FORMAT . length ( ) > date . length ( ) ) { return new SimpleDateFormat ( RIKSDAGEN_JAVA_SIMPLE_DATE_TIME_FORMAT , Locale . ENGLISH ) . parse ( date ) ; } else { return new SimpleDateFormat ( RIKSDAGEN_JAVA_SIMPLE_DATE_FORMAT , Locale . ENGLISH ) . parse ( date ) ; } }

Gets the date.

@param date
the date
@return the date
@throws ParseException
the parse exception


@OneToMany(targetEntity = SwedenPoliticalParty.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "PARTIES_SWEDEN_ELECTION_REGI_0")
    public List<SwedenPoliticalParty> getParties() {
        return this.parties;
    }

@ OneToMany ( targetEntity = SwedenPoliticalParty . class , cascade = { CascadeType . ALL } ) @ JoinColumn ( name = "PARTIES_SWEDEN_ELECTION_REGI_0" ) public List < SwedenPoliticalParty > getParties ( ) { return this . parties ; }


private VerticalLayout createEnableGoogleAuthButton() {
		final VerticalLayout formLayout = new VerticalLayout();
		formLayout.setSizeFull();

		final Panel formPanel = new Panel();
		formPanel.setSizeFull();

		formLayout.addComponent(formPanel);

		final FormLayout formContent = new FormLayout();
		formPanel.setContent(formContent);

		final SetGoogleAuthenticatorCredentialRequest request = new SetGoogleAuthenticatorCredentialRequest();
		request.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
		request.setUserpassword("");
		final ClickListener listener = new SetGoogleAuthenticatorCredentialClickListener(request);
		getFormFactory().addRequestInputFormFields(formContent, request, SetGoogleAuthenticatorCredentialRequest.class,
				AS_LIST, ENABLE_GOOGLE_AUTHENTICATOR, listener);

		return formLayout;
	}

Creates the enable google auth button.

@return the vertical layout


private VerticalLayout createDisableGoogleAuthButton() {

		final VerticalLayout formLayout = new VerticalLayout();
		formLayout.setSizeFull();

		final Panel formPanel = new Panel();
		formPanel.setSizeFull();

		formLayout.addComponent(formPanel);

		final FormLayout formContent = new FormLayout();
		formPanel.setContent(formContent);

		final DisableGoogleAuthenticatorCredentialRequest request = new DisableGoogleAuthenticatorCredentialRequest();
		request.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
		request.setUserpassword("");
		final ClickListener listener = new DisableGoogleAuthenticatorCredentialClickListener(request);
		getFormFactory().addRequestInputFormFields(formContent, request,
				DisableGoogleAuthenticatorCredentialRequest.class, AS_LIST, DISABLE_GOOGLE_AUTHENTICATOR, listener);

		return formLayout;
	}

Creates the disable google auth button.

@return the vertical layout

Creates the disable google auth button .