-
Notifications
You must be signed in to change notification settings - Fork 42
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
19 changed files
with
457 additions
and
127 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
service.api/src/main/java/com/hack23/cia/service/api/action/kpi/ComplianceCheckRequest.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,62 @@ | ||
/* | ||
* 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.api.action.kpi; | ||
|
||
import com.hack23.cia.service.api.action.common.AbstractRequest; | ||
|
||
|
||
/** | ||
* The Class ComplianceCheckRequest. | ||
*/ | ||
public final class ComplianceCheckRequest extends AbstractRequest { | ||
|
||
/** The Constant serialVersionUID. */ | ||
private static final long serialVersionUID = 1L; | ||
|
||
/** The session id. */ | ||
private String sessionId; | ||
|
||
/** | ||
* Instantiates a new compliance check request. | ||
*/ | ||
public ComplianceCheckRequest() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Gets the session id. | ||
* | ||
* @return the session id | ||
*/ | ||
public String getSessionId() { | ||
return sessionId; | ||
} | ||
|
||
/** | ||
* Sets the session id. | ||
* | ||
* @param sessionId | ||
* the new session id | ||
*/ | ||
public void setSessionId(final String sessionId) { | ||
this.sessionId = sessionId; | ||
} | ||
|
||
|
||
} |
44 changes: 44 additions & 0 deletions
44
service.api/src/main/java/com/hack23/cia/service/api/action/kpi/ComplianceCheckResponse.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,44 @@ | ||
/* | ||
* 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.api.action.kpi; | ||
|
||
import com.hack23.cia.service.api.action.common.AbstractResponse; | ||
|
||
|
||
/** | ||
* The Class ComplianceCheckResponse. | ||
*/ | ||
public final class ComplianceCheckResponse extends AbstractResponse { | ||
|
||
|
||
/** The Constant serialVersionUID. */ | ||
private static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* Instantiates a new compliance check response. | ||
* | ||
* @param result | ||
* the result | ||
*/ | ||
public ComplianceCheckResponse(final ServiceResult result) { | ||
super(result); | ||
} | ||
|
||
|
||
} |
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
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
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
94 changes: 94 additions & 0 deletions
94
...ice.impl/src/main/java/com/hack23/cia/service/impl/action/kpi/ComplianceCheckService.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,94 @@ | ||
/* | ||
* 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.action.kpi; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.security.access.annotation.Secured; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Propagation; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup; | ||
import com.hack23.cia.model.internal.application.system.impl.ApplicationOperationType; | ||
import com.hack23.cia.model.internal.application.user.impl.UserAccount; | ||
import com.hack23.cia.service.api.action.application.CreateApplicationEventRequest; | ||
import com.hack23.cia.service.api.action.application.CreateApplicationEventResponse; | ||
import com.hack23.cia.service.api.action.common.ServiceResponse.ServiceResult; | ||
import com.hack23.cia.service.api.action.kpi.ComplianceCheckRequest; | ||
import com.hack23.cia.service.api.action.kpi.ComplianceCheckResponse; | ||
import com.hack23.cia.service.impl.action.common.AbstractBusinessServiceImpl; | ||
import com.hack23.cia.service.impl.action.common.BusinessService; | ||
|
||
/** | ||
* The Class ComplianceCheckService. | ||
*/ | ||
@Service | ||
@Transactional(propagation = Propagation.REQUIRED,timeout=600) | ||
public final class ComplianceCheckService extends | ||
AbstractBusinessServiceImpl<ComplianceCheckRequest, ComplianceCheckResponse> | ||
implements BusinessService<ComplianceCheckRequest, ComplianceCheckResponse> { | ||
|
||
/** The Constant LOGGER. */ | ||
private static final Logger LOGGER = LoggerFactory | ||
.getLogger(ComplianceCheckService.class); | ||
|
||
/** The create application event service. */ | ||
@Autowired | ||
private BusinessService<CreateApplicationEventRequest, CreateApplicationEventResponse> createApplicationEventService; | ||
|
||
/** | ||
* Instantiates a new compliance check service. | ||
*/ | ||
public ComplianceCheckService() { | ||
super(ComplianceCheckRequest.class); | ||
} | ||
|
||
|
||
@Secured({ "ROLE_USER", "ROLE_ADMIN", "ROLE_ANONYMOUS" }) | ||
@Override | ||
public ComplianceCheckResponse processService( | ||
final ComplianceCheckRequest serviceRequest) { | ||
|
||
LOGGER.info("{}",serviceRequest.getClass().getSimpleName()); | ||
|
||
final CreateApplicationEventRequest eventRequest = new CreateApplicationEventRequest(); | ||
eventRequest.setEventGroup(ApplicationEventGroup.USER); | ||
eventRequest.setApplicationOperation(ApplicationOperationType.READ); | ||
eventRequest.setActionName(ComplianceCheckRequest.class.getSimpleName()); | ||
eventRequest.setSessionId(serviceRequest.getSessionId()); | ||
|
||
final UserAccount userAccount = getUserAccountFromSecurityContext(); | ||
|
||
|
||
if (userAccount != null) { | ||
|
||
eventRequest.setUserId(userAccount.getUserId()); | ||
} | ||
|
||
final ComplianceCheckResponse response = new ComplianceCheckResponse(ServiceResult.SUCCESS); | ||
|
||
eventRequest.setApplicationMessage(response.getResult().toString()); | ||
createApplicationEventService.processService(eventRequest); | ||
|
||
return response; | ||
} | ||
|
||
} |
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
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions
37
service.impl/src/main/java/com/hack23/cia/service/impl/rules/RulesEngine.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,37 @@ | ||
/* | ||
* 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.util.List; | ||
|
||
import com.hack23.cia.service.api.action.kpi.ComplianceCheck; | ||
|
||
/** | ||
* The Interface RulesEngine. | ||
*/ | ||
public interface RulesEngine { | ||
|
||
/** | ||
* Check rules compliance. | ||
* | ||
* @return the list | ||
*/ | ||
List<ComplianceCheck> checkRulesCompliance(); | ||
|
||
} |
Oops, something went wrong.