Convert a {@link EntityModel} into a list of {@link UberData}s, containing links and content.

@param resource
@return
963358
static List<UberData> extractLinksAndContent(EntityModel<?> resource) {

		List<UberData> data = extractLinks(resource);

		extractContent(resource.getContent()).ifPresent(data::add);

		return data;
	}
566873
private Manifest addToList(Resource resource) {
        try {
            if (resource != null && resource.exists()) {
                Manifest manifest = new ManifestEx(resource);
                manifests.add(manifest);
                return manifest;
            }
        } catch (Exception e) {
            log.debug("Exception occurred reading manifest: " + resource);
        }

        return null;
    }
583516
public Response getEntityListByType(String entityType) {
        try {
            Preconditions.checkNotNull(entityType, "Entity type cannot be null");

            if (LOG.isDebugEnabled()) {
                LOG.debug("Fetching entity list for type={} ", entityType);
            }

            final List<String> entityList = metadataService.getEntityList(entityType);

            JSONObject response = new JSONObject();
            response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId());
            response.put(AtlasClient.TYPENAME, entityType);
            response.put(AtlasClient.RESULTS, new JSONArray(entityList));
            response.put(AtlasClient.COUNT, entityList.size());

            return Response.ok(response).build();
        } catch (NullPointerException e) {
            LOG.error("Entity type cannot be null", e);
            throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
        } catch (AtlasException | IllegalArgumentException e) {
            LOG.error("Unable to get entity list for type {}", entityType, e);
            throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
        } catch (WebApplicationException e) {
            LOG.error("Unable to get entity list for type {}", entityType, e);
            throw e;
        } catch (Throwable e) {
            LOG.error("Unable to get entity list for type {}", entityType, e);
            throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
        }
    }
1203107
public List<Entity> pageForEntityList(Entity where, int page, int numPerPage) throws SQLException {
		return pageForEntityList(where, new Page(page, numPerPage));
	}
1107181
public static Resource wrap(@NotNull Resource resource) {
    return wrap(resource, resource.getValueMap(), resource.getChildren());
  }
381521
public List<Entity> pageForEntityList(Entity where, Page page) throws SQLException {
		return page(where, page, EntityListHandler.create());
	}
191054
public final DataModel fromJson(final InputStream resource) {
		ObjectMapper mapper = new ObjectMapper();
		mapper
			.addMixInAnnotations(DataType.class, DataTypeConfigMixin.class);
		mapper
			.addMixInAnnotations(ObjectDataType.class, ObjectDataTypeConfigMixin.class);
		try {
			return mapper.readValue(resource, DataModel.class);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
135688
Document getResourceAsDoc(String resource) throws Exception {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        InputStream is = cl.getResourceAsStream(resource);
        if (is != null) {
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            // Fortify Mod: prevent external entity injection
            dbf.setExpandEntityReferences(false);
            DocumentBuilder db = dbf.newDocumentBuilder();
            // Fortify Mod: prevent external entity injection 
            TransformerFactory tf = TransformerFactory.newInstance();
            tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
            Transformer t = tf.newTransformer();
            //Transformer t = TransformerFactory.newInstance().newTransformer();
	       // End Fortify Mod
            Document doc = db.newDocument();
            t.transform(new StreamSource(is), new DOMResult(doc));
            // Fortify Mod: Close the InputStream and release its resources
            is.close();
            return doc;
        } else {
            return null;
        }
    }
1190176
public static List<DashboardDto> transformToDto(List<Dashboard> dashboards) {
        if (dashboards == null) {
            throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
        }

        List<DashboardDto> result = new ArrayList<DashboardDto>();

        for (Dashboard dashboard : dashboards) {
            result.add(transformToDto(dashboard));
        }
        return result;
    }
277784
static List<UberData> extractLinksAndContent(CollectionModel<?> resources) {

		List<UberData> data = extractLinks(resources);

		data.addAll(resources.getContent().stream().map(UberData::doExtractLinksAndContent)
				.map(uberData -> new UberData().withData(uberData)).collect(Collectors.toList()));

		return data;
	}
21276
public Resource.Iterator get(Resource resource) {
		Integer key = Integer.valueOf(System.identityHashCode(resource));
		return map.get(key);
	}
1214527
public static List<String> readIntoLines(final String resource) throws IOException {
		BufferedReader br = null;
		try {
			br = ResourceLoader.getBufferedReader(resource);
			return doReadIntoLines(br);
		} finally {
			IOUtils.closeQuietly(br);
		}
	}
1082736
public static Map<String, Object> serializeToMap( Object entity )
  {
    IObjectSerializer serializer = getSerializer( entity.getClass() );
    return (Map<String, Object>) serializer.serializeToMap( entity, new HashMap<Object, Map<String, Object>>() );
  }
1347310
public T loadXml(DataResource resource) {

    if (isXIncludeAware()) {
      XMLStreamReader streamReader = getStaxUtil().createXmlStreamReader(resource, true);
      try {
        Object unmarshalledObject = getOrCreateUnmarshaller().unmarshal(streamReader);
        T jaxbBean = this.xmlBeanClass.cast(unmarshalledObject);
        validate(jaxbBean);
        return jaxbBean;
      } catch (Exception e) {
        throw new XmlInvalidException(e, resource);
      } finally {
        try {
          streamReader.close();
        } catch (XMLStreamException e) {
          throw new IllegalStateException("Failed to close stream reader.", e);
        }
      }
    } else {
      InputStream inputStream = resource.openStream();
      try {
        return loadXml(inputStream, resource);
      } catch (RuntimeException e) {
        throw new XmlInvalidException(e, resource.getUri());
      } finally {
        try {
          inputStream.close();
        } catch (Exception e) {
          // ignore...
        }
      }
    }
  }
421586
private static List<UberData> extractLinks(Links links) {

		return urlRelMap(links).entrySet().stream() //
				.map(entry -> new UberData() //
						.withUrl(entry.getKey()) //
						.withRel(entry.getValue().getRels())) //
				.collect(Collectors.toList());
	}
82101
public static Map loadYamlProperties(final Resource... resource) {
        val factory = new YamlPropertiesFactoryBean();
        factory.setResolutionMethod(YamlProcessor.ResolutionMethod.OVERRIDE);
        factory.setResources(resource);
        factory.setSingleton(true);
        factory.afterPropertiesSet();
        return factory.getObject();
    }
1014615
public static List<Resource> getJarContents(@NonNull Resource resource) {
      return getResourcesFromJar(resource, v -> true);
   }