private int addObject(final RpslObject rpslObject) { databaseHelper.addObject( "inet-rtr: " + rpslObject.findAttribute(AttributeType.INET_RTR).getValue()); final int objectId = getObjectId(rpslObject); final long ifAddr = Ipv4Resource.parse(getIfAddrAttributeAsString(rpslObject)).begin(); whoisTemplate.update("INSERT INTO ifaddr (object_id, ifaddr) VALUES (?, ?)", objectId, ifAddr); return objectId; }
private String getIfAddrAttributeAsString(final RpslObject rpslObject) { return rpslObject.findAttribute(AttributeType.IFADDR).getCleanValue().toString().split(" ")[0]; }