private NuGenValidationException[] testAgainstProfile(Message message, System.String id) { NuGenHL7Exception[] exceptions = null; DefaultValidator val = new DefaultValidator(); try { System.String profileString = ProfileStoreFactory.ProfileStore.getProfile(id); if (profileString != null) { ProfileParser profParser = new ProfileParser(true); RuntimeProfile profile = profParser.parse(profileString); exceptions = val.validate(message, profile.Message); } else { throw new ProfileException("Unable to find the profile " + id); } } catch (System.IO.IOException e) { throw new ProfileException("Error retreiving profile " + id, e); } NuGenValidationException[] result = new NuGenValidationException[exceptions.Length]; for (int i = 0; i < exceptions.Length; i++) { result[i] = new NuGenValidationException(exceptions[i].Message, exceptions[i]); } return(result); }
/// <seealso cref="Genetibase.NuGenHL7.validation.MessageRule.test(Genetibase.NuGenHL7.model.Message)"> /// </seealso> public virtual NuGenValidationException[] test(Message msg) { System.Collections.ArrayList problems = new System.Collections.ArrayList(20); System.String[] ids = new System.String[] { myProfileID }; try { if (myProfileID == null) { ids = getDeclaredProfileIDs(msg); } for (int i = 0; i < ids.Length; i++) { try { NuGenValidationException[] shortList = testAgainstProfile(msg, ids[i]); for (int j = 0; j < shortList.Length; j++) { problems.Add(shortList[j]); } } catch (ProfileException e) { problems.Add(new NuGenValidationException("Can't validate", e)); } } } catch (NuGenHL7Exception e) { problems.Add(new NuGenValidationException("Can't validate", e)); } NuGenValidationException[] retVal = new NuGenValidationException[problems.Count]; problems.CopyTo(retVal); return(retVal); }
/// <seealso cref="Genetibase.NuGenHL7.validation.MessageRule.test(Genetibase.NuGenHL7.model.Message)"> /// </seealso> public virtual NuGenValidationException[] test(Message msg) { System.Collections.ArrayList problems = new System.Collections.ArrayList(20); System.String[] ids = new System.String[]{myProfileID}; try { if (myProfileID == null) { ids = getDeclaredProfileIDs(msg); } for (int i = 0; i < ids.Length; i++) { try { NuGenValidationException[] shortList = testAgainstProfile(msg, ids[i]); for (int j = 0; j < shortList.Length; j++) { problems.Add(shortList[j]); } } catch (ProfileException e) { problems.Add(new NuGenValidationException("Can't validate", e)); } } } catch (NuGenHL7Exception e) { problems.Add(new NuGenValidationException("Can't validate", e)); } NuGenValidationException[] retVal = new NuGenValidationException[problems.Count]; problems.CopyTo(retVal); return retVal; }
private NuGenValidationException[] testAgainstProfile(Message message, System.String id) { NuGenHL7Exception[] exceptions = null; DefaultValidator val = new DefaultValidator(); try { System.String profileString = ProfileStoreFactory.ProfileStore.getProfile(id); if (profileString != null) { ProfileParser profParser = new ProfileParser(true); RuntimeProfile profile = profParser.parse(profileString); exceptions = val.validate(message, profile.Message); } else { throw new ProfileException("Unable to find the profile " + id); } } catch (System.IO.IOException e) { throw new ProfileException("Error retreiving profile " + id, e); } NuGenValidationException[] result = new NuGenValidationException[exceptions.Length]; for (int i = 0; i < exceptions.Length; i++) { result[i] = new NuGenValidationException(exceptions[i].Message, exceptions[i]); } return result; }