I'm trying to parse following part of xml. There are two "location" tags. And the second one has taken up attributes. But I can't set JAXB correctly the second class does not set properties. Is there also way to simplify the code using lombook, but keeping fields as private.
<location>
<name>London</name>
<type/>
<country>GB</country>
<timezone/>
<location altitude="0" latitude="51.5085" longitude="-0.1258" geobase="geonames" geobaseid="2643743"/>
</location>
Here is the outer Location class:
#Data
#XmlRootElement(name = "location")
class Location implements Serializable {
private String name;
private String type;
private String country;
private String timezone;
private GeoLocation geoLocation;
#XmlElement(name = "location")
public void setGeoLocation(GeoLocation geoLocation) {
this.geoLocation = geoLocation;
}
}
And the second-one class:
#Data
#XmlRootElement(name = "location")
class GeoLocation { //Ineer location
private String _altitude;
private double _latitude;
private double _longitude;
private String _geobase;
private int _geobaseid;
#XmlElement(name = "altitude")
public void set_altitude(String _altitude) {
this._altitude = _altitude;
}
#XmlElement(name = "latitude")
public void set_latitude(double _latitude) {
this._latitude = _latitude;
}
#XmlElement(name = "longitude")
public void set_longitude(double _longitude) {
this._longitude = _longitude;
}
#XmlElement(name = "geobase")
public void set_geobase(String _geobase) {
this._geobase = _geobase;
}
#XmlElement(name = "geobaseid")
public void set_geobaseid(int _geobaseid) {
this._geobaseid = _geobaseid;
}
}
#Data
#XmlRootElement(name = "location")
#XmlAccessorType(XmlAccessType.FIELD)
class Location implements Serializable {
private String name;
private String type;
private String country;
private String timezone;
#XmlElement(name = "location")
private GeoLocation geoLocation;
}
#Data
#XmlRootElement(name = "location")
#XmlAccessorType(XmlAccessType.FIELD)
class GeoLocation { //Ineer location
#XmlAttribute(name = "altitude")
private String _altitude;
#XmlAttribute(name = "latitude")
private double _latitude;
#XmlAttribute(name = "longitude")
private double _longitude;
#XmlAttribute(name = "geobase")
private String _geobase;
#XmlAttribute(name = "geobaseid")
private int _geobaseid;
}
Related
how to define the endpoint on spring boot server to receive server notification after read the app doc, this is what I am doing now:
#Api
#RequestMapping("/post/notification")
#FeignClient(name = "dolphin-post-service")
#Validated
public interface IAppleServerNotificationController {
/**
* Receive Apple Server Notification
* #param
* #return
*/
#PostMapping("/v1/appleSeverNotification")
Response<Integer> handleNotification(#RequestBody #Valid ServerNotificationRequest request);
}
and this is the entity I am define:
#Data
#NoArgsConstructor
#JsonIgnoreProperties(ignoreUnknown = true)
public class ServerNotificationRequest implements Serializable {
#ApiModelProperty(value = "responseBody")
#NonNull
private String responseBody;
}
but It seems not work. where I am going wrong? Any suggestion?
#Override
#NoCheck
public Response<Integer> handleNotification(ServerNotificationRequest request) {
JSONObject jsonResult = JSONObject.parseObject(request.getResponseBody());
AppleServerNotificationRecord record = new AppleServerNotificationRecord();
record.setResponseBody(request.getResponseBody());
record.setNotificationType(jsonResult.getString("notification_type"));
int result = notificationRecordService.saveNotificationRecord(record);
return new Response<>(result);
}
the responseBody is null!!!
define the request entity like this:
#Data
#NoArgsConstructor
#JsonIgnoreProperties(ignoreUnknown = true)
public class ServerNotificationRequest implements Serializable {
#ApiModelProperty(value = "auto_renew_adam_id")
#JsonProperty("auto_renew_adam_id")
private String autoRenewAdamId;
#ApiModelProperty(value = "auto_renew_product_id")
#JsonProperty("auto_renew_product_id")
private String autoRenewProductId;
#ApiModelProperty(value = "auto_renew_status")
#JsonProperty("auto_renew_status")
private String autoRenewStatus;
#ApiModelProperty(value = "auto_renew_status_change_date")
#JsonProperty("auto_renew_status_change_date")
private String autoRenewStatusChangeDate;
#ApiModelProperty(value = "auto_renew_status_change_date_ms")
#JsonProperty("auto_renew_status_change_date_ms")
private String autoRenewStatusChangeDateMs;
#ApiModelProperty(value = "auto_renew_status_change_date_pst")
#JsonProperty("auto_renew_status_change_date_pst")
private String autoRenewStatusChangeDatePst;
#ApiModelProperty(value = "environment")
private String environment;
#ApiModelProperty(value = "expiration_intent")
#JsonProperty("expiration_intent")
private Integer expirationIntent;
#ApiModelProperty(value = "notification_type")
#JsonProperty("notification_type")
private String notificationType;
#ApiModelProperty(value = "password")
#JsonProperty("password")
private String sharedSecret;
//#ApiModelProperty(value = "unified_receipt")
//#JsonProperty("unified_receipt")
//private String unifiedReceipt;
#ApiModelProperty(value = "bid")
private String bid;
#ApiModelProperty(value = "bvrs")
private String bvrs;
}
I am trying to get the following to be inserted into firebase but read that we can only store one information at a time? I thought that we can somehow store multiple information under a single unique id? Below is the code and I am trying to insert information such as phone numbers, address etc. With the address, can we use a string for the whole address or must we break it down to integer plus string? Also, should i be using "long" for phone number? I am also not sure if I should be using multiple Firebasedatabase for this?
public class MainActivity extends AppCompatActivity {
private Button logout;
private EditText edit;
private EditText number;
private EditText address;
private EditText phone;
private EditText postcode;
private Button add;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
logout = findViewById(R.id.logout);
edit = findViewById(R.id.edit);
add = findViewById(R.id.add);
number = findViewById(R.id.number);
address = findViewById(R.id.address);
phone = findViewById(R.id.phone);
postcode = findViewById(R.id.postcode);
logout.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
FirebaseAuth.getInstance().signOut();
Toast.makeText(MainActivity.this, "Logged Out", Toast.LENGTH_SHORT).show();
startActivity(new Intent(MainActivity.this, StartActivity.class));
finish();
}
});
add.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String txt_name = edit.getText().toString();
// int txtnumber = Integer.valueof(number);
String txt_address = address.getText().toString();
// Long phone_number = Long.parseLong(phone.getText().toString().trim());
// Long postcode2 = Long.parseLong(postcode.getText().toString().trim());
if (txt_name.isEmpty()) {
Toast.makeText(MainActivity.this, "No name entered!", Toast.LENGTH_SHORT).show();
} else {
FirebaseDatabase.getInstance("https://medical-review-in-australia.firebaseio.com/").getReference().child("Medical Clinic").push().child("Name").setValue(txt_name, txt_address);
// FirebaseDatabase.getInstance("https://medical-review-in-australia.firebaseio.com/").getReference().child("Medical Clinic").setValue(txt_address);
// FirebaseDatabase.getInstance("https://medical-review-in-australia.firebaseio.com/").getReference().child("Medical Clinic").child("Name:").child("Address No:").child("Address Name:").setValue(txt_address);
// FirebaseDatabase.getInstance("https://medical-review-in-australia.firebaseio.com/").getReference().child("Medical Clinic").child("Name:").child("Address No:").child("Address Name").child("Phone number:").setValue(phone_number);
// FirebaseDatabase.getInstance("https://medical-review-in-australia.firebaseio.com/").getReference().child("Medical Clinic").child("Name:").child("Address No:").child("Address Name").child("Phone number:").child("Postcode:").setValue(postcode2);
}
}
});
}
}
Create a class named Info
public class Info {
private String name;
private String address;
private String phoneNo;
private String postcode;
public Info(String name, String address, String phoneNo, String postcode) {
this.name = name;
this.address = address;
this.phoneNo = phoneNo;
this.postcode = postcode;
}
public Info() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
}
public String getPostcode() {
return postcode;
}
public void setPostcode(String postcode) {
this.postcode = postcode;
}
}
then in your activity
add.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String txt_name = edit.getText().toString();
// int txtnumber = Integer.valueof(number);
String txt_address = address.getText().toString();
// Long phone_number = Long.parseLong(phone.getText().toString().trim());
// Long postcode2 = Long.parseLong(postcode.getText().toString().trim());
if (txt_name.isEmpty()) {
Toast.makeText(MainActivity.this, "No name entered!", Toast.LENGTH_SHORT).show();
} else {
String key = FirebaseDatabase.getInstance("https://medical-review-in-australia.firebaseio.com/").getReference().child("Medical Clinic").push().getKey();
Info info = new Info(name,String.valueOf(txtnumber),String.valueOf(phone_number),String.valueOf(postcode2));
FirebaseDatabase.getInstance("https://medical-review-in-australia.firebaseio.com/").getReference().child(key).setValue(info);
});
I am new to Neo4J. I have built a project that uses spring-data-neo4j (4.0.0.BUILD-SNAPSHOT - version), spring-boot (1.2.3.RELEASE - version) and succeeded to create node entities, add properties to node entities and add relationships. It works fine. Now I want to create properties for the relationships. I have used sdn4 university as a reference, here is the link https://github.com/neo4j-examples/sdn4-university .
I want to create a property called "challengedBy" for relationship PLAY_MATCH (Start node is Match and end node is Player). You can have a look on below class.
#RelationshipEntity(type = "PLAY_MATCH")
public class PlayMatch extends Entity {
//Entity is a class with the id property for the node / relationship
#Property
private String challengedBy;
#StartNode
private Match match;
#EndNode
private Player player1;
}
I have created a controller in the project /api/playmatch to create only the relationship between match and a player. So when I pass the values for an existing match node and a player node, the relationship is not created at all.
Any help will be appreciated..
PlayMatch code is
#RelationshipEntity(type = "PLAY_MATCH")
public class PlayMatch extends Entity{
#Property
private String challengedBy;
#StartNode
private Match match;
#EndNode
private Player player1;
public PlayMatch() {
}
public PlayMatch(String challengedBy, Match match,
Player player1) {
super();
this.challengedBy = challengedBy;
this.match = match;
this.player1 = player1;
}
// after this i have getters & setters and toString method for above fields.
}
Match code is
#NodeEntity(label = "Match")
public class Match extends Entity {
private String createdBy;
private Long createdTime;
private String status;
private int noOfGames;
private int noOfPoints;
private String type;
private Long date;
#Relationship(type="PLAY_MATCH",direction= Relationship.UNDIRECTED)
private PlayMatch playMatch;
public Match() {
}
public Match(String createdBy, Long createdTime, String status,
int noOfGames, int noOfPoints, String type, Long date) {
super();
this.createdBy = createdBy;
this.createdTime = createdTime;
this.status = status;
this.noOfGames = noOfGames;
this.noOfPoints = noOfPoints;
this.type = type;
this.date = date;
}
public PlayMatch getPlayMatch() {
return playMatch;
}
public void setPlayMatch(PlayMatch playMatch) {
this.playMatch = playMatch;
}
// after this i have getters & setters and toString method for above fields.
}
Player code is
#NodeEntity(label = "Player")
public class Player extends Entity {
private String address;
private String preferredSport;
private float height;
private float weight;
private String phone;
private String photo;
#Relationship(type="PLAY_MATCH")
private PlayMatch playMatch;
public PlayMatch getPlayMatch() {
return playMatch;
}
public void setPlayMatch(PlayMatch playMatch) {
this.playMatch = playMatch;
}
public Player() {
}
public Player(String address, String preferredSport, float height,
float weight, String phone, String photo) {
super();
this.address = address;
this.preferredSport = preferredSport;
this.height = height;
this.weight = weight;
this.phone = phone;
this.photo = photo;
}
// after this i have getters & setters and toString method for above fields.
}
I think you have playmatch relationship within the player end node as well. If you comment the following code in the player node. It should work. I have also attached a json sample to pass from the UI in the match URL (/api/match) instead of (/api/playmatch)
#Relationship(type="PLAY_MATCH")
private PlayMatch playMatch;
public PlayMatch getPlayMatch() {
return playMatch;
}
public void setPlayMatch(PlayMatch playMatch) {
this.playMatch = playMatch;
}
Sample JSON
{
"type": "typename",
"status": "statusname",
"createdTime": 1435928223021,
"noOfGames": 5,
"noOfPoints": 19,
"playMatch": {"challengedBy" : "John", "player1" : {"id":732}, "match":{"type": "typename",
"status": "statusname",
"createdTime": 1435928223021,
"noOfGames": 5,
"noOfPoints": 19}}
}
this should create a new match and a new relationship with property challengedBy to an existing player node with id 732.
check it out and let me know if this works.
I have a weird problem with the node auto fetching in Spring Data Neo4j 4.0.0.
I have a class like below :
#NodeEntity
public class FilterVersionChange extends UnitVersion {
#GraphId
private Long id;
public FilterVersionChange() {
super();
}
public FilterVersionChange(String description, Long creationDate)
{
super(description, creationDate);
}
#Relationship(type="CONTAINS", direction = Relationship.OUTGOING)
private Set<FilterState> filterStates;
#Relationship(type="REFERENCES", direction = Relationship.OUTGOING)
private FilterVersionChange referencedFilterVersionChange;
#Relationship(type="ADDED", direction = Relationship.OUTGOING)
private Set<FilterState> newFilterStates;
#Relationship(type="DELETED", direction = Relationship.OUTGOING)
private Set<FilterState> deletedFilterStates;
#Relationship(type="MODIFIED", direction = Relationship.OUTGOING)
private Set<ModifiedUnitState> modifiedFilterStates;
#Relationship(type="TRACKS", direction = Relationship.INCOMING)
private FilterVersion filterVersion;
#Relationship(type = "CREATED_ON", direction = Relationship.OUTGOING)
private TimeTreeSecond timeTreeSecond;
public void createdOn(TimeTreeSecond timeTreeSecond) {
this.timeTreeSecond = timeTreeSecond;
}
public void contains(Set<FilterState> filterStates) {
this.filterStates = filterStates;
}
public void references(FilterVersionChange referencedFilterVersionChange) {
this.referencedFilterVersionChange = referencedFilterVersionChange;
}
public void added(Set<FilterState> newFilterStates) {
this.newFilterStates = newFilterStates;
}
public void deleted(Set<FilterState> deletedFilterStates) {
this.deletedFilterStates = deletedFilterStates;
}
public void modified(Set<ModifiedUnitState> modifiedFilterStates) {
this.modifiedFilterStates = modifiedFilterStates;
}
public void trackedIn(FilterVersion filterVersion) {
this.filterVersion = filterVersion;
}
public FilterVersion getFilterVersion() {
return filterVersion;
}
public Set<FilterState> getFilterStates() {
return filterStates;
}
}
In the database, I have one FilterVersionChange node with several FilterStates nodes attached to it via 'CONTAINS' and 'ADDED' relationships. Assume that I have the id of that FilterVersionChange node and I want to get the node by calling findOne(id). But, what I get from it is null value for the filterStates variable.
As I understand from the documentation, findOne should retrieve the depth of 1 by default. But I really have no idea why I get the value of null with the filterStates variable.
Thank you in advance and your suggestion would be really appreciated!
EDIT
This is the function where the insertion code is.
public FilterVersionChange createNewFilterVersionChange(String projectName,
String filterVersionName,
String filterVersionChangeDescription,
Set<FilterState> filterStates)
{
Long filterVersionNodeId = filterVersionRepository.findFilterVersionByName(projectName, filterVersionName);
if(filterVersionNodeId != null)
{
FilterVersion newFilterVersion = filterVersionRepository.findOne(filterVersionNodeId, 2);
HashMap<String, Filter> filterHashMap = new HashMap<String, Filter>();
Iterable<Filter> filters = filterRepository.findAll();
if(filters.iterator().hasNext())
{
for(Filter filter : filters)
{
filterHashMap.put(filter.getMatchingString(), filter);
}
}
for(FilterState filterState : filterStates)
{
Filter filter;
if(filterHashMap.isEmpty() == false)
{
filter = filterHashMap.get(filterState.getMatchingString());
}
else
{
filter = new Filter(filterState.getMatchingString(), filterState.getMatchingType());
filter.belongsTo(newFilterVersion.getProject());
}
filterState.stateOf(filter);
}
Date now = new Date();
FilterVersionChange filterVersionChange = new FilterVersionChange();
filterVersionChange.setDescription(filterVersionChangeDescription);
filterVersionChange.setCreationDate(now.getTime());
filterVersionChange.contains(filterStates);
filterVersionChange.added(filterStates);
filterVersionChange.trackedIn(newFilterVersion);
TimeTreeSecond timeInstantNode = timeTreeService.getFilterTimeInstantNode(projectName, now.getTime());
filterVersionChange.createdOn(timeInstantNode);
FilterVersionChange addedFilterVersionChange = filterVersionChangeRepository.save(filterVersionChange);
return addedFilterVersionChange;
}
else
{
return null;
}
}
Here is the FilterState class
#NodeEntity
public class FilterState {
#GraphId
private Long id;
private String matchingString;
private String matchingType;
public FilterState() {
}
public FilterState(String matchingString, String matchingType) {
this.matchingString = matchingString;
setMatchingType(matchingType);
}
#Relationship(type="STATE_OF", direction = Relationship.OUTGOING)
private Filter filter;
#Relationship(type="PART_OF", direction = Relationship.OUTGOING)
private CodeUnit codeUnit;
#Relationship(type="CONTAINS", direction = Relationship.INCOMING)
private FilterVersionChange containedInFilterVersionChange;
#Relationship(type="ADDED", direction = Relationship.INCOMING)
private FilterVersionChange addedInFilterVersionChange;
public void setMatchingString(String matchingString) {
this.matchingString = matchingString;
}
public void setMatchingType(String matchingType) {
String type = null;
if(matchingType.equalsIgnoreCase("RegexFilter"))
{
type = "RegexFilter";
}
else if(matchingType.equalsIgnoreCase("ClassFilter"))
{
type = "ClassFilter";
}
this.matchingType = type;
}
public void stateOf(Filter filter) {
this.filter = filter;
}
public void partOf(CodeUnit codeUnit) {
this.codeUnit = codeUnit;
}
public String getMatchingString() {
return matchingString;
}
public String getMatchingType() {
return matchingType;
}
public Filter getFilter() {
return filter;
}
public Long getId() {
return id;
}
public void addedIn(FilterVersionChange addedInFilterVersionChange) {
this.addedInFilterVersionChange = addedInFilterVersionChange;
}
public FilterVersionChange getContainedInFilterVersionChange() {
return containedInFilterVersionChange;
}
}
and here is the gradle file
def RMQVersion = "3.3.4"
def GSONVersion = "2.3.1"
def Neo4jVersion = "2.2.1"
def Neo4jTimeTreeVersion = "2.2.1.30.21"
def SpringVersion = "4.1.6.RELEASE"
def SDNVersion = "4.0.0.BUILD-SNAPSHOT"
def JunitVersion = "4.12"
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = 1.5
version = '1.0'
repositories {
mavenCentral()
maven {
url("http://maven.springframework.org/milestone")
}
maven {
url("http://repo.spring.io/libs-snapshot")
}
}
dependencies {
compile "org.springframework.data:spring-data-neo4j:${SDNVersion}"
compile "org.neo4j:neo4j:${Neo4jVersion}"
compile "com.graphaware.neo4j:timetree:${Neo4jTimeTreeVersion}"
compile "com.rabbitmq:amqp-client:${RMQVersion}"
compile "com.google.code.gson:gson:${GSONVersion}"
testCompile group: 'org.springframework.data', name: 'spring-data-neo4j', version: SDNVersion, classifier: 'tests'
testCompile group: 'org.springframework', name: 'spring-test', version: SpringVersion
testCompile group: 'junit', name: 'junit', version: JunitVersion
}
This issue has been fixed post 4.0.0M1, please use the latest build snapshot, thanks.
I am using neo4j version 1.8.1 and spring-data-neo4j version 2.2.0. RELEASE.
The problem is about neo4j saving speed. I could not realize why this happens. The node is persisting into db for about 30 second. Here is my model class.
#NodeEntity
public class GraphUser {
public static final String FACEBOOK_FRIEND = "FACEBOOK_FRIEND";
public static final String TWITTER_FOLLOW = "TWITTER_FOLLOW";
public static final String CONTACT = "CONTACT";
public static final String KNOWS = "KNOWS";
public static final String BLOCKED = "BLOCKED";
public static final String FAVORITE = "FAVORITE";
#GraphId
private Long id;
#Indexed(unique = true, indexType = IndexType.FULLTEXT, indexName = "userIdIndex")
private String userId;
#Indexed(indexType = IndexType.FULLTEXT, indexName = "facebookIdIndex")
private String facebookId;
#Indexed(indexType = IndexType.FULLTEXT, indexName = "twitterIdIndex")
private String twitterId;
#Indexed(indexType = IndexType.FULLTEXT, indexName = "emailIndex")
private String email;
#Indexed(indexType = IndexType.FULLTEXT, indexName = "phoneNumberIndex")
private String phoneNumber;
private String knowsLevel;
#RelatedTo(type = FACEBOOK_FRIEND, direction = Direction.BOTH)
#Fetch
private Set<GraphUser> facebookRelations = new HashSet<GraphUser>();
#RelatedTo(type = TWITTER_FOLLOW, direction = Direction.OUTGOING)
#Fetch
private Set<GraphUser> twitterRelations = new HashSet<GraphUser>();
#RelatedTo(type = CONTACT, direction = Direction.OUTGOING)
#Fetch
private Set<GraphUser> contacts = new HashSet<GraphUser>();
#RelatedTo(type = KNOWS, direction = Direction.OUTGOING)
#Fetch
private Set<GraphUser> knows = new HashSet<GraphUser>();
#RelatedTo(type = BLOCKED, direction = Direction.OUTGOING)
#Fetch
private Set<GraphUser> blocks = new HashSet<GraphUser>();
#RelatedTo(type = FAVORITE, direction = Direction.OUTGOING)
#Fetch
private Set<GraphUser> favorites = new HashSet<GraphUser>();
#Query(value = "start user=node({self}), user2=node(*), matchedUser=node(*) " +
"where has(user2.userId) and has(matchedUser.userId) and has(user.knowsLevel) and has(user2.knowsLevel) and has(matchedUser.knowsLevel) " +
"and " +
"user.userId<>matchedUser.userId " +
"and " +
"(" +
"(user.knowsLevel='ALL' and (matchedUser.knowsLevel='ALL' or (user)<-[:KNOWS]-(matchedUser) or ((user)<-[:KNOWS]-(user2)<-[:KNOWS]-(matchedUser) and matchedUser.knowsLevel='SECOND'))) " +
"or " +
"(user.knowsLevel='SECOND' and ((user)-[:KNOWS]->(matchedUser) or (user)-[:KNOWS]->(user2)-[:KNOWS]->(matchedUser)) and (matchedUser.knowsLevel='ALL' or (user)<-[:KNOWS]-(matchedUser) or ((user)<-[:KNOWS]-(user2)<-[:KNOWS]-(matchedUser) and matchedUser.knowsLevel='SECOND'))) " +
"or " +
"(user.knowsLevel='FIRST' and (user)-[:KNOWS]->(matchedUser) and (matchedUser.knowsLevel='ALL' or (user)<-[:KNOWS]-(matchedUser) or ((user)<-[:KNOWS]-(user2)<-[:KNOWS]-(matchedUser) and matchedUser.knowsLevel='SECOND')))" +
") " +
"return matchedUser")
#Fetch
private Iterable<GraphUser> matchedUsers;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getFacebookId() {
return facebookId;
}
public void setFacebookId(String facebookId) {
this.facebookId = facebookId;
}
public String getTwitterId() {
return twitterId;
}
public void setTwitterId(String twitterId) {
this.twitterId = twitterId;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhoneNumber() {
return phoneNumber;
}
public String getKnowsLevel() {
return knowsLevel;
}
public void setKnowsLevel(String knowsLevel) {
this.knowsLevel = knowsLevel;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public Set<GraphUser> getFacebookRelations() {
return facebookRelations;
}
public void setFacebookRelations(Set<GraphUser> facebookRelations) {
this.facebookRelations = facebookRelations;
}
public Set<GraphUser> getTwitterRelations() {
return twitterRelations;
}
public void setTwitterRelations(Set<GraphUser> twitterRelations) {
this.twitterRelations = twitterRelations;
}
public Set<GraphUser> getContacts() {
return contacts;
}
public void setContacts(Set<GraphUser> contacts) {
this.contacts = contacts;
}
public Set<GraphUser> getKnows() {
return knows;
}
public void setKnows(Set<GraphUser> knows) {
this.knows = knows;
}
public Set<GraphUser> getBlocks() {
return blocks;
}
public void setBlocks(Set<GraphUser> blocks) {
this.blocks = blocks;
}
public Set<GraphUser> getFavorites() {
return favorites;
}
public void setFavorites(Set<GraphUser> favorites) {
this.favorites = favorites;
}
}
What may I be missing ?
Thank you.
Two suspects
Indexes: I see you have around 5 indexes. Write takes longer when you have more indexes as the write should also update the index as part of the transaction.
Eager Fetch: I see you have around 6 relationships that you annotated with #Fetch. I believe spring-data-neo4j tries to re-fetch everything after the commit. And if these relationships/nodes have #Fetch for their own properties annotated with #Fetch then they are recursively fetched.
I suggest you start testing this by first removing #Fetch and then #Index and see if that improves performance. Are you also doing batch inserts?