Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Stardust/Knowledge Base/API/JavaAPICookbook/FetchingOrganizationOfProviderModel
< Stardust | Knowledge Base
Purpose
This article describes how to fetch Organizations, Departments and Particpants in a Multi model environment which involves consumer-provider hierarchy.
Solution
Approach 1:
// For each provider model of main model for(long oid : mainModel.getProviderModels()){ // Get the model DeployedModel providerModel = queryService.getModel(oid); // Get list of all organizations of provider model List<OrganizationDetails> orgDetails = providerModel.getAllOrganizations(); for(OrganizationDetails orgDetail : orgDetails) { System.out.println("Name" + orgDetail.getName()); }
Approach 2:
You can download sample FilterableAttributeImpl java source from here.
//Create Filterable query for Provider. FilterableAttribute PROVIDER = new FilterableAttributeImpl(DeployedModelQuery.class, "provider"); DeployedModelQuery query = DeployedModelQuery.findAll(); query.where(PROVIDER.isEqual("ACTIVE")); // Get all provider models Models models = qs.getModels(query) ; // For each model for(DeployedModelDescription model : models) { List<OrganizationDetails> orgDetails = model.getAllOrganizations(); for(OrganizationDetails orgDetail : orgDetails) { System.out.println("Name" + orgDetail.getName()); } }