package com.sorakasugano.pasteboard;

import java.util.*;
import java.text.*;
import com.sorakasugano.pasteboard.Writer;

public class Setter extends Writer {
    public Map<String, String> object = null;
    private static String ISOString(Date date) {
        DateFormat iso = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
        iso.setTimeZone(TimeZone.getTimeZone("UTC"));
        return iso.format(date);
    }
    @Override
    public Object call() {
        return null;
    }
}

@@ -67,24 +67,54 @@
 ava.text.*;%0A
+import redis.clients.jedis.*;%0A
 import com.s
@@ -182,16 +182,48 @@
 riter %7B%0A
+    public String owner = null;%0A
     publ
@@ -256,24 +256,59 @@
 ect = null;%0A
+    public boolean replace = true;%0A
     private 
@@ -524,64 +524,749 @@
     
-@Override%0A    public Object call() %7B%0A        return null
+private String list() %7B%0A        return (owner == null ? %22%22 : owner + %22:%22) + type + %22-list%22;%0A    %7D%0A    public Boolean call(Jedis jedis) throws Exception %7B%0A        String key = type + %22:%22 + id;%0A        boolean exists = jedis.exists(key);%0A        if (!exists %7C%7C replace) %7B%0A            Date date = new Date();%0A            String time = ISOString(date);%0A            if (!exists) object.put(%22created_time%22, time);%0A            object.put(%22modified_time%22, time);%0A            jedis.hmset(key, object);%0A            jedis.zadd(list(), date.getTime(), id);%0A        %7D%0A        return !exists;%0A    %7D%0A    @Override%0A    public Map%3CString, Boolean%3E keys() %7B%0A        Map%3CString, Boolean%3E keys = super.keys();%0A        keys.put(list(), true);%0A        return keys
 ;%0A  

implement database setter