A

Monday, January 24th, 2022 10:44 AM

The best autocomplete trick for eclipse! Get hints to java apis directly.

I know some people out there are still struggling to code workflows without any type of auto complete assistance. Here, I’m sharing with you the next step in autocomplete awesomeness!

I assume you have already installed Eclipse, the groovy developer tools, flowable, and loaded the latest dgc jar.

The problem

Whenever you want to use the collibra java apis, you have to import the class and instantiate it before you can use it.
  • It requires a lot of boilerplate code for every new script task
  • you need to add/remove that code every time you want to deploy
import com.collibra.dgc.core.api.component.instance.RelationApi

RelationApi relationApi = new RelationApi()

The Solution

  • In eclipse, open a new groovy file.
  • Type the name of variable you want to instantiate (e.g. relationApi
  • press ctrl + 1 to open the quick assist menu and select "Add inferencing suggestion"
  • Then fill in the details as described below

Tadaaaa!
Now you can write relationApi anywhere in a groovy script and eclipse will automatically know you’re talking about an instance of RelationApi.

image

Here is my file if you’re interested. Just replace in
~/eclipse-workspace/myDiagramsProject/.groovy/suggestions.xdsl

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<projectSuggestions>
    <declaringtype type="groovy.lang.Script">
        <property isActive="true" isStatic="false" name="item" type="com.collibra.dgc.workflow.api.bean.WorkflowBusinessItem"><doc/></property>
        <property isActive="true" isStatic="false" name="users" type="com.collibra.dgc.workflow.api.bean.WorkflowUsers"><doc/></property>
        <property isActive="true" isStatic="false" name="event" type="com.collibra.dgc.workflow.api.bean.WorkflowEvent"><doc/></property>
        <property isActive="true" isStatic="false" name="utility" type="com.collibra.dgc.workflow.api.bean.WorkflowUtility"><doc/></property>
        <property isActive="true" isStatic="false" name="mail" type="com.collibra.dgc.workflow.api.bean.WorkflowMail"><doc/></property>
        <property isActive="true" isStatic="false" name="translation" type="com.collibra.dgc.workflow.api.bean.WorkflowTranslation"><doc/></property>
        <property isActive="true" isStatic="false" name="activityStreamApi" type="com.collibra.dgc.core.api.component.activitystream.ActivityStreamApi"><doc/></property>
        <property isActive="true" isStatic="false" name="applicationApi" type="com.collibra.dgc.core.api.component.application.ApplicationApi"><doc/></property>
        <property isActive="true" isStatic="false" name="assetApi" type="com.collibra.dgc.core.api.component.instance.AssetApi"><doc/></property>
        <property isActive="true" isStatic="false" name="assetTypeApi" type="com.collibra.dgc.core.api.component.meta.AssetTypeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="assignmentApi" type="com.collibra.dgc.core.api.component.assignment.AssignmentApi"><doc/></property>
        <property isActive="true" isStatic="false" name="attachmentApi" type="com.collibra.dgc.core.api.component.instance.AttachmentApi"><doc/></property>
        <property isActive="true" isStatic="false" name="attributeApi" type="com.collibra.dgc.core.api.component.instance.AttributeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="attributeTypeApi" type="com.collibra.dgc.core.api.component.meta.AttributeTypeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="breadcrumbApi" type="com.collibra.dgc.core.api.component.breadcrumb.BreadcrumbApi"><doc/></property>
        <property isActive="true" isStatic="false" name="commentApi" type="com.collibra.dgc.core.api.component.instance.CommentApi"><doc/></property>
        <property isActive="true" isStatic="false" name="communityApi" type="com.collibra.dgc.core.api.component.instance.CommunityApi"><doc/></property>
        <property isActive="true" isStatic="false" name="complexRelationApi" type="com.collibra.dgc.core.api.component.instance.ComplexRelationApi"><doc/></property>
        <property isActive="true" isStatic="false" name="complexRelationTypeApi" type="com.collibra.dgc.core.api.component.meta.ComplexRelationTypeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="customizationApi" type="com.collibra.dgc.core.api.component.customization.CustomizationApi"><doc/></property>
        <property isActive="true" isStatic="false" name="dataQualityRuleApi" type="com.collibra.dgc.core.api.component.quality.DataQualityRuleApi"><doc/></property>
        <property isActive="true" isStatic="false" name="diagramPictureApi" type="com.collibra.dgc.core.api.component.diagram.DiagramPictureApi"><doc/></property>
        <property isActive="true" isStatic="false" name="domainApi" type="com.collibra.dgc.core.api.component.instance.DomainApi"><doc/></property>
        <property isActive="true" isStatic="false" name="domainTypeApi" type="com.collibra.dgc.core.api.component.meta.DomainTypeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="fileApi" type="com.collibra.dgc.core.api.component.file.FileApi"><doc/></property>
        <property isActive="true" isStatic="false" name="issueApi" type="com.collibra.dgc.core.api.component.instance.IssueApi"><doc/></property>
        <property isActive="true" isStatic="false" name="jobApi" type="com.collibra.dgc.core.api.component.job.JobApi"><doc/></property>
        <property isActive="true" isStatic="false" name="loggerApi" type="com.collibra.dgc.core.api.component.logger.LoggerApi"><doc/></property>
        <property isActive="true" isStatic="false" name="mappingApi" type="com.collibra.dgc.core.api.component.mapping.MappingApi"><doc/></property>
        <property isActive="true" isStatic="false" name="navigationStatisticsApi" type="com.collibra.dgc.core.api.component.navigation.NavigationStatisticsApi"><doc/></property>
        <property isActive="true" isStatic="false" name="outputModuleApi" type="com.collibra.dgc.core.api.component.query.outputmodule.OutputModuleApi"><doc/></property>
        <property isActive="true" isStatic="false" name="ratingApi" type="com.collibra.dgc.core.api.component.instance.RatingApi"><doc/></property>
        <property isActive="true" isStatic="false" name="relationApi" type="com.collibra.dgc.core.api.component.instance.RelationApi"><doc/></property>
        <property isActive="true" isStatic="false" name="relationTypeApi" type="com.collibra.dgc.core.api.component.meta.RelationTypeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="reportingApi" type="com.collibra.dgc.core.api.component.reporting.ReportingApi"><doc/></property>
        <property isActive="true" isStatic="false" name="responsibilityApi" type="com.collibra.dgc.core.api.component.instance.ResponsibilityApi"><doc/></property>
        <property isActive="true" isStatic="false" name="roleApi" type="com.collibra.dgc.core.api.component.role.RoleApi"><doc/></property>
        <property isActive="true" isStatic="false" name="samlApi" type="com.collibra.dgc.core.api.component.security.saml.SamlApi"><doc/></property>
        <property isActive="true" isStatic="false" name="scopeApi" type="com.collibra.dgc.core.api.component.assignment.ScopeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="statusApi" type="com.collibra.dgc.core.api.component.meta.StatusApi"><doc/></property>
        <property isActive="true" isStatic="false" name="tagApi" type="com.collibra.dgc.core.api.component.tag.TagApi"><doc/></property>
        <property isActive="true" isStatic="false" name="userApi" type="com.collibra.dgc.core.api.component.user.UserApi"><doc/></property>
        <property isActive="true" isStatic="false" name="userGroupApi" type="com.collibra.dgc.core.api.component.usergroup.UserGroupApi"><doc/></property>
        <property isActive="true" isStatic="false" name="validationApi" type="com.collibra.dgc.core.api.component.validation.ValidationApi"><doc/></property>
        <property isActive="true" isStatic="false" name="viewPermissionApi" type="com.collibra.dgc.core.api.component.viewpermission.ViewPermissionApi"><doc/></property>
        <property isActive="true" isStatic="false" name="workflowDefinitionApi" type="com.collibra.dgc.core.api.component.workflow.WorkflowDefinitionApi"><doc/></property>
        <property isActive="true" isStatic="false" name="workflowInstanceApi" type="com.collibra.dgc.core.api.component.workflow.WorkflowInstanceApi"><doc/></property>
        <property isActive="true" isStatic="false" name="workflowTaskApi" type="com.collibra.dgc.core.api.component.workflow.WorkflowTaskApi"><doc/></property>
    </declaringtype>
</projectSuggestions>

23 Messages

2 years ago

Really good thread to help autocomplete groovy code.

1.2K Messages

2 years ago

Very cool!
I wonder if there is an equivalent for VS Code…I ended up moving to writing most of my workflows by hand in XML for the most part as a lot of my workflows are script heavy.
Eclipse is such a big IDE to load up for simply moving a few boxes around!

1.2K Messages

If your workflows are script heavy, you might really enjoy the approach I’m using in eclipse: Workflow variables data types - :question:Product Q&A - The Data Citizens Community (collibra.com)

This is quite an old post (oct '20), but the logic has remained stable until today.

  1. All my workflows are neatly organized (I sort them into folders by nature and destination - e.g. "myCompany - UseCase1), and all the code remains very structured. Git management is easy peasy.
  2. I can easily update the script code (without any copy/paste)
  3. I can deploy directly from my IDE, without fiddling with the Collibra UI

I’m very happy with my setup, it has proven to be a very productive utility over my time working with Collibra.

image

Happy to have a talk with you on that topic if you’re interested.

4 Messages

Hello Arthur,

Can you help me with the same, also i am struggling how to add the suggestions file.

1.2K Messages

Well, what are you struggling with? The instructions are as clear as possible.

4 Messages

How to add those references for apis all in one go? Also how are you deploying the wfs from IDE? using workflow manager?

1.2K Messages

2 years ago

Hey Arthur,

I have seen that post, another excellent one for the community :slight_smile:
I have done something similar myself using python to add in reusable functions / deploy to DGC automatically. Given I don’t work in Collibra full time, I tend to just do some quick edits in workflows in XML and deploy where needed, but the autocomplete would be the cherry on top :slight_smile:
As I don’t use Eclipse for anything else, I try to avoid it where I can and only open it up when I have to move some boxes around / add new tasks in. Otherwise I have a range of templated “go to” workflows that I either start from or can copy and paste sections and stitch together in XML.

1.2K Messages

1 year ago


No, I have developed a custom python library to handle this. Workflow variables data types - :question:Product Q&A - the Data Citizens community (collibra.com)

1.2K Messages

11 months ago

Update: execution and importApi

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<projectSuggestions>
    <declaringtype type="groovy.lang.Script">
        <property isActive="true" isStatic="false" name="item" type="com.collibra.dgc.workflow.api.bean.WorkflowBusinessItem"><doc/></property>
        <property isActive="true" isStatic="false" name="users" type="com.collibra.dgc.workflow.api.bean.WorkflowUsers"><doc/></property>
        <property isActive="true" isStatic="false" name="event" type="com.collibra.dgc.workflow.api.bean.WorkflowEvent"><doc/></property>
        <property isActive="true" isStatic="false" name="utility" type="com.collibra.dgc.workflow.api.bean.WorkflowUtility"><doc/></property>
        <property isActive="true" isStatic="false" name="mail" type="com.collibra.dgc.workflow.api.bean.WorkflowMail"><doc/></property>
        <property isActive="true" isStatic="false" name="translation" type="com.collibra.dgc.workflow.api.bean.WorkflowTranslation"><doc/></property>
        <property isActive="true" isStatic="false" name="activityStreamApi" type="com.collibra.dgc.core.api.component.activitystream.ActivityStreamApi"><doc/></property>
        <property isActive="true" isStatic="false" name="applicationApi" type="com.collibra.dgc.core.api.component.application.ApplicationApi"><doc/></property>
        <property isActive="true" isStatic="false" name="assetApi" type="com.collibra.dgc.core.api.component.instance.AssetApi"><doc/></property>
        <property isActive="true" isStatic="false" name="assetTypeApi" type="com.collibra.dgc.core.api.component.meta.AssetTypeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="assignmentApi" type="com.collibra.dgc.core.api.component.assignment.AssignmentApi"><doc/></property>
        <property isActive="true" isStatic="false" name="attachmentApi" type="com.collibra.dgc.core.api.component.instance.AttachmentApi"><doc/></property>
        <property isActive="true" isStatic="false" name="attributeApi" type="com.collibra.dgc.core.api.component.instance.AttributeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="attributeTypeApi" type="com.collibra.dgc.core.api.component.meta.AttributeTypeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="breadcrumbApi" type="com.collibra.dgc.core.api.component.breadcrumb.BreadcrumbApi"><doc/></property>
        <property isActive="true" isStatic="false" name="commentApi" type="com.collibra.dgc.core.api.component.instance.CommentApi"><doc/></property>
        <property isActive="true" isStatic="false" name="communityApi" type="com.collibra.dgc.core.api.component.instance.CommunityApi"><doc/></property>
        <property isActive="true" isStatic="false" name="complexRelationApi" type="com.collibra.dgc.core.api.component.instance.ComplexRelationApi"><doc/></property>
        <property isActive="true" isStatic="false" name="complexRelationTypeApi" type="com.collibra.dgc.core.api.component.meta.ComplexRelationTypeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="customizationApi" type="com.collibra.dgc.core.api.component.customization.CustomizationApi"><doc/></property>
        <property isActive="true" isStatic="false" name="dataQualityRuleApi" type="com.collibra.dgc.core.api.component.quality.DataQualityRuleApi"><doc/></property>
        <property isActive="true" isStatic="false" name="diagramPictureApi" type="com.collibra.dgc.core.api.component.diagram.DiagramPictureApi"><doc/></property>
        <property isActive="true" isStatic="false" name="domainApi" type="com.collibra.dgc.core.api.component.instance.DomainApi"><doc/></property>
        <property isActive="true" isStatic="false" name="domainTypeApi" type="com.collibra.dgc.core.api.component.meta.DomainTypeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="fileApi" type="com.collibra.dgc.core.api.component.file.FileApi"><doc/></property>
        <property isActive="true" isStatic="false" name="issueApi" type="com.collibra.dgc.core.api.component.instance.IssueApi"><doc/></property>
        <property isActive="true" isStatic="false" name="jobApi" type="com.collibra.dgc.core.api.component.job.JobApi"><doc/></property>
        <property isActive="true" isStatic="false" name="loggerApi" type="com.collibra.dgc.core.api.component.logger.LoggerApi"><doc/></property>
        <property isActive="true" isStatic="false" name="mappingApi" type="com.collibra.dgc.core.api.component.mapping.MappingApi"><doc/></property>
        <property isActive="true" isStatic="false" name="navigationStatisticsApi" type="com.collibra.dgc.core.api.component.navigation.NavigationStatisticsApi"><doc/></property>
        <property isActive="true" isStatic="false" name="outputModuleApi" type="com.collibra.dgc.core.api.component.query.outputmodule.OutputModuleApi"><doc/></property>
        <property isActive="true" isStatic="false" name="ratingApi" type="com.collibra.dgc.core.api.component.instance.RatingApi"><doc/></property>
        <property isActive="true" isStatic="false" name="relationApi" type="com.collibra.dgc.core.api.component.instance.RelationApi"><doc/></property>
        <property isActive="true" isStatic="false" name="relationTypeApi" type="com.collibra.dgc.core.api.component.meta.RelationTypeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="reportingApi" type="com.collibra.dgc.core.api.component.reporting.ReportingApi"><doc/></property>
        <property isActive="true" isStatic="false" name="responsibilityApi" type="com.collibra.dgc.core.api.component.instance.ResponsibilityApi"><doc/></property>
        <property isActive="true" isStatic="false" name="roleApi" type="com.collibra.dgc.core.api.component.role.RoleApi"><doc/></property>
        <property isActive="true" isStatic="false" name="samlApi" type="com.collibra.dgc.core.api.component.security.saml.SamlApi"><doc/></property>
        <property isActive="true" isStatic="false" name="scopeApi" type="com.collibra.dgc.core.api.component.assignment.ScopeApi"><doc/></property>
        <property isActive="true" isStatic="false" name="statusApi" type="com.collibra.dgc.core.api.component.meta.StatusApi"><doc/></property>
        <property isActive="true" isStatic="false" name="tagApi" type="com.collibra.dgc.core.api.component.tag.TagApi"><doc/></property>
        <property isActive="true" isStatic="false" name="userApi" type="com.collibra.dgc.core.api.component.user.UserApi"><doc/></property>
        <property isActive="true" isStatic="false" name="userGroupApi" type="com.collibra.dgc.core.api.component.usergroup.UserGroupApi"><doc/></property>
        <property isActive="true" isStatic="false" name="validationApi" type="com.collibra.dgc.core.api.component.validation.ValidationApi"><doc/></property>
        <property isActive="true" isStatic="false" name="viewPermissionApi" type="com.collibra.dgc.core.api.component.viewpermission.ViewPermissionApi"><doc/></property>
        <property isActive="true" isStatic="false" name="workflowDefinitionApi" type="com.collibra.dgc.core.api.component.workflow.WorkflowDefinitionApi"><doc/></property>
        <property isActive="true" isStatic="false" name="workflowInstanceApi" type="com.collibra.dgc.core.api.component.workflow.WorkflowInstanceApi"><doc/></property>
        <property isActive="true" isStatic="false" name="workflowTaskApi" type="com.collibra.dgc.core.api.component.workflow.WorkflowTaskApi"><doc/></property>
        <property isActive="true" isStatic="false" name="execution" type="org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl"><doc/></property>
        <property isActive="true" isStatic="false" name="importerApi" type="com.collibra.dgc.importer.api.ImporterApi"><doc/></property>
    </declaringtype>
</projectSuggestions>

11 Messages

 • 

700 Points

Hi Arthur,
Very Nice Article. This almost made me to think to switch from Intellij to Eclipse, by any chance do you know any any way to get auto suggestions for the IDEA?

Loading...