Skip to content

Commit

Permalink
#8 support/aginst rules, wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pethers committed Jul 21, 2018
1 parent 2bf41af commit 6e7e192
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 245 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@
package com.hack23.cia.service.impl.rules;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionPartySummary;
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummary;
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryAnnual;
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryDaily;
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryMonthly;
import com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenPartyDocumentDailySummary;
import com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary;
import com.hack23.cia.service.api.action.kpi.ResourceType;

Expand All @@ -45,18 +42,9 @@ public final class PartyComplianceCheckImpl extends AbstractComplianceCheckImpl
/** The name. */
private final String name;

/** The document daily summary. */
private List<ViewRiksdagenPartyDocumentDailySummary> documentDailySummary = new ArrayList<>();

/** The ballot decisions. */
private List<ViewRiksdagenCommitteeBallotDecisionPartySummary> ballotDecisions = new ArrayList<>();

/** The ballots. */
private List<ViewRiksdagenVoteDataBallotPartySummary> ballots = new ArrayList<>();

/** The daily ballot summary. */
private List<ViewRiksdagenVoteDataBallotPartySummaryDaily> dailyBallotSummary = new ArrayList<>();

/** The daily summary. */
private final ViewRiksdagenVoteDataBallotPartySummaryDaily dailySummary;

Expand All @@ -69,22 +57,20 @@ public final class PartyComplianceCheckImpl extends AbstractComplianceCheckImpl
/**
* Instantiates a new party compliance check impl.
*
* @param party
* the party
* @param annualSummary
* the annual summary
* @param monthlySummary
* the monthly summary
* @param dailySummary
* the daily summary
* @param party the party
* @param annualSummary the annual summary
* @param monthlySummary the monthly summary
* @param dailySummary the daily summary
* @param ballotDecisions the ballot decisions
*/
public PartyComplianceCheckImpl(final ViewRiksdagenPartySummary party,final ViewRiksdagenVoteDataBallotPartySummaryAnnual annualSummary,final ViewRiksdagenVoteDataBallotPartySummaryMonthly monthlySummary,final ViewRiksdagenVoteDataBallotPartySummaryDaily dailySummary) {
public PartyComplianceCheckImpl(final ViewRiksdagenPartySummary party,final ViewRiksdagenVoteDataBallotPartySummaryAnnual annualSummary,final ViewRiksdagenVoteDataBallotPartySummaryMonthly monthlySummary,final ViewRiksdagenVoteDataBallotPartySummaryDaily dailySummary,final List<ViewRiksdagenCommitteeBallotDecisionPartySummary> ballotDecisions) {
super(ResourceType.PARTY);
this.party = party;
this.annualSummary = annualSummary;
this.monthlySummary = monthlySummary;
this.dailySummary = dailySummary;
this.name = party.getParty();
this.ballotDecisions = ballotDecisions;
}

/**
Expand All @@ -107,60 +93,35 @@ public String getId() {
}

/**
* Gets the document daily summary.
* Supports.
*
* @return the document daily summary
* @param committeeReport the committee report
* @param rm the rm
* @return true, if successful
*/
public List<ViewRiksdagenPartyDocumentDailySummary> getDocumentDailySummary() {
return Collections.unmodifiableList(documentDailySummary);
public boolean supports(final String committeeReport,final String rm) {
for (ViewRiksdagenCommitteeBallotDecisionPartySummary summary : ballotDecisions) {
if (summary.getRm().equalsIgnoreCase(rm) && summary.getCommitteeReport().equalsIgnoreCase(committeeReport)) {
return summary.isPartyApproved();
}
}
return false;
}

/**
* Sets the document daily summary.
* Against.
*
* @param documentDailySummary
* the new document daily summary
* @param committeeReport the committee report
* @param rm the rm
* @return true, if successful
*/
public void setDocumentDailySummary(final List<ViewRiksdagenPartyDocumentDailySummary> documentDailySummary) {
this.documentDailySummary = Collections.unmodifiableList(documentDailySummary);
}

/**
* Gets the ballots.
*
* @return the ballots
*/
public List<ViewRiksdagenVoteDataBallotPartySummary> getBallots() {
return Collections.unmodifiableList(ballots);
}

/**
* Sets the ballots.
*
* @param ballots
* the new ballots
*/
public void setBallots(final List<ViewRiksdagenVoteDataBallotPartySummary> ballots) {
this.ballots = Collections.unmodifiableList(ballots);
}

/**
* Gets the daily ballot summary.
*
* @return the daily ballot summary
*/
public List<ViewRiksdagenVoteDataBallotPartySummaryDaily> getDailyBallotSummary() {
return Collections.unmodifiableList(dailyBallotSummary);
}

/**
* Sets the daily ballot summary.
*
* @param dailyBallotSummary
* the new daily ballot summary
*/
public void setDailyBallotSummary(final List<ViewRiksdagenVoteDataBallotPartySummaryDaily> dailyBallotSummary) {
this.dailyBallotSummary = Collections.unmodifiableList(dailyBallotSummary);
public boolean against(final String committeeReport,final String rm) {
for (ViewRiksdagenCommitteeBallotDecisionPartySummary summary : ballotDecisions) {
if (summary.getRm().equalsIgnoreCase(rm) && summary.getCommitteeReport().equalsIgnoreCase(committeeReport)) {
return !summary.isPartyApproved();
}
}
return false;
}

/**
Expand Down Expand Up @@ -191,23 +152,4 @@ public ViewRiksdagenVoteDataBallotPartySummaryAnnual getAnnualSummary() {
return annualSummary;
}

/**
* Gets the ballot decisions.
*
* @return the ballot decisions
*/
public List<ViewRiksdagenCommitteeBallotDecisionPartySummary> getBallotDecisions() {
return Collections.unmodifiableList(ballotDecisions);
}

/**
* Sets the ballot decisions.
*
* @param ballotDecisions
* the new ballot decisions
*/
public void setBallotDecisions(final List<ViewRiksdagenCommitteeBallotDecisionPartySummary> ballotDecisions) {
this.ballotDecisions = Collections.unmodifiableList(ballotDecisions);
}

}
Loading

0 comments on commit 6e7e192

Please sign in to comment.