/** * Adds property values to the context item list. * * @param values Values to add. */ private void addItems(Map<String, String> values) { for (String itemName : values.keySet()) { setItem(itemName, values.get(itemName)); } } }
/** * Adds property values to the context item list. * * @param values Values to add. */ private void addItems(Map<String, String> values) { for (String itemName : values.keySet()) { setItem(itemName, values.get(itemName)); } } }
/** * Adds context items from a serialized string. * * @param values Serialized context items to add. * @throws Exception Unspecified exception. */ public void addItems(String values) throws Exception { for (String line : values.split("[\\r\\n]")) { String[] pcs = line.split("\\=", 2); if (pcs.length == 2) { setItem(pcs[0], pcs[1]); } } }
/** * Adds context items from a serialized string. * * @param values Serialized context items to add. * @throws Exception Unspecified exception. */ public void addItems(String values) throws Exception { for (String line : values.split("[\\r\\n]")) { String[] pcs = line.split("\\=", 2); if (pcs.length == 2) { setItem(pcs[0], pcs[1]); } } }
/** * Marshals the current context as a string. * * @param contextItems The context items to marshal. * @return The marshaled context. */ public String marshal(ContextItems contextItems) { SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyyMMddHHmmssz"); contextItems.setItem(PROPNAME_TIME, timestampFormat.format(new Date())); contextItems.setItem(PROPNAME_KEY, signer.getKeyName()); return contextItems.toString(); }
/** * Marshals the current context as a string. * * @param contextItems The context items to marshal. * @return The marshaled context. */ public String marshal(ContextItems contextItems) { SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyyMMddHHmmssz"); contextItems.setItem(PROPNAME_TIME, timestampFormat.format(new Date())); contextItems.setItem(PROPNAME_KEY, signer.getKeyName()); return contextItems.toString(); }
/** * Creates a CCOW context from the specified patient object. */ @Override public ContextItems toCCOWContext(Patient patient) { IdentifierDt mrn = FhirUtil.getIdentifier(patient.getIdentifier(), IdentifierTypeCodesEnum.MR); contextItems.setItem(CCOW_MRN, mrn == null ? null : mrn.getValue(), "MRN"); contextItems.setItem(CCOW_NAM, patient.getName()); contextItems.setItem(CCOW_SEX, patient.getGender()); contextItems.setItem(CCOW_DOB, patient.getBirthDate()); return contextItems; }
/** * Creates a CCOW context from the specified patient object. */ @Override public ContextItems toCCOWContext(Patient patient) { Identifier mrn = FhirUtil.getMRN(patient); contextItems.setItem(CCOW_MRN, mrn == null ? null : mrn.getValue(), "MRN"); contextItems.setItem(CCOW_NAM, patient.getName()); contextItems.setItem(CCOW_SEX, patient.getGender()); contextItems.setItem(CCOW_DOB, patient.getBirthDate()); return contextItems; }
/** * Remove all context items for the specified subject. * * @param subject Prefix whose items are to be removed. */ public void removeSubject(String subject) { String prefix = normalizePrefix(subject); for (String suffix : getSuffixes(prefix).keySet()) { setItem(prefix + suffix, null); } }
/** * Remove all context items for the specified subject. * * @param subject Prefix whose items are to be removed. */ public void removeSubject(String subject) { String prefix = normalizePrefix(subject); for (String suffix : getSuffixes(prefix).keySet()) { setItem(prefix + suffix, null); } }
/** * Sets a context item value. * * @param itemName Item name. * @param value The value to set. The value's class must have an associated context serializer * registered for it. */ public void setItem(String itemName, Object value) { if (value == null) { setItem(itemName, (String) null); } else { @SuppressWarnings("unchecked") ISerializer<Object> contextSerializer = (ISerializer<Object>) ContextSerializerRegistry.getInstance() .get(value.getClass()); if (contextSerializer == null) { throw new ContextException("No serializer found for type " + value.getClass().getName()); } setItem(itemName, contextSerializer.serialize(value)); } }
/** * Sets a context item value. * * @param itemName Item name. * @param value The value to set. The value's class must have an associated context serializer * registered for it. */ public void setItem(String itemName, Object value) { if (value == null) { setItem(itemName, (String) null); } else { @SuppressWarnings("unchecked") IContextSerializer<Object> contextSerializer = (IContextSerializer<Object>) ContextSerializerRegistry .getInstance().get(value.getClass()); if (contextSerializer == null) { throw new ContextException("No serializer found for type " + value.getClass().getName()); } setItem(itemName, contextSerializer.serialize(value)); } }