Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit 0f9ef06

Browse files
committed
Merge pull request #112 from MartyBurns/master
Merge of retailtosubscription into master
2 parents 91f5e6b + 2f1a29e commit 0f9ef06

File tree

68 files changed

+1981
-1079
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1981
-1079
lines changed
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
drop DATABASE IF EXISTS datacustodian ;
2-
drop database IF EXISTS thirdparty;
1+
drop database IF EXISTS datacustodian ;
32
drop database IF EXISTS tokenstore;
43
show databases;
54
create database datacustodian;
6-
create database thirdparty;
75
create database tokenstore;
86
show databases;
97

etc/cleandatabases_tp.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
drop database IF EXISTS thirdparty;
2+
show databases;
3+
create database thirdparty;
4+
show databases;
5+
Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,13 @@ TRUNCATE TABLE application_information_scopes;
2424
TRUNCATE TABLE application_information;
2525

2626

27-
USE thirdparty
28-
TRUNCATE TABLE authorizations;
29-
TRUNCATE TABLE BatchList;
30-
TRUNCATE TABLE electric_power_quality_summaries;
31-
TRUNCATE TABLE electric_power_usage_summaries;
32-
TRUNCATE TABLE interval_readings;
33-
TRUNCATE TABLE interval_blocks;
34-
TRUNCATE TABLE meter_readings;
35-
TRUNCATE TABLE meter_reading_related_links;
36-
TRUNCATE TABLE line_item;
37-
TRUNCATE TABLE reading_qualities;
38-
TRUNCATE TABLE reading_types;
39-
TRUNCATE TABLE resources;
40-
TRUNCATE TABLE retail_customers;
41-
TRUNCATE TABLE service_delivery_points;
42-
TRUNCATE TABLE subscriptions;
43-
TRUNCATE TABLE subscriptions_usage_points;
44-
TRUNCATE TABLE time_configurations;
45-
TRUNCATE TABLE usage_point_related_links;
46-
TRUNCATE TABLE usage_points;
47-
TRUNCATE TABLE application_information_scopes;
48-
TRUNCATE TABLE application_information;
49-
5027
USE tokenstore
51-
5228
TRUNCATE TABLE oauth_client_details;
5329
TRUNCATE TABLE oauth_client_token;
5430
TRUNCATE TABLE oauth_access_token;
5531
TRUNCATE TABLE oauth_refresh_token;
5632
TRUNCATE TABLE oauth_code;
5733
TRUNCATE TABLE oauth_approvals;
58-
TRUNCATE TABLE ClientDetails;
34+
TRUNCATE TABLE clientdetails;
35+
36+
SET FOREIGN_KEY_CHECKS=1;

etc/cleantables_tp.sql

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
SET FOREIGN_KEY_CHECKS=0;
2+
3+
USE thirdparty
4+
TRUNCATE TABLE authorizations;
5+
TRUNCATE TABLE BatchList;
6+
TRUNCATE TABLE electric_power_quality_summaries;
7+
TRUNCATE TABLE electric_power_usage_summaries;
8+
TRUNCATE TABLE interval_readings;
9+
TRUNCATE TABLE interval_blocks;
10+
TRUNCATE TABLE meter_readings;
11+
TRUNCATE TABLE meter_reading_related_links;
12+
TRUNCATE TABLE line_item;
13+
TRUNCATE TABLE reading_qualities;
14+
TRUNCATE TABLE reading_types;
15+
TRUNCATE TABLE resources;
16+
TRUNCATE TABLE retail_customers;
17+
TRUNCATE TABLE service_delivery_points;
18+
TRUNCATE TABLE subscriptions;
19+
TRUNCATE TABLE subscriptions_usage_points;
20+
TRUNCATE TABLE time_configurations;
21+
TRUNCATE TABLE usage_point_related_links;
22+
TRUNCATE TABLE usage_points;
23+
TRUNCATE TABLE application_information_scopes;
24+
TRUNCATE TABLE application_information;
25+
26+
SET FOREIGN_KEY_CHECKS=1;

etc/datacustodianmysql.sql

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ CREATE TABLE `subscriptions_usage_points` (
8484
`usagePoints_id` bigint(20) NOT NULL,
8585
KEY `FK_862cd528c4954f4cb2bcdadaf08` (`usagePoints_id`),
8686
KEY `FK_c138e968ff2d4cd49398210f48c` (`subscriptions_id`),
87-
CONSTRAINT `FK_c138e968ff2d4cd49398210f48c` FOREIGN KEY (`subscriptions_id`) REFERENCES `subscriptions` (`id`),
88-
CONSTRAINT `FK_862cd528c4954f4cb2bcdadaf08` FOREIGN KEY (`usagePoints_id`) REFERENCES `usage_points` (`id`)
89-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
87+
CONSTRAINT `FK_c138e968ff2d4cd49398210f48c` FOREIGN KEY (`subscriptions_id`) REFERENCES `subscriptions` (`id`)
88+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
9089
/*!40101 SET character_set_client = @saved_cs_client */;
9190

9291
--
@@ -331,9 +330,9 @@ CREATE TABLE `authorizations` (
331330
`description` varchar(255) DEFAULT NULL,
332331
`published` datetime DEFAULT NULL,
333332
`self_link_href` varchar(255) DEFAULT NULL,
334-
`self_link_rel` varchar(255) DEFAULT NULL,
333+
`self_link_rel` varchar(255) DEFAULT 'self',
335334
`up_link_href` varchar(255) DEFAULT NULL,
336-
`up_link_rel` varchar(255) DEFAULT NULL,
335+
`up_link_rel` varchar(255) DEFAULT 'up',
337336
`updated` datetime DEFAULT NULL,
338337
`uuid` varchar(255) NOT NULL,
339338
`access_token` varchar(255) DEFAULT NULL,
@@ -364,9 +363,7 @@ CREATE TABLE `authorizations` (
364363
KEY `FK_d0761ae9d2dd44c49867ac4ec4b` (`application_information_id`),
365364
KEY `FK_a4fccef421a14e0ead5c1b9753d` (`retail_customer_id`),
366365
KEY `FK_subscriptionkey` (`subscription_id`),
367-
CONSTRAINT `FK_a4fccef421a14e0ead5c1b9753d` FOREIGN KEY (`retail_customer_id`) REFERENCES `retail_customers` (`id`),
368-
CONSTRAINT `FK_d0761ae9d2dd44c49867ac4ec4b` FOREIGN KEY (`application_information_id`) REFERENCES `application_information` (`id`),
369-
CONSTRAINT `FK_subscriptionkey` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions` (`id`)
366+
CONSTRAINT `FK_d0761ae9d2dd44c49867ac4ec4b` FOREIGN KEY (`application_information_id`) REFERENCES `application_information` (`id`)
370367
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
371368
/*!40101 SET character_set_client = @saved_cs_client */;
372369

@@ -399,9 +396,9 @@ CREATE TABLE `subscriptions` (
399396
`description` varchar(255) DEFAULT NULL,
400397
`published` datetime DEFAULT NULL,
401398
`self_link_href` varchar(255) DEFAULT NULL,
402-
`self_link_rel` varchar(255) DEFAULT NULL,
399+
`self_link_rel` varchar(255) DEFAULT 'self',
403400
`up_link_href` varchar(255) DEFAULT NULL,
404-
`up_link_rel` varchar(255) DEFAULT NULL,
401+
`up_link_rel` varchar(255) DEFAULT 'up',
405402
`updated` datetime DEFAULT NULL,
406403
`uuid` varchar(255) NOT NULL,
407404
`hashedId` varchar(255) DEFAULT NULL,
@@ -536,7 +533,7 @@ DROP TABLE IF EXISTS `retail_customers`;
536533
/*!40101 SET @saved_cs_client = @@character_set_client */;
537534
/*!40101 SET character_set_client = utf8 */;
538535
CREATE TABLE `retail_customers` (
539-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
536+
`id` bigint(20) NOT NULL,
540537
`description` varchar(255) DEFAULT NULL,
541538
`published` datetime DEFAULT NULL,
542539
`self_link_href` varchar(255) DEFAULT NULL,
@@ -552,7 +549,7 @@ CREATE TABLE `retail_customers` (
552549
`role` varchar(255) NOT NULL,
553550
`username` varchar(30) DEFAULT NULL,
554551
PRIMARY KEY (`id`)
555-
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
552+
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
556553
/*!40101 SET character_set_client = @saved_cs_client */;
557554

558555
--
@@ -580,6 +577,7 @@ DROP TABLE IF EXISTS `application_information`;
580577
/*!40101 SET character_set_client = utf8 */;
581578
CREATE TABLE `application_information` (
582579
`id` bigint(20) NOT NULL AUTO_INCREMENT,
580+
`kind` varchar(255) DEFAULT NULL,
583581
`description` varchar(255) DEFAULT NULL,
584582
`published` datetime DEFAULT NULL,
585583
`self_link_href` varchar(255) DEFAULT NULL,

etc/espiDerived.xsd

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!--
44
==========================================================================
55
Schema: espiDerived.xsd
6-
Version: 0.7.20140304
6+
Version: 0.7.20140529
77
Author: Ron Pasquarelli & Marty Burns (Hypertek for NIST), John Teeter (for NIST), Don Coffin (Remi Networks)
88
==========================================================================
99
@@ -76,16 +76,6 @@ self link to this resource</xs:documentation>
7676
<xs:documentation>A code indicating the current status of the application. This value is provided by Data Custodian, cannot be modified by Third Party.</xs:documentation>
7777
</xs:annotation>
7878
</xs:element>
79-
<xs:element name="dataCustodianDefaultBatchResource" type="xs:anyURI" minOccurs="0">
80-
<xs:annotation>
81-
<xs:documentation>The default endpoint for Batch requests. This value is provided by Data Custodian, updated in approved applications objects, and cannot be modified by Third Party.</xs:documentation>
82-
</xs:annotation>
83-
</xs:element>
84-
<xs:element name="dataCustodianDefaultSubscriptionResource" type="xs:anyURI" minOccurs="0">
85-
<xs:annotation>
86-
<xs:documentation>The default endpoint for Subscription requests. This value is provided by Data Custodian, updated in approved applications objects, cannot be modified by Third Party.</xs:documentation>
87-
</xs:annotation>
88-
</xs:element>
8979
<xs:element name="thirdPartyApplicationDescription" type="String256" minOccurs="0">
9080
<xs:annotation>
9181
<xs:documentation>A description of the application.</xs:documentation>
@@ -149,26 +139,11 @@ self link to this resource</xs:documentation>
149139
<xs:documentation>{DataCustodianBulkRequestURI} URI of DataCustodian’s Bulk Request endpoint. The value is provided by the Data Custodian and cannot be modified by the ThirdParty. The field MUST be a valid URI.</xs:documentation>
150140
</xs:annotation>
151141
</xs:element>
152-
<xs:element name="dataCustodianThirdPartySelectionScreenURI" type="xs:anyURI" minOccurs="0">
153-
<xs:annotation>
154-
<xs:documentation>{DataCustodianThirdPartySelectionScreenURI} URI of Data Custodian’s Third Party Selection web page. The field MUST be a valid URI.</xs:documentation>
155-
</xs:annotation>
156-
</xs:element>
157142
<xs:element name="dataCustodianResourceEndpoint" type="xs:anyURI" minOccurs="0">
158143
<xs:annotation>
159144
<xs:documentation>{ResourceServer}{ResourcePath}</xs:documentation>
160145
</xs:annotation>
161146
</xs:element>
162-
<xs:element name="thirdPartyDataCustodianSelectionScreenURI" type="xs:anyURI" minOccurs="0">
163-
<xs:annotation>
164-
<xs:documentation>{ThirdPartyDataUsagePolicyURI} URI that points to a human-readable Policy document for the ThirdParty. The Data Custodian’s {AuthorizationServer} SHOULD display this URI to the end user. The policy usually describes how an end user’s data will be used by the ThirdParty. The value of the field MUST point to a valid web page.</xs:documentation>
165-
</xs:annotation>
166-
</xs:element>
167-
<xs:element name="thirdPartyLoginScreenURI" type="xs:anyURI" minOccurs="0">
168-
<xs:annotation>
169-
<xs:documentation>URI of the Login Screen used by the Third Party to authenticate the identity of the Retail Customer. The field MUST be a valid URI.</xs:documentation>
170-
</xs:annotation>
171-
</xs:element>
172147
<xs:element name="thirdPartyScopeSelectionScreenURI" type="xs:anyURI" minOccurs="0">
173148
<xs:annotation>
174149
<xs:documentation>URI of the Scope Selection Screen used by the Retail Customer to select the characteristics of the Green Button data to be shared with the ThirdParty. The field MUST be a valid URI.</xs:documentation>
@@ -305,11 +280,6 @@ Note: for privacy there is no identifier of the RetailCustomer in this structure
305280
<xs:documentation>Restricts access to the objects within the associated resource that were published within this date time interval.</xs:documentation>
306281
</xs:annotation>
307282
</xs:element>
308-
<xs:element name="referenceID" minOccurs="0">
309-
<xs:annotation>
310-
<xs:documentation>referenceID used in constructing of URIs for resources (e.g. in the RESTful API examples, this would populate the RetailCustomerID field)</xs:documentation>
311-
</xs:annotation>
312-
</xs:element>
313283
<xs:element name="access_token" type="String512" minOccurs="0">
314284
<xs:annotation>
315285
<xs:documentation>Contains the access token associated with this authorization. (OAuth contains access_token for RetailCustomer resources obtained through authorization code flow, registration_access_token obtained in the registration process, and an access_token obtained through client credentials flow)</xs:documentation>
@@ -320,7 +290,7 @@ Note: for privacy there is no identifier of the RetailCustomer in this structure
320290
<xs:documentation>The status of this authorization.</xs:documentation>
321291
</xs:annotation>
322292
</xs:element>
323-
<xs:element name="expires_in" type="TimeType" minOccurs="0">
293+
<xs:element name="expires_at" type="TimeType" minOccurs="0">
324294
<xs:annotation>
325295
<xs:documentation>Expiration period for the accessToken</xs:documentation>
326296
</xs:annotation>
@@ -340,26 +310,11 @@ Note: for privacy there is no identifier of the RetailCustomer in this structure
340310
<xs:documentation>Negotiated scope of the authorization</xs:documentation>
341311
</xs:annotation>
342312
</xs:element>
343-
<xs:element name="state" type="String256" minOccurs="0">
344-
<xs:annotation>
345-
<xs:documentation>transient opaque value used in the authorization exchange</xs:documentation>
346-
</xs:annotation>
347-
</xs:element>
348-
<xs:element name="response_type" type="ResponseType" minOccurs="0">
349-
<xs:annotation>
350-
<xs:documentation>enumeration of code or token</xs:documentation>
351-
</xs:annotation>
352-
</xs:element>
353313
<xs:element name="token_type" type="TokenType" minOccurs="0">
354314
<xs:annotation>
355315
<xs:documentation>type of token used</xs:documentation>
356316
</xs:annotation>
357317
</xs:element>
358-
<xs:element name="code" type="String512" minOccurs="0">
359-
<xs:annotation>
360-
<xs:documentation>onetime use code that must be retained to detect tamper</xs:documentation>
361-
</xs:annotation>
362-
</xs:element>
363318
<xs:element name="error" type="OAuthError" minOccurs="0">
364319
<xs:annotation>
365320
<xs:documentation>contains last error returned to ThirdParty</xs:documentation>
@@ -2900,6 +2855,12 @@ Enumerations
29002855
<xs:documentation>data that failed at least one of the required validation checks but was determined to represent actual usage</xs:documentation>
29012856
</xs:annotation>
29022857
</xs:enumeration>
2858+
<xs:enumeration value="19">
2859+
<xs:annotation>
2860+
<xs:appinfo>revenue-quality</xs:appinfo>
2861+
<xs:documentation>data that is valid for billing purposes</xs:documentation>
2862+
</xs:annotation>
2863+
</xs:enumeration>
29032864
</xs:restriction>
29042865
</xs:simpleType>
29052866
</xs:union>

etc/initializedatabases.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,17 @@
44
# then establishes all the tables
55
# then populates tables with initial data
66
#
7-
# Copy the appropriate version of prepopulatesql_<host><port>.sql to prepopulatesql.sql for your installation
8-
mysql --user=root --password=password < setupdatabases.sql
7+
# Copy the appropriate version of prepopulatesql_<dc or tp>_<host><port>.sql to prepopulatesql.sql for your installation
8+
9+
# drop/create databases
10+
mysql --user=root --password=password < cleandatabases_dc.sql
11+
mysql --user=root --password=password < cleandatabases_tp.sql
12+
13+
# create tables
14+
mysql --user=root --password=password < thirdpartymysql.sql
15+
mysql --user=root --password=password < datacustodianmysql.sql
16+
mysql --user=root --password=password < tokenstore.sql
17+
18+
# prepopulate tables
19+
mysql --user=root --password=password < prepopulatesql_dc.sql
20+
mysql --user=root --password=password < prepopulatesql_tp.sql

0 commit comments

Comments
 (0)