Project

General

Profile

« Previous | Next » 

Revision 58437

Added by Dimitris Pierrakos about 4 years ago

New Workflow for Usage Stats

View differences:

IrusStats.java
78 78
            //stmt.executeUpdate(sqlCopyPublicSushiLog);
79 79
            String sqlcreateRuleSushiLog = "CREATE OR REPLACE RULE ignore_duplicate_inserts AS "
80 80
                    + " ON INSERT TO sushilogtmp "
81
                    + " WHERE (EXISTS ( SELECT sushilog.source, sushilog.repository,"
82
                    + "sushilog.rid, sushilog.date "
83
                    + "FROM sushilog "
84
                    + "WHERE sushilog.source = new.source AND sushilog.repository = new.repository AND sushilog.rid = new.rid AND sushilog.date = new.date AND sushilog.metric_type = new.metric_type)) DO INSTEAD NOTHING;";
81
                    + " WHERE (EXISTS ( SELECT sushilogtmp.source, sushilogtmp.repository,"
82
                    + "sushilogtmp.rid, sushilogtmp.date "
83
                    + "FROM sushilogtmp "
84
                    + "WHERE sushilogtmp.source = new.source AND sushilogtmp.repository = new.repository AND sushilogtmp.rid = new.rid AND sushilogtmp.date = new.date AND sushilogtmp.metric_type = new.metric_type)) DO INSTEAD NOTHING;";
85 85
            stmt.executeUpdate(sqlcreateRuleSushiLog);
86 86

  
87 87
            stmt.close();
......
106 106
        sql = "Insert into sushilog select * from sushilogtmp;";
107 107
        stmt.executeUpdate(sql);
108 108
        
109
        sql = "drop table sushilogtmp;";
110
        stmt.executeUpdate(sql);
111
        
112 109
        ConnectDB.getConnection().commit();
113 110
        ConnectDB.getConnection().close();
114 111
    }
......
116 113
    public void processIrusRRReport() throws Exception {
117 114
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY-MM");
118 115
        //String reportUrl = "https://irus.jisc.ac.uk" + "/api/sushilite/v1_7/GetReport/?Report=RR1&Release=4&RequestorID=OpenAIRE&BeginDate=2016-01&EndDate=" + simpleDateFormat.format(new Date()) + "&RepositoryIdentifier=&ItemDataType=&NewJiscBand=&Granularity=Monthly&Callback=";
119
        String reportUrl = irusUKURL+"GetReport/?Report=RR1&Release=4&RequestorID=OpenAIRE&BeginDate=2016-01&EndDate=" + simpleDateFormat.format(new Date()) + "&RepositoryIdentifier=&ItemDataType=&NewJiscBand=&Granularity=Monthly&Callback=";
116
        String reportUrl = irusUKURL + "GetReport/?Report=RR1&Release=4&RequestorID=OpenAIRE&BeginDate=2016-01&EndDate=" + simpleDateFormat.format(new Date()) + "&RepositoryIdentifier=&ItemDataType=&NewJiscBand=&Granularity=Monthly&Callback=";
120 117

  
121 118
        log.info("Getting Irus report: " + reportUrl);
122 119

  

Also available in: Unified diff