Changeset 8126
- Timestamp:
- 02/03/12 16:29:18 (8 years ago)
- Location:
- mauRepo/revitalizationProject/branches/MEDIN/dpws
- Files:
-
- 1 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/revitalizationProject/branches/MEDIN/dpws/pom.xml
r8123 r8126 38 38 <jarName>dpws-ejb${project.version}</jarName> 39 39 </configuration> 40 </plugin> 41 <plugin> 42 <groupId>org.apache.maven.plugins</groupId> 43 <artifactId>maven-surefire-plugin</artifactId> 44 <version>2.12</version> 45 </plugin> 40 </plugin> 46 41 </plugins> 47 42 </build> -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/discovery/basic/DiscoveryDictionaryDPWS.java
r8124 r8126 26 26 import java.util.List; 27 27 28 import org.apache.commons.collections.CollectionUtils; 29 import org.apache.commons.lang.StringUtils; 30 28 31 import ndg.common.exception.NdgExecutionException; 29 32 import ndg.services.jpa.ListNames; 33 import ndg.services.jpa.ListNamesItem; 30 34 import ndg.services.jpa.OriginalDocument; 31 35 import ndg.services.revitalization.EJBBeanFactory; … … 39 43 40 44 public final static String SPATIAL_DATA_TABLE = "spatial_data"; 41 public final static String TEMPORAL_DATA_TABLE = "temporal_data";42 45 public final static String ORIGINAL_DOCUMENT_TABLE = "original_document"; 43 46 public final static String TRANSFORMED_DOCUMENT_TABLE = "transformed_document"; … … 46 49 public final static String ORDER_BY_FIELD = "OrderByField"; 47 50 51 52 public final static String TEMPORAL_DATA_TABLE = "temporal_data"; 53 //-----// 54 public final static String RECORD_DETAIL_DOCUMENT_SIMPLE = "DocumentSimple"; 55 public final static String RECORD_DETAIL_DOCUMENT_FULL = "DocumentFull"; 56 public final static String RECORD_DETAIL_DOCUMENT_SUMMARY = "DocumentSummary"; 57 public final static String RECORD_DETAIL_DOCUMENT_BRIEF = "DocumentBrief"; 58 //-----// 59 public final static String TEMPORAL_COVERAGE = "TemporalCoverage"; 60 //-----// 61 public final static String SPATIAL_OPERATOR_OVERLAP = "Overlaps"; 62 public final static String SPATIAL_OPERATOR_WITHIN = "Within"; 63 public final static String SPATIAL_OPERATOR_DOESNOTOVERLAP = "DoesNotOverlap"; 64 48 65 private static List<ListNames> listNames = new ArrayList<ListNames>(); 49 66 … … 51 68 try { 52 69 synchronized (listNames) { 53 DiscoveryDictionaryDPWS.listNames = (List<ListNames>)EJBBeanFactory.getDiscoveryService().getAllNamesList(); 70 DiscoveryDictionaryDPWS.listNames.clear(); 71 DiscoveryDictionaryDPWS.listNames.addAll(EJBBeanFactory.getDiscoveryService().getAllNamesList()); 54 72 } 55 73 } catch (NdgExecutionException e) { … … 58 76 } 59 77 60 61 /* 62 public static enum TermTarget { 63 FullText("document_ts_vector", "FullText", true), 64 Author("authors_ts_vector", "Author", true), 65 Parameters("parameters_ts_vector", "Parameters", true), 66 ResourceType("resource_type_ts_vector", "ResourceType", true), 67 TopicCategory("topic_category_ts_vector", "TopicCategory", true), 68 Lineage("lineage_ts_vector", "Lineage", true), 69 PublicAccessLimits("limitations_public_access_ts_vector", "PublicAccessLimits", true), 70 DataOriginator("data_originator_tsvector", "DataOriginator", true), 71 DataFormat("original_format_name", "DataFormat", false), 72 AvailableDataFormats("data_formats", "AvailableDataFormats", false), 73 InspireThemes("inspire_themes_ts_vector", "InspireThemes", true), 74 VerticalExtent("vertical_extent_ts_vector", "VerticalExtent", true); 75 76 private final String fieldName; 77 private final String fieldLabel; 78 private final boolean vector; 79 TermTarget(String fieldName, String fieldLabel, boolean vector) { 80 this.fieldName = fieldName; 81 this.fieldLabel = fieldLabel; 82 this.vector = vector; 83 } 84 public final String fieldName() { 85 return fieldName; 86 } 87 public final String fieldLabel() { 88 return fieldLabel; 89 } 90 public final boolean isVector() { 91 return vector; 92 } 93 } 94 */ 95 public static enum OrderByField { 96 DatasetStartDate("original_document.dataset_start_date_nom", "DatasetStartDate", "datasetStartDateNom"), 97 DatasetEndDate("original_document.dataset_end_date_nom", "DatasetEndDate", "datasetEndDateNom"), 98 DataCenter("original_document.datacentre_name", "DataCenter", "datacentreName"), 99 DatasetUpdate("original_document.update_date", "DatasetUpdateOrder", "updateDate"), 100 DiscoveryIngestDate("original_document.create_date", "DiscoveryIngestDate", "createDate"), 101 DatasetMetadataUpdateDate("original_document.dataset_metadata_update_date", "DatasetMetadataUpdateDate", "datasetMetadataUpdateDate"), 102 DiscoveryTitle("original_document.dataset_name", "DiscoveryTitle", "datasetName"); 103 104 private final String fieldName; 105 private final String fieldLabel; 106 private final String odField; 107 OrderByField(String fieldName, String fieldLabel, String odField) { 108 this.fieldName = fieldName; 109 this.fieldLabel = fieldLabel; 110 this.odField = odField; 111 } 112 public final String fieldName() { 113 return fieldName; 114 } 115 public final String fieldLabel() { 116 return fieldLabel; 117 } 118 public final String getOdField() { 119 return odField; 120 } 121 } 122 123 public static enum OrderDirection { 124 DESC("DESC", "descending"), 125 ASC("ASC", "ascending"); 126 127 private final String fieldName; 128 private final String fieldLabel; 129 OrderDirection(String fieldName, String fieldLabel) { 130 this.fieldName = fieldName; 131 this.fieldLabel = fieldLabel; 132 } 133 public final String fieldName() { 134 return fieldName; 135 } 136 public final String fieldLabel() { 137 return fieldLabel; 138 } 139 } 140 141 public static enum RecordDetail { 142 DocumentSimple("Simple", "DocumentSimple"), 143 DocumentBrief("Brief", "DocumentBrief"), 144 DocumentSummary("Summary", "DocumentSummary"), 145 DocumentFull("Full", "DocumentFull"); 146 147 private final String fieldName; 148 private final String fieldLabel; 149 RecordDetail(String fieldName, String fieldLabel) { 150 this.fieldName = fieldName; 151 this.fieldLabel = fieldLabel; 152 } 153 public final String fieldName() { 154 return fieldName; 155 } 156 public final String fieldLabel() { 157 return fieldLabel; 158 } 159 } 160 161 public static enum DateRangeTarget { 162 TemporalCoverage("TemporalCoverage", "TemporalCoverage"), 163 LastRevisionDate("dataset_metadata_update_date", "LastRevisionDate"), 164 DiscoveryIngestDate("update_date", "DiscoveryIngestDate"); 165 166 private final String fieldName; 167 private final String fieldLabel; 168 DateRangeTarget(String fieldName, String fieldLabel) { 169 this.fieldName = fieldName; 170 this.fieldLabel = fieldLabel; 171 } 172 public final String fieldName() { 173 return fieldName; 174 } 175 public final String fieldLabel() { 176 return fieldLabel; 177 } 178 } 179 180 public static enum TemporalOperator { 181 Equals("=", "Equals"), 182 DoesNotEqual("<>", "DoesNotEqual"), 183 OnOrBefore("<=", "OnOrBefore"), 184 OnOrAfter(">=", "OnOrAfter"), 185 Before("<", "Before"), 186 After(">", "After"); 187 188 private final String fieldName; 189 private final String fieldLabel; 190 TemporalOperator(String fieldName, String fieldLabel) { 191 this.fieldName = fieldName; 192 this.fieldLabel = fieldLabel; 193 } 194 public final String fieldName() { 195 return fieldName; 196 } 197 public final String fieldLabel() { 198 return fieldLabel; 199 } 200 } 201 202 public static enum Scope { 203 MDIP("MDIP", "MDIP"), 204 NERC_DDC("NERC_DDC", "NERC_DDC"), 205 NERC("NERC", "NERC"), 206 DPPP("DPPP", "DPPP"); 207 208 private final String fieldName; 209 private final String fieldLabel; 210 Scope(String fieldName, String fieldLabel) { 211 this.fieldName = fieldName; 212 this.fieldLabel = fieldLabel; 213 } 214 public final String fieldName() { 215 return fieldName; 216 } 217 public final String fieldLabel() { 218 return fieldLabel; 219 } 220 } 221 222 public static enum SpatialOperator { 223 OVERLAP("Overlaps", "Overlaps"), 224 DOESNOTOVERLAP("DoesNotOverlap", "DoesNotOverlap"), 225 WITHIN("Within", "Within"); 226 227 private final String fieldName; 228 private final String fieldLabel; 229 SpatialOperator(String fieldName, String fieldLabel) { 230 this.fieldName = fieldName; 231 this.fieldLabel = fieldLabel; 232 } 233 public final String fieldName() { 234 return fieldName; 235 } 236 public final String fieldLabel() { 237 return fieldLabel; 238 } 239 } 240 241 public static enum SpatialReferenceSystem { 242 EPSG4326("EPSG4326", "EPSG4326"); 243 244 private final String fieldName; 245 private final String fieldLabel; 246 SpatialReferenceSystem(String fieldName, String fieldLabel) { 247 this.fieldName = fieldName; 248 this.fieldLabel = fieldLabel; 249 } 250 public final String fieldName() { 251 return fieldName; 252 } 253 public final String fieldLabel() { 254 return fieldLabel; 255 } 256 } 257 258 public static enum MetadataFormat { 259 DIF_9_4("DIF_9.4", "DIF_9.4"), 260 DC("DC", "DC"), 261 MEDIN_2_3("MEDIN_2.3", "MEDIN_2.3"), 262 ISO19115("ISO19115", "ISO19115"), 263 NERC_DMS_07("NERC_DMS_0.7", "NERC_DMS_0.7"); 264 265 private final String fieldName; 266 private final String fieldLabel; 267 MetadataFormat(String fieldName, String fieldLabel) { 268 this.fieldName = fieldName; 269 this.fieldLabel = fieldLabel; 270 } 271 public final String fieldName() { 272 return fieldName; 273 } 274 public final String fieldLabel() { 275 return fieldLabel; 276 } 277 } 278 279 public static enum OriginalFormat { 280 DIF_9_4("DIF_9.4", "DIF_9.4"), 281 MEDIN_2_3("MEDIN_2.3", "MEDIN_2.3"), 282 ISO19115("ISO19115", "ISO19115"); 283 284 private final String fieldName; 285 private final String fieldLabel; 286 OriginalFormat(String fieldName, String fieldLabel) { 287 this.fieldName = fieldName; 288 this.fieldLabel = fieldLabel; 289 } 290 public final String fieldName() { 291 return fieldName; 292 } 293 public final String fieldLabel() { 294 return fieldLabel; 295 } 296 } 297 78 private static ListNames getListNames(String masterLabel) { 79 if (CollectionUtils.isEmpty(listNames)) { 80 refreshListNames(); 81 } 82 for (ListNames listNamesElement : listNames) { 83 if (listNamesElement.getLabel().equals(masterLabel)) { 84 return listNamesElement; 85 } 86 } 87 return null; 88 } 89 90 private static ListNamesItem getListNameItem(String masterLabel, String label) { 91 ListNames masterList = getListNames(masterLabel); 92 ListNamesItem defaultListNamesItem = null; 93 for (ListNamesItem listNamesItem : masterList.getListNamesItems()) { 94 if (StringUtils.isEmpty(label)){ 95 if (listNamesItem.isDefault_()) { 96 return listNamesItem; 97 } else { 98 continue; 99 } 100 } 101 102 if (listNamesItem.isDefault_()) { 103 defaultListNamesItem = listNamesItem; 104 } 105 106 if (StringUtils.equals(listNamesItem.getLabel(), label)) { 107 return listNamesItem; 108 } 109 } 110 return defaultListNamesItem; 111 } 112 113 /** 114 * Returns the TermTarget proper element 115 * @param label the reference label 116 * @return the proper TermTarget or the default value 117 * */ 118 public static ListNamesItem getTermType(String label) { 119 return getListNameItem("TermTargetList", label); 120 } 121 122 /** 123 * Returns the MetadataFormat proper element 124 * @param label the reference label 125 * @return the proper MetadataFormat or the default value 126 * */ 127 public static ListNamesItem getMetadataFormat(String label) { 128 return getListNameItem("MetadataFormatList", label); 129 } 130 131 /** 132 * Returns the OriginalFormat proper element 133 * @param label the reference label 134 * @return the proper OriginalFormat or the default value 135 * */ 136 public static ListNamesItem getOriginalFormat(String label) { 137 return getListNameItem("OriginalFormatList", label); 138 } 139 140 /** 141 * Returns the SpatialReferenceSystem proper element 142 * @param label the reference label 143 * @return the proper SpatialReferenceSystem or the default value 144 * */ 145 public static ListNamesItem getSpatialReferenceSystem(String label) { 146 return getListNameItem("SpatialReferenceSystemList", label); 147 } 148 149 /** 150 * Returns the SpatialOperator proper element 151 * @param label the reference label 152 * @return the proper SpatialOperator or the default value 153 * */ 154 public static ListNamesItem getSpatialOperator(String label) { 155 return getListNameItem("SpatialOperatorList", label); 156 } 157 158 /** 159 * Returns the RecordDetail proper element 160 * @param label the reference label 161 * @return the proper RecordDetail or the default value 162 * */ 163 public static ListNamesItem getRecordDetails(String label){ 164 return getListNameItem("RecordDetailsList", label); 165 } 166 167 /** 168 * Returns the DateRangeTarget proper element 169 * @param label the reference label 170 * @return the proper DateRangeTarget or the default value 171 * */ 172 public static ListNamesItem getDateRangeTarget(String label) { 173 return getListNameItem("DateRangeTargetList", label); 174 } 175 176 /** 177 * Returns the ListNamesItem proper element 178 * @param label the reference label 179 * @return the proper TemporalOperator or the default value 180 * */ 181 public static ListNamesItem getTemporalOperator(String label) { 182 return getListNameItem("TemporalOperatorList", label); 183 } 184 185 /** 186 * Returns the OrderByField proper element 187 * @param label the reference label 188 * @return the proper OrderByField or the default value 189 * */ 190 public static ListNamesItem getOrderByField(String label){ 191 return getListNameItem("OrderByFieldList", label); 192 } 193 194 /** 195 * Returns the OrderDirection proper element 196 * @param label the reference label 197 * @return the proper OrderDirection or the default value 198 * */ 199 public static ListNamesItem getOrderDirection(String label){ 200 return getListNameItem("OrderDirectionList", label) ; 201 } 202 203 /** 204 * Returns the Scope proper element 205 * @param label the reference label 206 * @return the proper Scope or the default value 207 * */ 208 public static ListNamesItem getScope(String label){ 209 return getListNameItem("ScopeList", label) ; 210 } 211 298 212 /** 299 213 * Maps the db table to {@link OriginalDocument} class. 214 * In a future release should be properly mapped within the JPA 300 215 **/ 301 216 public static enum OriginalDocumentToTable { … … 346 261 } 347 262 348 /**349 * Returns the {@link MetadataFormat} proper element350 * for the given parameter. In the paramenter is <code>null</code> or351 * not found the default value {@link MetadataFormat#NERC_DMS_07}}352 * is returned353 * @param label the reference label354 * @return the proper {@link MetadataFormat} or the default value355 * */356 public static MetadataFormat getMetadataFormat(String label) {357 MetadataFormat type = MetadataFormat.NERC_DMS_07;358 if (label != null) {359 for (MetadataFormat item : MetadataFormat.values()) {360 if(label.trim().equals(item.fieldLabel())) {361 type = item;362 break;363 }364 }365 }366 return type;367 }368 369 /**370 * Returns the {@link OriginalFormat} proper element371 * for the given parameter.372 * @param label the reference label373 * @return the proper {@link OriginalFormat} or <code>null</code>374 * if the label does not exist375 * */376 public static OriginalFormat getOriginalFormat(String label) {377 OriginalFormat type = null;378 if (label != null) {379 for (OriginalFormat item : OriginalFormat.values()) {380 if(label.trim().equals(item.fieldLabel())) {381 type = item;382 break;383 }384 }385 }386 return type;387 }388 389 /**390 * Returns the {@link SpatialReferenceSystem} proper element391 * for the given parameter.392 * @param label the reference label393 * @return the proper {@link SpatialReferenceSystem} or <code>null</code>394 * if the label does not exist395 * */396 public static SpatialReferenceSystem getSpatialReferenceSystem(String label) {397 SpatialReferenceSystem type = null;398 if (label != null) {399 for (SpatialReferenceSystem item : SpatialReferenceSystem.values()) {400 if(label.trim().equals(item.fieldLabel())) {401 type = item;402 break;403 }404 }405 }406 return type;407 }408 409 /**410 * Returns the {@link SpatialOperator} proper element411 * for the given parameter.412 * @param label the operator label413 * @return the proper {@link SpatialOperator} or <code>null</code>414 * if the label does not exist415 **/416 public static SpatialOperator getSpatialOperator(String label) {417 SpatialOperator type = SpatialOperator.OVERLAP;418 if (label != null) {419 for (SpatialOperator item : SpatialOperator.values()) {420 if(label.trim().equals(item.fieldLabel())) {421 type = item;422 break;423 }424 }425 }426 return type;427 }428 429 430 /**431 * Returns the {@link Names} proper element432 * for the given parameter.433 * @param label the name label434 * @return the proper {@link Names} or <code>null</code>435 * if the label does not exist436 * */437 /*438 public static Names getNames(String label) {439 Names type = null;440 if (label != null) {441 for (Names item : Names.values()) {442 if(label.trim().equals(item.fieldLabel())) {443 type = item;444 break;445 }446 }447 }448 return type;449 }450 */451 452 /**453 * Returns the {@link TermTarget} proper element454 * for the given parameter. In the paramenter is <code>null</code> or455 * not found the default value {@link TermTarget#FullText}}456 * is returned457 * @param label the term label458 * @return the proper {@link TermTarget} or the default value459 * */460 /*461 public static TermTarget getTermType(String label) {462 TermTarget type = TermTarget.FullText;463 if (label != null) {464 for (TermTarget item : TermTarget.values()) {465 if(label.trim().equals(item.fieldLabel())) {466 type = item;467 break;468 }469 }470 }471 return type;472 }473 */474 475 /**476 * Returns the {@link RecordDetail} proper element477 * for the given parameter. In the paramenter is <code>null</code> or478 * not found the default value {@link RecordDetail#DocumentSimple}}479 * is returned480 * @param label the detail label481 * @return the proper {@link RecordDetail} or the default value482 * */483 public static RecordDetail getRecordDetails(String label){484 RecordDetail type = RecordDetail.DocumentSimple;485 if (label != null) {486 for (RecordDetail item : RecordDetail.values()) {487 if(label.trim().equals(item.fieldLabel())) {488 type = item;489 break;490 }491 }492 }493 return type;494 }495 496 /**497 * Returns the {@link DateRangeTarget} proper element498 * for the given parameter. In the paramenter is <code>null</code> or499 * not found the default value {@link DateRangeTarget#TemporalCoverage}}500 * is returned501 * @param label the range label502 * @return the proper {@link DateRangeTarget} or the default value503 * */504 public static DateRangeTarget getDateRangeTarget(String label) {505 DateRangeTarget type = DateRangeTarget.TemporalCoverage;506 if (label != null) {507 for (DateRangeTarget item : DateRangeTarget.values()) {508 if(label.trim().equals(item.fieldLabel())) {509 type = item;510 break;511 }512 }513 }514 return type;515 }516 517 /**518 * Returns the {@link TemporalOperator} proper element519 * for the given parameter. In the paramenter is <code>null</code> or520 * not found the default value {@link TemporalOperator#OnOrAfter}}521 * is returned522 * @param label the operator label523 * @return the proper {@link DateRangeTarget} or the default value524 * */525 public static TemporalOperator getTemporalOperator(String label) {526 TemporalOperator type = TemporalOperator.OnOrAfter;527 if (label != null) {528 for (TemporalOperator item : TemporalOperator.values()) {529 if(label.trim().equals(item.fieldLabel())) {530 type = item;531 break;532 }533 }534 }535 return type;536 }537 538 /**539 * Returns the {@link OrderByField} proper element540 * for the given parameter.541 * @param label the field label542 * @return the proper {@link OrderByField} or <code>null</code>543 * if the label does not exist544 * */545 /*546 public static OrderByField getOrderByField(String fieldName){547 OrderByField ret = null;548 for (OrderByField orderField : OrderByField.values()) {549 if (orderField.fieldLabel().equals(fieldName)) {550 ret = orderField;551 break;552 }553 }554 return ret;555 }556 */557 558 /**559 * Returns the {@link OrderDirection} proper element560 * for the given parameter. In the paramenter is <code>null</code> or561 * not found the default value {@link OrderDirection#DESC}}562 * is returned563 * @param label the direction label564 * @return the proper {@link OrderDirection} or the default value565 * */566 public static OrderDirection getOrderDirection(String fieldName){567 OrderDirection ret = OrderDirection.DESC;568 for (OrderDirection orderField : OrderDirection.values()) {569 if (orderField.fieldLabel().equals(fieldName)) {570 ret = orderField;571 break;572 }573 }574 return ret;575 }576 577 /**578 * Returns the {@link Scope} proper element579 * for the given parameter.580 * @param label the scope label581 * @return the proper {@link Scope} or <code>null</code>582 * if the label does not exist583 * */584 public static DiscoveryDictionaryDPWS.Scope getScope(String fieldName){585 Scope ret = null;586 for (Scope orderField : Scope.values()) {587 if (orderField.fieldLabel().equals(fieldName)) {588 ret = orderField;589 break;590 }591 }592 return ret;593 }594 595 263 private static PropertyDescriptor[] pd = null; 596 264 public static PropertyDescriptor getOriginalDocumentProperty(String fieldName){ -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/jpa/ListNames.java
r8116 r8126 8 8 import javax.persistence.Entity; 9 9 import javax.persistence.FetchType; 10 import javax.persistence.GeneratedValue; 11 import javax.persistence.GenerationType; 10 12 import javax.persistence.Id; 11 13 import javax.persistence.NamedQueries; … … 24 26 @NamedQuery(name="findAllListNames", 25 27 query="select nm from ListNames nm"), 26 @NamedQuery(name="find NamesListByLabel",28 @NamedQuery(name="findListNamesByLabel", 27 29 query="select nm from ListNames nm where nm.label=:label "), 28 @NamedQuery(name="find NamesListByName",30 @NamedQuery(name="findListNamesByName", 29 31 query="select nm from ListNames nm where nm.name=:name ") 30 32 }) … … 42 44 @Id 43 45 @Column(name="id") 46 @GeneratedValue(strategy=GenerationType.AUTO) 44 47 public Integer getId() { 45 48 return this.id; -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/jpa/ListNamesItem.java
r8121 r8126 23 23 import javax.persistence.Column; 24 24 import javax.persistence.Entity; 25 import javax.persistence.GeneratedValue; 26 import javax.persistence.GenerationType; 25 27 import javax.persistence.Id; 26 28 import javax.persistence.NamedQueries; … … 59 61 @Id 60 62 @Column(name="id") 63 @GeneratedValue(strategy=GenerationType.AUTO) 61 64 public Integer getId() { 62 65 return this.id; -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/CommonMethods.java
r8119 r8126 66 66 // name? 67 67 if (order.getOrderByDirection() != null) { 68 DiscoveryDictionaryDPWS.OrderDirectiondirection = DiscoveryDictionaryDPWS.getOrderDirection(order68 ListNamesItem direction = DiscoveryDictionaryDPWS.getOrderDirection(order 69 69 .getOrderByDirection().toString()); 70 70 /* … … 72 72 */ 73 73 orderSQL.append(" "); 74 orderSQL.append(direction. fieldName());74 orderSQL.append(direction.getName()); 75 75 } 76 76 -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/DiscoveryService.java
r8123 r8126 89 89 } 90 90 91 @SuppressWarnings("unchecked") 91 92 @Override 92 public List< ?> getAllNamesList() {93 public List<ListNames> getAllNamesList() { 93 94 Query query = em.createNamedQuery("findAllListNames"); 94 95 return query.getResultList(); … … 97 98 @Override 98 99 public ListNames getNamesListByLabel(String label) { 99 Query query = em.createNamedQuery("find NamesListByLabel");100 Query query = em.createNamedQuery("findListNamesByLabel"); 100 101 query.setParameter("label", label); 101 102 return ListNames.class.cast(query.getSingleResult()); … … 104 105 @Override 105 106 public ListNames getNamesListByName(String name) throws NoResultException { 106 Query query = em.createNamedQuery("find NamesListByName");107 Query query = em.createNamedQuery("findListNamesByName"); 107 108 query.setParameter("name", name); 108 109 return ListNames.class.cast(query.getSingleResult()); -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/PresentHelper.java
r8119 r8126 25 25 import ndg.services.discovery.basic.DiscoveryDictionaryDPWS; 26 26 import ndg.services.discovery.basic.DiscoveryDictionaryDPWS.OriginalDocumentToTable; 27 import ndg.services.jpa.ListNamesItem; 27 28 import ndg.services.jpa.OriginalDocument; 28 29 import ndg.services.schemas.revitalization.discovery.BoundingBoxType; … … 102 103 103 104 String recDetail = retrieveType == null ? null : retrieveType.getRecordDetail(); 104 DiscoveryDictionaryDPWS.RecordDetaildetail = DiscoveryDictionaryDPWS.getRecordDetails(recDetail);105 ListNamesItem detail = DiscoveryDictionaryDPWS.getRecordDetails(recDetail); 105 106 /** all the IFs should be revisited */ 106 107 /* … … 109 110 } 110 111 */ 111 if (detail. equals(DiscoveryDictionaryDPWS.RecordDetail.DocumentBrief)) {112 if (detail.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_BRIEF)) { 112 113 checkFROMComma(selectSQL, false); 113 114 selectSQL.append(" dataset_name, " + customInfo); 114 115 } 115 if (detail. equals(DiscoveryDictionaryDPWS.RecordDetail.DocumentSummary)) {116 if (detail.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_SUMMARY)) { 116 117 checkFROMComma(selectSQL, false); 117 118 selectSQL.append(" dataset_name, dataset_abstract, " + customInfo); 118 119 } 119 if (detail. equals(DiscoveryDictionaryDPWS.RecordDetail.DocumentFull)) {120 if (detail.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_FULL)) { 120 121 checkFROMComma(selectSQL, false); 121 122 selectSQL.append(" dataset_name, dataset_abstract, " + customInfo); … … 140 141 /* ----- FORMAT ----- */ 141 142 String formType = retrieveType != null ? retrieveType.getRecordDetail() : null; 142 DiscoveryDictionaryDPWS.RecordDetaildetails = DiscoveryDictionaryDPWS.getRecordDetails(formType);143 if (details. equals(DiscoveryDictionaryDPWS.RecordDetail.DocumentFull)) {143 ListNamesItem details = DiscoveryDictionaryDPWS.getRecordDetails(formType); 144 if (details.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_FULL)) { 144 145 String metaFormat = retrieveType == null ? null : retrieveType.getMetadataFormat(); 145 146 preapareFormatCondition(selectSQL, fromSQL, whereSQL, metaFormat); … … 149 150 private void preapareFormatCondition(StringBuffer selectSQL, StringBuffer fromSQL, StringBuffer whereSQL, 150 151 String format) { 151 DiscoveryDictionaryDPWS.MetadataFormatdocFormat = DiscoveryDictionaryDPWS.getMetadataFormat(format);152 ListNamesItem docFormat = DiscoveryDictionaryDPWS.getMetadataFormat(format); 152 153 153 154 checkFROMComma(selectSQL, false); … … 162 163 whereSQL.append(DiscoveryDictionaryDPWS.TRANSFORMED_DOCUMENT_TABLE); 163 164 whereSQL.append(".transformed_format = '"); 164 whereSQL.append(docFormat. fieldName());165 whereSQL.append(docFormat.getName()); 165 166 whereSQL.append("'"); 166 167 checkWHERE_AND(whereSQL, false); … … 245 246 List<OriginalDocument> searchResult = executeSearch(conn, sqlQuery); 246 247 247 DiscoveryDictionaryDPWS.RecordDetaildetail = DiscoveryDictionaryDPWS.getRecordDetails(type == null ? null : type248 ListNamesItem detail = DiscoveryDictionaryDPWS.getRecordDetails(type == null ? null : type 248 249 .getRecordDetail()); 249 if (detail. equals(DiscoveryDictionaryDPWS.RecordDetail.DocumentFull)250 || detail. equals(DiscoveryDictionaryDPWS.RecordDetail.DocumentSummary)) {250 if (detail.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_FULL) 251 || detail.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_SUMMARY)) { 251 252 fillSpatialTemporalData(searchResult); 252 253 } -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/SearchHelper.java
r8124 r8126 18 18 import ndg.common.exception.ResourceNotAvailable; 19 19 import ndg.services.discovery.basic.DiscoveryDictionaryDPWS; 20 import ndg.services.discovery.basic.DiscoveryDictionaryDPWS.TemporalOperator;21 20 import ndg.services.jpa.ListNames; 22 21 import ndg.services.jpa.ListNamesItem; 23 22 import ndg.services.jpa.OriginalDocument; 24 23 import ndg.services.revitalization.EJBBeanFactory; 25 import ndg.services.revitalization.ejb.interfaces.DiscoveryServiceRemote;26 24 import ndg.services.schemas.revitalization.discovery.BoundingBoxType; 27 25 import ndg.services.schemas.revitalization.discovery.DateRangeType; … … 317 315 318 316 DateRangeType dataRangeType = temporalType.getDateRange(); 319 DiscoveryDictionaryDPWS.DateRangeTargetrangeTarget = DiscoveryDictionaryDPWS.getDateRangeTarget(dataRangeType317 ListNamesItem rangeTarget = DiscoveryDictionaryDPWS.getDateRangeTarget(dataRangeType 320 318 .getDateRangeTarget()); 321 319 List<DateValueType> dateValues = dataRangeType.getDate(); 322 320 boolean secondPass = false; 323 321 324 TemporalOperatoroperator = null;325 if (!rangeTarget. equals(DiscoveryDictionaryDPWS.DateRangeTarget.TemporalCoverage)) {322 ListNamesItem operator = null; 323 if (!rangeTarget.getLabel().equals(DiscoveryDictionaryDPWS.TEMPORAL_COVERAGE)) { 326 324 for (DateValueType dataValue : dateValues) { 327 325 checkWHERE_AND(whereSQL, secondPass); 328 326 operator = DiscoveryDictionaryDPWS.getTemporalOperator(dataValue.getTemporalOperator()); 329 whereSQL.append(" " + rangeTarget. fieldName());330 whereSQL.append(" " + operator. fieldName());327 whereSQL.append(" " + rangeTarget.getName()); 328 whereSQL.append(" " + operator.getName()); 331 329 whereSQL.append(" '" + dataValue.getDateValue() + "' "); 332 330 secondPass = true; … … 360 358 whereSQL.append(" " + DiscoveryDictionaryDPWS.TEMPORAL_DATA_TABLE); 361 359 whereSQL.append(".start_time "); 362 whereSQL.append(" " + operator. fieldName());360 whereSQL.append(" " + operator.getName()); 363 361 whereSQL.append(" '" + dataValue.getDateValue() + "' "); 364 362 } else { 365 363 whereSQL.append(" " + DiscoveryDictionaryDPWS.TEMPORAL_DATA_TABLE); 366 364 whereSQL.append(".end_time "); 367 whereSQL.append(" " + operator. fieldName());365 whereSQL.append(" " + operator.getName()); 368 366 whereSQL.append(" '" + dataValue.getDateValue() + "' "); 369 367 } … … 415 413 } 416 414 417 DiscoveryDictionaryDPWS.SpatialOperatorspatialOperator = DiscoveryDictionaryDPWS.getSpatialOperator(null);418 DiscoveryDictionaryDPWS.SpatialReferenceSystem spatialReferenceSystem = DiscoveryDictionaryDPWS415 ListNamesItem spatialOperator = DiscoveryDictionaryDPWS.getSpatialOperator(null); 416 ListNamesItem spatialReferenceSystem = DiscoveryDictionaryDPWS 419 417 .getSpatialReferenceSystem(null); 420 418 … … 448 446 checkWHERE_AND(whereSQL, false); 449 447 String spatialPart = DiscoveryDictionaryDPWS.SPATIAL_DATA_TABLE + ".geometry "; 450 if (spatialOperator. equals(DiscoveryDictionaryDPWS.SpatialOperator.OVERLAP)) {448 if (spatialOperator.getLabel().equals(DiscoveryDictionaryDPWS.SPATIAL_OPERATOR_OVERLAP)) { 451 449 whereSQL.append(spatialPart); 452 450 whereSQL.append(" && "); 453 } else if (spatialOperator. equals(DiscoveryDictionaryDPWS.SpatialOperator.WITHIN)) {451 } else if (spatialOperator.getLabel().equals(DiscoveryDictionaryDPWS.SPATIAL_OPERATOR_WITHIN)) { 454 452 whereSQL.append(spatialPart); 455 453 whereSQL.append(" @ "); 456 } else if (spatialOperator. equals(DiscoveryDictionaryDPWS.SpatialOperator.DOESNOTOVERLAP)) {454 } else if (spatialOperator.getLabel().equals(DiscoveryDictionaryDPWS.SPATIAL_OPERATOR_DOESNOTOVERLAP)) { 457 455 whereSQL.append(" NOT "); 458 456 whereSQL.append(spatialPart); … … 478 476 boolean secondPass = false; 479 477 for (String scopeLabel : scopes) { 480 DiscoveryDictionaryDPWS.Scopescope = DiscoveryDictionaryDPWS.getScope(scopeLabel);478 ListNamesItem scope = DiscoveryDictionaryDPWS.getScope(scopeLabel); 481 479 //logHelper.logMessage("Scope: " + scope, Level.DEBUG); 482 480 if (scope == null) { … … 487 485 whereSQL.append(" & "); 488 486 } 489 fromSQL.append(" '" + scope. fieldName() + "' ");487 fromSQL.append(" '" + scope.getName() + "' "); 490 488 secondPass = true; 491 489 } … … 511 509 } 512 510 513 DiscoveryDictionaryDPWS.OriginalFormatformat = DiscoveryDictionaryDPWS.getOriginalFormat(originalFormat);511 ListNamesItem format = DiscoveryDictionaryDPWS.getOriginalFormat(originalFormat); 514 512 checkWHERE_AND(whereSQL, false); 515 513 whereSQL.append(DiscoveryDictionaryDPWS.ORIGINAL_DOCUMENT_TABLE); 516 514 whereSQL.append(".original_format = '"); 517 whereSQL.append(format. fieldName());515 whereSQL.append(format.getName()); 518 516 whereSQL.append("' "); 519 517 } -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/interfaces/DiscoveryServiceLocal.java
r8118 r8126 52 52 public List<OriginalDocument> searchDocuments(DoSearchType searchType) throws NdgExecutionException; 53 53 54 public List< ?> getAllNamesList();54 public List<ListNames> getAllNamesList(); 55 55 public ListNames getNamesListByLabel(String label) throws NoResultException; 56 56 public ListNames getNamesListByName(String name) throws NoResultException; -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/interfaces/DiscoveryServiceRemote.java
r8118 r8126 52 52 public List<OriginalDocument> searchDocuments(DoSearchType searchType) throws NdgExecutionException; 53 53 54 public List< ?> getAllNamesList();54 public List<ListNames> getAllNamesList(); 55 55 public ListNames getNamesListByLabel(String label) throws NoResultException; 56 56 public ListNames getNamesListByName(String name) throws NoResultException; -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/executor/DiscoveryServiceExecutor.java
r8124 r8126 11 11 import ndg.common.exception.NdgExecutionException; 12 12 import ndg.services.discovery.basic.DiscoveryDictionaryDPWS; 13 import ndg.services.discovery.basic.DiscoveryDictionaryDPWS.RecordDetail;14 13 import ndg.services.jpa.ListNames; 15 14 import ndg.services.jpa.ListNamesItem; … … 95 94 96 95 RetrieveCriteriaType rct = doSearch.getRetrieveCriteria(); 97 DiscoveryDictionaryDPWS.RecordDetailtype = DiscoveryDictionaryDPWS.getRecordDetails(null);96 ListNamesItem type = DiscoveryDictionaryDPWS.getRecordDetails(null); 98 97 List<OrderByType> orderBy = null; 99 98 if (rct != null) { … … 159 158 List<OriginalDocument> result = EJBBeanFactory.getDiscoveryService().presentDocuments(doPresent); 160 159 String recDetail = retrieveType == null ? null : retrieveType.getRecordDetail(); 161 DiscoveryDictionaryDPWS.RecordDetaildetail = DiscoveryDictionaryDPWS.getRecordDetails(recDetail);160 ListNamesItem detail = DiscoveryDictionaryDPWS.getRecordDetails(recDetail); 162 161 if (response.getDocuments() == null) { 163 162 response.setDocuments(of.createDocuments()); … … 206 205 } 207 206 208 private void processResult(List<OriginalDocument> results, Documents documents, RecordDetailtype,207 private void processResult(List<OriginalDocument> results, Documents documents, ListNamesItem type, 209 208 List<OrderByType> orderBy) throws NdgExecutionException { 210 209 if (results != null && results.size() == 0) { … … 213 212 Object documentType = null; 214 213 for (OriginalDocument result : results) { 215 if (type. equals(DiscoveryDictionaryDPWS.RecordDetail.DocumentSimple)) {214 if (type.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_SIMPLE)) { 216 215 documentType = of.createReturnSimpleType(); 217 216 documents.getDocumentSimple().add((ReturnSimpleType)documentType); … … 224 223 * statement in order to execute the final 'fillOrderedField' -- 225 224 */ 226 if (type. equals(DiscoveryDictionaryDPWS.RecordDetail.DocumentFull)) {225 if (type.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_FULL)) { 227 226 documentType = of.createReturnFullType(); 228 227 documents.getDocumentFull().add((ReturnFullType)documentType); 229 228 fillDocument((ReturnFullType)documentType, result); 230 229 } 231 if (type. equals(DiscoveryDictionaryDPWS.RecordDetail.DocumentSummary)) {230 if (type.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_SUMMARY)) { 232 231 documentType = of.createReturnSummaryType(); 233 232 documents.getDocumentSummary().add((ReturnSummaryType)documentType); 234 233 fillDocument((ReturnSummaryType)documentType, result); 235 234 } 236 if (type. equals(DiscoveryDictionaryDPWS.RecordDetail.DocumentBrief)) {235 if (type.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_BRIEF)) { 237 236 documentType = of.createReturnBriefType(); 238 237 documents.getDocumentBrief().add((ReturnBriefType)documentType); … … 290 289 ret = of.createOrderingMetricType(); 291 290 } 292 /*293 if (ReturnFullType.class.isAssignableFrom(documentType.getClass())) {294 ReturnFullType tmp = (ReturnFullType) documentType;295 ret = of.createOrderingMetricType();296 }297 if (ReturnBriefType.class.isAssignableFrom(documentType.getClass())) {298 ReturnBriefType tmp = (ReturnBriefType) documentType;299 ret = of.createOrderingMetricType();300 }301 if (ReturnSummaryType.class.isAssignableFrom(documentType.getClass())) {302 ReturnSummaryType tmp = (ReturnSummaryType) documentType;303 ret = of.createOrderingMetricType();304 }305 */306 291 return ret; 307 292 } -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/harvest/waf/WAFHarvester.java
r8121 r8126 34 34 35 35 import ndg.common.exception.NdgExecutionException; 36 import ndg.common.http.HTTPHelper; 36 37 import ndg.common.xml.DocumentHelper; 37 import ndg.commons.http.HTTPHelper;38 38 import ndg.services.revitalization.harvest.HarvesterBase; 39 39 import ndg.services.revitalization.jpa.HiProcess; -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java/ndg/services/revitalization/ejb/discovery/DBTestBase.java
r8123 r8126 19 19 package ndg.services.revitalization.ejb.discovery; 20 20 21 import java.io.IOException; 22 import java.io.InputStream; 21 23 import java.sql.Connection; 22 24 import java.sql.DriverManager; 23 import java.util. HashMap;24 import java.util. Map;25 import java.util.ArrayList; 26 import java.util.List; 25 27 26 28 import javax.persistence.EntityManager; … … 32 34 import ndg.services.revitalization.ejb.HiProcessModel; 33 35 import ndg.services.revitalization.ejb.ModelManager; 34 import ndg.services.revitalization.jpa.HiStatus;35 import ndg.services.revitalization.jpa.ServiceConfig;36 36 37 import org.apache.commons.collections.CollectionUtils; 38 import org.apache.commons.io.IOUtils; 39 import org.apache.commons.lang.StringUtils; 37 40 import org.hsqldb.jdbc.JDBCDataSource; 38 41 import org.junit.After; … … 57 60 @Before 58 61 public void setUp() throws Exception { 59 try {60 logger.info("Starting in-memory HSQL database for unit tests");61 Class.forName("org.hsqldb.jdbcDriver");62 connection = DriverManager.getConnection(63 "jdbc:hsqldb:mem:unit-testing-jpa", "sa", "");64 connection.setAutoCommit(false);65 } catch (Exception ex) {66 ex.printStackTrace();67 Assert.fail("Exception during HSQL database startup.");68 }69 70 71 62 DiscoveryService discoveryService = new DiscoveryService(getDiscoveryDBds(), getDiscoveryEntityManager()); 72 63 HiProcessModel hiProcessModel = new HiProcessModel(getDPWSEntityManager()); 73 64 ModelManager modelManager = new ModelManager(getDPWSEntityManager(), getDiscoveryEntityManager(), hiProcessModel, null); 74 65 EJBBeanFactory.overrideEJBBeans(discoveryService, modelManager); 75 initializeServiceConfig(); 76 initialize HiStatus();66 initializeDiscoveryDB(); 67 initializeDPWSDB(); 77 68 } 78 69 … … 100 91 } 101 92 93 DataSource getDiscoveryDBds() { 94 if (discoveryDBds == null) { 95 logger.info("Building Discovery DataSource for unit tests"); 96 JDBCDataSource ds = new JDBCDataSource(); 97 ds.setUrl("jdbc:hsqldb:mem:discoveryDB"); 98 ds.setUser("sa"); 99 ds.setPassword(""); 100 discoveryDBds = ds; 101 } 102 return discoveryDBds; 103 } 104 102 105 private EntityManagerFactory getDiscoveryEntityManagerFactory() { 103 106 if (discoveryEntityManagerFactory == null) { … … 132 135 } 133 136 134 DataSource getDiscoveryDBds() { 135 if (discoveryDBds == null) { 136 logger.info("Building Discovery DataSource for unit tests"); 137 JDBCDataSource ds = new JDBCDataSource(); 138 ds.setUrl("jdbc:hsqldb:mem:unit-testing-jpa"); 139 ds.setUser("sa"); 140 ds.setPassword(""); 141 discoveryDBds = ds; 137 private List<String> getInserts(String fileName) { 138 InputStream is = getClass().getClassLoader().getResourceAsStream(fileName); 139 List<String> inserts = null; 140 try { 141 inserts = IOUtils.readLines(is); 142 } catch (IOException e) { 143 e.printStackTrace(); 142 144 } 143 return discoveryDBds;145 return CollectionUtils.isEmpty(inserts) ? new ArrayList<String>() : inserts; 144 146 } 145 147 146 private void initializeHiStatus() { 147 Map<String, String> hiStatusMap = new HashMap<String, String>(); 148 hiStatusMap.put("start_harv", "The harvesting process is starting"); 149 hiStatusMap.put("run_harv", "The harvesting process is running"); 150 hiStatusMap.put("end_harv", "The harvesting process is terminated"); 151 hiStatusMap.put("start_ingest", "The ingest process is starting"); 152 hiStatusMap.put("run_ingest", "The ingest process is running"); 153 hiStatusMap.put("end_ingest", "The ingest process is terminated"); 154 hiStatusMap.put("run_harv", "The Harvesting process has failed"); 155 hiStatusMap.put("failed_harv", "The harvesting process is running"); 156 hiStatusMap.put("failed_ingest", "The Ingest process has failed"); 157 158 getDPWSEntityManager().getTransaction().begin(); 159 HiStatus hiStatus = null; 160 for (String key : hiStatusMap.keySet()) { 161 hiStatus = new HiStatus(); 162 hiStatus.setId(key); 163 hiStatus.setDescription(hiStatusMap.get(key)); 164 getDPWSEntityManager().persist(hiStatus); 148 private void initializeDB(EntityManager entityManager, List<String> inserts) { 149 entityManager.getTransaction().begin(); 150 for (String insert : inserts) { 151 if (StringUtils.isEmpty(insert) || insert.startsWith("#")) { 152 continue; 153 } 154 if (StringUtils.contains(insert, "${TEST_PATH}")) { 155 insert = StringUtils.replaceOnce(insert, "${TEST_PATH}", getClass().getClassLoader().getResource(".").getPath()); 156 logger.debug("insert: " + insert); 157 } 158 logger.debug("insert: " + insert); 159 entityManager.createNativeQuery(insert).executeUpdate(); 165 160 } 166 getDPWSEntityManager().getTransaction().commit();161 entityManager.getTransaction().commit(); 167 162 } 168 163 169 private void initializeServiceConfig() { 170 Map<String, String> serviceConfigMap = new HashMap<String, String>(); 171 serviceConfigMap.put("HARVEST_ROOT_PATH", getClass().getClassLoader().getResource(".").getPath()); 172 getDPWSEntityManager().getTransaction().begin(); 173 ServiceConfig serviceConfig = null; 174 for (String key : serviceConfigMap.keySet()) { 175 serviceConfig = new ServiceConfig(); 176 serviceConfig.setParamName(key); 177 serviceConfig.setParamValue(serviceConfigMap.get(key)); 178 getDPWSEntityManager().persist(serviceConfig); 179 } 180 getDPWSEntityManager().getTransaction().commit(); 164 private void initializeDPWSDB() { 165 initializeDB(getDPWSEntityManager(), getInserts("DPWS.sql")); 166 } 167 168 private void initializeDiscoveryDB() { 169 initializeDB(getDiscoveryEntityManager(), getInserts("Discovery.sql")); 181 170 } 182 171 } -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/resources/Discovery.sql
r8118 r8126 1 CREATE SEQUENCE names_id_seq; 1 #Initialise ListNames 2 INSERT INTO list_names (id,name,label) VALUES (1,'TermTarget','TermTargetList'); 3 INSERT INTO list_names (id,name,label) VALUES (2,'OriginalFormat','OriginalFormatList'); 4 INSERT INTO list_names (id,name,label) VALUES (3,'OrderByField','OrderByFieldList'); 5 INSERT INTO list_names (id,name,label) VALUES (5,'Scope','ScopeList'); 6 INSERT INTO list_names (id,name,label) VALUES (6,'SpatialOperator','SpatialOperatorList'); 7 INSERT INTO list_names (id,name,label) VALUES (7,'SpatialReferenceSystem','SpatialReferenceSystemList'); 8 INSERT INTO list_names (id,name,label) VALUES (8,'DateRangeTarget','DateRangeTargetList'); 9 INSERT INTO list_names (id,name,label) VALUES (9,'TemporalOperator','TemporalOperatorList'); 10 INSERT INTO list_names (id,name,label) VALUES (10,'MetadataFormat','MetadataFormatList'); 11 INSERT INTO list_names (id,name,label) VALUES (11,'RecordDetail','RecordDetailList'); 12 INSERT INTO list_names (id,name,label) VALUES (12,'OrderDirection','OrderDirectionList'); 2 13 3 CREATE TABLE list_names 4 ( 5 id integer NOT NULL DEFAULT NEXT VALUE FOR 'names_id_seq', 6 "name" character varying(100) NOT NULL, 7 label text NOT NULL, 8 CONSTRAINT names_pkey PRIMARY KEY (id) 9 ) 10 WITH ( 11 OIDS=FALSE 12 ); 13 ALTER TABLE list_names OWNER TO badc; 14 #Initialise ListNamesItems 15 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (1,1,'document_ts_vector','FullText',true,true,null); 16 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (2,1,'authors_ts_vector','Author',false,true,null); 17 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (3,1,'parameters_ts_vector','Parameters',false,true,null); 18 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (4,1,'resource_type_ts_vector','ResourceType',false,true,null); 19 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (5,1,'topic_category_ts_vector','TopicCategory',false,true,null); 20 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (6,1,'lineage_ts_vector','Lineage',false,true,null); 21 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (7,1,'limitations_public_access_ts_vector','PublicAccessLimits',false,true,null); 22 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (8,1,'data_originator_tsvector','DataOriginator',false,true,null); 23 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (9,1,'original_format_name','DataFormat',false,false,null); 24 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (10,1,'data_formats','AvailableDataFormats',false,false,null); 25 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (11,1,'inspire_themes_ts_vector','InspireThemes',false,true,null); 26 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (12,1,'vertical_extent_ts_vector','VerticalExtent',false,true,null); 27 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (13,2,'DIF_9.4','DIF_9.4',false,false,null); 28 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (14,2,'MEDIN_2.3','MEDIN_2.3',false,false,null); 29 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (15,2,'ISO19115','ISO19115',false,false,null); 30 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (16,3,'original_document.dataset_start_date_nom','DatasetStartDate',false,false,'datasetStartDateNom'); 31 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (17,3,'original_document.dataset_end_date_nom','DatasetEndDate',false,false,'datasetEndDateNom'); 32 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (18,3,'original_document.datacentre_name','DataCenter',false,false,'datacentreName'); 33 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (19,3,'original_document.update_date','DatasetUpdateOrder',false,false,'updateDate'); 34 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (20,3,'original_document.create_date','DiscoveryIngestDate',false,false,'createDate'); 35 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (21,3,'original_document.dataset_metadata_update_date','DatasetMetadataUpdateDate',false,false,'datasetMetadataUpdateDate'); 36 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (22,3,'original_document.dataset_name','DiscoveryTitle',false,false,'datasetName'); 37 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (23,5,'MDIP','MDIP',false,false,null); 38 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (24,5,'MDIP','MDIP',false,false,null); 39 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (25,5,'NERC_DDC','NERC_DDC',false,false,null); 40 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (26,5,'NERC','NERC',false,false,null); 41 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (27,5,'DPPP','DPPP',false,false,null); 42 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (28,6,'Overlaps','Overlaps',true,false,null); 43 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (29,6,'DoesNotOverlap','DoesNotOverlap',false,false,null); 44 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (30,6,'Within','Within',false,false,null); 45 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (31,7,'EPSG4326','EPSG4326',false,false,null); 46 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (32,8,'TemporalCoverage','TemporalCoverage',true,false,null); 47 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (33,8,'dataset_metadata_update_date','LastRevisionDate',false,false,null); 48 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (34,8,'update_date','DiscoveryIngestDate',false,false,null); 49 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (35,9,'=','Equals',false,false,null); 50 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (36,9,'<>','DoesNotEqual',false,false,null); 51 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (37,9,'<=','OnOrBefore',false,false,null); 52 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (38,9,'>=','OnOrAfter',true,false,null); 53 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (39,9,'<','Before',false,false,null); 54 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (40,9,'>','After',false,false,null); 55 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (41,10,'DIF_9.4','DIF_9.4',false,false,null); 56 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (42,10,'DC','DC',false,false,null); 57 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (43,10,'MEDIN_2.3','MEDIN_2.3',false,false,null); 58 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (44,10,'ISO19115','ISO19115',false,false,null); 59 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (45,10,'NERC_DMS_0.7','NERC_DMS_0.7',true,false,null); 60 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (46,11,'Simple','DocumentSimple',true,false,null); 61 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (47,11,'Brief','DocumentBrief',false,false,null); 62 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (48,11,'Summary','DocumentSummary',false,false,null); 63 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (49,11,'Full','DocumentFull',false,false,null); 64 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (50,12,'DESC','descending',true,false,null); 65 INSERT INTO list_names_item (id,list_names_id,name,label,default_,term_target_vector,order_by_field_od_field) VALUES (51,12,'ASC','ascending',false,false,null); -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/resources/META-INF/persistence.xml
r8121 r8126 10 10 <class>ndg.services.jpa.ListNamesItem</class> 11 11 <properties> 12 <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:discovery -unit-testing" />12 <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:discoveryDB" /> 13 13 <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" /> 14 14 <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" /> … … 31 31 <class>ndg.services.revitalization.jpa.ServiceConfig</class> 32 32 <class>ndg.services.revitalization.jpa.HarvestLog</class> 33 <class>ndg.services.revitalization.jpa.ServiceParameter</class> 34 <class>ndg.services.revitalization.jpa.ServiceParameterValue</class> 33 35 <properties> 34 <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:d pws-unit-testing" />36 <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:discoveryDPWS" /> 35 37 <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" /> 36 38 <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
Note: See TracChangeset
for help on using the changeset viewer.