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

Bugfix KNOWAGE-8149 #883

Merged
merged 7 commits into from
Oct 13, 2023
Merged

Bugfix KNOWAGE-8149 #883

merged 7 commits into from
Oct 13, 2023

Conversation

BojanSovticEngIT
Copy link
Contributor

Bugfix KNOWAGE-8149

Files changed:

  • knowage-api/src/main/java/it/eng/knowage/knowageapi/resource/FunctionCatalogResource.java
  • knowage-core/src/main/java/it/eng/knowage/backendservices/rest/widgets/PythonProxy.java
  • knowage-core/src/main/java/it/eng/spagobi/api/AbstractDocumentResource.java
  • knowage-core/src/main/java/it/eng/spagobi/api/BusinessModelResource.java
  • knowage-core/src/main/java/it/eng/spagobi/api/common/AbstractDataSetResource.java
  • knowage-core/src/main/java/it/eng/spagobi/api/v3/DataSetResource.java
  • knowagecockpitengine/src/main/java/it/eng/knowage/engine/cockpit/api/page/PageResource.java
  • knowageutils/src/main/java/it/eng/spagobi/utilities/engines/rest/SimpleRestClient.java

Possible false positives:

  • RestExceptionMapper.java
  • KnowageBusinessExceptionMapper.java
  • KnowageExceptionMapper.java
  • KnowageRuntimeExceptionMapper.java
  • knowagecockpitengine/src/main/java/it/eng/knowage/engine/interceptors/RestExceptionMapper.java
  • knowageqbeengine/src/main/java/it/eng/spagobi/rest/interceptors/RestExceptionMapper.java
  • knowagesvgviewerengine/src/main/java/it/eng/knowage/engines/svgviewer/interceptor/RestExceptionMapper.java
  • knowagewhatifengine/src/main/java/it/eng/spagobi/engines/whatif/exception/RestExceptionMapper.
    java

knowage-api/src/main/java/it/eng/knowage/knowageapi/resource/FunctionCatalogResource.java ([53]),
knowage-core/src/main/java/it/eng/knowage/backendservices/rest/widgets/PythonProxy.java ([47]),
knowage-core/src/main/java/it/eng/spagobi/api/AbstractDocumentResource.java ([49]),
knowage-core/src/main/java/it/eng/spagobi/api/BusinessModelResource.java ([104]),
knowage-core/src/main/java/it/eng/spagobi/api/common/AbstractDataSetResource.java ([128]),
Added annotations.
Removed annotations from private methods
Updated abstract classes
Copy link

@kerny3d kerny3d Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that this is a false positive too. The @get, @post and @put as all other HTTP methods annotations like PUT, PATH, DELETE, etc... don't make much sense when the class misses the @path annotation. The SimpleRestClient is just an utility class to let BE makes REST call to other services: it's not its self a REST service. I would ask you to commit only the formatted code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed @get, @post and @put

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to say, just a check: is the Eclipse formatter correctly set up or it was an already unformatted class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We set the Eclipse formatting with Davide Z., it should be exactly the same as you use it, but a lot of the (older) files are unformatted. This is a common issue when creating pull requests and looking for changes.

@@ -1048,7 +1048,7 @@ public String getDataSet(String label) {
}
}

public Response deleteDataset(String label) {
protected Response deleteDataset(String label) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's possible to use private? If there is no inheritance I would prefer the private modifier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can't be private, it is being used in DataSetResource.java (two files, one of them is v2).

@@ -1121,7 +1121,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
}
}

public Response execute(String label, String body) {
protected Response execute(String label, String body) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's possible to use private? If there is no inheritance I would prefer the private modifier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can't be private, it is being used in DataSetResource.java (two files, one of them is v2).

@@ -138,7 +139,7 @@ public Response delete(@PathParam("id") UUID id) {
}
}

@PATCH
@PUT
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it bug fixing? :-D Just kidding, great job.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you :)

@@ -50,7 +50,7 @@ public abstract class AbstractDocumentResource extends AbstractSpagoBIResource {

private static final Logger LOGGER = LogManager.getLogger(AbstractDocumentResource.class);

public Response insertDocument(String body) {
protected Response insertDocument(String body) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I would prefer private but this is an abstract class, we need a check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can't be private, it is being used in DocumentResource.java (two files, one of them is v2).

@@ -88,7 +88,7 @@ public Response insertDocument(String body) {
}
}

public Response getDocumentDetails(Object documentIdentifier) {
protected Response getDocumentDetails(Object documentIdentifier) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I would prefer private but this is an abstract class, we need a check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can't be private, it is being used in DocumentResource.java (two files, one of them is v2).

@@ -115,7 +115,7 @@ public Response getDocumentDetails(Object documentIdentifier) {

}

public Response updateDocument(String label, String body) {
protected Response updateDocument(String label, String body) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I would prefer private but this is an abstract class, we need a check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can't be private, it is being used in DocumentResource.java (two files, one of them is v2).

@@ -133,7 +133,7 @@ public Response updateDocument(String label, String body) {
return Response.ok().build();
}

public Response deleteDocument(@PathParam("label") String label) {
protected Response deleteDocument(@PathParam("label") String label) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I would prefer private but this is an abstract class, we need a check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can't be private, it is being used in DocumentResource.java (two files, one of them is v2).

@@ -167,7 +167,7 @@ protected Object getObjectIdentifier(String labelOrId) {
return documentIdentifier;
}

public Response getDocumentTemplate(String label) {
protected Response getDocumentTemplate(String label) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I would prefer private but this is an abstract class, we need a check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can't be private, it is being used in DocumentResource.java (two files, one of them is v2).

@@ -194,7 +194,7 @@ public Response getDocumentTemplate(String label) {
return rb.build();
}

public Response addDocumentTemplate(String label, MultiPartBody input) {
protected Response addDocumentTemplate(String label, MultiPartBody input) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I would prefer private but this is an abstract class, we need a check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can't be private, it is being used in DocumentResource.java (two files, one of them is v2).

@@ -229,7 +229,7 @@ public Response addDocumentTemplate(String label, MultiPartBody input) {

}

public Response deleteCurrentTemplate(String documentLabel) {
protected Response deleteCurrentTemplate(String documentLabel) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I would prefer private but this is an abstract class, we need a check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can't be private, it is being used in DocumentResource.java.

@@ -257,7 +257,7 @@ public Response deleteCurrentTemplate(String documentLabel) {
return Response.ok().build();
}

public Response deleteTemplateById(String documentLabel, Integer templateId) {
protected Response deleteTemplateById(String documentLabel, Integer templateId) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I would prefer private but this is an abstract class, we need a check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can't be private, it is being used in DocumentResource.java.

Copy link

@kerny3d kerny3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need some checks

@BojanSovticEngIT BojanSovticEngIT marked this pull request as draft October 13, 2023 12:04
Removed  @get, @post and @put since this is false positive.
@BojanSovticEngIT
Copy link
Contributor Author

knowageutils/src/main/java/it/eng/spagobi/utilities/engines/rest/SimpleRestClient.java

Hello @kerny3d, I reviewed all comments, I don't think any of the abstract methods can be changed from protected to private, they are already being used. I removed the annotations from the knowageutils/../SimpleRestClient.java and just left the formatted code.

@BojanSovticEngIT BojanSovticEngIT marked this pull request as ready for review October 13, 2023 12:37
@kerny3d kerny3d merged commit 25591e8 into KnowageLabs:master Oct 13, 2023
1 of 2 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants