Skip to content

Commit

Permalink
ATLAS-4959: checkstyle compliance updates - atlas-graphdb modules (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
mneethiraj authored Jan 26, 2025
1 parent 56feecf commit 6c2cbaa
Show file tree
Hide file tree
Showing 95 changed files with 2,886 additions and 2,936 deletions.
2 changes: 2 additions & 0 deletions dev-support/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@
<suppress files="[\\/]surefire-reports[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="AtlasClient.java" checks="TypeName"/>
<suppress files="AtlasClientV2.java" checks="TypeName"/>
<suppress files="AtlasGraph.java" checks="MethodName"/>
<suppress files="AtlasGraphTraversalSource.java" checks="MethodName"/>
<suppress files="Id.java" checks="MethodName"/>
</suppressions>
5 changes: 5 additions & 0 deletions graphdb/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
<name>Apache Atlas Graph Database API</name>
<description>Apache Atlas Graph Datbase API</description>

<properties>
<checkstyle.failOnViolation>true</checkstyle.failOnViolation>
<checkstyle.skip>false</checkstyle.skip>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.atlas</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,7 @@ public class AggregationContext {
* @param indexFieldNameCache
* @param excludeDeletedEntities a boolean flag to indicate if the deleted entities need to be excluded in search
*/
public AggregationContext(String queryString,
FilterCriteria filterCriteria,
Set<AtlasEntityType> searchForEntityType,
Set<String> aggregationFieldNames,
Set<AtlasAttribute> aggregationAttributes,
Map<String, String> indexFieldNameCache,
boolean excludeDeletedEntities,
boolean includeSubTypes) {
public AggregationContext(String queryString, FilterCriteria filterCriteria, Set<AtlasEntityType> searchForEntityType, Set<String> aggregationFieldNames, Set<AtlasAttribute> aggregationAttributes, Map<String, String> indexFieldNameCache, boolean excludeDeletedEntities, boolean includeSubTypes) {
this.queryString = queryString;
this.filterCriteria = filterCriteria;
this.searchForEntityTypes = searchForEntityType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -26,10 +26,12 @@ public enum AtlasCardinality {
LIST(true),
SET(true);

private boolean isMany;
private final boolean isMany;

AtlasCardinality(boolean isMany) {
this.isMany = isMany;
}

public boolean isMany() {
return isMany;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -25,18 +25,15 @@
* @param <E> edge class used by the graph
*/
public interface AtlasEdge<V, E> extends AtlasElement {

/**
* Gets the incoming vertex for this edge.
* @param in
* @return
*/
AtlasVertex<V, E> getInVertex();

/**
* Gets the outgoing vertex for this edge.
*
* @param in
* @return
*/
AtlasVertex<V, E> getOutVertex();
Expand All @@ -56,5 +53,4 @@ public interface AtlasEdge<V, E> extends AtlasElement {
* @return
*/
E getE();

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -17,6 +17,7 @@
*/

package org.apache.atlas.repository.graphdb;

/**
* Enumeration of edge directions to query for.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -23,6 +23,5 @@
*
*/
public interface AtlasEdgeLabel {

String getName();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -18,19 +18,18 @@

package org.apache.atlas.repository.graphdb;

import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;

import java.util.Collection;
import java.util.List;
import java.util.Set;

import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;

/**
* Represents a graph element.
*
*/
public interface AtlasElement {

/**
* Gets the id of this element. If the object has not been physically created in the underlying graph,
* calling this method will force the element to be created so that a valid Id can be returned.
Expand Down Expand Up @@ -86,7 +85,6 @@ public interface AtlasElement {
*/
void setListProperty(String propertyName, List<String> values);


/**
* Sets a multiplicity one property whose effective value is a String list whose
* values consist of the ids of the supplied elements. This is implemented efficiently
Expand All @@ -104,7 +102,6 @@ public interface AtlasElement {
*/
void setPropertyFromElementId(String propertyName, AtlasElement value);


/**
* Removes a property from the vertex.
*/
Expand All @@ -130,7 +127,6 @@ public interface AtlasElement {
*/
<T> void setProperty(String propertyName, T value);


/**
* Creates a Jettison JSONObject from this Element.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -24,6 +24,7 @@

import javax.script.ScriptEngine;
import javax.script.ScriptException;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;
Expand All @@ -36,7 +37,6 @@
* @param <E> edge implementation class
*/
public interface AtlasGraph<V, E> {

/**
* Adds an edge to the graph.
*
Expand All @@ -54,13 +54,13 @@ public interface AtlasGraph<V, E> {
* @param relationshipLabel
* @return
*/
AtlasEdge<V, E> getEdgeBetweenVertices(AtlasVertex fromVertex, AtlasVertex toVertex, String relationshipLabel);
AtlasEdge<V, E> getEdgeBetweenVertices(AtlasVertex<V, E> fromVertex, AtlasVertex<V, E> toVertex, String relationshipLabel);

/**
* Adds a vertex to the graph.
*
* @return
*/
/**
* Adds a vertex to the graph.
*
* @return
*/
AtlasVertex<V, E> addVertex();

/**
Expand Down Expand Up @@ -123,7 +123,6 @@ public interface AtlasGraph<V, E> {
*/
Set<String> getEdgeIndexKeys();


/**
* Gets the names of the indexes on vertices.
* type.
Expand All @@ -132,7 +131,6 @@ public interface AtlasGraph<V, E> {
*/
Set<String> getVertexIndexKeys();


/**
* Finds the vertices where the given property key
* has the specified value. For multi-valued properties,
Expand All @@ -156,9 +154,9 @@ public interface AtlasGraph<V, E> {
* Start a graph traversal
* @return
*/
AtlasGraphTraversal<AtlasVertex, AtlasEdge> V(Object ... vertexIds);
AtlasGraphTraversal<AtlasVertex<?, ?>, AtlasEdge<?, ?>> V(Object... vertexIds);

AtlasGraphTraversal<AtlasVertex, AtlasEdge> E(Object ... edgeIds);
AtlasGraphTraversal<AtlasVertex<?, ?>, AtlasEdge<?, ?>> E(Object... edgeIds);

/**
* Creates an index query.
Expand Down Expand Up @@ -228,7 +226,7 @@ public interface AtlasGraph<V, E> {
/**
* Gets all open transactions.
*/
Set getOpenTransactions();
Set<?> getOpenTransactions();

/**
* Converts the graph to gson and writes it to the specified stream.
Expand Down Expand Up @@ -336,8 +334,7 @@ public interface AtlasGraph<V, E> {
*
* @throws ScriptException
*/
Object executeGremlinScript(ScriptEngine scriptEngine, Map<? extends String, ? extends Object> bindings, String query, boolean isPath) throws ScriptException;

Object executeGremlinScript(ScriptEngine scriptEngine, Map<? extends String, ? extends Object> bindings, String query, boolean isPath) throws ScriptException;

/**
* Convenience method to check whether the given property is
Expand All @@ -361,5 +358,5 @@ public interface AtlasGraph<V, E> {
* @return the graph index client
* @throws AtlasException when error encountered in creating the client.
*/
AtlasGraphIndexClient getGraphIndexClient()throws AtlasException;
AtlasGraphIndexClient getGraphIndexClient() throws AtlasException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -24,14 +24,12 @@
* Represents a graph index on the database.
*/
public interface AtlasGraphIndex {

/**
* Indicates if the index is a mixed index.
* @return
*/
boolean isMixedIndex();


/**
* Indicates if the index is a composite index.
* @return
Expand All @@ -52,10 +50,7 @@ public interface AtlasGraphIndex {
*/
boolean isVertexIndex();



boolean isUnique();

Set<AtlasPropertyKey> getFieldKeys();

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,41 @@
* Represents a graph client work with indices used by Jansgraph.
*/
public interface AtlasGraphIndexClient {

/**
* Gets aggregated metrics for the given query string and aggregation field names.
*
* @return A map of aggregation field to value-count pairs.
*/
Map<String, List<AtlasAggregationEntry>> getAggregatedMetrics(AggregationContext aggregationContext);

/**
* Returns top 5 suggestions for the given prefix string.
*
* @param prefixString the prefix string whose value needs to be retrieved.
* @param indexFieldName the indexed field name from which to retrieve suggestions
* @return top 5 suggestion strings with prefix String
*/
List<String> getSuggestions(String prefixString, String indexFieldName);

/**
* The implementers should apply the search weights for the passed in properties.
* @param collectionName the name of the collection for which the search weight needs to be applied
* @param indexFieldName2SearchWeightMap the map containing search weights from index field name to search weights.
* The implementers should apply the search weights for the passed in properties.
*
* @param collectionName the name of the collection for which the search weight needs to be applied
* @param indexFieldName2SearchWeightMap the map containing search weights from index field name to search weights.
*/
void applySearchWeight(String collectionName, Map<String, Integer> indexFieldName2SearchWeightMap);

/**
* The implementors should take the passed in list of suggestion properties for suggestions functionality.
*
* @param collectionName the name of the collection to which the suggestions properties should be applied to.
* @param suggestionProperties the list of suggestion properties.
*/
void applySuggestionFields(String collectionName, List<String> suggestionProperties);

/**
* Returns status of index client
*
* @return returns true if index client is active
*/
boolean isHealthy();
Expand Down
Loading

0 comments on commit 6c2cbaa

Please sign in to comment.