use of org.nhindirect.config.model.CertPolicy in project nhin-d by DirectProject.
the class PoliciesController method addPolicy.
/*********************************
*
* Add Policy Method
*
*********************************/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@RequestMapping(value = "/addPolicy", method = RequestMethod.POST)
@ResponseBody
public String addPolicy(@RequestParam("id") String id, @RequestParam("policyName") String policyName, @RequestParam("policyContent") String policyContent, @RequestParam("policyLexicon") String policyLexicon) {
// Debug Statement
if (log.isDebugEnabled()) {
log.debug("Adding New Policy");
}
if (log.isDebugEnabled()) {
log.debug("Beginning to add new policy");
}
try {
URL configURL = new URL("http://localhost:8081/config-service/ConfigurationService");
} catch (MalformedURLException ue) {
}
final CertPolicy newPolicy = new CertPolicy();
newPolicy.setPolicyName(policyName);
// Set policy lexicon type
final String lexiconName = policyLexicon;
if (lexiconName.equalsIgnoreCase("XML")) {
newPolicy.setLexicon(PolicyLexicon.XML);
} else if (lexiconName.equalsIgnoreCase("JAVA_SER")) {
newPolicy.setLexicon(PolicyLexicon.JAVA_SER);
} else if (lexiconName.equalsIgnoreCase("SIMPLE_TEXT_V1")) {
newPolicy.setLexicon(PolicyLexicon.SIMPLE_TEXT_V1);
}
// Get lexicon file from form
//CommonsMultipartFile lexiconFile = policyForm.getFileData();
newPolicy.setPolicyData(policyContent.getBytes());
// Debug
log.error(newPolicy);
try {
policyService.addPolicy(newPolicy);
} catch (ServiceException cse) {
cse.printStackTrace();
}
return "test";
}
Aggregations