Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard Naming of DvObject types #2490

Closed
raprasad opened this issue Sep 2, 2015 · 2 comments
Closed

Standard Naming of DvObject types #2490

raprasad opened this issue Sep 2, 2015 · 2 comments
Labels
Component: Code Infrastructure formerly "Feature: Code Infrastructure" Type: Suggestion an idea

Comments

@raprasad
Copy link
Contributor

raprasad commented Sep 2, 2015

The project has 4 different naming conventions for the same object types. Even if the number of naming conventions is not reduced, static variables should be used across the project. (It would help to cut it to 2 or at least 3 naming conventions)

It is easy to make programming errors when comparing objects types across postgres, solr results, etc.

Postgres dtype (db value and DvObject.java) Solr Index Names (SearchConstants.java) Search API (SearchConstants.java) Web UI as facets (SearchConstants.java)
Dataverse dataverses dataverse Dataverses
Dataset datasets dataset Datasets
DataFile files file Files

Note: In addition, the static variables for the strings above are not always used. Ther are many instances of simply using strings.

This is a side effect of the 'rapid development' in the winter

Some examples of using strings

Dataverses.java

         jab.add( Json.createObjectBuilder().add("type", "dataverse")

Index.java

            if (type.equals("dataverses")) {

DataTagsAPI.java

        JsonObject jsonInfo = endpoint.queryParam("repositoryName", "Dataverse")

IndexServiceBean.java

       solrInputDocument.addField(SearchFields.TYPE, "dataverses");

SearchServiceBean.java

            if (type.equals("dataverses")) {

(etc, etc, etc)

@raprasad raprasad added Type: Suggestion an idea Priority: High Type: Bug a defect Component: Code Infrastructure formerly "Feature: Code Infrastructure" and removed Type: Suggestion an idea labels Sep 2, 2015
@bencomp
Copy link
Contributor

bencomp commented Sep 14, 2015

👍 !

This is one for the (now closed) #775. I added it to the Style Guide:

Use constants when comparing a string value with reference values

@mercecrosas mercecrosas modified the milestone: In Review Nov 30, 2015
@scolapasta scolapasta removed this from the Not Assigned to a Release milestone Jan 28, 2016
@kcondon kcondon added Type: Suggestion an idea and removed Type: Bug a defect labels Apr 12, 2016
@pdurbin pdurbin removed the zTriaged label Jun 30, 2017
@pdurbin
Copy link
Member

pdurbin commented Jul 12, 2018

Yes, it's ugly but we're living with it. If someone wants to champion this issue, please open a new one. Closing.

@pdurbin pdurbin closed this as completed Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Code Infrastructure formerly "Feature: Code Infrastructure" Type: Suggestion an idea
Projects
None yet
Development

No branches or pull requests

7 participants