-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...st-applications/jakartadata/src/io/openliberty/jpa/data/tests/models/DemographicInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 IBM Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package io.openliberty.jpa.data.tests.models; | ||
|
||
import java.math.BigDecimal; | ||
import java.math.BigInteger; | ||
import java.time.Instant; | ||
import java.time.ZoneId; | ||
import java.time.ZonedDateTime; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
|
||
/** | ||
* Recreate from io.openliberty.data.internal_fat_jpa | ||
*/ | ||
@Entity | ||
public class DemographicInfo { | ||
|
||
@Column | ||
public Instant collectedOn; | ||
|
||
@GeneratedValue | ||
@Id | ||
public BigInteger id; | ||
|
||
@Column | ||
public BigDecimal publicDebt; | ||
|
||
@Column | ||
public BigDecimal intragovernmentalDebt; | ||
|
||
@Column | ||
public BigInteger numFullTimeWorkers; | ||
|
||
public static DemographicInfo of(int year, int month, int day, | ||
long numFullTimeWorkers, | ||
double intragovernmentalDebt, double publicDebt) { | ||
DemographicInfo inst = new DemographicInfo(); | ||
inst.collectedOn = ZonedDateTime.of(year, month, day, 12, 0, 0, 0, ZoneId.of("America/New_York")).toInstant(); | ||
inst.numFullTimeWorkers = BigInteger.valueOf(numFullTimeWorkers); | ||
inst.intragovernmentalDebt = BigDecimal.valueOf(intragovernmentalDebt); | ||
inst.publicDebt = BigDecimal.valueOf(publicDebt); | ||
return inst; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DemographicInfo from " + collectedOn; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters