More work on JPA server
This commit is contained in:
parent
0869b1fc14
commit
e3bb0fa3be
|
@ -1,9 +1,8 @@
|
||||||
package ca.uhn.fhir.jpa.entity;
|
package ca.uhn.fhir.jpa.dao;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
|
|
||||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
import ca.uhn.fhir.model.primitive.IdDt;
|
|
@ -0,0 +1,7 @@
|
||||||
|
package ca.uhn.fhir.jpa.dao;
|
||||||
|
|
||||||
|
public @interface IndexedParam {
|
||||||
|
|
||||||
|
String path();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package ca.uhn.fhir.jpa.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.DiscriminatorColumn;
|
||||||
|
import javax.persistence.DiscriminatorType;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Inheritance;
|
||||||
|
import javax.persistence.InheritanceType;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||||
|
public class BaseResourceIndexedSearchParam implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
@Column(name = "RES_ID")
|
||||||
|
private Long myId;
|
||||||
|
|
||||||
|
@ManyToOne(optional=false)
|
||||||
|
@Column(name="RESOURCE_PID", nullable=false)
|
||||||
|
private BaseResourceTable<?> myResource;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.entity.BaseResourceProvider;
|
import ca.uhn.fhir.jpa.dao.BaseResourceProvider;
|
||||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package ca.uhn.fhir.jpa.test;
|
package ca.uhn.fhir.jpa.test;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.entity.BaseResourceProvider;
|
import ca.uhn.fhir.jpa.dao.BaseResourceProvider;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.dstu.resource.Questionnaire;
|
import ca.uhn.fhir.model.dstu.resource.Questionnaire;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
#parse ( "/vm/templates.vm" )
|
||||||
|
|
||||||
|
package ${packageBase};
|
||||||
|
|
||||||
|
@ResourceDef(name="${className}", profile="${profile}", id="${id}")
|
||||||
|
public class ${className}ResourceTable extends BaseResourceTable<${className}> {
|
||||||
|
|
||||||
|
#foreach ( $param in $searchParams )
|
||||||
|
#if( ${param.typeCapitalized} == 'String' )
|
||||||
|
@IndexedParam(path="${param.path}")
|
||||||
|
@Column(length=100)
|
||||||
|
private String ${param.name};
|
||||||
|
#elseif( ${param.typeCapitalized} == 'Date' )
|
||||||
|
@IndexedParam(path="${param.path}")
|
||||||
|
@Column()
|
||||||
|
private String ${param.name};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <b>Fluent Client</b> search parameter constant for <b>${param.name}</b>
|
||||||
|
* <p>
|
||||||
|
* Description: <b>${param.description}</b><br/>
|
||||||
|
* Type: <b>${param.type}</b><br/>
|
||||||
|
* Path: <b>${param.path}</b><br/>
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public static final ${param.typeCapitalized}Param ${param.fluentConstantName} = new ${param.typeCapitalized}Param(${param.constantName});
|
||||||
|
|
||||||
|
#if( ${param.typeCapitalized} == 'Reference' )
|
||||||
|
#foreach ( $include in $param.paths )
|
||||||
|
/**
|
||||||
|
* Constant for fluent queries to be used to add include statements. Specifies
|
||||||
|
* the path value of "<b>${include.path}</b>".
|
||||||
|
*/
|
||||||
|
public static final Include INCLUDE_${include.includeName} = new Include("${include.path}");
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<${className}> getResourceType() {
|
||||||
|
return ${className}.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -17,7 +17,7 @@
|
||||||
<version>0.3</version>
|
<version>0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- HAPI-FHIR uses Logback for logging support. The logback library is included automatically by Maven as a part of the hapi-fhir-base dependency, but you also need to include a
|
<!-- HAPI-FHIR uses Logback for logging support. The logback library is included automatically by Maven as a part of the hapi-fhir-base dependency, but you also need to include a
|
||||||
logging library. Logback is used here, but log4j would also be fine. -->
|
logging library. Logback is used here, but log4j would also be fine. -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.qos.logback</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
@ -46,6 +46,8 @@
|
||||||
<target>1.6</target>
|
<target>1.6</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
@ -53,6 +55,7 @@
|
||||||
<skip>true</skip>
|
<skip>true</skip>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue