use of io.apiman.manager.api.beans.apis.ApiBean in project apiman by apiman.
the class RestHelper method hideSensitiveDataFromApiVersionBean.
/**
* This method will hide sensitive data, such as created by, from the result
*
* @param apiVersionBean the apiVersionBean
* @return the apiVersionBean without sensitive data
*/
public static ApiVersionBean hideSensitiveDataFromApiVersionBean(ApiVersionBean apiVersionBean) {
ApiBean api = new ApiBean();
api.setId(apiVersionBean.getApi().getId());
api.setName(apiVersionBean.getApi().getName());
api.setDescription(apiVersionBean.getApi().getDescription());
OrganizationBean org = new OrganizationBean();
org.setId(apiVersionBean.getApi().getOrganization().getId());
org.setName(apiVersionBean.getApi().getOrganization().getName());
org.setDescription(apiVersionBean.getApi().getOrganization().getDescription());
api.setOrganization(org);
ApiVersionBean apiVersion = new ApiVersionBean();
apiVersion.setApi(api);
apiVersion.setStatus(apiVersionBean.getStatus());
apiVersion.setEndpointType(apiVersionBean.getEndpointType());
apiVersion.setEndpointContentType(apiVersionBean.getEndpointContentType());
apiVersion.setGateways(apiVersionBean.getGateways());
apiVersion.setPublicAPI(apiVersionBean.isPublicAPI());
apiVersion.setPlans(apiVersionBean.getPlans());
apiVersion.setVersion(apiVersionBean.getVersion());
apiVersion.setDefinitionType(apiVersionBean.getDefinitionType());
return apiVersion;
}
use of io.apiman.manager.api.beans.apis.ApiBean in project apiman by apiman.
the class EsStorage method createApiVersion.
/**
* @see io.apiman.manager.api.core.IStorage#createApiVersion(io.apiman.manager.api.beans.apis.ApiVersionBean)
*/
@Override
public void createApiVersion(ApiVersionBean version) throws StorageException {
ApiBean api = version.getApi();
String id = id(api.getOrganization().getId(), api.getId(), version.getVersion());
indexEntity(INDEX_MANAGER_POSTFIX_API_VERSION, id, EsMarshalling.marshall(version));
PoliciesBean policies = PoliciesBean.from(PolicyType.Api, api.getOrganization().getId(), api.getId(), version.getVersion());
indexEntity(INDEX_MANAGER_POSTFIX_API_POLICIES, id, EsMarshalling.marshall(policies));
}
use of io.apiman.manager.api.beans.apis.ApiBean in project apiman by apiman.
the class EsStorage method getApi.
/**
* @see io.apiman.manager.api.core.IStorage#getApi(java.lang.String, java.lang.String)
*/
@Override
public ApiBean getApi(String organizationId, String id) throws StorageException {
Map<String, Object> source = getEntity(INDEX_MANAGER_POSTFIX_API, id(organizationId, id));
if (source == null) {
return null;
}
ApiBean bean = EsMarshalling.unmarshallApi(source);
bean.setOrganization(getOrganization(organizationId));
return bean;
}
use of io.apiman.manager.api.beans.apis.ApiBean in project apiman by apiman.
the class EsStorage method deleteApiVersion.
/**
* @see io.apiman.manager.api.core.IStorage#deleteApiVersion(io.apiman.manager.api.beans.apis.ApiVersionBean)
*/
@Override
public void deleteApiVersion(ApiVersionBean version) throws StorageException {
deleteApiDefinition(version);
ApiBean api = version.getApi();
String id = id(api.getOrganization().getId(), api.getId(), version.getVersion());
deleteEntity(INDEX_MANAGER_POSTFIX_API_VERSION, id);
deleteEntity(INDEX_MANAGER_POSTFIX_API_POLICIES, id);
}
use of io.apiman.manager.api.beans.apis.ApiBean in project apiman by apiman.
the class EsMarshallingTest method testMarshallApiBean.
/**
* Test method for {@link io.apiman.manager.api.es.EsMarshalling#marshall(io.apiman.manager.api.beans.apis.ApiBean)}.
*/
@Test
public void testMarshallApiBean() throws Exception {
ApiBean bean = createBean(ApiBean.class);
XContentBuilder builder = EsMarshalling.marshall(bean);
Assert.assertEquals("{\"organizationId\":\"ID\",\"organizationName\":\"NAME\",\"id\":\"ID\",\"name\":\"NAME\",\"description\":\"DESCRIPTION\",\"createdBy\":\"CREATEDBY\",\"createdOn\":1,\"numPublished\":11}", Strings.toString(builder));
}
Aggregations