/** * Gets the first repetition for <b>contact</b> (Details for human/organization for support), * creating it if it does not already exist. * * <p> * <b>Definition:</b> * Contact details for an organization or a particular human that is responsible for the device * </p> */ public ContactDt getContactFirstRep() { if (getContact().isEmpty()) { return addContact(); } return getContact().get(0); } /**
/** * Gets the first repetition for <b>identifier</b> (Instance id from manufacturer, owner and others), * creating it if it does not already exist. * * <p> * <b>Definition:</b> * Identifiers assigned to this device by various organizations. The most likely organizations to assign identifiers are the manufacturer and the owner, though regulatory agencies may also assign an identifier. The identifiers identify the particular device, not the kind of device * </p> */ public IdentifierDt getIdentifierFirstRep() { if (getIdentifier().isEmpty()) { return addIdentifier(); } return getIdentifier().get(0); } /**
private void updateUserDevices(final String username, Collection<Device> devices, Collection<String> contacts) { // put all the device contact info in the list and then filter out the ones in the given devices collection. devices.stream() .filter(d -> !contacts.contains(d.getContact())) .forEach(MyService::delete); } private void delete(Device d) { String contact = d.getContact(); if (d.isEmail()) { deleteEmail(contact); } else { deleteSms(contact); } } private void deleteEmail(String email) {} private void deleteSms(String sms) {}
/** * Adds and returns a new value for <b>contact</b> (Details for human/organization for support) * * <p> * <b>Definition:</b> * Contact details for an organization or a particular human that is responsible for the device * </p> */ public ContactDt addContact() { ContactDt newType = new ContactDt(); getContact().add(newType); return newType; }
/** * Adds and returns a new value for <b>identifier</b> (Instance id from manufacturer, owner and others) * * <p> * <b>Definition:</b> * Identifiers assigned to this device by various organizations. The most likely organizations to assign identifiers are the manufacturer and the owner, though regulatory agencies may also assign an identifier. The identifiers identify the particular device, not the kind of device * </p> */ public IdentifierDt addIdentifier() { IdentifierDt newType = new IdentifierDt(); getIdentifier().add(newType); return newType; }