Code cleanup and moving object definitions to new folder
This commit is contained in:
parent
f1cbd7ddba
commit
40a3445941
|
@ -82,7 +82,7 @@ done
|
|||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_NAME="reso-web-api-reference-server"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
|
|
|
@ -34,8 +34,8 @@ public class GenericEntityCollectionProcessor implements EntityCollectionProcess
|
|||
{
|
||||
private OData odata;
|
||||
private ServiceMetadata serviceMetadata;
|
||||
private Connection connect = null;
|
||||
private String dbType;
|
||||
private Connection connect = null;
|
||||
private final String dbType;
|
||||
HashMap<String, ResourceInfo> resourceList = null;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GenericEntityCollectionProcessor.class);
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ import java.util.*;
|
|||
public class GenericEntityProcessor implements EntityProcessor
|
||||
{
|
||||
private OData odata;
|
||||
private ServiceMetadata serviceMetadata;
|
||||
private Connection connect;
|
||||
private ServiceMetadata serviceMetadata;
|
||||
private final Connection connect;
|
||||
HashMap<String, ResourceInfo> resourceList = null;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GenericEntityCollectionProcessor.class);
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class GenericEntityProcessor implements EntityProcessor
|
|||
|
||||
private URI createId(String entitySetName, Object id) {
|
||||
try {
|
||||
return new URI(entitySetName + "('" + String.valueOf(id) + "')");
|
||||
return new URI(entitySetName + "('" + id + "')");
|
||||
} catch (URISyntaxException e) {
|
||||
throw new ODataRuntimeException("Unable to create id for entity: " + entitySetName, e);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class CommonDataProcessing
|
|||
|
||||
private static URI createId(String entitySetName, Object id) {
|
||||
try {
|
||||
return new URI(entitySetName + "('" + String.valueOf(id) + "')");
|
||||
return new URI(entitySetName + "('" + id + "')");
|
||||
} catch (URISyntaxException e) {
|
||||
throw new ODataRuntimeException("Unable to create id for entity: " + entitySetName, e);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.*;
|
|||
|
||||
public class FieldDefinition extends ResourceInfo
|
||||
{
|
||||
private static String STANDARD_NAME = "RESO.OData.Metadata.StandardName";
|
||||
private static final String STANDARD_NAME = "RESO.OData.Metadata.StandardName";
|
||||
|
||||
private static ArrayList<FieldInfo> fieldList = null;
|
||||
private ArrayList<ResourceInfo> resources;
|
||||
|
|
|
@ -33,9 +33,9 @@ public class BreakdownOfFilterExpressionVisitor implements ExpressionVisitor<Str
|
|||
put(BinaryOperatorKind.SUB, " - ");
|
||||
}};
|
||||
|
||||
private HashMap<String,String> representations = new HashMap<>();
|
||||
private final HashMap<String,String> representations = new HashMap<>();
|
||||
|
||||
private ResourceInfo resourceInfo;
|
||||
private final ResourceInfo resourceInfo;
|
||||
|
||||
public BreakdownOfFilterExpressionVisitor(ResourceInfo resourceInfo) {
|
||||
this.resourceInfo = resourceInfo;
|
||||
|
|
|
@ -19,13 +19,13 @@ import static org.reso.service.servlet.RESOservlet.getConnection;
|
|||
|
||||
public class EnumFieldInfo extends FieldInfo
|
||||
{
|
||||
private String lookupName;
|
||||
private ArrayList<EnumValueInfo> values = new ArrayList<>();
|
||||
private static final Logger LOG = LoggerFactory.getLogger(EnumFieldInfo.class);
|
||||
private String lookupName;
|
||||
private final ArrayList<EnumValueInfo> values = new ArrayList<>();
|
||||
private static final Logger LOG = LoggerFactory.getLogger(EnumFieldInfo.class);
|
||||
private boolean isCollection = false;
|
||||
private boolean isFlags = false;
|
||||
|
||||
private static String LOOKUP_COLUMN_NAME = "LookupValue";
|
||||
private static final String LOOKUP_COLUMN_NAME = "LookupValue";
|
||||
|
||||
public EnumFieldInfo(String fieldName, FullQualifiedName type)
|
||||
{
|
||||
|
|
|
@ -8,8 +8,8 @@ import java.util.ArrayList;
|
|||
|
||||
public class EnumValueInfo
|
||||
{
|
||||
private String value;
|
||||
private ArrayList<CsdlAnnotation> annotations = new ArrayList<>();
|
||||
private final String value;
|
||||
private final ArrayList<CsdlAnnotation> annotations = new ArrayList<>();
|
||||
|
||||
|
||||
public EnumValueInfo(String value)
|
||||
|
|
|
@ -42,8 +42,8 @@ public class MySQLFilterExpressionVisitor implements ExpressionVisitor<String>
|
|||
put(BinaryOperatorKind.SUB, " - ");
|
||||
}};
|
||||
|
||||
private String entityAlias;
|
||||
private ResourceInfo resourceInfo;
|
||||
private final String entityAlias;
|
||||
private final ResourceInfo resourceInfo;
|
||||
|
||||
public MySQLFilterExpressionVisitor(ResourceInfo resourceInfo) {
|
||||
this.entityAlias = resourceInfo.getTableName();
|
||||
|
|
|
@ -38,8 +38,8 @@ public class PostgreSQLFilterExpressionVisitor implements ExpressionVisitor<Stri
|
|||
put(BinaryOperatorKind.SUB, " - ");
|
||||
}};
|
||||
|
||||
private String entityAlias;
|
||||
private ResourceInfo resourceInfo;
|
||||
private final String entityAlias;
|
||||
private final ResourceInfo resourceInfo;
|
||||
|
||||
public PostgreSQLFilterExpressionVisitor(ResourceInfo resourceInfo) {
|
||||
this.entityAlias = resourceInfo.getTableName();
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package org.reso.service.data.meta.builder;
|
||||
|
||||
|
||||
import com.google.gson.stream.JsonReader;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class AnnotationObject extends GenericGSONobject<Object>
|
||||
{
|
||||
private static final Map<String, Object> PROPERTIES_META = Stream.of(
|
||||
new AbstractMap.SimpleEntry<>("term", String.class),
|
||||
new AbstractMap.SimpleEntry<>("value", String.class) )
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
public AnnotationObject(JsonReader reader)
|
||||
{
|
||||
super(reader);
|
||||
}
|
||||
|
||||
public Map<String, Object> getPropertiesMeta()
|
||||
{
|
||||
return PROPERTIES_META;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
package org.reso.service.data.meta;
|
||||
package org.reso.service.data.meta.builder;
|
||||
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||
import org.reso.service.data.meta.*;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
|
@ -11,214 +12,28 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class GenericGSONobject<SubType>
|
||||
{
|
||||
protected static String subArrayName = "annotations";
|
||||
|
||||
protected JsonReader reader;
|
||||
protected HashMap<String,Object> properties = new HashMap<>();
|
||||
protected ArrayList<SubType> subArrayList = new ArrayList<>();
|
||||
|
||||
public GenericGSONobject(JsonReader reader)
|
||||
{
|
||||
this.reader = reader;
|
||||
this.readObject();
|
||||
}
|
||||
|
||||
public Map<String, Object> getPropertiesMeta()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private void readObject()
|
||||
{
|
||||
Map<String, Object> PROPERTIES_META = this.getPropertiesMeta();
|
||||
try
|
||||
{
|
||||
reader.beginObject();
|
||||
|
||||
while (reader.hasNext()) {
|
||||
|
||||
String name = reader.nextName();
|
||||
|
||||
if (PROPERTIES_META.containsKey(name))
|
||||
{
|
||||
Object classType = PROPERTIES_META.get(name);
|
||||
|
||||
if (classType.equals(String.class))
|
||||
{
|
||||
properties.put(name,reader.nextString() );
|
||||
}
|
||||
else if (classType.equals(Boolean.class))
|
||||
{
|
||||
properties.put(name,reader.nextBoolean() );
|
||||
}
|
||||
else if (classType.equals(Integer.class))
|
||||
{
|
||||
properties.put(name,reader.nextInt() );
|
||||
}
|
||||
} else if (name.equals(subArrayName)) {
|
||||
// read array
|
||||
reader.beginArray();
|
||||
|
||||
|
||||
while (reader.hasNext()) {
|
||||
GenericGSONobject subArrayItem = this.createSubType();
|
||||
|
||||
subArrayList.add((SubType)subArrayItem);
|
||||
}
|
||||
reader.endArray();
|
||||
|
||||
} else {
|
||||
reader.skipValue(); //avoid some unhandle events
|
||||
}
|
||||
}
|
||||
|
||||
reader.endObject();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Object getProperty(String name)
|
||||
{
|
||||
return properties.get(name);
|
||||
}
|
||||
|
||||
protected GenericGSONobject createSubType() // must also be of type GenericGSONobject
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the annotations for this field.
|
||||
* @return the sub-array for this generic object
|
||||
*/
|
||||
public ArrayList<SubType> getSubArrayList()
|
||||
{
|
||||
return subArrayList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class FieldObject extends GenericGSONobject<AnnotationObject>
|
||||
{
|
||||
private static Map<String, Object> PROPERTIES_META = Stream.of(
|
||||
new AbstractMap.SimpleEntry<>("resourceName", String.class),
|
||||
new AbstractMap.SimpleEntry<>("fieldName", String.class),
|
||||
new AbstractMap.SimpleEntry<>("type", String.class),
|
||||
new AbstractMap.SimpleEntry<>("nullable", Boolean.class),
|
||||
new AbstractMap.SimpleEntry<>("maxLength", Integer.class),
|
||||
new AbstractMap.SimpleEntry<>("scale", Integer.class),
|
||||
new AbstractMap.SimpleEntry<>("precision", Integer.class),
|
||||
new AbstractMap.SimpleEntry<>("isCollection", Boolean.class),
|
||||
new AbstractMap.SimpleEntry<>("unicode", Boolean.class) )
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
protected static String subArrayName = "annotations";
|
||||
|
||||
public FieldObject(JsonReader reader)
|
||||
{
|
||||
super(reader);
|
||||
}
|
||||
|
||||
public Map<String, Object> getPropertiesMeta()
|
||||
{
|
||||
return PROPERTIES_META;
|
||||
}
|
||||
|
||||
protected GenericGSONobject createSubType() // must also be of type GenericGSONobject
|
||||
{
|
||||
return new AnnotationObject(reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the annotations for this field.
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<AnnotationObject> getAnnotations()
|
||||
{
|
||||
return getSubArrayList();
|
||||
}
|
||||
}
|
||||
|
||||
class LookupObject extends GenericGSONobject<AnnotationObject>
|
||||
{
|
||||
private static Map<String, Object> PROPERTIES_META = Stream.of(
|
||||
new AbstractMap.SimpleEntry<>("lookupName", String.class),
|
||||
new AbstractMap.SimpleEntry<>("lookupValue", String.class),
|
||||
new AbstractMap.SimpleEntry<>("type", String.class) )
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
protected static String subArrayName = "annotations";
|
||||
|
||||
public LookupObject(JsonReader reader)
|
||||
{
|
||||
super(reader);
|
||||
}
|
||||
|
||||
public Map<String, Object> getPropertiesMeta()
|
||||
{
|
||||
return PROPERTIES_META;
|
||||
}
|
||||
|
||||
protected GenericGSONobject createSubType() // must also be of type GenericGSONobject
|
||||
{
|
||||
return new AnnotationObject(reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the annotations for this field.
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<AnnotationObject> getAnnotations()
|
||||
{
|
||||
return getSubArrayList();
|
||||
}
|
||||
}
|
||||
|
||||
class AnnotationObject extends GenericGSONobject<Object>
|
||||
{
|
||||
private static Map<String, Object> PROPERTIES_META = Stream.of(
|
||||
new AbstractMap.SimpleEntry<>("term", String.class),
|
||||
new AbstractMap.SimpleEntry<>("value", String.class) )
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
public AnnotationObject(JsonReader reader)
|
||||
{
|
||||
super(reader);
|
||||
}
|
||||
|
||||
public Map<String, Object> getPropertiesMeta()
|
||||
{
|
||||
return PROPERTIES_META;
|
||||
}
|
||||
}
|
||||
|
||||
public class DefinitionBuilder
|
||||
{
|
||||
// Constants
|
||||
|
||||
private static String EDM_ENUM = "org.reso.metadata.enums";
|
||||
private static final String EDM_ENUM = "org.reso.metadata.enums";
|
||||
|
||||
private static Map<String, FullQualifiedName> EDM_MAP = Stream.of(
|
||||
private static final Map<String, FullQualifiedName> EDM_MAP = Stream.of(
|
||||
new AbstractMap.SimpleEntry<>("Edm.String", EdmPrimitiveTypeKind.String.getFullQualifiedName() ),
|
||||
new AbstractMap.SimpleEntry<>("Edm.Boolean", EdmPrimitiveTypeKind.Boolean.getFullQualifiedName() ),
|
||||
new AbstractMap.SimpleEntry<>("Edm.Decimal", EdmPrimitiveTypeKind.Int64.getFullQualifiedName() ))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
private static Map<String, Boolean> HEADER_FIELDS = Stream.of(
|
||||
private static final Map<String, Boolean> HEADER_FIELDS = Stream.of(
|
||||
new AbstractMap.SimpleEntry<>("description", true),
|
||||
new AbstractMap.SimpleEntry<>("generatedOn", true),
|
||||
new AbstractMap.SimpleEntry<>("version", true))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
// Internals
|
||||
private String fileName;
|
||||
private JsonReader reader;
|
||||
private final String fileName;
|
||||
private JsonReader reader;
|
||||
|
||||
// Constructor
|
||||
public DefinitionBuilder(String fileName)
|
||||
|
@ -356,12 +171,41 @@ public class DefinitionBuilder
|
|||
String lookupName = fieldType.substring(EDM_ENUM.length()+1 );
|
||||
EnumFieldInfo enumFieldInfo = new EnumFieldInfo(fieldName, EdmPrimitiveTypeKind.Int64.getFullQualifiedName());
|
||||
enumFieldInfo.setLookupName(lookupName);
|
||||
if (isCollection==true)
|
||||
{
|
||||
enumFieldInfo.setCollection();
|
||||
}
|
||||
newField = enumFieldInfo;
|
||||
|
||||
ArrayList<GenericGSONobject> lookupList = lookupMap.get(fieldType);
|
||||
boolean setFlags = lookupList.size()>1;
|
||||
|
||||
for (GenericGSONobject lookupItem: lookupList)
|
||||
{
|
||||
EnumValueInfo enumValue = new EnumValueInfo((String)lookupItem.getProperty("lookupValue"));
|
||||
String enumValueString = (String)lookupItem.getProperty("lookupValue");
|
||||
EnumValueInfo enumValue = new EnumValueInfo(enumValueString);
|
||||
|
||||
/**
|
||||
try
|
||||
{
|
||||
Long enumLongValue = Long.parseLong(enumValueString);
|
||||
if (enumLongValue<=0)
|
||||
{
|
||||
setFlags = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
long hob = Long.highestOneBit(enumLongValue);
|
||||
long lob = Long.lowestOneBit(enumLongValue);
|
||||
setFlags = (hob==lob);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setFlags = false;
|
||||
}
|
||||
/**/
|
||||
|
||||
|
||||
ArrayList<AnnotationObject> annotations = null;
|
||||
if (lookupItem.getClass().equals(LookupObject.class))
|
||||
|
@ -379,6 +223,11 @@ public class DefinitionBuilder
|
|||
enumFieldInfo.addValue(enumValue);
|
||||
}
|
||||
|
||||
if (setFlags)
|
||||
{
|
||||
enumFieldInfo.setFlags();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (newField != null)
|
|
@ -0,0 +1,51 @@
|
|||
package org.reso.service.data.meta.builder;
|
||||
|
||||
|
||||
import com.google.gson.stream.JsonReader;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class FieldObject extends GenericGSONobject<AnnotationObject>
|
||||
{
|
||||
private static final Map<String, Object> PROPERTIES_META = Stream.of(
|
||||
new AbstractMap.SimpleEntry<>("resourceName", String.class),
|
||||
new AbstractMap.SimpleEntry<>("fieldName", String.class),
|
||||
new AbstractMap.SimpleEntry<>("type", String.class),
|
||||
new AbstractMap.SimpleEntry<>("nullable", Boolean.class),
|
||||
new AbstractMap.SimpleEntry<>("maxLength", Integer.class),
|
||||
new AbstractMap.SimpleEntry<>("scale", Integer.class),
|
||||
new AbstractMap.SimpleEntry<>("precision", Integer.class),
|
||||
new AbstractMap.SimpleEntry<>("isCollection", Boolean.class),
|
||||
new AbstractMap.SimpleEntry<>("unicode", Boolean.class) )
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
protected static String subArrayName = "annotations";
|
||||
|
||||
public FieldObject(JsonReader reader)
|
||||
{
|
||||
super(reader);
|
||||
}
|
||||
|
||||
public Map<String, Object> getPropertiesMeta()
|
||||
{
|
||||
return PROPERTIES_META;
|
||||
}
|
||||
|
||||
protected GenericGSONobject createSubType() // must also be of type GenericGSONobject
|
||||
{
|
||||
return new AnnotationObject(reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the annotations for this field.
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<AnnotationObject> getAnnotations()
|
||||
{
|
||||
return getSubArrayList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package org.reso.service.data.meta.builder;
|
||||
|
||||
|
||||
import com.google.gson.stream.JsonReader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class GenericGSONobject<SubType>
|
||||
{
|
||||
protected static String subArrayName = "annotations";
|
||||
|
||||
protected JsonReader reader;
|
||||
protected HashMap<String,Object> properties = new HashMap<>();
|
||||
protected ArrayList<SubType> subArrayList = new ArrayList<>();
|
||||
|
||||
public GenericGSONobject(JsonReader reader)
|
||||
{
|
||||
this.reader = reader;
|
||||
this.readObject();
|
||||
}
|
||||
|
||||
public Map<String, Object> getPropertiesMeta()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private void readObject()
|
||||
{
|
||||
Map<String, Object> PROPERTIES_META = this.getPropertiesMeta();
|
||||
try
|
||||
{
|
||||
reader.beginObject();
|
||||
|
||||
while (reader.hasNext()) {
|
||||
|
||||
String name = reader.nextName();
|
||||
|
||||
if (PROPERTIES_META.containsKey(name))
|
||||
{
|
||||
Object classType = PROPERTIES_META.get(name);
|
||||
|
||||
if (classType.equals(String.class))
|
||||
{
|
||||
properties.put(name,reader.nextString() );
|
||||
}
|
||||
else if (classType.equals(Boolean.class))
|
||||
{
|
||||
properties.put(name,reader.nextBoolean() );
|
||||
}
|
||||
else if (classType.equals(Integer.class))
|
||||
{
|
||||
properties.put(name,reader.nextInt() );
|
||||
}
|
||||
} else if (name.equals(subArrayName)) {
|
||||
// read array
|
||||
reader.beginArray();
|
||||
|
||||
|
||||
while (reader.hasNext()) {
|
||||
GenericGSONobject subArrayItem = this.createSubType();
|
||||
|
||||
subArrayList.add((SubType)subArrayItem);
|
||||
}
|
||||
reader.endArray();
|
||||
|
||||
} else {
|
||||
reader.skipValue(); //avoid some unhandle events
|
||||
}
|
||||
}
|
||||
|
||||
reader.endObject();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Object getProperty(String name)
|
||||
{
|
||||
return properties.get(name);
|
||||
}
|
||||
|
||||
protected GenericGSONobject createSubType() // must also be of type GenericGSONobject
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the annotations for this field.
|
||||
* @return the sub-array for this generic object
|
||||
*/
|
||||
public ArrayList<SubType> getSubArrayList()
|
||||
{
|
||||
return subArrayList;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package org.reso.service.data.meta.builder;
|
||||
|
||||
|
||||
import com.google.gson.stream.JsonReader;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class LookupObject extends GenericGSONobject<AnnotationObject>
|
||||
{
|
||||
private static final Map<String, Object> PROPERTIES_META = Stream.of(
|
||||
new AbstractMap.SimpleEntry<>("lookupName", String.class),
|
||||
new AbstractMap.SimpleEntry<>("lookupValue", String.class),
|
||||
new AbstractMap.SimpleEntry<>("type", String.class) )
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
protected static String subArrayName = "annotations";
|
||||
|
||||
public LookupObject(JsonReader reader)
|
||||
{
|
||||
super(reader);
|
||||
}
|
||||
|
||||
public Map<String, Object> getPropertiesMeta()
|
||||
{
|
||||
return PROPERTIES_META;
|
||||
}
|
||||
|
||||
protected GenericGSONobject createSubType() // must also be of type GenericGSONobject
|
||||
{
|
||||
return new AnnotationObject(reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the annotations for this field.
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<AnnotationObject> getAnnotations()
|
||||
{
|
||||
return getSubArrayList();
|
||||
}
|
||||
}
|
|
@ -15,9 +15,9 @@ import java.util.*;
|
|||
|
||||
public class RESOedmProvider extends CsdlAbstractEdmProvider
|
||||
{
|
||||
private ArrayList<ResourceInfo> resourceList = new ArrayList<ResourceInfo>();
|
||||
private final ArrayList<ResourceInfo> resourceList = new ArrayList<ResourceInfo>();
|
||||
// Service Namespace
|
||||
public static final String NAMESPACE = "org.reso.metadata";
|
||||
public static final String NAMESPACE = "org.reso.metadata";
|
||||
|
||||
// EDM Container
|
||||
public static final String CONTAINER_NAME = "Container";
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.apache.olingo.server.api.ServiceMetadata;
|
|||
import org.reso.service.data.GenericEntityCollectionProcessor;
|
||||
import org.reso.service.data.GenericEntityProcessor;
|
||||
import org.reso.service.data.definition.LookupDefinition;
|
||||
import org.reso.service.data.meta.DefinitionBuilder;
|
||||
import org.reso.service.data.meta.builder.DefinitionBuilder;
|
||||
import org.reso.service.data.definition.FieldDefinition;
|
||||
import org.reso.service.data.meta.ResourceInfo;
|
||||
import org.reso.service.edmprovider.RESOedmProvider;
|
||||
|
@ -125,7 +125,7 @@ public class RESOservlet extends HttpServlet
|
|||
{
|
||||
try
|
||||
{
|
||||
resource.findPrimaryKey(this.connect);
|
||||
resource.findPrimaryKey(connect);
|
||||
resources.add(resource);
|
||||
}
|
||||
catch (SQLException e)
|
||||
|
@ -136,7 +136,7 @@ public class RESOservlet extends HttpServlet
|
|||
}
|
||||
else
|
||||
{
|
||||
// Get all classes with constructors with 0 parameters. LookupDefinition should not work.
|
||||
// Get all classes with constructors with 0 parameters. This is deprecated as the Cert metadata report should work for more people.
|
||||
try
|
||||
{
|
||||
Class[] classList = ClassLoader.getClasses("org.reso.service.data.definition.custom");
|
||||
|
@ -156,7 +156,7 @@ public class RESOservlet extends HttpServlet
|
|||
|
||||
try
|
||||
{
|
||||
resource.findPrimaryKey(this.connect);
|
||||
resource.findPrimaryKey(connect);
|
||||
resources.add(resource);
|
||||
resourceLookup.put(resource.getResourceName(), resource);
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public class RESOservlet extends HttpServlet
|
|||
ResourceInfo defn = new LookupDefinition();
|
||||
try
|
||||
{
|
||||
defn.findPrimaryKey(this.connect);
|
||||
defn.findPrimaryKey(connect);
|
||||
resources.add(defn);
|
||||
resourceLookup.put(defn.getResourceName(), defn);
|
||||
}
|
||||
|
@ -191,8 +191,8 @@ public class RESOservlet extends HttpServlet
|
|||
// create odata handler and configure it with CsdlEdmProvider and Processor
|
||||
this.handler = odata.createHandler(edm);
|
||||
|
||||
GenericEntityCollectionProcessor entityCollectionProcessor = new GenericEntityCollectionProcessor(this.connect, dbType);
|
||||
GenericEntityProcessor entityProcessor = new GenericEntityProcessor(this.connect);
|
||||
GenericEntityCollectionProcessor entityCollectionProcessor = new GenericEntityCollectionProcessor(connect, dbType);
|
||||
GenericEntityProcessor entityProcessor = new GenericEntityProcessor(connect);
|
||||
|
||||
this.handler.register(entityCollectionProcessor);
|
||||
this.handler.register(entityProcessor);
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.reso.service.servlet.util;
|
|||
|
||||
public class SimpleError
|
||||
{
|
||||
private String error;
|
||||
private final String error;
|
||||
|
||||
// Constants for standard errors.
|
||||
static public String AUTH_REQUIRED = "auth_required";
|
||||
|
|
Loading…
Reference in New Issue