class PolicyServiceImpl implements PolicyService, Constants {

	@Override
	public String createPolicies(final CreatePolicyDetails policyDetails) throws Exception {
		boolean isPolicyExits = policyRepository.existsById(policyDetails.getPolicyId());
		if(!isPolicyExits) {
			Date date = new Date();
			Policy newPolicy = new Policy();
			newPolicy.setPolicyId(policyDetails.getPolicyId());
			newPolicy.setPolicyName(policyDetails.getPolicyName());
			newPolicy.setPolicyDesc(policyDetails.getPolicyDesc());
			newPolicy.setPolicyUrl(policyDetails.getPolicyUrl());
			newPolicy.setPolicyVersion(policyDetails.getPolicyVersion());
			newPolicy.setResolution(policyDetails.getResolution());
			newPolicy.setCreatedDate(date);
			newPolicy.setModifiedDate(date);
			policyRepository.save(newPolicy);
			return "Created Successfully";
		} else {
			return "Policy already exits!!";
		}
	}

}