package protobuf;

/**
 * Created by Peter Mösenthin.
 */
public class ProtobufUserResolver {
}

@@ -12,16 +12,76 @@
 tobuf;%0A%0A
+import client.RaspberryLifeClient;%0Aimport data.model.User;%0A%0A
 /**%0A * C
@@ -146,11 +146,1841 @@
 solver %7B
+%0A%0A    public static final String DEBUG_TAG = ProtobufUserResolver.class.getSimpleName();%0A%0A    private RaspberryLifeClient client;%0A%0A    public void resolve(RaspberryLifeClient client, RblProto.RBLMessage message)%7B%0A        this.client = client;%0A        for(RblProto.RBLMessage.User user : message.getUserList())%7B%0A            switch (user.getCrudType())%7B%0A                case CREATE:%0A                    createUser(user);%0A                    break;%0A                case RETRIEVE:%0A                    retrieveUser(user);%0A                    break;%0A                case UPDATE:%0A                    updateUser(user);%0A                    break;%0A                case DELETE:%0A                    deleteUser(user);%0A                    break;%0A            %7D%0A        %7D%0A    %7D%0A%0A    private void createUser(RblProto.RBLMessage.User user)%7B%0A%0A    %7D%0A%0A    private void retrieveUser(RblProto.RBLMessage.User user)%7B%0A%0A    %7D%0A%0A    private void updateUser(RblProto.RBLMessage.User user)%7B%0A%0A    %7D%0A%0A    private void deleteUser(RblProto.RBLMessage.User user)%7B%0A%0A    %7D%0A%0A    //----------------------------------------------------------------------------------------------%0A    //                                      MAPPINGS%0A    //----------------------------------------------------------------------------------------------%0A%0A    public static User mapModelUser(RblProto.RBLMessage.User user)%7B%0A        User u = new User();%0A        if(user.hasId())%7B%0A            u.setId(user.getId());%0A        %7D%0A        if(user.hasEmail())%7B%0A            u.setEmail(user.getEmail());%0A        %7D%0A        if(user.hasPassword())%7B%0A            u.setPassword(user.getPassword());%0A        %7D%0A        return u;%0A    %7D%0A%0A    public static RblProto.RBLMessage.User mapProtobufUser(User user)%7B%0A        return ProtoFactory.buildUser(user.getId(),user.getEmail(), user.getPassword()).build();%0A    %7D%0A%0A
 %0A%7D%0A

update user resolver