public void writeTo(HL7ApplicationInfo hl7AppInfo, JsonGenerator gen) { JsonWriter writer = new JsonWriter(gen); gen.writeStartObject(); writer.writeNotNullOrDef("dicomDeviceName", hl7AppInfo.getDeviceName(), null); writer.writeNotNullOrDef("hl7ApplicationName", hl7AppInfo.getHl7ApplicationName(), null); writer.writeNotEmpty("hl7OtherApplicationName", hl7AppInfo.getHl7OtherApplicationName()); writer.writeNotNullOrDef("dicomDescription", hl7AppInfo.getDescription(), null); writer.writeNotEmpty("dicomApplicationCluster", hl7AppInfo.getApplicationClusters()); writer.writeNotNull("dicomInstalled", hl7AppInfo.getInstalled()); writeNotExtendedConns(hl7AppInfo.getConnections(), writer); gen.writeEnd(); }
private void loadFrom(HL7ApplicationInfo hl7AppInfo, Attributes attrs, String deviceName) throws NamingException, ConfigurationException { hl7AppInfo.setDeviceName(deviceName); hl7AppInfo.setHl7ApplicationName( LdapUtils.stringValue(attrs.get("hl7ApplicationName"), null)); hl7AppInfo.setHl7OtherApplicationName( LdapUtils.stringArray(attrs.get("hl7OtherApplicationName"))); hl7AppInfo.setDescription( LdapUtils.stringValue(attrs.get("dicomDescription"), null)); hl7AppInfo.setApplicationClusters(LdapUtils.stringArray(attrs.get("dicomApplicationCluster"))); hl7AppInfo.setInstalled( LdapUtils.booleanValue(attrs.get("dicomInstalled"), null)); for (String connDN : LdapUtils.stringArray(attrs.get("dicomNetworkConnectionReference"))) hl7AppInfo.getConnections().add(config.findConnection(connDN)); }
private String toFilter(HL7ApplicationInfo keys) { if (keys == null) return "(objectclass=hl7Application)"; StringBuilder sb = new StringBuilder(); sb.append("(&(objectclass=hl7Application)"); appendFilter("hl7ApplicationName", keys.getHl7ApplicationName(), sb); appendFilter("hl7OtherApplicationName", keys.getHl7ApplicationName(), sb); appendFilter("dicomApplicationCluster", keys.getApplicationClusters(), sb); sb.append(")"); return sb.toString(); }
@Override public synchronized HL7ApplicationInfo[] listHL7AppInfos(HL7ApplicationInfo keys) throws ConfigurationException { if (!config.configurationExists()) return new HL7ApplicationInfo[0]; ArrayList<HL7ApplicationInfo> results = new ArrayList<HL7ApplicationInfo>(); NamingEnumeration<SearchResult> ne = null; try { String deviceName = keys.getDeviceName(); ne = config.search(deviceName, HL7_ATTRS, toFilter(keys)); while (ne.hasMore()) { HL7ApplicationInfo hl7AppInfo = new HL7ApplicationInfo(); SearchResult ne1 = ne.next(); loadFrom(hl7AppInfo, ne1.getAttributes(), deviceName != null ? deviceName : LdapUtils.cutDeviceName(ne1.getName())); results.add(hl7AppInfo); } } catch (NameNotFoundException e) { return new HL7ApplicationInfo[0]; } catch (NamingException e) { throw new ConfigurationException(e); } finally { LdapUtils.safeClose(ne); } return results.toArray(new HL7ApplicationInfo[results.size()]); }
public void writeTo(HL7ApplicationInfo hl7AppInfo, JsonGenerator gen) { JsonWriter writer = new JsonWriter(gen); gen.writeStartObject(); writer.writeNotNullOrDef("dicomDeviceName", hl7AppInfo.getDeviceName(), null); writer.writeNotNullOrDef("hl7ApplicationName", hl7AppInfo.getHl7ApplicationName(), null); writer.writeNotEmpty("hl7OtherApplicationName", hl7AppInfo.getHl7OtherApplicationName()); writer.writeNotNullOrDef("dicomDescription", hl7AppInfo.getDescription(), null); writer.writeNotEmpty("dicomApplicationCluster", hl7AppInfo.getApplicationClusters()); writer.writeNotNull("dicomInstalled", hl7AppInfo.getInstalled()); writeNotExtendedConns(hl7AppInfo.getConnections(), writer); gen.writeEnd(); }