Package fr.ifremer.isisfish.entities
Class RegionExportJson
java.lang.Object
fr.ifremer.isisfish.entities.RegionExportJson
- All Implemented Interfaces:
org.nuiton.topia.persistence.EntityVisitor
Classe permettant d'exporter en Json une region
Format du JSON:
{
"#info": {
"formatVersion": int
"isisVersion": String
"region": boolean if true contains one region, if false contains one Entity
"root": toString representation of root entity
"rootId": id of root entity
},
"#entities": {
" <id>": {<entity field>},
...
},
"FisheryRegion" : [<id>],
"Cell": [<id>, ...],
"Zone": [<id>, ...],
...
}
- Version:
- $Revision$ Last update: $Date$ by : $Author$
- Author:
- poussin
-
Field Summary
Modifier and TypeFieldDescriptionprotected EntitySemanticsDecorator
protected boolean
static final String
static final int
protected com.fasterxml.jackson.core.JsonGenerator
protected LinkedHashMap<String,
List<String>> protected MatrixCSVHelper
protected LinkedList<org.nuiton.topia.persistence.TopiaEntity>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Reset all states of the visitor.void
end()
void
end
(org.nuiton.topia.persistence.TopiaEntity entity) Ends the visit of the given entity.void
export
(FisheryRegion fisheryRegion) Export la region et tous les elements de la region.void
export
(org.nuiton.topia.persistence.TopiaEntity entity) Export seulement l'entity et ses dépendances.protected void
export
(org.nuiton.topia.persistence.TopiaEntity entity, boolean isRegion) void
start()
void
start
(org.nuiton.topia.persistence.TopiaEntity entity) Start the visit of the given entity.void
visit
(org.nuiton.topia.persistence.TopiaEntity entity, String propertyName, Class<?> collectionType, Class<?> type, int index, Object value) Visit a indexed value from a collection property for the given entity.void
visit
(org.nuiton.topia.persistence.TopiaEntity entity, String propertyName, Class<?> collectionType, Class<?> type, Object value) Visit a collection property for the given entity.void
visit
(org.nuiton.topia.persistence.TopiaEntity entity, String propertyName, Class<?> type, Object value) Visit a none indexed property for the given entity.protected void
writeValue
(Class<?> type, Object value)
-
Field Details
-
FORMAT_VERSION
public static final int FORMAT_VERSION- See Also:
-
FORMAT_EXTENSION
- See Also:
-
toVisit
-
visited
-
isisEntities
-
doVisit
protected boolean doVisit -
matrixCSVHelper
-
decorator
-
g
protected com.fasterxml.jackson.core.JsonGenerator g
-
-
Constructor Details
-
RegionExportJson
-
-
Method Details
-
export
Export la region et tous les elements de la region.- Parameters:
fisheryRegion
-
-
export
public void export(org.nuiton.topia.persistence.TopiaEntity entity) Export seulement l'entity et ses dépendances.- Parameters:
entity
-
-
export
protected void export(org.nuiton.topia.persistence.TopiaEntity entity, boolean isRegion) -
writeValue
-
start
public void start() -
end
public void end() -
start
public void start(org.nuiton.topia.persistence.TopiaEntity entity) Start the visit of the given entity.- Specified by:
start
in interfaceorg.nuiton.topia.persistence.EntityVisitor
- Parameters:
entity
- the visited entity
-
end
public void end(org.nuiton.topia.persistence.TopiaEntity entity) Ends the visit of the given entity.- Specified by:
end
in interfaceorg.nuiton.topia.persistence.EntityVisitor
- Parameters:
entity
- the visited entity
-
visit
public void visit(org.nuiton.topia.persistence.TopiaEntity entity, String propertyName, Class<?> type, Object value) Visit a none indexed property for the given entity. The property visited is defined by the other parameters.- Specified by:
visit
in interfaceorg.nuiton.topia.persistence.EntityVisitor
- Parameters:
entity
- the visited entitypropertyName
- the name of the visited propertytype
- the type of the visited propertyvalue
- the value of the visited property
-
visit
public void visit(org.nuiton.topia.persistence.TopiaEntity entity, String propertyName, Class<?> collectionType, Class<?> type, Object value) Visit a collection property for the given entity. The property visited is defined by the other parameters.- Specified by:
visit
in interfaceorg.nuiton.topia.persistence.EntityVisitor
- Parameters:
entity
- the visited entitypropertyName
- the name of the visited propertycollectionType
- the type of the visited collectiontype
- the type of the visited propertyvalue
- the value of the visited property
-
visit
public void visit(org.nuiton.topia.persistence.TopiaEntity entity, String propertyName, Class<?> collectionType, Class<?> type, int index, Object value) Visit a indexed value from a collection property for the given entity. The property visited is defined by the other parameters.- Specified by:
visit
in interfaceorg.nuiton.topia.persistence.EntityVisitor
- Parameters:
entity
- the visited entitypropertyName
- the name of the visited propertycollectionType
- the type of the container of the visited propertytype
- the type of the visited propertyindex
- the index of the visited property in his containervalue
- the value of the visited property
-
clear
public void clear()Reset all states of the visitor. If you use internal states inside the visitor, this method should clean all of them. This method should be invoked after usage of the visitor.- Specified by:
clear
in interfaceorg.nuiton.topia.persistence.EntityVisitor
-