47 lines
1013 B
Java
47 lines
1013 B
Java
/**
|
|
*
|
|
*/
|
|
package org.gcube.informationsystem.model.impl.entities;
|
|
|
|
import java.io.StringWriter;
|
|
|
|
import org.gcube.informationsystem.model.impl.ERImpl;
|
|
import org.gcube.informationsystem.model.reference.entities.Entity;
|
|
import org.gcube.informationsystem.utils.ISMapper;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
|
|
|
/**
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
*/
|
|
@JsonTypeName(value=Entity.NAME)
|
|
public abstract class EntityImpl extends ERImpl implements Entity {
|
|
|
|
/**
|
|
* Generated Serial Version UID
|
|
*/
|
|
private static final long serialVersionUID = -4488771434017342703L;
|
|
|
|
protected EntityImpl(){
|
|
super();
|
|
this.header = null;
|
|
}
|
|
|
|
@Override
|
|
public String toString(){
|
|
StringWriter stringWriter = new StringWriter();
|
|
try {
|
|
ISMapper.marshal(this, stringWriter);
|
|
return stringWriter.toString();
|
|
}catch(Exception e){
|
|
try {
|
|
ISMapper.marshal(this.header, stringWriter);
|
|
return stringWriter.toString();
|
|
} catch(Exception e1){
|
|
return super.toString();
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|