// Path: src/main/java/com/orange/clara/cloud/servicedbdumper/converter/MetadataConverter.java
// @Converter
// public class MetadataConverter implements AttributeConverter<Metadata, String> {
//     @Override
//     public String convertToDatabaseColumn(Metadata metadata) {
//         if (metadata == null) {
//             return null;
//         }
//         ObjectMapper objectMapper = new ObjectMapper();
//         try {
//             return objectMapper.writeValueAsString(metadata);
//         } catch (JsonProcessingException e) {
//             throw new RuntimeException(e.getMessage(), e);
//         }
//     }
// 
//     @Override
//     public Metadata convertToEntityAttribute(String metadataInJson) {
//         if (metadataInJson == null) {
//             return null;
//         }
//         ObjectMapper objectMapper = new ObjectMapper();
//         try {
//             return objectMapper.readValue(metadataInJson, Metadata.class);
//         } catch (IOException e) {
//             throw new RuntimeException(e.getMessage(), e);
//         }
//     }
// }


import com.orange.clara.cloud.servicedbdumper.converter.CryptoConverter;
import com.orange.clara.cloud.servicedbdumper.converter.MetadataConverter;
import javax.persistence.*;
import java.io.File;
import java.util.Calendar;
import java.util.Date;
package com.orange.clara.cloud.servicedbdumper.model;




/**
 * Copyright (C) 2015 Orange
 * <p>
 * This software is distributed under the terms and conditions of the 'Apache-2.0'
 * license which can be found in the file 'LICENSE' in this package distribution
 * or at 'https://opensource.org/licenses/Apache-2.0'.
 * <p>
 * Author: Arthur Halet
 * Date: 03/06/2015
 */
@Entity
public class DatabaseDumpFile {

    protected String user;
    @Convert(converter = CryptoConverter.class)
    protected String password;
    protected Boolean showable;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;

    private String fileName;
    @Column(name = "created_at")
    private Date createdAt;

    @Column(name = "deleted_at")
    private Date deletedAt;

    @ManyToOne
    @JoinColumn(name = "service_instance_id")
    private DbDumperServiceInstance dbDumperServiceInstance;

// Path: src/main/java/com/orange/clara/cloud/servicedbdumper/converter/MetadataConverter.java
// @Converter
// public class MetadataConverter implements AttributeConverter<Metadata, String> {
//     @Override
//     public String convertToDatabaseColumn(Metadata metadata) {
//         if (metadata == null) {
//             return null;
//         }
//         ObjectMapper objectMapper = new ObjectMapper();
//         try {
//             return objectMapper.writeValueAsString(metadata);
//         } catch (JsonProcessingException e) {
//             throw new RuntimeException(e.getMessage(), e);
//         }
//     }
// 
//     @Override
//     public Metadata convertToEntityAttribute(String metadataInJson) {
//         if (metadataInJson == null) {
//             return null;
//         }
//         ObjectMapper objectMapper = new ObjectMapper();
//         try {
//             return objectMapper.readValue(metadataInJson, Metadata.class);
//         } catch (IOException e) {
//             throw new RuntimeException(e.getMessage(), e);
//         }
//     }
// }


// Path: src/main/java/com/orange/clara/cloud/servicedbdumper/model/DatabaseDumpFile.java
import com.orange.clara.cloud.servicedbdumper.converter.CryptoConverter;
import com.orange.clara.cloud.servicedbdumper.converter.MetadataConverter;
import javax.persistence.*;
import java.io.File;
import java.util.Calendar;
import java.util.Date;

package com.orange.clara.cloud.servicedbdumper.model;




/**
 * Copyright (C) 2015 Orange
 * <p>
 * This software is distributed under the terms and conditions of the 'Apache-2.0'
 * license which can be found in the file 'LICENSE' in this package distribution
 * or at 'https://opensource.org/licenses/Apache-2.0'.
 * <p>
 * Author: Arthur Halet
 * Date: 03/06/2015
 */
@Entity
public class DatabaseDumpFile {

    protected String user;
    @Convert(converter = CryptoConverter.class)
    protected String password;
    protected Boolean showable;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;

    private String fileName;
    @Column(name = "created_at")
    private Date createdAt;

    @Column(name = "deleted_at")
    private Date deletedAt;

    @ManyToOne
    @JoinColumn(name = "service_instance_id")
    private DbDumperServiceInstance dbDumperServiceInstance;

    @Convert(converter = MetadataConverter.class)