-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
354 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
...ice.impl/src/test/java/com/hack23/cia/service/impl/rules/AbstractComplianceCheckImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* Copyright 2010 James Pether Sörling | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* $Id$ | ||
* $HeadURL$ | ||
*/ | ||
package com.hack23.cia.service.impl.rules; | ||
|
||
import com.hack23.cia.service.api.action.kpi.ComplianceCheck; | ||
import com.hack23.cia.service.api.action.kpi.ResourceType; | ||
import com.hack23.cia.service.api.action.kpi.Status; | ||
|
||
/** | ||
* The Class AbstractComplianceCheckImpl. | ||
*/ | ||
public abstract class AbstractComplianceCheckImpl implements ComplianceCheck { | ||
|
||
/** The resource type. */ | ||
private final ResourceType resourceType; | ||
|
||
/** The rule name. */ | ||
private String ruleName; | ||
|
||
/** The rule description. */ | ||
private String ruleDescription; | ||
|
||
/** The status. */ | ||
private Status status = Status.OK; | ||
|
||
/** | ||
* Instantiates a new abstract compliance check impl. | ||
* | ||
* @param resourceType | ||
* the resource type | ||
*/ | ||
public AbstractComplianceCheckImpl(final ResourceType resourceType) { | ||
super(); | ||
this.resourceType = resourceType; | ||
} | ||
|
||
public String getRuleName() { | ||
return ruleName; | ||
} | ||
|
||
/** | ||
* Sets the rule name. | ||
* | ||
* @param ruleName | ||
* the new rule name | ||
*/ | ||
public void setRuleName(String ruleName) { | ||
this.ruleName = ruleName; | ||
} | ||
|
||
public String getRuleDescription() { | ||
return ruleDescription; | ||
} | ||
|
||
/** | ||
* Sets the rule description. | ||
* | ||
* @param ruleDescription | ||
* the new rule description | ||
*/ | ||
public void setRuleDescription(String ruleDescription) { | ||
this.ruleDescription = ruleDescription; | ||
} | ||
|
||
/** | ||
* Sets the status. | ||
* | ||
* @param status | ||
* the new status | ||
*/ | ||
public void setStatus(Status status) { | ||
this.status = status; | ||
} | ||
|
||
public ResourceType getResourceType() { | ||
return resourceType; | ||
} | ||
|
||
public Status getStatus() { | ||
return status; | ||
} | ||
} |
50 changes: 0 additions & 50 deletions
50
service.impl/src/test/java/com/hack23/cia/service/impl/rules/ComplianceCheckImpl.java
This file was deleted.
Oops, something went wrong.
73 changes: 73 additions & 0 deletions
73
service.impl/src/test/java/com/hack23/cia/service/impl/rules/PartyComplianceCheckImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2010 James Pether Sörling | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* $Id$ | ||
* $HeadURL$ | ||
*/ | ||
package com.hack23.cia.service.impl.rules; | ||
|
||
import java.text.MessageFormat; | ||
|
||
import com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary; | ||
import com.hack23.cia.service.api.action.kpi.ResourceIdentifier; | ||
import com.hack23.cia.service.api.action.kpi.ResourceType; | ||
|
||
/** | ||
* The Class PartyComplianceCheckImpl. | ||
*/ | ||
public final class PartyComplianceCheckImpl extends AbstractComplianceCheckImpl implements ResourceIdentifier { | ||
|
||
/** The party. */ | ||
private ViewRiksdagenPartySummary party; | ||
|
||
/** | ||
* Instantiates a new party compliance check impl. | ||
* | ||
* @param party | ||
* the party | ||
*/ | ||
public PartyComplianceCheckImpl(final ViewRiksdagenPartySummary party) { | ||
super(ResourceType.PARTY); | ||
this.party = party; | ||
} | ||
|
||
/** | ||
* Gets the party. | ||
* | ||
* @return the party | ||
*/ | ||
public ViewRiksdagenPartySummary getParty() { | ||
return party; | ||
} | ||
|
||
@Override | ||
public ResourceIdentifier getResourceIdentifier() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return party.getParty(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return MessageFormat.format( | ||
"PartyComplianceCheckImpl [getName()={0}, getRuleName()={1}, getRuleDescription()={2}, getResourceType()={3}, getStatus()={4}]", | ||
getName(), getRuleName(), getRuleDescription(), getResourceType(), getStatus()); | ||
} | ||
|
||
|
||
} |
73 changes: 73 additions & 0 deletions
73
...e.impl/src/test/java/com/hack23/cia/service/impl/rules/PoliticianComplianceCheckImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2010 James Pether Sörling | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* $Id$ | ||
* $HeadURL$ | ||
*/ | ||
package com.hack23.cia.service.impl.rules; | ||
|
||
import java.text.MessageFormat; | ||
|
||
import com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician; | ||
import com.hack23.cia.service.api.action.kpi.ResourceIdentifier; | ||
import com.hack23.cia.service.api.action.kpi.ResourceType; | ||
|
||
/** | ||
* The Class PoliticianComplianceCheckImpl. | ||
*/ | ||
public final class PoliticianComplianceCheckImpl extends AbstractComplianceCheckImpl implements ResourceIdentifier { | ||
|
||
/** The politician. */ | ||
private final ViewRiksdagenPolitician politician; | ||
|
||
/** | ||
* Instantiates a new politician compliance check impl. | ||
* | ||
* @param politician | ||
* the politician | ||
*/ | ||
public PoliticianComplianceCheckImpl(final ViewRiksdagenPolitician politician) { | ||
super(ResourceType.POLITICIAN); | ||
this.politician = politician; | ||
} | ||
|
||
/** | ||
* Gets the politician. | ||
* | ||
* @return the politician | ||
*/ | ||
public ViewRiksdagenPolitician getPolitician() { | ||
return politician; | ||
} | ||
|
||
@Override | ||
public ResourceIdentifier getResourceIdentifier() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return politician.getFirstName(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return MessageFormat.format( | ||
"PoliticianComplianceCheckImpl [getName()={0}, getRuleName()={1}, getRuleDescription()={2}, getResourceType()={3}, getStatus()={4}]", | ||
getName(), getRuleName(), getRuleDescription(), getResourceType(), getStatus()); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.