Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot] ba2d773933
Bump jackson-databind from 2.11.1 to 2.12.7.1
Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.11.1 to 2.12.7.1.
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-16 01:48:45 +00:00
5 changed files with 121 additions and 101 deletions

View File

@ -21,8 +21,6 @@ Run the `run.sh`
Assuming you're running the server locally, go to [http://localhost:8080/core/2.0.0/$metadata](http://localhost:8080/core/2.0.0/$metadata)\
Otherwise, you will have to replace `localhost` with the IP of your Docker machine.
![](https://cdn.ossez.com/discourse-uploads/optimized/2X/8/881469dc9b204975de209b56f0d897ba8b782347_2_690x439.png)
## Running with a different database
If you set the `SQL_HOST` Environment Variable, then the build script will not build the test database.

View File

@ -11,14 +11,14 @@ plugins {
repositories {
mavenLocal()
maven {
url = uri('https://repo.ossez.com/repository/maven-public/')
url = uri('https://repo.maven.apache.org/maven2/')
}
}
dependencies {
implementation 'org.postgresql:postgresql:42.2.23'
implementation 'org.apache.olingo:odata-server-api:4.8.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.1'
implementation 'org.apache.olingo:odata-commons-api:4.8.0'
implementation 'org.apache.olingo:odata-commons-core:4.8.0'
implementation 'org.slf4j:slf4j-api:1.7.11'

View File

@ -1,11 +1,11 @@
FROM ubuntu:22.04
FROM ubuntu:20.10
WORKDIR /usr/src/app
# Comment next line out for Windows builds
#ARG DEBIAN_FRONTEND=noninteractive
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y wget openjdk-8-jdk curl pip maven docker-compose
# Needed for Windows builds
RUN update-java-alternatives -s java-1.8.0-openjdk-amd64
#RUN update-java-alternatives -s java-1.8.0-openjdk-amd64
CMD sh /usr/src/app/docker/scripts/build.sh

View File

@ -11,8 +11,8 @@
<packaging>war</packaging>
<properties>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<junit.version>5.7.0</junit.version>
<javax.version>2.5</javax.version>
<odata.version>4.8.0</odata.version>
@ -54,7 +54,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.11.1</version>
<version>2.12.7.1</version>
</dependency>
<dependency>

View File

@ -17,118 +17,140 @@ import java.util.HashMap;
import static org.reso.service.servlet.RESOservlet.resourceLookup;
import static org.reso.service.servlet.RESOservlet.getConnection;
public class EnumFieldInfo extends FieldInfo {
private String lookupName;
private final ArrayList<EnumValueInfo> values = new ArrayList<>();
private final HashMap<String, Object> valueLookup = new HashMap<>();
public class EnumFieldInfo extends FieldInfo
{
private String lookupName;
private final ArrayList<EnumValueInfo> values = new ArrayList<>();
private final HashMap<String,Object> valueLookup = new HashMap<>();
private static final Logger LOG = LoggerFactory.getLogger(EnumFieldInfo.class);
private boolean isCollection = false;
private boolean isFlags = false;
private static final Logger LOG = LoggerFactory.getLogger(EnumFieldInfo.class);
private boolean isCollection = false;
private boolean isFlags = false;
private static final String LOOKUP_COLUMN_NAME = "LookupValue";
private static final String LOOKUP_COLUMN_NAME = "LookupValue";
public EnumFieldInfo(String fieldName, FullQualifiedName type) {
super(fieldName, type);
}
public EnumFieldInfo(String fieldName, FullQualifiedName type)
{
super(fieldName, type);
}
public void addValue(EnumValueInfo value) {
values.add(value);
}
public void addValue(EnumValueInfo value)
{
values.add(value);
}
private void loadValues() {
ResourceInfo resource = resourceLookup.get("Lookup");
if (resource != null) {
Connection connect = getConnection();
String queryString = null;
try {
Statement statement = connect.createStatement();
HashMap<String, Boolean> selectLookup = new HashMap<>();
selectLookup.put(LOOKUP_COLUMN_NAME, true);
private void loadValues()
{
ResourceInfo resource = resourceLookup.get("Lookup");
if (resource!=null)
{
Connection connect = getConnection();
String queryString = null;
try
{
Statement statement = connect.createStatement();
HashMap<String,Boolean> selectLookup = new HashMap<>();
selectLookup.put(LOOKUP_COLUMN_NAME, true);
queryString = "Select " + LOOKUP_COLUMN_NAME + " from " + resource.getTableName() + " WHERE LookupName = '" + lookupName + "'";
LOG.debug("Query: " + queryString);
queryString = "Select "+LOOKUP_COLUMN_NAME+" from "+resource.getTableName()+" WHERE LookupName = '"+lookupName+"'";
LOG.debug("Query: "+queryString);
ResultSet resultSet = statement.executeQuery(queryString);
while (resultSet.next()) {
Entity ent = CommonDataProcessing.getEntityFromRow(resultSet, resource, selectLookup);
Property property = ent.getProperty(LOOKUP_COLUMN_NAME);
String val = property.getValue().toString();
values.add(new EnumValueInfo(val));
}
} catch (Exception e) {
LOG.info("Query: " + queryString);
LOG.error("Error in finding Lookup values for " + lookupName + ": " + e.getMessage());
ResultSet resultSet = statement.executeQuery(queryString);
while (resultSet.next())
{
Entity ent = CommonDataProcessing.getEntityFromRow(resultSet, resource, selectLookup);
Property property = ent.getProperty(LOOKUP_COLUMN_NAME);
String val = property.getValue().toString();
values.add( new EnumValueInfo(val) );
}
}
}
}
catch (Exception e)
{
LOG.info("Query: "+queryString);
LOG.error("Error in finding Lookup values for "+lookupName+": "+e.getMessage());
}
}
}
public ArrayList<EnumValueInfo> getValues() {
if (values.size() == 0) {
EnumValueInfo sampleValue = new EnumValueInfo("Sample" + lookupName + "EnumValue");
values.add(sampleValue);
}
public ArrayList<EnumValueInfo> getValues()
{
if (values.size()==0)
{
EnumValueInfo sampleValue = new EnumValueInfo("Sample"+lookupName+"EnumValue");
values.add(sampleValue);
}
return values;
}
return values;
}
public void setLookupName(String name) {
lookupName = name;
}
public void setLookupName(String name) { lookupName=name; }
public FullQualifiedName getType() {
if (values.size() == 0) {
getValues();
}
if (values.size() > 0) {
return new FullQualifiedName("org.reso.metadata.enums." + lookupName);
}
public FullQualifiedName getType()
{
if (values.size()==0)
{
getValues();
}
if (values.size()>0)
{
return new FullQualifiedName("org.reso.metadata.enums." + lookupName);
}
return super.getType();
}
return super.getType();
}
/**
* Accessor for lookupName
*
* @return
*/
public String getLookupName() {
return lookupName;
}
/**
* Accessor for lookupName
* @return
*/
public String getLookupName()
{
return lookupName;
}
public boolean isCollection() {
return isCollection;
}
public boolean isCollection()
{
return isCollection;
}
public void setCollection() {
isCollection = true;
}
public void setCollection()
{
isCollection = true;
}
public void setFlags() {
isFlags = true;
}
public void setFlags()
{
isFlags = true;
}
public boolean isFlags() {
return isFlags;
}
public boolean isFlags()
{
return isFlags;
}
public Object getValueOf(String enumStringValue) {
Object value = valueLookup.get(enumStringValue);
if (value == null) {
long bitValue = 1;
for (EnumValueInfo val : values) {
valueLookup.put(val.getValue(), bitValue);
if (isFlags) {
bitValue = bitValue * 2;
} else {
bitValue = bitValue + 1;
}
public Object getValueOf(String enumStringValue)
{
Object value = valueLookup.get(enumStringValue);
if (value==null)
{
long bitValue = 1;
for (EnumValueInfo val: values)
{
valueLookup.put(val.getValue(),bitValue);
if (isFlags)
{
bitValue = bitValue * 2;
}
value = valueLookup.get(enumStringValue);
}
else
{
bitValue = bitValue+1;
}
}
value = valueLookup.get(enumStringValue);
}
return value;
}
return value;
}
}