-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do initial refactor of data dictionary service (#8)
* Perform an initial refactor of the data dictionary service with the following goals: - Reduce method signature size between DataDictionaryOperations and DataDictionary with ConnectionConfig class. - Extract DefaultMetadataField transformation to separate class to improve code clarity and make testing easier. - Reduce duplicated code where possible. - Add more unit tests and documentation.
- Loading branch information
Showing
8 changed files
with
1,192 additions
and
507 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 55 additions & 80 deletions
135
service/src/main/java/datawave/microservice/dictionary/DataDictionaryOperations.java
Large diffs are not rendered by default.
Oops, something went wrong.
85 changes: 85 additions & 0 deletions
85
service/src/main/java/datawave/microservice/dictionary/data/ConnectionConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package datawave.microservice.dictionary.data; | ||
|
||
import org.apache.accumulo.core.client.Connector; | ||
import org.apache.accumulo.core.security.Authorizations; | ||
import org.apache.commons.lang.builder.ToStringBuilder; | ||
|
||
import java.util.Objects; | ||
import java.util.Set; | ||
|
||
public class ConnectionConfig { | ||
|
||
private Connector connector; | ||
|
||
private Set<Authorizations> auths; | ||
|
||
private String metadataTable; | ||
|
||
private String modelTable; | ||
|
||
private String modelName; | ||
|
||
public Connector getConnector() { | ||
return connector; | ||
} | ||
|
||
public void setConnector(Connector connector) { | ||
this.connector = connector; | ||
} | ||
|
||
public Set<Authorizations> getAuths() { | ||
return auths; | ||
} | ||
|
||
public void setAuths(Set<Authorizations> authorizations) { | ||
this.auths = authorizations; | ||
} | ||
|
||
public String getMetadataTable() { | ||
return metadataTable; | ||
} | ||
|
||
public void setMetadataTable(String metadataTable) { | ||
this.metadataTable = metadataTable; | ||
} | ||
|
||
public String getModelTable() { | ||
return modelTable; | ||
} | ||
|
||
public void setModelTable(String modelTable) { | ||
this.modelTable = modelTable; | ||
} | ||
|
||
public String getModelName() { | ||
return modelName; | ||
} | ||
|
||
public void setModelName(String modelName) { | ||
this.modelName = modelName; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
ConnectionConfig that = (ConnectionConfig) o; | ||
return Objects.equals(connector, that.connector) && Objects.equals(auths, that.auths) && Objects.equals(metadataTable, that.metadataTable) | ||
&& Objects.equals(modelTable, that.modelTable) && Objects.equals(modelName, that.modelName); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(connector, auths, metadataTable, modelTable, modelName); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return new ToStringBuilder(this).append("connector", connector).append("auths", auths).append("metadataTable", metadataTable) | ||
.append("modelTable", modelTable).append("modelName", modelName).toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.