Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Stardust/Knowledge Base/API/JavaAPICookbook/FetchingOrganizationOfProviderModel

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());
     	 }
}

Back to the top