use of io.apiman.manager.api.beans.orgs.OrganizationBean in project apiman by apiman.
the class StorageExporter method minifyApi.
/**
* @param api
*/
private ApiVersionBean minifyApi(ApiVersionBean api) {
ApiVersionBean rval = new ApiVersionBean();
rval.setVersion(api.getVersion());
rval.setApi(new ApiBean());
rval.getApi().setId(api.getApi().getId());
rval.getApi().setOrganization(new OrganizationBean());
rval.getApi().getOrganization().setId(api.getApi().getOrganization().getId());
return rval;
}
use of io.apiman.manager.api.beans.orgs.OrganizationBean in project apiman by apiman.
the class StorageImportDispatcher method clientContract.
/**
* @see io.apiman.manager.api.exportimport.read.IImportReaderDispatcher#clientContract(io.apiman.manager.api.beans.contracts.ContractBean)
*/
@Override
public void clientContract(ContractBean contract) {
ClientVersionBean clientVersion = new ClientVersionBean();
clientVersion.setClient(new ClientBean());
clientVersion.getClient().setOrganization(new OrganizationBean());
clientVersion.getClient().setId(currentClient.getId());
clientVersion.getClient().getOrganization().setId(currentOrg.getId());
clientVersion.setVersion(currentClientVersion.getVersion());
contract.setClient(clientVersion);
contracts.add(contract);
}
use of io.apiman.manager.api.beans.orgs.OrganizationBean in project apiman by apiman.
the class JsonImportReader method readOrgs.
public void readOrgs() throws Exception {
current = nextToken();
if (current == JsonToken.END_ARRAY) {
return;
}
while (nextToken() != JsonToken.END_ARRAY) {
// Traverse each org definition
while (nextToken() != JsonToken.END_OBJECT) {
if (jp.getCurrentName().equals(OrganizationBean.class.getSimpleName())) {
current = nextToken();
OrganizationBean orgBean = jp.readValueAs(OrganizationBean.class);
dispatcher.organization(orgBean);
} else {
OrgElementsEnum fieldName = OrgElementsEnum.valueOf(jp.getCurrentName());
current = nextToken();
switch(fieldName) {
case Memberships:
processEntities(RoleMembershipBean.class, dispatcher::membership);
break;
case Plans:
readPlans();
break;
case Apis:
readApis();
break;
case Clients:
readClients();
break;
case Audits:
processEntities(AuditEntryBean.class, dispatcher::audit);
break;
default:
throw new RuntimeException("Unhandled entity " + fieldName + " with token " + current);
}
}
}
}
}
use of io.apiman.manager.api.beans.orgs.OrganizationBean in project apiman by apiman.
the class StorageExporter method exportOrgs.
private void exportOrgs() {
try {
writer.startOrgs();
Iterator<OrganizationBean> iter = storage.getAllOrganizations();
int foo = 0;
while (iter.hasNext()) {
OrganizationBean bean = iter.next();
writer.startOrg(bean);
// $NON-NLS-1$
logger.info(Messages.i18n.format("StorageExporter.ExportingOrgs") + bean);
exportMemberships(bean.getId());
exportPlans(bean.getId());
exportApis(bean.getId());
exportClients(bean.getId());
exportAudits(bean.getId());
writer.endOrg();
}
writer.endOrgs();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of io.apiman.manager.api.beans.orgs.OrganizationBean in project apiman by apiman.
the class EntityValidator method determineStatus.
@Override
public ClientStatus determineStatus(ClientVersionBean bean) throws StorageException {
OrganizationBean orgBean = bean.getClient().getOrganization();
ClientBean cb = bean.getClient();
ArrayList<ContractBean> contracts = Lists.newArrayList(storage.getAllContracts(orgBean.getId(), cb.getId(), bean.getVersion()));
return determineStatus(bean, contracts);
}
Aggregations