Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

fix pgsql lob behavior #466

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions model/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>

<dependency>
<groupId>net.iharder</groupId>
<artifactId>base64</artifactId>
</dependency>

</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import net.iharder.Base64;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;

import java.io.IOException;

/**
* The iOS variant class encapsulates APNs specific behavior.
*/
Expand All @@ -37,7 +40,7 @@ public class iOSVariant extends Variant {

@NotNull(message = "Certificate must be provided")
@JsonIgnore
private byte[] certificate;
private String certificateData;

/**
* If <code>true</code> a connection to Apple's Production APNs server
Expand Down Expand Up @@ -75,12 +78,16 @@ public void setPassphrase(final String passphrase) {
*/
@JsonIgnore
public byte[] getCertificate() {
return certificate;
try {
return Base64.decode(certificateData);
} catch (IOException e) {
throw new RuntimeException(e);
}
}

@JsonProperty
public void setCertificate(byte[] cert) {
this.certificate = cert;
this.certificateData = Base64.encodeBytes(cert);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions model/jpa/src/main/resources/META-INF/orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
<entity class="iOSVariant" access="FIELD">
<discriminator-value>ios</discriminator-value>
<attributes>
<basic name="certificate">
<lob/>
<basic name="certificateData">
<column name="cert_data" length="100000"/>
</basic>
</attributes>
</entity>
Expand Down