Search in sources :

Example 16 with ParcelableRelationship

use of org.neo4j.android.common.ParcelableRelationship in project neo4j-mobile-android by neo4j-contrib.

the class DbWrapper method updateRelationship.

@Override
public void updateRelationship(ParcelableRelationship rel, ParcelableError err) throws RemoteException {
    try {
        checkCallerHasWritePermission();
        resumeTrx();
        try {
            Relationship target = mDb.getRelationshipById(rel.getId());
            // remove existing properties
            for (String key : target.getPropertyKeys()) {
                target.removeProperty(key);
            }
            // set new properties
            for (String key : rel.getPropertyKeys()) {
                target.setProperty(key, rel.getProperty(key));
            }
        } finally {
            suspendCurrentTrx("updateRelationship");
        }
    } catch (Exception e) {
        Log.e(TAG, "Error updating relationship", e);
        err.setError(Errors.TRANSACTION, e.getMessage());
    }
}
Also used : ParcelableRelationship(org.neo4j.android.common.ParcelableRelationship) Relationship(org.neo4j.graphdb.Relationship) RemoteException(android.os.RemoteException) InvalidTransactionException(org.neo4j.javax.transaction.InvalidTransactionException) SystemException(org.neo4j.javax.transaction.SystemException)

Example 17 with ParcelableRelationship

use of org.neo4j.android.common.ParcelableRelationship in project neo4j-mobile-android by neo4j-contrib.

the class ParcelableFactory method makeParcelableRelationship.

public static ParcelableRelationship makeParcelableRelationship(Relationship rel) {
    ParcelableRelationship pRel = new ParcelableRelationship();
    pRel.setId(rel.getId());
    pRel.setName(rel.getType().name());
    pRel.setStartNodeId(rel.getStartNode().getId());
    pRel.setEndNodeId(rel.getEndNode().getId());
    // shallow copy of properties
    for (String key : rel.getPropertyKeys()) {
        pRel.setProperty(key, rel.getProperty(key));
    }
    return pRel;
}
Also used : ParcelableRelationship(org.neo4j.android.common.ParcelableRelationship)

Aggregations

ParcelableRelationship (org.neo4j.android.common.ParcelableRelationship)17 GraphDatabase (org.neo4j.android.client.GraphDatabase)11 ParcelableNode (org.neo4j.android.common.ParcelableNode)7 AlertDialog (android.app.AlertDialog)4 DialogInterface (android.content.DialogInterface)4 RemoteException (android.os.RemoteException)4 View (android.view.View)4 ContentView (roboguice.inject.ContentView)4 InjectView (roboguice.inject.InjectView)4 Formatter (java.util.Formatter)3 Relationship (org.neo4j.graphdb.Relationship)3 Intent (android.content.Intent)2 Button (android.widget.Button)2 ImageButton (android.widget.ImageButton)2 TextView (android.widget.TextView)2 Neo4jServiceException (org.neo4j.android.client.Neo4jServiceException)2 InvalidTransactionException (org.neo4j.javax.transaction.InvalidTransactionException)2 SystemException (org.neo4j.javax.transaction.SystemException)2 EditText (android.widget.EditText)1 ArrayList (java.util.ArrayList)1