use of io.jenkins.blueocean.rest.factory.organization.AbstractOrganization in project blueocean-plugin by jenkinsci.
the class OrganizationStatePreloader method getStateJson.
@Override
public String getStateJson() {
BlueOrganization organization = Iterables.getFirst(OrganizationFactory.getInstance().list(), null);
if (organization != null) {
// default is root group
String organizationGroup = "/";
if (organization instanceof AbstractOrganization) {
organizationGroup = "/" + ((AbstractOrganization) organization).getGroup().getFullName();
}
StringWriter writer = new StringWriter();
new JSONBuilder(writer).object().key("name").value(organization.getName()).key("displayName").value(organization.getDisplayName()).key("organizationGroup").value(organizationGroup).endObject();
return writer.toString();
} else {
// if will happen only when there is no implementation of BlueOrganization found.
return "{}";
}
}
Aggregations