use of io.apiman.manager.api.beans.summary.ApiSummaryBean in project apiman by apiman.
the class EsMarshalling method unmarshallApiSummary.
/**
* Unmarshals the given map source into a bean.
* @param source the source
* @return the API summary
*/
public static ApiSummaryBean unmarshallApiSummary(Map<String, Object> source) {
if (source == null) {
return null;
}
ApiSummaryBean bean = new ApiSummaryBean();
bean.setOrganizationId(asString(source.get("organizationId")));
bean.setOrganizationName(asString(source.get("organizationName")));
bean.setId(asString(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
bean.setCreatedOn(asDate(source.get("createdOn")));
postMarshall(bean);
return bean;
}
use of io.apiman.manager.api.beans.summary.ApiSummaryBean in project apiman by apiman.
the class RestHelper method hideSensitiveDataFromApiSummaryBeanList.
/**
* This method will hide sensitive data, such as created by, from the result
*
* @param apiSummaryBeans the summary beans
* @return A list with beans without sensitive data
*/
public static List<ApiSummaryBean> hideSensitiveDataFromApiSummaryBeanList(List<ApiSummaryBean> apiSummaryBeans) {
List<ApiSummaryBean> apis = new ArrayList<>();
for (ApiSummaryBean apiSummaryBean : apiSummaryBeans) {
ApiSummaryBean apiSummary = new ApiSummaryBean();
apiSummary.setOrganizationId(apiSummaryBean.getOrganizationId());
apiSummary.setOrganizationName(apiSummaryBean.getOrganizationName());
apiSummary.setId(apiSummaryBean.getId());
apiSummary.setName(apiSummaryBean.getName());
apiSummary.setDescription(apiSummaryBean.getDescription());
apiSummary.setImage(apiSummaryBean.getImage());
apiSummary.setTags(apiSummaryBean.getTags());
apis.add(apiSummary);
}
return apis;
}
use of io.apiman.manager.api.beans.summary.ApiSummaryBean in project apiman by apiman.
the class EsStorage method getApisInOrgs.
/**
* @see io.apiman.manager.api.core.IStorageQuery#getApisInOrgs(java.util.Set)
*/
@Override
public List<ApiSummaryBean> getApisInOrgs(Set<String> organizationIds) throws StorageException {
@SuppressWarnings("nls") SearchSourceBuilder builder = new SearchSourceBuilder().sort(new FieldSortBuilder("organizationName.keyword").order(SortOrder.ASC)).sort(new FieldSortBuilder("name.keyword").order(SortOrder.ASC)).size(500);
// $NON-NLS-1$
TermsQueryBuilder query = QueryBuilders.termsQuery("organizationId", organizationIds.toArray(new String[organizationIds.size()]));
builder.query(query);
List<SearchHit> hits = listEntities(INDEX_MANAGER_POSTFIX_API, builder);
List<ApiSummaryBean> rval = new ArrayList<>(hits.size());
for (SearchHit hit : hits) {
ApiSummaryBean bean = EsMarshalling.unmarshallApiSummary(hit.getSourceAsMap());
rval.add(bean);
}
return rval;
}
Aggregations