commit 0a7ebc9c0d93fb63055513de18fada5d308c667c Author: zhicheng.zhang Date: Thu Oct 29 19:08:06 2020 +0800 version-zhicheng diff --git a/cl_stream_datasave/cl_stream_datasave-2.0-SNAPSHOT.jar b/cl_stream_datasave/cl_stream_datasave-2.0-SNAPSHOT.jar new file mode 100644 index 0000000..6fbc644 Binary files /dev/null and b/cl_stream_datasave/cl_stream_datasave-2.0-SNAPSHOT.jar differ diff --git a/cl_stream_datasave/cl_stream_datasave.iml b/cl_stream_datasave/cl_stream_datasave.iml new file mode 100644 index 0000000..fdd6fc8 --- /dev/null +++ b/cl_stream_datasave/cl_stream_datasave.iml @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cl_stream_datasave/es.txt b/cl_stream_datasave/es.txt new file mode 100644 index 0000000..338fa97 --- /dev/null +++ b/cl_stream_datasave/es.txt @@ -0,0 +1,125 @@ +enSource +source +language +crawlTimeStr +primary +listBrand +projectName +createTimeStr +lastModifiedTime +cate +title +content +pictureList +videoUrl +pubTimeStr +postId +commentId +url +commentsCount +attitudesCount +collectCount +favorCnt +quoteCount +readCount +viewCnt +downCnt +postSource +commentUrl +commentScore +sign +impression +skuProperties +price +nomorprice +brand +productParameter +promotionInfo +smallImgs +forwardAttitudesCount +forwardAuthor +forwardAvatar +forwardCommentsCount +forwardContent +forwardImgs +forwardPostSource +forwardPubTime +forwardQuoteCount +forwardUrl +forwardUserId +forwardUserType +forwardUserUrl +age +sex +author +authorId +authorLevel +authornickname +avatar +userUrl +userType +area +city +country +location +province +isVip +forumScore +fansCount +friendsCount  +postCount +translateTitle +translateContent +filePath +resolution +extension +thumbnails +videoTime +isDownload +crawlDataFlag +attr +pageType +siteId +otherSourceJson +availability +channel +contentTag +dataCount +docId +docType +getSource +finalPhrase +originalPhrase +urlHash +titleLength +titleSimHash +contentLength +contentSimHash +expression +hashTag +hlKeywords +opinions +places +sysAbstract +sysKeywords +sysSentiment +pageCommentCount +pageTranspondCount +egc +pgc +ugc +brandId +firstListBrand +secondListBrand +threeListBrand +fourListBrand +fiveListBrand +crawlDate +crawlDay +crawlTime +pubDate +pubDay +pubTime +createDate +createDay +createTime \ No newline at end of file diff --git a/cl_stream_datasave/es_mapping b/cl_stream_datasave/es_mapping new file mode 100644 index 0000000..a91871d --- /dev/null +++ b/cl_stream_datasave/es_mapping @@ -0,0 +1,542 @@ +{ + "commentUrl":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "channel":{ + "type":"keyword" + }, + "readCount":{ + "type":"long" + }, + "quoteCount":{ + "type":"long" + }, + "brand":{ + "analyzer":"ik_smart", + "term_vector":"yes", + "type":"text", + "fields":{ + "shingles":{ + "analyzer":"shingle_analyzer", + "type":"text" + } + } + }, + "brandId":{ + "type":"keyword" + }, + "createTimeStr":{ + "type":"keyword" + }, + "authornickname":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "contentSimHash":{ + "type":"keyword" + }, + "crawlDay":{ + "type":"long" + }, + "titleSimHash":{ + "type":"keyword" + }, + "commentId":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "originalPhrase":{ + "type":"keyword" + }, + "forwardContent":{ + "analyzer":"ik_smart", + "type":"text", + "fields":{ + "shingles":{ + "analyzer":"shingle_analyzer", + "type":"text" + } + } + }, + "finalPhrase":{ + "type":"keyword" + }, + "availability":{ + "type":"integer" + }, + "forwardUserId":{ + "type":"keyword" + }, + "forwardUserType":{ + "type":"integer" + }, + "forwardUserUrl":{ + "type":"keyword" + }, + "forwardAvatar":{ + "type":"keyword" + }, + "forwardImgs":{ + "type":"keyword" + }, + "forwardPostSource":{ + "type":"keyword" + }, + "forwardAttitudesCount":{ + "type":"long" + }, + "forwardCommentsCount":{ + "type":"long" + }, + "forwardQuoteCount":{ + "type":"long" + }, + "forwardPubTime":{ + "type":"long" + }, + "titleLength":{ + "type":"long" + }, + "forwardAuthor":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "sysAbstract":{ + "analyzer":"ik_smart", + "type":"text" + }, + "forwardUrl":{ + "type":"keyword" + }, + "createDate":{ + "type":"date" + }, + "docType":{ + "type":"keyword" + }, + "getSource":{ + "type":"keyword" + }, + "dataCount":{ + "type":"integer" + }, + "primary":{ + "type":"integer" + }, + "cate":{ + "type":"keyword" + }, + "sex":{ + "type":"keyword" + }, + "collectCount":{ + "type":"long" + }, + "crawlDate":{ + "type":"date" + }, + "avatar":{ + "type":"keyword" + }, + "url":{ + "type":"keyword" + }, + "skuProperties":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "expression":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "hashTag":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "places":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "opinions":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "hlKeywords":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "createTime":{ + "type":"long" + }, + "contentLength":{ + "type":"integer" + }, + "pubTime":{ + "type":"long" + }, + "fansCount":{ + "type":"keyword" + }, + "language":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "source":{ + "type":"keyword" + }, + "enSource":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "pictureList":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "userUrl":{ + "type":"keyword" + }, + "videoUrl":{ + "type":"keyword" + }, + "contentTag":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "author":{ + "type":"keyword" + }, + "authorId":{ + "type":"keyword" + }, + "authorLevel":{ + "type":"keyword" + }, + "sysSentiment":{ + "type":"double" + }, + "price":{ + "type":"double" + }, + "nomorprice":{ + "type":"double" + }, + "attitudesCount":{ + "type":"keyword" + }, + "createDay":{ + "type":"long" + }, + "postId":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "pubDate":{ + "type":"date" + }, + "sysKeywords":{ + "type":"keyword" + }, + "crawlTime":{ + "type":"long" + }, + "userType":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "projectName":{ + "type":"keyword" + }, + "lastModifiedTime":{ + "type":"long" + }, + "productParameter":{ + "analyzer":"ik_smart", + "term_vector":"yes", + "type":"text", + "fields":{ + "shingles":{ + "analyzer":"shingle_analyzer", + "type":"text" + } + } + }, + "docId":{ + "type":"keyword" + }, + "commentScore":{ + "type":"long" + }, + "urlHash":{ + "type":"keyword" + }, + "_id_":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "title":{ + "analyzer":"ik_smart", + "term_vector":"yes", + "type":"text", + "fields":{ + "shingles":{ + "analyzer":"shingle_analyzer", + "type":"text" + } + } + }, + "pageTranspondCount":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "pageCommentCount":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "content":{ + "analyzer":"ik_smart", + "term_vector":"yes", + "type":"text", + "fields":{ + "shingles":{ + "analyzer":"shingle_analyzer", + "type":"text" + } + } + }, + "pubDay":{ + "type":"long" + }, + "pubTimeStr":{ + "type":"keyword" + }, + "postSource":{ + "type":"keyword" + }, + "crawlTimeStr":{ + "type":"keyword" + }, + "postCount":{ + "type":"keyword" + }, + "friendsCount":{ + "type":"keyword" + }, + "commentsCount":{ + "type":"long" + }, + "favorCnt":{ + "type":"long" + }, + "viewCnt":{ + "type":"long" + }, + "downCnt":{ + "type":"long" + }, + "sign":{ + "type":"keyword" + }, + "isVip":{ + "type":"integer" + }, + "forumScore":{ + "type":"keyword" + }, + "impression":{ + "type":"keyword" + }, + "promotionInfo":{ + "type":"keyword" + }, + "smallImgs":{ + "type":"keyword" + }, + "listBrand":{ + "analyzer":"ik_smart", + "term_vector":"yes", + "type":"text", + "fields":{ + "shingles":{ + "analyzer":"shingle_analyzer", + "type":"text" + } + } + }, + "firstListBrand":{ + "type":"keyword" + }, + "secondListBrand":{ + "type":"keyword" + }, + "threeListBrand":{ + "type":"keyword" + }, + "fourListBrand":{ + "type":"keyword" + }, + "fiveListBrand":{ + "type":"keyword" + }, + "area":{ + "type":"keyword" + }, + "location":{ + "type":"keyword" + }, + "country":{ + "type":"keyword" + }, + "province":{ + "type":"keyword" + }, + "city":{ + "type":"keyword" + }, + "age":{ + "type":"keyword" + }, + "egc":{ + "type":"integer" + }, + "pgc":{ + "type":"integer" + }, + "ugc":{ + "type":"integer" + }, + "translateTitle":{ + "type":"keyword" + }, + "translateContent":{ + "type":"keyword" + }, + "filePath":{ + "type":"keyword" + }, + "resolution":{ + "type":"keyword" + }, + "extension":{ + "type":"keyword" + }, + "thumbnails":{ + "type":"keyword" + }, + "videoTime":{ + "type":"keyword" + }, + "isDownload":{ + "type":"keyword" + }, + "crawlDataFlag":{ + "type":"keyword" + }, + "attr":{ + "type":"keyword" + }, + "pageType":{ + "type":"keyword" + }, + "siteId":{ + "type":"keyword" + }, + "otherSourceJson":{ + "type":"keyword" + } +} \ No newline at end of file diff --git a/cl_stream_datasave/foreground b/cl_stream_datasave/foreground new file mode 100644 index 0000000..b71826e --- /dev/null +++ b/cl_stream_datasave/foreground @@ -0,0 +1,547 @@ +{ + "commentUrl":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "channel":{ + "type":"keyword" + }, + "readCount":{ + "type":"long" + }, + "quoteCount":{ + "type":"long" + }, + "brand":{ + "term_vector":"yes", + "type":"text", + "analyzer":"ik_smart", + "search_analyzer":"ik_smart", + "fields":{ + "shingles":{ + "type":"text", + "analyzer":"shingle_analyzer" + } + } + }, + "brandId":{ + "type":"keyword" + }, + "createTimeStr":{ + "type":"keyword" + }, + "authornickname":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "contentSimHash":{ + "type":"keyword" + }, + "crawlDay":{ + "type":"long" + }, + "titleSimHash":{ + "type":"keyword" + }, + "commentId":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "originalPhrase":{ + "type":"keyword" + }, + "forwardContent":{ + "analyzer":"ik_smart", + "type":"text", + "fields":{ + "shingles":{ + "analyzer":"shingle_analyzer", + "type":"text" + } + } + }, + "finalPhrase":{ + "type":"keyword" + }, + "availability":{ + "type":"integer" + }, + "forwardUserId":{ + "type":"keyword" + }, + "forwardUserType":{ + "type":"integer" + }, + "forwardUserUrl":{ + "type":"keyword" + }, + "forwardAvatar":{ + "type":"keyword" + }, + "forwardImgs":{ + "type":"keyword" + }, + "forwardPostSource":{ + "type":"keyword" + }, + "forwardAttitudesCount":{ + "type":"long" + }, + "forwardCommentsCount":{ + "type":"long" + }, + "forwardQuoteCount":{ + "type":"long" + }, + "forwardPubTime":{ + "type":"long" + }, + "titleLength":{ + "type":"long" + }, + "forwardAuthor":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "sysAbstract":{ + "analyzer":"ik_smart", + "type":"text" + }, + "forwardUrl":{ + "type":"keyword" + }, + "createDate":{ + "type":"date" + }, + "docType":{ + "type":"keyword" + }, + "getSource":{ + "type":"keyword" + }, + "dataCount":{ + "type":"integer" + }, + "primary":{ + "type":"integer" + }, + "cate":{ + "type":"keyword" + }, + "sex":{ + "type":"keyword" + }, + "collectCount":{ + "type":"long" + }, + "crawlDate":{ + "type":"date" + }, + "avatar":{ + "type":"keyword" + }, + "url":{ + "type":"keyword" + }, + "skuProperties":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "expression":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "hashTag":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "places":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "opinions":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "hlKeywords":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "createTime":{ + "type":"long" + }, + "contentLength":{ + "type":"integer" + }, + "pubTime":{ + "type":"long" + }, + "fansCount":{ + "type":"keyword" + }, + "language":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "source":{ + "type":"keyword" + }, + "enSource":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "pictureList":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "userUrl":{ + "type":"keyword" + }, + "videoUrl":{ + "type":"keyword" + }, + "contentTag":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "author":{ + "type":"keyword" + }, + "authorId":{ + "type":"keyword" + }, + "authorLevel":{ + "type":"keyword" + }, + "sysSentiment":{ + "type":"double" + }, + "price":{ + "type":"double" + }, + "nomorprice":{ + "type":"double" + }, + "attitudesCount":{ + "type":"keyword" + }, + "createDay":{ + "type":"long" + }, + "postId":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "pubDate":{ + "type":"date" + }, + "sysKeywords":{ + "type":"keyword" + }, + "crawlTime":{ + "type":"long" + }, + "userType":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "projectName":{ + "type":"keyword" + }, + "lastModifiedTime":{ + "type":"long" + }, + "productParameter":{ + "term_vector":"yes", + "type":"text", + "analyzer":"ik_smart", + "search_analyzer":"ik_smart", + "fields":{ + "shingles":{ + "type":"text", + "analyzer":"shingle_analyzer" + } + } + }, + "docId":{ + "type":"keyword" + }, + "commentScore":{ + "type":"long" + }, + "urlHash":{ + "type":"keyword" + }, + "_id_":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "title":{ + "term_vector":"yes", + "type":"text", + "analyzer":"ik_smart", + "search_analyzer":"ik_smart", + "fields":{ + "shingles":{ + "type":"text", + "analyzer":"shingle_analyzer" + } + } + }, + "pageTranspondCount":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "pageCommentCount":{ + "type":"text", + "fields":{ + "keyword":{ + "ignore_above":256, + "type":"keyword" + } + } + }, + "content":{ + "term_vector":"yes", + "type":"text", + "analyzer":"ik_smart", + "search_analyzer":"ik_smart", + "fields":{ + "shingles":{ + "type":"text", + "analyzer":"shingle_analyzer" + } + } + }, + "pubDay":{ + "type":"long" + }, + "pubTimeStr":{ + "type":"keyword" + }, + "postSource":{ + "type":"keyword" + }, + "crawlTimeStr":{ + "type":"keyword" + }, + "postCount":{ + "type":"keyword" + }, + "friendsCount":{ + "type":"keyword" + }, + "commentsCount":{ + "type":"long" + }, + "favorCnt":{ + "type":"long" + }, + "viewCnt":{ + "type":"long" + }, + "downCnt":{ + "type":"long" + }, + "sign":{ + "type":"keyword" + }, + "isVip":{ + "type":"integer" + }, + "forumScore":{ + "type":"keyword" + }, + "impression":{ + "type":"keyword" + }, + "promotionInfo":{ + "type":"keyword" + }, + "smallImgs":{ + "type":"keyword" + }, + "listBrand":{ + "term_vector":"yes", + "type":"text", + "analyzer":"ik_smart", + "search_analyzer":"ik_smart", + "fields":{ + "shingles":{ + "type":"text", + "analyzer":"shingle_analyzer" + } + } + }, + "firstListBrand":{ + "type":"keyword" + }, + "secondListBrand":{ + "type":"keyword" + }, + "threeListBrand":{ + "type":"keyword" + }, + "fourListBrand":{ + "type":"keyword" + }, + "fiveListBrand":{ + "type":"keyword" + }, + "area":{ + "type":"keyword" + }, + "location":{ + "type":"keyword" + }, + "country":{ + "type":"keyword" + }, + "province":{ + "type":"keyword" + }, + "city":{ + "type":"keyword" + }, + "age":{ + "type":"keyword" + }, + "egc":{ + "type":"integer" + }, + "pgc":{ + "type":"integer" + }, + "ugc":{ + "type":"integer" + }, + "translateTitle":{ + "type":"keyword" + }, + "translateContent":{ + "type":"keyword" + }, + "filePath":{ + "type":"keyword" + }, + "resolution":{ + "type":"keyword" + }, + "extension":{ + "type":"keyword" + }, + "thumbnails":{ + "type":"keyword" + }, + "videoTime":{ + "type":"keyword" + }, + "isDownload":{ + "type":"keyword" + }, + "crawlDataFlag":{ + "type":"keyword" + }, + "attr":{ + "type":"keyword" + }, + "pageType":{ + "type":"keyword" + }, + "siteId":{ + "type":"keyword" + }, + "otherSourceJson":{ + "type":"keyword" + } +} \ No newline at end of file diff --git a/cl_stream_datasave/pom.xml b/cl_stream_datasave/pom.xml new file mode 100644 index 0000000..52dc113 --- /dev/null +++ b/cl_stream_datasave/pom.xml @@ -0,0 +1,187 @@ + + + + cl_stream + com.bfd.mf + 2.0-SNAPSHOT + + 4.0.0 + + cl_stream_datasave + + + com.bfd.mf.runstart.RunStartDataSave + UTF-8 + true + 1.8 + + + + + bfd + utils + 3.0.0 + + + + + slf4j-api + org.slf4j + 1.7.22 + + + + com.bfd + elastiUtils + 0.0.1-SNAPSHOT + + + kafka-utils + kafka + 0.10 + + + + + + + + + + + + + + + + + com.alibaba + fastjson + 1.1.22 + + + + mysql + mysql-connector-java + 5.1.29 + + + + org.elasticsearch + elasticsearch + 6.2.3 + + + jackson-core + com.fasterxml.jackson.core + + + jopt-simple + net.sf.jopt-simple + + + + + org.elasticsearch.client + transport + 6.2.3 + + + org.elasticsearch.client + elasticsearch-rest-high-level-client + 6.2.3 + + + org.elasticsearch.plugin + transport-netty4-client + 6.2.3 + + + + + com.fasterxml.jackson.core + jackson-annotations + 2.8.1 + + + com.fasterxml.jackson.core + jackson-core + 2.8.1 + + + com.fasterxml.jackson.core + jackson-databind + 2.8.1 + + + jackson-annotations + com.fasterxml.jackson.core + + + + + + + org.apache.commons + commons-lang3 + 3.1 + + + + + + + + + + + + + + + com.squareup.okhttp3 + okhttp + 3.6.0 + + + junit + junit + 4.13-beta-1 + + + log4j + log4j + 1.2.17 + + + + + + + maven-compiler-plugin + + 1.8 + 1.8 + + + + org.springframework.boot + spring-boot-maven-plugin + + com.bfd.mf.runstart.RunStartDataSave + + + + + repackage + + + + + + + + + \ No newline at end of file diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/DownLoadFile.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/DownLoadFile.java new file mode 100644 index 0000000..ed2e2d6 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/DownLoadFile.java @@ -0,0 +1,69 @@ +package com.bfd.mf.datasave.download; + +import com.alibaba.fastjson.JSONObject; +import okhttp3.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +public class DownLoadFile { + public static Map downloadAndSaveFile(String getUrl,String putUrl){ + String realUrl = "";Integer size; + Map realresult= new HashMap<>(); + try{ + String files [] = getUrl.split("/"); + String fileName = getUrl.split("/")[files.length-1]; + Map header = new HashMap<>(); + header.put("User-Agent","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"); + // header.put("Connection","close"); + try { + Map downloadresult = OkHttpUtils.doGetBytes(getUrl,header); + if (downloadresult.containsKey("content")){ + byte[] content = (byte[]) downloadresult.get("content"); + size= (Integer) downloadresult.get("size"); + Thread.sleep(4000); + String result = DownLoadFile.upload(putUrl,fileName,content); + + realUrl = JSONObject.parseObject(result).getString("url"); + realresult.put("realUrl",realUrl); + realresult.put("size",size); + } + } catch (IOException e) { + e.printStackTrace(); + } + }catch (Exception e){ + e.printStackTrace(); + } + return realresult; + } + + public static String upload(String uploadUrl,String fileName,byte[] content) { + String result = ""; + try { + OkHttpClient httpClient = new OkHttpClient(); + MultipartBody multipartBody = new MultipartBody.Builder(). + setType(MultipartBody.FORM) + .addFormDataPart("file", fileName, + RequestBody.create(MediaType.parse("multipart/form-data;charset=utf-8"), + content)) + .addFormDataPart("output", "json") + .build(); + Request request = new Request.Builder() + .url(uploadUrl) + .post(multipartBody) + .build(); + Response response = httpClient.newCall(request).execute(); + if (response.isSuccessful()) { + ResponseBody body = response.body(); + if (body != null) { + result = body.string(); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } + +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/MyCookieJar.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/MyCookieJar.java new file mode 100644 index 0000000..f74486a --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/MyCookieJar.java @@ -0,0 +1,38 @@ +package com.bfd.mf.datasave.download; + +import okhttp3.Cookie; +import okhttp3.CookieJar; +import okhttp3.HttpUrl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class MyCookieJar implements CookieJar { + private final Map> cookieStore = new ConcurrentHashMap<>(); + + @Override + public void saveFromResponse(HttpUrl httpUrl, List list) { + Map cookies = cookieStore.get(httpUrl.host()); + if (cookies == null) { + cookies = new HashMap<>(); + } + for (Cookie c : list) { + cookies.put(c.name(), c); + } + } + + @Override + public List loadForRequest(HttpUrl httpUrl) { + Map cookies = cookieStore.get(httpUrl.host()); + + List list = new ArrayList<>(); + if (cookies == null) + return list; + + cookies.forEach((k,v) -> list.add(v)); + return list; + } +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/OkHttpUtils.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/OkHttpUtils.java new file mode 100644 index 0000000..d2d104c --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/OkHttpUtils.java @@ -0,0 +1,190 @@ +package com.bfd.mf.datasave.download; + +import okhttp3.*; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * Created by BFD_303 on 2017/7/7. + */ +public class OkHttpUtils { + + private static final CookieJar cookieJar = new MyCookieJar(); + private static final OkHttpClient dClient = new OkHttpClient().newBuilder() + .cookieJar(cookieJar) + .connectTimeout(10, TimeUnit.MINUTES) + .readTimeout(10,TimeUnit.MINUTES) + .writeTimeout(10,TimeUnit.MINUTES) + .build(); + + private static String doExecute(Request request, OkHttpClient client) throws Exception{ + if (client == null) + client = dClient; + + Response response = null; + try{ + response = client.newCall(request).execute(); + System.out.println(request.url() + " => get status code is " + response.code()); + return response.isSuccessful() ? response.body().string() : ""; + }finally { + if (response != null) + response.close(); + } + } +// + public static String doGet(String url, Map headers,String ip,int port) throws Exception { + OkHttpClient client ; + if (ip == null) + client = dClient; + else + client = dClient.newBuilder() + .cookieJar(cookieJar) + .proxy(new Proxy(Proxy.Type.HTTP,new InetSocketAddress(ip,port))) + .connectTimeout(10, TimeUnit.SECONDS) + .build(); + + Request.Builder builder = new Request.Builder().url(url); + if (headers != null && headers.size() > 0){ + headers.forEach((k,v) -> builder.addHeader(k,v)); + } + Request request = builder.build(); + return doExecute(request,client); + } + + public static String doPost(String url, Map headers,Map params) throws Exception { + OkHttpClient client = dClient.newBuilder() + .cookieJar(cookieJar) + .connectTimeout(30, TimeUnit.SECONDS) + .build(); + + FormBody.Builder bodyBuilder= new FormBody.Builder(); + if (params != null){ + params.forEach((k,v) -> bodyBuilder.add(k,v)); + } + RequestBody body = bodyBuilder.build(); + + Request.Builder builder = new Request.Builder().url(url).post(body); + if (headers != null && headers.size() > 0){ + headers.forEach((k,v) -> builder.addHeader(k,v)); + } + Request request = builder.build(); + return doExecute(request,client); + } + + + public static String doPost(String url, Map headers,Map params, ProxyIp ip) throws Exception { + OkHttpClient client; + if (ip == null) + client = dClient; + else + client = dClient.newBuilder() + .cookieJar(cookieJar) + .proxy(new Proxy(ip.getType(),new InetSocketAddress(ip.getIp(),ip.getPort()))) + .connectTimeout(5, TimeUnit.SECONDS) + .build(); + + FormBody.Builder bodyBuilder= new FormBody.Builder(); + if (params != null){ + params.forEach((k,v) -> bodyBuilder.add(k,v)); + } + RequestBody body = bodyBuilder.build(); + + Request.Builder builder = new Request.Builder().url(url).post(body); + if (headers != null && headers.size() > 0){ + headers.forEach((k,v) -> builder.addHeader(k,v)); + } + Request request = builder.build(); + return doExecute(request,client); + } + + public static byte[] doPostByte(String url,Map headers,Map params,ProxyIp ip) throws IOException { + OkHttpClient client; + if (ip == null) + client = dClient; + else + client = dClient.newBuilder() + .cookieJar(cookieJar) + .proxy(new Proxy(ip.getType(),new InetSocketAddress(ip.getIp(),ip.getPort()))) + .connectTimeout(10, TimeUnit.SECONDS) + .build(); + + FormBody.Builder bodyBuilder= new FormBody.Builder(); + if (params != null){ + params.forEach((k,v) -> bodyBuilder.add(k,v)); + } + RequestBody body = bodyBuilder.build(); + + Request.Builder builder = new Request.Builder().url(url).post(body); + if (headers != null && headers.size() > 0){ + headers.forEach((k,v) -> builder.addHeader(k,v)); + } + Request request = builder.build(); + + Response response = null; + try{ + response = client.newCall(request).execute(); + System.out.println(request.url() + " => get status code is " + response.code()); +// cookieJar.loadForRequest(request.url()).forEach(c -> System.out.println(c.name() + " -> " + c.value())); + return response.isSuccessful() ? response.body().bytes() : null; + }finally { + if (response != null) + response.close(); + } + } + + public static byte[] doGetByte(String url,Map headers) throws IOException { + Request.Builder rBuilder = new Request.Builder().url(url); + + if (headers != null){ + headers.forEach((k,v) -> rBuilder.addHeader(k,v)); + } + Request request = rBuilder.build(); + Response response = null; + try{ + response = dClient.newCall(request).execute(); + System.out.println(request.url() + " => get status code is " + response.code()); + System.out.println( " => get size code is " + Integer.valueOf(response.header("Content-Length"))/1024); + return response.isSuccessful() ? response.body().bytes() : null; + }finally { + if (response != null) + response.close(); + System.gc(); + } + } + + + public static Map doGetBytes(String url,Map headers) throws IOException { + Map result= new HashMap<>(); + Request.Builder rBuilder = new Request.Builder().url(url); + if (headers != null){ + headers.forEach((k,v) -> rBuilder.addHeader(k,v)); + } + Request request = rBuilder.build(); + Response response = null; + try{ + response = dClient.newCall(request).execute(); + System.out.println(request.url() + " => get status code is " + response.code()); + + if (response.isSuccessful()) { + ResponseBody body = response.body(); + if (body != null) { + byte[] content=response.body().bytes(); + result.put("content",content); + int size=Integer.valueOf(response.header("Content-Length"))/1024; + result.put("size",size); + } + } + return result; + }finally { + if (response != null) + response.close(); + System.gc(); + } + } + +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/ProxyIp.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/ProxyIp.java new file mode 100644 index 0000000..35985d0 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/download/ProxyIp.java @@ -0,0 +1,33 @@ +package com.bfd.mf.datasave.download; + +import java.net.Proxy; + +public class ProxyIp { + private static Proxy.Type type; + private static String ip; + private static int port; + + public static Proxy.Type getType() { + return type; + } + + public static void setType(Proxy.Type type) { + ProxyIp.type = type; + } + + public static String getIp() { + return ip; + } + + public static void setIp(String ip) { + ProxyIp.ip = ip; + } + + public static int getPort() { + return port; + } + + public static void setPort(int port) { + ProxyIp.port = port; + } +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/kafka/IKafka.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/kafka/IKafka.java new file mode 100644 index 0000000..5c64b73 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/kafka/IKafka.java @@ -0,0 +1,11 @@ +package com.bfd.mf.datasave.kafka; + +import java.util.List; + +public interface IKafka { + public void read(); + public void read(String readTopicName); + public void read(String readTopicName, String groupId); + public void write(List data, String writeTopicName); + public void stop(); +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/kafka/ReadKafka.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/kafka/ReadKafka.java new file mode 100644 index 0000000..aed90cb --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/kafka/ReadKafka.java @@ -0,0 +1,117 @@ +package com.bfd.mf.datasave.kafka; + + +import com.bfd.crawler.kafka7.KfkConsumer; +import com.bfd.crawler.kafka7.KfkProducer; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.List; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingDeque; + +public class ReadKafka implements IKafka{ + private static Log LOG = LogFactory.getLog(ReadKafka.class); + private BlockingQueue queue; + private String defaultReadTopicName; + private int threadNums; + private String groupId; + private int kafkaServerName ; + private int esSerName ; + + public ReadKafka(BlockingQueue queue,String topicName,int threadNums,String groupId,int kafkaServerName,int esSerName){ + this.queue = queue; + this.defaultReadTopicName = topicName; + this.threadNums =threadNums; + this.groupId = groupId; + this.kafkaServerName = kafkaServerName ; + this.esSerName = esSerName ; + } + +// public void read(){ +// KfkConsumer.startReadThread(this.queue, this.defaultReadTopicName,this.threadNums,this.groupId,this.kafkaServerName); +// } +// + public void read(){ + System.out.println(this.queue+"队列"+this.defaultReadTopicName+"topic"+this.threadNums+"group"+this.groupId+"sercer"+this.kafkaServerName); + //KfkConsumer.startReadThread(this.queue, this.defaultReadTopicName,this.threadNums,this.groupId,this.kafkaServerName); + KfkConsumer.startReadThread(this.queue, this.defaultReadTopicName,this.threadNums, this.groupId,this.kafkaServerName); + } + @Override + public void read(String readTopicName) { + KfkConsumer.startReadThread(this.queue, readTopicName,this.threadNums,this.groupId,this.kafkaServerName); + } + + @Override + public void read(String readTopicName, String groupId) { + KfkConsumer.startReadThread(this.queue, readTopicName,this.threadNums,groupId,this.kafkaServerName); + } + + @Override + public void write(List data,String writeTopicName ) { + KfkProducer.getInstance(kafkaServerName,"").send(writeTopicName,data); + } + + @Override + public void stop() { + LOG.info("ending:kfk consumer:stopping..."); + KfkConsumer.stopKfkConsumerThreads(); + LOG.info("ending:kfk consumer:closed"); + } + +// public static void main(String[] args) { +// test2(); +// } +// +// public static void test2(){ +// BlockingQueue queue = new LinkedBlockingDeque(); +// String topicName = "Ejingdongdedup"; +// int threadNums = 5; +// ReadKafka kfk = new ReadKafka(queue, topicName, threadNums,"bbs_group_test",1,1); +// kfk.read(); +// while(true){ +// if(queue.size()>0){ +// try { +// System.out.println("kafka 读取结果 : "+queue.take()); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// }else{ +//// kfk.stop(); +//// break; +// } +// } +// +// } +// +// public static void test1(){ +// +// +// +// BlockingQueue queue = new LinkedBlockingDeque(); +// String topicName = "test_hrn"; +// int threadNums = 5; +// ReadKafka kfk = new ReadKafka(queue, topicName, threadNums,"test_group_2",1,1); +//// List data = new ArrayList(); +//// for(int i=1000;i<1010;i++){ +//// data.add("test_" + i); +//// } +//// kfk.write(data); +// +// +// kfk.read(); +// while(true){ +// if(queue.size()>0){ +// try { +// System.out.println(queue.take()); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// }else{ +//// kfk.stop(); +//// break; +// } +// } +// +// } +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/listen/DataSaveManager.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/listen/DataSaveManager.java new file mode 100644 index 0000000..6309077 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/listen/DataSaveManager.java @@ -0,0 +1,671 @@ +package com.bfd.mf.datasave.listen; + +import com.alibaba.fastjson.JSONArray; +import com.bfd.crawler.elasti.ElastiProducer; +import com.bfd.crawler.kafka7.KfkProducer; +import com.bfd.crawler.kafka7.utils.PropertiesParser; +import com.bfd.crawler.utils.JsonUtils; +import com.bfd.mf.datasave.download.DownLoadFile; +import com.bfd.mf.datasave.tools.DateUtil; +import com.bfd.mf.datasave.tools.ReadLine; +import com.bfd.mf.datasave.tools.WriteMethod; +import com.bfd.mf.entity.AllKeys; +import com.bfd.mf.entity.FieldNormaliz; +import com.bfd.mf.entity.mysql.SubjectTask; +import org.apache.commons.lang3.StringUtils; + +import org.apache.log4j.Logger; +import scala.collection.generic.BitOperations; +//import org.apache.logging.log4j.core.parser.ParseException; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class DataSaveManager implements Runnable{ + + private static Logger log = Logger.getLogger(DataSaveManager.class); + private String data ; + private FieldNormaliz fieldNormaliz ; + private static Map>> subject; + private static Map> tableInfoMap; + private static String preIndex = "cl_index_"; + private static String preSubject = "cl_subject_"; + private static int subjectEsNum = 1; + private static int indexEsNum = 2; + private static String indexType = "docs"; + private static int bussinessType = 1; + private static String kafkaTopic = "dataFromES_"; + private static String myGoFastAddr = "http://172.18.1.113:8080/upload"; + private static Map resultMap = AllKeys.getMap(); + private static String filePath = "../datasaveputkafka_file/";// + public DataSaveManager(String data, FieldNormaliz fieldNormaliz){ + this.data = data ; + this.fieldNormaliz = fieldNormaliz ; + } + + + public DataSaveManager(String data, FieldNormaliz fieldNormaliz, + Map>> subject, + Map> tableInfoMap){ + this.data = data ; + this.fieldNormaliz = fieldNormaliz ; + this.subject = subject; + this.tableInfoMap = tableInfoMap; + } + + + public void excData(){ + try{ + int kafkaNum = fieldNormaliz.getKafkaSerName(); + Map jsonData = JsonUtils.parseObject(data); + Map tableInfo = tableInfoMap.get(bussinessType) ; + String res = convertData(jsonData, tableInfo); + Map resultMap = getResponse(res); // resultMap 就是将要写入到 ES 和 kafka 的一条数据 + System.out.println("The Message : "+JsonUtils.toJSONString(resultMap)); + //System.out.println("The Message subject: "+JsonUtils.toJSONString(subject)); + // 1、先判断是主贴还是评论 主贴写日期索引,回帖评论写 渠道索引 + String dateIndexName = getIndexName(resultMap); + System.out.println(dateIndexName); + int index= Integer.parseInt(dateIndexName.split("cl_index_")[1].split("-")[0]); + if(resultMap.containsKey("primary") && resultMap.get("primary").toString().equals("0")) { + dateIndexName = preIndex + resultMap.get("docType").toString(); + } + System.out.println("切割后的索引名字"+index); + //writerToKafka(2, "dataFromES_10000tw", resultMap); + // writerToSubjectES("cl_subject_10429", resultMap); + if (index>2015){ + writerToIndexES(dateIndexName, resultMap); + } + //System.out.println("-----------------------继续后面的步骤哇--------------------: " + JsonUtils.toJSONString(resultMap)); + // 2、判断数据中是否要下载标识,如果有需要先下载对应的文件,然后替换存储路径后再保存数据 + if(resultMap.containsKey("crawlDataFlag") && resultMap.containsKey("isDownload")) { //resultMap.containsKey("isDownload") + String key = getAllMapKey(resultMap); + //String getUrl = (String) resultMap.get("filePath"); + List filePathlist=new ArrayList<>(); + List imagePathlist=new ArrayList<>(); + List videoPathlist=new ArrayList<>(); + List filePath= (List) resultMap.get("filePath"); + List imagePath= (List) resultMap.get("imagePath"); + List videoPath= (List) resultMap.get("videoPath"); + // 从 subject 中可以获取到这个key 对应的 专题信息 + System.out.println("key == " + key + " **** " + JsonUtils.toJSONString(subject)); + + if(subject.containsKey(key)) { + List> subjectList = subject.get(key); + for (Map subjectMap : subjectList) { + String go_fast_addr = subjectMap.get("go_fast_addr"); + String subject_id = subjectMap.get("subject_id"); + String isDownload = (String)resultMap.get("isDownload"); + if (isDownload.equals("true")) { + String putUrl = myGoFastAddr; + if (!go_fast_addr.isEmpty()){ + putUrl = go_fast_addr; + } + if (filePath.size()>0){ + Iterator it = filePath.iterator(); + List> valueList = new ArrayList<>(); + Map filemap =new HashMap<>(); + while(it.hasNext()){ + String geturl= it.next(); + Map resultmap = DownLoadFile.downloadAndSaveFile(geturl, putUrl); + String resulturl= (String) resultmap.get("realUrl"); + String size= resultmap.get("size").toString()+"KB"; + if (resulturl!= null && resulturl.length()!= 0){ + filemap.put(resulturl,size); + filePathlist.add(resulturl); + }else { + System.out.print("很遗憾,怎么有下载失败了"); + filePath.add(geturl); + filemap.put(geturl,size); + } + } + //valueList.add(filemap); +// if(videoPathlist.size()>0){ +// resultMap.put("ugc",1); +// } +// else { +// resultMap.put("ugc",0); +// } + resultMap.put("filePathSize",JsonUtils.toJSONString(filemap)); + resultMap.put("filePath", filePathlist); + } + if (imagePath.size()>0){ + List> valueList = new ArrayList<>(); + Map imagemap =new HashMap<>(); + Iterator it = imagePath.iterator(); + while(it.hasNext()){ + String geturl= it.next(); + Map resultmap = DownLoadFile.downloadAndSaveFile(geturl, putUrl); + String resulturl= (String) resultmap.get("realUrl"); + String size= resultmap.get("size").toString()+"KB"; + if (resulturl!= null && resulturl.length()!= 0){ + imagemap.put(resulturl,size); //url +size + imagePathlist.add(resulturl);//url + }else{ + System.out.print("很遗憾,怎么有下载失败了"); + imagePath.add(geturl); + imagemap.put(geturl,size); + } + } + //valueList.add(imagemap); +// if(imagePath.size()>0){ +// resultMap.put("pgc",1); +// } +// else { +// resultMap.put("pgc",0); +// } + resultMap.put("imagePathSize",JsonUtils.toJSONString(imagemap)); + resultMap.put("imagePath", imagePathlist); + } + if (videoPath.size()>0){ + List> valueList = new ArrayList<>(); + Map videomap =new HashMap<>(); + Iterator it = videoPath.iterator(); + while(it.hasNext()){ + String geturl= it.next(); + System.out.println(putUrl+"putUrl是哪个啊"); + Map resultmap = DownLoadFile.downloadAndSaveFile(geturl, putUrl); + String resulturl= (String) resultmap.get("realUrl"); + String size= resultmap.get("size").toString()+"KB"; + + System.out.println("视频地址啊"+resulturl); + if (resulturl!= null && resulturl.length()!= 0){//判断 是否下载成功 + videomap.put(geturl,size); + videoPathlist.add(resulturl);}else{ + videoPathlist.add(geturl); + videomap.put(geturl,size); + } + } + //valueList.add(videomap); + if(videoPathlist.size()>0){ + resultMap.put("egc",1); + } + else { + resultMap.put("egc",0); + } + resultMap.put("videoPathSize",JsonUtils.toJSONString(videomap)); + resultMap.put("videoPath", videoPathlist); + } + + } + String task_id = subjectMap.get("task_id"); + String external_id = subjectMap.get("external_id"); + resultMap.put("taskId", task_id); + resultMap.put("externalId", external_id); + String indexName = preSubject + subject_id; + // 数据写入到对应的专题索引中 + writerToSubjectES(indexName, resultMap); + + String kafka_addr = subjectMap.get("kafka_addr"); + if (!kafka_addr.isEmpty()) { + // 数据写入到指定的kafka 中 + kafkaTopic = kafkaTopic + "_" + subject_id; + //kafkaNum 指的是etc 中 kafka 配置文件的编号 + int num= checkPathExists(kafka_addr); + if (num>0){ + System.out.print(num); + writerToKafka(num, "dataFromES_10000", resultMap);} + } + } + } + }else{ + System.out.println(" 这条数据都没有标识位,就不往专题的索引存储了呗!!!!" + resultMap.get("dataId")); + } + + }catch(Exception e){ + e.printStackTrace(); + log.error(data); + } + } + + private static void writerToSubjectES(String indexName , Map responseMap) { + System.out.println("==========================写入到【专题】ES : ==========" + indexName + " - "+responseMap.get("docId") ); + WriteMethod.writeMethod("zhuti.txt",JsonUtils.toJSONString(responseMap)); + // System.out.println("==========================写入到【专题】ES : ==========" + indexName + " - "+responseMap.get("videoPath") ); + ElastiProducer elastiProducer = ElastiProducer.getInstance(bussinessType, subjectEsNum, indexName, indexType); + elastiProducer.sendMessageToEs(JsonUtils.toJSONString(responseMap)); + //System.out.println("==========================写入到【专题】ES : ==========" + indexName + " - "+JsonUtils.toJSONString(responseMap) ); + } + + private static void writerToIndexES(String indexName , Map responseMap) { + System.out.println("==========================写入到【日期】ES : ==========" + indexName + " - "+responseMap.get("docId")); + ElastiProducer elastiProducer = ElastiProducer.getInstance(bussinessType, indexEsNum, indexName, indexType); + elastiProducer.sendMessageToEs(JsonUtils.toJSONString(responseMap)); + + } + + private static void writerToKafka(int kafkaNum,String indexName, String key, Map responseMap) { + try{ + List> subjects = subject.get(key); + if(subjects.size() > 0) { + for (Map sub : subjects) { + String subjectId = sub.get("subject_id"); + String exportToKafka = sub.get("export_to_kafka"); + String kafkaAddr = sub.get("kafka_addr"); + //System.out.println("indexName : " + indexName + " ; subjectId : " + subjectId); + if (indexName.contains(subjectId) && exportToKafka.equals("1")) { + System.out.println("-----------------------------------------将数据写到对应的 kafka 中 : " + kafkaAddr); + //KfkProducer.getInstance().send("test0910", JsonUtils.toJSONString(responseMap)); + } + } + }else{ + System.out.println("空的????????" + key); + } + + }catch (Exception e){ + e.printStackTrace(); + } + } + + private static void writerToKafka(int kafkaNum,String kafkaTopic,Map responseMap) { + try{ + System.out.println("要写的kafka : "+kafkaNum + " ; kafkaTopic: " + kafkaTopic); + KfkProducer.getInstance(kafkaNum, kafkaTopic).send(kafkaTopic, JsonUtils.toJSONString(responseMap)); + }catch (Exception e){ + e.printStackTrace(); + } + } + + private static String downloadAndChange(String indexName ,String key ,Map responseMap,String defaultgetUrl ) { + String newdefaultUrl=""; + try{ + // 判断数据是否有文件需要下载,如果有需要下载的讲文件下载到对应的 gofast 地址中 + if(null != responseMap && responseMap.containsKey("isDownload")){ + String isDownload = (String)responseMap.get("isDownload"); + if(isDownload.equals("true")){ + // String getUrl = "https://www.bilibili.com/video/BV1gJ411L7aF?from=search&seid"; + String getUrl = defaultgetUrl; + System.out.println("实际要下载的视频链接: "+getUrl); + List> subjects = subject.get(key); + for (Map sub: subjects) { + String subjectId = sub.get("subject_id"); + if(indexName.contains(subjectId)){ + //String putUrl = sub.get("go_fast_addr"); + System.out.println("gofast的地址是这个啊"+myGoFastAddr); + //newdefaultUrl = DownLoadFile.downloadAndSaveFile(getUrl,myGoFastAddr); + System.out.println("下载后的地址链接: "+newdefaultUrl); + //responseMap.put("videoUrl",resulturl); +// responseMap.put("filePath","http://172.26.11.110:8080/group1/default/20200904/09/58/5/VIUuOnpnGyE.mp4"); + } + } + } + } + }catch (Exception e){ + e.printStackTrace(); + } + return newdefaultUrl; + } + + private static String getAllMapKey(Map responseMap){ + String key = null; + if(responseMap.containsKey("enSource")){ + String enSource = (String) responseMap.get("enSource"); + if(responseMap.containsKey("crawlDataFlag")) { + String crawlDataFlag = (String) responseMap.get("crawlDataFlag"); + key = enSource+"#####"+crawlDataFlag; + }else{ + System.out.println("数据没有标识???为什么呀?" + JsonUtils.toJSONString(responseMap)); + } + } + return key.toLowerCase(); + } + +// private List getIndexNameList(String key , Map responseMap) { +// List indexNames = new ArrayList<>(); +// try{ +// System.out.println( key + " ; task_subject: "+JsonUtils.toJSONString(subject)); +// if(subject.containsKey(key)){ +// List> values = subject.get(key); +// for (Map val: values) { +// String subjectId = val.get("subject_id"); +// String taskId = val.get("task_id"); +// String externalId = val.get("external_id"); +// System.out.println(taskId + " -- " + externalId); +// System.out.println(externalId); +// indexNames.add(preSubject + subjectId); +// } +// }else{ +// //System.out.println("3333 : " + JsonUtils.toJSONString(responseMap)); +// System.out.println("这条数据不用写到 【专题】 索引中哦!!! " + +// "crawlDataFlag = " +responseMap.get("crawlDataFlag") + " ; " + +// "id = " + responseMap.get("dataId") + " ; " + +// "pubTime = " + responseMap.get("pubTimeStr")); +// } +// +//// }else{ +//// System.out.println("33333 "+responseMap); +//// } +// +//// for (Map.Entry entry : subject.entrySet()) { +//// System.out.println("subject : key= " + entry.getKey() + " and value= " + entry.getValue()); +//// } +//// for (Map.Entry entry : downloadAddr.entrySet()) { +//// System.out.println("download : key= " + entry.getKey() + " and value= " + entry.getValue()); +//// } +//// for (Map.Entry entry : kafkaAddr.entrySet()) { +//// System.out.println("kafka: key= " + entry.getKey() + " and value= " + entry.getValue()); +//// } +// }catch (Exception e){ +// e.printStackTrace(); +// } +// return indexNames; +// } + +// private static String getIndexName(Map responseMap) { +// String pubTimeStr = responseMap.get("pubTimeStr").toString().split(" ")[0]; +// String indexName = preIndex+pubTimeStr; +// return indexName; +// } + + private static String getIndexName(Map responseMap) { + String pubTimeStr= null; + try { + //System.out.print(responseMap); + //System.out.print(responseMap.get("pubTimeStr").toString()+"pubTimeStr是啦啦啦"); + pubTimeStr = getDayString( responseMap.get("pubTimeStr").toString()); + + } catch (ParseException e) { + e.printStackTrace(); + } + String indexName = preIndex+pubTimeStr; + return indexName; + } + + + + + + private static Map getResponse(String dataNew) throws Exception { + Map responseMap = new HashMap<>(resultMap); + try { + Map dataMap = JsonUtils.parseObject(dataNew); + for (Map.Entry entry : dataMap.entrySet()) { + if (resultMap.containsKey(entry.getKey())) { + responseMap.put(entry.getKey(), entry.getValue()); + } + } + return responseMap; + }catch (Exception e){ + e.printStackTrace(); + return null; + } + } + +// public static void main(String[] args) { +// String getUrl = "https://wx1.sinaimg.cn/mw1024/89c644a5ly8fnskt9bm5gj20ro0rogls.jpg"; +// String putUrl = "http://172.26.11.110:8080/upload"; +// String url = DownLoadFile.downloadAndSaveFile(getUrl,putUrl); +// System.out.println(url); +// } + +// public static void main(String[] args) { +// int bussinessType = 1; +// int esServerName = 2; +// String indexType = "docs"; +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// Date dBegin = null; +// try { +// dBegin = sdf.parse("2020-08-11"); +// Date dEnd = sdf.parse("2020-08-12"); +// List < Date > lDate = findDates(dBegin, dEnd); +// for (Date d:lDate) { +//// String indexName = "cl_index_"+ sdf.format(d); +// String indexName = "cl_index_news"; +//// String indexName = "cl_index_yilong_comment"; +//// String indexName = "cl_subject_10277"; +// System.out.println(indexName); +// ElastiProducer elastiProducer = ElastiProducer.getInstance(bussinessType, esServerName, indexName, indexType); +// System.out.println(elastiProducer); +// } +//// ElastiProducer elastiProducer = ElastiProducer.getInstance(bussinessType, esServerName, indexName, indexType); +//// System.out.println(esServerName+"#"+indexName+" : "+ JsonUtils.toJSONString(elastiProducer)); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } + + + private static String convertData(Map jsonData, Map tableInfo){ + try{ + Map jsonDatanew = new HashMap(jsonData); + for(Map.Entry entry : jsonDatanew.entrySet()){ + String key = entry.getKey() ; + Object dataValue = entry.getValue(); + if(key.equals("content") && dataValue != null){ + String content = dataValue.toString().replaceAll("[^\\u0000-\\uFFFF]", "") ; + jsonData.put(key, content); + } + if(key.equals("title") && dataValue != null){ + String title = dataValue.toString().replaceAll("[^\\u0000-\\uFFFF]", "") ; + jsonData.put(key, title); + } + if(key.equals("author") && dataValue != null){ + String author = dataValue.toString().replaceAll("[^\\u0000-\\uFFFF]", "") ; + jsonData.put(key, author); + } +// if(key.equals("videoPath") && dataValue != null){ +// List list=new ArrayList<>(); +// list.add(dataValue.toString()); +// jsonData.put(key,list); +// } +// if(key.equals("imagePath")&&dataValue != null){ +// List list=new ArrayList<>(); +// list.add(dataValue.toString()); +// jsonData.put(key,list); +// } +// if(key.equals("filePath") && dataValue != null){ +// List list=new ArrayList<>(); +// list.add(dataValue.toString()); +// jsonData.put(key,list); +// } + + if(tableInfo.containsKey(key)){ + System.out.print("tableInfo"+tableInfo); + String value = tableInfo.get(key); + if(value.equals("Integer")){ + if(StringUtils.isNotBlank(dataValue.toString())){ + String dataValuenew = dataValue.toString(); + if(dataValuenew.contains(",")){ + dataValuenew = dataValuenew.replace(",", ""); + jsonData.put(key, Integer.valueOf(dataValuenew)) ; + }else if(dataValuenew.contains("顶")){ + dataValuenew = "0"; + jsonData.put(key, Integer.valueOf(dataValuenew)) ; + }else if(dataValuenew.endsWith("万")){ + dataValuenew = dataValuenew.substring(0, dataValuenew.indexOf("万")); + jsonData.put(key, new Double(Double.valueOf(dataValuenew) * 10000).intValue()) ; + }else if(dataValuenew.endsWith("万+")){ + dataValuenew = dataValuenew.substring(0,dataValuenew.indexOf("万+")) ; + jsonData.put(key, new Double(Double.valueOf(dataValuenew) * 10000).intValue()) ; + }else{ + try{ + if(dataValue.toString().contains("全部评论")){ + dataValue = dataValue.toString().replace("全部评论 (","").replace(")",""); + } + jsonData.put(key, Integer.valueOf(dataValue.toString())) ; + }catch(Exception e){ + System.out.println("ERROR key " + key + "; value " + dataValue.toString()); + jsonData.put(key, 0) ; + e.printStackTrace(); + log.error("parse data IntFormat err value:"+dataValue); + } + } + }else{ + jsonData.put(key, 0) ; + } + }else if(value.equals("List")){ + if(StringUtils.isNotBlank(dataValue.toString())){ + jsonData.put(key, JSONArray.parseArray(dataValue.toString())) ; + } else{ + jsonData.put(key, new ArrayList()) ; + } + }else if(value.equals("Long")){ + if(StringUtils.isNotBlank(dataValue.toString())){ + try{ + Long theValue = 0L; + if(dataValue.toString().contains("万+")){ + Double dou = Double.valueOf(dataValue.toString().replace("万+","")); + theValue =new Double(dou * 10000).longValue(); ; + jsonData.put(key,theValue) ; + }else{ + jsonData.put(key,Long.valueOf(dataValue.toString())) ; + } + + }catch(Exception e){ + jsonData.put(key, 0) ; + e.printStackTrace(); + log.error("parse data LongFormat err value:"+dataValue); + } + }else{ + jsonData.put(key, 0) ; + } + } + } + } + return JsonUtils.toJSONString(jsonData) ; + }catch(Exception e){ + e.printStackTrace(); + log.error("parse data NumberFormat err :"+jsonData); + } + return null ; + } + + public static Pattern datePattrn = Pattern.compile("^\\d{4}\\-\\d{2}\\-\\d{2}\\s\\d{2}\\:\\d{2}:\\d{2}$"); + +// private String getDayString(String indexName){ +// Matcher matcher = datePattrn.matcher(indexName); +// String result = ""; +// if(matcher.find()){ +// if(StringUtils.isBlank(indexName)){ +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// return sdf.format(new Date()); +// } +// }else{ +// result = DateUtil.getDate(); +// return result; +// } +// result = indexName.trim().split("\\s+")[0]; +// return result; +// } + + + private static String getDayString(String indexName) throws ParseException { + Matcher matcher = datePattrn.matcher(indexName); + String result = ""; + if(matcher.find()){ + if(StringUtils.isBlank(indexName)){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + return sdf.format(new Date()); + } + }else{ + result = DateUtil.getDate(); + return result; + } + result = indexName.trim().split("\\s+")[0]; + DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd"); + boolean checkResult = check(result); + if(!checkResult) { + return format1.format(new Date()); + } + try { + Long date = format1.parse(result).getTime(); + Long date1 = new Date().getTime(); + if (date > date1) { + return format1.format(new Date()); + } + } catch (ParseException e) { + e.printStackTrace(); + } + return result; + } + public static boolean check (String str) { +// SimpleDateFormat sd=new SimpleDateFormat("yyyy-MM-dd");//括号内为日期格式,y代表年份,M代表年份中的月份(为避免与小时中的分钟数m冲突,此处用M),d代表月份中的天数 +// try { +// sd.setLenient(false);//此处指定日期/时间解析是否不严格,在true是不严格,false时为严格 +// sd.parse(str); //从给定字符串的开始解析文本,以生成一个日期 +// } +// catch (Exception e) { +// return false; +// } +// return true; + SimpleDateFormat sd=new SimpleDateFormat("yyyy-MM-dd");//括号内为日期格式,y代表年份,M代表年份中的月份(为避免与小时中的分钟数m冲突,此处用M),d代表月份中的天数 + try { + sd.setLenient(false);//此处指定日期/时间解析是否不严格,在true是不严格,false时为严格 + sd.parse(str);//从给定字符串的开始解析文本,以生成一个日期 + } + catch (Exception e) { + return false; + } + return true; + } + + + + + + + @Override + public void run() { + excData(); + } + + public List findDates(Date dBegin, Date dEnd) { + List lDate = new ArrayList(); + lDate.add(dBegin); + Calendar calBegin = Calendar.getInstance(); + // 使用给定的 Date 设置此 Calendar 的时间 + calBegin.setTime(dBegin); + Calendar calEnd = Calendar.getInstance(); + // 使用给定的 Date 设置此 Calendar 的时间 + calEnd.setTime(dEnd); + // 测试此日期是否在指定日期之后 + while (dEnd.after(calBegin.getTime())) { + // 根据日历的规则,为给定的日历字段添加或减去指定的时间量 + calBegin.add(Calendar.DAY_OF_MONTH, 1); + lDate.add(calBegin.getTime()); + } + return lDate; + } + public static int checkPathExists(String kafka_addr){//检查文件夹是否存在kafka的配置文件 + int num = 0; + String filename=""; + if (kafka_addr.equals("172.18.1.119:9992")){ + num=1; + }else if(kafka_addr.equals("172.18.1.178:9092,172.18.1.181:9092,172.18.1.182:9092")) { + num=2; + }else if(kafka_addr.equals("172.26.11.123:9092")) { + num=3; + }else if(kafka_addr.equals("50.19.49.16:9092")) { + num=4; + }else if(kafka_addr.equals("172.18.1.113:9092")) { + num=5; + }else { + if (kafka_addr.contains(",")){ + filename=kafka_addr.split(",")[0]; + } + filename=filename.split(":")[0]; + System.out.print(filename+"kafka_adds是"); + String filepath="../etc/"+filename+".properties"; + File file = new File(filepath); + List properties = ReadLine.readLine(new File("../etc/1_kafka.properties")); + if (!file.exists()) { + WriteMethod.writeMethod(filepath,"crawl.kfk.metadata.broker.list="+kafka_addr); + for(int i=1;i>> subject; +// private static Map> tableInfoMap; +// private static String preIndex = "cl_index_"; +// private static String preSubject = "cl_subject_"; +// private static int subjectEsNum = 1; +// private static int indexEsNum = 2; +// private static String indexType = "docs"; +// private static int bussinessType = 1; +// private static String kafkaTopic = "newsTopic_fromES"; +// private static Map resultMap = AllKeys.getMap(); +// +// public DataSaveManager_kongtianyuan(String data, FieldNormaliz fieldNormaliz){ +// this.data = data ; +// this.fieldNormaliz = fieldNormaliz ; +// } +// +// +// public DataSaveManager_kongtianyuan(String data, FieldNormaliz fieldNormaliz, +// Map>> subject, +// Map> tableInfoMap){ +// this.data = data ; +// this.fieldNormaliz = fieldNormaliz ; +// this.subject = subject; +// this.tableInfoMap = tableInfoMap; +// } +// +// +// public void excData(){ +// try{ +// int kafkaNum = fieldNormaliz.getKafkaSerName(); +// Map jsonData = JsonUtils.parseObject(data); +// Map tableInfo = tableInfoMap.get(bussinessType) ; +// String res = convertData(jsonData, tableInfo); +// Map resultMap = getResponse(res); +//// System.out.println("resultMap : " + JsonUtils.toJSONString(resultMap)); +// // 直接先将数据写入到日期索引的ES中 +// String dateIndexName = getIndexName(resultMap); +// if(resultMap.containsKey("primary") && resultMap.get("primary").toString().equals("0")) { +// dateIndexName = preIndex + resultMap.get("docType").toString(); +// } +// writerToKafka(kafkaNum,kafkaTopic,resultMap); +// // writerToIndexES(dateIndexName, resultMap); +// +//// if(responseMap.containsKey("crawlDataFlag")){ +//// // 需要根据这个标识位知道要添加的 ID 和 要写入的ES +//// String key = getAllMapKey(responseMap); +//// //List indexNames = getIndexNameList(key,responseMap); +//// WriterToSubjectES("",responseMap); +//// } +//// System.out.println("4444 : " + JsonUtils.toJSONString(responseMap)); +//// WriterToIndexES(dateIndexName, responseMap); +// // 判断数据要写入到哪个索引,然后讲数据写入到对应的索引中 +//// if(null != responseMap && responseMap.containsKey("source")) { +//// //key = twitter#####account:https://twitter.com/spokespersonchn &&& 索引名称是: cl_subject_10337 &&& 数据标识:keyword:folklore +//// String key = getAllMapKey(responseMap); +//// System.out.println(" ============== key = " + key + "; crawlDataFlag = " + responseMap.get("crawlDataFlag")); +//// // 从 subject 中可以根据 key get 到 数据 要不要写 kafka,kafka的地址,文件要不要下载,文件输出的go-fast地址 +//// List indexNames = getIndexNameList(key,responseMap); +//// System.out.println("indexNames size = "+indexNames.size()); +//// for(String in: indexNames){ +//// System.out.println("key = " + key +" &&& 索引名称是: " + in + " &&& 数据标识:" + responseMap.get("crawlDataFlag")); +//// if(key.contains(responseMap.get("crawlDataFlag").toString().toLowerCase())) { +//// // 根据 key 和 索引名 去 subject 中查看数据要下载文件的gofast地址 +//// responseMap = downloadAndChange(in, key, responseMap); +//// // 根据 key 和 索引名 去 subject 中查看数据是否要导出到kafka,写到 kafka 中的数据得是替换文件地址后的数据 +//// writerToKafka(in, key, responseMap); +//// // 讲数据写入到对应索引的ES 中 +//// WriterToSubjectES(in, responseMap); +//// }else{ +//// System.out.println("对应关系错了!!!! key = " + key +" ;&&& 数据标识:" + responseMap.get("crawlDataFlag")); +//// } +//// } +//// } +// }catch(Exception e){ +// e.printStackTrace(); +// log.error(data); +// } +// } +// +// private static void writerToSubjectES(String indexName , Map responseMap) { +// System.out.println("==========================写入到【专题】ES : ==========" + indexName + " - "+responseMap.get("docId")); +//// ElastiProducer elastiProducer = ElastiProducer.getInstance(bussinessType, subjectEsNum, indexName, indexType); +//// elastiProducer.sendMessageToEs(JsonUtils.toJSONString(responseMap)); +// +// } +// +// private static void writerToIndexES(String indexName , Map responseMap) { +// System.out.println("==========================写入到【日期】ES : ==========" + indexName + " - "+responseMap.get("docId")); +// ElastiProducer elastiProducer = ElastiProducer.getInstance(bussinessType, indexEsNum, indexName, indexType); +// elastiProducer.sendMessageToEs(JsonUtils.toJSONString(responseMap)); +// +// } +// +// private static void writerToKafka(int kafkaNum,String indexName, String key, Map responseMap) { +// try{ +// List> subjects = subject.get(key); +// if(subjects.size() > 0) { +// for (Map sub : subjects) { +// String subjectId = sub.get("subject_id"); +// String exportToKafka = sub.get("export_to_kafka"); +// String kafkaAddr = sub.get("kafka_addr"); +// //System.out.println("indexName : " + indexName + " ; subjectId : " + subjectId); +// if (indexName.contains(subjectId) && exportToKafka.equals("1")) { +// System.out.println("-----------------------------------------将数据写到对应的 kafka 中 : " + kafkaAddr); +// //KfkProducer.getInstance().send("test0910", JsonUtils.toJSONString(responseMap)); +// } +// } +// }else{ +// System.out.println("空的????????" + key); +// } +// +// }catch (Exception e){ +// e.printStackTrace(); +// } +// } +// +// private static void writerToKafka(int kafkaNum,String kafkaTopic,Map responseMap) { +// try{ +// System.out.println("要写的kafka : "+kafkaNum + " ; kafkaTopic: " + kafkaTopic); +// KfkProducer.getInstance(kafkaNum, kafkaTopic).send(kafkaTopic, JsonUtils.toJSONString(responseMap)); +// }catch (Exception e){ +// e.printStackTrace(); +// } +// } +// +// private static Map downloadAndChange(String indexName ,String key ,Map responseMap) { +// try{ +// // 判断数据是否有文件需要下载,如果有需要下载的讲文件下载到对应的 gofast 地址中 +// if(null != responseMap && responseMap.containsKey("isDownload")){ +// String isDownload = (String)responseMap.get("isDownload"); +// if(isDownload.equals("true")){ +//// String getUrl = "https://wx1.sinaimg.cn/mw1024/89c644a5ly8fnskt9bm5gj20ro0rogls.jpg"; +// String getUrl = (String) responseMap.get("videoUrl"); +//// System.out.println("实际要下载的视频链接: "+getUrl1); +// List> subjects = subject.get(key); +// for (Map sub: subjects) { +// String subjectId = sub.get("subject_id"); +// if(indexName.contains(subjectId)){ +// String putUrl = sub.get("go_fast_addr"); +// String resulturl = DownLoadFile.downloadAndSaveFile(getUrl,putUrl); +//// System.out.println("下载后的地址链接: "+resulturl); +// responseMap.put("videoUrl",resulturl); +//// responseMap.put("filePath","http://172.26.11.110:8080/group1/default/20200904/09/58/5/VIUuOnpnGyE.mp4"); +// } +// } +// } +// } +// }catch (Exception e){ +// e.printStackTrace(); +// } +// return responseMap; +// } +// +// private static String getAllMapKey(Map responseMap){ +// String key = null; +// if(responseMap.containsKey("enSource")){ +// String enSource = (String) responseMap.get("enSource"); +// if(responseMap.containsKey("crawlDataFlag")) { +// String crawlDataFlag = (String) responseMap.get("crawlDataFlag"); +// key = enSource+"#####"+crawlDataFlag; +// }else{ +// System.out.println("数据没有标识???为什么呀?" + JsonUtils.toJSONString(responseMap)); +// } +// } +// return key; +// } +// +//// private List getIndexNameList(String key , Map responseMap) { +//// List indexNames = new ArrayList<>(); +//// try{ +//// System.out.println( key + " ; task_subject: "+JsonUtils.toJSONString(subject)); +//// if(subject.containsKey(key)){ +//// List> values = subject.get(key); +//// for (Map val: values) { +//// String subjectId = val.get("subject_id"); +//// String taskId = val.get("task_id"); +//// String externalId = val.get("external_id"); +//// System.out.println(taskId + " -- " + externalId); +//// System.out.println(externalId); +//// indexNames.add(preSubject + subjectId); +//// } +//// }else{ +//// //System.out.println("3333 : " + JsonUtils.toJSONString(responseMap)); +//// System.out.println("这条数据不用写到 【专题】 索引中哦!!! " + +//// "crawlDataFlag = " +responseMap.get("crawlDataFlag") + " ; " + +//// "id = " + responseMap.get("dataId") + " ; " + +//// "pubTime = " + responseMap.get("pubTimeStr")); +//// } +//// +////// }else{ +////// System.out.println("33333 "+responseMap); +////// } +//// +////// for (Map.Entry entry : subject.entrySet()) { +////// System.out.println("subject : key= " + entry.getKey() + " and value= " + entry.getValue()); +////// } +////// for (Map.Entry entry : downloadAddr.entrySet()) { +////// System.out.println("download : key= " + entry.getKey() + " and value= " + entry.getValue()); +////// } +////// for (Map.Entry entry : kafkaAddr.entrySet()) { +////// System.out.println("kafka: key= " + entry.getKey() + " and value= " + entry.getValue()); +////// } +//// }catch (Exception e){ +//// e.printStackTrace(); +//// } +//// return indexNames; +//// } +// +// private static String getIndexName(Map responseMap) { +// String pubTimeStr = responseMap.get("pubTimeStr").toString().split(" ")[0]; +// String indexName = preIndex+pubTimeStr; +// return indexName; +// } +// +// private static Map getResponse(String dataNew) throws Exception { +// Map responseMap = new HashMap<>(resultMap); +// try { +// Map dataMap = JsonUtils.parseObject(dataNew); +// for (Map.Entry entry : dataMap.entrySet()) { +// if (resultMap.containsKey(entry.getKey())) { +// responseMap.put(entry.getKey(), entry.getValue()); +// } +// } +// return responseMap; +// }catch (Exception e){ +// e.printStackTrace(); +// return null; +// } +// } +// +//// public static void main(String[] args) { +//// String getUrl = "https://wx1.sinaimg.cn/mw1024/89c644a5ly8fnskt9bm5gj20ro0rogls.jpg"; +//// String putUrl = "http://172.26.11.110:8080/upload"; +//// String url = DownLoadFile.downloadAndSaveFile(getUrl,putUrl); +//// System.out.println(url); +//// } +// +//// public static void main(String[] args) { +//// int bussinessType = 1; +//// int esServerName = 2; +//// String indexType = "docs"; +//// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +//// Date dBegin = null; +//// try { +//// dBegin = sdf.parse("2020-08-11"); +//// Date dEnd = sdf.parse("2020-08-12"); +//// List < Date > lDate = findDates(dBegin, dEnd); +//// for (Date d:lDate) { +////// String indexName = "cl_index_"+ sdf.format(d); +//// String indexName = "cl_index_news"; +////// String indexName = "cl_index_yilong_comment"; +////// String indexName = "cl_subject_10277"; +//// System.out.println(indexName); +//// ElastiProducer elastiProducer = ElastiProducer.getInstance(bussinessType, esServerName, indexName, indexType); +//// System.out.println(elastiProducer); +//// } +////// ElastiProducer elastiProducer = ElastiProducer.getInstance(bussinessType, esServerName, indexName, indexType); +////// System.out.println(esServerName+"#"+indexName+" : "+ JsonUtils.toJSONString(elastiProducer)); +//// } catch (Exception e) { +//// e.printStackTrace(); +//// } +//// } +// +// +// private static String convertData(Map jsonData, Map tableInfo){ +// try{ +// Map jsonDatanew = new HashMap(jsonData); +// for(Map.Entry entry : jsonDatanew.entrySet()){ +// String key = entry.getKey() ; +// Object dataValue = entry.getValue(); +// if(key.equals("content") && dataValue != null){ +// String content = dataValue.toString().replaceAll("[^\\u0000-\\uFFFF]", "") ; +// jsonData.put(key, content); +// } +// if(key.equals("title") && dataValue != null){ +// String title = dataValue.toString().replaceAll("[^\\u0000-\\uFFFF]", "") ; +// jsonData.put(key, title); +// } +// if(key.equals("author") && dataValue != null){ +// String author = dataValue.toString().replaceAll("[^\\u0000-\\uFFFF]", "") ; +// jsonData.put(key, author); +// } +// if(tableInfo.containsKey(key)){ +// String value = tableInfo.get(key); +// if(value.equals("Integer")){ +// if(StringUtils.isNotBlank(dataValue.toString())){ +// String dataValuenew = dataValue.toString(); +// if(dataValuenew.contains(",")){ +// dataValuenew = dataValuenew.replace(",", ""); +// jsonData.put(key, Integer.valueOf(dataValuenew)) ; +// }else if(dataValuenew.contains("顶")){ +// dataValuenew = "0"; +// jsonData.put(key, Integer.valueOf(dataValuenew)) ; +// }else if(dataValuenew.endsWith("万")){ +// dataValuenew = dataValuenew.substring(0, dataValuenew.indexOf("万")); +// jsonData.put(key, new Double(Double.valueOf(dataValuenew) * 10000).intValue()) ; +// }else if(dataValuenew.endsWith("万+")){ +// dataValuenew = dataValuenew.substring(0,dataValuenew.indexOf("万+")) ; +// jsonData.put(key, new Double(Double.valueOf(dataValuenew) * 10000).intValue()) ; +// }else{ +// try{ +// if(dataValue.toString().contains("全部评论")){ +// dataValue = dataValue.toString().replace("全部评论 (","").replace(")",""); +// } +// jsonData.put(key, Integer.valueOf(dataValue.toString())) ; +// }catch(Exception e){ +// System.out.println("ERROR key " + key + "; value " + dataValue.toString()); +// jsonData.put(key, 0) ; +// e.printStackTrace(); +// log.error("parse data IntFormat err value:"+dataValue); +// } +// } +// }else{ +// jsonData.put(key, 0) ; +// } +// +// }else if(value.equals("List")){ +// if(StringUtils.isNotBlank(dataValue.toString())){ +// jsonData.put(key, JSONArray.parseArray(dataValue.toString())) ; +// } else{ +// jsonData.put(key, new ArrayList()) ; +// } +// }else if(value.equals("Long")){ +// if(StringUtils.isNotBlank(dataValue.toString())){ +// try{ +// jsonData.put(key, Long.valueOf(dataValue.toString())) ; +// }catch(Exception e){ +// jsonData.put(key, 0) ; +// e.printStackTrace(); +// log.error("parse data LongFormat err value:"+dataValue); +// } +// }else{ +// jsonData.put(key, 0) ; +// } +// } +// } +// } +// return JsonUtils.toJSONString(jsonData) ; +// }catch(Exception e){ +// e.printStackTrace(); +// log.error("parse data NumberFormat err :"+jsonData); +// } +// return null ; +// } +// +// public static Pattern datePattrn = Pattern.compile("^\\d{4}\\-\\d{2}\\-\\d{2}\\s\\d{2}\\:\\d{2}:\\d{2}$"); +// +// private String getDayString(String indexName){ +// Matcher matcher = datePattrn.matcher(indexName); +// String result = ""; +// if(matcher.find()){ +// if(StringUtils.isBlank(indexName)){ +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// return sdf.format(new Date()); +// } +// }else{ +// result = DateUtil.getDate(); +// return result; +// } +// result = indexName.trim().split("\\s+")[0]; +// return result; +// } +// +// public boolean check (String str) { +// SimpleDateFormat sd=new SimpleDateFormat("yyyy-MM-dd");//括号内为日期格式,y代表年份,M代表年份中的月份(为避免与小时中的分钟数m冲突,此处用M),d代表月份中的天数 +// try { +// sd.setLenient(false);//此处指定日期/时间解析是否不严格,在true是不严格,false时为严格 +// sd.parse(str); //从给定字符串的开始解析文本,以生成一个日期 +// } +// catch (Exception e) { +// return false; +// } +// return true; +// } +// +// +// @Override +// public void run() { +// excData(); +// } +// +// public List findDates(Date dBegin, Date dEnd) { +// List lDate = new ArrayList(); +// lDate.add(dBegin); +// Calendar calBegin = Calendar.getInstance(); +// // 使用给定的 Date 设置此 Calendar 的时间 +// calBegin.setTime(dBegin); +// Calendar calEnd = Calendar.getInstance(); +// // 使用给定的 Date 设置此 Calendar 的时间 +// calEnd.setTime(dEnd); +// // 测试此日期是否在指定日期之后 +// while (dEnd.after(calBegin.getTime())) { +// // 根据日历的规则,为给定的日历字段添加或减去指定的时间量 +// calBegin.add(Calendar.DAY_OF_MONTH, 1); +// lDate.add(calBegin.getTime()); +// } +// return lDate; +// } +// +// +//} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/listen/ListenKafkaManager.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/listen/ListenKafkaManager.java new file mode 100644 index 0000000..19577e6 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/listen/ListenKafkaManager.java @@ -0,0 +1,77 @@ +package com.bfd.mf.datasave.listen; +import com.bfd.crawler.kafka7.KfkConsumer; +import com.bfd.mf.datasave.kafka.ReadKafka; +import com.bfd.mf.datasave.tools.DateUtil; +import com.bfd.mf.entity.FieldNormaliz; +import com.bfd.mf.entity.mysql.FiledTableInfo; +import com.bfd.mf.entity.mysql.SubjectTask; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.LinkedBlockingDeque; +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +public class ListenKafkaManager implements Runnable{ + + private LinkedBlockingDeque queue= new LinkedBlockingDeque(5000); + private boolean isRun = true; + private FieldNormaliz fieldNormaliz; + private ThreadPoolExecutor spiderPoolExec ; + private Map>> subject; + private Map> tableInfoMap; + + public ListenKafkaManager(FieldNormaliz fieldNormaliz){ + int croePoolsize = 20 ; + int maximumPoolsize = 60; + long keepAliveTime = 0; + this.spiderPoolExec = new ThreadPoolExecutor(croePoolsize, maximumPoolsize, keepAliveTime, TimeUnit.SECONDS, new SynchronousQueue()); + this.fieldNormaliz = fieldNormaliz ; + this.subject = SubjectTask.subjectTaskMap; + this.tableInfoMap = FiledTableInfo.tableInfoMap; + String kafkaname = fieldNormaliz.getKafkaName() ; +// KfkConsumer.startReadThread(queue,"Ejingdongdedup_filter1",10,"333",2); + ReadKafka readKafka = new ReadKafka(queue , kafkaname ,10 , fieldNormaliz.getGroupId(), fieldNormaliz.getKafkaSerName(),fieldNormaliz.getEsSerName()); + readKafka.read(); + } + + @Override + public void run() { + while(isRun){ + if(this.queue.size() < 1){ + DateUtil.sleep(1); + continue; + } + String data = this.queue.poll(); + if(data == null) continue ; + if (data.equals("__Exit__")) break ; + this.addTask(data); + } + } + + private void addTask(String data){ + while ( spiderPoolExec.getPoolSize() >= spiderPoolExec.getMaximumPoolSize() || + spiderPoolExec.getActiveCount() >= spiderPoolExec.getMaximumPoolSize()) { + try { + Thread.sleep(200); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + //spiderPoolExec.submit(new DataSaveManager(data, fieldNormaliz)); + //spiderPoolExec.submit(new DataSaveManager_kongtianyuan(data, fieldNormaliz,subject,tableInfoMap)); + spiderPoolExec.submit(new DataSaveManager(data, fieldNormaliz,subject,tableInfoMap)); + } + + + public void setSwitch(boolean flag){ + this.isRun = flag ; + } + + public LinkedBlockingDeque getQueue(){ + return queue ; + } + + +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/listen/ListenTaskManager.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/listen/ListenTaskManager.java new file mode 100644 index 0000000..9cbbf34 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/listen/ListenTaskManager.java @@ -0,0 +1,30 @@ +package com.bfd.mf.datasave.listen; + + +import com.bfd.mf.entity.FieldNormaliz; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +public class ListenTaskManager { + + private static Set listenkafkaTopicThreadObj = new TreeSet(); + + public static Map listenKafkaManagers = new HashMap(); + + public static void addKafkaTopicListen(FieldNormaliz fieldNormaliz){ + String kafkaTopicName = fieldNormaliz.getKafkaName() ; + int kafkaServerName = fieldNormaliz.getKafkaSerName() ; + if (!listenkafkaTopicThreadObj.contains(kafkaServerName+"#"+kafkaTopicName)) { + listenkafkaTopicThreadObj.add(kafkaServerName+"#"+kafkaTopicName); + ListenKafkaManager listenKafkaManager = new ListenKafkaManager(fieldNormaliz); + new Thread(listenKafkaManager).start(); + listenKafkaManagers.put(kafkaServerName+"#"+kafkaTopicName, listenKafkaManager); + } + } + + + +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/DBConnectionManager.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/DBConnectionManager.java new file mode 100644 index 0000000..bab717f --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/DBConnectionManager.java @@ -0,0 +1,226 @@ +package com.bfd.mf.datasave.tools; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.*; + +public class DBConnectionManager { + + private static DBConnectionManager m_dbInstance; + + private static int m_ClientNum; + + @SuppressWarnings("rawtypes") + private Vector drivers = new Vector(); + @SuppressWarnings("rawtypes") + private Hashtable pools = new Hashtable(); + public int nCount; + public int iConID; + + public static synchronized DBConnectionManager getInstance(String name) { + if (m_dbInstance == null) + m_dbInstance = new DBConnectionManager(name); + m_ClientNum++; + return m_dbInstance; + } + + private DBConnectionManager(String name) { + init(name); + } + + public void freeConnection(String name, Connection con) { + DBConnectionPool pool = (DBConnectionPool) pools.get(name); + if (pool != null) { + pool.freeConnection(con); + } + } + + public Connection getConnection(String name) { + DBConnectionPool pool = (DBConnectionPool) pools.get(name); + if (pool != null) + return pool.getConnection(); + return null; + } + + public Connection getConnection(String name, long time) { + DBConnectionPool pool = (DBConnectionPool) pools.get(name); + if (pool != null) { + return pool.getConnection(time); + } + return null; + } + + @SuppressWarnings("rawtypes") + public void release() { + if (--m_ClientNum != 0) + return; + Enumeration allPools = pools.elements(); + while (allPools.hasMoreElements()) { + DBConnectionPool pool = (DBConnectionPool) allPools.nextElement(); + pool.release(); + } + Enumeration allDrivers = drivers.elements(); + while (allDrivers.hasMoreElements()) { + Driver driver = (Driver) allDrivers.nextElement(); + try { + DriverManager.deregisterDriver(driver); + } catch (SQLException e) { + } + } + System.gc(); + } + + @SuppressWarnings({ "unchecked"}) + private void createPools(Map props) { + Set propNames = props.keySet(); + for(String name:propNames){ + if (name.endsWith(".url")) { + String poolName = name.substring(0, name.lastIndexOf(".")); + String url = props.get(poolName + ".url"); + if (url == null) { + continue; + } + String user = props.get(poolName + ".user"); + String password = props.get(poolName + ".password"); + String maxconn="0"; + if(props.containsKey(poolName + ".maxconn")) + maxconn = props.get(poolName + ".maxconn"); + else + maxconn = "50"; + int max = 0; + try { + max = Integer.parseInt(maxconn); + } catch (Exception e) { + max = 50; + } + + DBConnectionPool pool = new DBConnectionPool(poolName, url, user, password, max); + pools.put(poolName, pool); + } + + } + } + + private void init(String name) { + Map config=PropertiesUtil.getProperties(name); + + if(config==null){ + System.exit(-1); + } + + loadDrivers(config); + createPools(config); + } + + @SuppressWarnings("unchecked") + private void loadDrivers(Map props) { + String driverClasses = props.get("drivers"); + StringTokenizer st = new StringTokenizer(driverClasses); + while (st.hasMoreElements()) { + String driverClassName = st.nextToken().trim(); + try { + Driver driver = (Driver) Class.forName(driverClassName).newInstance(); + DriverManager.registerDriver(driver); + drivers.addElement(driver); + } catch (Exception e) { + } + } + } + + class DBConnectionPool { + private int checkedOut; + @SuppressWarnings("rawtypes") + private Vector freeConnections = new Vector(); + private int maxConn; + private String name; + private String password; + private String URL; + private String user; + + public DBConnectionPool(String name, String URL, String user, String password, int maxConn) { + this.name = name; + this.URL = URL; + this.user = user; + this.password = password; + this.maxConn = maxConn; + } + + @SuppressWarnings("unchecked") + public synchronized void freeConnection(Connection con) { + freeConnections.addElement(con); + checkedOut--; + notifyAll(); + } + + @SuppressWarnings("resource") + public synchronized Connection getConnection() { + Connection con = null; + if (freeConnections.size() > 0) { + con = (Connection) freeConnections.firstElement(); + freeConnections.removeElementAt(0); + try { + if (con.isClosed() || !con.isValid(2)) { + checkedOut--; + con = null; + con = getConnection(); + } + } catch (SQLException e) { + checkedOut--; + con = null; + con = getConnection(); + } + } else if (maxConn == 0 || checkedOut < maxConn) { + con = newConnection(); + }else{ + } + + if (con != null) { + checkedOut++; + } + return con; + } + + public synchronized Connection getConnection(long timeout) { + long startTime = 0; + Connection con; + while ((con = getConnection()) == null) { + try { + wait(timeout); + } catch (InterruptedException e) { + } + if (startTime++ >= timeout) { + return null; + } + } + return con; + } + + @SuppressWarnings("rawtypes") + public synchronized void release() { + Enumeration allConnections = freeConnections.elements(); + while (allConnections.hasMoreElements()) { + Connection con = (Connection) allConnections.nextElement(); + try { + con.close(); + } catch (SQLException e) { + } + } + freeConnections.removeAllElements(); + } + + private Connection newConnection() { + Connection con = null; + try { + if (user == null) + con = DriverManager.getConnection(URL); + else + con = DriverManager.getConnection(URL, user, password); + } catch (SQLException e) { + return null; + } + return con; + } + } +} \ No newline at end of file diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/DBUtil.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/DBUtil.java new file mode 100644 index 0000000..7665b6c --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/DBUtil.java @@ -0,0 +1,317 @@ +package com.bfd.mf.datasave.tools; + +import java.sql.*; +import java.util.*; + + +/** + * the operation of the db + * @author ruining.he + * @createTime 2015年5月5日上午10:28:56 + * */ +public class DBUtil { + + private static String etc_path = ""; + private static DBConnectionManager dbManager = null; + private static Map map = Collections.synchronizedMap(new HashMap()); + private String conn_name; + + private DBUtil(String conn){ + if(dbManager==null) + dbManager = DBConnectionManager.getInstance(etc_path); + this.conn_name = conn; + } + + public static void init(String path){ + etc_path = path; + } + + public static DBUtil getInstance(String connectionName){ + if("".equals(etc_path) && dbManager==null){ + System.exit(0); + } + if(map.containsKey(connectionName)) + return map.get(connectionName); + else{ + DBUtil dbUtil = new DBUtil(connectionName); + map.put(connectionName, dbUtil); + return dbUtil; + } + } + + private DBConnectionManager getDBCONConnectionManager(){ + return dbManager; + } + + public List> query(String querySql){ + List> list = new ArrayList>(); + List columns = new ArrayList(); + + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn=null; + while(conn == null){ + conn = dbm.getConnection(conn_name); +// DateUtil.sleep(1); + } + + Statement statement = null; + ResultSet rs = null; + try { + conn.setAutoCommit(false); + statement=conn.createStatement(); + rs=statement.executeQuery(querySql); + ResultSetMetaData data = rs.getMetaData(); + for(int i=1;i<=data.getColumnCount();i++) { + columns.add(data.getColumnName(i)); + } + while(rs.next()) { + HashMap map = new HashMap(); + for(int i=0;i> queryOriginalColumn(String querySql){ + List> list = new ArrayList>(); + List columns = new ArrayList(); + + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn=null; + while(conn == null){ + conn = dbm.getConnection(conn_name); + try { + Thread.currentThread().sleep(1*1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + Statement statement = null; + ResultSet rs = null; + try { + conn.setAutoCommit(false); + statement=conn.createStatement(); + rs=statement.executeQuery(querySql); + ResultSetMetaData data = rs.getMetaData(); + for(int i=1;i<=data.getColumnCount();i++){ + columns.add(data.getColumnName(i)); + } + while(rs.next()){ + HashMap map = new HashMap(); + for(int i=0;i> getQuaryResult(String quartReplyTable,String iid,Object node_name,Object website_source,Object keyword,Object title ,Object url){ + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn=null; + while(conn == null){ + conn = dbm.getConnection(conn_name); + + } + Statement statement = null; + ResultSet rs = null; + String querySql = ""; + try { + conn.setAutoCommit(false); + statement=conn.createStatement(); + rs=statement.executeQuery("select * from "+quartReplyTable+" where iid = '"+iid+"'"); + List> datalist = new ArrayList>(); + while(rs.next()){ + Map dataMap = new HashMap(); + dataMap.put("node_name", node_name); + dataMap.put("website_source", website_source); + dataMap.put("iid", rs.getObject("iid")); + dataMap.put("keyword", keyword); + dataMap.put("title", title); + dataMap.put("url", url); + dataMap.put("node_type", rs.getObject("node_type")); + dataMap.put("authorname", rs.getObject("authorname")); + dataMap.put("publicNumberName", rs.getObject("publicNumberName")); + dataMap.put("newstime", rs.getObject("newstime")); + dataMap.put("contents", rs.getObject("contents")); + dataMap.put("reply_cnt", rs.getObject("reply_cnt")); + dataMap.put("forward_num", rs.getObject("forward_num")); + dataMap.put("reply_up_cnt", rs.getObject("reply_up_cnt")); + dataMap.put("click_num", rs.getObject("click_num")); + int reply_cnt = 0; + if(rs.getObject("reply_cnt") != null){ + reply_cnt = Integer.parseInt((String) rs.getObject("reply_cnt")); + } + int forward_num = 0 ; + if(rs.getObject("forward_num") != null ){ + forward_num = Integer.parseInt((String) rs.getObject("forward_num")); + + } + dataMap.put("integra_sound_vol",1 + reply_cnt + forward_num); + dataMap.put("cate", rs.getObject("cate")); + dataMap.put("page_reply_cnt", rs.getObject("page_reply_cnt")); + dataMap.put("page_forward_num", rs.getObject("page_forward_num")); + datalist.add(dataMap); + + } + + return datalist; + } catch (Exception e) { + } finally{ + try { + if(rs!=null) + rs.close(); + if(statement!=null) + statement.close(); + } catch (Exception e2) { + } + dbm.freeConnection(conn_name, conn); + } + return null; + } + + + public int quaryCount(String querySql){ + + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn=null; + while(conn == null){ + conn = dbm.getConnection(conn_name); + try { + Thread.currentThread().sleep(1*1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + Statement statement = null; + ResultSet rs = null; + try { + conn.setAutoCommit(false); + statement=conn.createStatement(); + rs=statement.executeQuery(querySql); + while(rs.next()){ + return rs.getInt(1); + } + + conn.commit(); + } catch (Exception e) { + } finally{ + try { + if(rs!=null) + rs.close(); + if(statement!=null) + statement.close(); + } catch (Exception e2) { + } + dbm.freeConnection(conn_name, conn); + } + return 0; + + } + + public void executeBatch(List sqlCache){ + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn=null; + while(conn == null){ + conn = dbm.getConnection(conn_name); + } + try { + conn.setAutoCommit(false); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Statement statement = null; + try { + statement = conn.createStatement(); + for (int i = 0; i < sqlCache.size(); i++) { + statement.addBatch(sqlCache.get(i)); + } + statement.executeBatch(); + conn.commit(); + System.out.println("mysql execute batch committed..."); + }catch (Exception bue) { + bue.printStackTrace(); + + }finally{ + if(statement!=null){ + try { + statement.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + if(conn!=null){ + dbm.freeConnection(conn_name, conn); + } + } + + + } + + + public int execute(String sql){ + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn= null; + while(conn == null){ + conn = dbm.getConnection(conn_name); +// DateUtil.sleep(1); + } + Statement st = null; + + try { + conn.setAutoCommit(false); + st = conn.createStatement(); + int rs = st.executeUpdate(sql); + conn.commit(); + return rs; +// } catch (com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException e1){ +// return ConfigCache.CODE_EXIST_IN_DB_AND_NOT_EXIST_IN_DUPLICATE; + }catch (Exception e) { + //return -10; + }finally{ + try { + if(st!=null) + st.close(); + } catch (Exception e2) { + } + dbm.freeConnection(conn_name, conn); + } + return 0; + } + +} \ No newline at end of file diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/DateUtil.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/DateUtil.java new file mode 100644 index 0000000..eff9320 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/DateUtil.java @@ -0,0 +1,861 @@ +package com.bfd.mf.datasave.tools; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.text.ParseException; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + + +/** + * 日期处理工具类 + */ + +public class DateUtil { + //~ Static fields/initializers ============================================= + + + private static Log log = LogFactory.getLog(DateUtil.class); + private static String defaultDatePattern = null; + private static String timePattern = "HH:mm"; + public static final String TS_FORMAT = DateUtil.getDatePattern() + " HH:mm:ss.S"; + private static Calendar cale = Calendar.getInstance(); + + + //~ Methods ================================================================ + + public DateUtil(){ + } + + /** + * 获得服务器当前日期及时间,以格式为:yyyy-MM-dd HH:mm:ss的日期字符串形式返回 + */ + public static String getDateTime(){ + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return datetime.format(Calendar.getInstance().getTime()); + } catch(Exception e){ + log.debug("DateUtil.getDateTime():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器当前日期及时间,以格式为:yyyy-MM-dd HH:mm:ss的日期字符串形式返回 + */ + public static String getDateTime(long date){ + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return datetime.format(new Date(date)); + } catch(Exception e){ + log.debug("DateUtil.getDateTime():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器当前日期,以格式为:yyyy-MM-dd的日期字符串形式返回 + */ + public static String getDate(){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + return date.format(Calendar.getInstance().getTime()); + } catch(Exception e){ + log.debug("DateUtil.getDate():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器当前时间,以格式为:HH:mm:ss的日期字符串形式返回 + */ + public static String getTime(){ + String temp = ""; + try{ + SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss"); + temp += time.format(cale.getTime()); + return temp; + } catch(Exception e){ + log.debug("DateUtil.getTime():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器当前时间,以格式为:HH:mm:ss的日期字符串形式返回 + */ + public static int getHour(){ + int temp = 0; + try{ + temp = Calendar.getInstance().get(Calendar.HOUR_OF_DAY); + return temp; + } catch(Exception e){ + log.debug("DateUtil.getTime():" + e.getMessage()); + return 0; + } + } + + /** + * 返回日期加X天后的日期 + */ + @SuppressWarnings("static-access") + public static int getHour(String fromdate){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + GregorianCalendar gCal = new GregorianCalendar(); + Date datetime = date.parse(fromdate) ; + gCal.setTime(datetime) ; + return gCal.get(gCal.HOUR_OF_DAY); + } catch(Exception e){ + log.debug("DateUtil.addDay():" + e.toString()); + return 0; + } + } + + + public static int getMinute(){ + int temp = 0; + try{ + temp = Calendar.getInstance().get(Calendar.MINUTE); + return temp; + } catch(Exception e){ + log.debug("DateUtil.getTime():" + e.getMessage()); + return 0; + } + } + + + /** + * 统计时开始日期的默认值, + * 今年的开始时间 + */ + public static String getStartDate(){ + try{ + return getYear() + "-01-01"; + } catch(Exception e){ + log.debug("DateUtil.getStartDate():" + e.getMessage()); + return ""; + } + } + + /** + * 统计时结束日期的默认值 + */ + public static String getEndDate(){ + try{ + return getDate(); + } catch(Exception e){ + log.debug("DateUtil.getEndDate():" + e.getMessage()); + return ""; + } + } + + + /** + * 获得服务器当前日期的年份 + */ + public static String getYear(){ + try{ + //返回的int型,需要字符串转换 + return String.valueOf(cale.get(Calendar.YEAR)); + } catch(Exception e){ + log.debug("DateUtil.getYear():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器当前日期的月份 + */ + public static String getMonth(){ + try{ + //一个数字格式,非常好 + java.text.DecimalFormat df = new java.text.DecimalFormat(); + df.applyPattern("00"); + return df.format((cale.get(Calendar.MONTH) + 1)); + //return String.valueOf(cale.get(Calendar.MONTH) + 1); + } catch(Exception e){ + log.debug("DateUtil.getMonth():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器在当前月中天数 + */ + public static String getDay(){ + try{ + return String.valueOf(cale.get(Calendar.DAY_OF_MONTH)); + } catch(Exception e){ + log.debug("DateUtil.getDay():" + e.getMessage()); + return ""; + } + } + + /** + * 比较两个日期相差的天数, + * 第一个日期要比第二个日期要晚 + */ + public static int getDays(String date1,String date2){ + int margin; + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + ParsePosition pos = new ParsePosition(0); + ParsePosition pos1 = new ParsePosition(0); + Date dt1 = date.parse(date1,pos); + Date dt2 = date.parse(date2,pos1); + long l = dt1.getTime() - dt2.getTime(); + margin = (int)(l / (24 * 60 * 60 * 1000)); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getDays():" + e.toString()); + return 0; + } + } + + /** + * 比较两个日期相差的 小时数, + * 第一个日期要比第二个日期要晚 + */ + public static int getHours(String date1,String date2){ + int margin; + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ParsePosition pos = new ParsePosition(0); + ParsePosition pos1 = new ParsePosition(0); + Date dt1 = datetime.parse(date1,pos); + Date dt2 = datetime.parse(date2,pos1); + long l = dt1.getTime() - dt2.getTime(); + margin = (int)(l / ( 60 * 60 * 1000)); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getHours():" + e.toString()); + return 0; + } + } + + /** + * 比较两个日期相差的分钟数, + * 第一个日期要比第二个日期要晚 + */ + public static int getMinutes(String date1,String date2){ + int margin; + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ParsePosition pos = new ParsePosition(0); + ParsePosition pos1 = new ParsePosition(0); + Date dt1 = datetime.parse(date1,pos); + Date dt2 = datetime.parse(date2,pos1); + long l = dt1.getTime() - dt2.getTime(); + margin = (int)(l / ( 60 * 1000)); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getMinutes():" + e.toString()); + return 0; + } + } + + /** + * 返回日期加X天后的日期 + */ + @SuppressWarnings("static-access") + public static int getMinutes(String fromdate){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + GregorianCalendar gCal = new GregorianCalendar(); + Date datetime = date.parse(fromdate) ; + gCal.setTime(datetime) ; + return gCal.get(gCal.MINUTE); + } catch(Exception e){ + log.debug("DateUtil.addDay():" + e.toString()); + return 0; + } + } + + /** + * 比较两个日期相差的秒数, + * 第一个日期要比第二个日期要晚 + */ + public static int getSeconds(String date1,String date2){ + int margin; + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date dt1 = datetime.parse(date1); + Date dt2 = datetime.parse(date2); + long dateintvlong = dt1.getTime() - dt2.getTime(); + margin = (int)(dateintvlong /1000); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getSeconds():" + e.toString()); + return 0; + } + } + + + /** + * 比较两个日期相差的天数,格式不一样 + * 第一个日期要比第二个日期要晚 + */ + public static double getDoubledays(String date1,String date2){ + double margin; + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ParsePosition pos = new ParsePosition(0); + ParsePosition pos1 = new ParsePosition(0); + Date dt1 = datetime.parse(date1,pos); + Date dt2 = datetime.parse(date2,pos1); + long l = dt1.getTime() - dt2.getTime(); + margin = (l / (24 * 60 * 60 * 1000.00)); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getMargin():" + e.toString()); + return 0; + } + } + + + /** + * 比较两个日期相差的月数 + */ + public static int getMonthMargin(String date1,String date2){ + int margin; + try{ + margin = (Integer.parseInt(date2.substring(0,4)) - Integer.parseInt(date1.substring(0,4)))* 12; + margin += (Integer.parseInt(date2.substring(4,7).replaceAll("-0","-")) - Integer.parseInt(date1.substring(4,7).replaceAll("-0","-"))); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getMargin():" + e.toString()); + return 0; + } + } + + /** + * 返回日期加X天后的日期 + */ + public static String addDay(String fromdate,int i){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + GregorianCalendar gCal = new GregorianCalendar(Integer.parseInt(fromdate.substring(0,4)),Integer.parseInt(fromdate.substring(5,7))-1,Integer.parseInt(fromdate.substring(8,10))); + gCal.add(GregorianCalendar.DATE,i); + return date.format(gCal.getTime()); + } catch(Exception e){ + log.debug("DateUtil.addDay():" + e.toString()); + return getDate(); + } + } + + /** + * 返回日期加X天后的日期 + */ + public static String addDay(int i){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + Calendar cale = Calendar.getInstance() ; + cale.add(Calendar.DAY_OF_MONTH, i) ; + return date.format(cale.getTime()); + } catch(Exception e){ + log.debug("DateUtil.addDay():" + e.toString()); + return getDate(); + } + } + + /** + * 返回日期加X月后的日期 + */ + public static String addMonth(String fromdate,int i){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + GregorianCalendar gCal = new GregorianCalendar(Integer.parseInt(fromdate.substring(0,4)),Integer.parseInt(fromdate.substring(5,7))-1,Integer.parseInt(fromdate.substring(8,10))); + gCal.add(GregorianCalendar.MONTH,i); + return date.format(gCal.getTime()); + } catch(Exception e){ + log.debug("DateUtil.addMonth():" + e.toString()); + return getDate(); + } + } + + /** + * 返回日期加X年后的日期 + */ + public static String addYear(String fromdate,int i){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + GregorianCalendar gCal = new GregorianCalendar(Integer.parseInt(fromdate.substring(0,4)),Integer.parseInt(fromdate.substring(5,7))-1,Integer.parseInt(fromdate.substring(8,10))); + gCal.add(GregorianCalendar.YEAR,i); + return date.format(gCal.getTime()); + } catch(Exception e){ + log.debug("DateUtil.addYear():" + e.toString()); + return ""; + } + } + + + /** + * 返回某年某月中的最大天 + */ + public static int getMaxDay(String year,String month){ + int day = 0; + try{ + int iyear = Integer.parseInt(year); + int imonth = Integer.parseInt(month); + if(imonth == 1 || imonth == 3 || imonth == 5 || imonth == 7 || imonth == 8 || imonth == 10 || imonth == 12){ + day = 31; + } else if(imonth == 4 || imonth == 6 || imonth == 9 || imonth == 11){ + day = 30; + } else if((0 == (iyear % 4)) && (0 != (iyear % 100)) || (0 == (iyear % 400))){ + day = 29; + } else{ + day = 28; + } + return day; + } catch(Exception e){ + log.debug("DateUtil.getMonthDay():" + e.toString()); + return 1; + } + } + + + + /** + * 格式化日期 + */ + @SuppressWarnings("static-access") + public String rollDate(String orgDate,int Type,int Span){ + try{ + String temp = ""; + int iyear,imonth,iday; + int iPos = 0; + char seperater = '-'; + if(orgDate == null || orgDate.length() < 6){ + return ""; + } + + iPos = orgDate.indexOf(seperater); + if(iPos > 0){ + iyear = Integer.parseInt(orgDate.substring(0,iPos)); + temp = orgDate.substring(iPos + 1); + } else{ + iyear = Integer.parseInt(orgDate.substring(0,4)); + temp = orgDate.substring(4); + } + + iPos = temp.indexOf(seperater); + if(iPos > 0){ + imonth = Integer.parseInt(temp.substring(0,iPos)); + temp = temp.substring(iPos + 1); + } else{ + imonth = Integer.parseInt(temp.substring(0,2)); + temp = temp.substring(2); + } + + imonth--; + if(imonth < 0 || imonth > 11){ + imonth = 0; + } + + iday = Integer.parseInt(temp); + if(iday < 1 || iday > 31) + iday = 1; + + Calendar orgcale = Calendar.getInstance(); + orgcale.set(iyear,imonth,iday); + temp = this.rollDate(orgcale,Type,Span); + return temp; + }catch(Exception e){ + return ""; + } + } + + public static String rollDate(Calendar cal,int Type,int Span){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + String temp = ""; + Calendar rolcale; + rolcale = cal; + rolcale.add(Type,Span); + temp = date.format(rolcale.getTime()); + return temp; + }catch(Exception e){ + return ""; + } + } + + /** + * + * 返回默认的日期格式 + * + */ + public static synchronized String getDatePattern() { + defaultDatePattern = "yyyy-MM-dd"; + return defaultDatePattern; + } + + /** + * 将指定日期按默认格式进行格式代化成字符串后输出如:yyyy-MM-dd + */ + public static final String getDate(Date aDate) { + SimpleDateFormat df = null; + String returnValue = ""; + + if (aDate != null) { + df = new SimpleDateFormat(getDatePattern()); + returnValue = df.format(aDate); + } + + return (returnValue); + } + + + + /** + * 取得给定日期的时间字符串,格式为当前默认时间格式 + */ + public static String getTimeNow(Date theTime) { + return getDateTime(timePattern, theTime); + } + + /** + * 取得当前时间的Calendar日历对象 + */ + public Calendar getToday() throws ParseException { + Date today = new Date(); + SimpleDateFormat df = new SimpleDateFormat(getDatePattern()); + String todayAsString = df.format(today); + Calendar cal = new GregorianCalendar(); + cal.setTime(convertStringToDate(todayAsString)); + return cal; + } + + /** + * 将日期类转换成指定格式的字符串形式 + */ + public static final String getDateTime(String aMask, Date aDate) { + SimpleDateFormat df = null; + String returnValue = ""; + + if (aDate == null) { + log.error("aDate is null!"); + } else { + df = new SimpleDateFormat(aMask); + returnValue = df.format(aDate); + } + return (returnValue); + } + + /** + * 将指定的日期转换成默认格式的字符串形式 + */ + public static final String convertDateToString(Date aDate) { + return getDateTime(getDatePattern(), aDate); + } + + + /** + * 将日期字符串按指定格式转换成日期类型 + * @param aMask 指定的日期格式,如:yyyy-MM-dd + * @param strDate 待转换的日期字符串 + */ + + public static final Date convertStringToDate(String aMask, String strDate) + throws ParseException { + SimpleDateFormat df = null; + Date date = null; + df = new SimpleDateFormat(aMask); + + if (log.isDebugEnabled()) { + log.debug("converting '" + strDate + "' to date with mask '" + + aMask + "'"); + } + try { + date = df.parse(strDate); + } catch (ParseException pe) { + log.error("ParseException: " + pe); + throw pe; + } + return (date); + } + + /** + * 将日期字符串按默认格式转换成日期类型 + */ + public static Date convertStringToDate(String strDate) + throws ParseException { + Date aDate = null; + + try { + if (log.isDebugEnabled()) { + log.debug("converting date with pattern: " + getDatePattern()); + } + aDate = convertStringToDate(getDatePattern(), strDate); + } catch (ParseException pe) { + log.error("Could not convert '" + strDate + + "' to a date, throwing exception"); + throw new ParseException(pe.getMessage(), + pe.getErrorOffset()); + + } + + return aDate; + } + + /** + * 返回一个JAVA简单类型的日期字符串 + */ + public static String getSimpleDateFormat(){ + SimpleDateFormat formatter=new SimpleDateFormat(); + String NDateTime=formatter.format(new Date()); + return NDateTime; + } + + /** + * 将两个字符串格式的日期进行比较 + * @param last 要比较的第一个日期字符串 + * @param now 要比较的第二个日期格式字符串 + * @return true(last 在now 日期之前),false(last 在now 日期之后) + */ + public static boolean compareTo(String last, String now) { + try { + SimpleDateFormat formatter = new SimpleDateFormat( + "yyyy-MM-dd HH:mm:ss"); + Date temp1 = formatter.parse(last); + Date temp2 = formatter.parse(now); + if (temp1.after(temp2)) + return false; + else if (temp1.before(temp2)) + return true; + } catch (ParseException e) { + log.debug(e.getMessage()); + } + return false; + } + + + /** + * 将两个字符串格式的日期进行比较 + * @param last 要比较的第一个日期字符串 + * @param now 要比较的第二个日期格式字符串 + * @return true(last 在now 日期之前),false(last 在now 日期之后) + */ + public static boolean compareToForBBS(String last, String now) { + try { + if(last.equals(now)) + return true; + SimpleDateFormat formatter = new SimpleDateFormat( + "yyyy-MM-dd"); + Date temp1 = formatter.parse(last); + Date temp2 = formatter.parse(now); + if (temp1.after(temp2)) + return false; + else if (temp1.before(temp2)) + return true; + } catch (ParseException e) { + log.debug(e.getMessage()); + } + return false; + } + + + + + + /** + * 为查询日期添加最小时间 + * @return + */ + @SuppressWarnings("deprecation") + public static Date addStartTime(Date param) { + Date date = param; + try{ + date.setHours(0); + date.setMinutes(0); + date.setSeconds(0); + return date; + }catch(Exception ex){ + return date; + } + } + + + + /** + * 为查询日期添加最大时间 + * @return + */ + @SuppressWarnings("deprecation") + public static Date addEndTime(Date param) { + Date date = param; + try{ + date.setHours(23); + date.setMinutes(59); + date.setSeconds(0); + return date; + }catch(Exception ex){ + return date; + } + } + + + + /** + * 返回系统现在年份中指定月份的天数 + * @return 指定月的总天数 + */ + @SuppressWarnings("deprecation") + public static String getMonthLastDay(int month) + { + Date date=new Date(); + int[][] day={{0,30,28,31,30,31,30,31,31,30,31,30,31}, + {0,31,29,31,30,31,30,31,31,30,31,30,31}}; + int year=date.getYear()+1900; + if(year%4==0 && year%100!=0 || year%400==0) + { + return day[1][month]+""; + } + else + { + return day[0][month]+""; + } + } + + /** + * 返回指定年份中指定月份的天数 + * @return 指定月的总天数 + */ + public static String getMonthLastDay(int year,int month) + { + int[][] day={{0,30,28,31,30,31,30,31,31,30,31,30,31}, + {0,31,29,31,30,31,30,31,31,30,31,30,31}}; + if(year%4==0 && year%100!=0 || year%400==0) + { + return day[1][month]+""; + } + else + { + return day[0][month]+""; + } + } + + /** + * 取得当前时间的日戳 + * @return + */ + @SuppressWarnings("deprecation") + public static String getTimestamp(){ + Date date=new Date(); + String timestamp=""+(date.getYear()+1900)+date.getMonth()+date.getDate()+date.getMinutes()+date.getSeconds()+date.getTime(); + return timestamp; + } + /** + * 取得指定时间的日戳 + * @return + */ + @SuppressWarnings("deprecation") + public static String getTimestamp(Date date){ + String timestamp=""+(date.getYear()+1900)+date.getMonth()+date.getDate()+date.getMinutes()+date.getSeconds()+date.getTime(); + return timestamp; + } + + + public static Date getDate(String time) { + Date date = new Date(); + try { + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + date = datetime.parse(time); + } catch (ParseException e) { + e.printStackTrace(); + } + return date; + } + + + public static long getTimeMillis(String datetime){ + long timemillis = 0 ; + Calendar cal = Calendar.getInstance(); + Date date = getDate(datetime) ; + cal.setTime(date) ; + timemillis = cal.getTimeInMillis() ; + return timemillis ; + } + + + public static long getsmallSec(String datetime1,String datetime2){ + long time1 = 0 ; + long time2 = 0 ; + long time = 0 ; + if(datetime1!=null){ + time1 = getTimeMillis(datetime1) ; + } + if(datetime2!=null){ + time2 = getTimeMillis(datetime2) ; + } + if(time1==0){ + time = time2 ; + }else if(time2==0){ + time = time1 ; + }else if(time1>time2){ + time = time2 ; + }else{ + time = time1 ; + } + time = time/1000 ; + return time ; + } + + /** + * @Description: TODO + * @param calendarField 修改的字段 + * @param calc add/sub + * @param n + * @return  + *  + * @return String    + * @throws + */ + public static String getDatetimeNfieldgap(int calendarField,String calc,int n){ + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar cal = Calendar.getInstance() ; + int value = cal.get(calendarField) ; + if(calc.equals("add")){ + cal.set(calendarField, value+n) ; + }else if(calc.equals("sub")){ + cal.set(calendarField, value-n); + } + return datetime.format(cal.getTime()); + } catch(Exception e){ + log.debug("DateUtil.getDay():" + e.getMessage()); + return "" ; + } + } + + @SuppressWarnings("static-access") + public static void sleep(int seconds){ + if(seconds<1) + return; + try { + Thread.currentThread().sleep(seconds*1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @SuppressWarnings("static-access") + public static void sleepLong(long millisecond){ + if(millisecond<1) + return; + try { + Thread.currentThread().sleep(millisecond); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + +// public static void main(String[] args) { +// boolean flag = compareToForBBS("0000-06-01 00:00:00.0","11-09"); +// System.out.println(flag); +// } +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/PropertiesUtil.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/PropertiesUtil.java new file mode 100644 index 0000000..2177177 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/PropertiesUtil.java @@ -0,0 +1,33 @@ +package com.bfd.mf.datasave.tools; + +import java.io.*; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +/** + * properties文件读取 + * @author ruining.he + * */ +public class PropertiesUtil { + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Map getProperties(String filePath){ + Properties properties=new Properties(); + try { + Reader reader = new InputStreamReader(new FileInputStream(new File(filePath)), "utf8"); + properties.load(reader); + return new HashMap(properties); + } catch (FileNotFoundException e) { + } catch (IOException e) { + } + return null; + } + +// public static void main(String[] args) { +// Map map = getProperties("E:\\BaiFenDian\\工作文档\\5月\\B版_develop\\test\\info-config"); +// for(String k:map.keySet()){ +// System.out.println(k + ":" + map.get(k)); +// } +// } +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/ReadLine.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/ReadLine.java new file mode 100644 index 0000000..9e776b5 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/ReadLine.java @@ -0,0 +1,37 @@ +package com.bfd.mf.datasave.tools; + +import java.io.*; +import java.util.ArrayList; +import java.util.List; + + +public class ReadLine { + public static List readLine( File fileName){ + List list = new ArrayList (); + String line; + try { + InputStreamReader read = new InputStreamReader(new FileInputStream(fileName), "utf-8"); + BufferedReader reader = new BufferedReader(read); + while ((line = reader.readLine()) != null) { + try { + if (line.length() > 0) { + list.add(line); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return list; + }catch (UnsupportedEncodingException e) { + e.printStackTrace(); + return null; + } catch (FileNotFoundException e) { + e.printStackTrace(); + return null; + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/WriteMethod.java b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/WriteMethod.java new file mode 100644 index 0000000..d3930db --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/datasave/tools/WriteMethod.java @@ -0,0 +1,21 @@ +package com.bfd.mf.datasave.tools; + +import java.io.FileWriter; +import java.io.IOException; + +/** + * Created by BFD-229 on 2017/7/6. + */ +public class WriteMethod { + public static void writeMethod(String fileName, String json){ + try{ + FileWriter writer=new FileWriter(fileName,true); + writer.write(json+"\n"); + writer.close(); + } catch (IOException e) + { + e.printStackTrace(); + } + } + +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/entity/AllKeys.java b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/AllKeys.java new file mode 100644 index 0000000..9a27a3f --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/AllKeys.java @@ -0,0 +1,147 @@ +package com.bfd.mf.entity; + +import java.util.*; + +public class AllKeys { + private static Map map = new HashMap(); + + public static Map getMap() { + return map; + } + + public static void setMap(Map map) { + AllKeys.map = map; + } + + static { + map.put("_id_",""); + map.put("age",""); + map.put("area",""); + map.put("attitudesCount",""); + map.put("attr",""); + map.put("author",""); + map.put("authorId",""); + map.put("authorLevel",""); + map.put("authornickname",""); + map.put("availability",0); + map.put("avatar",""); + map.put("brand",""); + map.put("brandId",""); + map.put("cate",""); + map.put("channel",""); + map.put("city",""); + map.put("collectCount",0); + map.put("commentId",""); + map.put("commentScore",0); + map.put("commentsCount",0); + map.put("commentUrl",""); + map.put("content",""); + map.put("contentLength",0); + map.put("contentSimHash",""); + map.put("contentTag",""); + map.put("country",""); + map.put("crawlDataFlag",""); + map.put("crawlDate",new Date ()); + map.put("crawlDay",0L); + map.put("crawlTime",0L); + map.put("crawlTimeStr",""); + map.put("createDate",new Date ()); + map.put("createDay",0L); + map.put("createTime",0L); + map.put("createTimeStr",""); + map.put("dataCount",0); + map.put("dataId",""); + map.put("docId",""); + map.put("docType",""); + map.put("downCnt",0); + map.put("egc",0); + map.put("enSource",""); + map.put("expression",new ArrayList<>()); + map.put("extension",""); + map.put("fansCount",""); + map.put("favorCnt",0); + map.put("filePath",new ArrayList<>()); + map.put("imagePath",new ArrayList<>()); + map.put("videoPath",new ArrayList<>()); + map.put("finalPhrase",""); + map.put("firstListBrand",""); + map.put("fiveListBrand",""); + map.put("forumScore",""); + map.put("forwardAttitudesCount",0); + map.put("forwardAuthor",""); + map.put("forwardAvatar",""); + map.put("forwardCommentsCount",0); + map.put("forwardContent",""); + map.put("forwardImgs",""); + map.put("forwardPostSource",""); + map.put("forwardPubTime",0L); + map.put("forwardQuoteCount",0); + map.put("forwardUrl",""); + map.put("forwardUserId",""); + map.put("forwardUserType",0); + map.put("forwardUserUrl",""); + map.put("fourListBrand",""); + map.put("friendsCount",""); + map.put("getSource",""); + map.put("hashTag",new ArrayList<>()); + map.put("hlKeywords",new ArrayList<>()); + map.put("impression",""); + map.put("isDownload",false); + map.put("isVip",0); + map.put("language",""); + map.put("lastModifiedTime",0L); + map.put("listBrand",""); + map.put("location",""); + map.put("nomorprice",0); + map.put("opinions",new ArrayList<>()); + map.put("originalPhrase",""); + map.put("otherSourceJson",""); + map.put("pageCommentCount",0); + map.put("pageTranspondCount",0); + map.put("pageType",""); + map.put("pgc",0); + map.put("pictureList",""); + map.put("places",new ArrayList<>()); + map.put("postCount",""); + map.put("postId",""); + map.put("postSource",""); + map.put("price",0); + map.put("primary",1); + map.put("productParameter",""); + map.put("projectName",""); + map.put("promotionInfo",""); + map.put("province",""); + map.put("pubDate",new Date()); + map.put("pubDay",0L); + map.put("pubTime",0L); + map.put("pubTimeStr",""); + map.put("quoteCount",0); + map.put("readCount",0); + map.put("resolution",""); + map.put("secondListBrand",""); + map.put("sex",""); + map.put("sign",""); + map.put("siteId",""); + map.put("skuProperties",""); + map.put("smallImgs",""); + map.put("source",""); + map.put("sysAbstract",""); + map.put("sysKeywords",""); + map.put("sysSentiment",0.0); + map.put("threeListBrand",""); + map.put("thumbnails",""); + map.put("title",""); + map.put("titleLength",0); + map.put("titleSimHash",""); + map.put("translateContent",""); + map.put("translateTitle",""); + map.put("ugc",0); + map.put("url",""); + map.put("urlHash",""); + map.put("userType",""); + map.put("userUrl",""); + map.put("videoTime",""); + map.put("videoUrl",""); + map.put("viewCnt",0); + } +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/entity/DataSaveManager.java b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/DataSaveManager.java new file mode 100644 index 0000000..4f4d065 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/DataSaveManager.java @@ -0,0 +1,21 @@ +package com.bfd.mf.entity; + + +import com.bfd.mf.entity.FieldNormaliz; + +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.util.Map; + +public interface DataSaveManager extends Remote{ + + public void addTaskName(FieldNormaliz fieldNormaliz) throws RemoteException; + + public void stopImprotTask(int kafkaSerName, String kafkaName) throws RemoteException ; + + public void startImprotTask(String kafkaName) throws RemoteException ; + + public long getNowImportEsNum(Map param) throws RemoteException; + + public int getNowKafkaNum() throws RemoteException ; +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/entity/FieldInfo.java b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/FieldInfo.java new file mode 100644 index 0000000..5d3185f --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/FieldInfo.java @@ -0,0 +1,39 @@ +package com.bfd.mf.entity; + +import java.util.List; + +public class FieldInfo { + + private String kafka_type ; + + private List kafkaJsonString ; + + private List kafkaJsonArray ; + + public String getKafka_type() { + return kafka_type; + } + + public void setKafka_type(String kafka_type) { + this.kafka_type = kafka_type; + } + + public List getKafkaJsonString() { + return kafkaJsonString; + } + + public void setKafkaJsonString(List kafkaJsonString) { + this.kafkaJsonString = kafkaJsonString; + } + + public List getKafkaJsonArray() { + return kafkaJsonArray; + } + + public void setKafkaJsonArray(List kafkaJsonArray) { + this.kafkaJsonArray = kafkaJsonArray; + } + + + +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/entity/FieldNormaliz.java b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/FieldNormaliz.java new file mode 100644 index 0000000..1dbe416 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/FieldNormaliz.java @@ -0,0 +1,207 @@ +package com.bfd.mf.entity; + +import java.io.Serializable; +import java.util.Map; +import java.util.Set; + +public class FieldNormaliz implements Serializable{ + + private static final long serialVersionUID = 1L; + + private int id ; + + private String kafkaName ; + + private int kafkaSerName ; + + private int esSerName ; + + private String esSuffixNames ; + + private String docType ; + + private int isSemtimentApi ; + + private boolean ishlKeyword ; + + private int bussinessType ; + + private Map fieldNormalizeContentMap ; + + private Map fieldNormalizeCommentMap ; + + private Map>> fieldDataMap ; + + private Map fieldInfo ; + + private String groupId ; + + private String createTime ; + + private String finshTime ; + + private int status ; + + private String projectName ; + + public String getKafkaName() { + return kafkaName; + } + + public void setKafkaName(String kafkaName) { + this.kafkaName = kafkaName; + } + + public int getKafkaSerName() { + return kafkaSerName; + } + + public void setKafkaSerName(int kafkaSerName) { + this.kafkaSerName = kafkaSerName; + } + + public int getEsSerName() { + return esSerName; + } + + public void setEsSerName(int esSerName) { + this.esSerName = esSerName; + } + + public String getDocType() { + return docType; + } + + public void setDocType(String docType) { + this.docType = docType; + } + + public int getIsSemtimentApi() { + return isSemtimentApi; + } + + public void setIsSemtimentApi(int isSemtimentApi) { + this.isSemtimentApi = isSemtimentApi; + } + + public int getBussinessType() { + return bussinessType; + } + + public void setBussinessType(int bussinessType) { + this.bussinessType = bussinessType; + } + + public Map getFieldNormalizeContentMap() { + return fieldNormalizeContentMap; + } + + public void setFieldNormalizeContentMap(Map fieldNormalizeContentMap) { + this.fieldNormalizeContentMap = fieldNormalizeContentMap; + } + + public Map getFieldNormalizeCommentMap() { + return fieldNormalizeCommentMap; + } + + public void setFieldNormalizeCommentMap(Map fieldNormalizeCommentMap) { + this.fieldNormalizeCommentMap = fieldNormalizeCommentMap; + } + + public Map>> getFieldDataMap() { + return fieldDataMap; + } + + public Map> getFieldDataMapByType(String type){ + return fieldDataMap.get(type); + } + + public void addFieldDataMap(String type, Map fixFieldData, Integer bussinessType){ + Set keys = fixFieldData.keySet() ; + Map> fieldMaps = fieldDataMap.get(bussinessType) ; + Map fieldMap = fieldMaps.get(type) ; + for(String key : keys){ + fieldMap.put(key, key) ; + } + fieldMaps.put(type, fieldMap); + fieldDataMap.put(bussinessType, fieldMaps) ; + } + + public void setFieldDataMap(Map>> fieldDataMap) { + this.fieldDataMap = fieldDataMap; + } + + public Map getFieldInfo() { + return fieldInfo; + } + + public void setFieldInfo(Map fieldInfo) { + this.fieldInfo = fieldInfo; + } + + public boolean isIshlKeyword() { + return ishlKeyword; + } + + public void setIshlKeyword(boolean ishlKeyword) { + this.ishlKeyword = ishlKeyword; + } + + public String getEsSuffixNames() { + return esSuffixNames; + } + + public void setEsSuffixNames(String esSuffixNames) { + this.esSuffixNames = esSuffixNames; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getFinshTime() { + return finshTime; + } + + public void setFinshTime(String finshTime) { + this.finshTime = finshTime; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/entity/ReaultInfo.java b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/ReaultInfo.java new file mode 100644 index 0000000..70078fb --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/ReaultInfo.java @@ -0,0 +1,1397 @@ +package com.bfd.mf.entity; + +import java.util.Date; +import java.util.List; + +public class ReaultInfo { + + + + private String age ; + private String area ; + private String attitudesCount ; + private String attr ; + private String author ; + private String authorId ; + private String authorLevel ; + private String authornickname ; + private Integer availability ; + private String avatar ; + private String brand ; + private String brandId ; + private String cate ; + private String channel ; + private String city ; + private Long collectCount ; + private String commentId ; + private Integer commentScore ; + private Long commentsCount ; + private String commentUrl ; + private String content ; + private Integer contentLength ; + private String contentSimHash ; + private String contentTag ; + private String country ; + private String crawlDataFlag ; + private Date crawlDate ; + private Long crawlDay ; + private Long crawlTime ; + private String crawlTimeStr ; + private Date createDate ; + private Long createDay ; + private Long createTime ; + private String createTimeStr ; + private Integer dataCount ; + private String docId ; + private String docType ; + private Long downCnt ; + private Integer egc ; + private String enSource ; + private List expression ; + private String extension ; + private String fansCount ; + private Long favorCnt ; + private String filePath ; + private String finalPhrase ; + private String firstListBrand ; + private String fiveListBrand ; + private String forumScore ; + private Long forwardAttitudesCount ; + private String forwardAuthor ; + private String forwardAvatar ; + private Long forwardCommentsCount ; + private String forwardContent ; + private List forwardImgs ; + private String forwardPostSource ; + private Long forwardPubTime ; + private Long forwardQuoteCount ; + private String forwardUrl ; + private String forwardUserId ; + private Integer forwardUserType ; + private String forwardUserUrl ; + private String fourListBrand ; + private String friendsCount; + private String getSource ; + private List hashTag ; + private List hlKeywords ; + private String impression ; + private String isDownload ; + private Integer isVip ; + private String language ; + private Long lastModifiedTime ; + private String listBrand ; + private String location ; + private Double nomorprice ; + private List opinions ; + private String originalPhrase ; + private String otherSourceJson ; + private Long pageCommentCount ; + private Long pageTranspondCount ; + private String pageType ; + private Integer pgc ; + private List pictureList ; + private List places ; + private String postCount ; + private String postId ; + private String postSource ; + private Double price ; + private Integer primary ; + private String productParameter ; + private String projectName ; + private String promotionInfo ; + private String province ; + private Date pubDate ; + private Long pubDay ; + private Long pubTime ; + private String pubTimeStr ; + private Long quoteCount ; + private Long readCount ; + private String resolution ; + private String secondListBrand ; + private String sex ; + private String sign ; + private String siteId ; + private String skuProperties ; + private List smallImgs ; + private String source ; + private String sysAbstract ; + private String sysKeywords ; + private Double sysSentiment ; + private String threeListBrand ; + private String thumbnails ; + private String title ; + private Integer titleLength ; + private String titleSimHash ; + private String translateContent ; + private String translateTitle ; + private Integer ugc ; + private String url ; + private String urlHash ; + private Integer userType ; + private String userUrl ; + private String videoTime ; + private String videoUrl ; + private Long viewCnt ; + + public ReaultInfo() { + } + + public ReaultInfo(String age, String area, String attitudesCount, String attr, String author, String authorId, String authorLevel, String authornickname, Integer availability, String avatar, String brand, String brandId, String cate, String channel, String city, Long collectCount, String commentId, Integer commentScore, Long commentsCount, String commentUrl, String content, Integer contentLength, String contentSimHash, String contentTag, String country, String crawlDataFlag, Date crawlDate, Long crawlDay, Long crawlTime, String crawlTimeStr, Date createDate, Long createDay, Long createTime, String createTimeStr, Integer dataCount, String docId, String docType, Long downCnt, Integer egc, String enSource, List expression, String extension, String fansCount, Long favorCnt, String filePath, String finalPhrase, String firstListBrand, String fiveListBrand, String forumScore, Long forwardAttitudesCount, String forwardAuthor, String forwardAvatar, Long forwardCommentsCount, String forwardContent, List forwardImgs, String forwardPostSource, Long forwardPubTime, Long forwardQuoteCount, String forwardUrl, String forwardUserId, Integer forwardUserType, String forwardUserUrl, String fourListBrand, String friendsCount, String getSource, List hashTag, List hlKeywords, String impression, String isDownload, Integer isVip, String language, Long lastModifiedTime, String listBrand, String location, Double nomorprice, List opinions, String originalPhrase, String otherSourceJson, Long pageCommentCount, Long pageTranspondCount, String pageType, Integer pgc, List pictureList, List places, String postCount, String postId, String postSource, Double price, Integer primary, String productParameter, String projectName, String promotionInfo, String province, Date pubDate, Long pubDay, Long pubTime, String pubTimeStr, Long quoteCount, Long readCount, String resolution, String secondListBrand, String sex, String sign, String siteId, String skuProperties, List smallImgs, String source, String sysAbstract, String sysKeywords, Double sysSentiment, String threeListBrand, String thumbnails, String title, Integer titleLength, String titleSimHash, String translateContent, String translateTitle, Integer ugc, String url, String urlHash, Integer userType, String userUrl, String videoTime, String videoUrl, Long viewCnt) { + this.age = age; + this.area = area; + this.attitudesCount = attitudesCount; + this.attr = attr; + this.author = author; + this.authorId = authorId; + this.authorLevel = authorLevel; + this.authornickname = authornickname; + this.availability = availability; + this.avatar = avatar; + this.brand = brand; + this.brandId = brandId; + this.cate = cate; + this.channel = channel; + this.city = city; + this.collectCount = collectCount; + this.commentId = commentId; + this.commentScore = commentScore; + this.commentsCount = commentsCount; + this.commentUrl = commentUrl; + this.content = content; + this.contentLength = contentLength; + this.contentSimHash = contentSimHash; + this.contentTag = contentTag; + this.country = country; + this.crawlDataFlag = crawlDataFlag; + this.crawlDate = crawlDate; + this.crawlDay = crawlDay; + this.crawlTime = crawlTime; + this.crawlTimeStr = crawlTimeStr; + this.createDate = createDate; + this.createDay = createDay; + this.createTime = createTime; + this.createTimeStr = createTimeStr; + this.dataCount = dataCount; + this.docId = docId; + this.docType = docType; + this.downCnt = downCnt; + this.egc = egc; + this.enSource = enSource; + this.expression = expression; + this.extension = extension; + this.fansCount = fansCount; + this.favorCnt = favorCnt; + this.filePath = filePath; + this.finalPhrase = finalPhrase; + this.firstListBrand = firstListBrand; + this.fiveListBrand = fiveListBrand; + this.forumScore = forumScore; + this.forwardAttitudesCount = forwardAttitudesCount; + this.forwardAuthor = forwardAuthor; + this.forwardAvatar = forwardAvatar; + this.forwardCommentsCount = forwardCommentsCount; + this.forwardContent = forwardContent; + this.forwardImgs = forwardImgs; + this.forwardPostSource = forwardPostSource; + this.forwardPubTime = forwardPubTime; + this.forwardQuoteCount = forwardQuoteCount; + this.forwardUrl = forwardUrl; + this.forwardUserId = forwardUserId; + this.forwardUserType = forwardUserType; + this.forwardUserUrl = forwardUserUrl; + this.fourListBrand = fourListBrand; + this.friendsCount = friendsCount; + this.getSource = getSource; + this.hashTag = hashTag; + this.hlKeywords = hlKeywords; + this.impression = impression; + this.isDownload = isDownload; + this.isVip = isVip; + this.language = language; + this.lastModifiedTime = lastModifiedTime; + this.listBrand = listBrand; + this.location = location; + this.nomorprice = nomorprice; + this.opinions = opinions; + this.originalPhrase = originalPhrase; + this.otherSourceJson = otherSourceJson; + this.pageCommentCount = pageCommentCount; + this.pageTranspondCount = pageTranspondCount; + this.pageType = pageType; + this.pgc = pgc; + this.pictureList = pictureList; + this.places = places; + this.postCount = postCount; + this.postId = postId; + this.postSource = postSource; + this.price = price; + this.primary = primary; + this.productParameter = productParameter; + this.projectName = projectName; + this.promotionInfo = promotionInfo; + this.province = province; + this.pubDate = pubDate; + this.pubDay = pubDay; + this.pubTime = pubTime; + this.pubTimeStr = pubTimeStr; + this.quoteCount = quoteCount; + this.readCount = readCount; + this.resolution = resolution; + this.secondListBrand = secondListBrand; + this.sex = sex; + this.sign = sign; + this.siteId = siteId; + this.skuProperties = skuProperties; + this.smallImgs = smallImgs; + this.source = source; + this.sysAbstract = sysAbstract; + this.sysKeywords = sysKeywords; + this.sysSentiment = sysSentiment; + this.threeListBrand = threeListBrand; + this.thumbnails = thumbnails; + this.title = title; + this.titleLength = titleLength; + this.titleSimHash = titleSimHash; + this.translateContent = translateContent; + this.translateTitle = translateTitle; + this.ugc = ugc; + this.url = url; + this.urlHash = urlHash; + this.userType = userType; + this.userUrl = userUrl; + this.videoTime = videoTime; + this.videoUrl = videoUrl; + this.viewCnt = viewCnt; + } + + @Override + public String toString() { + return "ReaultInfo{" + + "age='" + age + '\'' + + ", area='" + area + '\'' + + ", attitudesCount='" + attitudesCount + '\'' + + ", attr='" + attr + '\'' + + ", author='" + author + '\'' + + ", authorId='" + authorId + '\'' + + ", authorLevel='" + authorLevel + '\'' + + ", authornickname='" + authornickname + '\'' + + ", availability=" + availability + + ", avatar='" + avatar + '\'' + + ", brand='" + brand + '\'' + + ", brandId='" + brandId + '\'' + + ", cate='" + cate + '\'' + + ", channel='" + channel + '\'' + + ", city='" + city + '\'' + + ", collectCount=" + collectCount + + ", commentId='" + commentId + '\'' + + ", commentScore=" + commentScore + + ", commentsCount=" + commentsCount + + ", commentUrl='" + commentUrl + '\'' + + ", content='" + content + '\'' + + ", contentLength=" + contentLength + + ", contentSimHash='" + contentSimHash + '\'' + + ", contentTag='" + contentTag + '\'' + + ", country='" + country + '\'' + + ", crawlDataFlag='" + crawlDataFlag + '\'' + + ", crawlDate=" + crawlDate + + ", crawlDay=" + crawlDay + + ", crawlTime=" + crawlTime + + ", crawlTimeStr='" + crawlTimeStr + '\'' + + ", createDate=" + createDate + + ", createDay=" + createDay + + ", createTime=" + createTime + + ", createTimeStr='" + createTimeStr + '\'' + + ", dataCount=" + dataCount + + ", docId='" + docId + '\'' + + ", docType='" + docType + '\'' + + ", downCnt=" + downCnt + + ", egc=" + egc + + ", enSource='" + enSource + '\'' + + ", expression=" + expression + + ", extension='" + extension + '\'' + + ", fansCount='" + fansCount + '\'' + + ", favorCnt=" + favorCnt + + ", filePath='" + filePath + '\'' + + ", finalPhrase='" + finalPhrase + '\'' + + ", firstListBrand='" + firstListBrand + '\'' + + ", fiveListBrand='" + fiveListBrand + '\'' + + ", forumScore='" + forumScore + '\'' + + ", forwardAttitudesCount=" + forwardAttitudesCount + + ", forwardAuthor='" + forwardAuthor + '\'' + + ", forwardAvatar='" + forwardAvatar + '\'' + + ", forwardCommentsCount=" + forwardCommentsCount + + ", forwardContent='" + forwardContent + '\'' + + ", forwardImgs=" + forwardImgs + + ", forwardPostSource='" + forwardPostSource + '\'' + + ", forwardPubTime=" + forwardPubTime + + ", forwardQuoteCount=" + forwardQuoteCount + + ", forwardUrl='" + forwardUrl + '\'' + + ", forwardUserId='" + forwardUserId + '\'' + + ", forwardUserType=" + forwardUserType + + ", forwardUserUrl='" + forwardUserUrl + '\'' + + ", fourListBrand='" + fourListBrand + '\'' + + ", friendsCount='" + friendsCount + '\'' + + ", getSource='" + getSource + '\'' + + ", hashTag=" + hashTag + + ", hlKeywords=" + hlKeywords + + ", impression='" + impression + '\'' + + ", isDownload='" + isDownload + '\'' + + ", isVip=" + isVip + + ", language='" + language + '\'' + + ", lastModifiedTime=" + lastModifiedTime + + ", listBrand='" + listBrand + '\'' + + ", location='" + location + '\'' + + ", nomorprice=" + nomorprice + + ", opinions=" + opinions + + ", originalPhrase='" + originalPhrase + '\'' + + ", otherSourceJson='" + otherSourceJson + '\'' + + ", pageCommentCount=" + pageCommentCount + + ", pageTranspondCount=" + pageTranspondCount + + ", pageType='" + pageType + '\'' + + ", pgc=" + pgc + + ", pictureList=" + pictureList + + ", places=" + places + + ", postCount='" + postCount + '\'' + + ", postId='" + postId + '\'' + + ", postSource='" + postSource + '\'' + + ", price=" + price + + ", primary=" + primary + + ", productParameter='" + productParameter + '\'' + + ", projectName='" + projectName + '\'' + + ", promotionInfo='" + promotionInfo + '\'' + + ", province='" + province + '\'' + + ", pubDate=" + pubDate + + ", pubDay=" + pubDay + + ", pubTime=" + pubTime + + ", pubTimeStr='" + pubTimeStr + '\'' + + ", quoteCount=" + quoteCount + + ", readCount=" + readCount + + ", resolution='" + resolution + '\'' + + ", secondListBrand='" + secondListBrand + '\'' + + ", sex='" + sex + '\'' + + ", sign='" + sign + '\'' + + ", siteId='" + siteId + '\'' + + ", skuProperties='" + skuProperties + '\'' + + ", smallImgs=" + smallImgs + + ", source='" + source + '\'' + + ", sysAbstract='" + sysAbstract + '\'' + + ", sysKeywords='" + sysKeywords + '\'' + + ", sysSentiment=" + sysSentiment + + ", threeListBrand='" + threeListBrand + '\'' + + ", thumbnails='" + thumbnails + '\'' + + ", title='" + title + '\'' + + ", titleLength=" + titleLength + + ", titleSimHash='" + titleSimHash + '\'' + + ", translateContent='" + translateContent + '\'' + + ", translateTitle='" + translateTitle + '\'' + + ", ugc=" + ugc + + ", url='" + url + '\'' + + ", urlHash='" + urlHash + '\'' + + ", userType=" + userType + + ", userUrl='" + userUrl + '\'' + + ", videoTime='" + videoTime + '\'' + + ", videoUrl='" + videoUrl + '\'' + + ", viewCnt=" + viewCnt + + '}'; + } + + public String getAge() { + return age; + } + + public void setAge(String age) { + this.age = age; + } + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getAttitudesCount() { + return attitudesCount; + } + + public void setAttitudesCount(String attitudesCount) { + this.attitudesCount = attitudesCount; + } + + public String getAttr() { + return attr; + } + + public void setAttr(String attr) { + this.attr = attr; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getAuthorId() { + return authorId; + } + + public void setAuthorId(String authorId) { + this.authorId = authorId; + } + + public String getAuthorLevel() { + return authorLevel; + } + + public void setAuthorLevel(String authorLevel) { + this.authorLevel = authorLevel; + } + + public String getAuthornickname() { + return authornickname; + } + + public void setAuthornickname(String authornickname) { + this.authornickname = authornickname; + } + + public Integer getAvailability() { + return availability; + } + + public void setAvailability(Integer availability) { + this.availability = availability; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public String getBrandId() { + return brandId; + } + + public void setBrandId(String brandId) { + this.brandId = brandId; + } + + public String getCate() { + return cate; + } + + public void setCate(String cate) { + this.cate = cate; + } + + public String getChannel() { + return channel; + } + + public void setChannel(String channel) { + this.channel = channel; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public Long getCollectCount() { + return collectCount; + } + + public void setCollectCount(Long collectCount) { + this.collectCount = collectCount; + } + + public String getCommentId() { + return commentId; + } + + public void setCommentId(String commentId) { + this.commentId = commentId; + } + + public Integer getCommentScore() { + return commentScore; + } + + public void setCommentScore(Integer commentScore) { + this.commentScore = commentScore; + } + + public Long getCommentsCount() { + return commentsCount; + } + + public void setCommentsCount(Long commentsCount) { + this.commentsCount = commentsCount; + } + + public String getCommentUrl() { + return commentUrl; + } + + public void setCommentUrl(String commentUrl) { + this.commentUrl = commentUrl; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Integer getContentLength() { + return contentLength; + } + + public void setContentLength(Integer contentLength) { + this.contentLength = contentLength; + } + + public String getContentSimHash() { + return contentSimHash; + } + + public void setContentSimHash(String contentSimHash) { + this.contentSimHash = contentSimHash; + } + + public String getContentTag() { + return contentTag; + } + + public void setContentTag(String contentTag) { + this.contentTag = contentTag; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public String getCrawlDataFlag() { + return crawlDataFlag; + } + + public void setCrawlDataFlag(String crawlDataFlag) { + this.crawlDataFlag = crawlDataFlag; + } + + public Date getCrawlDate() { + return crawlDate; + } + + public void setCrawlDate(Date crawlDate) { + this.crawlDate = crawlDate; + } + + public Long getCrawlDay() { + return crawlDay; + } + + public void setCrawlDay(Long crawlDay) { + this.crawlDay = crawlDay; + } + + public Long getCrawlTime() { + return crawlTime; + } + + public void setCrawlTime(Long crawlTime) { + this.crawlTime = crawlTime; + } + + public String getCrawlTimeStr() { + return crawlTimeStr; + } + + public void setCrawlTimeStr(String crawlTimeStr) { + this.crawlTimeStr = crawlTimeStr; + } + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public Long getCreateDay() { + return createDay; + } + + public void setCreateDay(Long createDay) { + this.createDay = createDay; + } + + public Long getCreateTime() { + return createTime; + } + + public void setCreateTime(Long createTime) { + this.createTime = createTime; + } + + public String getCreateTimeStr() { + return createTimeStr; + } + + public void setCreateTimeStr(String createTimeStr) { + this.createTimeStr = createTimeStr; + } + + public Integer getDataCount() { + return dataCount; + } + + public void setDataCount(Integer dataCount) { + this.dataCount = dataCount; + } + + public String getDocId() { + return docId; + } + + public void setDocId(String docId) { + this.docId = docId; + } + + public String getDocType() { + return docType; + } + + public void setDocType(String docType) { + this.docType = docType; + } + + public Long getDownCnt() { + return downCnt; + } + + public void setDownCnt(Long downCnt) { + this.downCnt = downCnt; + } + + public Integer getEgc() { + return egc; + } + + public void setEgc(Integer egc) { + this.egc = egc; + } + + public String getEnSource() { + return enSource; + } + + public void setEnSource(String enSource) { + this.enSource = enSource; + } + + public List getExpression() { + return expression; + } + + public void setExpression(List expression) { + this.expression = expression; + } + + public String getExtension() { + return extension; + } + + public void setExtension(String extension) { + this.extension = extension; + } + + public String getFansCount() { + return fansCount; + } + + public void setFansCount(String fansCount) { + this.fansCount = fansCount; + } + + public Long getFavorCnt() { + return favorCnt; + } + + public void setFavorCnt(Long favorCnt) { + this.favorCnt = favorCnt; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getFinalPhrase() { + return finalPhrase; + } + + public void setFinalPhrase(String finalPhrase) { + this.finalPhrase = finalPhrase; + } + + public String getFirstListBrand() { + return firstListBrand; + } + + public void setFirstListBrand(String firstListBrand) { + this.firstListBrand = firstListBrand; + } + + public String getFiveListBrand() { + return fiveListBrand; + } + + public void setFiveListBrand(String fiveListBrand) { + this.fiveListBrand = fiveListBrand; + } + + public String getForumScore() { + return forumScore; + } + + public void setForumScore(String forumScore) { + this.forumScore = forumScore; + } + + public Long getForwardAttitudesCount() { + return forwardAttitudesCount; + } + + public void setForwardAttitudesCount(Long forwardAttitudesCount) { + this.forwardAttitudesCount = forwardAttitudesCount; + } + + public String getForwardAuthor() { + return forwardAuthor; + } + + public void setForwardAuthor(String forwardAuthor) { + this.forwardAuthor = forwardAuthor; + } + + public String getForwardAvatar() { + return forwardAvatar; + } + + public void setForwardAvatar(String forwardAvatar) { + this.forwardAvatar = forwardAvatar; + } + + public Long getForwardCommentsCount() { + return forwardCommentsCount; + } + + public void setForwardCommentsCount(Long forwardCommentsCount) { + this.forwardCommentsCount = forwardCommentsCount; + } + + public String getForwardContent() { + return forwardContent; + } + + public void setForwardContent(String forwardContent) { + this.forwardContent = forwardContent; + } + + public List getForwardImgs() { + return forwardImgs; + } + + public void setForwardImgs(List forwardImgs) { + this.forwardImgs = forwardImgs; + } + + public String getForwardPostSource() { + return forwardPostSource; + } + + public void setForwardPostSource(String forwardPostSource) { + this.forwardPostSource = forwardPostSource; + } + + public Long getForwardPubTime() { + return forwardPubTime; + } + + public void setForwardPubTime(Long forwardPubTime) { + this.forwardPubTime = forwardPubTime; + } + + public Long getForwardQuoteCount() { + return forwardQuoteCount; + } + + public void setForwardQuoteCount(Long forwardQuoteCount) { + this.forwardQuoteCount = forwardQuoteCount; + } + + public String getForwardUrl() { + return forwardUrl; + } + + public void setForwardUrl(String forwardUrl) { + this.forwardUrl = forwardUrl; + } + + public String getForwardUserId() { + return forwardUserId; + } + + public void setForwardUserId(String forwardUserId) { + this.forwardUserId = forwardUserId; + } + + public Integer getForwardUserType() { + return forwardUserType; + } + + public void setForwardUserType(Integer forwardUserType) { + this.forwardUserType = forwardUserType; + } + + public String getForwardUserUrl() { + return forwardUserUrl; + } + + public void setForwardUserUrl(String forwardUserUrl) { + this.forwardUserUrl = forwardUserUrl; + } + + public String getFourListBrand() { + return fourListBrand; + } + + public void setFourListBrand(String fourListBrand) { + this.fourListBrand = fourListBrand; + } + + public String getFriendsCount() { + return friendsCount; + } + + public void setFriendsCount(String friendsCount) { + this.friendsCount = friendsCount; + } + + public String getGetSource() { + return getSource; + } + + public void setGetSource(String getSource) { + this.getSource = getSource; + } + + public List getHashTag() { + return hashTag; + } + + public void setHashTag(List hashTag) { + this.hashTag = hashTag; + } + + public List getHlKeywords() { + return hlKeywords; + } + + public void setHlKeywords(List hlKeywords) { + this.hlKeywords = hlKeywords; + } + + public String getImpression() { + return impression; + } + + public void setImpression(String impression) { + this.impression = impression; + } + + public String getIsDownload() { + return isDownload; + } + + public void setIsDownload(String isDownload) { + this.isDownload = isDownload; + } + + public Integer getIsVip() { + return isVip; + } + + public void setIsVip(Integer isVip) { + this.isVip = isVip; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public Long getLastModifiedTime() { + return lastModifiedTime; + } + + public void setLastModifiedTime(Long lastModifiedTime) { + this.lastModifiedTime = lastModifiedTime; + } + + public String getListBrand() { + return listBrand; + } + + public void setListBrand(String listBrand) { + this.listBrand = listBrand; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public Double getNomorprice() { + return nomorprice; + } + + public void setNomorprice(Double nomorprice) { + this.nomorprice = nomorprice; + } + + public List getOpinions() { + return opinions; + } + + public void setOpinions(List opinions) { + this.opinions = opinions; + } + + public String getOriginalPhrase() { + return originalPhrase; + } + + public void setOriginalPhrase(String originalPhrase) { + this.originalPhrase = originalPhrase; + } + + public String getOtherSourceJson() { + return otherSourceJson; + } + + public void setOtherSourceJson(String otherSourceJson) { + this.otherSourceJson = otherSourceJson; + } + + public Long getPageCommentCount() { + return pageCommentCount; + } + + public void setPageCommentCount(Long pageCommentCount) { + this.pageCommentCount = pageCommentCount; + } + + public Long getPageTranspondCount() { + return pageTranspondCount; + } + + public void setPageTranspondCount(Long pageTranspondCount) { + this.pageTranspondCount = pageTranspondCount; + } + + public String getPageType() { + return pageType; + } + + public void setPageType(String pageType) { + this.pageType = pageType; + } + + public Integer getPgc() { + return pgc; + } + + public void setPgc(Integer pgc) { + this.pgc = pgc; + } + + public List getPictureList() { + return pictureList; + } + + public void setPictureList(List pictureList) { + this.pictureList = pictureList; + } + + public List getPlaces() { + return places; + } + + public void setPlaces(List places) { + this.places = places; + } + + public String getPostCount() { + return postCount; + } + + public void setPostCount(String postCount) { + this.postCount = postCount; + } + + public String getPostId() { + return postId; + } + + public void setPostId(String postId) { + this.postId = postId; + } + + public String getPostSource() { + return postSource; + } + + public void setPostSource(String postSource) { + this.postSource = postSource; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + + public Integer getPrimary() { + return primary; + } + + public void setPrimary(Integer primary) { + this.primary = primary; + } + + public String getProductParameter() { + return productParameter; + } + + public void setProductParameter(String productParameter) { + this.productParameter = productParameter; + } + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public String getPromotionInfo() { + return promotionInfo; + } + + public void setPromotionInfo(String promotionInfo) { + this.promotionInfo = promotionInfo; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public Date getPubDate() { + return pubDate; + } + + public void setPubDate(Date pubDate) { + this.pubDate = pubDate; + } + + public Long getPubDay() { + return pubDay; + } + + public void setPubDay(Long pubDay) { + this.pubDay = pubDay; + } + + public Long getPubTime() { + return pubTime; + } + + public void setPubTime(Long pubTime) { + this.pubTime = pubTime; + } + + public String getPubTimeStr() { + return pubTimeStr; + } + + public void setPubTimeStr(String pubTimeStr) { + this.pubTimeStr = pubTimeStr; + } + + public Long getQuoteCount() { + return quoteCount; + } + + public void setQuoteCount(Long quoteCount) { + this.quoteCount = quoteCount; + } + + public Long getReadCount() { + return readCount; + } + + public void setReadCount(Long readCount) { + this.readCount = readCount; + } + + public String getResolution() { + return resolution; + } + + public void setResolution(String resolution) { + this.resolution = resolution; + } + + public String getSecondListBrand() { + return secondListBrand; + } + + public void setSecondListBrand(String secondListBrand) { + this.secondListBrand = secondListBrand; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getSign() { + return sign; + } + + public void setSign(String sign) { + this.sign = sign; + } + + public String getSiteId() { + return siteId; + } + + public void setSiteId(String siteId) { + this.siteId = siteId; + } + + public String getSkuProperties() { + return skuProperties; + } + + public void setSkuProperties(String skuProperties) { + this.skuProperties = skuProperties; + } + + public List getSmallImgs() { + return smallImgs; + } + + public void setSmallImgs(List smallImgs) { + this.smallImgs = smallImgs; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getSysAbstract() { + return sysAbstract; + } + + public void setSysAbstract(String sysAbstract) { + this.sysAbstract = sysAbstract; + } + + public String getSysKeywords() { + return sysKeywords; + } + + public void setSysKeywords(String sysKeywords) { + this.sysKeywords = sysKeywords; + } + + public Double getSysSentiment() { + return sysSentiment; + } + + public void setSysSentiment(Double sysSentiment) { + this.sysSentiment = sysSentiment; + } + + public String getThreeListBrand() { + return threeListBrand; + } + + public void setThreeListBrand(String threeListBrand) { + this.threeListBrand = threeListBrand; + } + + public String getThumbnails() { + return thumbnails; + } + + public void setThumbnails(String thumbnails) { + this.thumbnails = thumbnails; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Integer getTitleLength() { + return titleLength; + } + + public void setTitleLength(Integer titleLength) { + this.titleLength = titleLength; + } + + public String getTitleSimHash() { + return titleSimHash; + } + + public void setTitleSimHash(String titleSimHash) { + this.titleSimHash = titleSimHash; + } + + public String getTranslateContent() { + return translateContent; + } + + public void setTranslateContent(String translateContent) { + this.translateContent = translateContent; + } + + public String getTranslateTitle() { + return translateTitle; + } + + public void setTranslateTitle(String translateTitle) { + this.translateTitle = translateTitle; + } + + public Integer getUgc() { + return ugc; + } + + public void setUgc(Integer ugc) { + this.ugc = ugc; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUrlHash() { + return urlHash; + } + + public void setUrlHash(String urlHash) { + this.urlHash = urlHash; + } + + public Integer getUserType() { + return userType; + } + + public void setUserType(Integer userType) { + this.userType = userType; + } + + public String getUserUrl() { + return userUrl; + } + + public void setUserUrl(String userUrl) { + this.userUrl = userUrl; + } + + public String getVideoTime() { + return videoTime; + } + + public void setVideoTime(String videoTime) { + this.videoTime = videoTime; + } + + public String getVideoUrl() { + return videoUrl; + } + + public void setVideoUrl(String videoUrl) { + this.videoUrl = videoUrl; + } + + public Long getViewCnt() { + return viewCnt; + } + + public void setViewCnt(Long viewCnt) { + this.viewCnt = viewCnt; + } +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/entity/impl/DataSaveManagerImpl.java b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/impl/DataSaveManagerImpl.java new file mode 100644 index 0000000..d468df9 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/impl/DataSaveManagerImpl.java @@ -0,0 +1,74 @@ +package com.bfd.mf.entity.impl; + +import com.bfd.crawler.elasti.ElatiIndexManager; +import com.bfd.crawler.kafka7.KfkConsumer; +import com.bfd.mf.datasave.listen.ListenKafkaManager; +import com.bfd.mf.datasave.listen.ListenTaskManager; +import com.bfd.mf.entity.DataSaveManager; +import com.bfd.mf.entity.FieldNormaliz; +import org.apache.commons.lang3.StringUtils; + +import java.rmi.RemoteException; +import java.rmi.server.UnicastRemoteObject; +import java.util.Map; + +public class DataSaveManagerImpl extends UnicastRemoteObject implements DataSaveManager { + + private static final long serialVersionUID = 1L; + + public DataSaveManagerImpl() throws RemoteException { + super(); + } + + @Override + public void addTaskName(FieldNormaliz fieldNormaliz) throws RemoteException { + ListenTaskManager.addKafkaTopicListen(fieldNormaliz); + } + + @Override + public void stopImprotTask(int kafkaSerName, String kafkaName) throws RemoteException{ + if(ListenTaskManager.listenKafkaManagers.size() > 0){ + KfkConsumer.stopKfkConsumerThreads(kafkaSerName, kafkaName); + ListenKafkaManager listenKafkaManager = ListenTaskManager.listenKafkaManagers.get(kafkaSerName+"#"+kafkaName) ; + listenKafkaManager.setSwitch(false); + ListenTaskManager.listenKafkaManagers.remove(kafkaSerName+"#"+kafkaName); + } + } + + @Override + public void startImprotTask(String kafkaName) throws RemoteException{ + if(ListenTaskManager.listenKafkaManagers.size() > 0){ + System.out.println("kafkaName : "+kafkaName); + ListenKafkaManager listenKafkaManager = ListenTaskManager.listenKafkaManagers.get(kafkaName) ; + listenKafkaManager.setSwitch(true); + } + } + + /** + * 获取当前插入到 ES 中的数据 (仅限查询后台的ES ,因为前台的ES 是按日期的,因此暂时不统计) + */ + @Override + public long getNowImportEsNum(Map param) throws RemoteException{ + long esNum = 0 ; + try{ + int esServerName = Integer.valueOf(param.get("esServerName").toString()) ; + if(param.containsKey("indexName")){ + String indexName = param.get("indexName").toString() ; + if(StringUtils.isNotBlank(indexName)){ + ElatiIndexManager elatiIndexManager = ElatiIndexManager.getInstance(esServerName) ; + esNum += elatiIndexManager.getindexNum(indexName+"_content") ; + ElatiIndexManager elatiIndexManagerCommment = ElatiIndexManager.getInstance(esServerName) ; + esNum += elatiIndexManagerCommment.getindexNum(indexName+"_comment") ; + } + } + }catch(Exception e){ + e.printStackTrace(); + } + return esNum; + } + + @Override + public int getNowKafkaNum() throws RemoteException{ + return 0 ; + } +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/entity/mysql/FiledTableInfo.java b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/mysql/FiledTableInfo.java new file mode 100644 index 0000000..52e6067 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/mysql/FiledTableInfo.java @@ -0,0 +1,26 @@ +package com.bfd.mf.entity.mysql; + + +import com.bfd.mf.datasave.tools.DBUtil; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FiledTableInfo { + + public static Map> tableInfoMap = new HashMap>(); + + public static void loadTableInfo(){ + List> tableInfoList1 = DBUtil.getInstance("db_stat").query("select * from mf_field_table_info where bussiness_type = 1"); + if(tableInfoList1.size() > 0){ + Map tablefieldValue = new HashMap(); + for(Map tableInfo : tableInfoList1){ + tablefieldValue.put(tableInfo.get("col_name").toString(), tableInfo.get("col_type").toString()); + } + tableInfoMap.put(1, tablefieldValue); + } + + } + +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/entity/mysql/SubjectTask.java b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/mysql/SubjectTask.java new file mode 100644 index 0000000..afc29e0 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/entity/mysql/SubjectTask.java @@ -0,0 +1,70 @@ +package com.bfd.mf.entity.mysql; + + +//import com.bfd.crawler.utils.JsonUtils; +import com.bfd.mf.datasave.tools.DBUtil; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SubjectTask { + + public static Map>> subjectTaskMap = new HashMap<>(); + + public static void loadSubjectTask(){ + subjectTaskMap.clear(); + List> subjectTaskList = DBUtil.getInstance("db_stat").query("SELECT cst.id,ct.external_id,cst.subject_id, cst.task_id, ct.cid, ct.crawl_data_flag,cs.export_to_kafka,cs.kafka_addr,cs.go_fast_addr FROM cl_subject_task cst JOIN cl_subject cs ON (cst.subject_id = cs.id) LEFT JOIN cl_task ct ON (cst.task_id = ct.id );"); + //System.out.println("***&&&&&**"+subjectTaskList+"subjectTaskList"); + if(subjectTaskList.size() > 0){ + String key = ""; + for(Map subjectTask : subjectTaskList){ //{subject_id=10222, name=我是张三, task_id=188, id=71, crawl_data_flag=aaa} + key = subjectTask.get("cid") + "#####" + subjectTask.get("crawl_data_flag"); + //System.out.print(key+"asdasd"); + Map value = new HashMap<>(); + List> valueList = new ArrayList<>(); + String v_subject_id = ""; + String v_go_fast_addr = ""; + String v_export_to_kafka = ""; + String v_kafka_addr = ""; + String v_task_id = ""; + String v_external_id =""; + if(null != subjectTask.get("subject_id")) { + v_subject_id = subjectTask.get("subject_id").toString(); + } + if(null != subjectTask.get("go_fast_addr")) { + v_go_fast_addr = subjectTask.get("go_fast_addr").toString(); + } + if(null != subjectTask.get("kafka_addr")) { + v_kafka_addr = subjectTask.get("kafka_addr").toString(); + } + if(null != subjectTask.get("export_to_kafka")){ + v_export_to_kafka = subjectTask.get("export_to_kafka").toString(); + } + if(null !=subjectTask.get("task_id")){ + v_task_id = subjectTask.get("task_id").toString(); + } + if(null !=subjectTask.get("external_id")){ + v_external_id = subjectTask.get("external_id").toString(); + } + value.put("subject_id",v_subject_id); + value.put("go_fast_addr",v_go_fast_addr); + value.put("export_to_kafka",v_export_to_kafka); + value.put("kafka_addr",v_kafka_addr); + value.put("task_id",v_task_id); + value.put("external_id",v_external_id); + //System.out.print(v_external_id+"external_id"); + String newkey = key.toLowerCase(); + if(subjectTaskMap.containsKey(newkey)){ + valueList = subjectTaskMap.get(newkey); + valueList.add(value); + }else{ + valueList.add(value); + } + subjectTaskMap.put(newkey,valueList); + } + //System.out.println(JsonUtils.toJSONString(subjectTaskMap)); + } + } +} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/runstart/GeterExit.java b/cl_stream_datasave/src/main/java/com/bfd/mf/runstart/GeterExit.java new file mode 100644 index 0000000..bb4cf87 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/runstart/GeterExit.java @@ -0,0 +1,11 @@ +//package com.bfd.mf.runstart; +// +// +//public class GeterExit extends Thread { +// +// public void run() { +// System.out.println("system run close..."); +// TaskFileUtils.clearTaskQueue(); +// System.out.println("system run closeed"); +// } +//} diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/runstart/RunStartDataSave.java b/cl_stream_datasave/src/main/java/com/bfd/mf/runstart/RunStartDataSave.java new file mode 100644 index 0000000..73cfb6d --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/runstart/RunStartDataSave.java @@ -0,0 +1,73 @@ +package com.bfd.mf.runstart; + +import com.bfd.crawler.kafka7.KfkConsumer; +import com.bfd.crawler.kafka7.consts.KafkaConsts; +import com.bfd.mf.entity.DataSaveManager; +import com.bfd.mf.entity.impl.DataSaveManagerImpl; +import com.bfd.mf.datasave.tools.DBUtil; +import com.bfd.mf.entity.mysql.FiledTableInfo; +import com.bfd.mf.entity.mysql.SubjectTask; +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; + +import java.net.MalformedURLException; +import java.rmi.AlreadyBoundException; +import java.rmi.Naming; +import java.rmi.RemoteException; +import java.rmi.registry.LocateRegistry; + +public class RunStartDataSave { + private static final Logger LOG = Logger.getLogger(RunStartDataSave.class); + + private static String log4jPath = "../etc/log4j.properties"; + private static String dbPath = "../etc/db.properties"; + static { + PropertyConfigurator.configureAndWatch(log4jPath); + DBUtil.init(dbPath); + } + public static void main(String[] args) { + + //KfkConsumer.startReadThread(this.queue, readTopicName,this.threadNums,this.groupId,this.kafkaServerName); + FiledTableInfo.loadTableInfo(); + // cl_subject_task + startRmiService(); + while (true){ + SubjectTask.loadSubjectTask(); + try { + Thread.sleep(30000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + /**后面增加把es缓存的数据关闭的时候处理 不让丢数据**/ + //Runtime.getRuntime().addShutdownHook(new GeterExit()); + } + + public static void startRmiService() { + try { + /*** 创建一个远程对象 ***/ + DataSaveManager dataSaveManager = new DataSaveManagerImpl(); + /*** + * 本地主机上的远程对象注册表Registry的实例, 并指定端口为8888,这一步必不可少(Java默认端口是1099), + * 必不可缺的一步,缺少注册表创建,则无法绑定对象到远程注册表上 + ***/ + LocateRegistry.createRegistry(1099); + /*** 把远程对象注册到RMI注册服务器上,并命名为taskManager ***/ + /*** 绑定的URL标准格式为:rmi://host:port/name(其中协议名可以省略,下面两种写法都是正确的) ***/ + + Naming.bind("//127.0.0.1:1099/dataSaveManager", dataSaveManager); + System.out.println(">>>>>INFO:远程IHello对象绑定成功!"); + } catch (RemoteException e) { + System.out.println("创建远程对象发生异常!"); + e.printStackTrace(); + } catch (MalformedURLException e) { + System.out.println("发生URL畸形异常!"); + e.printStackTrace(); + } catch (AlreadyBoundException e) { + e.printStackTrace(); + } + } +} + + + diff --git a/cl_stream_datasave/src/main/java/com/bfd/mf/runstart/TaskFileUtils.java b/cl_stream_datasave/src/main/java/com/bfd/mf/runstart/TaskFileUtils.java new file mode 100644 index 0000000..b183572 --- /dev/null +++ b/cl_stream_datasave/src/main/java/com/bfd/mf/runstart/TaskFileUtils.java @@ -0,0 +1,37 @@ +//package com.bfd.mf.runstart; +// +//import com.bfd.crawler.kafka7.KfkConsumer; +//import com.bfd.mf.datasave.listen.ListenKafkaManager; +//import com.bfd.mf.datasave.listen.ListenTaskManager; +//import org.apache.log4j.Logger; +// +//import java.util.Map; +//import java.util.concurrent.LinkedBlockingDeque; +// +//public class TaskFileUtils { +// +// private static Logger log = Logger.getLogger(TaskFileUtils.class); +// +// public static void clearTaskQueue(){ +// if(ListenTaskManager.listenKafkaManagers.size() > 0){ +// for(Map.Entry entry : ListenTaskManager.listenKafkaManagers.entrySet()){ +// try { +// ListenKafkaManager listenKafkaManager = entry.getValue() ; +// String kafkaInfo = entry.getKey(); +// KfkConsumer.stopKfkConsumerThreads(Integer.valueOf(kafkaInfo.split("#")[0]), kafkaInfo.split("#")[1]); +// LinkedBlockingDeque cacheQueue = listenKafkaManager.getQueue() ; +// if (cacheQueue.size() == 0) { +// listenKafkaManager.setSwitch(false); +// continue ; +// } +// cacheQueue.put("__Exit__"); +// } catch (InterruptedException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// log.error("TaskFileUtils>>> clearTaskQueue err "+e); +// } +// } +// } +// +// } +//} diff --git a/cl_stream_datasave/src/test/java/AboutMysql.java b/cl_stream_datasave/src/test/java/AboutMysql.java new file mode 100644 index 0000000..43f81e1 --- /dev/null +++ b/cl_stream_datasave/src/test/java/AboutMysql.java @@ -0,0 +1,13 @@ +//import com.bfd.mf.datasave.tools.DBUtil; +//import com.bfd.mf.entity.mysql.SubjectTask; +//import org.junit.Test; +// +//public class AboutMysql { +// +// +// @Test +// public void test1(){ +// DBUtil.init("../etc/db.properties"); +// SubjectTask.loadSubjectTask(); +// } +//} diff --git a/cl_stream_datasave/src/test/java/CreatIndex.java b/cl_stream_datasave/src/test/java/CreatIndex.java new file mode 100644 index 0000000..bbcbc70 --- /dev/null +++ b/cl_stream_datasave/src/test/java/CreatIndex.java @@ -0,0 +1,19 @@ +public class CreatIndex { + // 110 话题索引ES + +// public static void main(String[] args) { +// int bussinessType = 1; +// int esServerName = 2; +// String indexType = "docs"; +// try { +// for (int i = 0 ; i < 00 ; i ++) { +// String indexName = "cl_subject_00"+i ; +// System.out.println(indexName); +// ElastiProducer elastiProducer = ElastiProducer.getInstance(bussinessType, esServerName, indexName, indexType); +// System.out.println(elastiProducer); +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +} diff --git a/cl_stream_datasave/src/test/java/Test1.java b/cl_stream_datasave/src/test/java/Test1.java new file mode 100644 index 0000000..025dbf7 --- /dev/null +++ b/cl_stream_datasave/src/test/java/Test1.java @@ -0,0 +1,32 @@ +import com.bfd.crawler.utils.JsonUtils; +import com.bfd.mf.datasave.tools.ReadLine; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class Test1 { + + public static void main(String[] args) { + List list = ReadLine.readLine(new File("E:\\work\\workspace2020\\socialx\\SocialX_Stream\\SocialX_Stream/es.txt")); + Map map1 = new HashMap<>(); + for (String line:list) { + System.out.println(line); + String key = line.split("\t@@@\t")[0]; + String type = line.split("\t@@@\t")[1]; + if(type.contains("Long")){ + + } + // Map map2 = new HashMap<>(); + Map map3 = new HashMap<>(); + map3.put("type","keyword"); + map3.put("index",true); + map1.put(line,map3); + // map1.put(map2); + + } + + System.out.println(JsonUtils.toJSONString(map1)); + } +} diff --git a/cl_stream_mybatis/cl_stream_mybatis.iml b/cl_stream_mybatis/cl_stream_mybatis.iml new file mode 100644 index 0000000..ec0f185 --- /dev/null +++ b/cl_stream_mybatis/cl_stream_mybatis.iml @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cl_stream_mybatis/pom.xml b/cl_stream_mybatis/pom.xml new file mode 100644 index 0000000..9c2596d --- /dev/null +++ b/cl_stream_mybatis/pom.xml @@ -0,0 +1,180 @@ + + + + + + + + + 4.0.0 + + cl_stream_mybatis + + + org.springframework.boot + spring-boot-starter-parent + 1.4.3.RELEASE + + + + + UTF-8 + + true + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 1.3.1 + + + com.alibaba + fastjson + 1.1.22 + + + + org.springframework.boot + spring-boot-starter-log4j + 1.3.8.RELEASE + + + + org.springframework.boot + spring-boot-starter-test + test + + + + com.bfd.mf + serviceManager + 2.0-SNAPSHOT + + + + com.bfd.mf + dataSaveManager + 2.0-SNAPSHOT + + + + + javax.servlet + jstl + + + org.apache.tomcat.embed + tomcat-embed-jasper + + + org.apache.poi + poi + 3.15 + + + org.apache.poi + poi-ooxml + 3.15 + + + net.sf.json-lib + json-lib + 2.4 + jdk15 + + + org.elasticsearch + elasticsearch + 6.0.0 + + + org.elasticsearch.client + transport + 6.0.0 + + + + mysql + mysql-connector-java + runtime + + + log4j + log4j + 1.2.17 + + + org.slf4j + slf4j-api + 1.7.25 + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + 1.4.2.RELEASE + + com.bfd.mf.TestmybatisApplication + + + + + repackage + + + + + + + maven-compiler-plugin + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-war-plugin + + false + + + + + + ${project.basedir}/src/main/webapp + + META-INF/resources + + **/** + + + + ${project.basedir}/src/main/resources + + **/** + + + + + + \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/TestmybatisApplication.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/TestmybatisApplication.java new file mode 100644 index 0000000..62f89d1 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/TestmybatisApplication.java @@ -0,0 +1,18 @@ +package com.bfd.mf; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@MapperScan("com.bfd.mf.mapper") +public class TestmybatisApplication { + + public static void main(String[] args) { + try { + SpringApplication.run(TestmybatisApplication.class, args); + }catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/common/ExternalConnCache.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/common/ExternalConnCache.java new file mode 100644 index 0000000..78442c2 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/common/ExternalConnCache.java @@ -0,0 +1,58 @@ +package com.bfd.mf.common; + +import org.elasticsearch.client.transport.TransportClient; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.Settings.Builder; +import org.elasticsearch.common.transport.TransportAddress; +import org.elasticsearch.transport.client.PreBuiltTransportClient; +import org.springframework.stereotype.Component; + +import java.net.InetAddress; + + +@Component +public class ExternalConnCache { + + private static final String hosts = "172.18.1.148"; + private static final Integer port = 9303; + private static final String clusterName = "SQ_Mini_new"; + + private static TransportClient transportClient ; + /*private static String hosts; + private static String port; + private static String clusterName; + */ + /*@Value("${externalConn.cache.hosts}") + public void setHosts(String hosts) { + ExternalConnCache.hosts = hosts; + } + + @Value("${externalConn.cache.port}") + public void setPort(String port) { + ExternalConnCache.port = port; + } + + @Value("${externalConn.cache.clusterName}") + public void setClusterName(String clusterName) { + ExternalConnCache.clusterName = clusterName; + }*/ + + public static TransportClient getTransportClient(){ + if(transportClient == null){ + try{ + Builder builder = + Settings.builder().put("cluster.name", clusterName).put("client.transport.sniff", false); + Settings esSettings = builder.build(); + transportClient = new PreBuiltTransportClient(esSettings); + transportClient.addTransportAddress(new TransportAddress(InetAddress.getByName(hosts),Integer.valueOf(port))); + }catch (Exception ex){ + ex.printStackTrace(); + new RuntimeException(ex); + }finally { + + } + } + return transportClient; + + } +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/common/PageBean.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/common/PageBean.java new file mode 100644 index 0000000..32760b2 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/common/PageBean.java @@ -0,0 +1,38 @@ +package com.bfd.mf.common; + +import java.io.Serializable; + + +public class PageBean implements Serializable { + private static final long serialVersionUID = 8656597559014685635L; + private long total; //总记录数 + private long quarycount; // 当前页的数量 <= pageSize,该属性来自ArrayList的size属性 + + + public PageBean() { + + } + + public PageBean(long total, long quarycount) { + this.total = total; + + this.quarycount = quarycount; + } + + public long getTotal() { + return total; + } + + public void setTotal(long total) { + this.total = total; + } + + public long getQuarycount() { + return quarycount; + } + + public void setQuarycount(long quarycount) { + this.quarycount = quarycount; + } + +} \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/config/XmlConfiguration.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/config/XmlConfiguration.java new file mode 100644 index 0000000..cca4ac0 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/config/XmlConfiguration.java @@ -0,0 +1,11 @@ +package com.bfd.mf.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.ImportResource; + +@Configuration +@ImportResource({"classpath:/com/bfd/mf/spring/applicationContext.xml"}) +public class XmlConfiguration { + + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/controller/CompanyController.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/controller/CompanyController.java new file mode 100644 index 0000000..8d55ca2 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/controller/CompanyController.java @@ -0,0 +1,256 @@ +package com.bfd.mf.controller; + + +import com.bfd.mf.common.PageBean; +import com.bfd.mf.entity.DataSaveManager; +import com.bfd.mf.entity.FieldNormaliz; +import com.bfd.mf.entity.StatInfo; +import com.bfd.mf.service.rmi.ServiceManager; +import com.bfd.mf.service.FieldNormalizService; +import com.bfd.mf.service.MetaSearchService; +import com.bfd.mf.service.StatService; +import com.bfd.mf.tools.ConnectionRmi; +import net.sf.json.JSONObject; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.io.IOException; +import java.rmi.RemoteException; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @author hanzhitong + * @version 1.0 + * @description com.uniocredit.controller + * @date 2018/5/15 + */ +@Controller +@RequestMapping("/web") +public class CompanyController { + private Logger logger = LoggerFactory.getLogger(CompanyController.class); + + @Autowired + private FieldNormalizService fieldNormalizService; + @Autowired + private MetaSearchService metaSearchService ; + @Autowired + private StatService statService ; + + private ServiceManager serviceManager = ConnectionRmi.getServiceManager(); + private DataSaveManager dataSaveManager = ConnectionRmi.getDataSaveManager(); + + public Map> taskInfos = new HashMap>(); + + private SimpleDateFormat ddf = new SimpleDateFormat("yyyy-MM-dd"); + + @RequestMapping(value = { "/upload" }, method = RequestMethod.GET) + public String upload() { + return "importdb" ; + } + + /** + * 重载 + */ + @RequestMapping(value = { "/upload" }, method = RequestMethod.POST) + public String upload(HttpServletRequest request, + @RequestParam(value="myfile") MultipartFile[] files) { + List fileNames = new ArrayList(); + List errfileNames = new ArrayList(); + String uploadFile = request.getSession().getServletContext().getRealPath("/")+"upload/"; + File dir = new File(uploadFile); + if(!dir.exists()){ + dir.mkdir(); + } + for (MultipartFile file: files){ + String fileName=file.getOriginalFilename(); + System.out.println(fileName); + File serverFile = new File(uploadFile + fileName); + try { + file.transferTo(serverFile); +// excelToDB.exc_import_db(uploadFile + fileName); + if(serverFile.exists() && serverFile.isFile()) + serverFile.delete(); + fileNames.add(fileName); + } catch (IOException e) { + errfileNames.add(fileName); + logger.error(fileName+"--上传到服务器报错!!"); + e.printStackTrace(); + } catch (Exception e) { + errfileNames.add(fileName); + e.printStackTrace(); + } + } + if(errfileNames.size() > 0){ + request.setAttribute("errfileNames",errfileNames); + } + request.setAttribute("fileNames",fileNames); + return "importdb" ; + } + + + @RequestMapping(value = { "/taskInfo" }, method = RequestMethod.POST) + public String addTask(@RequestParam("kafkaSerName") String kafkaSerName, + @RequestParam("kafkaName") String kafkaName,@RequestParam("groupId") String groupId, + @RequestParam("bussinessType") String bussinessType,@RequestParam("esSerName") String esSerName, + @RequestParam("esSuffixNames") String esSuffixNames, @RequestParam("projectName") String projectName, + @RequestParam("isSemtimentApi") String isSemtimentApi) { + FieldNormaliz fieldNormaliz = new FieldNormaliz(); + fieldNormaliz.setEsSerName(Integer.valueOf(esSerName)); + fieldNormaliz.setBussinessType(Integer.valueOf(bussinessType)); + fieldNormaliz.setEsSuffixNames(esSuffixNames); + fieldNormaliz.setKafkaName(kafkaName); + fieldNormaliz.setGroupId(groupId); + fieldNormaliz.setKafkaSerName(Integer.valueOf(kafkaSerName)); + fieldNormaliz.setProjectName(projectName); + fieldNormaliz.setIsSemtimentApi(Integer.valueOf(isSemtimentApi)); + fieldNormaliz.setKafkaSuffixName("filter1"); + fieldNormalizService.add(fieldNormaliz) ; + return "importdb" ; + } + + + /** + * 获取任务列表 + * @return + */ + @RequestMapping(value = { "/tasklist" }, method = RequestMethod.POST) + @ResponseBody + public String tasklist() { + List fieldNormalizs = fieldNormalizService.getFieldNormalizList() ; + Map map = new HashMap(); + map.put("fieldNormalizs", fieldNormalizs); + String result = JSONObject.fromObject(map).toString(); + return result ; + } + + + @RequestMapping(value = { "/startTask" }, method = RequestMethod.POST) + public String startTask(int id){ + FieldNormaliz fieldNormaliz = fieldNormalizService.getFieldNormalizById(id); + Map map = new HashMap(); + map.put("kafkaName", fieldNormaliz.getKafkaName()) ; + map.put("taskid", fieldNormaliz.getId()) ; + map.put("busniessType", fieldNormaliz.getBussinessType()) ; // 2=后台 1=前台 + map.put("esServerName",fieldNormaliz.getEsSerName()); // 1= 后台 2=前台 + map.put("indexName",fieldNormaliz.getEsSuffixNames()); + taskInfos.put(fieldNormaliz.getId(), map); + try { + System.out.println("任务开始 ~" + fieldNormaliz.getId()); + //serviceManager.addTaskName(fieldNormaliz); + serviceManager.addTaskName(fieldNormaliz); + if(fieldNormaliz.getIsSemtimentApi() == 1){ + String kafkaName = fieldNormaliz.getKafkaName() ; + String kafkasuffixName = fieldNormaliz.getKafkaSuffixName() ; + fieldNormaliz.setKafkaName(kafkaName+"_"+kafkasuffixName); + System.out.println(fieldNormaliz.toString()+"fieldNormaliz是000"); + dataSaveManager.addTaskName(fieldNormaliz); + } + } catch (RemoteException e) { + e.printStackTrace(); + } + fieldNormalizService.update(id, fieldNormaliz); + return "importdb"; + } + + @RequestMapping(value = { "/stopTask" }, method = RequestMethod.POST) + public String stopTask(int id){ + FieldNormaliz fieldNormaliz = fieldNormalizService.getFieldNormalizById(id); + fieldNormalizService.delete(id); + if(fieldNormaliz != null){ + String kafkaName = ""; + try{ + kafkaName = fieldNormaliz.getKafkaName() ; + }catch(Exception e){ + e.printStackTrace(); + } + + if(taskInfos.containsKey(id)){ + taskInfos.remove(id); + } + try { + if(StringUtils.isNotBlank(kafkaName)){ + int kafkaSerName= fieldNormaliz.getKafkaSerName() ; + serviceManager.stopImprotTask(kafkaSerName,kafkaName) ; + if(fieldNormaliz.getIsSemtimentApi() == 1){ + String kafkasuffixName = fieldNormaliz.getKafkaSuffixName() ; + dataSaveManager.stopImprotTask(kafkaSerName,kafkaName+"_"+kafkasuffixName); + } + } + } catch (RemoteException e) { + e.printStackTrace(); + } + } + return "importdb"; + } + + @RequestMapping(value = { "/refreshStats" }, method = RequestMethod.POST) + @ResponseBody + public String refreshStats(){ + List> statdatas= new ArrayList>(); + try{ +// if(taskInfos.size() > 0){ +// for(Map.Entry> entry : taskInfos.entrySet()){ +// Map taski = entry.getValue() ; +// int kafkaNum = serviceManager.getNowKafkaNum(taski) ; // 获取 kafka 当前条数 +// String checkDay = ddf.format(new Date()); +// String kafkaName = taski.get("kafkaName").toString(); +// String indexName = taski.get("indexName").toString() ; +// PageBean pageBean = metaSearchService.metaSearchPageList(indexName, new Date().getTime()) ; +// long quaryesToalNum= pageBean.getTotal(); +// long quaryesDiffrows = pageBean.getQuarycount(); +// StatInfo statInfo = statService.getStatInfoByCheck(checkDay, kafkaName, indexName); +// if(statInfo != null){ +// int kafkaN = statInfo.getKafkaRows() ; +// int esN = statInfo.getIndexRows() ; +// int esdiffNum = statInfo.getDiffRows() ; +// if(kafkaNum != kafkaN || esN != quaryesToalNum || quaryesDiffrows != esdiffNum ){ +// statService.update(checkDay, kafkaName, indexName, quaryesToalNum , quaryesDiffrows, kafkaNum); +// } +// }else{ +// StatInfo statInfonew = new StatInfo(); +// statInfonew.setCheckDay(checkDay); +// statInfonew.setKafkaName(kafkaName); +// statInfonew.setKafkaRows(kafkaNum); +// statInfonew.setIndexName(indexName); +// statInfonew.setIndexRows((int) quaryesToalNum); +// statInfonew.setDiffRows((int) quaryesDiffrows); +// statService.add(statInfonew); +// } +// } +// } + + List statlist = statService.getStatInfo(); + if(statlist.size() > 0){ + Map statdata ; + for(StatInfo statInfo : statlist){ + statdata = new HashMap(); + statdata.put("indexName", statInfo.getIndexName()); + statdata.put("kafkaNum", statInfo.getKafkaRows()); + statdata.put("esNum", statInfo.getIndexRows()); + statdata.put("diffesNum", statInfo.getDiffRows()); + statdata.put("checkDay", statInfo.getCheckDay()); + statdata.put("kafkaName", statInfo.getKafkaName()); + statdatas.add(statdata); + } + } + }catch(Exception e){ + e.printStackTrace(); + } + Map map = new HashMap(); + map.put("autoRefresh", statdatas); + String result = JSONObject.fromObject(map).toString(); + return result; + + } +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/FieldInfo.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/FieldInfo.java new file mode 100644 index 0000000..5d3185f --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/FieldInfo.java @@ -0,0 +1,39 @@ +package com.bfd.mf.entity; + +import java.util.List; + +public class FieldInfo { + + private String kafka_type ; + + private List kafkaJsonString ; + + private List kafkaJsonArray ; + + public String getKafka_type() { + return kafka_type; + } + + public void setKafka_type(String kafka_type) { + this.kafka_type = kafka_type; + } + + public List getKafkaJsonString() { + return kafkaJsonString; + } + + public void setKafkaJsonString(List kafkaJsonString) { + this.kafkaJsonString = kafkaJsonString; + } + + public List getKafkaJsonArray() { + return kafkaJsonArray; + } + + public void setKafkaJsonArray(List kafkaJsonArray) { + this.kafkaJsonArray = kafkaJsonArray; + } + + + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/FieldNormaliz.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/FieldNormaliz.java new file mode 100644 index 0000000..0ae78f2 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/FieldNormaliz.java @@ -0,0 +1,258 @@ +package com.bfd.mf.entity; + +import java.io.Serializable; +import java.util.Map; +import java.util.Set; + +public class FieldNormaliz implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + private int id ; + + private String kafkaName ; + + private int kafkaSerName ; + + private int esSerName ; + + private String esSuffixNames ; + + private String docType ; + + private int isSemtimentApi ; + + private boolean ishlKeyword ; + + private int bussinessType ; + + private Map fieldNormalizeContentMap ; + + private Map fieldNormalizeCommentMap ; + + private Map>> fieldDataMap ; + + private Map fieldInfo ; + + private String groupId ; + + private String createTime ; + + private String finshTime ; + + private int status ; + + private String projectName ; + + private Map>> userfieldDataMap ; + + private String kafkaSuffixName ; + + public String getKafkaSuffixName() { + return kafkaSuffixName; + } + + public void setKafkaSuffixName(String kafkaSuffixName) { + this.kafkaSuffixName = kafkaSuffixName; + } + + public String getKafkaName() { + return kafkaName; + } + + public void setKafkaName(String kafkaName) { + this.kafkaName = kafkaName; + } + + public int getKafkaSerName() { + return kafkaSerName; + } + + public void setKafkaSerName(int kafkaSerName) { + this.kafkaSerName = kafkaSerName; + } + + + public int getEsSerName() { + return esSerName; + } + + public void setEsSerName(int esSerName) { + this.esSerName = esSerName; + } + + public String getDocType() { + return docType; + } + + public void setDocType(String docType) { + this.docType = docType; + } + + + public int getIsSemtimentApi() { + return isSemtimentApi; + } + + public void setIsSemtimentApi(int isSemtimentApi) { + this.isSemtimentApi = isSemtimentApi; + } + + public int getBussinessType() { + return bussinessType; + } + + public void setBussinessType(int bussinessType) { + this.bussinessType = bussinessType; + } + + public Map getFieldNormalizeContentMap() { + return fieldNormalizeContentMap; + } + + public void setFieldNormalizeContentMap(Map fieldNormalizeContentMap) { + this.fieldNormalizeContentMap = fieldNormalizeContentMap; + } + + public Map getFieldNormalizeCommentMap() { + return fieldNormalizeCommentMap; + } + + public void setFieldNormalizeCommentMap(Map fieldNormalizeCommentMap) { + this.fieldNormalizeCommentMap = fieldNormalizeCommentMap; + } + + public Map>> getFieldDataMap() { + return fieldDataMap; + } + + public Map> getFieldDataMapByType(String type){ + return fieldDataMap.get(type); + } + + public void addFieldDataMap(String type, Map fixFieldData, Integer bussinessType){ + Set keys = fixFieldData.keySet() ; + Map> fieldMaps = fieldDataMap.get(bussinessType) ; + Map fieldMap = fieldMaps.get(type) ; + for(String key : keys){ + fieldMap.put(key, key) ; + } + fieldMaps.put(type, fieldMap); + fieldDataMap.put(bussinessType, fieldMaps) ; + } + + + public void setFieldDataMap(Map>> fieldDataMap) { + this.fieldDataMap = fieldDataMap; + } + + public Map getFieldInfo() { + return fieldInfo; + } + + public void setFieldInfo(Map fieldInfo) { + this.fieldInfo = fieldInfo; + } + + public boolean isIshlKeyword() { + return ishlKeyword; + } + + public void setIshlKeyword(boolean ishlKeyword) { + this.ishlKeyword = ishlKeyword; + } + + public String getEsSuffixNames() { + return esSuffixNames; + } + + public void setEsSuffixNames(String esSuffixNames) { + this.esSuffixNames = esSuffixNames; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getFinshTime() { + return finshTime; + } + + public void setFinshTime(String finshTime) { + this.finshTime = finshTime; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public Map>> getUserfieldDataMap() { + return userfieldDataMap; + } + + public void setUserfieldDataMap(Map>> userfieldDataMap) { + this.userfieldDataMap = userfieldDataMap; + } + + @Override + public String toString() { + return "FieldNormaliz{" + + "id=" + id + + ", kafkaName='" + kafkaName + '\'' + + ", kafkaSerName=" + kafkaSerName + + ", esSerName=" + esSerName + + ", esSuffixNames='" + esSuffixNames + '\'' + + ", docType='" + docType + '\'' + + ", isSemtimentApi=" + isSemtimentApi + + ", ishlKeyword=" + ishlKeyword + + ", bussinessType=" + bussinessType + + ", fieldNormalizeContentMap=" + fieldNormalizeContentMap + + ", fieldNormalizeCommentMap=" + fieldNormalizeCommentMap + + ", fieldDataMap=" + fieldDataMap + + ", fieldInfo=" + fieldInfo + + ", groupId='" + groupId + '\'' + + ", createTime='" + createTime + '\'' + + ", finshTime='" + finshTime + '\'' + + ", status=" + status + + ", projectName='" + projectName + '\'' + + ", userfieldDataMap=" + userfieldDataMap + + ", kafkaSuffixName='" + kafkaSuffixName + '\'' + + '}'; + } +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/Record.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/Record.java new file mode 100644 index 0000000..dccb15c --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/Record.java @@ -0,0 +1,22 @@ +package com.bfd.mf.entity; + +import java.util.List; +import java.util.Map; + +public class Record { + private Long counts; + private List> records; + + public Long getCounts() { + return counts; + } + public void setCounts(Long counts) { + this.counts = counts; + } + public List> getRecords() { + return records; + } + public void setRecords(List> records) { + this.records = records; + } +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/StatInfo.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/StatInfo.java new file mode 100644 index 0000000..0f22525 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/entity/StatInfo.java @@ -0,0 +1,84 @@ +package com.bfd.mf.entity; + +import java.io.Serializable; + +public class StatInfo implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + + private String checkDay ; + + private String kafkaName ; + + private int kafkaRows ; + + private String indexName ; + + private int indexRows ; + + private int diffRows; + + private String addTime ; + + public String getCheckDay() { + return checkDay; + } + + public void setCheckDay(String checkDay) { + this.checkDay = checkDay; + } + + public String getKafkaName() { + return kafkaName; + } + + public void setKafkaName(String kafkaName) { + this.kafkaName = kafkaName; + } + + public int getKafkaRows() { + return kafkaRows; + } + + public void setKafkaRows(int kafkaRows) { + this.kafkaRows = kafkaRows; + } + + public String getIndexName() { + return indexName; + } + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + + public int getIndexRows() { + return indexRows; + } + + public void setIndexRows(int indexRows) { + this.indexRows = indexRows; + } + + public int getDiffRows() { + return diffRows; + } + + public void setDiffRows(int diffRows) { + this.diffRows = diffRows; + } + + public String getAddTime() { + return addTime; + } + + public void setAddTime(String addTime) { + this.addTime = addTime; + } + + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/es/ESHandler.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/es/ESHandler.java new file mode 100644 index 0000000..877fa36 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/es/ESHandler.java @@ -0,0 +1,86 @@ +package com.bfd.mf.es; + +import com.bfd.mf.common.ExternalConnCache; +import org.elasticsearch.action.search.SearchRequestBuilder; +import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.client.transport.TransportClient; +import org.elasticsearch.index.query.BoolQueryBuilder; +import org.elasticsearch.index.query.QueryBuilders; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Repository; + +import java.text.SimpleDateFormat; +import java.util.Date; + + +@Repository +public class ESHandler { + + private static final Logger logger = LoggerFactory.getLogger(ESHandler.class); + + private static final SimpleDateFormat startddf = new SimpleDateFormat("yyyy-MM-dd 00:00:00"); + + private static final SimpleDateFormat nowddf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + public long synoPageSearch(String indexName, long nowcreateTime) { + + TransportClient client = ExternalConnCache.getTransportClient(); + BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery(); + if(nowcreateTime != 0){ + String startTime = startddf.format(new Date(nowcreateTime)); + String nowTime = nowddf.format(new Date(nowcreateTime)) ; + queryBuilder.must(QueryBuilders.rangeQuery("createTimeStr").from(startTime).to(nowTime)); + }else{ + queryBuilder.must(QueryBuilders.matchAllQuery()); + } + + SearchResponse response; + try { + SearchRequestBuilder srb = client.prepareSearch(indexName) + .setTypes("docs") + .setQuery(queryBuilder); + response = srb.get(); + } catch (Exception e) { + e.printStackTrace(); + return 0 ; + } + + Long count = response.getHits().getTotalHits(); + return count ; + } + + + +// public static void main(String[] args) { +// String indexName = "overseas_content"; +//// JSONArray jsonArray = new JSONArray(); +//// jsonArray.add("{\"id\":259,\"question\":\"人工智能是指什么\",\"answer\":\"AI,人工智能它是研究、开发用于模拟、延伸和扩展人的智能的理论、方法、技术及应用系统的一门新的技术科学。\",\"createdBy\":1,\"createTime\":1541757803,\"lastModifiedBy\":1,\"lastModifiedTime\":1541757803}"); +// +// //jsonArray.add("{\"id\":4440,\"question\":\"人工智能指什么\",\"answer\":\"AI,人工智能它是研究、开发用于模拟、延伸和扩展人的智能的理论、方法、技术及应用系统的一门新的技术科学。\",\"createdBy\":1,\"createTime\":1541757803,\"lastModifiedBy\":1,\"lastModifiedTime\":1541757803}"); +// +// //System.out.println(jsonArray.toJSONString()); +// +// //batchInsert(indexName, type, jsonArray); +// +// //update(jsonArray, indexName, type); +// +// //String ids = "24,25"; +// //deleteByIDs(indexName, type, ids); +//// ChatPairs chatPairs = new ChatPairs(); +//// chatPairs.setAnswer("请问能帮我介绍一下AI"); +//// chatPairs.setQuestion("请问能帮我介绍一下AI"); +//// chatSearch(indexName,type, chatPairs); +// +//// Synonym synonym = new Synonym(); +//// synonym.setRoot("抓取"); +//// synoSearch(indexName,type, 1, 10, synonym); +// +// //exportIndex(indexName); +// ESHandler esh = new ESHandler(); +// long a= esh.synoPageSearch(indexName,0); //13978 +// System.out.println(a); +// } + + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/mapper/FieldNormalizMapper.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/mapper/FieldNormalizMapper.java new file mode 100644 index 0000000..26dbb24 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/mapper/FieldNormalizMapper.java @@ -0,0 +1,23 @@ +package com.bfd.mf.mapper; + +import com.bfd.mf.entity.FieldNormaliz; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; +import java.util.List; + +@Repository +@Mapper +public interface FieldNormalizMapper { + + FieldNormaliz getFieldNormalizById(Integer id); + + public List getFieldNormalizList(); + + public int add(FieldNormaliz fieldNormaliz); + + public int update(@Param("id") Integer id, @Param("fieldNormaliz") FieldNormaliz fieldNormaliz); + + public int delete(Integer id); + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/mapper/StatMapper.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/mapper/StatMapper.java new file mode 100644 index 0000000..18bf370 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/mapper/StatMapper.java @@ -0,0 +1,20 @@ +package com.bfd.mf.mapper; + +import com.bfd.mf.entity.StatInfo; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + + +@Repository +public interface StatMapper { + + public List getStatInfo(); + + public int add(StatInfo statInfo); + + public int update(@Param("checkDay") String checkDay, @Param("kafkaName") String kafkaName, @Param("indexName") String indexName, @Param("indexRows") long indexRows, @Param("diffRows") long diffRows, @Param("kafkaRows") int kafkaRows); + + public StatInfo getStatInfoByCheck(@Param("checkDay") String checkDay, @Param("kafkaName") String kafkaName, @Param("indexName") String indexName); +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/sendTask/SendTask.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/sendTask/SendTask.java new file mode 100644 index 0000000..793c425 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/sendTask/SendTask.java @@ -0,0 +1,12 @@ +package com.bfd.mf.sendTask; + +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.util.Map; + +public interface SendTask extends Remote{ + + public void backTopic(Map dataMap) throws RemoteException; + + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/sendTask/impl/SendTaskImpl.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/sendTask/impl/SendTaskImpl.java new file mode 100644 index 0000000..da6167c --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/sendTask/impl/SendTaskImpl.java @@ -0,0 +1,23 @@ +package com.bfd.mf.sendTask.impl; + + +import com.bfd.mf.sendTask.SendTask; + +import java.io.Serializable; +import java.rmi.RemoteException; +import java.util.Map; + +public class SendTaskImpl implements SendTask,Serializable,Cloneable{ + /** + * + */ + private static final long serialVersionUID = 6269469187077502624L; + + + @Override + public void backTopic(Map dataMap) throws RemoteException { + // TODO Auto-generated method stub + + } + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/service/FieldNormalizService.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/FieldNormalizService.java new file mode 100644 index 0000000..b6e61cc --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/FieldNormalizService.java @@ -0,0 +1,22 @@ +package com.bfd.mf.service; + + +import com.bfd.mf.entity.FieldNormaliz; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public interface FieldNormalizService { + + FieldNormaliz getFieldNormalizById(Integer id); + + public List getFieldNormalizList(); + + public int add(FieldNormaliz fieldNormaliz); + + public int update(Integer id, FieldNormaliz fieldNormaliz); + + public int delete(Integer id); + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/service/MetaSearchService.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/MetaSearchService.java new file mode 100644 index 0000000..6ea7e08 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/MetaSearchService.java @@ -0,0 +1,8 @@ +package com.bfd.mf.service; + + +import com.bfd.mf.common.PageBean; + +public interface MetaSearchService { + PageBean metaSearchPageList(String indexName, long createTime); +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/service/StatService.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/StatService.java new file mode 100644 index 0000000..8d2270a --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/StatService.java @@ -0,0 +1,17 @@ +package com.bfd.mf.service; + + +import com.bfd.mf.entity.StatInfo; + +import java.util.List; + +public interface StatService { + public List getStatInfo(); + + public int add(StatInfo statInfo); + + public int update(String checkDay, String kafkaName, String indexName, long quaryesToalNum, long quaryesDiffrows, int kafkaNum); + + public StatInfo getStatInfoByCheck(String checkDay, String kafkaName, String indexName); + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/service/impl/FieldNormalizServiceImpl.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/impl/FieldNormalizServiceImpl.java new file mode 100644 index 0000000..8c1ccd9 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/impl/FieldNormalizServiceImpl.java @@ -0,0 +1,46 @@ +package com.bfd.mf.service.impl; + +import com.bfd.mf.entity.FieldNormaliz; +import com.bfd.mf.mapper.FieldNormalizMapper; +import com.bfd.mf.service.FieldNormalizService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; + +@Service +public class FieldNormalizServiceImpl implements FieldNormalizService { + + @Autowired + private FieldNormalizMapper fieldNormalizMapper ; + + @Override + public FieldNormaliz getFieldNormalizById(Integer id) { + // TODO Auto-generated method stub + return fieldNormalizMapper.getFieldNormalizById(id); + } + + @Override + public List getFieldNormalizList() { + // TODO Auto-generated method stub + return fieldNormalizMapper.getFieldNormalizList(); + } + + @Override + public int add(FieldNormaliz fieldNormaliz) { + // TODO Auto-generated method stub + return fieldNormalizMapper.add(fieldNormaliz); + } + + @Override + public int update(Integer id, FieldNormaliz fieldNormaliz) { + // TODO Auto-generated method stub + return fieldNormalizMapper.update(id, fieldNormaliz); + } + + @Override + public int delete(Integer id) { + // TODO Auto-generated method stub + return fieldNormalizMapper.delete(id); + } + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/service/impl/MetaSearchServiceImpl.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/impl/MetaSearchServiceImpl.java new file mode 100644 index 0000000..d5a2970 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/impl/MetaSearchServiceImpl.java @@ -0,0 +1,35 @@ +package com.bfd.mf.service.impl; + + +import com.bfd.mf.common.PageBean; +import com.bfd.mf.es.ESHandler; +import com.bfd.mf.service.MetaSearchService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +@Service +public class MetaSearchServiceImpl implements MetaSearchService { + + @Autowired + private ESHandler esHandler; + + @Override + public PageBean metaSearchPageList(String indexName, long createTime) { + // TODO Auto-generated method stub + try { + long quarycommentCount = esHandler.synoPageSearch(indexName+"_comment",createTime); + long quarycontentCount = esHandler.synoPageSearch(indexName+"_content",createTime); + long totalcommentCount = esHandler.synoPageSearch(indexName+"_comment",0); + long totalcontentCount = esHandler.synoPageSearch(indexName+"_content",0); + PageBean pageBean = new PageBean(); + pageBean.setTotal(totalcommentCount + totalcontentCount); + pageBean.setQuarycount(quarycommentCount + quarycontentCount); + return pageBean; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/service/impl/StatServiceImpl.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/impl/StatServiceImpl.java new file mode 100644 index 0000000..d413c74 --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/service/impl/StatServiceImpl.java @@ -0,0 +1,42 @@ +package com.bfd.mf.service.impl; + +import com.bfd.mf.entity.StatInfo; +import com.bfd.mf.mapper.StatMapper; +import com.bfd.mf.service.StatService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class StatServiceImpl implements StatService { + + @Autowired + private StatMapper statMapper ; + + @Override + public List getStatInfo() { + // TODO Auto-generated method stub + return statMapper.getStatInfo(); + } + + @Override + public int add(StatInfo statInfo) { + // TODO Auto-generated method stub + return statMapper.add(statInfo); + } + + @Override + public int update(String checkDay,String kafkaName,String indexName,long quaryesToalNum ,long quaryesDiffrows,int kafkaNum) { + // TODO Auto-generated method stub + return statMapper.update(checkDay,kafkaName,indexName, quaryesToalNum, quaryesDiffrows, kafkaNum); + } + + @Override + public StatInfo getStatInfoByCheck(String checkDay, String kafkaName, String indexName) { + // TODO Auto-generated method stub + return statMapper.getStatInfoByCheck(checkDay, kafkaName, indexName); + } + + +} diff --git a/cl_stream_mybatis/src/main/java/com/bfd/mf/tools/ConnectionRmi.java b/cl_stream_mybatis/src/main/java/com/bfd/mf/tools/ConnectionRmi.java new file mode 100644 index 0000000..c6ec14e --- /dev/null +++ b/cl_stream_mybatis/src/main/java/com/bfd/mf/tools/ConnectionRmi.java @@ -0,0 +1,53 @@ +package com.bfd.mf.tools; + +import com.bfd.mf.entity.DataSaveManager; +import com.bfd.mf.service.rmi.ServiceManager; + +import java.rmi.NotBoundException; +import java.rmi.RemoteException; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; + +public class ConnectionRmi { + + private static ServiceManager serviceManager ; + + private static DataSaveManager dataSaveManager ; + + private ConnectionRmi() {} + + private static ServiceManager initServiceManager() { + Registry registry; + try { + registry = LocateRegistry.getRegistry("127.0.0.1", 8899); + serviceManager = (ServiceManager) registry.lookup("serviceManager"); + } catch (RemoteException e) { + e.printStackTrace(); + } catch (NotBoundException e) { + e.printStackTrace(); + } + return serviceManager; + } + + private static DataSaveManager initDataSaveManager() { + Registry registry; + try { + registry = LocateRegistry.getRegistry("127.0.0.1", 1099); + dataSaveManager = (DataSaveManager) registry.lookup("dataSaveManager"); + } catch (RemoteException e) { + e.printStackTrace(); + } catch (NotBoundException e) { + e.printStackTrace(); + } + return dataSaveManager; + } + + public static ServiceManager getServiceManager(){ + return initServiceManager(); + } + + public static DataSaveManager getDataSaveManager(){ + return initDataSaveManager(); + } + +} diff --git a/cl_stream_mybatis/src/main/resources/application.properties b/cl_stream_mybatis/src/main/resources/application.properties new file mode 100644 index 0000000..2a6f8ba --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/application.properties @@ -0,0 +1,18 @@ +# mysql +#spring.datasource.url=jdbc:mysql://192.168.67.152/field_normaliz?useUnicode=true&characterEncoding=utf-8 +#spring.datasource.username=root +#spring.datasource.password=Bfd123!@# +#spring.datasource.driver-class-name=com.mysql.jdbc.Driver + +spring.datasource.url=jdbc:mysql://172.26.11.113:3306/bfd_sq_data?useUnicode=true&characterEncoding=utf-8 +spring.datasource.username=root +spring.datasource.password=bfd123 +spring.datasource.driver-class-name=com.mysql.jdbc.Driver + +spring.mvc.view.suffix=.jsp +spring.mvc.view.prefix=/WEB-INF/ +spring.mvc.static-path-pattern=/static/** + + +#mybatis +mybatis.mapperLocations=classpath:com/bfd/mf/mapper/*.xml \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/com/bfd/mf/mapper/fieldNormaliz.xml b/cl_stream_mybatis/src/main/resources/com/bfd/mf/mapper/fieldNormaliz.xml new file mode 100644 index 0000000..875aff9 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/com/bfd/mf/mapper/fieldNormaliz.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + id, kafka_server, es_server, bussiness_type,es_index_name,kafka_topic,groupid,project_name,is_semtiment_api,kafka_suffix_name + + + + + + + + INSERT INTO + mf_kafka_info + (kafka_server,kafka_topic,groupid,es_server,bussiness_type,es_index_name,create_time,project_name,is_semtiment_api,kafka_suffix_name) + VALUES + (#{kafkaSerName}, #{kafkaName}, #{groupId}, #{esSerName}, #{bussinessType}, #{esSuffixNames}, now(), #{projectName}, #{isSemtimentApi}, #{kafkaSuffixName}) + + + + UPDATE + mf_kafka_info + SET + status = 1 + WHERE + id = #{id} + + + + DELETE FROM + mf_kafka_info + WHERE + id = #{id} + + \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/com/bfd/mf/mapper/statInfo.xml b/cl_stream_mybatis/src/main/resources/com/bfd/mf/mapper/statInfo.xml new file mode 100644 index 0000000..13bdb44 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/com/bfd/mf/mapper/statInfo.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + check_day, kafka_name, kafka_rows, index_name, index_rows, diff_rows, add_time + + + + + + INSERT INTO + mf_check_rows_list + (check_day,kafka_name,kafka_rows,index_name,index_rows,diff_rows,add_time) + VALUES + (#{checkDay}, #{kafkaName}, #{kafkaRows}, #{indexName}, #{indexRows}, #{diffRows}, now()) + + + + UPDATE + mf_check_rows_list + SET + kafka_rows = #{kafkaRows}, index_rows = #{indexRows} , diff_rows = #{diffRows} + WHERE + check_day = #{checkDay} and kafka_name = #{kafkaName} and index_name = #{indexName} + + + + \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/com/bfd/mf/spring/applicationContext.xml b/cl_stream_mybatis/src/main/resources/com/bfd/mf/spring/applicationContext.xml new file mode 100644 index 0000000..f1aa6ed --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/com/bfd/mf/spring/applicationContext.xml @@ -0,0 +1,31 @@ + + + + + + classpath:/datasources.properties + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/datasources.properties b/cl_stream_mybatis/src/main/resources/datasources.properties new file mode 100644 index 0000000..8ef3802 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/datasources.properties @@ -0,0 +1,4 @@ +sms_username=0c44a92f900c5 +sms_password=100817121800010094 +sms_url=http://www.xcapi.net:18018/xcapi/smsApiSend.do +# diff --git a/cl_stream_mybatis/src/main/resources/log4j.properties b/cl_stream_mybatis/src/main/resources/log4j.properties new file mode 100644 index 0000000..5d6e92f --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/log4j.properties @@ -0,0 +1,18 @@ +log4j.rootLogger=DEBUG, error + +###### error appender definition ####### +log4j.appender.error=org.apache.log4j.DailyRollingFileAppender +log4j.appender.error.File=logs/sdkclient_error.log +log4j.appender.error.Append=true +log4j.appender.error.DatePattern='.'yyyy-MM-dd-HH +log4j.appender.error.layout=org.apache.log4j.PatternLayout +log4j.appender.error.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] %m%n + +#error only +log4j.appender.error.filter.F1=org.apache.log4j.varia.LevelRangeFilter +log4j.appender.error.filter.F1.LevelMin=ERROR +log4j.appender.error.filter.F1.LevelMax=ERROR +# +log4j.appender.error.filter.F2=org.apache.log4j.varia.LevelMatchFilter +log4j.appender.error.filter.F2.levelToMatch=WARN +log4j.appender.error.filter.F2.acceptOnMatch=false \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/AjaxObject.js b/cl_stream_mybatis/src/main/resources/static/scripts/AjaxObject.js new file mode 100644 index 0000000..d717d7a --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/AjaxObject.js @@ -0,0 +1,124 @@ +/*---------------------------- Ajax 请求对象 ----------------------------*/ + +/************************************************** + -- 属性: + url: 请求地址; + method: 请求方法(GET 或者 POST),默认为 GET; + flag: 异步或者同步请求(true 或者 false),默认为 true; + info: 请求参数,默认为 null,注:只有当请求方法为 POST 时,才被使用; + //isEval: 是否调用 eval() 函数(true 或者 false),默认为为 false; + //callback: 是否设置回调函数(true或者false),默认为 true; + result: Ajax 请求的响应结果 + + -- 方法: + executeRequest: 执行 Ajax 请求的方法; + onReady: 绑定函数到 req.onreadystatechange 事件; + dealResult: 只提供了函数名称,用来设置用户自己的函数。注:在用户自己的函数中,用来处理 Ajax 请求的返回结果。 +**************************************************/ +function Ajax(url, method, flag, info) { + this.url = url; + this.method = method || "GET"; + this.flag = (flag == false) ? false : (flag || true); + this.info = info || null; + //this.isEval = false; + //this.callback = true; + this.result = null; + var req = null; // req: XMLHttpRequest 对象; + + // 实例化 req 对象 + (function() { + if (window.XMLHttpRequest) { + req = new XMLHttpRequest(); + if (req.overrideMimeType) { + //req.overrideMimeType("text/xml"); + } + } else if (window.ActiveXObject) { + try { + req = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + req = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (e) { + alert("该浏览器不支持 Ajax !"); + req = null; + } + } + + /* Msxml2.XMLHTTP.5.0, 4.0, 3.0 都可以,2.0 和 1.0 不可以 + for (var i = 5; i; i--) { + try { + alert(i); + if (i != 2) { + req = new ActiveXObject("Msxml2.XMLHTTP." + i + ".0"); + } + + } catch (e) { + alert(e); + continue; + } + }*/ + } + }()); + this.executeRequest = function () { + if (!req || !this.url) { + alert("req 为空或者 url 为空!"); + return; + } + + if (this.url.indexOf("_id_=") != -1) { + // 不改变 + } else { + // 保证每次请求的 URL 都不一样,防止缓存 + var rand = "_id_=" + Math.random(); + if (this.url.indexOf("?") != -1) { + this.url += "&" + rand; + } else { + this.url += "?" + rand; + } + } + + /*// 判断,是否设置回调函数 + if (this.callback) { + this.onReady(req); + }*/ + // 设置回调函数 + this.onReady(req, this); + // 初始化 req 对象 + req.open(this.method, this.url, this.flag); + + // 判断,是否为 POST 请求 + if ((this.method.toUpperCase() == "POST") && this.info) { + req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + } + // 向服务器端发送请求 + req.send(this.info); + + /*// 判断,是否执行 eval() 函数 + if (this.isEval) { + eval(req.responseText); + }*/ + }; + this.onReady = function (req, ajax) { + req.onreadystatechange = function () { + if (req.readyState == 4) { + var result = req.responseText; + if (req.status == 200) { + ajax.result = result; + if (ajax.dealResult) { + ajax.dealResult(result); + } else { + var message = "请为 Ajax对象的 dealResult 设置回调函数!"; + message += "\r\n例如:Ajax对象.dealResult=function(result) { Your Code }"; + message += "\r\n其中,result 参数为服务器端返回的响应数据。"; + //alert(message); + } + } else { + //alert("响应错误!"); + + //alert(result); + } + } + }; + }; + this.dealResult; // = function(result) { }; +} diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery.TableExcel.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery.TableExcel.js new file mode 100644 index 0000000..5c42ee3 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery.TableExcel.js @@ -0,0 +1,203 @@ +/* +生成EXCEL的数据格式定义: +{ + name: '', + widths: [xxx,…,xxx], + clazz" '', + style: '', + data: [ + { + height: xxx, + clazz" '', + style: '', + cell: [ + { + range: 'xxx.xxx', + text: '', + clazz: '', + style: '' +},…{ +… +} +] + },…,{ + } +], …,[ +… +] +} +*/ +(function($) { + $.fn.exportTableData = function(options) { + var opts = $.extend({}, $.fn.exportTableData.defaults, options); + + var table = $(this[0]); + if (table.attr('nodeName').toUpperCase() != 'TABLE') + return null; + + var result = { + widths: [], + data: [] + }; + + readCSS(result, table); + + var cols = table.find('col'); + cols.each(function(i) { + result.widths[i] = $(this).width(); + }) + + var trs = table.find('tr'); + trs.each(function(row) { + var tr = $(this); + + result.data[row] = { + height: tr.height(), + cell: [] + }; + + readCSS(result.data[row], tr); + + var tds = tr.find('td'); + tds.each(function(col) { + var td = $(this); + + var val = td.html(); + if (opts.callback) + val = opts.callback(tr, td, row, col, val); + + result.data[row].cell[col] = { + text: val + } + + readRange(result.data[row].cell[col], td); + readCSS(result.data[row].cell[col], td); + }) + }) + + return result; + + function readRange(data, el) { + var rowSpan = el.attr('rowSpan'); + var colSpan = el.attr('colSpan'); + + rowSpan = rowSpan ? parseInt(rowSpan) : 1; + colSpan = colSpan ? parseInt(colSpan) : 1; + + if (rowSpan != 1 || colSpan != 1) + data.range = rowSpan + '.' + colSpan; + } + + function readCSS(data, el) { + var clazz = el.attr('class'); + if (clazz) + data.clazz = clazz; + + var style = el.attr('style'); + if (style) + data.style = style; + } + }; + + $.fn.exportTableData.defaults = { + callback: function(tr, td, row, col, val) { + return val; + } + }; + + $.fn.parseImportTableConfig = function(options) { + var opts = $.extend({}, $.fn.parseImportTableConfig.defaults, options); + + var table = $(this[0]); + if (table.attr('nodeName').toUpperCase() != 'TABLE') + return null; + + var result = ''; + + var trs = table.find('tr'); + trs.each(function(row) { + var tr = $(this); + + var tds = tr.find('td'); + tds.each(function(col) { + var td = $(this); + + if (opts.callback) { + if (opts.callback({ + tr: tr, + td: td, + row: row, + col: col + }) == false) + return; + } + + result += row + '.' + col + ' '; + }) + }) + + return result; + }; + + $.fn.parseImportTableConfig.defaults = { + callback: function(params) { + return true; + } + }; + + $.fn.importTableData = function(data, options) { + var opts = $.extend({}, $.fn.importTableData.defaults, options); + + var table = $(this[0]); + if (table.attr('nodeName').toUpperCase() != 'TABLE') + return null; + + var importTds = []; + + var trs = table.find('tr'); + trs.each(function(row) { + var tr = $(this); + + var tds = tr.find('td'); + tds.each(function(col) { + var td = $(this); + + var key = row + '.' + col; + if (typeof(data[key]) == 'undefined') + return; + + var params = { + tr: tr, + td: td, + row: row, + col: col, + val: data[key] + }; + + if (opts.callback) { + if (opts.callback(params) == false) + return; + } + + var val = params.val; + var orgVal = td.html(); + if (val != null && val != orgVal) { + td.html(val); + + importTds[importTds.length] = td; + } + }) + }) + + if (importTds.length > 0 && opts.finish) + opts.finish(importTds); + }; + + $.fn.importTableData.defaults = { + callback: function(params) { + return true; + }, + finish: function(tds) { + } + }; +})(jQuery); \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/jquery-1.3.2.min.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/jquery-1.3.2.min.js new file mode 100644 index 0000000..b1ae21d --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/jquery-1.3.2.min.js @@ -0,0 +1,19 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/plugins/ajaxfileupload.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/plugins/ajaxfileupload.js new file mode 100644 index 0000000..762aaf1 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/plugins/ajaxfileupload.js @@ -0,0 +1,209 @@ + +jQuery.extend({ + + + createUploadIframe: function(id, uri) + { + //create frame + var frameId = 'jUploadFrame' + id; + + if(window.ActiveXObject) { + var io = document.createElement('' : ''); + inst._keyEvent = false; + return html; + }, + + /* Generate the month and year header. */ + _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, + selectedDate, secondary, monthNames, monthNamesShort) { + minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate); + var changeMonth = this._get(inst, 'changeMonth'); + var changeYear = this._get(inst, 'changeYear'); + var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); + var html = '
'; + var monthHtml = ''; + // month selection + if (secondary || !changeMonth) + monthHtml += '' + monthNames[drawMonth] + ' '; + else { + var inMinYear = (minDate && minDate.getFullYear() == drawYear); + var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); + monthHtml += ''; + } + if (!showMonthAfterYear) + html += monthHtml + ((secondary || changeMonth || changeYear) && (!(changeMonth && changeYear)) ? ' ' : ''); + // year selection + if (secondary || !changeYear) + html += '' + drawYear + ''; + else { + // determine range of years to display + var years = this._get(inst, 'yearRange').split(':'); + var year = 0; + var endYear = 0; + if (years.length != 2) { + year = drawYear - 10; + endYear = drawYear + 10; + } else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') { + year = drawYear + parseInt(years[0], 10); + endYear = drawYear + parseInt(years[1], 10); + } else { + year = parseInt(years[0], 10); + endYear = parseInt(years[1], 10); + } + year = (minDate ? Math.max(year, minDate.getFullYear()) : year); + endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); + html += ''; + } + if (showMonthAfterYear) + html += (secondary || changeMonth || changeYear ? ' ' : '') + monthHtml; + html += '
'; // Close datepicker_header + return html; + }, + + /* Adjust one of the date sub-fields. */ + _adjustInstDate: function(inst, offset, period) { + var year = inst.drawYear + (period == 'Y' ? offset : 0); + var month = inst.drawMonth + (period == 'M' ? offset : 0); + var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + + (period == 'D' ? offset : 0); + var date = this._daylightSavingAdjust(new Date(year, month, day)); + // ensure it is within the bounds set + var minDate = this._getMinMaxDate(inst, 'min', true); + var maxDate = this._getMinMaxDate(inst, 'max'); + date = (minDate && date < minDate ? minDate : date); + date = (maxDate && date > maxDate ? maxDate : date); + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + if (period == 'M' || period == 'Y') + this._notifyChange(inst); + }, + + /* Notify change of month/year. */ + _notifyChange: function(inst) { + var onChange = this._get(inst, 'onChangeMonthYear'); + if (onChange) + onChange.apply((inst.input ? inst.input[0] : null), + [inst.selectedYear, inst.selectedMonth + 1, inst]); + }, + + /* Determine the number of months to show. */ + _getNumberOfMonths: function(inst) { + var numMonths = this._get(inst, 'numberOfMonths'); + return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); + }, + + /* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */ + _getMinMaxDate: function(inst, minMax, checkRange) { + var date = this._determineDate(this._get(inst, minMax + 'Date'), null); + return (!checkRange || !inst.rangeStart ? date : + (!date || inst.rangeStart > date ? inst.rangeStart : date)); + }, + + /* Find the number of days in a given month. */ + _getDaysInMonth: function(year, month) { + return 32 - new Date(year, month, 32).getDate(); + }, + + /* Find the day of the week of the first of a month. */ + _getFirstDayOfMonth: function(year, month) { + return new Date(year, month, 1).getDay(); + }, + + /* Determines if we should allow a "next/prev" month display change. */ + _canAdjustMonth: function(inst, offset, curYear, curMonth) { + var numMonths = this._getNumberOfMonths(inst); + var date = this._daylightSavingAdjust(new Date( + curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1)); + if (offset < 0) + date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); + return this._isInRange(inst, date); + }, + + /* Is the given date in the accepted range? */ + _isInRange: function(inst, date) { + // during range selection, use minimum of selected date and range start + var newMinDate = (!inst.rangeStart ? null : this._daylightSavingAdjust( + new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay))); + newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate); + var minDate = newMinDate || this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); + return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate)); + }, + + /* Provide the configuration settings for formatting/parsing. */ + _getFormatConfig: function(inst) { + var shortYearCutoff = this._get(inst, 'shortYearCutoff'); + shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : + new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); + return {shortYearCutoff: shortYearCutoff, + dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), + monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; + }, + + /* Format the given date for display. */ + _formatDate: function(inst, day, month, year) { + if (!day) { + inst.currentDay = inst.selectedDay; + inst.currentMonth = inst.selectedMonth; + inst.currentYear = inst.selectedYear; + } + var date = (day ? (typeof day == 'object' ? day : + this._daylightSavingAdjust(new Date(year, month, day))) : + this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); + return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); + } +}); + +/* jQuery extend now ignores nulls! */ +function extendRemove(target, props) { + $.extend(target, props); + for (var name in props) + if (props[name] == null || props[name] == undefined) + target[name] = props[name]; + return target; +}; + +/* Determine whether an object is an array. */ +function isArray(a) { + return (a && (($.browser.safari && typeof a == 'object' && a.length) || + (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); +}; + +/* Invoke the datepicker functionality. + @param options string - a command, optionally followed by additional parameters or + Object - settings for attaching new datepicker functionality + @return jQuery object */ +$.fn.datepicker = function(options){ + + /* Initialise the date picker. */ + if (!$.datepicker.initialized) { + $(document).mousedown($.datepicker._checkExternalClick). + find('body').append($.datepicker.dpDiv); + $.datepicker.initialized = true; + } + + var otherArgs = Array.prototype.slice.call(arguments, 1); + if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate')) + return $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this[0]].concat(otherArgs)); + return this.each(function() { + typeof options == 'string' ? + $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this].concat(otherArgs)) : + $.datepicker._attachDatepicker(this, options); + }); +}; + +$.datepicker = new Datepicker(); // singleton instance +$.datepicker.initialized = false; +$.datepicker.uuid = new Date().getTime(); +$.datepicker.version = "1.7"; + +// Workaround for #4055 +// Add another global to avoid noConflict issues with inline event handlers +window.DP_jQuery = $; + +})(jQuery); +/* + * jQuery UI Progressbar 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Progressbar + * + * Depends: + * ui.core.js + */ +(function($) { + +$.widget("ui.progressbar", { + + _init: function() { + + this.element + .addClass("ui-progressbar" + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all") + .attr({ + role: "progressbar", + "aria-valuemin": this._valueMin(), + "aria-valuemax": this._valueMax(), + "aria-valuenow": this._value() + }); + + this.valueDiv = $('
').appendTo(this.element); + + this._refreshValue(); + + }, + + destroy: function() { + + this.element + .removeClass("ui-progressbar" + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all") + .removeAttr("role") + .removeAttr("aria-valuemin") + .removeAttr("aria-valuemax") + .removeAttr("aria-valuenow") + .removeData("progressbar") + .unbind(".progressbar"); + + this.valueDiv.remove(); + + $.widget.prototype.destroy.apply(this, arguments); + + }, + + value: function(newValue) { + arguments.length && this._setData("value", newValue); + return this._value(); + }, + + _setData: function(key, value) { + + switch (key) { + case 'value': + this.options.value = value; + this._refreshValue(); + this._trigger('change', null, {}); + break; + } + + $.widget.prototype._setData.apply(this, arguments); + + }, + + _value: function() { + + var val = this.options.value; + if (val < this._valueMin()) val = this._valueMin(); + if (val > this._valueMax()) val = this._valueMax(); + + return val; + + }, + + _valueMin: function() { + var valueMin = 0; + return valueMin; + }, + + _valueMax: function() { + var valueMax = 100; + return valueMax; + }, + + _refreshValue: function() { + var value = this.value(); + this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right"); + this.valueDiv.width(value + '%'); + this.element.attr("aria-valuenow", value); + } + +}); + +$.extend($.ui.progressbar, { + version: "1.7", + defaults: { + value: 0 + } +}); + +})(jQuery); +/* + * jQuery UI Effects 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/ + */ +;jQuery.effects || (function($) { + +$.effects = { + version: "1.7", + + // Saves a set of properties in a data storage + save: function(element, set) { + for(var i=0; i < set.length; i++) { + if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]); + } + }, + + // Restores a set of previously saved properties from a data storage + restore: function(element, set) { + for(var i=0; i < set.length; i++) { + if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i])); + } + }, + + setMode: function(el, mode) { + if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle + return mode; + }, + + getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value + // this should be a little more flexible in the future to handle a string & hash + var y, x; + switch (origin[0]) { + case 'top': y = 0; break; + case 'middle': y = 0.5; break; + case 'bottom': y = 1; break; + default: y = origin[0] / original.height; + }; + switch (origin[1]) { + case 'left': x = 0; break; + case 'center': x = 0.5; break; + case 'right': x = 1; break; + default: x = origin[1] / original.width; + }; + return {x: x, y: y}; + }, + + // Wraps the element around a wrapper that copies position properties + createWrapper: function(element) { + + //if the element is already wrapped, return it + if (element.parent().is('.ui-effects-wrapper')) + return element.parent(); + + //Cache width,height and float properties of the element, and create a wrapper around it + var props = { width: element.outerWidth(true), height: element.outerHeight(true), 'float': element.css('float') }; + element.wrap('
'); + var wrapper = element.parent(); + + //Transfer the positioning of the element to the wrapper + if (element.css('position') == 'static') { + wrapper.css({ position: 'relative' }); + element.css({ position: 'relative'} ); + } else { + var top = element.css('top'); if(isNaN(parseInt(top,10))) top = 'auto'; + var left = element.css('left'); if(isNaN(parseInt(left,10))) left = 'auto'; + wrapper.css({ position: element.css('position'), top: top, left: left, zIndex: element.css('z-index') }).show(); + element.css({position: 'relative', top: 0, left: 0 }); + } + + wrapper.css(props); + return wrapper; + }, + + removeWrapper: function(element) { + if (element.parent().is('.ui-effects-wrapper')) + return element.parent().replaceWith(element); + return element; + }, + + setTransition: function(element, list, factor, value) { + value = value || {}; + $.each(list, function(i, x){ + unit = element.cssUnit(x); + if (unit[0] > 0) value[x] = unit[0] * factor + unit[1]; + }); + return value; + }, + + //Base function to animate from one class to another in a seamless transition + animateClass: function(value, duration, easing, callback) { + + var cb = (typeof easing == "function" ? easing : (callback ? callback : null)); + var ea = (typeof easing == "string" ? easing : null); + + return this.each(function() { + + var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || ''; + if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */ + if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; } + + //Let's get a style offset + var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle)); + if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove); + var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle)); + if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove); + + // The main function to form the object for animation + for(var n in newStyle) { + if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */ + && n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */ + && newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */ + && (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */ + && (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */ + ) offset[n] = newStyle[n]; + } + + that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object + // Change style attribute back to original. For stupid IE, we need to clear the damn object. + if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr); + if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove); + if(cb) cb.apply(this, arguments); + }); + + }); + } +}; + + +function _normalizeArguments(a, m) { + + var o = a[1] && a[1].constructor == Object ? a[1] : {}; if(m) o.mode = m; + var speed = a[1] && a[1].constructor != Object ? a[1] : (o.duration ? o.duration : a[2]); //either comes from options.duration or the secon/third argument + speed = $.fx.off ? 0 : typeof speed === "number" ? speed : $.fx.speeds[speed] || $.fx.speeds._default; + var callback = o.callback || ( $.isFunction(a[1]) && a[1] ) || ( $.isFunction(a[2]) && a[2] ) || ( $.isFunction(a[3]) && a[3] ); + + return [a[0], o, speed, callback]; + +} + +//Extend the methods of jQuery +$.fn.extend({ + + //Save old methods + _show: $.fn.show, + _hide: $.fn.hide, + __toggle: $.fn.toggle, + _addClass: $.fn.addClass, + _removeClass: $.fn.removeClass, + _toggleClass: $.fn.toggleClass, + + // New effect methods + effect: function(fx, options, speed, callback) { + return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: options || {}, duration: speed, callback: callback }) : null; + }, + + show: function() { + if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) + return this._show.apply(this, arguments); + else { + return this.effect.apply(this, _normalizeArguments(arguments, 'show')); + } + }, + + hide: function() { + if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) + return this._hide.apply(this, arguments); + else { + return this.effect.apply(this, _normalizeArguments(arguments, 'hide')); + } + }, + + toggle: function(){ + if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) || (arguments[0].constructor == Function)) + return this.__toggle.apply(this, arguments); + else { + return this.effect.apply(this, _normalizeArguments(arguments, 'toggle')); + } + }, + + addClass: function(classNames, speed, easing, callback) { + return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames); + }, + removeClass: function(classNames,speed,easing,callback) { + return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames); + }, + toggleClass: function(classNames,speed,easing,callback) { + return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed); + }, + morph: function(remove,add,speed,easing,callback) { + return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]); + }, + switchClass: function() { + return this.morph.apply(this, arguments); + }, + + // helper functions + cssUnit: function(key) { + var style = this.css(key), val = []; + $.each( ['em','px','%','pt'], function(i, unit){ + if(style.indexOf(unit) > 0) + val = [parseFloat(style), unit]; + }); + return val; + } +}); + +/* + * jQuery Color Animations + * Copyright 2007 John Resig + * Released under the MIT and GPL licenses. + */ + +// We override the animation for all of these color styles +$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ + $.fx.step[attr] = function(fx) { + if ( fx.state == 0 ) { + fx.start = getColor( fx.elem, attr ); + fx.end = getRGB( fx.end ); + } + + fx.elem.style[attr] = "rgb(" + [ + Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0],10), 255), 0), + Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1],10), 255), 0), + Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2],10), 255), 0) + ].join(",") + ")"; + }; +}); + +// Color Conversion functions from highlightFade +// By Blair Mitchelmore +// http://jquery.offput.ca/highlightFade/ + +// Parse strings looking for color tuples [255,255,255] +function getRGB(color) { + var result; + + // Check if we're already dealing with an array of colors + if ( color && color.constructor == Array && color.length == 3 ) + return color; + + // Look for rgb(num,num,num) + if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) + return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; + + // Look for rgb(num%,num%,num%) + if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) + return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; + + // Look for #a0b1c2 + if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) + return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; + + // Look for #fff + if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) + return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; + + // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 + if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) + return colors['transparent']; + + // Otherwise, we're most likely dealing with a named color + return colors[$.trim(color).toLowerCase()]; +} + +function getColor(elem, attr) { + var color; + + do { + color = $.curCSS(elem, attr); + + // Keep going until we find an element that has color, or we hit the body + if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") ) + break; + + attr = "backgroundColor"; + } while ( elem = elem.parentNode ); + + return getRGB(color); +}; + +// Some named colors to work with +// From Interface by Stefan Petre +// http://interface.eyecon.ro/ + +var colors = { + aqua:[0,255,255], + azure:[240,255,255], + beige:[245,245,220], + black:[0,0,0], + blue:[0,0,255], + brown:[165,42,42], + cyan:[0,255,255], + darkblue:[0,0,139], + darkcyan:[0,139,139], + darkgrey:[169,169,169], + darkgreen:[0,100,0], + darkkhaki:[189,183,107], + darkmagenta:[139,0,139], + darkolivegreen:[85,107,47], + darkorange:[255,140,0], + darkorchid:[153,50,204], + darkred:[139,0,0], + darksalmon:[233,150,122], + darkviolet:[148,0,211], + fuchsia:[255,0,255], + gold:[255,215,0], + green:[0,128,0], + indigo:[75,0,130], + khaki:[240,230,140], + lightblue:[173,216,230], + lightcyan:[224,255,255], + lightgreen:[144,238,144], + lightgrey:[211,211,211], + lightpink:[255,182,193], + lightyellow:[255,255,224], + lime:[0,255,0], + magenta:[255,0,255], + maroon:[128,0,0], + navy:[0,0,128], + olive:[128,128,0], + orange:[255,165,0], + pink:[255,192,203], + purple:[128,0,128], + violet:[128,0,128], + red:[255,0,0], + silver:[192,192,192], + white:[255,255,255], + yellow:[255,255,0], + transparent: [255,255,255] +}; + +/* + * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ + * + * Uses the built in easing capabilities added In jQuery 1.1 + * to offer multiple easing options + * + * TERMS OF USE - jQuery Easing + * + * Open source under the BSD License. + * + * Copyright 2008 George McGinley Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * +*/ + +// t: current time, b: begInnIng value, c: change In value, d: duration +$.easing.jswing = $.easing.swing; + +$.extend($.easing, +{ + def: 'easeOutQuad', + swing: function (x, t, b, c, d) { + //alert($.easing.default); + return $.easing[$.easing.def](x, t, b, c, d); + }, + easeInQuad: function (x, t, b, c, d) { + return c*(t/=d)*t + b; + }, + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + }, + easeInOutQuad: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + }, + easeInCubic: function (x, t, b, c, d) { + return c*(t/=d)*t*t + b; + }, + easeOutCubic: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t + 1) + b; + }, + easeInOutCubic: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + }, + easeInQuart: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t + b; + }, + easeOutQuart: function (x, t, b, c, d) { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + }, + easeInOutQuart: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + }, + easeInQuint: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t*t + b; + }, + easeOutQuint: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + }, + easeInOutQuint: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + }, + easeInSine: function (x, t, b, c, d) { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + }, + easeOutSine: function (x, t, b, c, d) { + return c * Math.sin(t/d * (Math.PI/2)) + b; + }, + easeInOutSine: function (x, t, b, c, d) { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + }, + easeInExpo: function (x, t, b, c, d) { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; + }, + easeOutExpo: function (x, t, b, c, d) { + return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; + }, + easeInOutExpo: function (x, t, b, c, d) { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; + return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; + }, + easeInCirc: function (x, t, b, c, d) { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + }, + easeOutCirc: function (x, t, b, c, d) { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + }, + easeInOutCirc: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + }, + easeInElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + }, + easeOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; + }, + easeInOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + }, + easeInBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*(t/=d)*t*((s+1)*t - s) + b; + }, + easeOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + }, + easeInOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + }, + easeInBounce: function (x, t, b, c, d) { + return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b; + }, + easeOutBounce: function (x, t, b, c, d) { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + }, + easeInOutBounce: function (x, t, b, c, d) { + if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; + return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; + } +}); + +/* + * + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +})(jQuery); +/* + * jQuery UI Effects Blind 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Blind + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.blind = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['position','top','left']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode + var direction = o.options.direction || 'vertical'; // Default direction + + // Adjust + $.effects.save(el, props); el.show(); // Save & Show + var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper + var ref = (direction == 'vertical') ? 'height' : 'width'; + var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width(); + if(mode == 'show') wrapper.css(ref, 0); // Shift + + // Animation + var animation = {}; + animation[ref] = mode == 'show' ? distance : 0; + + // Animate + wrapper.animate(animation, o.duration, o.options.easing, function() { + if(mode == 'hide') el.hide(); // Hide + $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore + if(o.callback) o.callback.apply(el[0], arguments); // Callback + el.dequeue(); + }); + + }); + +}; + +})(jQuery); +/* + * jQuery UI Effects Bounce 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Bounce + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.bounce = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['position','top','left']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode + var direction = o.options.direction || 'up'; // Default direction + var distance = o.options.distance || 20; // Default distance + var times = o.options.times || 5; // Default # of times + var speed = o.duration || 250; // Default speed per bounce + if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE + + // Adjust + $.effects.save(el, props); el.show(); // Save & Show + $.effects.createWrapper(el); // Create Wrapper + var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; + var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; + var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3); + if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift + if (mode == 'hide') distance = distance / (times * 2); + if (mode != 'hide') times--; + + // Animate + if (mode == 'show') { // Show Bounce + var animation = {opacity: 1}; + animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance; + el.animate(animation, speed / 2, o.options.easing); + distance = distance / 2; + times--; + }; + for (var i = 0; i < times; i++) { // Bounces + var animation1 = {}, animation2 = {}; + animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; + animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; + el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing); + distance = (mode == 'hide') ? distance * 2 : distance / 2; + }; + if (mode == 'hide') { // Last Bounce + var animation = {opacity: 0}; + animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; + el.animate(animation, speed / 2, o.options.easing, function(){ + el.hide(); // Hide + $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore + if(o.callback) o.callback.apply(this, arguments); // Callback + }); + } else { + var animation1 = {}, animation2 = {}; + animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; + animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; + el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){ + $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore + if(o.callback) o.callback.apply(this, arguments); // Callback + }); + }; + el.queue('fx', function() { el.dequeue(); }); + el.dequeue(); + }); + +}; + +})(jQuery); +/* + * jQuery UI Effects Clip 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Clip + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.clip = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['position','top','left','height','width']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode + var direction = o.options.direction || 'vertical'; // Default direction + + // Adjust + $.effects.save(el, props); el.show(); // Save & Show + var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper + var animate = el[0].tagName == 'IMG' ? wrapper : el; + var ref = { + size: (direction == 'vertical') ? 'height' : 'width', + position: (direction == 'vertical') ? 'top' : 'left' + }; + var distance = (direction == 'vertical') ? animate.height() : animate.width(); + if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift + + // Animation + var animation = {}; + animation[ref.size] = mode == 'show' ? distance : 0; + animation[ref.position] = mode == 'show' ? 0 : distance / 2; + + // Animate + animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { + if(mode == 'hide') el.hide(); // Hide + $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore + if(o.callback) o.callback.apply(el[0], arguments); // Callback + el.dequeue(); + }}); + + }); + +}; + +})(jQuery); +/* + * jQuery UI Effects Drop 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Drop + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.drop = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['position','top','left','opacity']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode + var direction = o.options.direction || 'left'; // Default Direction + + // Adjust + $.effects.save(el, props); el.show(); // Save & Show + $.effects.createWrapper(el); // Create Wrapper + var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; + var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; + var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2); + if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift + + // Animation + var animation = {opacity: mode == 'show' ? 1 : 0}; + animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; + + // Animate + el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { + if(mode == 'hide') el.hide(); // Hide + $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore + if(o.callback) o.callback.apply(this, arguments); // Callback + el.dequeue(); + }}); + + }); + +}; + +})(jQuery); +/* + * jQuery UI Effects Explode 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Explode + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.explode = function(o) { + + return this.queue(function() { + + var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; + var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; + + o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode; + var el = $(this).show().css('visibility', 'hidden'); + var offset = el.offset(); + + //Substract the margins - not fixing the problem yet. + offset.top -= parseInt(el.css("marginTop"),10) || 0; + offset.left -= parseInt(el.css("marginLeft"),10) || 0; + + var width = el.outerWidth(true); + var height = el.outerHeight(true); + + for(var i=0;i
') + .css({ + position: 'absolute', + visibility: 'visible', + left: -j*(width/cells), + top: -i*(height/rows) + }) + .parent() + .addClass('ui-effects-explode') + .css({ + position: 'absolute', + overflow: 'hidden', + width: width/cells, + height: height/rows, + left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0), + top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0), + opacity: o.options.mode == 'show' ? 0 : 1 + }).animate({ + left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)), + top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)), + opacity: o.options.mode == 'show' ? 1 : 0 + }, o.duration || 500); + } + } + + // Set a timeout, to call the callback approx. when the other animations have finished + setTimeout(function() { + + o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide(); + if(o.callback) o.callback.apply(el[0]); // Callback + el.dequeue(); + + $('div.ui-effects-explode').remove(); + + }, o.duration || 500); + + + }); + +}; + +})(jQuery); +/* + * jQuery UI Effects Fold 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.fold = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['position','top','left']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode + var size = o.options.size || 15; // Default fold size + var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value + var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2; + + // Adjust + $.effects.save(el, props); el.show(); // Save & Show + var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper + var widthFirst = ((mode == 'show') != horizFirst); + var ref = widthFirst ? ['width', 'height'] : ['height', 'width']; + var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()]; + var percent = /([0-9]+)%/.exec(size); + if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1]; + if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift + + // Animation + var animation1 = {}, animation2 = {}; + animation1[ref[0]] = mode == 'show' ? distance[0] : size; + animation2[ref[1]] = mode == 'show' ? distance[1] : 0; + + // Animate + wrapper.animate(animation1, duration, o.options.easing) + .animate(animation2, duration, o.options.easing, function() { + if(mode == 'hide') el.hide(); // Hide + $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore + if(o.callback) o.callback.apply(el[0], arguments); // Callback + el.dequeue(); + }); + + }); + +}; + +})(jQuery); +/* + * jQuery UI Effects Highlight 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.highlight = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['backgroundImage','backgroundColor','opacity']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode + var color = o.options.color || "#ffff99"; // Default highlight color + var oldColor = el.css("backgroundColor"); + + // Adjust + $.effects.save(el, props); el.show(); // Save & Show + el.css({backgroundImage: 'none', backgroundColor: color}); // Shift + + // Animation + var animation = {backgroundColor: oldColor }; + if (mode == "hide") animation['opacity'] = 0; + + // Animate + el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { + if(mode == "hide") el.hide(); + $.effects.restore(el, props); + if (mode == "show" && $.browser.msie) this.style.removeAttribute('filter'); + if(o.callback) o.callback.apply(this, arguments); + el.dequeue(); + }}); + + }); + +}; + +})(jQuery); +/* + * jQuery UI Effects Pulsate 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.pulsate = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this); + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode + var times = o.options.times || 5; // Default # of times + var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2; + + // Adjust + if (mode == 'hide') times--; + if (el.is(':hidden')) { // Show fadeIn + el.css('opacity', 0); + el.show(); // Show + el.animate({opacity: 1}, duration, o.options.easing); + times = times-2; + } + + // Animate + for (var i = 0; i < times; i++) { // Pulsate + el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing); + }; + if (mode == 'hide') { // Last Pulse + el.animate({opacity: 0}, duration, o.options.easing, function(){ + el.hide(); // Hide + if(o.callback) o.callback.apply(this, arguments); // Callback + }); + } else { + el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing, function(){ + if(o.callback) o.callback.apply(this, arguments); // Callback + }); + }; + el.queue('fx', function() { el.dequeue(); }); + el.dequeue(); + }); + +}; + +})(jQuery); +/* + * jQuery UI Effects Scale 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Scale + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.puff = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this); + + // Set options + var options = $.extend(true, {}, o.options); + var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode + var percent = parseInt(o.options.percent,10) || 150; // Set default puff percent + options.fade = true; // It's not a puff if it doesn't fade! :) + var original = {height: el.height(), width: el.width()}; // Save original + + // Adjust + var factor = percent / 100; + el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor}; + + // Animation + options.from = el.from; + options.percent = (mode == 'hide') ? percent : 100; + options.mode = mode; + + // Animate + el.effect('scale', options, o.duration, o.callback); + el.dequeue(); + }); + +}; + +$.effects.scale = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this); + + // Set options + var options = $.extend(true, {}, o.options); + var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode + var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent + var direction = o.options.direction || 'both'; // Set default axis + var origin = o.options.origin; // The origin of the scaling + if (mode != 'effect') { // Set default origin and restore for show/hide + options.origin = origin || ['middle','center']; + options.restore = true; + } + var original = {height: el.height(), width: el.width()}; // Save original + el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state + + // Adjust + var factor = { // Set scaling factor + y: direction != 'horizontal' ? (percent / 100) : 1, + x: direction != 'vertical' ? (percent / 100) : 1 + }; + el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state + + if (o.options.fade) { // Fade option to support puff + if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;}; + if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;}; + }; + + // Animation + options.from = el.from; options.to = el.to; options.mode = mode; + + // Animate + el.effect('size', options, o.duration, o.callback); + el.dequeue(); + }); + +}; + +$.effects.size = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['position','top','left','width','height','overflow','opacity']; + var props1 = ['position','top','left','overflow','opacity']; // Always restore + var props2 = ['width','height','overflow']; // Copy for children + var cProps = ['fontSize']; + var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom']; + var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode + var restore = o.options.restore || false; // Default restore + var scale = o.options.scale || 'both'; // Default scale mode + var origin = o.options.origin; // The origin of the sizing + var original = {height: el.height(), width: el.width()}; // Save original + el.from = o.options.from || original; // Default from state + el.to = o.options.to || original; // Default to state + // Adjust + if (origin) { // Calculate baseline shifts + var baseline = $.effects.getBaseline(origin, original); + el.from.top = (original.height - el.from.height) * baseline.y; + el.from.left = (original.width - el.from.width) * baseline.x; + el.to.top = (original.height - el.to.height) * baseline.y; + el.to.left = (original.width - el.to.width) * baseline.x; + }; + var factor = { // Set scaling factor + from: {y: el.from.height / original.height, x: el.from.width / original.width}, + to: {y: el.to.height / original.height, x: el.to.width / original.width} + }; + if (scale == 'box' || scale == 'both') { // Scale the css box + if (factor.from.y != factor.to.y) { // Vertical props scaling + props = props.concat(vProps); + el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from); + el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to); + }; + if (factor.from.x != factor.to.x) { // Horizontal props scaling + props = props.concat(hProps); + el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from); + el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to); + }; + }; + if (scale == 'content' || scale == 'both') { // Scale the content + if (factor.from.y != factor.to.y) { // Vertical props scaling + props = props.concat(cProps); + el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from); + el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to); + }; + }; + $.effects.save(el, restore ? props : props1); el.show(); // Save & Show + $.effects.createWrapper(el); // Create Wrapper + el.css('overflow','hidden').css(el.from); // Shift + + // Animate + if (scale == 'content' || scale == 'both') { // Scale the children + vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size + hProps = hProps.concat(['marginLeft','marginRight']); // Add margins + props2 = props.concat(vProps).concat(hProps); // Concat + el.find("*[width]").each(function(){ + child = $(this); + if (restore) $.effects.save(child, props2); + var c_original = {height: child.height(), width: child.width()}; // Save original + child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x}; + child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x}; + if (factor.from.y != factor.to.y) { // Vertical props scaling + child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from); + child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to); + }; + if (factor.from.x != factor.to.x) { // Horizontal props scaling + child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from); + child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to); + }; + child.css(child.from); // Shift children + child.animate(child.to, o.duration, o.options.easing, function(){ + if (restore) $.effects.restore(child, props2); // Restore children + }); // Animate children + }); + }; + + // Animate + el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { + if(mode == 'hide') el.hide(); // Hide + $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore + if(o.callback) o.callback.apply(this, arguments); // Callback + el.dequeue(); + }}); + + }); + +}; + +})(jQuery); +/* + * jQuery UI Effects Shake 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Shake + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.shake = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['position','top','left']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode + var direction = o.options.direction || 'left'; // Default direction + var distance = o.options.distance || 20; // Default distance + var times = o.options.times || 3; // Default # of times + var speed = o.duration || o.options.duration || 140; // Default speed per shake + + // Adjust + $.effects.save(el, props); el.show(); // Save & Show + $.effects.createWrapper(el); // Create Wrapper + var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; + var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; + + // Animation + var animation = {}, animation1 = {}, animation2 = {}; + animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; + animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2; + animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2; + + // Animate + el.animate(animation, speed, o.options.easing); + for (var i = 1; i < times; i++) { // Shakes + el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing); + }; + el.animate(animation1, speed, o.options.easing). + animate(animation, speed / 2, o.options.easing, function(){ // Last shake + $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore + if(o.callback) o.callback.apply(this, arguments); // Callback + }); + el.queue('fx', function() { el.dequeue(); }); + el.dequeue(); + }); + +}; + +})(jQuery); +/* + * jQuery UI Effects Slide 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Slide + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.slide = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['position','top','left']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode + var direction = o.options.direction || 'left'; // Default Direction + + // Adjust + $.effects.save(el, props); el.show(); // Save & Show + $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper + var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; + var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; + var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true})); + if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift + + // Animation + var animation = {}; + animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; + + // Animate + el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { + if(mode == 'hide') el.hide(); // Hide + $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore + if(o.callback) o.callback.apply(this, arguments); // Callback + el.dequeue(); + }}); + + }); + +}; + +})(jQuery); +/* + * jQuery UI Effects Transfer 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Transfer + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.transfer = function(o) { + return this.queue(function() { + var elem = $(this), + target = $(o.options.to), + endPosition = target.offset(), + animation = { + top: endPosition.top, + left: endPosition.left, + height: target.innerHeight(), + width: target.innerWidth() + }, + startPosition = elem.offset(), + transfer = $('
') + .appendTo(document.body) + .addClass(o.options.className) + .css({ + top: startPosition.top, + left: startPosition.left, + height: elem.innerHeight(), + width: elem.innerWidth(), + position: 'absolute' + }) + .animate(animation, o.duration, o.options.easing, function() { + transfer.remove(); + (o.callback && o.callback.apply(elem[0], arguments)); + elem.dequeue(); + }); + }); +}; + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/jquery-ui-1.7.custom.min.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/jquery-ui-1.7.custom.min.js new file mode 100644 index 0000000..9831410 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/jquery-ui-1.7.custom.min.js @@ -0,0 +1,273 @@ +/* + * jQuery UI 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI + */ jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/* + * jQuery UI Draggable 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * ui.core.js + */ (function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.leftthis.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.topthis.containment[3])?g:(!(g-this.offset.click.topthis.containment[2])?f:(!(f-this.offset.click.left').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y=p&&n<=k)||(m>=p&&m<=k)||(nk))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(ec));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];var f=g?g.type:null;var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidthk.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=h._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/h.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*h.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);;/* + * jQuery UI Selectable 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Selectables + * + * Depends: + * ui.core.js + */ (function(a){a.widget("ui.selectable",a.extend({},a.ui.mouse,{_init:function(){var b=this;this.element.addClass("ui-selectable");this.dragged=false;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]);c.each(function(){var d=a(this);var e=d.offset();a.data(this,"selectable-item",{element:this,$element:d,left:e.left,top:e.top,right:e.left+d.outerWidth(),bottom:e.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=c.addClass("ui-selectee");this._mouseInit();this.helper=a(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(d){var b=this;this.opos=[d.pageX,d.pageY];if(this.options.disabled){return}var c=this.options;this.selectees=a(c.filter,this.element[0]);this._trigger("start",d);a("body").append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:d.clientX,top:d.clientY,width:0,height:0});if(c.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var e=a.data(this,"selectable-item");e.startselected=true;if(!d.metaKey){e.$element.removeClass("ui-selected");e.selected=false;e.$element.addClass("ui-unselecting");e.unselecting=true;b._trigger("unselecting",d,{unselecting:e.element})}});a(d.target).parents().andSelf().each(function(){var e=a.data(this,"selectable-item");if(e){e.$element.removeClass("ui-unselecting").addClass("ui-selecting");e.unselecting=false;e.selecting=true;e.selected=true;b._trigger("selecting",d,{selecting:e.element});return false}})},_mouseDrag:function(i){var c=this;this.dragged=true;if(this.options.disabled){return}var e=this.options;var d=this.opos[0],h=this.opos[1],b=i.pageX,g=i.pageY;if(d>b){var f=b;b=d;d=f}if(h>g){var f=g;g=h;h=f}this.helper.css({left:d,top:h,width:b-d,height:g-h});this.selectees.each(function(){var j=a.data(this,"selectable-item");if(!j||j.element==c.element[0]){return}var k=false;if(e.tolerance=="touch"){k=(!(j.left>b||j.rightg||j.bottomd&&j.righth&&j.bottom=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)f&&(e+h)m[this.floating?"width":"height"])){return g}else{return(f0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.topthis.containment[3])?g:(!(g-this.offset.click.topthis.containment[2])?f:(!(f-this.offset.click.left=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);;/* + * jQuery UI Accordion 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Accordion + * + * Depends: + * ui.core.js + */ (function(a){a.widget("ui.accordion",{_init:function(){var d=this.options,b=this;this.running=0;if(d.collapsible==a.ui.accordion.defaults.collapsible&&d.alwaysOpen!=a.ui.accordion.defaults.alwaysOpen){d.collapsible=!d.alwaysOpen}if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);if(c.length){if(c.filter(d.header).length){this.active=c}else{this.active=c.parent().parent().prev();c.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");a("").addClass("ui-icon "+d.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(d.icons.header).toggleClass(d.icons.headerSelected);if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(e){return b._keydown(e)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(d.event){this.headers.bind((d.event)+".accordion",function(e){return b._clickHandler.call(b,e,this)})}},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(c.autoHeight||c.fillHeight){b.css("height","")}},_setData:function(b,c){if(b=="alwaysOpen"){b="collapsible";c=!c}a.widget.prototype._setData.apply(this,arguments)},_keydown:function(e){var g=this.options,f=a.ui.keyCode;if(g.disabled||e.altKey||e.ctrlKey){return}var d=this.headers.length;var b=this.headers.index(e.target);var c=false;switch(e.keyCode){case f.RIGHT:case f.DOWN:c=this.headers[(b+1)%d];break;case f.LEFT:case f.UP:c=this.headers[(b-1+d)%d];break;case f.SPACE:case f.ENTER:return this._clickHandler({target:e.target},e.target)}if(c){a(e.target).attr("tabIndex","-1");a(c).attr("tabIndex","0");c.focus();return false}return true},resize:function(){var e=this.options,d;if(e.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}d=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",b)}this.headers.each(function(){d-=a(this).outerHeight()});var c=0;this.headers.next().each(function(){c=Math.max(c,a(this).innerHeight()-a(this).height())}).height(Math.max(0,d-c)).css("overflow","auto")}else{if(e.autoHeight){d=0;this.headers.next().each(function(){d=Math.max(d,a(this).outerHeight())}).height(d)}}},activate:function(b){var c=this._findActive(b)[0];this._clickHandler({target:c},c)},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,f){var d=this.options;if(d.disabled){return false}if(!b.target&&d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var h=this.active.next(),e={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:h},c=(this.active=a([]));this._toggle(c,h,e);return false}var g=a(b.currentTarget||f);var i=g[0]==this.active[0];if(this.running||(!d.collapsible&&i)){return false}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!i){g.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);g.next().addClass("ui-accordion-content-active")}var c=g.next(),h=this.active.next(),e={options:d,newHeader:i&&d.collapsible?a([]):g,oldHeader:this.active,newContent:i&&d.collapsible?a([]):c.find("> *"),oldContent:h.find("> *")},j=this.headers.index(this.active[0])>this.headers.index(g[0]);this.active=i?a([]):g;this._toggle(c,h,e,i,j);return false},_toggle:function(b,i,g,j,k){var d=this.options,m=this;this.toShow=b;this.toHide=i;this.data=g;var c=function(){if(!m){return}return m._completed.apply(m,arguments)};this._trigger("changestart",null,this.data);this.running=i.size()===0?b.size():i.size();if(d.animated){var f={};if(d.collapsible&&j){f={toShow:a([]),toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}else{f={toShow:b,toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}if(!d.proxied){d.proxied=d.animated}if(!d.proxiedDuration){d.proxiedDuration=d.duration}d.animated=a.isFunction(d.proxied)?d.proxied(f):d.proxied;d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(f):d.proxiedDuration;var l=a.ui.accordion.animations,e=d.duration,h=d.animated;if(!l[h]){l[h]=function(n){this.slide(n,{easing:h,duration:e||700})}}l[h](f)}else{if(d.collapsible&&j){b.toggle()}else{i.hide();b.show()}c(true)}i.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.7",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(j,h){j=a.extend({easing:"swing",duration:300},j,h);if(!j.toHide.size()){j.toShow.animate({height:"show"},j);return}if(!j.toShow.size()){j.toHide.animate({height:"hide"},j);return}var c=j.toShow.css("overflow"),g,d={},f={},e=["height","paddingTop","paddingBottom"],b;var i=j.toShow;b=i[0].style.width;i.width(parseInt(i.parent().width(),10)-parseInt(i.css("paddingLeft"),10)-parseInt(i.css("paddingRight"),10)-parseInt(i.css("borderLeftWidth"),10)-parseInt(i.css("borderRightWidth"),10));a.each(e,function(k,m){f[m]="hide";var l=(""+a.css(j.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);d[m]={value:l[1],unit:l[2]||"px"}});j.toShow.css({height:0,overflow:"hidden"}).show();j.toHide.filter(":hidden").each(j.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){g=(l.now-l.start)/(l.end-l.start)}j.toShow[0].style[l.prop]=(g*d[l.prop].value)+d[l.prop].unit},duration:j.duration,easing:j.easing,complete:function(){if(!j.autoHeight){j.toShow.css("height","")}j.toShow.css("width",b);j.toShow.css({overflow:c});j.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})}}})})(jQuery);;/* + * jQuery UI Dialog 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Dialog + * + * Depends: + * ui.core.js + * ui.draggable.js + * ui.resizable.js + */ (function(c){var b={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},a="ui-dialog ui-widget ui-widget-content ui-corner-all ";c.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var l=this,m=this.options,j=m.title||this.originalTitle||" ",e=c.ui.dialog.getTitleId(this.element),k=(this.uiDialog=c("
")).appendTo(document.body).hide().addClass(a+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==c.ui.keyCode.ESCAPE&&l.close(n))}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(n){l.moveToTop(false,n)}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=c("
")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=c('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(n){l.close(n);return false}).appendTo(f),h=(this.uiDialogTitlebarCloseText=c("")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),d=c("").addClass("ui-dialog-title").attr("id",e).html(j).prependTo(f);f.find("*").add(f).disableSelection();(m.draggable&&c.fn.draggable&&this._makeDraggable());(m.resizable&&c.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&c.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(e){var d=this;if(false===d._trigger("beforeclose",e)){return}(d.overlay&&d.overlay.destroy());d.uiDialog.unbind("keypress.ui-dialog");(d.options.hide?d.uiDialog.hide(d.options.hide,function(){d._trigger("close",e)}):d.uiDialog.hide()&&d._trigger("close",e));c.ui.dialog.overlay.resize();d._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(f,e){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",e)}if(this.options.zIndex>c.ui.dialog.maxZ){c.ui.dialog.maxZ=this.options.zIndex}(this.overlay&&this.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=++c.ui.dialog.maxZ));var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++c.ui.dialog.maxZ);this.element.attr(d);this._trigger("focus",e)},open:function(){if(this._isOpen){return}var e=this.options,d=this.uiDialog;this.overlay=e.modal?new c.ui.dialog.overlay(this):null;(d.next().length&&d.appendTo("body"));this._size();this._position(e.position);d.show(e.show);this.moveToTop(true);(e.modal&&d.bind("keypress.ui-dialog",function(h){if(h.keyCode!=c.ui.keyCode.TAB){return}var g=c(":tabbable",this),i=g.filter(":first")[0],f=g.filter(":last")[0];if(h.target==f&&!h.shiftKey){setTimeout(function(){i.focus()},1)}else{if(h.target==i&&h.shiftKey){setTimeout(function(){f.focus()},1)}}}));c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(g){var f=this,d=false,e=c("
").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof g=="object"&&g!==null&&c.each(g,function(){return !(d=true)}));if(d){c.each(g,function(h,i){c('').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)}).hover(function(){c(this).addClass("ui-state-hover")},function(){c(this).removeClass("ui-state-hover")}).focus(function(){c(this).addClass("ui-state-focus")}).blur(function(){c(this).removeClass("ui-state-focus")}).appendTo(e)});e.appendTo(this.uiDialog)}},_makeDraggable:function(){var d=this,f=this.options,e;this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){e=f.height;c(this).height(c(this).height()).addClass("ui-dialog-dragging");(f.dragStart&&f.dragStart.apply(d.element[0],arguments))},drag:function(){(f.drag&&f.drag.apply(d.element[0],arguments))},stop:function(){c(this).removeClass("ui-dialog-dragging").height(e);(f.dragStop&&f.dragStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}})},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);var d=this,f=this.options,e=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){c(this).addClass("ui-dialog-resizing");(f.resizeStart&&f.resizeStart.apply(d.element[0],arguments))},resize:function(){(f.resize&&f.resize.apply(d.element[0],arguments))},handles:e,stop:function(){c(this).removeClass("ui-dialog-resizing");f.height=c(this).height();f.width=c(this).width();(f.resizeStop&&f.resizeStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(i){var e=c(window),f=c(document),g=f.scrollTop(),d=f.scrollLeft(),h=g;if(c.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]}if(i.constructor!=Array){i=["center","middle"]}if(i[0].constructor==Number){d+=i[0]}else{switch(i[0]){case"left":d+=0;break;case"right":d+=e.width()-this.uiDialog.outerWidth();break;default:case"center":d+=(e.width()-this.uiDialog.outerWidth())/2}}if(i[1].constructor==Number){g+=i[1]}else{switch(i[1]){case"top":g+=0;break;case"bottom":g+=e.height()-this.uiDialog.outerHeight();break;default:case"middle":g+=(e.height()-this.uiDialog.outerHeight())/2}}g=Math.max(g,h);this.uiDialog.css({top:g,left:d})},_setData:function(e,f){(b[e]&&this.uiDialog.data(b[e],f));switch(e){case"buttons":this._createButtons(f);break;case"closeText":this.uiDialogTitlebarCloseText.text(f);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a+f);break;case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(f);break;case"position":this._position(f);break;case"resizable":var d=this.uiDialog,g=this.uiDialog.is(":data(resizable)");(g&&!f&&d.resizable("destroy"));(g&&typeof f=="string"&&d.resizable("option","handles",f));(g||this._makeResizable(f));break;case"title":c(".ui-dialog-title",this.uiDialogTitlebar).html(f||" ");break;case"width":this.uiDialog.width(f);break}c.widget.prototype._setData.apply(this,arguments)},_size:function(){var e=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var d=this.uiDialog.css({height:"auto",width:e.width}).height();this.element.css({minHeight:Math.max(e.minHeight-d,0),height:e.height=="auto"?"auto":Math.max(e.height-d,0)})}});c.extend(c.ui.dialog,{version:"1.7",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(d){return"ui-dialog-title-"+(d.attr("id")||++this.uuid)},overlay:function(d){this.$el=c.ui.dialog.overlay.create(d)}});c.extend(c.ui.dialog.overlay,{instances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(d){return d+".dialog-overlay"}).join(" "),create:function(e){if(this.instances.length===0){setTimeout(function(){c(document).bind(c.ui.dialog.overlay.events,function(f){var g=c(f.target).parents(".ui-dialog").css("zIndex")||0;return(g>c.ui.dialog.overlay.maxZ)})},1);c(document).bind("keydown.dialog-overlay",function(f){(e.options.closeOnEscape&&f.keyCode&&f.keyCode==c.ui.keyCode.ESCAPE&&e.close(f))});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var d=c("
").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(e.options.bgiframe&&c.fn.bgiframe&&d.bgiframe());this.instances.push(d);return d},destroy:function(d){this.instances.splice(c.inArray(this.instances,d),1);if(this.instances.length===0){c([document,window]).unbind(".dialog-overlay")}d.remove()},height:function(){if(c.browser.msie&&c.browser.version<7){var e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var d=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(e
");if(!c.values){c.values=[this._valueMin(),this._valueMin()]}if(c.values.length&&c.values.length!=2){c.values=[c.values[0],c.values[0]]}}else{this.range=a("
")}this.range.appendTo(this.element).addClass("ui-slider-range");if(c.range=="min"||c.range=="max"){this.range.addClass("ui-slider-range-"+c.range)}this.range.addClass("ui-widget-header")}if(a(".ui-slider-handle",this.element).length==0){a('
').appendTo(this.element).addClass("ui-slider-handle")}if(c.values&&c.values.length){while(a(".ui-slider-handle",this.element).length').appendTo(this.element).addClass("ui-slider-handle")}}this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(d){d.preventDefault()}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");a(this).addClass("ui-state-focus")}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(d){a(this).data("index.ui-slider-handle",d)});this.handles.keydown(function(i){var f=true;var e=a(this).data("index.ui-slider-handle");if(b.options.disabled){return}switch(i.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:f=false;if(!b._keySliding){b._keySliding=true;a(this).addClass("ui-state-active");b._start(i,e)}break}var g,d,h=b._step();if(b.options.values&&b.options.values.length){g=d=b.values(e)}else{g=d=b.value()}switch(i.keyCode){case a.ui.keyCode.HOME:d=b._valueMin();break;case a.ui.keyCode.END:d=b._valueMax();break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g==b._valueMax()){return}d=g+h;break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g==b._valueMin()){return}d=g-h;break}b._slide(i,e,d);return f}).keyup(function(e){var d=a(this).data("index.ui-slider-handle");if(b._keySliding){b._stop(e,d);b._change(e,d);b._keySliding=false;a(this).removeClass("ui-state-active")}});this._refreshValue()},destroy:function(){this.handles.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy()},_mouseCapture:function(d){var e=this.options;if(e.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();var h={x:d.pageX,y:d.pageY};var j=this._normValueFromMouse(h);var c=this._valueMax()+1,f;var k=this,i;this.handles.each(function(l){var m=Math.abs(j-k.values(l));if(c>m){c=m;f=a(this);i=l}});if(e.range==true&&this.values(1)==e.min){f=a(this.handles[++i])}this._start(d,i);k._handleIndex=i;f.addClass("ui-state-active").focus();var g=f.offset();var b=!a(d.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=b?{left:0,top:0}:{left:d.pageX-g.left-(f.width()/2),top:d.pageY-g.top-(f.height()/2)-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};j=this._normValueFromMouse(h);this._slide(d,i,j);return true},_mouseStart:function(b){return true},_mouseDrag:function(d){var b={x:d.pageX,y:d.pageY};var c=this._normValueFromMouse(b);this._slide(d,this._handleIndex,c);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._handleIndex=null;this._clickOffset=null;return false},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(d){var c,h;if("horizontal"==this.orientation){c=this.elementSize.width;h=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{c=this.elementSize.height;h=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}var f=(h/c);if(f>1){f=1}if(f<0){f=0}if("vertical"==this.orientation){f=1-f}var e=this._valueMax()-this._valueMin(),i=f*e,b=i%this.options.step,g=this._valueMin()+i-b;if(b>(this.options.step/2)){g+=this.options.step}return parseFloat(g.toFixed(5))},_start:function(c,b){this._trigger("start",c,this._uiHash(b))},_slide:function(f,e,d){var g=this.handles[e];if(this.options.values&&this.options.values.length){var b=this.values(e?0:1);if((e==0&&d>=b)||(e==1&&d<=b)){d=b}if(d!=this.values(e)){var c=this.values();c[e]=d;var h=this._trigger("slide",f,this._uiHash(e,d,c));var b=this.values(e?0:1);if(h!==false){this.values(e,d,(f.type=="mousedown"&&this.options.animate),true)}}}else{if(d!=this.value()){var h=this._trigger("slide",f,this._uiHash(e,d));if(h!==false){this._setData("value",d,(f.type=="mousedown"&&this.options.animate))}}}},_stop:function(c,b){this._trigger("stop",c,this._uiHash(b))},_change:function(c,b){this._trigger("change",c,this._uiHash(b))},value:function(b){if(arguments.length){this._setData("value",b);this._change(null,0)}return this._value()},values:function(b,e,c,d){if(arguments.length>1){this.options.values[b]=e;this._refreshValue(c);if(!d){this._change(null,b)}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(b)}else{return this.value()}}else{return this._values()}},_setData:function(b,d,c){a.widget.prototype._setData.apply(this,arguments);switch(b){case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue(c);break;case"value":this._refreshValue(c);break}},_step:function(){var b=this.options.step;return b},_value:function(){var b=this.options.value;if(bthis._valueMax()){b=this._valueMax()}return b},_values:function(b){if(arguments.length){var c=this.options.values[b];if(cthis._valueMax()){c=this._valueMax()}return c}else{return this.options.values}},_valueMin:function(){var b=this.options.min;return b},_valueMax:function(){var b=this.options.max;return b},_refreshValue:function(c){var f=this.options.range,d=this.options,l=this;if(this.options.values&&this.options.values.length){var i,h;this.handles.each(function(p,n){var o=(l.values(p)-l._valueMin())/(l._valueMax()-l._valueMin())*100;var m={};m[l.orientation=="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[c?"animate":"css"](m,d.animate);if(l.options.range===true){if(l.orientation=="horizontal"){(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({left:o+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({width:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}else{(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({bottom:(o)+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({height:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}}lastValPercent=o})}else{var j=this.value(),g=this._valueMin(),k=this._valueMax(),e=k!=g?(j-g)/(k-g)*100:0;var b={};b[l.orientation=="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[c?"animate":"css"](b,d.animate);(f=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[c?"animate":"css"]({width:e+"%"},d.animate);(f=="max")&&(this.orientation=="horizontal")&&this.range[c?"animate":"css"]({width:(100-e)+"%"},{queue:false,duration:d.animate});(f=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[c?"animate":"css"]({height:e+"%"},d.animate);(f=="max")&&(this.orientation=="vertical")&&this.range[c?"animate":"css"]({height:(100-e)+"%"},{queue:false,duration:d.animate})}},_uiHash:function(d,e,c){var b=this.options.values&&this.options.values.length;return{handle:this.handles[d],value:e||(b?this.values(d):this.value()),values:c||(b&&this.values())}}}));a.extend(a.ui.slider,{getter:"value values",version:"1.7",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})})(jQuery);;/* + * jQuery UI Tabs 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Tabs + * + * Depends: + * ui.core.js + */ (function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable}this._tabify(true)},_setData:function(b,c){if(b=="selected"){if(this.options.collapsible&&c==this.options.selected){return}this.select(c)}else{this.options[b]=c;if(b=="deselectable"){this.options.collapsible=c}this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(c,b){return{tab:c,panel:b,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){this.list=this.element.children("ul:first");this.lis=a("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);var p=this,d=this.options;var c=/^#.+/;this.anchors.each(function(r,o){var q=a(o).attr("href");var s=q.split("#")[0],u;if(s&&(s===location.toString().split("#")[0]||(u=a("base")[0])&&s===u.href)){q=o.hash;o.href=q}if(c.test(q)){p.panels=p.panels.add(p._sanitizeSelector(q))}else{if(q!="#"){a.data(o,"href.tabs",q);a.data(o,"load.tabs",q.replace(/#.*$/,""));var w=p._tabId(o);o.href="#"+w;var v=a("#"+w);if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(p.panels[r-1]||p.list);v.data("destroy.tabs",true)}p.panels=p.panels.add(v)}else{d.disabled.push(r)}}});if(n){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(d.selected===undefined){if(location.hash){this.anchors.each(function(q,o){if(o.hash==location.hash){d.selected=q;return false}})}if(typeof d.selected!="number"&&d.cookie){d.selected=parseInt(p._cookie(),10)}if(typeof d.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}d.selected=d.selected||0}else{if(d.selected===null){d.selected=-1}}d.selected=((d.selected>=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))});this.load(d.selected)}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");p.lis=p.anchors=p.panels=null})}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(d.cookie){this._cookie(d.selected,d.cookie)}for(var g=0,m;(m=this.lis[g]);g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var j=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){f("hover",a(this))});this.lis.bind("mouseout.tabs",function(){j("hover",a(this))});this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var b,h;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];h=d.fx[1]}else{b=h=d.fx}}function e(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);p._trigger("show",null,p._ui(i,o[0]))})}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");p._trigger("show",null,p._ui(i,o[0]))};var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");e(i,b);p.element.dequeue("tabs")})}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");p.element.dequeue("tabs")};this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();return false}d.selected=p.anchors.index(this);p.abort();if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){l(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this));this.blur();return false}}}if(d.cookie){p._cookie(d.selected,d.cookie)}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)})}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(e,d,c){if(c===undefined){c=this.anchors.length}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var f=a("#"+h);if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)}f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(c>=this.lis.length){i.appendTo(this.list);f.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[c]);f.insertBefore(this.panels[c])}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1=b?--g:g});this._tabify();this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(e,d){return e!=b});this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))}else{if(b===null){b=-1}}if(b==-1&&this.options.collapsible){b=this.options.selected}this.anchors.eq(b).trigger(this.options.event+".tabs")},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");this.abort();if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(e).addClass("ui-state-processing");if(g.spinner){var f=a("span",b);f.data("label.tabs",f.html()).html(g.spinner)}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);c._cleanup();if(g.cache){a.data(b,"cache.tabs",true)}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));try{g.ajaxOptions.success(i,h)}catch(j){}c.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"
",spinner:"Loading…",tabTemplate:'
  • #{label}
  • '}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var i=g.selected;b.select(++i')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('
    '))}},_connectDatepicker:function(target,inst){var input=$(target);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){input[isRTL?"before":"after"](''+appendText+"")}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");var trigger=$(this._get(inst,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](trigger);trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){$target.siblings("."+this._appendClass).remove().end().siblings("."+this._triggerClass).remove().end().removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=false}).end().siblings("img."+this._triggerClass).css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;$target.siblings("button."+this._triggerClass).each(function(){this.disabled=true}).end().siblings("img."+this._triggerClass).css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDatenew Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)0&&iValue="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j0&&iValue-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormatmaxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDrawmaxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?''+prevText+"":(hideIfNoPrevNext?"":''+prevText+""));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?''+nextText+"":(hideIfNoPrevNext?"":''+nextText+""));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'":"");var buttonPanel=(showButtonPanel)?'
    '+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'":"")+(isRTL?"":controls)+"
    ":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'';var thead="";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="=5?' class="ui-datepicker-week-end"':"")+'>'+dayNamesMin[day]+""}calender+=thead+"";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow";var tbody="";for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDatemaxDate);tbody+='";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+""}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="
    =currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():" "):(unselectable?''+printDate.getDate()+"":'=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+""))+"
    "+(isMultiMonth?""+((numMonths[0]>0&&col==numMonths[1]-1)?'
    ':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate "}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='"}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?" ":"")}if(secondary||!changeYear){html+=''+drawYear+""}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?" ":"")+monthHtml}html+="";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&datemaxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7";window.DP_jQuery=$})(jQuery);;/* + * jQuery UI Progressbar 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Progressbar + * + * Depends: + * ui.core.js + */ (function(a){a.widget("ui.progressbar",{_init:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});this.valueDiv=a('
    ').appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar");this.valueDiv.remove();a.widget.prototype.destroy.apply(this,arguments)},value:function(b){arguments.length&&this._setData("value",b);return this._value()},_setData:function(b,c){switch(b){case"value":this.options.value=c;this._refreshValue();this._trigger("change",null,{});break}a.widget.prototype._setData.apply(this,arguments)},_value:function(){var b=this.options.value;if(bthis._valueMax()){b=this._valueMax()}return b},_valueMin:function(){var b=0;return b},_valueMax:function(){var b=100;return b},_refreshValue:function(){var b=this.value();this.valueDiv[b==this._valueMax()?"addClass":"removeClass"]("ui-corner-right");this.valueDiv.width(b+"%");this.element.attr("aria-valuenow",b)}});a.extend(a.ui.progressbar,{version:"1.7",defaults:{value:0}})})(jQuery);;/* + * jQuery UI Effects 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/ + */ jQuery.effects||(function(d){d.effects={version:"1.7",save:function(g,h){for(var f=0;f');var j=f.parent();if(f.css("position")=="static"){j.css({position:"relative"});f.css({position:"relative"})}else{var i=f.css("top");if(isNaN(parseInt(i,10))){i="auto"}var h=f.css("left");if(isNaN(parseInt(h,10))){h="auto"}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();f.css({position:"relative",top:0,left:0})}j.css(g);return j},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(g,i,f,h){h=h||{};d.each(i,function(k,j){unit=g.cssUnit(j);if(unit[0]>0){h[j]=unit[0]*f+unit[1]}});return h},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));var g=(typeof k=="string"?k:null);return this.each(function(){var q={};var o=d(this);var p=o.attr("style")||"";if(typeof p=="object"){p=p.cssText}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.addClass(h.add)}if(h.remove){o.removeClass(h.remove)}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.removeClass(h.add)}if(h.remove){o.addClass(h.remove)}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=p}else{d(this).attr("style",p)}if(h.add){d(this).addClass(h.add)}if(h.remove){d(this).removeClass(h.remove)}if(f){f.apply(this,arguments)}})})}};function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};if(f){i.mode=f}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);return[g[0],i,h,j]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(f){var g=this.css(f),h=[];d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]}});return h}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);h.end=b(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function b(g){var f;if(g&&g.constructor==Array&&g.length==3){return g}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){return[parseInt(f[1],10),parseInt(f[2],10),parseInt(f[3],10)]}if(f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g)){return[parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55]}if(f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g)){return[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16)]}if(f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g)){return[parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16)]}if(f=/rgba\(0, 0, 0, 0\)/.exec(g)){return a.transparent}return a[d.trim(g).toLowerCase()]}function e(h,f){var g;do{g=d.curCSS(h,f);if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break}f="backgroundColor"}while(h=h.parentNode);return b(g)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f}return -j/2*((--h)*(h-2)-1)+f},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f}return j/2*((h-=2)*h*h+2)+f},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f}return -j/2*((h-=2)*h*h*h-2)+f},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f}return j/2*((h-=2)*h*h*h*h+2)+f},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f}if(h==i){return f+j}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f}return j/2*(-Math.pow(2,-10*--h)+2)+f},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f},easeInElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h").css({position:"absolute",visibility:"visible",left:-d*(g/e),top:-f*(c/k)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/e,height:c/k,left:l.left+d*(g/e)+(b.options.mode=="show"?(d-Math.floor(e/2))*(g/e):0),top:l.top+f*(c/k)+(b.options.mode=="show"?(f-Math.floor(k/2))*(c/k):0),opacity:b.options.mode=="show"?0:1}).animate({left:l.left+d*(g/e)+(b.options.mode=="show"?0:(d-Math.floor(e/2))*(g/e)),top:l.top+f*(c/k)+(b.options.mode=="show"?0:(f-Math.floor(k/2))*(c/k)),opacity:b.options.mode=="show"?1:0},b.duration||500)}}setTimeout(function(){b.options.mode=="show"?h.css({visibility:"visible"}):h.css({visibility:"visible"}).hide();if(b.callback){b.callback.apply(h[0])}h.dequeue();a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);;/* + * jQuery UI Effects Fold 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * effects.core.js + */ (function(a){a.effects.fold=function(b){return this.queue(function(){var e=a(this),k=["position","top","left"];var h=a.effects.setMode(e,b.options.mode||"hide");var o=b.options.size||15;var n=!(!b.options.horizFirst);var g=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(e,k);e.show();var d=a.effects.createWrapper(e).css({overflow:"hidden"});var i=((h=="show")!=n);var f=i?["width","height"]:["height","width"];var c=i?[d.width(),d.height()]:[d.height(),d.width()];var j=/([0-9]+)%/.exec(o);if(j){o=parseInt(j[1],10)/100*c[h=="hide"?0:1]}if(h=="show"){d.css(n?{height:0,width:o}:{height:o,width:0})}var m={},l={};m[f[0]]=h=="show"?c[0]:o;l[f[1]]=h=="show"?c[1]:0;d.animate(m,g,b.options.easing).animate(l,g,b.options.easing,function(){if(h=="hide"){e.hide()}a.effects.restore(e,k);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(e[0],arguments)}e.dequeue()})})}})(jQuery);;/* + * jQuery UI Effects Highlight 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * effects.core.js + */ (function(a){a.effects.highlight=function(b){return this.queue(function(){var e=a(this),d=["backgroundImage","backgroundColor","opacity"];var h=a.effects.setMode(e,b.options.mode||"show");var c=b.options.color||"#ffff99";var g=e.css("backgroundColor");a.effects.save(e,d);e.show();e.css({backgroundImage:"none",backgroundColor:c});var f={backgroundColor:g};if(h=="hide"){f.opacity=0}e.animate(f,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(h=="hide"){e.hide()}a.effects.restore(e,d);if(h=="show"&&a.browser.msie){this.style.removeAttribute("filter")}if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);;/* + * jQuery UI Effects Pulsate 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * effects.core.js + */ (function(a){a.effects.pulsate=function(b){return this.queue(function(){var d=a(this);var g=a.effects.setMode(d,b.options.mode||"show");var f=b.options.times||5;var e=b.duration?b.duration/2:a.fx.speeds._default/2;if(g=="hide"){f--}if(d.is(":hidden")){d.css("opacity",0);d.show();d.animate({opacity:1},e,b.options.easing);f=f-2}for(var c=0;c').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(f[0],arguments));f.dequeue()})})}})(jQuery);; \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100644 index 0000000..5b5dab2 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 0000000..ad3d634 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_65_ffffff_1x400.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100644 index 0000000..42ccba2 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_75_dadada_1x400.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 0000000..5a46b47 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 0000000..86c2baa Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_75_ffffff_1x400.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_75_ffffff_1x400.png new file mode 100644 index 0000000..e65ca12 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_glass_75_ffffff_1x400.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 0000000..7c9fa6c Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_inset-soft_95_fef1ec_1x100.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_inset-soft_95_fef1ec_1x100.png new file mode 100644 index 0000000..0e05810 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-bg_inset-soft_95_fef1ec_1x100.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_222222_256x240.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_222222_256x240.png new file mode 100644 index 0000000..67560da Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_222222_256x240.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_2e83ff_256x240.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 0000000..b2c9052 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_2e83ff_256x240.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_454545_256x240.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_454545_256x240.png new file mode 100644 index 0000000..0cd64a2 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_454545_256x240.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_888888_256x240.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_888888_256x240.png new file mode 100644 index 0000000..2e5180e Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_888888_256x240.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_cd0a0a_256x240.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 0000000..2db88b7 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/images/ui-icons_cd0a0a_256x240.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.accordion.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.accordion.css new file mode 100644 index 0000000..ee1b1b6 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.accordion.css @@ -0,0 +1,9 @@ +/* Accordion +----------------------------------*/ +.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } +.ui-accordion .ui-accordion-li-fix { display: inline; } +.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } +.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; } +.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } +.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; } +.ui-accordion .ui-accordion-content-active { display: block; } \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.all.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.all.css new file mode 100644 index 0000000..543e4c3 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.all.css @@ -0,0 +1,2 @@ +@import "ui.base.css"; +@import "ui.theme.css"; diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.base.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.base.css new file mode 100644 index 0000000..d716095 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.base.css @@ -0,0 +1,8 @@ +@import url("ui.core.css"); +@import url("ui.resizable.css"); +@import url("ui.accordion.css"); +@import url("ui.dialog.css"); +@import url("ui.slider.css"); +@import url("ui.tabs.css"); +@import url("ui.datepicker.css"); +@import url("ui.progressbar.css"); \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.core.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.core.css new file mode 100644 index 0000000..c2f18f2 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.core.css @@ -0,0 +1,37 @@ +/* +* jQuery UI CSS Framework +* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +*/ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.datepicker.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.datepicker.css new file mode 100644 index 0000000..567f8c9 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.datepicker.css @@ -0,0 +1,62 @@ +/* Datepicker +----------------------------------*/ +.ui-datepicker { width: 17em; padding: .2em .2em 0; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; } +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +} \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.dialog.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.dialog.css new file mode 100644 index 0000000..2997595 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.dialog.css @@ -0,0 +1,13 @@ +/* Dialog +----------------------------------*/ +.ui-dialog { position: relative; padding: .2em; width: 300px; } +.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.progressbar.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.progressbar.css new file mode 100644 index 0000000..bc0939e --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.progressbar.css @@ -0,0 +1,4 @@ +/* Progressbar +----------------------------------*/ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.resizable.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.resizable.css new file mode 100644 index 0000000..44efeb2 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.resizable.css @@ -0,0 +1,13 @@ +/* Resizable +----------------------------------*/ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;} \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.slider.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.slider.css new file mode 100644 index 0000000..4c56218 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.slider.css @@ -0,0 +1,17 @@ +/* Slider +----------------------------------*/ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; } \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.tabs.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.tabs.css new file mode 100644 index 0000000..3ca6b9a --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.tabs.css @@ -0,0 +1,11 @@ +/* Tabs +----------------------------------*/ +.ui-tabs { padding: .2em; zoom: 1; } +.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; } +.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.theme.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.theme.css new file mode 100644 index 0000000..6296e4e --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/base/ui.theme.css @@ -0,0 +1,243 @@ +/* +* jQuery UI CSS Framework +* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +* To view and modify this theme, visit http://jqueryui.com/themeroller/ +*/ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: /*{ffDefault}*/; font-size: 9pt/*{fsDefault}*/; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: /*{ffDefault}*/; font-size: 9pt; } +.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_glass_75_ffffff_1x400.png)/*{bgImgUrlContent}*/ 0/*{bgContentXPos}*/ 0/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; } +.ui-widget-content a { color: #222222/*{fcContent}*/; } +.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 0/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; } +.ui-widget-header a { color: #222222/*{fcHeader}*/; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 0/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; outline: none; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; outline: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 0/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; outline: none; } +.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; outline: none; } +.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 0/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; outline: none; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; outline: none; text-decoration: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 0/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636/*{fcHighlight}*/; } +.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_inset-soft_95_fef1ec_1x100.png)/*{bgImgUrlError}*/ 0/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; } +.ui-state-error a, .ui-widget-content .ui-state-error a { color: #363636/*{fcError}*/; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a/*{fcError}*/; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; } +.ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; } +.ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; } +.ui-corner-top { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; } +.ui-corner-right { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; } +.ui-corner-left { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; } +.ui-corner-all { -moz-border-radius: 4px/*{cornerRadius}*/; -webkit-border-radius: 4px/*{cornerRadius}*/; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ none/*{bgImgUrlOverlay}*/ 0/*{bgOverlayXPos}*/ 0/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; } +.ui-widget-shadow { margin: -4px/*{offsetTopShadow}*/ 0 0 -4px/*{offsetLeftShadow}*/; padding: 4px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ none/*{bgImgUrlShadow}*/ 0/*{bgShadowXPos}*/ 0/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .35;filter:Alpha(Opacity=35)/*{opacityShadow}*/; -moz-border-radius: 4px/*{cornerRadiusShadow}*/; -webkit-border-radius: 4px/*{cornerRadiusShadow}*/; } \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100644 index 0000000..5b5dab2 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100644 index 0000000..ac8b229 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 0000000..ad3d634 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100644 index 0000000..42ccba2 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 0000000..5a46b47 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 0000000..86c2baa Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100644 index 0000000..4443fdc Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 0000000..7c9fa6c Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_222222_256x240.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_222222_256x240.png new file mode 100644 index 0000000..67560da Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_222222_256x240.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_2e83ff_256x240.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 0000000..b425c44 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_2e83ff_256x240.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_454545_256x240.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_454545_256x240.png new file mode 100644 index 0000000..0cd64a2 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_454545_256x240.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_888888_256x240.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_888888_256x240.png new file mode 100644 index 0000000..2e5180e Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_888888_256x240.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_cd0a0a_256x240.png b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 0000000..2db88b7 Binary files /dev/null and b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/images/ui-icons_cd0a0a_256x240.png differ diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/jquery-ui-1.7.custom.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/jquery-ui-1.7.custom.css new file mode 100644 index 0000000..b2d67e2 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/jquery-ui-1.7.custom.css @@ -0,0 +1,405 @@ +/* +* jQuery UI CSS Framework +* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +*/ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + +/* +* jQuery UI CSS Framework +* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px +*/ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } +.ui-widget-content a { color: #222222; } +.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header a { color: #222222; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; outline: none; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; outline: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; } +.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; outline: none; } +.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; outline: none; text-decoration: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } +.ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd0a0a; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; } +.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; } +.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; }/* Resizable +----------------------------------*/ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Accordion +----------------------------------*/ +.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } +.ui-accordion .ui-accordion-li-fix { display: inline; } +.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } +.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; } +.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } +.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; } +.ui-accordion .ui-accordion-content-active { display: block; }/* Dialog +----------------------------------*/ +.ui-dialog { position: relative; padding: .2em; width: 300px; } +.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* Slider +----------------------------------*/ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs +----------------------------------*/ +.ui-tabs { padding: .2em; zoom: 1; } +.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; } +.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } +/* Datepicker +----------------------------------*/ +.ui-datepicker { width: 17em; padding: .2em .2em 0; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; } +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +}/* Progressbar +----------------------------------*/ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.accordion.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.accordion.css new file mode 100644 index 0000000..ee1b1b6 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.accordion.css @@ -0,0 +1,9 @@ +/* Accordion +----------------------------------*/ +.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } +.ui-accordion .ui-accordion-li-fix { display: inline; } +.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } +.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; } +.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } +.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; } +.ui-accordion .ui-accordion-content-active { display: block; } \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.all.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.all.css new file mode 100644 index 0000000..543e4c3 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.all.css @@ -0,0 +1,2 @@ +@import "ui.base.css"; +@import "ui.theme.css"; diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.base.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.base.css new file mode 100644 index 0000000..d716095 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.base.css @@ -0,0 +1,8 @@ +@import url("ui.core.css"); +@import url("ui.resizable.css"); +@import url("ui.accordion.css"); +@import url("ui.dialog.css"); +@import url("ui.slider.css"); +@import url("ui.tabs.css"); +@import url("ui.datepicker.css"); +@import url("ui.progressbar.css"); \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.core.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.core.css new file mode 100644 index 0000000..c2f18f2 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.core.css @@ -0,0 +1,37 @@ +/* +* jQuery UI CSS Framework +* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +*/ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.datepicker.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.datepicker.css new file mode 100644 index 0000000..567f8c9 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.datepicker.css @@ -0,0 +1,62 @@ +/* Datepicker +----------------------------------*/ +.ui-datepicker { width: 17em; padding: .2em .2em 0; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; } +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +} \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.dialog.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.dialog.css new file mode 100644 index 0000000..2997595 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.dialog.css @@ -0,0 +1,13 @@ +/* Dialog +----------------------------------*/ +.ui-dialog { position: relative; padding: .2em; width: 300px; } +.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.progressbar.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.progressbar.css new file mode 100644 index 0000000..bc0939e --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.progressbar.css @@ -0,0 +1,4 @@ +/* Progressbar +----------------------------------*/ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.resizable.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.resizable.css new file mode 100644 index 0000000..44efeb2 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.resizable.css @@ -0,0 +1,13 @@ +/* Resizable +----------------------------------*/ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;} \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.slider.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.slider.css new file mode 100644 index 0000000..4c56218 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.slider.css @@ -0,0 +1,17 @@ +/* Slider +----------------------------------*/ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; } \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.tabs.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.tabs.css new file mode 100644 index 0000000..3ca6b9a --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.tabs.css @@ -0,0 +1,11 @@ +/* Tabs +----------------------------------*/ +.ui-tabs { padding: .2em; zoom: 1; } +.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; } +.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.theme.css b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.theme.css new file mode 100644 index 0000000..10f76b4 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/themes/smoothness/ui.theme.css @@ -0,0 +1,245 @@ + + +/* +* jQuery UI CSS Framework +* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px +*/ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } +.ui-widget-content a { color: #222222; } +.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header a { color: #222222; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; outline: none; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; outline: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; } +.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; outline: none; } +.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; outline: none; text-decoration: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } +.ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd0a0a; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; } +.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; } +.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; } \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.accordion.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.accordion.js new file mode 100644 index 0000000..fc71ecf --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.accordion.js @@ -0,0 +1,477 @@ +/* + * jQuery UI Accordion 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Accordion + * + * Depends: + * ui.core.js + */ +(function($) { + +$.widget("ui.accordion", { + + _init: function() { + + var o = this.options, self = this; + this.running = 0; + + // if the user set the alwaysOpen option on init + // then we need to set the collapsible option + // if they set both on init, collapsible will take priority + if (o.collapsible == $.ui.accordion.defaults.collapsible && + o.alwaysOpen != $.ui.accordion.defaults.alwaysOpen) { + o.collapsible = !o.alwaysOpen; + } + + if ( o.navigation ) { + var current = this.element.find("a").filter(o.navigationFilter); + if ( current.length ) { + if ( current.filter(o.header).length ) { + this.active = current; + } else { + this.active = current.parent().parent().prev(); + current.addClass("ui-accordion-content-active"); + } + } + } + + this.element.addClass("ui-accordion ui-widget ui-helper-reset"); + + // in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix + if (this.element[0].nodeName == "UL") { + this.element.children("li").addClass("ui-accordion-li-fix"); + } + + this.headers = this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all") + .bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); }) + .bind("mouseleave.accordion", function(){ $(this).removeClass('ui-state-hover'); }) + .bind("focus.accordion", function(){ $(this).addClass('ui-state-focus'); }) + .bind("blur.accordion", function(){ $(this).removeClass('ui-state-focus'); }); + + this.headers + .next() + .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); + + this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"); + this.active.next().addClass('ui-accordion-content-active'); + + //Append icon elements + $("").addClass("ui-icon " + o.icons.header).prependTo(this.headers); + this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected); + + // IE7-/Win - Extra vertical space in lists fixed + if ($.browser.msie) { + this.element.find('a').css('zoom', '1'); + } + + this.resize(); + + //ARIA + this.element.attr('role','tablist'); + + this.headers + .attr('role','tab') + .bind('keydown', function(event) { return self._keydown(event); }) + .next() + .attr('role','tabpanel'); + + this.headers + .not(this.active || "") + .attr('aria-expanded','false') + .attr("tabIndex", "-1") + .next() + .hide(); + + // make sure at least one header is in the tab order + if (!this.active.length) { + this.headers.eq(0).attr('tabIndex','0'); + } else { + this.active + .attr('aria-expanded','true') + .attr('tabIndex', '0'); + } + + // only need links in taborder for Safari + if (!$.browser.safari) + this.headers.find('a').attr('tabIndex','-1'); + + if (o.event) { + this.headers.bind((o.event) + ".accordion", function(event) { return self._clickHandler.call(self, event, this); }); + } + + }, + + destroy: function() { + var o = this.options; + + this.element + .removeClass("ui-accordion ui-widget ui-helper-reset") + .removeAttr("role") + .unbind('.accordion') + .removeData('accordion'); + + this.headers + .unbind(".accordion") + .removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top") + .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex"); + + this.headers.find("a").removeAttr("tabindex"); + this.headers.children(".ui-icon").remove(); + var contents = this.headers.next().css("display", "").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active"); + if (o.autoHeight || o.fillHeight) { + contents.css("height", ""); + } + }, + + _setData: function(key, value) { + if(key == 'alwaysOpen') { key = 'collapsible'; value = !value; } + $.widget.prototype._setData.apply(this, arguments); + }, + + _keydown: function(event) { + + var o = this.options, keyCode = $.ui.keyCode; + + if (o.disabled || event.altKey || event.ctrlKey) + return; + + var length = this.headers.length; + var currentIndex = this.headers.index(event.target); + var toFocus = false; + + switch(event.keyCode) { + case keyCode.RIGHT: + case keyCode.DOWN: + toFocus = this.headers[(currentIndex + 1) % length]; + break; + case keyCode.LEFT: + case keyCode.UP: + toFocus = this.headers[(currentIndex - 1 + length) % length]; + break; + case keyCode.SPACE: + case keyCode.ENTER: + return this._clickHandler({ target: event.target }, event.target); + } + + if (toFocus) { + $(event.target).attr('tabIndex','-1'); + $(toFocus).attr('tabIndex','0'); + toFocus.focus(); + return false; + } + + return true; + + }, + + resize: function() { + + var o = this.options, maxHeight; + + if (o.fillSpace) { + + if($.browser.msie) { var defOverflow = this.element.parent().css('overflow'); this.element.parent().css('overflow', 'hidden'); } + maxHeight = this.element.parent().height(); + if($.browser.msie) { this.element.parent().css('overflow', defOverflow); } + + this.headers.each(function() { + maxHeight -= $(this).outerHeight(); + }); + + var maxPadding = 0; + this.headers.next().each(function() { + maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height()); + }).height(Math.max(0, maxHeight - maxPadding)) + .css('overflow', 'auto'); + + } else if ( o.autoHeight ) { + maxHeight = 0; + this.headers.next().each(function() { + maxHeight = Math.max(maxHeight, $(this).outerHeight()); + }).height(maxHeight); + } + + }, + + activate: function(index) { + // call clickHandler with custom event + var active = this._findActive(index)[0]; + this._clickHandler({ target: active }, active); + }, + + _findActive: function(selector) { + return selector + ? typeof selector == "number" + ? this.headers.filter(":eq(" + selector + ")") + : this.headers.not(this.headers.not(selector)) + : selector === false + ? $([]) + : this.headers.filter(":eq(0)"); + }, + + _clickHandler: function(event, target) { + + var o = this.options; + if (o.disabled) return false; + + // called only when using activate(false) to close all parts programmatically + if (!event.target && o.collapsible) { + this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all") + .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header); + this.active.next().addClass('ui-accordion-content-active'); + var toHide = this.active.next(), + data = { + options: o, + newHeader: $([]), + oldHeader: o.active, + newContent: $([]), + oldContent: toHide + }, + toShow = (this.active = $([])); + this._toggle(toShow, toHide, data); + return false; + } + + // get the click target + var clicked = $(event.currentTarget || target); + var clickedIsActive = clicked[0] == this.active[0]; + + // if animations are still active, or the active header is the target, ignore click + if (this.running || (!o.collapsible && clickedIsActive)) { + return false; + } + + // switch classes + this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all") + .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header); + this.active.next().addClass('ui-accordion-content-active'); + if (!clickedIsActive) { + clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top") + .find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected); + clicked.next().addClass('ui-accordion-content-active'); + } + + // find elements to show and hide + var toShow = clicked.next(), + toHide = this.active.next(), + data = { + options: o, + newHeader: clickedIsActive && o.collapsible ? $([]) : clicked, + oldHeader: this.active, + newContent: clickedIsActive && o.collapsible ? $([]) : toShow.find('> *'), + oldContent: toHide.find('> *') + }, + down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] ); + + this.active = clickedIsActive ? $([]) : clicked; + this._toggle(toShow, toHide, data, clickedIsActive, down); + + return false; + + }, + + _toggle: function(toShow, toHide, data, clickedIsActive, down) { + + var o = this.options, self = this; + + this.toShow = toShow; + this.toHide = toHide; + this.data = data; + + var complete = function() { if(!self) return; return self._completed.apply(self, arguments); }; + + // trigger changestart event + this._trigger("changestart", null, this.data); + + // count elements to animate + this.running = toHide.size() === 0 ? toShow.size() : toHide.size(); + + if (o.animated) { + + var animOptions = {}; + + if ( o.collapsible && clickedIsActive ) { + animOptions = { + toShow: $([]), + toHide: toHide, + complete: complete, + down: down, + autoHeight: o.autoHeight || o.fillSpace + }; + } else { + animOptions = { + toShow: toShow, + toHide: toHide, + complete: complete, + down: down, + autoHeight: o.autoHeight || o.fillSpace + }; + } + + if (!o.proxied) { + o.proxied = o.animated; + } + + if (!o.proxiedDuration) { + o.proxiedDuration = o.duration; + } + + o.animated = $.isFunction(o.proxied) ? + o.proxied(animOptions) : o.proxied; + + o.duration = $.isFunction(o.proxiedDuration) ? + o.proxiedDuration(animOptions) : o.proxiedDuration; + + var animations = $.ui.accordion.animations, + duration = o.duration, + easing = o.animated; + + if (!animations[easing]) { + animations[easing] = function(options) { + this.slide(options, { + easing: easing, + duration: duration || 700 + }); + }; + } + + animations[easing](animOptions); + + } else { + + if (o.collapsible && clickedIsActive) { + toShow.toggle(); + } else { + toHide.hide(); + toShow.show(); + } + + complete(true); + + } + + toHide.prev().attr('aria-expanded','false').attr("tabIndex", "-1").blur(); + toShow.prev().attr('aria-expanded','true').attr("tabIndex", "0").focus(); + + }, + + _completed: function(cancel) { + + var o = this.options; + + this.running = cancel ? 0 : --this.running; + if (this.running) return; + + if (o.clearStyle) { + this.toShow.add(this.toHide).css({ + height: "", + overflow: "" + }); + } + + this._trigger('change', null, this.data); + } + +}); + + +$.extend($.ui.accordion, { + version: "1.7", + defaults: { + active: null, + alwaysOpen: true, //deprecated, use collapsible + animated: 'slide', + autoHeight: true, + clearStyle: false, + collapsible: false, + event: "click", + fillSpace: false, + header: "> li > :first-child,> :not(li):even", + icons: { + header: "ui-icon-triangle-1-e", + headerSelected: "ui-icon-triangle-1-s" + }, + navigation: false, + navigationFilter: function() { + return this.href.toLowerCase() == location.href.toLowerCase(); + } + }, + animations: { + slide: function(options, additions) { + options = $.extend({ + easing: "swing", + duration: 300 + }, options, additions); + if ( !options.toHide.size() ) { + options.toShow.animate({height: "show"}, options); + return; + } + if ( !options.toShow.size() ) { + options.toHide.animate({height: "hide"}, options); + return; + } + var overflow = options.toShow.css('overflow'), + percentDone, + showProps = {}, + hideProps = {}, + fxAttrs = [ "height", "paddingTop", "paddingBottom" ], + originalWidth; + // fix width before calculating height of hidden element + var s = options.toShow; + originalWidth = s[0].style.width; + s.width( parseInt(s.parent().width(),10) - parseInt(s.css("paddingLeft"),10) - parseInt(s.css("paddingRight"),10) - parseInt(s.css("borderLeftWidth"),10) - parseInt(s.css("borderRightWidth"),10) ); + + $.each(fxAttrs, function(i, prop) { + hideProps[prop] = 'hide'; + + var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/); + showProps[prop] = { + value: parts[1], + unit: parts[2] || 'px' + }; + }); + options.toShow.css({ height: 0, overflow: 'hidden' }).show(); + options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{ + step: function(now, settings) { + // only calculate the percent when animating height + // IE gets very inconsistent results when animating elements + // with small values, which is common for padding + if (settings.prop == 'height') { + percentDone = (settings.now - settings.start) / (settings.end - settings.start); + } + + options.toShow[0].style[settings.prop] = + (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit; + }, + duration: options.duration, + easing: options.easing, + complete: function() { + if ( !options.autoHeight ) { + options.toShow.css("height", ""); + } + options.toShow.css("width", originalWidth); + options.toShow.css({overflow: overflow}); + options.complete(); + } + }); + }, + bounceslide: function(options) { + this.slide(options, { + easing: options.down ? "easeOutBounce" : "swing", + duration: options.down ? 1000 : 200 + }); + }, + easeslide: function(options) { + this.slide(options, { + easing: "easeinout", + duration: 700 + }); + } + } +}); + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.core.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.core.js new file mode 100644 index 0000000..89300d9 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.core.js @@ -0,0 +1,519 @@ +/* + * jQuery UI 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI + */ +;jQuery.ui || (function($) { + +var _remove = $.fn.remove, + isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9); + +//Helper functions and ui object +$.ui = { + version: "1.7", + + // $.ui.plugin is deprecated. Use the proxy pattern instead. + plugin: { + add: function(module, option, set) { + var proto = $.ui[module].prototype; + for(var i in set) { + proto.plugins[i] = proto.plugins[i] || []; + proto.plugins[i].push([option, set[i]]); + } + }, + call: function(instance, name, args) { + var set = instance.plugins[name]; + if(!set || !instance.element[0].parentNode) { return; } + + for (var i = 0; i < set.length; i++) { + if (instance.options[set[i][0]]) { + set[i][1].apply(instance.element, args); + } + } + } + }, + + contains: function(a, b) { + return document.compareDocumentPosition + ? a.compareDocumentPosition(b) & 16 + : a !== b && a.contains(b); + }, + + hasScroll: function(el, a) { + + //If overflow is hidden, the element might have extra content, but the user wants to hide it + if ($(el).css('overflow') == 'hidden') { return false; } + + var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', + has = false; + + if (el[scroll] > 0) { return true; } + + // TODO: determine which cases actually cause this to happen + // if the element doesn't have the scroll set, see if it's possible to + // set the scroll + el[scroll] = 1; + has = (el[scroll] > 0); + el[scroll] = 0; + return has; + }, + + isOverAxis: function(x, reference, size) { + //Determines when x coordinate is over "b" element axis + return (x > reference) && (x < (reference + size)); + }, + + isOver: function(y, x, top, left, height, width) { + //Determines when x, y coordinates is over "b" element + return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width); + }, + + keyCode: { + BACKSPACE: 8, + CAPS_LOCK: 20, + COMMA: 188, + CONTROL: 17, + DELETE: 46, + DOWN: 40, + END: 35, + ENTER: 13, + ESCAPE: 27, + HOME: 36, + INSERT: 45, + LEFT: 37, + NUMPAD_ADD: 107, + NUMPAD_DECIMAL: 110, + NUMPAD_DIVIDE: 111, + NUMPAD_ENTER: 108, + NUMPAD_MULTIPLY: 106, + NUMPAD_SUBTRACT: 109, + PAGE_DOWN: 34, + PAGE_UP: 33, + PERIOD: 190, + RIGHT: 39, + SHIFT: 16, + SPACE: 32, + TAB: 9, + UP: 38 + } +}; + +// WAI-ARIA normalization +if (isFF2) { + var attr = $.attr, + removeAttr = $.fn.removeAttr, + ariaNS = "http://www.w3.org/2005/07/aaa", + ariaState = /^aria-/, + ariaRole = /^wairole:/; + + $.attr = function(elem, name, value) { + var set = value !== undefined; + + return (name == 'role' + ? (set + ? attr.call(this, elem, name, "wairole:" + value) + : (attr.apply(this, arguments) || "").replace(ariaRole, "")) + : (ariaState.test(name) + ? (set + ? elem.setAttributeNS(ariaNS, + name.replace(ariaState, "aaa:"), value) + : attr.call(this, elem, name.replace(ariaState, "aaa:"))) + : attr.apply(this, arguments))); + }; + + $.fn.removeAttr = function(name) { + return (ariaState.test(name) + ? this.each(function() { + this.removeAttributeNS(ariaNS, name.replace(ariaState, "")); + }) : removeAttr.call(this, name)); + }; +} + +//jQuery plugins +$.fn.extend({ + remove: function() { + // Safari has a native remove event which actually removes DOM elements, + // so we have to use triggerHandler instead of trigger (#3037). + $("*", this).add(this).each(function() { + $(this).triggerHandler("remove"); + }); + return _remove.apply(this, arguments ); + }, + + enableSelection: function() { + return this + .attr('unselectable', 'off') + .css('MozUserSelect', '') + .unbind('selectstart.ui'); + }, + + disableSelection: function() { + return this + .attr('unselectable', 'on') + .css('MozUserSelect', 'none') + .bind('selectstart.ui', function() { return false; }); + }, + + scrollParent: function() { + var scrollParent; + if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { + scrollParent = this.parents().filter(function() { + return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); + }).eq(0); + } else { + scrollParent = this.parents().filter(function() { + return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); + }).eq(0); + } + + return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; + } +}); + + +//Additional selectors +$.extend($.expr[':'], { + data: function(elem, i, match) { + return !!$.data(elem, match[3]); + }, + + focusable: function(element) { + var nodeName = element.nodeName.toLowerCase(), + tabIndex = $.attr(element, 'tabindex'); + return (/input|select|textarea|button|object/.test(nodeName) + ? !element.disabled + : 'a' == nodeName || 'area' == nodeName + ? element.href || !isNaN(tabIndex) + : !isNaN(tabIndex)) + // the element and all of its ancestors must be visible + // the browser may report that the area is hidden + && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length; + }, + + tabbable: function(element) { + var tabIndex = $.attr(element, 'tabindex'); + return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable'); + } +}); + + +// $.widget is a factory to create jQuery plugins +// taking some boilerplate code out of the plugin code +function getter(namespace, plugin, method, args) { + function getMethods(type) { + var methods = $[namespace][plugin][type] || []; + return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods); + } + + var methods = getMethods('getter'); + if (args.length == 1 && typeof args[0] == 'string') { + methods = methods.concat(getMethods('getterSetter')); + } + return ($.inArray(method, methods) != -1); +} + +$.widget = function(name, prototype) { + var namespace = name.split(".")[0]; + name = name.split(".")[1]; + + // create plugin method + $.fn[name] = function(options) { + var isMethodCall = (typeof options == 'string'), + args = Array.prototype.slice.call(arguments, 1); + + // prevent calls to internal methods + if (isMethodCall && options.substring(0, 1) == '_') { + return this; + } + + // handle getter methods + if (isMethodCall && getter(namespace, name, options, args)) { + var instance = $.data(this[0], name); + return (instance ? instance[options].apply(instance, args) + : undefined); + } + + // handle initialization and non-getter methods + return this.each(function() { + var instance = $.data(this, name); + + // constructor + (!instance && !isMethodCall && + $.data(this, name, new $[namespace][name](this, options))._init()); + + // method call + (instance && isMethodCall && $.isFunction(instance[options]) && + instance[options].apply(instance, args)); + }); + }; + + // create widget constructor + $[namespace] = $[namespace] || {}; + $[namespace][name] = function(element, options) { + var self = this; + + this.namespace = namespace; + this.widgetName = name; + this.widgetEventPrefix = $[namespace][name].eventPrefix || name; + this.widgetBaseClass = namespace + '-' + name; + + this.options = $.extend({}, + $.widget.defaults, + $[namespace][name].defaults, + $.metadata && $.metadata.get(element)[name], + options); + + this.element = $(element) + .bind('setData.' + name, function(event, key, value) { + if (event.target == element) { + return self._setData(key, value); + } + }) + .bind('getData.' + name, function(event, key) { + if (event.target == element) { + return self._getData(key); + } + }) + .bind('remove', function() { + return self.destroy(); + }); + }; + + // add widget prototype + $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype); + + // TODO: merge getter and getterSetter properties from widget prototype + // and plugin prototype + $[namespace][name].getterSetter = 'option'; +}; + +$.widget.prototype = { + _init: function() {}, + destroy: function() { + this.element.removeData(this.widgetName) + .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled') + .removeAttr('aria-disabled'); + }, + + option: function(key, value) { + var options = key, + self = this; + + if (typeof key == "string") { + if (value === undefined) { + return this._getData(key); + } + options = {}; + options[key] = value; + } + + $.each(options, function(key, value) { + self._setData(key, value); + }); + }, + _getData: function(key) { + return this.options[key]; + }, + _setData: function(key, value) { + this.options[key] = value; + + if (key == 'disabled') { + this.element + [value ? 'addClass' : 'removeClass']( + this.widgetBaseClass + '-disabled' + ' ' + + this.namespace + '-state-disabled') + .attr("aria-disabled", value); + } + }, + + enable: function() { + this._setData('disabled', false); + }, + disable: function() { + this._setData('disabled', true); + }, + + _trigger: function(type, event, data) { + var callback = this.options[type], + eventName = (type == this.widgetEventPrefix + ? type : this.widgetEventPrefix + type); + + event = $.Event(event); + event.type = eventName; + + // copy original event properties over to the new event + // this would happen if we could call $.event.fix instead of $.Event + // but we don't have a way to force an event to be fixed multiple times + if (event.originalEvent) { + for (var i = $.event.props.length, prop; i;) { + prop = $.event.props[--i]; + event[prop] = event.originalEvent[prop]; + } + } + + this.element.trigger(event, data); + + return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false + || event.isDefaultPrevented()); + } +}; + +$.widget.defaults = { + disabled: false +}; + + +/** Mouse Interaction Plugin **/ + +$.ui.mouse = { + _mouseInit: function() { + var self = this; + + this.element + .bind('mousedown.'+this.widgetName, function(event) { + return self._mouseDown(event); + }) + .bind('click.'+this.widgetName, function(event) { + if(self._preventClickEvent) { + self._preventClickEvent = false; + event.stopImmediatePropagation(); + return false; + } + }); + + // Prevent text selection in IE + if ($.browser.msie) { + this._mouseUnselectable = this.element.attr('unselectable'); + this.element.attr('unselectable', 'on'); + } + + this.started = false; + }, + + // TODO: make sure destroying one instance of mouse doesn't mess with + // other instances of mouse + _mouseDestroy: function() { + this.element.unbind('.'+this.widgetName); + + // Restore text selection in IE + ($.browser.msie + && this.element.attr('unselectable', this._mouseUnselectable)); + }, + + _mouseDown: function(event) { + // don't let more than one widget handle mouseStart + // TODO: figure out why we have to use originalEvent + event.originalEvent = event.originalEvent || {}; + if (event.originalEvent.mouseHandled) { return; } + + // we may have missed mouseup (out of window) + (this._mouseStarted && this._mouseUp(event)); + + this._mouseDownEvent = event; + + var self = this, + btnIsLeft = (event.which == 1), + elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false); + if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { + return true; + } + + this.mouseDelayMet = !this.options.delay; + if (!this.mouseDelayMet) { + this._mouseDelayTimer = setTimeout(function() { + self.mouseDelayMet = true; + }, this.options.delay); + } + + if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { + this._mouseStarted = (this._mouseStart(event) !== false); + if (!this._mouseStarted) { + event.preventDefault(); + return true; + } + } + + // these delegates are required to keep context + this._mouseMoveDelegate = function(event) { + return self._mouseMove(event); + }; + this._mouseUpDelegate = function(event) { + return self._mouseUp(event); + }; + $(document) + .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) + .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); + + // preventDefault() is used to prevent the selection of text here - + // however, in Safari, this causes select boxes not to be selectable + // anymore, so this fix is needed + ($.browser.safari || event.preventDefault()); + + event.originalEvent.mouseHandled = true; + return true; + }, + + _mouseMove: function(event) { + // IE mouseup check - mouseup happened when mouse was out of window + if ($.browser.msie && !event.button) { + return this._mouseUp(event); + } + + if (this._mouseStarted) { + this._mouseDrag(event); + return event.preventDefault(); + } + + if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { + this._mouseStarted = + (this._mouseStart(this._mouseDownEvent, event) !== false); + (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); + } + + return !this._mouseStarted; + }, + + _mouseUp: function(event) { + $(document) + .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) + .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); + + if (this._mouseStarted) { + this._mouseStarted = false; + this._preventClickEvent = (event.target == this._mouseDownEvent.target); + this._mouseStop(event); + } + + return false; + }, + + _mouseDistanceMet: function(event) { + return (Math.max( + Math.abs(this._mouseDownEvent.pageX - event.pageX), + Math.abs(this._mouseDownEvent.pageY - event.pageY) + ) >= this.options.distance + ); + }, + + _mouseDelayMet: function(event) { + return this.mouseDelayMet; + }, + + // These are placeholder methods, to be overriden by extending plugin + _mouseStart: function(event) {}, + _mouseDrag: function(event) {}, + _mouseStop: function(event) {}, + _mouseCapture: function(event) { return true; } +}; + +$.ui.mouse.defaults = { + cancel: null, + distance: 1, + delay: 0 +}; + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.core.min.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.core.min.js new file mode 100644 index 0000000..01679c4 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.core.min.js @@ -0,0 +1,4 @@ +/* + * Compressed by JSA(www.xidea.org) + */ +eval(function(E,I,A,D,J,K,L,H){function C(A){return A<62?String.fromCharCode(A+=A<26?65:A<52?71:-4):A<63?'_':A<64?'$':C(A>>6)+C(A&63)}while(A>0)K[C(D--)]=I[--A];function N(A){return K[A]==L[A]?A:K[A]}if(''.replace(/^/,String)){var M=E.match(J),B=M[0],F=E.split(J),G=0;if(E.indexOf(F[0]))F=[''].concat(F);do{H[A++]=F[G++];H[A++]=N(B)}while(B=M[G]);H[A++]=F[G]||'';return H.join('')}return E.replace(J,N)}('Bb.L||(u(B){N F=B.M.l,C=B.q.mozilla&&(parseFloat(B.q.BY)G)c T;A[C]=H;J=(A[C]>G);A[C]=G;c J},BI:u(I,A,J){c(I>A)&&(I<(A+J))},isOver:u(D,E,I,C,A,J){c B.L.BI(D,I,A)&&B.L.BI(E,C,J)},keyCode:{BACKSPACE:CG,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:Bc,SPACE:32,TAB:Bw,UP:38}};K(C){N E=B.R,B_=B.M.BQ,A="http://www.w3.org/2005/07/BF",I=/^Z-/,D=/^Bm:/;B.R=u(B,F,J){N C=J!==BD;c(F=="role"?(C?E.V(Q,B,F,"Bm:"+J):(E.b(Q,3)||"").s(D,"")):(I.S(F)?(C?B.setAttributeNS(A,F.s(I,"BF:"),J):E.V(Q,B,F.s(I,"BF:"))):E.b(Q,3)))};B.M.BQ=u(J){c(I.S(J)?Q.Y(u(){Q.removeAttributeNS(A,J.s(I,""))}):B_.V(Q,J))}}B.M.k({l:u(){B("*",Q).BE(Q).Y(u(){B(Q).triggerHandler("l")});c F.b(Q,3)},enableSelection:u(){c Q.R("5","off").O("B0","").j("BU.L")},disableSelection:u(){c Q.R("5","Bf").O("B0","none").U("BU.L",u(){c a})},scrollParent:u(){N J;K((B.q.X&&(/(static|CB)/).S(Q.O("z")))||(/BW/).S(Q.O("z")))J=Q.r().n(u(){c(/(CB|BW|B5)/).S(B.d(Q,"z",H))&&(/(Bq|By)/).S(B.d(Q,"w",H)+B.d(Q,"w-Bv",H)+B.d(Q,"w-Bz",H))}).B9(G);else J=Q.r().n(u(){c(/(Bq|By)/).S(B.d(Q,"w",H)+B.d(Q,"w-Bv",H)+B.d(Q,"w-Bz",H))}).B9(G);c(/B5/).S(Q.O("z"))||!J.e?B(1):J}});B.k(B.expr[":"],{W:u(A,I,J){c!!B.W(A,J[CE])},B3:u(J){N I=J.nodeName.toLowerCase(),A=B.R(J,"BV");c(/input|select|textarea|Bu|object/.S(I)?!J.v:"CC"==I||"B4"==I?J.href||!BB(A):!BB(A))&&!B(J)["B4"==I?"r":"closest"](":Bp").e},tabbable:u(J){N I=B.R(J,"BV");c(BB(I)||I>=G)&&B(J).is(":B3")}});u J(J,E,D,I){u A(I){N A=B[J][E][I]||[];c(g A=="h"?A.BM(/,?\\CD+/):A)}N C=A("getter");K(I.e==H&&g I[G]=="h")C=C.concat(A("B7"));c(B.inArray(D,C)!=-H)}B.i=u(C,A){N I=C.BM(".")[G];C=C.BM(".")[H];B.M[C]=u(F){N E=(g F=="h"),D=Array.2.slice.V(3,H);K(E&&F.substring(G,H)=="I")c Q;K(E&&J(I,C,F,D)){N A=B.W(Q[G],C);c(A?A[F].b(A,D):BD)}c Q.Y(u(){N J=B.W(Q,C);(!J&&!E&&B.W(Q,C,new B[I][C](Q,F)).B8());(J&&E&&B.B1(J[F])&&J[F].b(J,D))})};B[I]=B[I]||{};B[I][C]=u(J,D){N A=Q;Q.BK=I;Q.4=C;Q.BP=B[I][C].eventPrefix||C;Q.BG=I+"-"+C;Q.p=B.k({},B.i.0,B[I][C].0,B.Bo&&B.Bo.get(J)[C],D);Q.o=B(J).U("setData."+C,u(C,I,B){K(C.f==J)c A.x(I,B)}).U("getData."+C,u(B,I){K(B.f==J)c A.BN(I)}).U("l",u(){c A.Bh()})};B[I][C].2=B.k({},B.i.2,A);B[I][C].B7="Bi"};B.i.2={B8:u(){},Bh:u(){Q.o.removeData(Q.4).Be(Q.BG+"-v"+" "+Q.BK+"-Ba-v").BQ("Z-v")},Bi:u(J,I){N C=J,A=Q;K(g J=="h"){K(I===BD)c Q.BN(J);C={};C[J]=I}B.Y(C,u(J,I){A.x(J,I)})},BN:u(J){c Q.p[J]},x:u(J,I){Q.p[J]=I;K(J=="v")Q.o[I?"addClass":"Be"](Q.BG+"-v"+" "+Q.BK+"-Ba-v").R("Z-v",I)},enable:u(){Q.x("v",a)},disable:u(){Q.x("v",T)},_trigger:u(A,E,D){N I=Q.p[A],F=(A==Q.BP?A:Q.BP+A);E=B.Event(E);E.type=F;K(E.7)P(N J=B.Bl.Bk.e,C;J;){C=B.Bl.Bk[--J];E[C]=E.7[C]}Q.o.trigger(E,D);c!(B.B1(I)&&I.V(Q.o[G],E,D)===a||E.isDefaultPrevented())}};B.i.0={v:a};B.L.Bt={_mouseInit:u(){N J=Q;Q.o.U("mousedown."+Q.4,u(I){c J.BX(I)}).U("click."+Q.4,u(I){K(J._){J._=a;I.stopImmediatePropagation();c a}});K(B.q.X){Q.BT=Q.o.R("5");Q.o.R("5","Bf")}Q.started=a},_mouseDestroy:u(){Q.o.j("."+Q.4);(B.q.X&&Q.o.R("5",Q.BT))},BX:u(C){C.7=C.7||{};K(C.7.B$)c;(Q.6&&Q.y(C));Q.9=C;N A=Q,I=(C.which==H),J=(g Q.p.m=="h"?B(C.f).r().BE(C.f).n(Q.p.m).e:a);K(!I||J||!Q.Bs(C))c T;Q.8=!Q.p.BH;K(!Q.8)Q._mouseDelayTimer=setTimeout(u(){A.8=T},Q.p.BH);K(Q.BR(C)&&Q.BC(C)){Q.6=(Q.BO(C)!==a);K(!Q.6){C.BS();c T}}Q.$=u(J){c A.Bx(J)};Q.BA=u(J){c A.y(J)};B(1).U("BZ."+Q.4,Q.$).U("CA."+Q.4,Q.BA);(B.q.safari||C.BS());C.7.B$=T;c T},Bx:u(J){K(B.q.X&&!J.Bu)c Q.y(J);K(Q.6){Q.BL(J);c J.BS()}K(Q.BR(J)&&Q.BC(J)){Q.6=(Q.BO(Q.9,J)!==a);(Q.6?Q.BL(J):Q.y(J))}c!Q.6},y:u(J){B(1).j("BZ."+Q.4,Q.$).j("CA."+Q.4,Q.BA);K(Q.6){Q.6=a;Q._=(J.f==Q.9.f);Q.B6(J)}c a},BR:u(J){c(BJ.max(BJ.Bn(Q.9.Bj-J.Bj),BJ.Bn(Q.9.Bg-J.Bg))>=Q.p.Bd)},BC:u(J){c Q.8},BO:u(J){},BL:u(J){},B6:u(J){},Bs:u(J){c T}};B.L.Bt.0={m:null,Bd:H,BH:G}})(Bb)','0|1|_|$|if|ui|fn|var|css|for|this|attr|test|true|bind|call|data|msie|each|aria|false|apply|return|curCSS|length|target|typeof|string|widget|unbind|extend|remove|cancel|filter|element|options|browser|parents|replace|plugins|function|disabled|overflow|_setData|_mouseUp|position|defaults|document|prototype|arguments|widgetName|unselectable|_mouseStarted|originalEvent|mouseDelayMet|_mouseDownEvent|_preventClickEvent|_mouseMoveDelegate|_mouseUpDelegate|isNaN|_mouseDelayMet|undefined|add|aaa|widgetBaseClass|delay|isOverAxis|Math|namespace|_mouseDrag|split|_getData|_mouseStart|widgetEventPrefix|removeAttr|_mouseDistanceMet|preventDefault|_mouseUnselectable|selectstart|tabindex|absolute|_mouseDown|version|mousemove|state|jQuery|16|distance|removeClass|on|pageY|destroy|option|pageX|props|event|wairole|abs|metadata|hidden|auto|contains|_mouseCapture|mouse|button|y|9|_mouseMove|scroll|x|MozUserSelect|isFunction|compareDocumentPosition|focusable|area|fixed|_mouseStop|getterSetter|_init|eq|G|mouseHandled|mouseup|relative|a|s|3|7|8'.split('|'),129,134,/[\w\$]+/g,{},{},[])) \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.datepicker.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.datepicker.js new file mode 100644 index 0000000..514cf0d --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.datepicker.js @@ -0,0 +1,1626 @@ +/* + * jQuery UI Datepicker 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Datepicker + * + * Depends: + * ui.core.js + */ + +(function($) { // hide the namespace + +$.extend($.ui, { datepicker: { version: "1.7" } }); + +var PROP_NAME = 'datepicker'; + +/* Date picker manager. + Use the singleton instance of this class, $.datepicker, to interact with the date picker. + Settings for (groups of) date pickers are maintained in an instance object, + allowing multiple different settings on the same page. */ + +function Datepicker() { + this.debug = false; // Change this to true to start debugging + this._curInst = null; // The current instance in use + this._keyEvent = false; // If the last event was a key event + this._disabledInputs = []; // List of date picker inputs that have been disabled + this._datepickerShowing = false; // True if the popup picker is showing , false if not + this._inDialog = false; // True if showing within a "dialog", false if not + this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division + this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class + this._appendClass = 'ui-datepicker-append'; // The name of the append marker class + this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class + this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class + this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class + this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class + this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class + this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class + this.regional = []; // Available regional settings, indexed by language code + this.regional[''] = { // Default regional settings + closeText: 'Done', // Display text for close link + prevText: 'Prev', // Display text for previous month link + nextText: 'Next', // Display text for next month link + currentText: 'Today', // Display text for current month link + monthNames: ['January','February','March','April','May','June', + 'July','August','September','October','November','December'], // Names of months for drop-down and formatting + monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting + dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting + dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting + dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday + dateFormat: 'mm/dd/yy', // See format options on parseDate + firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... + isRTL: false // True if right-to-left language, false if left-to-right + }; + this._defaults = { // Global defaults for all the date picker instances + showOn: 'focus', // 'focus' for popup on focus, + // 'button' for trigger button, or 'both' for either + showAnim: 'show', // Name of jQuery animation for popup + showOptions: {}, // Options for enhanced animations + defaultDate: null, // Used when field is blank: actual date, + // +/-number for offset from today, null for today + appendText: '', // Display text following the input box, e.g. showing the format + buttonText: '...', // Text for trigger button + buttonImage: '', // URL for trigger button image + buttonImageOnly: false, // True if the image appears alone, false if it appears on a button + hideIfNoPrevNext: false, // True to hide next/previous month links + // if not applicable, false to just disable them + navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links + gotoCurrent: false, // True if today link goes back to current selection instead + changeMonth: false, // True if month can be selected directly, false if only prev/next + changeYear: false, // True if year can be selected directly, false if only prev/next + showMonthAfterYear: false, // True if the year select precedes month, false for month then year + yearRange: '-10:+10', // Range of years to display in drop-down, + // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn) + showOtherMonths: false, // True to show dates in other months, false to leave blank + calculateWeek: this.iso8601Week, // How to calculate the week of the year, + // takes a Date and returns the number of the week for it + shortYearCutoff: '+10', // Short year values < this are in the current century, + // > this are in the previous century, + // string value starting with '+' for current year + value + minDate: null, // The earliest selectable date, or null for no limit + maxDate: null, // The latest selectable date, or null for no limit + duration: 'normal', // Duration of display/closure + beforeShowDay: null, // Function that takes a date and returns an array with + // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', + // [2] = cell title (optional), e.g. $.datepicker.noWeekends + beforeShow: null, // Function that takes an input field and + // returns a set of custom settings for the date picker + onSelect: null, // Define a callback function when a date is selected + onChangeMonthYear: null, // Define a callback function when the month or year is changed + onClose: null, // Define a callback function when the datepicker is closed + numberOfMonths: 1, // Number of months to show at a time + showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) + stepMonths: 1, // Number of months to step back/forward + stepBigMonths: 12, // Number of months to step back/forward for the big links + altField: '', // Selector for an alternate field to store selected dates into + altFormat: '', // The date format to use for the alternate field + constrainInput: true, // The input is constrained by the current date format + showButtonPanel: false // True to show button panel, false to not show it + }; + $.extend(this._defaults, this.regional['']); + this.dpDiv = $('
    '); +} + +$.extend(Datepicker.prototype, { + /* Class name added to elements to indicate already configured with a date picker. */ + markerClassName: 'hasDatepicker', + + /* Debug logging (if enabled). */ + log: function () { + if (this.debug) + console.log.apply('', arguments); + }, + + /* Override the default settings for all instances of the date picker. + @param settings object - the new settings to use as defaults (anonymous object) + @return the manager object */ + setDefaults: function(settings) { + extendRemove(this._defaults, settings || {}); + return this; + }, + + /* Attach the date picker to a jQuery selection. + @param target element - the target input field or division or span + @param settings object - the new settings to use for this date picker instance (anonymous) */ + _attachDatepicker: function(target, settings) { + // check for settings on the control itself - in namespace 'date:' + var inlineSettings = null; + for (var attrName in this._defaults) { + var attrValue = target.getAttribute('date:' + attrName); + if (attrValue) { + inlineSettings = inlineSettings || {}; + try { + inlineSettings[attrName] = eval(attrValue); + } catch (err) { + inlineSettings[attrName] = attrValue; + } + } + } + var nodeName = target.nodeName.toLowerCase(); + var inline = (nodeName == 'div' || nodeName == 'span'); + if (!target.id) + target.id = 'dp' + (++this.uuid); + var inst = this._newInst($(target), inline); + inst.settings = $.extend({}, settings || {}, inlineSettings || {}); + if (nodeName == 'input') { + this._connectDatepicker(target, inst); + } else if (inline) { + this._inlineDatepicker(target, inst); + } + }, + + /* Create a new instance object. */ + _newInst: function(target, inline) { + var id = target[0].id.replace(/([:\[\]\.])/g, '\\\\$1'); // escape jQuery meta chars + return {id: id, input: target, // associated target + selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection + drawMonth: 0, drawYear: 0, // month being drawn + inline: inline, // is datepicker inline or not + dpDiv: (!inline ? this.dpDiv : // presentation div + $('
    '))}; + }, + + /* Attach the date picker to an input field. */ + _connectDatepicker: function(target, inst) { + var input = $(target); + if (input.hasClass(this.markerClassName)) + return; + var appendText = this._get(inst, 'appendText'); + var isRTL = this._get(inst, 'isRTL'); + if (appendText) + input[isRTL ? 'before' : 'after']('' + appendText + ''); + var showOn = this._get(inst, 'showOn'); + if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field + input.focus(this._showDatepicker); + if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked + var buttonText = this._get(inst, 'buttonText'); + var buttonImage = this._get(inst, 'buttonImage'); + var trigger = $(this._get(inst, 'buttonImageOnly') ? + $('').addClass(this._triggerClass). + attr({ src: buttonImage, alt: buttonText, title: buttonText }) : + $('').addClass(this._triggerClass). + html(buttonImage == '' ? buttonText : $('').attr( + { src:buttonImage, alt:buttonText, title:buttonText }))); + input[isRTL ? 'before' : 'after'](trigger); + trigger.click(function() { + if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target) + $.datepicker._hideDatepicker(); + else + $.datepicker._showDatepicker(target); + return false; + }); + } + input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress). + bind("setData.datepicker", function(event, key, value) { + inst.settings[key] = value; + }).bind("getData.datepicker", function(event, key) { + return this._get(inst, key); + }); + $.data(target, PROP_NAME, inst); + }, + + /* Attach an inline date picker to a div. */ + _inlineDatepicker: function(target, inst) { + var divSpan = $(target); + if (divSpan.hasClass(this.markerClassName)) + return; + divSpan.addClass(this.markerClassName).append(inst.dpDiv). + bind("setData.datepicker", function(event, key, value){ + inst.settings[key] = value; + }).bind("getData.datepicker", function(event, key){ + return this._get(inst, key); + }); + $.data(target, PROP_NAME, inst); + this._setDate(inst, this._getDefaultDate(inst)); + this._updateDatepicker(inst); + this._updateAlternate(inst); + }, + + /* Pop-up the date picker in a "dialog" box. + @param input element - ignored + @param dateText string - the initial date to display (in the current format) + @param onSelect function - the function(dateText) to call when a date is selected + @param settings object - update the dialog date picker instance's settings (anonymous object) + @param pos int[2] - coordinates for the dialog's position within the screen or + event - with x/y coordinates or + leave empty for default (screen centre) + @return the manager object */ + _dialogDatepicker: function(input, dateText, onSelect, settings, pos) { + var inst = this._dialogInst; // internal instance + if (!inst) { + var id = 'dp' + (++this.uuid); + this._dialogInput = $(''); + this._dialogInput.keydown(this._doKeyDown); + $('body').append(this._dialogInput); + inst = this._dialogInst = this._newInst(this._dialogInput, false); + inst.settings = {}; + $.data(this._dialogInput[0], PROP_NAME, inst); + } + extendRemove(inst.settings, settings || {}); + this._dialogInput.val(dateText); + + this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); + if (!this._pos) { + var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; + var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; + var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; + var scrollY = document.documentElement.scrollTop || document.body.scrollTop; + this._pos = // should use actual width/height below + [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; + } + + // move input on screen for focus, but hidden behind dialog + this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px'); + inst.settings.onSelect = onSelect; + this._inDialog = true; + this.dpDiv.addClass(this._dialogClass); + this._showDatepicker(this._dialogInput[0]); + if ($.blockUI) + $.blockUI(this.dpDiv); + $.data(this._dialogInput[0], PROP_NAME, inst); + return this; + }, + + /* Detach a datepicker from its control. + @param target element - the target input field or division or span */ + _destroyDatepicker: function(target) { + var $target = $(target); + if (!$target.hasClass(this.markerClassName)) { + return; + } + var nodeName = target.nodeName.toLowerCase(); + $.removeData(target, PROP_NAME); + if (nodeName == 'input') { + $target.siblings('.' + this._appendClass).remove().end(). + siblings('.' + this._triggerClass).remove().end(). + removeClass(this.markerClassName). + unbind('focus', this._showDatepicker). + unbind('keydown', this._doKeyDown). + unbind('keypress', this._doKeyPress); + } else if (nodeName == 'div' || nodeName == 'span') + $target.removeClass(this.markerClassName).empty(); + }, + + /* Enable the date picker to a jQuery selection. + @param target element - the target input field or division or span */ + _enableDatepicker: function(target) { + var $target = $(target); + if (!$target.hasClass(this.markerClassName)) { + return; + } + var nodeName = target.nodeName.toLowerCase(); + if (nodeName == 'input') { + target.disabled = false; + $target.siblings('button.' + this._triggerClass). + each(function() { this.disabled = false; }).end(). + siblings('img.' + this._triggerClass). + css({opacity: '1.0', cursor: ''}); + } + else if (nodeName == 'div' || nodeName == 'span') { + var inline = $target.children('.' + this._inlineClass); + inline.children().removeClass('ui-state-disabled'); + } + this._disabledInputs = $.map(this._disabledInputs, + function(value) { return (value == target ? null : value); }); // delete entry + }, + + /* Disable the date picker to a jQuery selection. + @param target element - the target input field or division or span */ + _disableDatepicker: function(target) { + var $target = $(target); + if (!$target.hasClass(this.markerClassName)) { + return; + } + var nodeName = target.nodeName.toLowerCase(); + if (nodeName == 'input') { + target.disabled = true; + $target.siblings('button.' + this._triggerClass). + each(function() { this.disabled = true; }).end(). + siblings('img.' + this._triggerClass). + css({opacity: '0.5', cursor: 'default'}); + } + else if (nodeName == 'div' || nodeName == 'span') { + var inline = $target.children('.' + this._inlineClass); + inline.children().addClass('ui-state-disabled'); + } + this._disabledInputs = $.map(this._disabledInputs, + function(value) { return (value == target ? null : value); }); // delete entry + this._disabledInputs[this._disabledInputs.length] = target; + }, + + /* Is the first field in a jQuery collection disabled as a datepicker? + @param target element - the target input field or division or span + @return boolean - true if disabled, false if enabled */ + _isDisabledDatepicker: function(target) { + if (!target) { + return false; + } + for (var i = 0; i < this._disabledInputs.length; i++) { + if (this._disabledInputs[i] == target) + return true; + } + return false; + }, + + /* Retrieve the instance data for the target control. + @param target element - the target input field or division or span + @return object - the associated instance data + @throws error if a jQuery problem getting data */ + _getInst: function(target) { + try { + return $.data(target, PROP_NAME); + } + catch (err) { + throw 'Missing instance data for this datepicker'; + } + }, + + /* Update the settings for a date picker attached to an input field or division. + @param target element - the target input field or division or span + @param name object - the new settings to update or + string - the name of the setting to change or + @param value any - the new value for the setting (omit if above is an object) */ + _optionDatepicker: function(target, name, value) { + var settings = name || {}; + if (typeof name == 'string') { + settings = {}; + settings[name] = value; + } + var inst = this._getInst(target); + if (inst) { + if (this._curInst == inst) { + this._hideDatepicker(null); + } + extendRemove(inst.settings, settings); + var date = new Date(); + extendRemove(inst, {rangeStart: null, // start of range + endDay: null, endMonth: null, endYear: null, // end of range + selectedDay: date.getDate(), selectedMonth: date.getMonth(), + selectedYear: date.getFullYear(), // starting point + currentDay: date.getDate(), currentMonth: date.getMonth(), + currentYear: date.getFullYear(), // current selection + drawMonth: date.getMonth(), drawYear: date.getFullYear()}); // month being drawn + this._updateDatepicker(inst); + } + }, + + // change method deprecated + _changeDatepicker: function(target, name, value) { + this._optionDatepicker(target, name, value); + }, + + /* Redraw the date picker attached to an input field or division. + @param target element - the target input field or division or span */ + _refreshDatepicker: function(target) { + var inst = this._getInst(target); + if (inst) { + this._updateDatepicker(inst); + } + }, + + /* Set the dates for a jQuery selection. + @param target element - the target input field or division or span + @param date Date - the new date + @param endDate Date - the new end date for a range (optional) */ + _setDateDatepicker: function(target, date, endDate) { + var inst = this._getInst(target); + if (inst) { + this._setDate(inst, date, endDate); + this._updateDatepicker(inst); + this._updateAlternate(inst); + } + }, + + /* Get the date(s) for the first entry in a jQuery selection. + @param target element - the target input field or division or span + @return Date - the current date or + Date[2] - the current dates for a range */ + _getDateDatepicker: function(target) { + var inst = this._getInst(target); + if (inst && !inst.inline) + this._setDateFromField(inst); + return (inst ? this._getDate(inst) : null); + }, + + /* Handle keystrokes. */ + _doKeyDown: function(event) { + var inst = $.datepicker._getInst(event.target); + var handled = true; + var isRTL = inst.dpDiv.is('.ui-datepicker-rtl'); + inst._keyEvent = true; + if ($.datepicker._datepickerShowing) + switch (event.keyCode) { + case 9: $.datepicker._hideDatepicker(null, ''); + break; // hide on tab out + case 13: var sel = $('td.' + $.datepicker._dayOverClass + + ', td.' + $.datepicker._currentClass, inst.dpDiv); + if (sel[0]) + $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); + else + $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration')); + return false; // don't submit the form + break; // select the value on enter + case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration')); + break; // hide on escape + case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? + -$.datepicker._get(inst, 'stepBigMonths') : + -$.datepicker._get(inst, 'stepMonths')), 'M'); + break; // previous month/year on page up/+ ctrl + case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? + +$.datepicker._get(inst, 'stepBigMonths') : + +$.datepicker._get(inst, 'stepMonths')), 'M'); + break; // next month/year on page down/+ ctrl + case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target); + handled = event.ctrlKey || event.metaKey; + break; // clear on ctrl or command +end + case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target); + handled = event.ctrlKey || event.metaKey; + break; // current on ctrl or command +home + case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D'); + handled = event.ctrlKey || event.metaKey; + // -1 day on ctrl or command +left + if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? + -$.datepicker._get(inst, 'stepBigMonths') : + -$.datepicker._get(inst, 'stepMonths')), 'M'); + // next month/year on alt +left on Mac + break; + case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D'); + handled = event.ctrlKey || event.metaKey; + break; // -1 week on ctrl or command +up + case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D'); + handled = event.ctrlKey || event.metaKey; + // +1 day on ctrl or command +right + if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? + +$.datepicker._get(inst, 'stepBigMonths') : + +$.datepicker._get(inst, 'stepMonths')), 'M'); + // next month/year on alt +right + break; + case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D'); + handled = event.ctrlKey || event.metaKey; + break; // +1 week on ctrl or command +down + default: handled = false; + } + else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home + $.datepicker._showDatepicker(this); + else { + handled = false; + } + if (handled) { + event.preventDefault(); + event.stopPropagation(); + } + }, + + /* Filter entered characters - based on date format. */ + _doKeyPress: function(event) { + var inst = $.datepicker._getInst(event.target); + if ($.datepicker._get(inst, 'constrainInput')) { + var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); + var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); + return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); + } + }, + + /* Pop-up the date picker for a given input field. + @param input element - the input field attached to the date picker or + event - if triggered by focus */ + _showDatepicker: function(input) { + input = input.target || input; + if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger + input = $('input', input.parentNode)[0]; + if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here + return; + var inst = $.datepicker._getInst(input); + var beforeShow = $.datepicker._get(inst, 'beforeShow'); + extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {})); + $.datepicker._hideDatepicker(null, ''); + $.datepicker._lastInput = input; + $.datepicker._setDateFromField(inst); + if ($.datepicker._inDialog) // hide cursor + input.value = ''; + if (!$.datepicker._pos) { // position below input + $.datepicker._pos = $.datepicker._findPos(input); + $.datepicker._pos[1] += input.offsetHeight; // add the height + } + var isFixed = false; + $(input).parents().each(function() { + isFixed |= $(this).css('position') == 'fixed'; + return !isFixed; + }); + if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled + $.datepicker._pos[0] -= document.documentElement.scrollLeft; + $.datepicker._pos[1] -= document.documentElement.scrollTop; + } + var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; + $.datepicker._pos = null; + inst.rangeStart = null; + // determine sizing offscreen + inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); + $.datepicker._updateDatepicker(inst); + // fix width for dynamic number of date pickers + // and adjust position before showing + offset = $.datepicker._checkOffset(inst, offset, isFixed); + inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? + 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', + left: offset.left + 'px', top: offset.top + 'px'}); + if (!inst.inline) { + var showAnim = $.datepicker._get(inst, 'showAnim') || 'show'; + var duration = $.datepicker._get(inst, 'duration'); + var postProcess = function() { + $.datepicker._datepickerShowing = true; + if ($.browser.msie && parseInt($.browser.version,10) < 7) // fix IE < 7 select problems + $('iframe.ui-datepicker-cover').css({width: inst.dpDiv.width() + 4, + height: inst.dpDiv.height() + 4}); + }; + if ($.effects && $.effects[showAnim]) + inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); + else + inst.dpDiv[showAnim](duration, postProcess); + if (duration == '') + postProcess(); + if (inst.input[0].type != 'hidden') + inst.input[0].focus(); + $.datepicker._curInst = inst; + } + }, + + /* Generate the date picker content. */ + _updateDatepicker: function(inst) { + var dims = {width: inst.dpDiv.width() + 4, + height: inst.dpDiv.height() + 4}; + var self = this; + inst.dpDiv.empty().append(this._generateHTML(inst)) + .find('iframe.ui-datepicker-cover'). + css({width: dims.width, height: dims.height}) + .end() + .find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a') + .bind('mouseout', function(){ + $(this).removeClass('ui-state-hover'); + if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); + if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); + }) + .bind('mouseover', function(){ + if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) { + $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); + $(this).addClass('ui-state-hover'); + if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); + if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); + } + }) + .end() + .find('.' + this._dayOverClass + ' a') + .trigger('mouseover') + .end(); + var numMonths = this._getNumberOfMonths(inst); + var cols = numMonths[1]; + var width = 17; + if (cols > 1) { + inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em'); + } else { + inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width(''); + } + inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + + 'Class']('ui-datepicker-multi'); + inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + + 'Class']('ui-datepicker-rtl'); + if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst) + $(inst.input[0]).focus(); + }, + + /* Check positioning to remain on screen. */ + _checkOffset: function(inst, offset, isFixed) { + var dpWidth = inst.dpDiv.outerWidth(); + var dpHeight = inst.dpDiv.outerHeight(); + var inputWidth = inst.input ? inst.input.outerWidth() : 0; + var inputHeight = inst.input ? inst.input.outerHeight() : 0; + var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft(); + var viewHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) + $(document).scrollTop(); + + offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); + offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; + offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; + + // now check if datepicker is showing outside window viewport - move to a better place if so. + offset.left -= (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0; + offset.top -= (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight*2 - viewHeight) : 0; + + return offset; + }, + + /* Find an object's position on the screen. */ + _findPos: function(obj) { + while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) { + obj = obj.nextSibling; + } + var position = $(obj).offset(); + return [position.left, position.top]; + }, + + /* Hide the date picker from view. + @param input element - the input field attached to the date picker + @param duration string - the duration over which to close the date picker */ + _hideDatepicker: function(input, duration) { + var inst = this._curInst; + if (!inst || (input && inst != $.data(input, PROP_NAME))) + return; + if (inst.stayOpen) + this._selectDate('#' + inst.id, this._formatDate(inst, + inst.currentDay, inst.currentMonth, inst.currentYear)); + inst.stayOpen = false; + if (this._datepickerShowing) { + duration = (duration != null ? duration : this._get(inst, 'duration')); + var showAnim = this._get(inst, 'showAnim'); + var postProcess = function() { + $.datepicker._tidyDialog(inst); + }; + if (duration != '' && $.effects && $.effects[showAnim]) + inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), + duration, postProcess); + else + inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' : + (showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess); + if (duration == '') + this._tidyDialog(inst); + var onClose = this._get(inst, 'onClose'); + if (onClose) + onClose.apply((inst.input ? inst.input[0] : null), + [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback + this._datepickerShowing = false; + this._lastInput = null; + if (this._inDialog) { + this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); + if ($.blockUI) { + $.unblockUI(); + $('body').append(this.dpDiv); + } + } + this._inDialog = false; + } + this._curInst = null; + }, + + /* Tidy up after a dialog display. */ + _tidyDialog: function(inst) { + inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar'); + }, + + /* Close date picker if clicked elsewhere. */ + _checkExternalClick: function(event) { + if (!$.datepicker._curInst) + return; + var $target = $(event.target); + if (($target.parents('#' + $.datepicker._mainDivId).length == 0) && + !$target.hasClass($.datepicker.markerClassName) && + !$target.hasClass($.datepicker._triggerClass) && + $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) + $.datepicker._hideDatepicker(null, ''); + }, + + /* Adjust one of the date sub-fields. */ + _adjustDate: function(id, offset, period) { + var target = $(id); + var inst = this._getInst(target[0]); + if (this._isDisabledDatepicker(target[0])) { + return; + } + this._adjustInstDate(inst, offset + + (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning + period); + this._updateDatepicker(inst); + }, + + /* Action for current link. */ + _gotoToday: function(id) { + var target = $(id); + var inst = this._getInst(target[0]); + if (this._get(inst, 'gotoCurrent') && inst.currentDay) { + inst.selectedDay = inst.currentDay; + inst.drawMonth = inst.selectedMonth = inst.currentMonth; + inst.drawYear = inst.selectedYear = inst.currentYear; + } + else { + var date = new Date(); + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + } + this._notifyChange(inst); + this._adjustDate(target); + }, + + /* Action for selecting a new month/year. */ + _selectMonthYear: function(id, select, period) { + var target = $(id); + var inst = this._getInst(target[0]); + inst._selectingMonthYear = false; + inst['selected' + (period == 'M' ? 'Month' : 'Year')] = + inst['draw' + (period == 'M' ? 'Month' : 'Year')] = + parseInt(select.options[select.selectedIndex].value,10); + this._notifyChange(inst); + this._adjustDate(target); + }, + + /* Restore input focus after not changing month/year. */ + _clickMonthYear: function(id) { + var target = $(id); + var inst = this._getInst(target[0]); + if (inst.input && inst._selectingMonthYear && !$.browser.msie) + inst.input[0].focus(); + inst._selectingMonthYear = !inst._selectingMonthYear; + }, + + /* Action for selecting a day. */ + _selectDay: function(id, month, year, td) { + var target = $(id); + if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { + return; + } + var inst = this._getInst(target[0]); + inst.selectedDay = inst.currentDay = $('a', td).html(); + inst.selectedMonth = inst.currentMonth = month; + inst.selectedYear = inst.currentYear = year; + if (inst.stayOpen) { + inst.endDay = inst.endMonth = inst.endYear = null; + } + this._selectDate(id, this._formatDate(inst, + inst.currentDay, inst.currentMonth, inst.currentYear)); + if (inst.stayOpen) { + inst.rangeStart = this._daylightSavingAdjust( + new Date(inst.currentYear, inst.currentMonth, inst.currentDay)); + this._updateDatepicker(inst); + } + }, + + /* Erase the input field and hide the date picker. */ + _clearDate: function(id) { + var target = $(id); + var inst = this._getInst(target[0]); + inst.stayOpen = false; + inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null; + this._selectDate(target, ''); + }, + + /* Update the input field with the selected date. */ + _selectDate: function(id, dateStr) { + var target = $(id); + var inst = this._getInst(target[0]); + dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); + if (inst.input) + inst.input.val(dateStr); + this._updateAlternate(inst); + var onSelect = this._get(inst, 'onSelect'); + if (onSelect) + onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback + else if (inst.input) + inst.input.trigger('change'); // fire the change event + if (inst.inline) + this._updateDatepicker(inst); + else if (!inst.stayOpen) { + this._hideDatepicker(null, this._get(inst, 'duration')); + this._lastInput = inst.input[0]; + if (typeof(inst.input[0]) != 'object') + inst.input[0].focus(); // restore focus + this._lastInput = null; + } + }, + + /* Update any alternate field to synchronise with the main field. */ + _updateAlternate: function(inst) { + var altField = this._get(inst, 'altField'); + if (altField) { // update alternate field too + var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat'); + var date = this._getDate(inst); + dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); + $(altField).each(function() { $(this).val(dateStr); }); + } + }, + + /* Set as beforeShowDay function to prevent selection of weekends. + @param date Date - the date to customise + @return [boolean, string] - is this date selectable?, what is its CSS class? */ + noWeekends: function(date) { + var day = date.getDay(); + return [(day > 0 && day < 6), '']; + }, + + /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. + @param date Date - the date to get the week for + @return number - the number of the week within the year that contains this date */ + iso8601Week: function(date) { + var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate()); + var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan + var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7 + firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday + if (firstDay < 4 && checkDate < firstMon) { // Adjust first three days in year if necessary + checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year + return $.datepicker.iso8601Week(checkDate); + } else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year + firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7; + if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary + return 1; + } + } + return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date + }, + + /* Parse a string value into a date object. + See formatDate below for the possible formats. + + @param format string - the expected format of the date + @param value string - the date in the above format + @param settings Object - attributes include: + shortYearCutoff number - the cutoff year for determining the century (optional) + dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + dayNames string[7] - names of the days from Sunday (optional) + monthNamesShort string[12] - abbreviated names of the months (optional) + monthNames string[12] - names of the months (optional) + @return Date - the extracted date value or null if value is blank */ + parseDate: function (format, value, settings) { + if (format == null || value == null) + throw 'Invalid arguments'; + value = (typeof value == 'object' ? value.toString() : value + ''); + if (value == '') + return null; + var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; + var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; + var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; + var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; + var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; + var year = -1; + var month = -1; + var day = -1; + var doy = -1; + var literal = false; + // Check whether a format character is doubled + var lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); + if (matches) + iFormat++; + return matches; + }; + // Extract a number from the string value + var getNumber = function(match) { + lookAhead(match); + var origSize = (match == '@' ? 14 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2))); + var size = origSize; + var num = 0; + while (size > 0 && iValue < value.length && + value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') { + num = num * 10 + parseInt(value.charAt(iValue++),10); + size--; + } + if (size == origSize) + throw 'Missing number at position ' + iValue; + return num; + }; + // Extract a name from the string value and convert to an index + var getName = function(match, shortNames, longNames) { + var names = (lookAhead(match) ? longNames : shortNames); + var size = 0; + for (var j = 0; j < names.length; j++) + size = Math.max(size, names[j].length); + var name = ''; + var iInit = iValue; + while (size > 0 && iValue < value.length) { + name += value.charAt(iValue++); + for (var i = 0; i < names.length; i++) + if (name == names[i]) + return i + 1; + size--; + } + throw 'Unknown name at position ' + iInit; + }; + // Confirm that a literal character matches the string value + var checkLiteral = function() { + if (value.charAt(iValue) != format.charAt(iFormat)) + throw 'Unexpected literal at position ' + iValue; + iValue++; + }; + var iValue = 0; + for (var iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) + if (format.charAt(iFormat) == "'" && !lookAhead("'")) + literal = false; + else + checkLiteral(); + else + switch (format.charAt(iFormat)) { + case 'd': + day = getNumber('d'); + break; + case 'D': + getName('D', dayNamesShort, dayNames); + break; + case 'o': + doy = getNumber('o'); + break; + case 'm': + month = getNumber('m'); + break; + case 'M': + month = getName('M', monthNamesShort, monthNames); + break; + case 'y': + year = getNumber('y'); + break; + case '@': + var date = new Date(getNumber('@')); + year = date.getFullYear(); + month = date.getMonth() + 1; + day = date.getDate(); + break; + case "'": + if (lookAhead("'")) + checkLiteral(); + else + literal = true; + break; + default: + checkLiteral(); + } + } + if (year == -1) + year = new Date().getFullYear(); + else if (year < 100) + year += new Date().getFullYear() - new Date().getFullYear() % 100 + + (year <= shortYearCutoff ? 0 : -100); + if (doy > -1) { + month = 1; + day = doy; + do { + var dim = this._getDaysInMonth(year, month - 1); + if (day <= dim) + break; + month++; + day -= dim; + } while (true); + } + var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); + if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) + throw 'Invalid date'; // E.g. 31/02/* + return date; + }, + + /* Standard date formats. */ + ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) + COOKIE: 'D, dd M yy', + ISO_8601: 'yy-mm-dd', + RFC_822: 'D, d M y', + RFC_850: 'DD, dd-M-y', + RFC_1036: 'D, d M y', + RFC_1123: 'D, d M yy', + RFC_2822: 'D, d M yy', + RSS: 'D, d M y', // RFC 822 + TIMESTAMP: '@', + W3C: 'yy-mm-dd', // ISO 8601 + + /* Format a date object into a string value. + The format can be combinations of the following: + d - day of month (no leading zero) + dd - day of month (two digit) + o - day of year (no leading zeros) + oo - day of year (three digit) + D - day name short + DD - day name long + m - month of year (no leading zero) + mm - month of year (two digit) + M - month name short + MM - month name long + y - year (two digit) + yy - year (four digit) + @ - Unix timestamp (ms since 01/01/1970) + '...' - literal text + '' - single quote + + @param format string - the desired format of the date + @param date Date - the date value to format + @param settings Object - attributes include: + dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + dayNames string[7] - names of the days from Sunday (optional) + monthNamesShort string[12] - abbreviated names of the months (optional) + monthNames string[12] - names of the months (optional) + @return string - the date in the above format */ + formatDate: function (format, date, settings) { + if (!date) + return ''; + var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; + var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; + var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; + var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; + // Check whether a format character is doubled + var lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); + if (matches) + iFormat++; + return matches; + }; + // Format a number, with leading zero if necessary + var formatNumber = function(match, value, len) { + var num = '' + value; + if (lookAhead(match)) + while (num.length < len) + num = '0' + num; + return num; + }; + // Format a name, short or long as requested + var formatName = function(match, value, shortNames, longNames) { + return (lookAhead(match) ? longNames[value] : shortNames[value]); + }; + var output = ''; + var literal = false; + if (date) + for (var iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) + if (format.charAt(iFormat) == "'" && !lookAhead("'")) + literal = false; + else + output += format.charAt(iFormat); + else + switch (format.charAt(iFormat)) { + case 'd': + output += formatNumber('d', date.getDate(), 2); + break; + case 'D': + output += formatName('D', date.getDay(), dayNamesShort, dayNames); + break; + case 'o': + var doy = date.getDate(); + for (var m = date.getMonth() - 1; m >= 0; m--) + doy += this._getDaysInMonth(date.getFullYear(), m); + output += formatNumber('o', doy, 3); + break; + case 'm': + output += formatNumber('m', date.getMonth() + 1, 2); + break; + case 'M': + output += formatName('M', date.getMonth(), monthNamesShort, monthNames); + break; + case 'y': + output += (lookAhead('y') ? date.getFullYear() : + (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); + break; + case '@': + output += date.getTime(); + break; + case "'": + if (lookAhead("'")) + output += "'"; + else + literal = true; + break; + default: + output += format.charAt(iFormat); + } + } + return output; + }, + + /* Extract all possible characters from the date format. */ + _possibleChars: function (format) { + var chars = ''; + var literal = false; + for (var iFormat = 0; iFormat < format.length; iFormat++) + if (literal) + if (format.charAt(iFormat) == "'" && !lookAhead("'")) + literal = false; + else + chars += format.charAt(iFormat); + else + switch (format.charAt(iFormat)) { + case 'd': case 'm': case 'y': case '@': + chars += '0123456789'; + break; + case 'D': case 'M': + return null; // Accept anything + case "'": + if (lookAhead("'")) + chars += "'"; + else + literal = true; + break; + default: + chars += format.charAt(iFormat); + } + return chars; + }, + + /* Get a setting value, defaulting if necessary. */ + _get: function(inst, name) { + return inst.settings[name] !== undefined ? + inst.settings[name] : this._defaults[name]; + }, + + /* Parse existing date and initialise date picker. */ + _setDateFromField: function(inst) { + var dateFormat = this._get(inst, 'dateFormat'); + var dates = inst.input ? inst.input.val() : null; + inst.endDay = inst.endMonth = inst.endYear = null; + var date = defaultDate = this._getDefaultDate(inst); + var settings = this._getFormatConfig(inst); + try { + date = this.parseDate(dateFormat, dates, settings) || defaultDate; + } catch (event) { + this.log(event); + date = defaultDate; + } + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + inst.currentDay = (dates ? date.getDate() : 0); + inst.currentMonth = (dates ? date.getMonth() : 0); + inst.currentYear = (dates ? date.getFullYear() : 0); + this._adjustInstDate(inst); + }, + + /* Retrieve the default date shown on opening. */ + _getDefaultDate: function(inst) { + var date = this._determineDate(this._get(inst, 'defaultDate'), new Date()); + var minDate = this._getMinMaxDate(inst, 'min', true); + var maxDate = this._getMinMaxDate(inst, 'max'); + date = (minDate && date < minDate ? minDate : date); + date = (maxDate && date > maxDate ? maxDate : date); + return date; + }, + + /* A date may be specified as an exact value or a relative one. */ + _determineDate: function(date, defaultDate) { + var offsetNumeric = function(offset) { + var date = new Date(); + date.setDate(date.getDate() + offset); + return date; + }; + var offsetString = function(offset, getDaysInMonth) { + var date = new Date(); + var year = date.getFullYear(); + var month = date.getMonth(); + var day = date.getDate(); + var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; + var matches = pattern.exec(offset); + while (matches) { + switch (matches[2] || 'd') { + case 'd' : case 'D' : + day += parseInt(matches[1],10); break; + case 'w' : case 'W' : + day += parseInt(matches[1],10) * 7; break; + case 'm' : case 'M' : + month += parseInt(matches[1],10); + day = Math.min(day, getDaysInMonth(year, month)); + break; + case 'y': case 'Y' : + year += parseInt(matches[1],10); + day = Math.min(day, getDaysInMonth(year, month)); + break; + } + matches = pattern.exec(offset); + } + return new Date(year, month, day); + }; + date = (date == null ? defaultDate : + (typeof date == 'string' ? offsetString(date, this._getDaysInMonth) : + (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date))); + date = (date && date.toString() == 'Invalid Date' ? defaultDate : date); + if (date) { + date.setHours(0); + date.setMinutes(0); + date.setSeconds(0); + date.setMilliseconds(0); + } + return this._daylightSavingAdjust(date); + }, + + /* Handle switch to/from daylight saving. + Hours may be non-zero on daylight saving cut-over: + > 12 when midnight changeover, but then cannot generate + midnight datetime, so jump to 1AM, otherwise reset. + @param date (Date) the date to check + @return (Date) the corrected date */ + _daylightSavingAdjust: function(date) { + if (!date) return null; + date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); + return date; + }, + + /* Set the date(s) directly. */ + _setDate: function(inst, date, endDate) { + var clear = !(date); + var origMonth = inst.selectedMonth; + var origYear = inst.selectedYear; + date = this._determineDate(date, new Date()); + inst.selectedDay = inst.currentDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear(); + if (origMonth != inst.selectedMonth || origYear != inst.selectedYear) + this._notifyChange(inst); + this._adjustInstDate(inst); + if (inst.input) { + inst.input.val(clear ? '' : this._formatDate(inst)); + } + }, + + /* Retrieve the date(s) directly. */ + _getDate: function(inst) { + var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : + this._daylightSavingAdjust(new Date( + inst.currentYear, inst.currentMonth, inst.currentDay))); + return startDate; + }, + + /* Generate the HTML for the current state of the date picker. */ + _generateHTML: function(inst) { + var today = new Date(); + today = this._daylightSavingAdjust( + new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time + var isRTL = this._get(inst, 'isRTL'); + var showButtonPanel = this._get(inst, 'showButtonPanel'); + var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); + var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); + var numMonths = this._getNumberOfMonths(inst); + var showCurrentAtPos = this._get(inst, 'showCurrentAtPos'); + var stepMonths = this._get(inst, 'stepMonths'); + var stepBigMonths = this._get(inst, 'stepBigMonths'); + var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); + var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : + new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); + var minDate = this._getMinMaxDate(inst, 'min', true); + var maxDate = this._getMinMaxDate(inst, 'max'); + var drawMonth = inst.drawMonth - showCurrentAtPos; + var drawYear = inst.drawYear; + if (drawMonth < 0) { + drawMonth += 12; + drawYear--; + } + if (maxDate) { + var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), + maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate())); + maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); + while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { + drawMonth--; + if (drawMonth < 0) { + drawMonth = 11; + drawYear--; + } + } + } + inst.drawMonth = drawMonth; + inst.drawYear = drawYear; + var prevText = this._get(inst, 'prevText'); + prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, + this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), + this._getFormatConfig(inst))); + var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? + '' + prevText + '' : + (hideIfNoPrevNext ? '' : '' + prevText + '')); + var nextText = this._get(inst, 'nextText'); + nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, + this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), + this._getFormatConfig(inst))); + var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? + '' + nextText + '' : + (hideIfNoPrevNext ? '' : '' + nextText + '')); + var currentText = this._get(inst, 'currentText'); + var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); + currentText = (!navigationAsDateFormat ? currentText : + this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); + var controls = (!inst.inline ? '' : ''); + var buttonPanel = (showButtonPanel) ? '
    ' + (isRTL ? controls : '') + + (this._isInRange(inst, gotoDate) ? '' : '') + (isRTL ? '' : controls) + '
    ' : ''; + var firstDay = parseInt(this._get(inst, 'firstDay'),10); + firstDay = (isNaN(firstDay) ? 0 : firstDay); + var dayNames = this._get(inst, 'dayNames'); + var dayNamesShort = this._get(inst, 'dayNamesShort'); + var dayNamesMin = this._get(inst, 'dayNamesMin'); + var monthNames = this._get(inst, 'monthNames'); + var monthNamesShort = this._get(inst, 'monthNamesShort'); + var beforeShowDay = this._get(inst, 'beforeShowDay'); + var showOtherMonths = this._get(inst, 'showOtherMonths'); + var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; + var endDate = inst.endDay ? this._daylightSavingAdjust( + new Date(inst.endYear, inst.endMonth, inst.endDay)) : currentDate; + var defaultDate = this._getDefaultDate(inst); + var html = ''; + for (var row = 0; row < numMonths[0]; row++) { + var group = ''; + for (var col = 0; col < numMonths[1]; col++) { + var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); + var cornerClass = ' ui-corner-all'; + var calender = ''; + if (isMultiMonth) { + calender += '
    '; + } + calender += '
    ' + + (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') + + (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') + + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, + selectedDate, row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers + '
    ' + + ''; + var thead = ''; + for (var dow = 0; dow < 7; dow++) { // days of the week + var day = (dow + firstDay) % 7; + thead += '= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' + + '' + dayNamesMin[day] + ''; + } + calender += thead + ''; + var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); + if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) + inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); + var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; + var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate + var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); + for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows + calender += ''; + var tbody = ''; + for (var dow = 0; dow < 7; dow++) { // create date picker days + var daySettings = (beforeShowDay ? + beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); + var otherMonth = (printDate.getMonth() != drawMonth); + var unselectable = otherMonth || !daySettings[0] || + (minDate && printDate < minDate) || (maxDate && printDate > maxDate); + tbody += ''; // display for this month + printDate.setDate(printDate.getDate() + 1); + printDate = this._daylightSavingAdjust(printDate); + } + calender += tbody + ''; + } + drawMonth++; + if (drawMonth > 11) { + drawMonth = 0; + drawYear++; + } + calender += '
    ' + // actions + (otherMonth ? (showOtherMonths ? printDate.getDate() : ' ') : // display for other months + (unselectable ? '' + printDate.getDate() + '' : '' + printDate.getDate() + '')) + '
    ' + (isMultiMonth ? '
    ' + + ((numMonths[0] > 0 && col == numMonths[1]-1) ? '
    ' : '') : ''); + group += calender; + } + html += group; + } + html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ? + '' : ''); + inst._keyEvent = false; + return html; + }, + + /* Generate the month and year header. */ + _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, + selectedDate, secondary, monthNames, monthNamesShort) { + minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate); + var changeMonth = this._get(inst, 'changeMonth'); + var changeYear = this._get(inst, 'changeYear'); + var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); + var html = '
    '; + var monthHtml = ''; + // month selection + if (secondary || !changeMonth) + monthHtml += '' + monthNames[drawMonth] + ' '; + else { + var inMinYear = (minDate && minDate.getFullYear() == drawYear); + var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); + monthHtml += ''; + } + if (!showMonthAfterYear) + html += monthHtml + ((secondary || changeMonth || changeYear) && (!(changeMonth && changeYear)) ? ' ' : ''); + // year selection + if (secondary || !changeYear) + html += '' + drawYear + ''; + else { + // determine range of years to display + var years = this._get(inst, 'yearRange').split(':'); + var year = 0; + var endYear = 0; + if (years.length != 2) { + year = drawYear - 10; + endYear = drawYear + 10; + } else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') { + year = drawYear + parseInt(years[0], 10); + endYear = drawYear + parseInt(years[1], 10); + } else { + year = parseInt(years[0], 10); + endYear = parseInt(years[1], 10); + } + year = (minDate ? Math.max(year, minDate.getFullYear()) : year); + endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); + html += ''; + } + if (showMonthAfterYear) + html += (secondary || changeMonth || changeYear ? ' ' : '') + monthHtml; + html += '
    '; // Close datepicker_header + return html; + }, + + /* Adjust one of the date sub-fields. */ + _adjustInstDate: function(inst, offset, period) { + var year = inst.drawYear + (period == 'Y' ? offset : 0); + var month = inst.drawMonth + (period == 'M' ? offset : 0); + var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + + (period == 'D' ? offset : 0); + var date = this._daylightSavingAdjust(new Date(year, month, day)); + // ensure it is within the bounds set + var minDate = this._getMinMaxDate(inst, 'min', true); + var maxDate = this._getMinMaxDate(inst, 'max'); + date = (minDate && date < minDate ? minDate : date); + date = (maxDate && date > maxDate ? maxDate : date); + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + if (period == 'M' || period == 'Y') + this._notifyChange(inst); + }, + + /* Notify change of month/year. */ + _notifyChange: function(inst) { + var onChange = this._get(inst, 'onChangeMonthYear'); + if (onChange) + onChange.apply((inst.input ? inst.input[0] : null), + [inst.selectedYear, inst.selectedMonth + 1, inst]); + }, + + /* Determine the number of months to show. */ + _getNumberOfMonths: function(inst) { + var numMonths = this._get(inst, 'numberOfMonths'); + return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); + }, + + /* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */ + _getMinMaxDate: function(inst, minMax, checkRange) { + var date = this._determineDate(this._get(inst, minMax + 'Date'), null); + return (!checkRange || !inst.rangeStart ? date : + (!date || inst.rangeStart > date ? inst.rangeStart : date)); + }, + + /* Find the number of days in a given month. */ + _getDaysInMonth: function(year, month) { + return 32 - new Date(year, month, 32).getDate(); + }, + + /* Find the day of the week of the first of a month. */ + _getFirstDayOfMonth: function(year, month) { + return new Date(year, month, 1).getDay(); + }, + + /* Determines if we should allow a "next/prev" month display change. */ + _canAdjustMonth: function(inst, offset, curYear, curMonth) { + var numMonths = this._getNumberOfMonths(inst); + var date = this._daylightSavingAdjust(new Date( + curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1)); + if (offset < 0) + date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); + return this._isInRange(inst, date); + }, + + /* Is the given date in the accepted range? */ + _isInRange: function(inst, date) { + // during range selection, use minimum of selected date and range start + var newMinDate = (!inst.rangeStart ? null : this._daylightSavingAdjust( + new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay))); + newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate); + var minDate = newMinDate || this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); + return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate)); + }, + + /* Provide the configuration settings for formatting/parsing. */ + _getFormatConfig: function(inst) { + var shortYearCutoff = this._get(inst, 'shortYearCutoff'); + shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : + new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); + return {shortYearCutoff: shortYearCutoff, + dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), + monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; + }, + + /* Format the given date for display. */ + _formatDate: function(inst, day, month, year) { + if (!day) { + inst.currentDay = inst.selectedDay; + inst.currentMonth = inst.selectedMonth; + inst.currentYear = inst.selectedYear; + } + var date = (day ? (typeof day == 'object' ? day : + this._daylightSavingAdjust(new Date(year, month, day))) : + this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); + return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); + } +}); + +/* jQuery extend now ignores nulls! */ +function extendRemove(target, props) { + $.extend(target, props); + for (var name in props) + if (props[name] == null || props[name] == undefined) + target[name] = props[name]; + return target; +}; + +/* Determine whether an object is an array. */ +function isArray(a) { + return (a && (($.browser.safari && typeof a == 'object' && a.length) || + (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); +}; + +/* Invoke the datepicker functionality. + @param options string - a command, optionally followed by additional parameters or + Object - settings for attaching new datepicker functionality + @return jQuery object */ +$.fn.datepicker = function(options){ + + /* Initialise the date picker. */ + if (!$.datepicker.initialized) { + $(document).mousedown($.datepicker._checkExternalClick). + find('body').append($.datepicker.dpDiv); + $.datepicker.initialized = true; + } + + var otherArgs = Array.prototype.slice.call(arguments, 1); + if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate')) + return $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this[0]].concat(otherArgs)); + return this.each(function() { + typeof options == 'string' ? + $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this].concat(otherArgs)) : + $.datepicker._attachDatepicker(this, options); + }); +}; + +$.datepicker = new Datepicker(); // singleton instance +$.datepicker.initialized = false; +$.datepicker.uuid = new Date().getTime(); +$.datepicker.version = "1.7"; + +// Workaround for #4055 +// Add another global to avoid noConflict issues with inline event handlers +window.DP_jQuery = $; + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.datepicker.min.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.datepicker.min.js new file mode 100644 index 0000000..5e0a13b --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.datepicker.min.js @@ -0,0 +1,4 @@ +/* + * Compressed by JSA(www.xidea.org) + */ +eval(function(E,I,A,D,J,K,L,H){function C(A){return A<62?String.fromCharCode(A+=A<26?65:A<52?71:-4):A<63?'_':A<64?'$':C(A>>6)+C(A&63)}while(A>0)K[C(D--)]=I[--A];function N(A){return K[A]==L[A]?A:K[A]}if(''.replace(/^/,String)){var M=E.match(J),B=M[0],F=E.split(J),G=0;if(E.indexOf(F[0]))F=[''].concat(F);do{H[A++]=F[G++];H[A++]=N(B)}while(B=M[G]);H[A++]=F[G]||'';return H.join('')}return E.replace(J,N)}('(0(V){V.Ct(V.X,{5:{DL:"S.T"}});a B1="5";0 C6(){f.Fh=p;f.CP=h;f.DP=p;f.Bt=[];f.CG=p;f.CT=p;f.EM="X-5-c";f.Da="X-5-BV";f.EQ="X-5-CW";f.Bm="X-5-D0";f.Eg="X-5-dialog";f._disableClass="X-5-Bb";f.EK="X-5-unselectable";f.ER="X-5-E_-day";f.Dk="X-5-days-cell-over";f.EN=[];f.EN[""]={GT:"Done",FP:"Prev",Fq:"Next",Fi:"Today",B$:["January","February","March","April","F7","June","July","August","September","October","November","December"],Bw:["Jan","Feb","Mar","Apr","F7","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B_:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],B9:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],F9:["Su","Mo","Tu","We","Th","GX","Sa"],C_:"Ds/Ca/CE",GR:R,C0:p};f.4={Ev:"B0",EH:"D9",EA:{},Cr:h,E2:"",FC:"...",GS:"",E8:p,FZ:p,Fc:p,En:p,F6:p,GF:p,Fb:p,FG:"-Y:+Y",F_:p,Fg:f.DO,C$:"+Y",minDate:h,maxDate:h,Cn:"normal",Fm:h,Fk:h,Dx:h,GN:h,F8:h,E3:S,EJ:R,Ch:S,CV:C3,FW:"",FD:"",FT:m,GO:p};V.Ct(f.4,f.EN[""]);f.r=V("")}V.Ct(C6.F0,{BT:"hasDatepicker",ET:0(){W(f.Fh)console.ET.By("",EC)},setDefaults:0(V){CX(f.4,V||{});t f},F3:0(u,BM){a Ck=h;d(a DM Fu f.4){a Do=u.getAttribute("GK:"+DM);W(Do){Ck=Ck||{};El{Ck[DM]=eval(Do)}D_(err){Ck[DM]=Do}}}a Bn=u.Bn.DH(),BV=(Bn=="c"||Bn=="l");W(!u.Z)u.Z="Fr"+(++f.Ed);a De=f.EZ(V(u),BV);De.BM=V.Ct({},BM||{},Ck||{});W(Bn=="o")f.E4(u,De);k W(BV)f.GU(u,De)},EZ:0(A,U){a B=A[R].Z.replace(/([:\\[\\]\\.])/Dg,"\\\\\\\\$1");t{Z:B,o:A,8:R,_:R,9:R,BY:R,BW:R,BV:U,r:(!U?f.r:V(""))}},E4:0(F,C){a B=V(F);W(B.B7(f.BT))t;a D=f.g(C,"E2"),E=f.g(C,"C0");W(D)B[E?"F5":"Et"](""+D+"");a H=f.g(C,"Ev");W(H=="B0"||H=="Fw")B.B0(f.Ce);W(H=="BG"||H=="Fw"){a A=f.g(C,"FC"),G=f.g(C,"GS"),U=V(f.g(C,"E8")?V("
    ").BZ(f.Bm).Es({EF:G,FR:A,Br:A}):V("").BZ(f.Bm).Er(G==""?A:V("
    ").Es({EF:G,FR:A,Br:A})));B[E?"F5":"Et"](U);U.click(0(){W(V.5.CG&&V.5.Cb==F)V.5.Bd();k V.5.Ce(F);t p})}B.BZ(f.BT).ES(f.DR).Ey(f.Ep).Cg("GE.5",0(A,V,U){C.BM[V]=U}).Cg("FJ.5",0(U,V){t f.g(C,V)});V.CC(F,B1,C)},GU:0(B,U){a A=V(B);W(A.B7(f.BT))t;A.BZ(f.BT).CW(U.r).Cg("GE.5",0(B,V,A){U.BM[V]=A}).Cg("FJ.5",0(A,V){t f.g(U,V)});V.CC(B,B1,U);f.Ea(U,f.DJ(U));f.Bu(U);f.Dv(U)},_dialogDatepicker:0(B,I,F,U,E){a A=f.FF;W(!A){a J="Fr"+(++f.Ed);f.Bc=V("");f.Bc.ES(f.DR);V("Bi").CW(f.Bc);A=f.FF=f.EZ(f.Bc,p);A.BM={};V.CC(f.Bc[R],B1,A)}CX(A.BM,U||{});f.Bc.CI(I);f.BD=(E?(E.w?E:[E.pageX,E.pageY]):h);W(!f.BD){a D=DE.GQ||2.B4.Dr||2.Bi.Dr,H=DE.GG||2.B4.DU||2.Bi.DU,G=2.B4.DA||2.Bi.DA,C=2.B4.DD||2.Bi.DD;f.BD=[(D/BN)-CH+G,(H/BN)-150+C]}f.Bc.BS("n",f.BD[R]+"DZ").BS("e",f.BD[S]+"DZ");A.BM.Dx=F;f.CT=m;f.r.BZ(f.Eg);f.Ce(f.Bc[R]);W(V.C5)V.C5(f.r);V.CC(f.Bc[R],B1,A);t f},_destroyDatepicker:0(A){a B=V(A);W(!B.B7(f.BT))t;a U=A.Bn.DH();V.removeData(A,B1);W(U=="o")B.Cf("."+f.EQ).DV().Bv().Cf("."+f.Bm).DV().Bv().Bp(f.BT).DQ("B0",f.Ce).DQ("ES",f.DR).DQ("Ey",f.Ep);k W(U=="c"||U=="l")B.Bp(f.BT).Eu()},_enableDatepicker:0(B){a C=V(B);W(!C.B7(f.BT))t;a A=B.Bn.DH();W(A=="o"){B.Bb=p;C.Cf("BG."+f.Bm).C1(0(){f.Bb=p}).Bv().Cf("DT."+f.Bm).BS({Fo:"S.R",GL:""})}k W(A=="c"||A=="l"){a U=C.DW("."+f.Da);U.DW().Bp("X-BA-Bb")}f.Bt=V.FV(f.Bt,0(V){t(V==B?h:V)})},_disableDatepicker:0(B){a C=V(B);W(!C.B7(f.BT))t;a A=B.Bn.DH();W(A=="o"){B.Bb=m;C.Cf("BG."+f.Bm).C1(0(){f.Bb=m}).Bv().Cf("DT."+f.Bm).BS({Fo:"R.D$",GL:"Bf"})}k W(A=="c"||A=="l"){a U=C.DW("."+f.Da);U.DW().BZ("X-BA-Bb")}f.Bt=V.FV(f.Bt,0(V){t(V==B?h:V)});f.Bt[f.Bt.w]=B},C8:0(U){W(!U)t p;d(a V=R;V-S)}},Ce:0(B){B=B.u||B;W(B.Bn.DH()!="o")B=V("o",B.parentNode)[R];W(V.5.C8(B)||V.5.Cb==B)t;a A=V.5.3(B),E=V.5.g(A,"Fk");CX(A.BM,(E?E.By(B,[B,A]):{}));V.5.Bd(h,"");V.5.Cb=B;V.5.Ec(A);W(V.5.CT)B.Dd="";W(!V.5.BD){V.5.BD=V.5.GD(B);V.5.BD[S]+=B.offsetHeight}a C=p;V(B).Dz().C1(0(){C|=V(f).BS("B8")=="GP";t!C});W(C&&V.CB.opera){V.5.BD[R]-=2.B4.DA;V.5.BD[S]-=2.B4.DD}a D={n:V.5.BD[R],e:V.5.BD[S]};V.5.BD=h;A.BU=h;A.r.BS({B8:"DK",Fy:"block",e:"-1000px"});V.5.Bu(A);D=V.5.Fv(A,D,C);A.r.BS({B8:(V.5.CT&&V.C5?"static":(C?"GP":"DK")),Fy:"none",n:D.n+"DZ",e:D.e+"DZ"});W(!A.BV){a G=V.5.g(A,"EH")||"D9",F=V.5.g(A,"Cn"),U=0(){V.5.CG=m;W(V.CB.Ef&&BB(V.CB.DL,Y)S)B.r.BZ("X-5-C4-"+A).BS("Bx",(C*A)+"em");k B.r.Bp("X-5-C4-BN X-5-C4-C2 X-5-C4-Bg").Bx("");B.r[(U[R]!=S||U[S]!=S?"E9":"DV")+"Fd"]("X-5-C4");B.r[(f.g(B,"C0")?"E9":"DV")+"Fd"]("X-5-Fe");W(B.o&&B.o[R].CF!="DS"&&B==V.5.CP)V(B.o[R]).B0()},Fv:0(A,H,D){a B=A.r.Fs(),G=A.r.Fp(),E=A.o?A.o.Fs():R,C=A.o?A.o.Fp():R,F=(DE.GQ||2.B4.Dr||2.Bi.Dr)+V(2).DA(),U=(DE.GG||2.B4.DU||2.Bi.DU)+V(2).DD();H.n-=(f.g(A,"C0")?(B-E):R);H.n-=(D&&H.n==A.o.Ek().n)?V(2).DA():R;H.e-=(D&&H.e==(A.o.Ek().e+C))?V(2).DD():R;H.n-=(H.n+B>F&&F>B)?BR.Fz(H.n+B-F):R;H.e-=(H.e+G>U&&U>G)?BR.Fz(H.e+G+C*BN-U):R;t H},GD:0(U){CK(U&&(U.CF=="DS"||U.nodeType!=S))U=U.nextSibling;a A=V(U).Ek();t[A.n,A.e]},Bd:0(B,D){a A=f.CP;W(!A||(B&&A!=V.CC(B,B1)))t;W(A.CY)f.Db("#"+A.Z,f.Cy(A,A.6,A.BK,A.BH));A.CY=p;W(f.CG){D=(D!=h?D:f.g(A,"Cn"));a E=f.g(A,"EH"),U=0(){V.5.EB(A)};W(D!=""&&V.Dj&&V.Dj[E])A.r.D2(E,V.5.g(A,"EA"),D,U);k A.r[(D==""?"D2":(E=="slideDown"?"slideUp":(E=="fadeIn"?"fadeOut":"D2")))](D,U);W(D=="")f.EB(A);a C=f.g(A,"F8");W(C)C.By((A.o?A.o[R]:h),[(A.o?A.o.CI():""),A]);f.CG=p;f.Cb=h;W(f.CT){f.Bc.BS({B8:"DK",n:"R",e:"-FH"});W(V.C5){V.unblockUI();V("Bi").CW(f.r)}}f.CT=p}f.CP=h},EB:0(V){V.r.Bp(f.Eg).DQ(".X-5-Dl")},FK:0(U){W(!V.5.CP)t;a A=V(U.u);W((A.Dz("#"+V.5.EM).w==R)&&!A.B7(V.5.BT)&&!A.B7(V.5.Bm)&&V.5.CG&&!(V.5.CT&&V.C5))V.5.Bd(h,"")},BC:0(D,C,U){a B=V(D),A=f.3(B[R]);W(f.C8(B[R]))t;f.Dn(A,C+(U=="L"?f.g(A,"EJ"):R),U);f.Bu(A)},EU:0(C){a A=V(C),U=f.3(A[R]);W(f.g(U,"En")&&U.6){U.8=U.6;U.BY=U._=U.BK;U.BW=U.9=U.BH}k{a B=b j();U.8=B.x();U.BY=U._=B.1();U.BW=U.9=B.7()}f.C7(U);f.BC(A)},EE:0(C,D,U){a B=V(C),A=f.3(B[R]);A.Dh=p;A["DB"+(U=="L"?"FN":"GA")]=A["draw"+(U=="L"?"FN":"GA")]=BB(D.options[D.selectedIndex].Dd,Y);f.C7(A);f.BC(B)},EX:0(B){a A=V(B),U=f.3(A[R]);W(U.o&&U.Dh&&!V.CB.Ef)U.o[R].B0();U.Dh=!U.Dh},EI:0(E,A,C,U){a D=V(E);W(V(U).B7(f.EK)||f.C8(D[R]))t;a B=f.3(D[R]);B.8=B.6=V("P",U).Er();B._=B.BK=A;B.9=B.BH=C;W(B.CY)B.Co=B.Cu=B.Cw=h;f.Db(E,f.Cy(B,B.6,B.BK,B.BH));W(B.CY){B.BU=f.$(b j(B.BH,B.BK,B.6));f.Bu(B)}},Fx:0(B){a A=V(B),U=f.3(A[R]);U.CY=p;U.Co=U.Cu=U.Cw=U.BU=h;f.Db(A,"")},Db:0(D,C){a B=V(D),U=f.3(B[R]);C=(C!=h?C:f.Cy(U));W(U.o)U.o.CI(C);f.Dv(U);a A=f.g(U,"Dx");W(A)A.By((U.o?U.o[R]:h),[C,U]);k W(U.o)U.o.D0("change");W(U.BV)f.Bu(U);k W(!U.CY){f.Bd(h,f.g(U,"Cn"));f.Cb=U.o[R];W(BO(U.o[R])!="DI")U.o[R].B0();f.Cb=h}},Dv:0(U){a A=f.g(U,"FW");W(A){a C=f.g(U,"FD")||f.g(U,"C_"),B=f.Ei(U);FB=f.Ci(C,B,f.CN(U));V(A).C1(0(){V(f).CI(FB)})}},noWeekends:0(U){a V=U.Cc();t[(V>R&&Vb j(U.7(),C3-S,28)){B=b j(U.7()+S,S-S,Bg).Cc()||T;W(B>Bg&&(U.Cc()||T)R&&M="R"&&A.v(M)<="Cz"){V=V*Y+BB(A.v(M++),Y);B--}W(B==C)CZ"GC D3 EO B8 "+M;t V},K=0(V,C,G){a D=(F(V)?G:C),H=R;d(a E=R;ER&&M-S){V=S;B=BJ;do{a C=f.CO(N,V-S);W(B<=C)q;V++;B-=C}CK(m)}H=f.$(b j(N,V-S,B));W(H.7()!=N||H.1()+S!=V||H.x()!=B)CZ"Eh GK";t H},ATOM:"CE-Ds-Ca",COOKIE:"D, Ca L CE",ISO_8601:"CE-Ds-Ca",RFC_822:"D, Q L BE",RFC_850:"GW, Ca-L-BE",RFC_1036:"D, Q L BE",RFC_1123:"D, Q L CE",RFC_2822:"D, Q L CE",RSS:"D, Q L BE",TIMESTAMP:"@",W3C:"CE-Ds-Ca",Ci:0(L,F,V){W(!F)t"";a K=(V?V.B9:h)||f.4.B9,I=(V?V.B_:h)||f.4.B_,A=(V?V.Bw:h)||f.4.Bw,D=(V?V.B$:h)||f.4.B$,C=0(V){a U=(H+S=R;J--)BX+=f.CO(F.7(),J);U+=G("CA",BX,C2);q;i"Bh":U+=G("Bh",F.1()+S,BN);q;i"L":U+=E("L",F.1(),A,D);q;i"BE":U+=(C("BE")?F.7():(F.E5()%CHV?V:A);t A},Dp:0(U,B){a A=0(U){a V=b j();V.DF(V.x()+U);t V},V=0(F,C){a E=b j(),B=E.7(),V=E.1(),U=E.x(),D=/([+-]?[R-Cz]+)\\Be*(Q|D|Bs|CM|Bh|L|BE|CL)?/Dg,A=D.GM(F);CK(A){Cd(A[BN]||"Q"){i"Q":i"D":U+=BB(A[S],Y);q;i"Bs":i"CM":U+=BB(A[S],Y)*T;q;i"Bh":i"L":V+=BB(A[S],Y);U=BR.Bo(U,C(B,V));q;i"BE":i"CL":B+=BB(A[S],Y);U=BR.Bo(U,C(B,V));q}A=D.GM(F)}t b j(B,V,U)};U=(U==h?B:(BO U=="Cx"?V(U,f.CO):(BO U=="D3"?(F1(U)?B:A(U)):U)));U=(U&&U.EW()=="Eh j"?B:U);W(U){U.GI(R);U.setMinutes(R);U.setSeconds(R);U.setMilliseconds(R)}t f.$(U)},$:0(V){W(!V)t h;V.GI(V.GH()>C3?V.GH()+BN:R);t V},Ea:0(U,C,B){a A=!(C),D=U._,V=U.9;C=f.Dp(C,b j());U.8=U.6=C.x();U.BY=U._=U.BK=C.1();U.BW=U.9=U.BH=C.7();W(D!=U._||V!=U.9)f.C7(U);f.Dn(U);W(U.o)U.o.CI(A?"":f.Cy(U))},Ei:0(V){a U=(!V.BH||(V.o&&V.o.CI()=="")?h:f.$(b j(V.BH,V.BK,V.6)));t U},FS:0(N){a B6=b j();B6=f.$(b j(B6.7(),B6.1(),B6.x()));a D=f.g(N,"C0"),Bj=f.g(N,"GO"),Bs=f.g(N,"FZ"),A=f.g(N,"Fc"),Be=f.Dm(N),L=f.g(N,"EJ"),Bq=f.g(N,"Ch"),U=f.g(N,"CV"),H=(Be[R]!=S||Be[S]!=S),Cv=f.$((!N.6?b j(9999,Cz,Cz):b j(N.BH,N.BK,N.6))),CU=f.Bl(N,"Bo",m),B3=f.Bl(N,"Cj"),O=N.BY-L,J=N.BW;W(ODG){O--;W(O"+M+"

    ":(Bs?"":"

    "+M+"

    ")),B2=f.g(N,"Fq");B2=(!A?B2:f.Ci(B2,f.$(b j(J,O+Bq,S)),f.CN(N)));a D6=(f.Em(N,+S,J,O)?"

    "+B2+"

    ":(Bs?"":"

    "+B2+"

    ")),Cq=f.g(N,"Fi"),BX=(f.g(N,"En")&&N.6?Cv:B6);Cq=(!A?Cq:f.Ci(Cq,BX,f.CN(N)));a ED=(!N.BV?""+f.g(N,"GT")+"":""),CL=(Bj)?""+(D?ED:"")+(f.Eo(N,BX)?""+Cq+"":"")+(D?"":ED)+"":"",Bz=BB(f.g(N,"GR"),Y);Bz=(F1(Bz)?R:Bz);a I=f.g(N,"B_"),BE=f.g(N,"B9"),Fj=f.g(N,"F9"),Dg=f.g(N,"B$"),E=f.g(N,"Bw"),Bh=f.g(N,"Fm"),B=f.g(N,"F_"),GV=f.g(N,"Fg")||f.DO,D5=N.Co?f.$(b j(N.Cw,N.Cu,N.Co)):Cv,D7=f.DJ(N),C="";d(a Cl=R;Cl"}BL+=""+(/BP|n/.Ff(CQ)&&Cl==R?(D?D6:D1):"")+(/BP|D8/.Ff(CQ)&&Cl==R?(D?D1:D6):"")+f.FY(N,O,J,CU,B3,DY,Cl>R||F>R,Dg,E)+""+"";a Q="";d(a Bk=R;Bk=D$?" s=\\"X-5-E1-Bv\\"":"")+">"+""+Fj[BF]+""}BL+=Q+"";a Dy=f.CO(J,O);W(J==N.9&&O==N._)N.8=BR.Bo(N.8,Dy);a CA=(f.FU(J,O)-Bz+T)%T,FI=(H?Dq:BR.ceil((CA+Dy)/T)),G=f.$(b j(J,O,S-CA));d(a Ee=R;Ee";a Eb="";d(Bk=R;BkB3);Eb+="=D$?" X-5-E1-Bv":"")+(K?" X-5-other-EV":"")+((G.y()==DY.y()&&O==N._&&N.DP)||(D7.y()==G.y()&&D7.y()==DY.y())?" "+f.Dk:"")+(P?" "+f.EK+" X-BA-Bb":"")+(K&&!B?"":" "+CM[S]+(G.y()>=Cv.y()&&G.y()<=D5.y()?" "+f.ER:"")+(G.y()==B6.y()?" X-5-today":""))+"\\""+((!K||B)&&CM[BN]?" Br=\\""+CM[BN]+"\\"":"")+(P?"":" CS=\\"Ba.5.EI(\'#"+N.Z+"\',"+O+","+J+", f);t p;\\"")+">"+(K?(B?G.x():"&#Ej;"):(P?""+G.x()+"":"

    =Cv.y()&&G.y()<=D5.y()?" X-BA-active":"")+"\\" href=\\"#\\">"+G.x()+"

    "))+"
    ";G.DF(G.x()+S);G=f.$(G)}BL+=Eb+""}O++;W(O>FX){O=R;J++}BL+="
    "+(H?""+((Be[R]>R&&F==Be[S]-S)?"":""):"");BJ+=BL}C+=BJ}C+=CL+(V.CB.Ef&&BB(V.CB.DL,Y)
    ":"");N.DP=p;t C},FY:0(U,C,M,H,J,N,K,E,B){H=(U.BU&&H&&N",F="";W(K||!D)F+=""+E[C]+" ";k{a G=(H&&H.7()==M),BX=(J&&J.7()==M);F+="";d(a V=R;V=H.1())&&(!BX||V<=J.1()))F+=""+B[V]+"";F+=""}W(!Bj)A+=F+((K||D||BJ)&&(!(D&&BJ))?"&#Ej;":"");W(K||!BJ)A+=""+M+"";k{a BF=f.g(U,"FG").split(":"),L=R,I=R;W(BF.w!=BN){L=M-Y;I=M+Y}k W(BF[R].v(R)=="+"||BF[R].v(R)=="-"){L=M+BB(BF[R],Y);I=M+BB(BF[S],Y)}k{L=BB(BF[R],Y);I=BB(BF[S],Y)}L=(H?BR.Cj(L,H.7()):L);I=(J?BR.Bo(I,J.7()):I);A+="";d(;L<=I;L++)A+=""+L+"";A+=""}W(Bj)A+=(K||D||BJ?"&#Ej;":"")+F;A+="";t A},Dn:0(C,F,U){a D=C.BW+(U=="CL"?F:R),V=C.BY+(U=="L"?F:R),B=BR.Bo(C.8,f.CO(D,V))+(U=="D"?F:R),E=f.$(b j(D,V,B)),G=f.Bl(C,"Bo",m),A=f.Bl(C,"Cj");E=(G&&EA?A:E);C.8=E.x();C.BY=C._=E.1();C.BW=C.9=E.7();W(U=="L"||U=="CL")f.C7(C)},C7:0(V){a U=f.g(V,"GN");W(U)U.By((V.o?V.o[R]:h),[V.9,V._+S,V])},Dm:0(U){a V=f.g(U,"E3");t(V==h?[S,S]:(BO V=="D3"?[S,V]:V))},Bl:0(U,B,V){a A=f.Dp(f.g(U,B+"j"),h);t(!V||!U.BU?A:(!A||U.BU>A?U.BU:A))},CO:0(U,V){t Ez-b j(U,V,Ez).x()},FU:0(U,V){t b j(U,V,S).Cc()},Em:0(A,C,U,D){a V=f.Dm(A),B=f.$(b j(U,D+(C=C)&&(!V||B<=V))},CN:0(V){a U=f.g(V,"C$");U=(BO U!="Cx"?U:b j().7()%CH+BB(U,Y));t{C$:U,B9:f.g(V,"B9"),B_:f.g(V,"B_"),Bw:f.g(V,"Bw"),B$:f.g(V,"B$")}},Cy:0(A,U,V,B){W(!U){A.6=A.8;A.BK=A._;A.BH=A.9}a C=(U?(BO U=="DI"?U:f.$(b j(B,V,U))):f.$(b j(A.BH,A.BK,A.6)));t f.Ci(f.g(A,"C_"),C,f.CN(A))}});0 CX(A,U){V.Ct(A,U);d(a B Fu U)W(U[B]==h||U[B]==EY)A[B]=U[B];t A}0 isArray(U){t(U&&((V.CB.safari&&BO U=="DI"&&U.w)||(U.GB&&U.GB.EW().match(/\\Ft\\(\\)/))))}V.fn.5=0(A){W(!V.5.Eq){V(2).mousedown(V.5.FK).DC("Bi").CW(V.5.r);V.5.Eq=m}a U=Ft.F0.slice.call(EC,S);W(BO A=="Cx"&&(A=="isDisabled"||A=="x"))t V.5["U"+A+"C6"].By(V.5,[f[R]].F4(U));t f.C1(0(){BO A=="Cx"?V.5["U"+A+"C6"].By(V.5,[f].F4(U)):V.5.F3(f,A)})};V.5=b C6();V.5.Eq=p;V.5.Ed=b j().y();V.5.DL="S.T";DE.Ba=V})(jQuery)','M|N|O|S|a|d|0|1|7|_|$|if|ui|10|id|var|new|div|for|top|this|_get|null|case|Date|else|span|true|left|input|false|break|dpDiv|class|return|target|charAt|length|getDate|getTime|ctrlKey|function|getMonth|document|_getInst|_defaults|datepicker|currentDay|getFullYear|selectedDay|selectedYear|selectedMonth|_daylightSavingAdjust|state|parseInt|_adjustDate|_pos|y|Q|button|currentYear|metaKey|P|currentMonth|n|settings|2|typeof|all|corner|Math|css|markerClassName|rangeStart|inline|drawYear|L|drawMonth|addClass|DP_jQuery|disabled|_dialogInput|_hideDatepicker|s|default|4|m|body|R|T|_getMinMaxDate|_triggerClass|nodeName|min|removeClass|e|title|w|_disabledInputs|_updateDatepicker|end|monthNamesShort|width|apply|h|focus|PROP_NAME|x|j|documentElement|icon|u|hasClass|position|dayNamesShort|dayNames|monthNames|o|browser|data|hover|yy|type|_datepickerShowing|100|val|next|while|Y|W|_getFormatConfig|_getDaysInMonth|_curInst|c|prev|onclick|_inDialog|i|stepBigMonths|append|extendRemove|stayOpen|throw|dd|_lastInput|getDay|switch|_showDatepicker|siblings|bind|stepMonths|formatDate|max|inlineSettings|k|widget|duration|endDay|height|X|defaultDate|td|extend|endMonth|v|endYear|string|_formatDate|9|isRTL|each|3|12|multi|blockUI|Datepicker|_notifyChange|_isDisabledDatepicker|indexOf|dateFormat|shortYearCutoff|scrollLeft|selected|find|scrollTop|window|setDate|Z|toLowerCase|object|_getDefaultDate|absolute|version|attrName|option|iso8601Week|_keyEvent|unbind|_doKeyDown|hidden|img|clientHeight|remove|children|tr|p|px|_inlineClass|_selectDate|helper|value|inst|className|g|_selectingMonthYear|triangle|effects|_dayOverClass|calendar|_getNumberOfMonths|_adjustInstDate|attrValue|_determineDate|6|clientWidth|mm|iframe|select|_updateAlternate|circle|onSelect|V|parents|trigger|l|hide|number|keyCode|b|f|_0|right|show|catch|5|showOptions|_tidyDialog|arguments|r|_selectMonthYear|src|cover|showAnim|_selectDay|showCurrentAtPos|_unselectableClass|content|_mainDivId|regional|at|clearfix|_appendClass|_currentClass|keydown|log|_gotoToday|month|toString|_clickMonthYear|undefined|_newInst|_setDate|q|_setDateFromField|uuid|z|msie|_dialogClass|Invalid|_getDate|xa0|offset|try|_canAdjustMonth|gotoCurrent|_isInRange|_doKeyPress|initialized|html|attr|after|empty|showOn|_possibleChars|header|keypress|32|parseDate|week|appendText|numberOfMonths|_connectDatepicker|getYear|thead|priority|buttonImageOnly|add|current|year|mouseover|dateStr|buttonText|altFormat|charCode|_dialogInst|yearRange|100px|t|getData|_checkExternalClick|onchange|th|Month|originalEvent|prevText|group|alt|_generateHTML|constrainInput|_getFirstDayOfMonth|map|altField|11|_generateMonthYearHeader|hideIfNoPrevNext|altKey|showMonthAfterYear|navigationAsDateFormat|Class|rtl|test|calculateWeek|debug|currentText|$0|beforeShow|36|beforeShowDay|tbody|opacity|outerHeight|nextText|dp|outerWidth|Array|in|_checkOffset|both|_clearDate|display|abs|prototype|isNaN|_optionDatepicker|_attachDatepicker|concat|before|changeMonth|May|onClose|dayNamesMin|showOtherMonths|lookAhead|Year|constructor|Missing|_findPos|setData|changeYear|innerHeight|getHours|setHours|table|date|cursor|exec|onChangeMonthYear|showButtonPanel|fixed|innerWidth|firstDay|buttonImage|closeText|_inlineDatepicker|U|DD|Fr'.split('|'),397,407,/[\w\$]+/g,{},{},[])) \ No newline at end of file diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.dialog.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.dialog.js new file mode 100644 index 0000000..99d16f0 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.dialog.js @@ -0,0 +1,650 @@ +/* + * jQuery UI Dialog 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Dialog + * + * Depends: + * ui.core.js + * ui.draggable.js + * ui.resizable.js + */ +(function($) { + +var setDataSwitch = { + dragStart: "start.draggable", + drag: "drag.draggable", + dragStop: "stop.draggable", + maxHeight: "maxHeight.resizable", + minHeight: "minHeight.resizable", + maxWidth: "maxWidth.resizable", + minWidth: "minWidth.resizable", + resizeStart: "start.resizable", + resize: "drag.resizable", + resizeStop: "stop.resizable" + }, + + uiDialogClasses = + 'ui-dialog ' + + 'ui-widget ' + + 'ui-widget-content ' + + 'ui-corner-all '; + +$.widget("ui.dialog", { + + _init: function() { + this.originalTitle = this.element.attr('title'); + + var self = this, + options = this.options, + + title = options.title || this.originalTitle || ' ', + titleId = $.ui.dialog.getTitleId(this.element), + + uiDialog = (this.uiDialog = $('
    ')) + .appendTo(document.body) + .hide() + .addClass(uiDialogClasses + options.dialogClass) + .css({ + position: 'absolute', + overflow: 'hidden', + zIndex: options.zIndex + }) + // setting tabIndex makes the div focusable + // setting outline to 0 prevents a border on focus in Mozilla + .attr('tabIndex', -1).css('outline', 0).keydown(function(event) { + (options.closeOnEscape && event.keyCode + && event.keyCode == $.ui.keyCode.ESCAPE && self.close(event)); + }) + .attr({ + role: 'dialog', + 'aria-labelledby': titleId + }) + .mousedown(function(event) { + self.moveToTop(false, event); + }), + + uiDialogContent = this.element + .show() + .removeAttr('title') + .addClass( + 'ui-dialog-content ' + + 'ui-widget-content') + .appendTo(uiDialog), + + uiDialogTitlebar = (this.uiDialogTitlebar = $('
    ')) + .addClass( + 'ui-dialog-titlebar ' + + 'ui-widget-header ' + + 'ui-corner-all ' + + 'ui-helper-clearfix' + ) + .prependTo(uiDialog), + + uiDialogTitlebarClose = $('') + .addClass( + 'ui-dialog-titlebar-close ' + + 'ui-corner-all' + ) + .attr('role', 'button') + .hover( + function() { + uiDialogTitlebarClose.addClass('ui-state-hover'); + }, + function() { + uiDialogTitlebarClose.removeClass('ui-state-hover'); + } + ) + .focus(function() { + uiDialogTitlebarClose.addClass('ui-state-focus'); + }) + .blur(function() { + uiDialogTitlebarClose.removeClass('ui-state-focus'); + }) + .mousedown(function(ev) { + ev.stopPropagation(); + }) + .click(function(event) { + self.close(event); + return false; + }) + .appendTo(uiDialogTitlebar), + + uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('')) + .addClass( + 'ui-icon ' + + 'ui-icon-closethick' + ) + .text(options.closeText) + .appendTo(uiDialogTitlebarClose), + + uiDialogTitle = $('') + .addClass('ui-dialog-title') + .attr('id', titleId) + .html(title) + .prependTo(uiDialogTitlebar); + + uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); + + (options.draggable && $.fn.draggable && this._makeDraggable()); + (options.resizable && $.fn.resizable && this._makeResizable()); + + this._createButtons(options.buttons); + this._isOpen = false; + + (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe()); + (options.autoOpen && this.open()); + + }, + + destroy: function() { + (this.overlay && this.overlay.destroy()); + this.uiDialog.hide(); + this.element + .unbind('.dialog') + .removeData('dialog') + .removeClass('ui-dialog-content ui-widget-content') + .hide().appendTo('body'); + this.uiDialog.remove(); + + (this.originalTitle && this.element.attr('title', this.originalTitle)); + }, + + close: function(event) { + var self = this; + + if (false === self._trigger('beforeclose', event)) { + return; + } + + (self.overlay && self.overlay.destroy()); + self.uiDialog.unbind('keypress.ui-dialog'); + + (self.options.hide + ? self.uiDialog.hide(self.options.hide, function() { + self._trigger('close', event); + }) + : self.uiDialog.hide() && self._trigger('close', event)); + + $.ui.dialog.overlay.resize(); + + self._isOpen = false; + }, + + isOpen: function() { + return this._isOpen; + }, + + // the force parameter allows us to move modal dialogs to their correct + // position on open + moveToTop: function(force, event) { + + if ((this.options.modal && !force) + || (!this.options.stack && !this.options.modal)) { + return this._trigger('focus', event); + } + + if (this.options.zIndex > $.ui.dialog.maxZ) { + $.ui.dialog.maxZ = this.options.zIndex; + } + (this.overlay && this.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = ++$.ui.dialog.maxZ)); + + //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. + // http://ui.jquery.com/bugs/ticket/3193 + var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') }; + this.uiDialog.css('z-index', ++$.ui.dialog.maxZ); + this.element.attr(saveScroll); + this._trigger('focus', event); + }, + + open: function() { + if (this._isOpen) { return; } + + var options = this.options, + uiDialog = this.uiDialog; + + this.overlay = options.modal ? new $.ui.dialog.overlay(this) : null; + (uiDialog.next().length && uiDialog.appendTo('body')); + this._size(); + this._position(options.position); + uiDialog.show(options.show); + this.moveToTop(true); + + // prevent tabbing out of modal dialogs + (options.modal && uiDialog.bind('keypress.ui-dialog', function(event) { + if (event.keyCode != $.ui.keyCode.TAB) { + return; + } + + var tabbables = $(':tabbable', this), + first = tabbables.filter(':first')[0], + last = tabbables.filter(':last')[0]; + + if (event.target == last && !event.shiftKey) { + setTimeout(function() { + first.focus(); + }, 1); + } else if (event.target == first && event.shiftKey) { + setTimeout(function() { + last.focus(); + }, 1); + } + })); + + // set focus to the first tabbable element in the content area or the first button + // if there are no tabbable elements, set focus on the dialog itself + $([]) + .add(uiDialog.find('.ui-dialog-content :tabbable:first')) + .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')) + .add(uiDialog) + .filter(':first') + .focus(); + + this._trigger('open'); + this._isOpen = true; + }, + + _createButtons: function(buttons) { + var self = this, + hasButtons = false, + uiDialogButtonPane = $('
    ') + .addClass( + 'ui-dialog-buttonpane ' + + 'ui-widget-content ' + + 'ui-helper-clearfix' + ); + + // if we already have a button pane, remove it + this.uiDialog.find('.ui-dialog-buttonpane').remove(); + + (typeof buttons == 'object' && buttons !== null && + $.each(buttons, function() { return !(hasButtons = true); })); + if (hasButtons) { + $.each(buttons, function(name, fn) { + $('') + .addClass( + 'ui-state-default ' + + 'ui-corner-all' + ) + .text(name) + .click(function() { fn.apply(self.element[0], arguments); }) + .hover( + function() { + $(this).addClass('ui-state-hover'); + }, + function() { + $(this).removeClass('ui-state-hover'); + } + ) + .focus(function() { + $(this).addClass('ui-state-focus'); + }) + .blur(function() { + $(this).removeClass('ui-state-focus'); + }) + .appendTo(uiDialogButtonPane); + }); + uiDialogButtonPane.appendTo(this.uiDialog); + } + }, + + _makeDraggable: function() { + var self = this, + options = this.options, + heightBeforeDrag; + + this.uiDialog.draggable({ + cancel: '.ui-dialog-content', + handle: '.ui-dialog-titlebar', + containment: 'document', + start: function() { + heightBeforeDrag = options.height; + $(this).height($(this).height()).addClass("ui-dialog-dragging"); + (options.dragStart && options.dragStart.apply(self.element[0], arguments)); + }, + drag: function() { + (options.drag && options.drag.apply(self.element[0], arguments)); + }, + stop: function() { + $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); + (options.dragStop && options.dragStop.apply(self.element[0], arguments)); + $.ui.dialog.overlay.resize(); + } + }); + }, + + _makeResizable: function(handles) { + handles = (handles === undefined ? this.options.resizable : handles); + var self = this, + options = this.options, + resizeHandles = typeof handles == 'string' + ? handles + : 'n,e,s,w,se,sw,ne,nw'; + + this.uiDialog.resizable({ + cancel: '.ui-dialog-content', + alsoResize: this.element, + maxWidth: options.maxWidth, + maxHeight: options.maxHeight, + minWidth: options.minWidth, + minHeight: options.minHeight, + start: function() { + $(this).addClass("ui-dialog-resizing"); + (options.resizeStart && options.resizeStart.apply(self.element[0], arguments)); + }, + resize: function() { + (options.resize && options.resize.apply(self.element[0], arguments)); + }, + handles: resizeHandles, + stop: function() { + $(this).removeClass("ui-dialog-resizing"); + options.height = $(this).height(); + options.width = $(this).width(); + (options.resizeStop && options.resizeStop.apply(self.element[0], arguments)); + $.ui.dialog.overlay.resize(); + } + }) + .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); + }, + + _position: function(pos) { + var wnd = $(window), doc = $(document), + pTop = doc.scrollTop(), pLeft = doc.scrollLeft(), + minTop = pTop; + + if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) { + pos = [ + pos == 'right' || pos == 'left' ? pos : 'center', + pos == 'top' || pos == 'bottom' ? pos : 'middle' + ]; + } + if (pos.constructor != Array) { + pos = ['center', 'middle']; + } + if (pos[0].constructor == Number) { + pLeft += pos[0]; + } else { + switch (pos[0]) { + case 'left': + pLeft += 0; + break; + case 'right': + pLeft += wnd.width() - this.uiDialog.outerWidth(); + break; + default: + case 'center': + pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2; + } + } + if (pos[1].constructor == Number) { + pTop += pos[1]; + } else { + switch (pos[1]) { + case 'top': + pTop += 0; + break; + case 'bottom': + pTop += wnd.height() - this.uiDialog.outerHeight(); + break; + default: + case 'middle': + pTop += (wnd.height() - this.uiDialog.outerHeight()) / 2; + } + } + + // prevent the dialog from being too high (make sure the titlebar + // is accessible) + pTop = Math.max(pTop, minTop); + this.uiDialog.css({top: pTop, left: pLeft}); + }, + + _setData: function(key, value){ + (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value)); + switch (key) { + case "buttons": + this._createButtons(value); + break; + case "closeText": + this.uiDialogTitlebarCloseText.text(value); + break; + case "dialogClass": + this.uiDialog + .removeClass(this.options.dialogClass) + .addClass(uiDialogClasses + value); + break; + case "draggable": + (value + ? this._makeDraggable() + : this.uiDialog.draggable('destroy')); + break; + case "height": + this.uiDialog.height(value); + break; + case "position": + this._position(value); + break; + case "resizable": + var uiDialog = this.uiDialog, + isResizable = this.uiDialog.is(':data(resizable)'); + + // currently resizable, becoming non-resizable + (isResizable && !value && uiDialog.resizable('destroy')); + + // currently resizable, changing handles + (isResizable && typeof value == 'string' && + uiDialog.resizable('option', 'handles', value)); + + // currently non-resizable, becoming resizable + (isResizable || this._makeResizable(value)); + break; + case "title": + $(".ui-dialog-title", this.uiDialogTitlebar).html(value || ' '); + break; + case "width": + this.uiDialog.width(value); + break; + } + + $.widget.prototype._setData.apply(this, arguments); + }, + + _size: function() { + /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content + * divs will both have width and height set, so we need to reset them + */ + var options = this.options; + + // reset content sizing + this.element.css({ + height: 0, + minHeight: 0, + width: 'auto' + }); + + // reset wrapper sizing + // determine the height of all the non-content elements + var nonContentHeight = this.uiDialog.css({ + height: 'auto', + width: options.width + }) + .height(); + + this.element + .css({ + minHeight: Math.max(options.minHeight - nonContentHeight, 0), + height: options.height == 'auto' + ? 'auto' + : Math.max(options.height - nonContentHeight, 0) + }); + } +}); + +$.extend($.ui.dialog, { + version: "1.7", + defaults: { + autoOpen: true, + bgiframe: false, + buttons: {}, + closeOnEscape: true, + closeText: 'close', + dialogClass: '', + draggable: true, + hide: null, + height: 'auto', + maxHeight: false, + maxWidth: false, + minHeight: 150, + minWidth: 150, + modal: false, + position: 'center', + resizable: true, + show: null, + stack: true, + title: '', + width: 300, + zIndex: 1000 + }, + + getter: 'isOpen', + + uuid: 0, + maxZ: 0, + + getTitleId: function($el) { + return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid); + }, + + overlay: function(dialog) { + this.$el = $.ui.dialog.overlay.create(dialog); + } +}); + +$.extend($.ui.dialog.overlay, { + instances: [], + maxZ: 0, + events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), + function(event) { return event + '.dialog-overlay'; }).join(' '), + create: function(dialog) { + if (this.instances.length === 0) { + // prevent use of anchors and inputs + // we use a setTimeout in case the overlay is created from an + // event that we're going to be cancelling (see #2804) + setTimeout(function() { + $(document).bind($.ui.dialog.overlay.events, function(event) { + var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') || 0; + return (dialogZ > $.ui.dialog.overlay.maxZ); + }); + }, 1); + + // allow closing by pressing the escape key + $(document).bind('keydown.dialog-overlay', function(event) { + (dialog.options.closeOnEscape && event.keyCode + && event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event)); + }); + + // handle window resize + $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); + } + + var $el = $('
    ').appendTo(document.body) + .addClass('ui-widget-overlay').css({ + width: this.width(), + height: this.height() + }); + + (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe()); + + this.instances.push($el); + return $el; + }, + + destroy: function($el) { + this.instances.splice($.inArray(this.instances, $el), 1); + + if (this.instances.length === 0) { + $([document, window]).unbind('.dialog-overlay'); + } + + $el.remove(); + }, + + height: function() { + // handle IE 6 + if ($.browser.msie && $.browser.version < 7) { + var scrollHeight = Math.max( + document.documentElement.scrollHeight, + document.body.scrollHeight + ); + var offsetHeight = Math.max( + document.documentElement.offsetHeight, + document.body.offsetHeight + ); + + if (scrollHeight < offsetHeight) { + return $(window).height() + 'px'; + } else { + return scrollHeight + 'px'; + } + // handle "good" browsers + } else { + return $(document).height() + 'px'; + } + }, + + width: function() { + // handle IE 6 + if ($.browser.msie && $.browser.version < 7) { + var scrollWidth = Math.max( + document.documentElement.scrollWidth, + document.body.scrollWidth + ); + var offsetWidth = Math.max( + document.documentElement.offsetWidth, + document.body.offsetWidth + ); + + if (scrollWidth < offsetWidth) { + return $(window).width() + 'px'; + } else { + return scrollWidth + 'px'; + } + // handle "good" browsers + } else { + return $(document).width() + 'px'; + } + }, + + resize: function() { + /* If the dialog is draggable and the user drags it past the + * right edge of the window, the document becomes wider so we + * need to stretch the overlay. If the user then drags the + * dialog back to the left, the document will become narrower, + * so we need to shrink the overlay to the appropriate size. + * This is handled by shrinking the overlay before setting it + * to the full document size. + */ + var $overlays = $([]); + $.each($.ui.dialog.overlay.instances, function() { + $overlays = $overlays.add(this); + }); + + $overlays.css({ + width: 0, + height: 0 + }).css({ + width: $.ui.dialog.overlay.width(), + height: $.ui.dialog.overlay.height() + }); + } +}); + +$.extend($.ui.dialog.overlay.prototype, { + destroy: function() { + $.ui.dialog.overlay.destroy(this.$el); + } +}); + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.draggable.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.draggable.js new file mode 100644 index 0000000..6a563e8 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.draggable.js @@ -0,0 +1,766 @@ +/* + * jQuery UI Draggable 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * ui.core.js + */ +(function($) { + +$.widget("ui.draggable", $.extend({}, $.ui.mouse, { + + _init: function() { + + if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) + this.element[0].style.position = 'relative'; + + (this.options.addClasses && this.element.addClass("ui-draggable")); + (this.options.disabled && this.element.addClass("ui-draggable-disabled")); + + this._mouseInit(); + + }, + + destroy: function() { + if(!this.element.data('draggable')) return; + this.element + .removeData("draggable") + .unbind(".draggable") + .removeClass("ui-draggable" + + " ui-draggable-dragging" + + " ui-draggable-disabled"); + this._mouseDestroy(); + }, + + _mouseCapture: function(event) { + + var o = this.options; + + if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) + return false; + + //Quit if we're not on a valid handle + this.handle = this._getHandle(event); + if (!this.handle) + return false; + + return true; + + }, + + _mouseStart: function(event) { + + var o = this.options; + + //Create and append the visible helper + this.helper = this._createHelper(event); + + //Cache the helper size + this._cacheHelperProportions(); + + //If ddmanager is used for droppables, set the global draggable + if($.ui.ddmanager) + $.ui.ddmanager.current = this; + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //Store the helper's css position + this.cssPosition = this.helper.css("position"); + this.scrollParent = this.helper.scrollParent(); + + //The element's absolute position on the page minus margins + this.offset = this.element.offset(); + this.offset = { + top: this.offset.top - this.margins.top, + left: this.offset.left - this.margins.left + }; + + $.extend(this.offset, { + click: { //Where the click happened, relative to the element + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top + }, + parent: this._getParentOffset(), + relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper + }); + + //Generate the original position + this.originalPosition = this._generatePosition(event); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + + //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied + if(o.cursorAt) + this._adjustOffsetFromHelper(o.cursorAt); + + //Set a containment if given in the options + if(o.containment) + this._setContainment(); + + //Call plugins and callbacks + this._trigger("start", event); + + //Recache the helper size + this._cacheHelperProportions(); + + //Prepare the droppable offsets + if ($.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + + this.helper.addClass("ui-draggable-dragging"); + this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position + return true; + }, + + _mouseDrag: function(event, noPropagation) { + + //Compute the helpers position + this.position = this._generatePosition(event); + this.positionAbs = this._convertPositionTo("absolute"); + + //Call plugins and callbacks and use the resulting position if something is returned + if (!noPropagation) { + var ui = this._uiHash(); + this._trigger('drag', event, ui); + this.position = ui.position; + } + + if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; + if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; + if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); + + return false; + }, + + _mouseStop: function(event) { + + //If we are using droppables, inform the manager about the drop + var dropped = false; + if ($.ui.ddmanager && !this.options.dropBehaviour) + dropped = $.ui.ddmanager.drop(this, event); + + //if a drop comes from outside (a sortable) + if(this.dropped) { + dropped = this.dropped; + this.dropped = false; + } + + if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { + var self = this; + $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { + self._trigger("stop", event); + self._clear(); + }); + } else { + this._trigger("stop", event); + this._clear(); + } + + return false; + }, + + _getHandle: function(event) { + + var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; + $(this.options.handle, this.element) + .find("*") + .andSelf() + .each(function() { + if(this == event.target) handle = true; + }); + + return handle; + + }, + + _createHelper: function(event) { + + var o = this.options; + var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element); + + if(!helper.parents('body').length) + helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); + + if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) + helper.css("position", "absolute"); + + return helper; + + }, + + _adjustOffsetFromHelper: function(obj) { + if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left; + if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top; + if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + }, + + _getParentOffset: function() { + + //Get the offsetParent and cache its position + this.offsetParent = this.helper.offsetParent(); + var po = this.offsetParent.offset(); + + // This is a special case where we need to modify a offset calculated on start, since the following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that + // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag + if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { + po.left += this.scrollParent.scrollLeft(); + po.top += this.scrollParent.scrollTop(); + } + + if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information + || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix + po = { top: 0, left: 0 }; + + return { + top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), + left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) + }; + + }, + + _getRelativeOffset: function() { + + if(this.cssPosition == "relative") { + var p = this.element.position(); + return { + top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), + left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() + }; + } else { + return { top: 0, left: 0 }; + } + + }, + + _cacheMargins: function() { + this.margins = { + left: (parseInt(this.element.css("marginLeft"),10) || 0), + top: (parseInt(this.element.css("marginTop"),10) || 0) + }; + }, + + _cacheHelperProportions: function() { + this.helperProportions = { + width: this.helper.outerWidth(), + height: this.helper.outerHeight() + }; + }, + + _setContainment: function() { + + var o = this.options; + if(o.containment == 'parent') o.containment = this.helper[0].parentNode; + if(o.containment == 'document' || o.containment == 'window') this.containment = [ + 0 - this.offset.relative.left - this.offset.parent.left, + 0 - this.offset.relative.top - this.offset.parent.top, + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top + ]; + + if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { + var ce = $(o.containment)[0]; if(!ce) return; + var co = $(o.containment).offset(); + var over = ($(ce).css("overflow") != 'hidden'); + + this.containment = [ + co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, + co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, + co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, + co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top + ]; + } else if(o.containment.constructor == Array) { + this.containment = o.containment; + } + + }, + + _convertPositionTo: function(d, pos) { + + if(!pos) pos = this.position; + var mod = d == "absolute" ? 1 : -1; + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + return { + top: ( + pos.top // The absolute mouse position + + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) + - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + ), + left: ( + pos.left // The absolute mouse position + + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) + - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + ) + }; + + }, + + _generatePosition: function(event) { + + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + // This is another very weird special case that only happens for relative elements: + // 1. If the css position is relative + // 2. and the scroll parent is the document or similar to the offset parent + // we have to refresh the relative offset during the scroll so there are no jumps + if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { + this.offset.relative = this._getRelativeOffset(); + } + + var pageX = event.pageX; + var pageY = event.pageY; + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + if(this.originalPosition) { //If we are not dragging yet, we won't check for options + + if(this.containment) { + if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; + if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; + if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; + if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; + } + + if(o.grid) { + var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; + pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; + + var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; + pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; + } + + } + + return { + top: ( + pageY // The absolute mouse position + - this.offset.click.top // Click offset (relative to the element) + - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.top // The offsetParent's offset without borders (offset + border) + + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + ), + left: ( + pageX // The absolute mouse position + - this.offset.click.left // Click offset (relative to the element) + - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.left // The offsetParent's offset without borders (offset + border) + + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + ) + }; + + }, + + _clear: function() { + this.helper.removeClass("ui-draggable-dragging"); + if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove(); + //if($.ui.ddmanager) $.ui.ddmanager.current = null; + this.helper = null; + this.cancelHelperRemoval = false; + }, + + // From now on bulk stuff - mainly helpers + + _trigger: function(type, event, ui) { + ui = ui || this._uiHash(); + $.ui.plugin.call(this, type, [event, ui]); + if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins + return $.widget.prototype._trigger.call(this, type, event, ui); + }, + + plugins: {}, + + _uiHash: function(event) { + return { + helper: this.helper, + position: this.position, + absolutePosition: this.positionAbs, //deprecated + offset: this.positionAbs + }; + } + +})); + +$.extend($.ui.draggable, { + version: "1.7", + eventPrefix: "drag", + defaults: { + addClasses: true, + appendTo: "parent", + axis: false, + cancel: ":input,option", + connectToSortable: false, + containment: false, + cursor: "auto", + cursorAt: false, + delay: 0, + distance: 1, + grid: false, + handle: false, + helper: "original", + iframeFix: false, + opacity: false, + refreshPositions: false, + revert: false, + revertDuration: 500, + scope: "default", + scroll: true, + scrollSensitivity: 20, + scrollSpeed: 20, + snap: false, + snapMode: "both", + snapTolerance: 20, + stack: false, + zIndex: false + } +}); + +$.ui.plugin.add("draggable", "connectToSortable", { + start: function(event, ui) { + + var inst = $(this).data("draggable"), o = inst.options, + uiSortable = $.extend({}, ui, { item: inst.element }); + inst.sortables = []; + $(o.connectToSortable).each(function() { + var sortable = $.data(this, 'sortable'); + if (sortable && !sortable.options.disabled) { + inst.sortables.push({ + instance: sortable, + shouldRevert: sortable.options.revert + }); + sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache + sortable._trigger("activate", event, uiSortable); + } + }); + + }, + stop: function(event, ui) { + + //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper + var inst = $(this).data("draggable"), + uiSortable = $.extend({}, ui, { item: inst.element }); + + $.each(inst.sortables, function() { + if(this.instance.isOver) { + + this.instance.isOver = 0; + + inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance + this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) + + //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' + if(this.shouldRevert) this.instance.options.revert = true; + + //Trigger the stop of the sortable + this.instance._mouseStop(event); + + this.instance.options.helper = this.instance.options._helper; + + //If the helper has been the original item, restore properties in the sortable + if(inst.options.helper == 'original') + this.instance.currentItem.css({ top: 'auto', left: 'auto' }); + + } else { + this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance + this.instance._trigger("deactivate", event, uiSortable); + } + + }); + + }, + drag: function(event, ui) { + + var inst = $(this).data("draggable"), self = this; + + var checkPos = function(o) { + var dyClick = this.offset.click.top, dxClick = this.offset.click.left; + var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left; + var itemHeight = o.height, itemWidth = o.width; + var itemTop = o.top, itemLeft = o.left; + + return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); + }; + + $.each(inst.sortables, function(i) { + + //Copy over some variables to allow calling the sortable's native _intersectsWith + this.instance.positionAbs = inst.positionAbs; + this.instance.helperProportions = inst.helperProportions; + this.instance.offset.click = inst.offset.click; + + if(this.instance._intersectsWith(this.instance.containerCache)) { + + //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once + if(!this.instance.isOver) { + + this.instance.isOver = 1; + //Now we fake the start of dragging for the sortable instance, + //by cloning the list group item, appending it to the sortable and using it as inst.currentItem + //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) + this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true); + this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it + this.instance.options.helper = function() { return ui.helper[0]; }; + + event.target = this.instance.currentItem[0]; + this.instance._mouseCapture(event, true); + this.instance._mouseStart(event, true, true); + + //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes + this.instance.offset.click.top = inst.offset.click.top; + this.instance.offset.click.left = inst.offset.click.left; + this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; + this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; + + inst._trigger("toSortable", event); + inst.dropped = this.instance.element; //draggable revert needs that + //hack so receive/update callbacks work (mostly) + inst.currentItem = inst.element; + this.instance.fromOutside = inst; + + } + + //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable + if(this.instance.currentItem) this.instance._mouseDrag(event); + + } else { + + //If it doesn't intersect with the sortable, and it intersected before, + //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval + if(this.instance.isOver) { + + this.instance.isOver = 0; + this.instance.cancelHelperRemoval = true; + + //Prevent reverting on this forced stop + this.instance.options.revert = false; + + // The out event needs to be triggered independently + this.instance._trigger('out', event, this.instance._uiHash(this.instance)); + + this.instance._mouseStop(event, true); + this.instance.options.helper = this.instance.options._helper; + + //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size + this.instance.currentItem.remove(); + if(this.instance.placeholder) this.instance.placeholder.remove(); + + inst._trigger("fromSortable", event); + inst.dropped = false; //draggable revert needs that + } + + }; + + }); + + } +}); + +$.ui.plugin.add("draggable", "cursor", { + start: function(event, ui) { + var t = $('body'), o = $(this).data('draggable').options; + if (t.css("cursor")) o._cursor = t.css("cursor"); + t.css("cursor", o.cursor); + }, + stop: function(event, ui) { + var o = $(this).data('draggable').options; + if (o._cursor) $('body').css("cursor", o._cursor); + } +}); + +$.ui.plugin.add("draggable", "iframeFix", { + start: function(event, ui) { + var o = $(this).data('draggable').options; + $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { + $('
    ') + .css({ + width: this.offsetWidth+"px", height: this.offsetHeight+"px", + position: "absolute", opacity: "0.001", zIndex: 1000 + }) + .css($(this).offset()) + .appendTo("body"); + }); + }, + stop: function(event, ui) { + $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers + } +}); + +$.ui.plugin.add("draggable", "opacity", { + start: function(event, ui) { + var t = $(ui.helper), o = $(this).data('draggable').options; + if(t.css("opacity")) o._opacity = t.css("opacity"); + t.css('opacity', o.opacity); + }, + stop: function(event, ui) { + var o = $(this).data('draggable').options; + if(o._opacity) $(ui.helper).css('opacity', o._opacity); + } +}); + +$.ui.plugin.add("draggable", "scroll", { + start: function(event, ui) { + var i = $(this).data("draggable"); + if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); + }, + drag: function(event, ui) { + + var i = $(this).data("draggable"), o = i.options, scrolled = false; + + if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { + + if(!o.axis || o.axis != 'x') { + if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) + i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; + else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) + i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; + } + + if(!o.axis || o.axis != 'y') { + if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) + i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; + else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) + i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; + } + + } else { + + if(!o.axis || o.axis != 'x') { + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); + else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); + } + + if(!o.axis || o.axis != 'y') { + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); + else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); + } + + } + + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(i, event); + + } +}); + +$.ui.plugin.add("draggable", "snap", { + start: function(event, ui) { + + var i = $(this).data("draggable"), o = i.options; + i.snapElements = []; + + $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() { + var $t = $(this); var $o = $t.offset(); + if(this != i.element[0]) i.snapElements.push({ + item: this, + width: $t.outerWidth(), height: $t.outerHeight(), + top: $o.top, left: $o.left + }); + }); + + }, + drag: function(event, ui) { + + var inst = $(this).data("draggable"), o = inst.options; + var d = o.snapTolerance; + + var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, + y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; + + for (var i = inst.snapElements.length - 1; i >= 0; i--){ + + var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, + t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; + + //Yes, I know, this is insane ;) + if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { + if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); + inst.snapElements[i].snapping = false; + continue; + } + + if(o.snapMode != 'inner') { + var ts = Math.abs(t - y2) <= d; + var bs = Math.abs(b - y1) <= d; + var ls = Math.abs(l - x2) <= d; + var rs = Math.abs(r - x1) <= d; + if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; + if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; + if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; + if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; + } + + var first = (ts || bs || ls || rs); + + if(o.snapMode != 'outer') { + var ts = Math.abs(t - y1) <= d; + var bs = Math.abs(b - y2) <= d; + var ls = Math.abs(l - x1) <= d; + var rs = Math.abs(r - x2) <= d; + if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; + if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; + if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; + if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; + } + + if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) + (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); + inst.snapElements[i].snapping = (ts || bs || ls || rs || first); + + }; + + } +}); + +$.ui.plugin.add("draggable", "stack", { + start: function(event, ui) { + + var o = $(this).data("draggable").options; + + var group = $.makeArray($(o.stack.group)).sort(function(a,b) { + return (parseInt($(a).css("zIndex"),10) || o.stack.min) - (parseInt($(b).css("zIndex"),10) || o.stack.min); + }); + + $(group).each(function(i) { + this.style.zIndex = o.stack.min + i; + }); + + this[0].style.zIndex = o.stack.min + group.length; + + } +}); + +$.ui.plugin.add("draggable", "zIndex", { + start: function(event, ui) { + var t = $(ui.helper), o = $(this).data("draggable").options; + if(t.css("zIndex")) o._zIndex = t.css("zIndex"); + t.css('zIndex', o.zIndex); + }, + stop: function(event, ui) { + var o = $(this).data("draggable").options; + if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex); + } +}); + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.droppable.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.droppable.js new file mode 100644 index 0000000..d4b17f6 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.droppable.js @@ -0,0 +1,282 @@ +/* + * jQuery UI Droppable 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Droppables + * + * Depends: + * ui.core.js + * ui.draggable.js + */ +(function($) { + +$.widget("ui.droppable", { + + _init: function() { + + var o = this.options, accept = o.accept; + this.isover = 0; this.isout = 1; + + this.options.accept = this.options.accept && $.isFunction(this.options.accept) ? this.options.accept : function(d) { + return d.is(accept); + }; + + //Store the droppable's proportions + this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; + + // Add the reference and positions to the manager + $.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || []; + $.ui.ddmanager.droppables[this.options.scope].push(this); + + (this.options.addClasses && this.element.addClass("ui-droppable")); + + }, + + destroy: function() { + var drop = $.ui.ddmanager.droppables[this.options.scope]; + for ( var i = 0; i < drop.length; i++ ) + if ( drop[i] == this ) + drop.splice(i, 1); + + this.element + .removeClass("ui-droppable ui-droppable-disabled") + .removeData("droppable") + .unbind(".droppable"); + }, + + _setData: function(key, value) { + + if(key == 'accept') { + this.options.accept = value && $.isFunction(value) ? value : function(d) { + return d.is(accept); + }; + } else { + $.widget.prototype._setData.apply(this, arguments); + } + + }, + + _activate: function(event) { + var draggable = $.ui.ddmanager.current; + if(this.options.activeClass) this.element.addClass(this.options.activeClass); + (draggable && this._trigger('activate', event, this.ui(draggable))); + }, + + _deactivate: function(event) { + var draggable = $.ui.ddmanager.current; + if(this.options.activeClass) this.element.removeClass(this.options.activeClass); + (draggable && this._trigger('deactivate', event, this.ui(draggable))); + }, + + _over: function(event) { + + var draggable = $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element + + if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.hoverClass) this.element.addClass(this.options.hoverClass); + this._trigger('over', event, this.ui(draggable)); + } + + }, + + _out: function(event) { + + var draggable = $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element + + if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); + this._trigger('out', event, this.ui(draggable)); + } + + }, + + _drop: function(event,custom) { + + var draggable = custom || $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element + + var childrenIntersection = false; + this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { + var inst = $.data(this, 'droppable'); + if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) { + childrenIntersection = true; return false; + } + }); + if(childrenIntersection) return false; + + if(this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.activeClass) this.element.removeClass(this.options.activeClass); + if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); + this._trigger('drop', event, this.ui(draggable)); + return this.element; + } + + return false; + + }, + + ui: function(c) { + return { + draggable: (c.currentItem || c.element), + helper: c.helper, + position: c.position, + absolutePosition: c.positionAbs, //deprecated + offset: c.positionAbs + }; + } + +}); + +$.extend($.ui.droppable, { + version: "1.7", + eventPrefix: 'drop', + defaults: { + accept: '*', + activeClass: false, + addClasses: true, + greedy: false, + hoverClass: false, + scope: 'default', + tolerance: 'intersect' + } +}); + +$.ui.intersect = function(draggable, droppable, toleranceMode) { + + if (!droppable.offset) return false; + + var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, + y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; + var l = droppable.offset.left, r = l + droppable.proportions.width, + t = droppable.offset.top, b = t + droppable.proportions.height; + + switch (toleranceMode) { + case 'fit': + return (l < x1 && x2 < r + && t < y1 && y2 < b); + break; + case 'intersect': + return (l < x1 + (draggable.helperProportions.width / 2) // Right Half + && x2 - (draggable.helperProportions.width / 2) < r // Left Half + && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half + && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half + break; + case 'pointer': + var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), + draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), + isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); + return isOver; + break; + case 'touch': + return ( + (y1 >= t && y1 <= b) || // Top edge touching + (y2 >= t && y2 <= b) || // Bottom edge touching + (y1 < t && y2 > b) // Surrounded vertically + ) && ( + (x1 >= l && x1 <= r) || // Left edge touching + (x2 >= l && x2 <= r) || // Right edge touching + (x1 < l && x2 > r) // Surrounded horizontally + ); + break; + default: + return false; + break; + } + +}; + +/* + This manager tracks offsets of draggables and droppables +*/ +$.ui.ddmanager = { + current: null, + droppables: { 'default': [] }, + prepareOffsets: function(t, event) { + + var m = $.ui.ddmanager.droppables[t.options.scope]; + var type = event ? event.type : null; // workaround for #2317 + var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); + + droppablesLoop: for (var i = 0; i < m.length; i++) { + + if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted + for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item + m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue + + m[i].offset = m[i].element.offset(); + m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; + + if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables + + } + + }, + drop: function(draggable, event) { + + var dropped = false; + $.each($.ui.ddmanager.droppables[draggable.options.scope], function() { + + if(!this.options) return; + if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) + dropped = this._drop.call(this, event); + + if (!this.options.disabled && this.visible && this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + this.isout = 1; this.isover = 0; + this._deactivate.call(this, event); + } + + }); + return dropped; + + }, + drag: function(draggable, event) { + + //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. + if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); + + //Run through all droppables and check their positions based on specific tolerance options + + $.each($.ui.ddmanager.droppables[draggable.options.scope], function() { + + if(this.options.disabled || this.greedyChild || !this.visible) return; + var intersects = $.ui.intersect(draggable, this, this.options.tolerance); + + var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); + if(!c) return; + + var parentInstance; + if (this.options.greedy) { + var parent = this.element.parents(':data(droppable):eq(0)'); + if (parent.length) { + parentInstance = $.data(parent[0], 'droppable'); + parentInstance.greedyChild = (c == 'isover' ? 1 : 0); + } + } + + // we just moved into a greedy child + if (parentInstance && c == 'isover') { + parentInstance['isover'] = 0; + parentInstance['isout'] = 1; + parentInstance._out.call(parentInstance, event); + } + + this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; + this[c == "isover" ? "_over" : "_out"].call(this, event); + + // we just moved out of a greedy child + if (parentInstance && c == 'isout') { + parentInstance['isout'] = 0; + parentInstance['isover'] = 1; + parentInstance._over.call(parentInstance, event); + } + }); + + } +}; + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.progressbar.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.progressbar.js new file mode 100644 index 0000000..14a73df --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.progressbar.js @@ -0,0 +1,112 @@ +/* + * jQuery UI Progressbar 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Progressbar + * + * Depends: + * ui.core.js + */ +(function($) { + +$.widget("ui.progressbar", { + + _init: function() { + + this.element + .addClass("ui-progressbar" + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all") + .attr({ + role: "progressbar", + "aria-valuemin": this._valueMin(), + "aria-valuemax": this._valueMax(), + "aria-valuenow": this._value() + }); + + this.valueDiv = $('
    ').appendTo(this.element); + + this._refreshValue(); + + }, + + destroy: function() { + + this.element + .removeClass("ui-progressbar" + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all") + .removeAttr("role") + .removeAttr("aria-valuemin") + .removeAttr("aria-valuemax") + .removeAttr("aria-valuenow") + .removeData("progressbar") + .unbind(".progressbar"); + + this.valueDiv.remove(); + + $.widget.prototype.destroy.apply(this, arguments); + + }, + + value: function(newValue) { + arguments.length && this._setData("value", newValue); + return this._value(); + }, + + _setData: function(key, value) { + + switch (key) { + case 'value': + this.options.value = value; + this._refreshValue(); + this._trigger('change', null, {}); + break; + } + + $.widget.prototype._setData.apply(this, arguments); + + }, + + _value: function() { + + var val = this.options.value; + if (val < this._valueMin()) val = this._valueMin(); + if (val > this._valueMax()) val = this._valueMax(); + + return val; + + }, + + _valueMin: function() { + var valueMin = 0; + return valueMin; + }, + + _valueMax: function() { + var valueMax = 100; + return valueMax; + }, + + _refreshValue: function() { + var value = this.value(); + this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right"); + this.valueDiv.width(value + '%'); + this.element.attr("aria-valuenow", value); + } + +}); + +$.extend($.ui.progressbar, { + version: "1.7", + defaults: { + value: 0 + } +}); + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.resizable.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.resizable.js new file mode 100644 index 0000000..0e4b894 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.resizable.js @@ -0,0 +1,800 @@ +/* + * jQuery UI Resizable 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Resizables + * + * Depends: + * ui.core.js + */ +(function($) { + +$.widget("ui.resizable", $.extend({}, $.ui.mouse, { + + _init: function() { + + var self = this, o = this.options; + this.element.addClass("ui-resizable"); + + $.extend(this, { + _aspectRatio: !!(o.aspectRatio), + aspectRatio: o.aspectRatio, + originalElement: this.element, + _proportionallyResizeElements: [], + _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null + }); + + //Wrap the element if it cannot hold child nodes + if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { + + //Opera fix for relative positioning + if (/relative/.test(this.element.css('position')) && $.browser.opera) + this.element.css({ position: 'relative', top: 'auto', left: 'auto' }); + + //Create a wrapper element and set the wrapper to the new current internal element + this.element.wrap( + $('
    ').css({ + position: this.element.css('position'), + width: this.element.outerWidth(), + height: this.element.outerHeight(), + top: this.element.css('top'), + left: this.element.css('left') + }) + ); + + //Overwrite the original this.element + this.element = this.element.parent().data( + "resizable", this.element.data('resizable') + ); + + this.elementIsWrapper = true; + + //Move margins to the wrapper + this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); + this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); + + //Prevent Safari textarea resize + this.originalResizeStyle = this.originalElement.css('resize'); + this.originalElement.css('resize', 'none'); + + //Push the actual element to our proportionallyResize internal array + this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' })); + + // avoid IE jump (hard set the margin) + this.originalElement.css({ margin: this.originalElement.css('margin') }); + + // fix handlers offset + this._proportionallyResize(); + + } + + this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' }); + if(this.handles.constructor == String) { + + if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw'; + var n = this.handles.split(","); this.handles = {}; + + for(var i = 0; i < n.length; i++) { + + var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; + var axis = $('
    '); + + // increase zIndex of sw, se, ne, nw axis + //TODO : this modifies original option + if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex }); + + //TODO : What's going on here? + if ('se' == handle) { + axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se'); + }; + + //Insert into internal handles object and append to element + this.handles[handle] = '.ui-resizable-'+handle; + this.element.append(axis); + } + + } + + this._renderAxis = function(target) { + + target = target || this.element; + + for(var i in this.handles) { + + if(this.handles[i].constructor == String) + this.handles[i] = $(this.handles[i], this.element).show(); + + //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) + if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { + + var axis = $(this.handles[i], this.element), padWrapper = 0; + + //Checking the correct pad and border + padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); + + //The padding type i have to apply... + var padPos = [ 'padding', + /ne|nw|n/.test(i) ? 'Top' : + /se|sw|s/.test(i) ? 'Bottom' : + /^e$/.test(i) ? 'Right' : 'Left' ].join(""); + + target.css(padPos, padWrapper); + + this._proportionallyResize(); + + } + + //TODO: What's that good for? There's not anything to be executed left + if(!$(this.handles[i]).length) + continue; + + } + }; + + //TODO: make renderAxis a prototype function + this._renderAxis(this.element); + + this._handles = $('.ui-resizable-handle', this.element) + .disableSelection(); + + //Matching axis name + this._handles.mouseover(function() { + if (!self.resizing) { + if (this.className) + var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); + //Axis, default = se + self.axis = axis && axis[1] ? axis[1] : 'se'; + } + }); + + //If we want to auto hide the elements + if (o.autoHide) { + this._handles.hide(); + $(this.element) + .addClass("ui-resizable-autohide") + .hover(function() { + $(this).removeClass("ui-resizable-autohide"); + self._handles.show(); + }, + function(){ + if (!self.resizing) { + $(this).addClass("ui-resizable-autohide"); + self._handles.hide(); + } + }); + } + + //Initialize the mouse interaction + this._mouseInit(); + + }, + + destroy: function() { + + this._mouseDestroy(); + + var _destroy = function(exp) { + $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") + .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); + }; + + //TODO: Unwrap at same DOM position + if (this.elementIsWrapper) { + _destroy(this.element); + var wrapper = this.element; + wrapper.parent().append( + this.originalElement.css({ + position: wrapper.css('position'), + width: wrapper.outerWidth(), + height: wrapper.outerHeight(), + top: wrapper.css('top'), + left: wrapper.css('left') + }) + ).end().remove(); + } + + this.originalElement.css('resize', this.originalResizeStyle); + _destroy(this.originalElement); + + }, + + _mouseCapture: function(event) { + + var handle = false; + for(var i in this.handles) { + if($(this.handles[i])[0] == event.target) handle = true; + } + + return this.options.disabled || !!handle; + + }, + + _mouseStart: function(event) { + + var o = this.options, iniPos = this.element.position(), el = this.element; + + this.resizing = true; + this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; + + // bugfix for http://dev.jquery.com/ticket/1749 + if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { + el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left }); + } + + //Opera fixing relative position + if ($.browser.opera && (/relative/).test(el.css('position'))) + el.css({ position: 'relative', top: 'auto', left: 'auto' }); + + this._renderProxy(); + + var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); + + if (o.containment) { + curleft += $(o.containment).scrollLeft() || 0; + curtop += $(o.containment).scrollTop() || 0; + } + + //Store needed variables + this.offset = this.helper.offset(); + this.position = { left: curleft, top: curtop }; + this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; + this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; + this.originalPosition = { left: curleft, top: curtop }; + this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; + this.originalMousePosition = { left: event.pageX, top: event.pageY }; + + //Aspect Ratio + this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); + + var cursor = $('.ui-resizable-' + this.axis).css('cursor'); + $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); + + el.addClass("ui-resizable-resizing"); + this._propagate("start", event); + return true; + }, + + _mouseDrag: function(event) { + + //Increase performance, avoid regex + var el = this.helper, o = this.options, props = {}, + self = this, smp = this.originalMousePosition, a = this.axis; + + var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; + var trigger = this._change[a]; + if (!trigger) return false; + + // Calculate the attrs that will be change + var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff; + + if (this._aspectRatio || event.shiftKey) + data = this._updateRatio(data, event); + + data = this._respectSize(data, event); + + // plugins callbacks need to be called first + this._propagate("resize", event); + + el.css({ + top: this.position.top + "px", left: this.position.left + "px", + width: this.size.width + "px", height: this.size.height + "px" + }); + + if (!this._helper && this._proportionallyResizeElements.length) + this._proportionallyResize(); + + this._updateCache(data); + + // calling the user callback at the end + this._trigger('resize', event, this.ui()); + + return false; + }, + + _mouseStop: function(event) { + + this.resizing = false; + var o = this.options, self = this; + + if(this._helper) { + var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, + soffsetw = ista ? 0 : self.sizeDiff.width; + + var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, + left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, + top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; + + if (!o.animate) + this.element.css($.extend(s, { top: top, left: left })); + + self.helper.height(self.size.height); + self.helper.width(self.size.width); + + if (this._helper && !o.animate) this._proportionallyResize(); + } + + $('body').css('cursor', 'auto'); + + this.element.removeClass("ui-resizable-resizing"); + + this._propagate("stop", event); + + if (this._helper) this.helper.remove(); + return false; + + }, + + _updateCache: function(data) { + var o = this.options; + this.offset = this.helper.offset(); + if (isNumber(data.left)) this.position.left = data.left; + if (isNumber(data.top)) this.position.top = data.top; + if (isNumber(data.height)) this.size.height = data.height; + if (isNumber(data.width)) this.size.width = data.width; + }, + + _updateRatio: function(data, event) { + + var o = this.options, cpos = this.position, csize = this.size, a = this.axis; + + if (data.height) data.width = (csize.height * this.aspectRatio); + else if (data.width) data.height = (csize.width / this.aspectRatio); + + if (a == 'sw') { + data.left = cpos.left + (csize.width - data.width); + data.top = null; + } + if (a == 'nw') { + data.top = cpos.top + (csize.height - data.height); + data.left = cpos.left + (csize.width - data.width); + } + + return data; + }, + + _respectSize: function(data, event) { + + var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, + ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), + isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); + + if (isminw) data.width = o.minWidth; + if (isminh) data.height = o.minHeight; + if (ismaxw) data.width = o.maxWidth; + if (ismaxh) data.height = o.maxHeight; + + var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; + var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); + + if (isminw && cw) data.left = dw - o.minWidth; + if (ismaxw && cw) data.left = dw - o.maxWidth; + if (isminh && ch) data.top = dh - o.minHeight; + if (ismaxh && ch) data.top = dh - o.maxHeight; + + // fixing jump error on top/left - bug #2330 + var isNotwh = !data.width && !data.height; + if (isNotwh && !data.left && data.top) data.top = null; + else if (isNotwh && !data.top && data.left) data.left = null; + + return data; + }, + + _proportionallyResize: function() { + + var o = this.options; + if (!this._proportionallyResizeElements.length) return; + var element = this.helper || this.element; + + for (var i=0; i < this._proportionallyResizeElements.length; i++) { + + var prel = this._proportionallyResizeElements[i]; + + if (!this.borderDif) { + var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], + p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; + + this.borderDif = $.map(b, function(v, i) { + var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; + return border + padding; + }); + } + + if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length))) + continue; + + prel.css({ + height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0, + width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0 + }); + + }; + + }, + + _renderProxy: function() { + + var el = this.element, o = this.options; + this.elementOffset = el.offset(); + + if(this._helper) { + + this.helper = this.helper || $('
    '); + + // fix ie6 offset TODO: This seems broken + var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0), + pxyoffset = ( ie6 ? 2 : -1 ); + + this.helper.addClass(this._helper).css({ + width: this.element.outerWidth() + pxyoffset, + height: this.element.outerHeight() + pxyoffset, + position: 'absolute', + left: this.elementOffset.left - ie6offset +'px', + top: this.elementOffset.top - ie6offset +'px', + zIndex: ++o.zIndex //TODO: Don't modify option + }); + + this.helper + .appendTo("body") + .disableSelection(); + + } else { + this.helper = this.element; + } + + }, + + _change: { + e: function(event, dx, dy) { + return { width: this.originalSize.width + dx }; + }, + w: function(event, dx, dy) { + var o = this.options, cs = this.originalSize, sp = this.originalPosition; + return { left: sp.left + dx, width: cs.width - dx }; + }, + n: function(event, dx, dy) { + var o = this.options, cs = this.originalSize, sp = this.originalPosition; + return { top: sp.top + dy, height: cs.height - dy }; + }, + s: function(event, dx, dy) { + return { height: this.originalSize.height + dy }; + }, + se: function(event, dx, dy) { + return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); + }, + sw: function(event, dx, dy) { + return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); + }, + ne: function(event, dx, dy) { + return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); + }, + nw: function(event, dx, dy) { + return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); + } + }, + + _propagate: function(n, event) { + $.ui.plugin.call(this, n, [event, this.ui()]); + (n != "resize" && this._trigger(n, event, this.ui())); + }, + + plugins: {}, + + ui: function() { + return { + originalElement: this.originalElement, + element: this.element, + helper: this.helper, + position: this.position, + size: this.size, + originalSize: this.originalSize, + originalPosition: this.originalPosition + }; + } + +})); + +$.extend($.ui.resizable, { + version: "1.7", + eventPrefix: "resize", + defaults: { + alsoResize: false, + animate: false, + animateDuration: "slow", + animateEasing: "swing", + aspectRatio: false, + autoHide: false, + cancel: ":input,option", + containment: false, + delay: 0, + distance: 1, + ghost: false, + grid: false, + handles: "e,s,se", + helper: false, + maxHeight: null, + maxWidth: null, + minHeight: 10, + minWidth: 10, + zIndex: 1000 + } +}); + +/* + * Resizable Extensions + */ + +$.ui.plugin.add("resizable", "alsoResize", { + + start: function(event, ui) { + + var self = $(this).data("resizable"), o = self.options; + + _store = function(exp) { + $(exp).each(function() { + $(this).data("resizable-alsoresize", { + width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10), + left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10) + }); + }); + }; + + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { + if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } + else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); } + }else{ + _store(o.alsoResize); + } + }, + + resize: function(event, ui){ + var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition; + + var delta = { + height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0, + top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0 + }, + + _alsoResize = function(exp, c) { + $(exp).each(function() { + var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left']; + + $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) { + var sum = (start[prop]||0) + (delta[prop]||0); + if (sum && sum >= 0) + style[prop] = sum || null; + }); + + //Opera fixing relative position + if (/relative/.test(el.css('position')) && $.browser.opera) { + self._revertToRelativePosition = true; + el.css({ position: 'absolute', top: 'auto', left: 'auto' }); + } + + el.css(style); + }); + }; + + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { + $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); }); + }else{ + _alsoResize(o.alsoResize); + } + }, + + stop: function(event, ui){ + var self = $(this).data("resizable"); + + //Opera fixing relative position + if (self._revertToRelativePosition && $.browser.opera) { + self._revertToRelativePosition = false; + el.css({ position: 'relative' }); + } + + $(this).removeData("resizable-alsoresize-start"); + } +}); + +$.ui.plugin.add("resizable", "animate", { + + stop: function(event, ui) { + var self = $(this).data("resizable"), o = self.options; + + var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, + soffsetw = ista ? 0 : self.sizeDiff.width; + + var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, + left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, + top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; + + self.element.animate( + $.extend(style, top && left ? { top: top, left: left } : {}), { + duration: o.animateDuration, + easing: o.animateEasing, + step: function() { + + var data = { + width: parseInt(self.element.css('width'), 10), + height: parseInt(self.element.css('height'), 10), + top: parseInt(self.element.css('top'), 10), + left: parseInt(self.element.css('left'), 10) + }; + + if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height }); + + // propagating resize, and updating values for each animation step + self._updateCache(data); + self._propagate("resize", event); + + } + } + ); + } + +}); + +$.ui.plugin.add("resizable", "containment", { + + start: function(event, ui) { + var self = $(this).data("resizable"), o = self.options, el = self.element; + var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; + if (!ce) return; + + self.containerElement = $(ce); + + if (/document/.test(oc) || oc == document) { + self.containerOffset = { left: 0, top: 0 }; + self.containerPosition = { left: 0, top: 0 }; + + self.parentData = { + element: $(document), left: 0, top: 0, + width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight + }; + } + + // i'm a node, so compute top, left, right, bottom + else { + var element = $(ce), p = []; + $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); + + self.containerOffset = element.offset(); + self.containerPosition = element.position(); + self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; + + var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width, + width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); + + self.parentData = { + element: ce, left: co.left, top: co.top, width: width, height: height + }; + } + }, + + resize: function(event, ui) { + var self = $(this).data("resizable"), o = self.options, + ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position, + pRatio = o._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement; + + if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co; + + if (cp.left < (self._helper ? co.left : 0)) { + self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left)); + if (pRatio) self.size.height = self.size.width / o.aspectRatio; + self.position.left = o.helper ? co.left : 0; + } + + if (cp.top < (self._helper ? co.top : 0)) { + self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top); + if (pRatio) self.size.width = self.size.height * o.aspectRatio; + self.position.top = self._helper ? co.top : 0; + } + + self.offset.left = self.parentData.left+self.position.left; + self.offset.top = self.parentData.top+self.position.top; + + var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ), + hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height ); + + var isParent = self.containerElement.get(0) == self.element.parent().get(0), + isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position')); + + if(isParent && isOffsetRelative) woset -= self.parentData.left; + + if (woset + self.size.width >= self.parentData.width) { + self.size.width = self.parentData.width - woset; + if (pRatio) self.size.height = self.size.width / o.aspectRatio; + } + + if (hoset + self.size.height >= self.parentData.height) { + self.size.height = self.parentData.height - hoset; + if (pRatio) self.size.width = self.size.height * o.aspectRatio; + } + }, + + stop: function(event, ui){ + var self = $(this).data("resizable"), o = self.options, cp = self.position, + co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement; + + var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height; + + if (self._helper && !o.animate && (/relative/).test(ce.css('position'))) + $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); + + if (self._helper && !o.animate && (/static/).test(ce.css('position'))) + $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); + + } +}); + +$.ui.plugin.add("resizable", "ghost", { + + start: function(event, ui) { + + var self = $(this).data("resizable"), o = self.options, cs = self.size; + + self.ghost = self.originalElement.clone(); + self.ghost + .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) + .addClass('ui-resizable-ghost') + .addClass(typeof o.ghost == 'string' ? o.ghost : ''); + + self.ghost.appendTo(self.helper); + + }, + + resize: function(event, ui){ + var self = $(this).data("resizable"), o = self.options; + if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width }); + }, + + stop: function(event, ui){ + var self = $(this).data("resizable"), o = self.options; + if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0)); + } + +}); + +$.ui.plugin.add("resizable", "grid", { + + resize: function(event, ui) { + var self = $(this).data("resizable"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey; + o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; + var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1); + + if (/^(se|s|e)$/.test(a)) { + self.size.width = os.width + ox; + self.size.height = os.height + oy; + } + else if (/^(ne)$/.test(a)) { + self.size.width = os.width + ox; + self.size.height = os.height + oy; + self.position.top = op.top - oy; + } + else if (/^(sw)$/.test(a)) { + self.size.width = os.width + ox; + self.size.height = os.height + oy; + self.position.left = op.left - ox; + } + else { + self.size.width = os.width + ox; + self.size.height = os.height + oy; + self.position.top = op.top - oy; + self.position.left = op.left - ox; + } + } + +}); + +var num = function(v) { + return parseInt(v, 10) || 0; +}; + +var isNumber = function(value) { + return !isNaN(parseInt(value, 10)); +}; + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.selectable.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.selectable.js new file mode 100644 index 0000000..3d5df28 --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.selectable.js @@ -0,0 +1,257 @@ +/* + * jQuery UI Selectable 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Selectables + * + * Depends: + * ui.core.js + */ +(function($) { + +$.widget("ui.selectable", $.extend({}, $.ui.mouse, { + + _init: function() { + var self = this; + + this.element.addClass("ui-selectable"); + + this.dragged = false; + + // cache selectee children based on filter + var selectees; + this.refresh = function() { + selectees = $(self.options.filter, self.element[0]); + selectees.each(function() { + var $this = $(this); + var pos = $this.offset(); + $.data(this, "selectable-item", { + element: this, + $element: $this, + left: pos.left, + top: pos.top, + right: pos.left + $this.outerWidth(), + bottom: pos.top + $this.outerHeight(), + startselected: false, + selected: $this.hasClass('ui-selected'), + selecting: $this.hasClass('ui-selecting'), + unselecting: $this.hasClass('ui-unselecting') + }); + }); + }; + this.refresh(); + + this.selectees = selectees.addClass("ui-selectee"); + + this._mouseInit(); + + this.helper = $(document.createElement('div')) + .css({border:'1px dotted black'}) + .addClass("ui-selectable-helper"); + }, + + destroy: function() { + this.element + .removeClass("ui-selectable ui-selectable-disabled") + .removeData("selectable") + .unbind(".selectable"); + this._mouseDestroy(); + }, + + _mouseStart: function(event) { + var self = this; + + this.opos = [event.pageX, event.pageY]; + + if (this.options.disabled) + return; + + var options = this.options; + + this.selectees = $(options.filter, this.element[0]); + + this._trigger("start", event); + + $('body').append(this.helper); + // position helper (lasso) + this.helper.css({ + "z-index": 100, + "position": "absolute", + "left": event.clientX, + "top": event.clientY, + "width": 0, + "height": 0 + }); + + if (options.autoRefresh) { + this.refresh(); + } + + this.selectees.filter('.ui-selected').each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.startselected = true; + if (!event.metaKey) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + // selectable UNSELECTING callback + self._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + }); + + $(event.target).parents().andSelf().each(function() { + var selectee = $.data(this, "selectable-item"); + if (selectee) { + selectee.$element.removeClass("ui-unselecting").addClass('ui-selecting'); + selectee.unselecting = false; + selectee.selecting = true; + selectee.selected = true; + // selectable SELECTING callback + self._trigger("selecting", event, { + selecting: selectee.element + }); + return false; + } + }); + + }, + + _mouseDrag: function(event) { + var self = this; + this.dragged = true; + + if (this.options.disabled) + return; + + var options = this.options; + + var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY; + if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; } + if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; } + this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); + + this.selectees.each(function() { + var selectee = $.data(this, "selectable-item"); + //prevent helper from being selected if appendTo: selectable + if (!selectee || selectee.element == self.element[0]) + return; + var hit = false; + if (options.tolerance == 'touch') { + hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); + } else if (options.tolerance == 'fit') { + hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); + } + + if (hit) { + // SELECT + if (selectee.selected) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + } + if (selectee.unselecting) { + selectee.$element.removeClass('ui-unselecting'); + selectee.unselecting = false; + } + if (!selectee.selecting) { + selectee.$element.addClass('ui-selecting'); + selectee.selecting = true; + // selectable SELECTING callback + self._trigger("selecting", event, { + selecting: selectee.element + }); + } + } else { + // UNSELECT + if (selectee.selecting) { + if (event.metaKey && selectee.startselected) { + selectee.$element.removeClass('ui-selecting'); + selectee.selecting = false; + selectee.$element.addClass('ui-selected'); + selectee.selected = true; + } else { + selectee.$element.removeClass('ui-selecting'); + selectee.selecting = false; + if (selectee.startselected) { + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + } + // selectable UNSELECTING callback + self._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + } + if (selectee.selected) { + if (!event.metaKey && !selectee.startselected) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + // selectable UNSELECTING callback + self._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + } + } + }); + + return false; + }, + + _mouseStop: function(event) { + var self = this; + + this.dragged = false; + + var options = this.options; + + $('.ui-unselecting', this.element[0]).each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.$element.removeClass('ui-unselecting'); + selectee.unselecting = false; + selectee.startselected = false; + self._trigger("unselected", event, { + unselected: selectee.element + }); + }); + $('.ui-selecting', this.element[0]).each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.$element.removeClass('ui-selecting').addClass('ui-selected'); + selectee.selecting = false; + selectee.selected = true; + selectee.startselected = true; + self._trigger("selected", event, { + selected: selectee.element + }); + }); + this._trigger("stop", event); + + this.helper.remove(); + + return false; + } + +})); + +$.extend($.ui.selectable, { + version: "1.7", + defaults: { + appendTo: 'body', + autoRefresh: true, + cancel: ":input,option", + delay: 0, + distance: 0, + filter: '*', + tolerance: 'touch' + } +}); + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.slider.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.slider.js new file mode 100644 index 0000000..a7b4d0c --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.slider.js @@ -0,0 +1,511 @@ +/* + * jQuery UI Slider 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Slider + * + * Depends: + * ui.core.js + */ + +(function($) { + +$.widget("ui.slider", $.extend({}, $.ui.mouse, { + + _init: function() { + + var self = this, o = this.options; + this._keySliding = false; + this._handleIndex = null; + this._detectOrientation(); + this._mouseInit(); + + this.element + .addClass("ui-slider" + + " ui-slider-" + this.orientation + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all"); + + this.range = $([]); + + if (o.range) { + + if (o.range === true) { + this.range = $('
    '); + if (!o.values) o.values = [this._valueMin(), this._valueMin()]; + if (o.values.length && o.values.length != 2) { + o.values = [o.values[0], o.values[0]]; + } + } else { + this.range = $('
    '); + } + + this.range + .appendTo(this.element) + .addClass("ui-slider-range"); + + if (o.range == "min" || o.range == "max") { + this.range.addClass("ui-slider-range-" + o.range); + } + + // note: this isn't the most fittingly semantic framework class for this element, + // but worked best visually with a variety of themes + this.range.addClass("ui-widget-header"); + + } + + if ($(".ui-slider-handle", this.element).length == 0) + $('
    ') + .appendTo(this.element) + .addClass("ui-slider-handle"); + + if (o.values && o.values.length) { + while ($(".ui-slider-handle", this.element).length < o.values.length) + $('') + .appendTo(this.element) + .addClass("ui-slider-handle"); + } + + this.handles = $(".ui-slider-handle", this.element) + .addClass("ui-state-default" + + " ui-corner-all"); + + this.handle = this.handles.eq(0); + + this.handles.add(this.range).filter("a") + .click(function(event) { event.preventDefault(); }) + .hover(function() { $(this).addClass('ui-state-hover'); }, function() { $(this).removeClass('ui-state-hover'); }) + .focus(function() { $(".ui-slider .ui-state-focus").removeClass('ui-state-focus'); $(this).addClass('ui-state-focus'); }) + .blur(function() { $(this).removeClass('ui-state-focus'); }); + + this.handles.each(function(i) { + $(this).data("index.ui-slider-handle", i); + }); + + this.handles.keydown(function(event) { + + var ret = true; + + var index = $(this).data("index.ui-slider-handle"); + + if (self.options.disabled) + return; + + switch (event.keyCode) { + case $.ui.keyCode.HOME: + case $.ui.keyCode.END: + case $.ui.keyCode.UP: + case $.ui.keyCode.RIGHT: + case $.ui.keyCode.DOWN: + case $.ui.keyCode.LEFT: + ret = false; + if (!self._keySliding) { + self._keySliding = true; + $(this).addClass("ui-state-active"); + self._start(event, index); + } + break; + } + + var curVal, newVal, step = self._step(); + if (self.options.values && self.options.values.length) { + curVal = newVal = self.values(index); + } else { + curVal = newVal = self.value(); + } + + switch (event.keyCode) { + case $.ui.keyCode.HOME: + newVal = self._valueMin(); + break; + case $.ui.keyCode.END: + newVal = self._valueMax(); + break; + case $.ui.keyCode.UP: + case $.ui.keyCode.RIGHT: + if(curVal == self._valueMax()) return; + newVal = curVal + step; + break; + case $.ui.keyCode.DOWN: + case $.ui.keyCode.LEFT: + if(curVal == self._valueMin()) return; + newVal = curVal - step; + break; + } + + self._slide(event, index, newVal); + + return ret; + + }).keyup(function(event) { + + var index = $(this).data("index.ui-slider-handle"); + + if (self._keySliding) { + self._stop(event, index); + self._change(event, index); + self._keySliding = false; + $(this).removeClass("ui-state-active"); + } + + }); + + this._refreshValue(); + + }, + + destroy: function() { + + this.handles.remove(); + + this.element + .removeClass("ui-slider" + + " ui-slider-horizontal" + + " ui-slider-vertical" + + " ui-slider-disabled" + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all") + .removeData("slider") + .unbind(".slider"); + + this._mouseDestroy(); + + }, + + _mouseCapture: function(event) { + + var o = this.options; + + if (o.disabled) + return false; + + this.elementSize = { + width: this.element.outerWidth(), + height: this.element.outerHeight() + }; + this.elementOffset = this.element.offset(); + + var position = { x: event.pageX, y: event.pageY }; + var normValue = this._normValueFromMouse(position); + + var distance = this._valueMax() + 1, closestHandle; + var self = this, index; + this.handles.each(function(i) { + var thisDistance = Math.abs(normValue - self.values(i)); + if (distance > thisDistance) { + distance = thisDistance; + closestHandle = $(this); + index = i; + } + }); + + // workaround for bug #3736 (if both handles of a range are at 0, + // the first is always used as the one with least distance, + // and moving it is obviously prevented by preventing negative ranges) + if(o.range == true && this.values(1) == o.min) { + closestHandle = $(this.handles[++index]); + } + + this._start(event, index); + + self._handleIndex = index; + + closestHandle + .addClass("ui-state-active") + .focus(); + + var offset = closestHandle.offset(); + var mouseOverHandle = !$(event.target).parents().andSelf().is('.ui-slider-handle'); + this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { + left: event.pageX - offset.left - (closestHandle.width() / 2), + top: event.pageY - offset.top + - (closestHandle.height() / 2) + - (parseInt(closestHandle.css('borderTopWidth'),10) || 0) + - (parseInt(closestHandle.css('borderBottomWidth'),10) || 0) + + (parseInt(closestHandle.css('marginTop'),10) || 0) + }; + + normValue = this._normValueFromMouse(position); + this._slide(event, index, normValue); + return true; + + }, + + _mouseStart: function(event) { + return true; + }, + + _mouseDrag: function(event) { + + var position = { x: event.pageX, y: event.pageY }; + var normValue = this._normValueFromMouse(position); + + this._slide(event, this._handleIndex, normValue); + + return false; + + }, + + _mouseStop: function(event) { + + this.handles.removeClass("ui-state-active"); + this._stop(event, this._handleIndex); + this._change(event, this._handleIndex); + this._handleIndex = null; + this._clickOffset = null; + + return false; + + }, + + _detectOrientation: function() { + this.orientation = this.options.orientation == 'vertical' ? 'vertical' : 'horizontal'; + }, + + _normValueFromMouse: function(position) { + + var pixelTotal, pixelMouse; + if ('horizontal' == this.orientation) { + pixelTotal = this.elementSize.width; + pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0); + } else { + pixelTotal = this.elementSize.height; + pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0); + } + + var percentMouse = (pixelMouse / pixelTotal); + if (percentMouse > 1) percentMouse = 1; + if (percentMouse < 0) percentMouse = 0; + if ('vertical' == this.orientation) + percentMouse = 1 - percentMouse; + + var valueTotal = this._valueMax() - this._valueMin(), + valueMouse = percentMouse * valueTotal, + valueMouseModStep = valueMouse % this.options.step, + normValue = this._valueMin() + valueMouse - valueMouseModStep; + + if (valueMouseModStep > (this.options.step / 2)) + normValue += this.options.step; + + // Since JavaScript has problems with large floats, round + // the final value to 5 digits after the decimal point (see #4124) + return parseFloat(normValue.toFixed(5)); + + }, + + _start: function(event, index) { + this._trigger("start", event, this._uiHash(index)); + }, + + _slide: function(event, index, newVal) { + + var handle = this.handles[index]; + + if (this.options.values && this.options.values.length) { + + var otherVal = this.values(index ? 0 : 1); + + if ((index == 0 && newVal >= otherVal) || (index == 1 && newVal <= otherVal)) + newVal = otherVal; + + if (newVal != this.values(index)) { + var newValues = this.values(); + newValues[index] = newVal; + // A slide can be canceled by returning false from the slide callback + var allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues)); + var otherVal = this.values(index ? 0 : 1); + if (allowed !== false) { + this.values(index, newVal, ( event.type == 'mousedown' && this.options.animate ), true); + } + } + + } else { + + if (newVal != this.value()) { + // A slide can be canceled by returning false from the slide callback + var allowed = this._trigger("slide", event, this._uiHash(index, newVal)); + if (allowed !== false) { + this._setData('value', newVal, ( event.type == 'mousedown' && this.options.animate )); + } + + } + + } + + }, + + _stop: function(event, index) { + this._trigger("stop", event, this._uiHash(index)); + }, + + _change: function(event, index) { + this._trigger("change", event, this._uiHash(index)); + }, + + value: function(newValue) { + + if (arguments.length) { + this._setData("value", newValue); + this._change(null, 0); + } + + return this._value(); + + }, + + values: function(index, newValue, animated, noPropagation) { + + if (arguments.length > 1) { + this.options.values[index] = newValue; + this._refreshValue(animated); + if(!noPropagation) this._change(null, index); + } + + if (arguments.length) { + if (this.options.values && this.options.values.length) { + return this._values(index); + } else { + return this.value(); + } + } else { + return this._values(); + } + + }, + + _setData: function(key, value, animated) { + + $.widget.prototype._setData.apply(this, arguments); + + switch (key) { + case 'orientation': + + this._detectOrientation(); + + this.element + .removeClass("ui-slider-horizontal ui-slider-vertical") + .addClass("ui-slider-" + this.orientation); + this._refreshValue(animated); + break; + case 'value': + this._refreshValue(animated); + break; + } + + }, + + _step: function() { + var step = this.options.step; + return step; + }, + + _value: function() { + + var val = this.options.value; + if (val < this._valueMin()) val = this._valueMin(); + if (val > this._valueMax()) val = this._valueMax(); + + return val; + + }, + + _values: function(index) { + + if (arguments.length) { + var val = this.options.values[index]; + if (val < this._valueMin()) val = this._valueMin(); + if (val > this._valueMax()) val = this._valueMax(); + + return val; + } else { + return this.options.values; + } + + }, + + _valueMin: function() { + var valueMin = this.options.min; + return valueMin; + }, + + _valueMax: function() { + var valueMax = this.options.max; + return valueMax; + }, + + _refreshValue: function(animate) { + + var oRange = this.options.range, o = this.options, self = this; + + if (this.options.values && this.options.values.length) { + var vp0, vp1; + this.handles.each(function(i, j) { + var valPercent = (self.values(i) - self._valueMin()) / (self._valueMax() - self._valueMin()) * 100; + var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%'; + $(this).stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate); + if (self.options.range === true) { + if (self.orientation == 'horizontal') { + (i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ left: valPercent + '%' }, o.animate); + (i == 1) && self.range[animate ? 'animate' : 'css']({ width: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate }); + } else { + (i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ bottom: (valPercent) + '%' }, o.animate); + (i == 1) && self.range[animate ? 'animate' : 'css']({ height: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate }); + } + } + lastValPercent = valPercent; + }); + } else { + var value = this.value(), + valueMin = this._valueMin(), + valueMax = this._valueMax(), + valPercent = valueMax != valueMin + ? (value - valueMin) / (valueMax - valueMin) * 100 + : 0; + var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%'; + this.handle.stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate); + + (oRange == "min") && (this.orientation == "horizontal") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ width: valPercent + '%' }, o.animate); + (oRange == "max") && (this.orientation == "horizontal") && this.range[animate ? 'animate' : 'css']({ width: (100 - valPercent) + '%' }, { queue: false, duration: o.animate }); + (oRange == "min") && (this.orientation == "vertical") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ height: valPercent + '%' }, o.animate); + (oRange == "max") && (this.orientation == "vertical") && this.range[animate ? 'animate' : 'css']({ height: (100 - valPercent) + '%' }, { queue: false, duration: o.animate }); + } + + }, + + _uiHash: function(index, value, values) { + + var multiple = this.options.values && this.options.values.length; + return { + handle: this.handles[index], + value: value || (multiple ? this.values(index) : this.value()), + values: values || (multiple && this.values()) + }; + + } + +})); + +$.extend($.ui.slider, { + getter: "value values", + version: "1.7", + eventPrefix: "slide", + defaults: { + animate: false, + delay: 0, + distance: 0, + max: 100, + min: 0, + orientation: 'horizontal', + range: false, + step: 1, + value: 0, + values: null + } +}); + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.sortable.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.sortable.js new file mode 100644 index 0000000..b18d52e --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.sortable.js @@ -0,0 +1,1019 @@ +/* + * jQuery UI Sortable 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Sortables + * + * Depends: + * ui.core.js + */ +(function($) { + +$.widget("ui.sortable", $.extend({}, $.ui.mouse, { + _init: function() { + + var o = this.options; + this.containerCache = {}; + this.element.addClass("ui-sortable"); + + //Get the items + this.refresh(); + + //Let's determine if the items are floating + this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false; + + //Let's determine the parent's offset + this.offset = this.element.offset(); + + //Initialize mouse events for interaction + this._mouseInit(); + + }, + + destroy: function() { + this.element + .removeClass("ui-sortable ui-sortable-disabled") + .removeData("sortable") + .unbind(".sortable"); + this._mouseDestroy(); + + for ( var i = this.items.length - 1; i >= 0; i-- ) + this.items[i].item.removeData("sortable-item"); + }, + + _mouseCapture: function(event, overrideHandle) { + + if (this.reverting) { + return false; + } + + if(this.options.disabled || this.options.type == 'static') return false; + + //We have to refresh the items data once first + this._refreshItems(event); + + //Find out if the clicked node (or one of its parents) is a actual item in this.items + var currentItem = null, self = this, nodes = $(event.target).parents().each(function() { + if($.data(this, 'sortable-item') == self) { + currentItem = $(this); + return false; + } + }); + if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target); + + if(!currentItem) return false; + if(this.options.handle && !overrideHandle) { + var validHandle = false; + + $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; }); + if(!validHandle) return false; + } + + this.currentItem = currentItem; + this._removeCurrentsFromItems(); + return true; + + }, + + _mouseStart: function(event, overrideHandle, noActivation) { + + var o = this.options, self = this; + this.currentContainer = this; + + //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture + this.refreshPositions(); + + //Create and append the visible helper + this.helper = this._createHelper(event); + + //Cache the helper size + this._cacheHelperProportions(); + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //Get the next scrolling parent + this.scrollParent = this.helper.scrollParent(); + + //The element's absolute position on the page minus margins + this.offset = this.currentItem.offset(); + this.offset = { + top: this.offset.top - this.margins.top, + left: this.offset.left - this.margins.left + }; + + // Only after we got the offset, we can change the helper's position to absolute + // TODO: Still need to figure out a way to make relative sorting possible + this.helper.css("position", "absolute"); + this.cssPosition = this.helper.css("position"); + + $.extend(this.offset, { + click: { //Where the click happened, relative to the element + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top + }, + parent: this._getParentOffset(), + relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper + }); + + //Generate the original position + this.originalPosition = this._generatePosition(event); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + + //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied + if(o.cursorAt) + this._adjustOffsetFromHelper(o.cursorAt); + + //Cache the former DOM position + this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; + + //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way + if(this.helper[0] != this.currentItem[0]) { + this.currentItem.hide(); + } + + //Create the placeholder + this._createPlaceholder(); + + //Set a containment if given in the options + if(o.containment) + this._setContainment(); + + if(o.cursor) { // cursor option + if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor"); + $('body').css("cursor", o.cursor); + } + + if(o.opacity) { // opacity option + if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity"); + this.helper.css("opacity", o.opacity); + } + + if(o.zIndex) { // zIndex option + if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex"); + this.helper.css("zIndex", o.zIndex); + } + + //Prepare scrolling + if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') + this.overflowOffset = this.scrollParent.offset(); + + //Call callbacks + this._trigger("start", event, this._uiHash()); + + //Recache the helper size + if(!this._preserveHelperProportions) + this._cacheHelperProportions(); + + + //Post 'activate' events to possible containers + if(!noActivation) { + for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); } + } + + //Prepare possible droppables + if($.ui.ddmanager) + $.ui.ddmanager.current = this; + + if ($.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + + this.dragging = true; + + this.helper.addClass("ui-sortable-helper"); + this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position + return true; + + }, + + _mouseDrag: function(event) { + + //Compute the helpers position + this.position = this._generatePosition(event); + this.positionAbs = this._convertPositionTo("absolute"); + + if (!this.lastPositionAbs) { + this.lastPositionAbs = this.positionAbs; + } + + //Do scrolling + if(this.options.scroll) { + var o = this.options, scrolled = false; + if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { + + if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) + this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; + else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) + this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; + + if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) + this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; + else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) + this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; + + } else { + + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); + else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); + + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); + else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); + + } + + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + } + + //Regenerate the absolute position used for position checks + this.positionAbs = this._convertPositionTo("absolute"); + + //Set the helper position + if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; + if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; + + //Rearrange + for (var i = this.items.length - 1; i >= 0; i--) { + + //Cache variables and intersection, continue if no intersection + var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); + if (!intersection) continue; + + if(itemElement != this.currentItem[0] //cannot intersect with itself + && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before + && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked + && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true) + ) { + + this.direction = intersection == 1 ? "down" : "up"; + + if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { + this._rearrange(event, item); + } else { + break; + } + + this._trigger("change", event, this._uiHash()); + break; + } + } + + //Post events to containers + this._contactContainers(event); + + //Interconnect with droppables + if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); + + //Call callbacks + this._trigger('sort', event, this._uiHash()); + + this.lastPositionAbs = this.positionAbs; + return false; + + }, + + _mouseStop: function(event, noPropagation) { + + if(!event) return; + + //If we are using droppables, inform the manager about the drop + if ($.ui.ddmanager && !this.options.dropBehaviour) + $.ui.ddmanager.drop(this, event); + + if(this.options.revert) { + var self = this; + var cur = self.placeholder.offset(); + + self.reverting = true; + + $(this.helper).animate({ + left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), + top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) + }, parseInt(this.options.revert, 10) || 500, function() { + self._clear(event); + }); + } else { + this._clear(event, noPropagation); + } + + return false; + + }, + + cancel: function() { + + var self = this; + + if(this.dragging) { + + this._mouseUp(); + + if(this.options.helper == "original") + this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + else + this.currentItem.show(); + + //Post deactivating events to containers + for (var i = this.containers.length - 1; i >= 0; i--){ + this.containers[i]._trigger("deactivate", null, self._uiHash(this)); + if(this.containers[i].containerCache.over) { + this.containers[i]._trigger("out", null, self._uiHash(this)); + this.containers[i].containerCache.over = 0; + } + } + + } + + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); + + $.extend(this, { + helper: null, + dragging: false, + reverting: false, + _noFinalSort: null + }); + + if(this.domPosition.prev) { + $(this.domPosition.prev).after(this.currentItem); + } else { + $(this.domPosition.parent).prepend(this.currentItem); + } + + return true; + + }, + + serialize: function(o) { + + var items = this._getItemsAsjQuery(o && o.connected); + var str = []; o = o || {}; + + $(items).each(function() { + var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); + if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); + }); + + return str.join('&'); + + }, + + toArray: function(o) { + + var items = this._getItemsAsjQuery(o && o.connected); + var ret = []; o = o || {}; + + items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); }); + return ret; + + }, + + /* Be careful with the following core functions */ + _intersectsWith: function(item) { + + var x1 = this.positionAbs.left, + x2 = x1 + this.helperProportions.width, + y1 = this.positionAbs.top, + y2 = y1 + this.helperProportions.height; + + var l = item.left, + r = l + item.width, + t = item.top, + b = t + item.height; + + var dyClick = this.offset.click.top, + dxClick = this.offset.click.left; + + var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; + + if( this.options.tolerance == "pointer" + || this.options.forcePointerForContainers + || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height']) + ) { + return isOverElement; + } else { + + return (l < x1 + (this.helperProportions.width / 2) // Right Half + && x2 - (this.helperProportions.width / 2) < r // Left Half + && t < y1 + (this.helperProportions.height / 2) // Bottom Half + && y2 - (this.helperProportions.height / 2) < b ); // Top Half + + } + }, + + _intersectsWithPointer: function(item) { + + var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), + isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), + isOverElement = isOverElementHeight && isOverElementWidth, + verticalDirection = this._getDragVerticalDirection(), + horizontalDirection = this._getDragHorizontalDirection(); + + if (!isOverElement) + return false; + + return this.floating ? + ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 ) + : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) ); + + }, + + _intersectsWithSides: function(item) { + + var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), + isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), + verticalDirection = this._getDragVerticalDirection(), + horizontalDirection = this._getDragHorizontalDirection(); + + if (this.floating && horizontalDirection) { + return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf)); + } else { + return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)); + } + + }, + + _getDragVerticalDirection: function() { + var delta = this.positionAbs.top - this.lastPositionAbs.top; + return delta != 0 && (delta > 0 ? "down" : "up"); + }, + + _getDragHorizontalDirection: function() { + var delta = this.positionAbs.left - this.lastPositionAbs.left; + return delta != 0 && (delta > 0 ? "right" : "left"); + }, + + refresh: function(event) { + this._refreshItems(event); + this.refreshPositions(); + }, + + _connectWith: function() { + var options = this.options; + return options.connectWith.constructor == String + ? [options.connectWith] + : options.connectWith; + }, + + _getItemsAsjQuery: function(connected) { + + var self = this; + var items = []; + var queries = []; + var connectWith = this._connectWith(); + + if(connectWith && connected) { + for (var i = connectWith.length - 1; i >= 0; i--){ + var cur = $(connectWith[i]); + for (var j = cur.length - 1; j >= 0; j--){ + var inst = $.data(cur[j], 'sortable'); + if(inst && inst != this && !inst.options.disabled) { + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper"), inst]); + } + }; + }; + } + + queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper"), this]); + + for (var i = queries.length - 1; i >= 0; i--){ + queries[i][0].each(function() { + items.push(this); + }); + }; + + return $(items); + + }, + + _removeCurrentsFromItems: function() { + + var list = this.currentItem.find(":data(sortable-item)"); + + for (var i=0; i < this.items.length; i++) { + + for (var j=0; j < list.length; j++) { + if(list[j] == this.items[i].item[0]) + this.items.splice(i,1); + }; + + }; + + }, + + _refreshItems: function(event) { + + this.items = []; + this.containers = [this]; + var items = this.items; + var self = this; + var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; + var connectWith = this._connectWith(); + + if(connectWith) { + for (var i = connectWith.length - 1; i >= 0; i--){ + var cur = $(connectWith[i]); + for (var j = cur.length - 1; j >= 0; j--){ + var inst = $.data(cur[j], 'sortable'); + if(inst && inst != this && !inst.options.disabled) { + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); + this.containers.push(inst); + } + }; + }; + } + + for (var i = queries.length - 1; i >= 0; i--) { + var targetData = queries[i][1]; + var _queries = queries[i][0]; + + for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) { + var item = $(_queries[j]); + + item.data('sortable-item', targetData); // Data for target checking (mouse manager) + + items.push({ + item: item, + instance: targetData, + width: 0, height: 0, + left: 0, top: 0 + }); + }; + }; + + }, + + refreshPositions: function(fast) { + + //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change + if(this.offsetParent && this.helper) { + this.offset.parent = this._getParentOffset(); + } + + for (var i = this.items.length - 1; i >= 0; i--){ + var item = this.items[i]; + + //We ignore calculating positions of all connected containers when we're not over them + if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) + continue; + + var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; + + if (!fast) { + item.width = t.outerWidth(); + item.height = t.outerHeight(); + } + + var p = t.offset(); + item.left = p.left; + item.top = p.top; + }; + + if(this.options.custom && this.options.custom.refreshContainers) { + this.options.custom.refreshContainers.call(this); + } else { + for (var i = this.containers.length - 1; i >= 0; i--){ + var p = this.containers[i].element.offset(); + this.containers[i].containerCache.left = p.left; + this.containers[i].containerCache.top = p.top; + this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); + this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); + }; + } + + }, + + _createPlaceholder: function(that) { + + var self = that || this, o = self.options; + + if(!o.placeholder || o.placeholder.constructor == String) { + var className = o.placeholder; + o.placeholder = { + element: function() { + + var el = $(document.createElement(self.currentItem[0].nodeName)) + .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder") + .removeClass("ui-sortable-helper")[0]; + + if(!className) + el.style.visibility = "hidden"; + + return el; + }, + update: function(container, p) { + + // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that + // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified + if(className && !o.forcePlaceholderSize) return; + + //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item + if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); }; + if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); }; + } + }; + } + + //Create the placeholder + self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)); + + //Append it after the actual current item + self.currentItem.after(self.placeholder); + + //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) + o.placeholder.update(self, self.placeholder); + + }, + + _contactContainers: function(event) { + for (var i = this.containers.length - 1; i >= 0; i--){ + + if(this._intersectsWith(this.containers[i].containerCache)) { + if(!this.containers[i].containerCache.over) { + + if(this.currentContainer != this.containers[i]) { + + //When entering a new container, we will find the item with the least distance and append our item near it + var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top']; + for (var j = this.items.length - 1; j >= 0; j--) { + if(!$.ui.contains(this.containers[i].element[0], this.items[j].item[0])) continue; + var cur = this.items[j][this.containers[i].floating ? 'left' : 'top']; + if(Math.abs(cur - base) < dist) { + dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; + } + } + + if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled + continue; + + this.currentContainer = this.containers[i]; + itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[i].element, true); + this._trigger("change", event, this._uiHash()); + this.containers[i]._trigger("change", event, this._uiHash(this)); + + //Update the placeholder + this.options.placeholder.update(this.currentContainer, this.placeholder); + + } + + this.containers[i]._trigger("over", event, this._uiHash(this)); + this.containers[i].containerCache.over = 1; + } + } else { + if(this.containers[i].containerCache.over) { + this.containers[i]._trigger("out", event, this._uiHash(this)); + this.containers[i].containerCache.over = 0; + } + } + + }; + }, + + _createHelper: function(event) { + + var o = this.options; + var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem); + + if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already + $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); + + if(helper[0] == this.currentItem[0]) + this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; + + if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width()); + if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height()); + + return helper; + + }, + + _adjustOffsetFromHelper: function(obj) { + if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left; + if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top; + if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + }, + + _getParentOffset: function() { + + + //Get the offsetParent and cache its position + this.offsetParent = this.helper.offsetParent(); + var po = this.offsetParent.offset(); + + // This is a special case where we need to modify a offset calculated on start, since the following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that + // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag + if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { + po.left += this.scrollParent.scrollLeft(); + po.top += this.scrollParent.scrollTop(); + } + + if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information + || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix + po = { top: 0, left: 0 }; + + return { + top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), + left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) + }; + + }, + + _getRelativeOffset: function() { + + if(this.cssPosition == "relative") { + var p = this.currentItem.position(); + return { + top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), + left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() + }; + } else { + return { top: 0, left: 0 }; + } + + }, + + _cacheMargins: function() { + this.margins = { + left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), + top: (parseInt(this.currentItem.css("marginTop"),10) || 0) + }; + }, + + _cacheHelperProportions: function() { + this.helperProportions = { + width: this.helper.outerWidth(), + height: this.helper.outerHeight() + }; + }, + + _setContainment: function() { + + var o = this.options; + if(o.containment == 'parent') o.containment = this.helper[0].parentNode; + if(o.containment == 'document' || o.containment == 'window') this.containment = [ + 0 - this.offset.relative.left - this.offset.parent.left, + 0 - this.offset.relative.top - this.offset.parent.top, + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top + ]; + + if(!(/^(document|window|parent)$/).test(o.containment)) { + var ce = $(o.containment)[0]; + var co = $(o.containment).offset(); + var over = ($(ce).css("overflow") != 'hidden'); + + this.containment = [ + co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, + co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, + co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, + co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top + ]; + } + + }, + + _convertPositionTo: function(d, pos) { + + if(!pos) pos = this.position; + var mod = d == "absolute" ? 1 : -1; + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + return { + top: ( + pos.top // The absolute mouse position + + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) + - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + ), + left: ( + pos.left // The absolute mouse position + + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) + - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + ) + }; + + }, + + _generatePosition: function(event) { + + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + // This is another very weird special case that only happens for relative elements: + // 1. If the css position is relative + // 2. and the scroll parent is the document or similar to the offset parent + // we have to refresh the relative offset during the scroll so there are no jumps + if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { + this.offset.relative = this._getRelativeOffset(); + } + + var pageX = event.pageX; + var pageY = event.pageY; + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + if(this.originalPosition) { //If we are not dragging yet, we won't check for options + + if(this.containment) { + if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; + if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; + if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; + if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; + } + + if(o.grid) { + var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; + pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; + + var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; + pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; + } + + } + + return { + top: ( + pageY // The absolute mouse position + - this.offset.click.top // Click offset (relative to the element) + - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.top // The offsetParent's offset without borders (offset + border) + + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + ), + left: ( + pageX // The absolute mouse position + - this.offset.click.left // Click offset (relative to the element) + - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.left // The offsetParent's offset without borders (offset + border) + + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + ) + }; + + }, + + _rearrange: function(event, i, a, hardRefresh) { + + a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); + + //Various things done here to improve the performance: + // 1. we create a setTimeout, that calls refreshPositions + // 2. on the instance, we have a counter variable, that get's higher after every append + // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same + // 4. this lets only the last addition to the timeout stack through + this.counter = this.counter ? ++this.counter : 1; + var self = this, counter = this.counter; + + window.setTimeout(function() { + if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove + },0); + + }, + + _clear: function(event, noPropagation) { + + this.reverting = false; + // We delay all events that have to be triggered to after the point where the placeholder has been removed and + // everything else normalized again + var delayedTriggers = [], self = this; + + // We first have to update the dom position of the actual currentItem + // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) + if(!this._noFinalSort && this.currentItem[0].parentNode) this.placeholder.before(this.currentItem); + this._noFinalSort = null; + + if(this.helper[0] == this.currentItem[0]) { + for(var i in this._storedCSS) { + if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; + } + this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + } else { + this.currentItem.show(); + } + + if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); + if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed + if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element + if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); + for (var i = this.containers.length - 1; i >= 0; i--){ + if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) { + delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + } + }; + }; + + //Post events to containers + for (var i = this.containers.length - 1; i >= 0; i--){ + if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + if(this.containers[i].containerCache.over) { + delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + this.containers[i].containerCache.over = 0; + } + } + + //Do what was originally in plugins + if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor + if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset cursor + if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index + + this.dragging = false; + if(this.cancelHelperRemoval) { + if(!noPropagation) { + this._trigger("beforeStop", event, this._uiHash()); + for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events + this._trigger("stop", event, this._uiHash()); + } + return false; + } + + if(!noPropagation) this._trigger("beforeStop", event, this._uiHash()); + + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + + if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; + + if(!noPropagation) { + for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events + this._trigger("stop", event, this._uiHash()); + } + + this.fromOutside = false; + return true; + + }, + + _trigger: function() { + if ($.widget.prototype._trigger.apply(this, arguments) === false) { + this.cancel(); + } + }, + + _uiHash: function(inst) { + var self = inst || this; + return { + helper: self.helper, + placeholder: self.placeholder || $([]), + position: self.position, + absolutePosition: self.positionAbs, //deprecated + offset: self.positionAbs, + item: self.currentItem, + sender: inst ? inst.element : null + }; + } + +})); + +$.extend($.ui.sortable, { + getter: "serialize toArray", + version: "1.7", + eventPrefix: "sort", + defaults: { + appendTo: "parent", + axis: false, + cancel: ":input,option", + connectWith: false, + containment: false, + cursor: 'auto', + cursorAt: false, + delay: 0, + distance: 1, + dropOnEmpty: true, + forcePlaceholderSize: false, + forceHelperSize: false, + grid: false, + handle: false, + helper: "original", + items: '> *', + opacity: false, + placeholder: false, + revert: false, + scroll: true, + scrollSensitivity: 20, + scrollSpeed: 20, + scope: "default", + tolerance: "intersect", + zIndex: 1000 + } +}); + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.tabs.js b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.tabs.js new file mode 100644 index 0000000..15e9c9a --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/jquery/ui/ui.tabs.js @@ -0,0 +1,685 @@ +/* + * jQuery UI Tabs 1.7 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Tabs + * + * Depends: + * ui.core.js + */ +(function($) { + +$.widget("ui.tabs", { + + _init: function() { + if (this.options.deselectable !== undefined) { + this.options.collapsible = this.options.deselectable; + } + this._tabify(true); + }, + + _setData: function(key, value) { + if (key == 'selected') { + if (this.options.collapsible && value == this.options.selected) { + return; + } + this.select(value); + } + else { + this.options[key] = value; + if (key == 'deselectable') { + this.options.collapsible = value; + } + this._tabify(); + } + }, + + _tabId: function(a) { + return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') || + this.options.idPrefix + $.data(a); + }, + + _sanitizeSelector: function(hash) { + return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":" + }, + + _cookie: function() { + var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + $.data(this.list[0])); + return $.cookie.apply(null, [cookie].concat($.makeArray(arguments))); + }, + + _ui: function(tab, panel) { + return { + tab: tab, + panel: panel, + index: this.anchors.index(tab) + }; + }, + + _cleanup: function() { + // restore all former loading tabs labels + this.lis.filter('.ui-state-processing').removeClass('ui-state-processing') + .find('span:data(label.tabs)') + .each(function() { + var el = $(this); + el.html(el.data('label.tabs')).removeData('label.tabs'); + }); + }, + + _tabify: function(init) { + + this.list = this.element.children('ul:first'); + this.lis = $('li:has(a[href])', this.list); + this.anchors = this.lis.map(function() { return $('a', this)[0]; }); + this.panels = $([]); + + var self = this, o = this.options; + + var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash + this.anchors.each(function(i, a) { + var href = $(a).attr('href'); + + // For dynamically created HTML that contains a hash as href IE < 8 expands + // such href to the full page url with hash and then misinterprets tab as ajax. + // Same consideration applies for an added tab with a fragment identifier + // since a[href=#fragment-identifier] does unexpectedly not match. + // Thus normalize href attribute... + var hrefBase = href.split('#')[0], baseEl; + if (hrefBase && (hrefBase === location.toString().split('#')[0] || + (baseEl = $('base')[0]) && hrefBase === baseEl.href)) { + href = a.hash; + a.href = href; + } + + // inline tab + if (fragmentId.test(href)) { + self.panels = self.panels.add(self._sanitizeSelector(href)); + } + + // remote tab + else if (href != '#') { // prevent loading the page itself if href is just "#" + $.data(a, 'href.tabs', href); // required for restore on destroy + + // TODO until #3808 is fixed strip fragment identifier from url + // (IE fails to load from such url) + $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data + + var id = self._tabId(a); + a.href = '#' + id; + var $panel = $('#' + id); + if (!$panel.length) { + $panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom') + .insertAfter(self.panels[i - 1] || self.list); + $panel.data('destroy.tabs', true); + } + self.panels = self.panels.add($panel); + } + + // invalid tab href + else { + o.disabled.push(i); + } + }); + + // initialization from scratch + if (init) { + + // attach necessary classes for styling + this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all'); + this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); + this.lis.addClass('ui-state-default ui-corner-top'); + this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom'); + + // Selected tab + // use "selected" option or try to retrieve: + // 1. from fragment identifier in url + // 2. from cookie + // 3. from selected class attribute on
  • + if (o.selected === undefined) { + if (location.hash) { + this.anchors.each(function(i, a) { + if (a.hash == location.hash) { + o.selected = i; + return false; // break + } + }); + } + if (typeof o.selected != 'number' && o.cookie) { + o.selected = parseInt(self._cookie(), 10); + } + if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) { + o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); + } + o.selected = o.selected || 0; + } + else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release + o.selected = -1; + } + + // sanity check - default to first tab... + o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0; + + // Take disabling tabs via class attribute from HTML + // into account and update option properly. + // A selected tab cannot become disabled. + o.disabled = $.unique(o.disabled.concat( + $.map(this.lis.filter('.ui-state-disabled'), + function(n, i) { return self.lis.index(n); } ) + )).sort(); + + if ($.inArray(o.selected, o.disabled) != -1) { + o.disabled.splice($.inArray(o.selected, o.disabled), 1); + } + + // highlight selected tab + this.panels.addClass('ui-tabs-hide'); + this.lis.removeClass('ui-tabs-selected ui-state-active'); + if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list + this.panels.eq(o.selected).removeClass('ui-tabs-hide'); + this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active'); + + // seems to be expected behavior that the show callback is fired + self.element.queue("tabs", function() { + self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected])); + }); + + this.load(o.selected); + } + + // clean up to avoid memory leaks in certain versions of IE 6 + $(window).bind('unload', function() { + self.lis.add(self.anchors).unbind('.tabs'); + self.lis = self.anchors = self.panels = null; + }); + + } + // update selected after add/remove + else { + o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected')); + } + + // update collapsible + this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible'); + + // set or update cookie after init and add/remove respectively + if (o.cookie) { + this._cookie(o.selected, o.cookie); + } + + // disable tabs + for (var i = 0, li; (li = this.lis[i]); i++) { + $(li)[$.inArray(i, o.disabled) != -1 && + !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled'); + } + + // reset cache if switching from cached to not cached + if (o.cache === false) { + this.anchors.removeData('cache.tabs'); + } + + // remove all handlers before, tabify may run on existing tabs after add or option change + this.lis.add(this.anchors).unbind('.tabs'); + + if (o.event != 'mouseover') { + var addState = function(state, el) { + if (el.is(':not(.ui-state-disabled)')) { + el.addClass('ui-state-' + state); + } + }; + var removeState = function(state, el) { + el.removeClass('ui-state-' + state); + }; + this.lis.bind('mouseover.tabs', function() { + addState('hover', $(this)); + }); + this.lis.bind('mouseout.tabs', function() { + removeState('hover', $(this)); + }); + this.anchors.bind('focus.tabs', function() { + addState('focus', $(this).closest('li')); + }); + this.anchors.bind('blur.tabs', function() { + removeState('focus', $(this).closest('li')); + }); + } + + // set up animations + var hideFx, showFx; + if (o.fx) { + if ($.isArray(o.fx)) { + hideFx = o.fx[0]; + showFx = o.fx[1]; + } + else { + hideFx = showFx = o.fx; + } + } + + // Reset certain styles left over from animation + // and prevent IE's ClearType bug... + function resetStyle($el, fx) { + $el.css({ display: '' }); + if ($.browser.msie && fx.opacity) { + $el[0].style.removeAttribute('filter'); + } + } + + // Show a tab... + var showTab = showFx ? + function(clicked, $show) { + $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active'); + $show.hide().removeClass('ui-tabs-hide') // avoid flicker that way + .animate(showFx, showFx.duration || 'normal', function() { + resetStyle($show, showFx); + self._trigger('show', null, self._ui(clicked, $show[0])); + }); + } : + function(clicked, $show) { + $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active'); + $show.removeClass('ui-tabs-hide'); + self._trigger('show', null, self._ui(clicked, $show[0])); + }; + + // Hide a tab, $show is optional... + var hideTab = hideFx ? + function(clicked, $hide) { + $hide.animate(hideFx, hideFx.duration || 'normal', function() { + self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default'); + $hide.addClass('ui-tabs-hide'); + resetStyle($hide, hideFx); + self.element.dequeue("tabs"); + }); + } : + function(clicked, $hide, $show) { + self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default'); + $hide.addClass('ui-tabs-hide'); + self.element.dequeue("tabs"); + }; + + // attach tab event handler, unbind to avoid duplicates from former tabifying... + this.anchors.bind(o.event + '.tabs', function() { + var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'), + $show = $(self._sanitizeSelector(this.hash)); + + // If tab is already selected and not collapsible or tab disabled or + // or is already loading or click callback returns false stop here. + // Check if click handler returns false last so that it is not executed + // for a disabled or loading tab! + if (($li.hasClass('ui-tabs-selected') && !o.collapsible) || + $li.hasClass('ui-state-disabled') || + $li.hasClass('ui-state-processing') || + self._trigger('select', null, self._ui(this, $show[0])) === false) { + this.blur(); + return false; + } + + o.selected = self.anchors.index(this); + + self.abort(); + + // if tab may be closed + if (o.collapsible) { + if ($li.hasClass('ui-tabs-selected')) { + o.selected = -1; + + if (o.cookie) { + self._cookie(o.selected, o.cookie); + } + + self.element.queue("tabs", function() { + hideTab(el, $hide); + }).dequeue("tabs"); + + this.blur(); + return false; + } + else if (!$hide.length) { + if (o.cookie) { + self._cookie(o.selected, o.cookie); + } + + self.element.queue("tabs", function() { + showTab(el, $show); + }); + + self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 + + this.blur(); + return false; + } + } + + if (o.cookie) { + self._cookie(o.selected, o.cookie); + } + + // show new tab + if ($show.length) { + if ($hide.length) { + self.element.queue("tabs", function() { + hideTab(el, $hide); + }); + } + self.element.queue("tabs", function() { + showTab(el, $show); + }); + + self.load(self.anchors.index(this)); + } + else { + throw 'jQuery UI Tabs: Mismatching fragment identifier.'; + } + + // Prevent IE from keeping other link focussed when using the back button + // and remove dotted border from clicked link. This is controlled via CSS + // in modern browsers; blur() removes focus from address bar in Firefox + // which can become a usability and annoying problem with tabs('rotate'). + if ($.browser.msie) { + this.blur(); + } + + }); + + // disable click in any case + this.anchors.bind('click.tabs', function(){return false;}); + + }, + + destroy: function() { + var o = this.options; + + this.abort(); + + this.element.unbind('.tabs') + .removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible') + .removeData('tabs'); + + this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); + + this.anchors.each(function() { + var href = $.data(this, 'href.tabs'); + if (href) { + this.href = href; + } + var $this = $(this).unbind('.tabs'); + $.each(['href', 'load', 'cache'], function(i, prefix) { + $this.removeData(prefix + '.tabs'); + }); + }); + + this.lis.unbind('.tabs').add(this.panels).each(function() { + if ($.data(this, 'destroy.tabs')) { + $(this).remove(); + } + else { + $(this).removeClass([ + 'ui-state-default', + 'ui-corner-top', + 'ui-tabs-selected', + 'ui-state-active', + 'ui-state-hover', + 'ui-state-focus', + 'ui-state-disabled', + 'ui-tabs-panel', + 'ui-widget-content', + 'ui-corner-bottom', + 'ui-tabs-hide' + ].join(' ')); + } + }); + + if (o.cookie) { + this._cookie(null, o.cookie); + } + }, + + add: function(url, label, index) { + if (index === undefined) { + index = this.anchors.length; // append by default + } + + var self = this, o = this.options, + $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)), + id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]); + + $li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true); + + // try to find an existing element before creating a new one + var $panel = $('#' + id); + if (!$panel.length) { + $panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true); + } + $panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide'); + + if (index >= this.lis.length) { + $li.appendTo(this.list); + $panel.appendTo(this.list[0].parentNode); + } + else { + $li.insertBefore(this.lis[index]); + $panel.insertBefore(this.panels[index]); + } + + o.disabled = $.map(o.disabled, + function(n, i) { return n >= index ? ++n : n; }); + + this._tabify(); + + if (this.anchors.length == 1) { // after tabify + $li.addClass('ui-tabs-selected ui-state-active'); + $panel.removeClass('ui-tabs-hide'); + this.element.queue("tabs", function() { + self._trigger('show', null, self._ui(self.anchors[0], self.panels[0])); + }); + + this.load(0); + } + + // callback + this._trigger('add', null, this._ui(this.anchors[index], this.panels[index])); + }, + + remove: function(index) { + var o = this.options, $li = this.lis.eq(index).remove(), + $panel = this.panels.eq(index).remove(); + + // If selected tab was removed focus tab to the right or + // in case the last tab was removed the tab to the left. + if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) { + this.select(index + (index + 1 < this.anchors.length ? 1 : -1)); + } + + o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }), + function(n, i) { return n >= index ? --n : n; }); + + this._tabify(); + + // callback + this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0])); + }, + + enable: function(index) { + var o = this.options; + if ($.inArray(index, o.disabled) == -1) { + return; + } + + this.lis.eq(index).removeClass('ui-state-disabled'); + o.disabled = $.grep(o.disabled, function(n, i) { return n != index; }); + + // callback + this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index])); + }, + + disable: function(index) { + var self = this, o = this.options; + if (index != o.selected) { // cannot disable already selected tab + this.lis.eq(index).addClass('ui-state-disabled'); + + o.disabled.push(index); + o.disabled.sort(); + + // callback + this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index])); + } + }, + + select: function(index) { + if (typeof index == 'string') { + index = this.anchors.index(this.anchors.filter('[href$=' + index + ']')); + } + else if (index === null) { // usage of null is deprecated, TODO remove in next release + index = -1; + } + if (index == -1 && this.options.collapsible) { + index = this.options.selected; + } + + this.anchors.eq(index).trigger(this.options.event + '.tabs'); + }, + + load: function(index) { + var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs'); + + this.abort(); + + // not remote or from cache + if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) { + this.element.dequeue("tabs"); + return; + } + + // load remote from here on + this.lis.eq(index).addClass('ui-state-processing'); + + if (o.spinner) { + var span = $('span', a); + span.data('label.tabs', span.html()).html(o.spinner); + } + + this.xhr = $.ajax($.extend({}, o.ajaxOptions, { + url: url, + success: function(r, s) { + $(self._sanitizeSelector(a.hash)).html(r); + + // take care of tab labels + self._cleanup(); + + if (o.cache) { + $.data(a, 'cache.tabs', true); // if loaded once do not load them again + } + + // callbacks + self._trigger('load', null, self._ui(self.anchors[index], self.panels[index])); + try { + o.ajaxOptions.success(r, s); + } + catch (e) {} + + // last, so that load event is fired before show... + self.element.dequeue("tabs"); + } + })); + }, + + abort: function() { + // stop possibly running animations + this.element.queue([]); + this.panels.stop(false, true); + + // terminate pending requests from other tabs + if (this.xhr) { + this.xhr.abort(); + delete this.xhr; + } + + // take care of tab labels + this._cleanup(); + + }, + + url: function(index, url) { + this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url); + }, + + length: function() { + return this.anchors.length; + } + +}); + +$.extend($.ui.tabs, { + version: '1.7', + getter: 'length', + defaults: { + ajaxOptions: null, + cache: false, + cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } + collapsible: false, + disabled: [], + event: 'click', + fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } + idPrefix: 'ui-tabs-', + panelTemplate: '
    ', + spinner: 'Loading…', + tabTemplate: '
  • #{label}
  • ' + } +}); + +/* + * Tabs Extensions + */ + +/* + * Rotate + */ +$.extend($.ui.tabs.prototype, { + rotation: null, + rotate: function(ms, continuing) { + + var self = this, o = this.options; + + var rotate = self._rotate || (self._rotate = function(e) { + clearTimeout(self.rotation); + self.rotation = setTimeout(function() { + var t = o.selected; + self.select( ++t < self.anchors.length ? t : 0 ); + }, ms); + + if (e) { + e.stopPropagation(); + } + }); + + var stop = self._unrotate || (self._unrotate = !continuing ? + function(e) { + if (e.clientX) { // in case of a true click + self.rotate(null); + } + } : + function(e) { + t = o.selected; + rotate(); + }); + + // start rotation + if (ms) { + this.element.bind('tabsshow', rotate); + this.anchors.bind(o.event + '.tabs', stop); + rotate(); + } + // stop rotation + else { + clearTimeout(self.rotation); + this.element.unbind('tabsshow', rotate); + this.anchors.unbind(o.event + '.tabs', stop); + delete this._rotate; + delete this._unrotate; + } + } +}); + +})(jQuery); diff --git a/cl_stream_mybatis/src/main/resources/static/scripts/json.js b/cl_stream_mybatis/src/main/resources/static/scripts/json.js new file mode 100644 index 0000000..9ae240d --- /dev/null +++ b/cl_stream_mybatis/src/main/resources/static/scripts/json.js @@ -0,0 +1 @@ +JSON=new function(){this.decode=function(){var filter,result,self,tmp;if($$("toString")){switch(arguments.length){case 2:self=arguments[0];filter=arguments[1];break;case 1:if($[typeof arguments[0]](arguments[0])===Function){self=this;filter=arguments[0];}else self=arguments[0];break;default:self=this;break;};if(rc.test(self)){try{result=e("(".concat(self,")"));if(filter&&result!==null&&(tmp=$[typeof result](result))&&(tmp===Array||tmp===Object)){for(self in result)result[self]=v(self,result)?filter(self,result[self]):result[self];}}catch(z){}}else{throw new JSONError("bad data");}};return result;};this.encode=function(){var self=arguments.length?arguments[0]:this,result,tmp;if(self===null)result="null";else if(self!==undefined&&(tmp=$[typeof self](self))){switch(tmp){case Array:result=[];for(var i=0,j=0,k=self.length;j +<%-- + Created by IntelliJ IDEA. + User: Administrator + Date: 2018/8/3 + Time: 15:53 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + 自动灌数系统 + + + + + + + + + + + + + + +<%--
    --%> +<%--
    选择Excel文件(可同时批量上传多个文件):--%> +<%--
    --%> +<%--<%––%>--%> +<%--<%––%>--%> +<%--
    <
    --%> +<%----%> +<%--${keyword}导入成功!!!!!
    --%> +<%--
    --%> +<%--
    --%> +<%--
    --%> +<%----%> +<%--${keyworderr}导入失败!!!!!
    --%> +<%--
    --%> +<%--
    --%> +
    +

    灌数系统

    +
    +=================================================================== + +
    +
    + kafka服务地址: + + topic名称:
    + topic消费组:
    + 业务类型: + + es服务: + + 项目名:
    + + es索引名称:
    + 调情感 + 不调情感 + + +
    + +
    + +
    +
    +
    + -------------------------------------------------------------------------- +
    + +
    +
    + + diff --git a/cl_stream_mybatis/src/main/webapp/WEB-INF/index.jsp b/cl_stream_mybatis/src/main/webapp/WEB-INF/index.jsp new file mode 100644 index 0000000..d4431a7 --- /dev/null +++ b/cl_stream_mybatis/src/main/webapp/WEB-INF/index.jsp @@ -0,0 +1,54 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +<%-- + Created by IntelliJ IDEA. + User: Administrator + Date: 2018/5/16 + Time: 16:58 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + + +
    + +
    + + + diff --git a/cl_stream_mybatis/src/main/webapp/WEB-INF/uploaderr.jsp b/cl_stream_mybatis/src/main/webapp/WEB-INF/uploaderr.jsp new file mode 100644 index 0000000..054e10e --- /dev/null +++ b/cl_stream_mybatis/src/main/webapp/WEB-INF/uploaderr.jsp @@ -0,0 +1,16 @@ +<%-- + Created by IntelliJ IDEA. + User: Administrator + Date: 2018/8/6 + Time: 13:58 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 上传失败 + + + 上传excel文件失败!!! + + diff --git a/cl_stream_mybatis/src/main/webapp/upload/财报模板 - 副本.xlsx b/cl_stream_mybatis/src/main/webapp/upload/财报模板 - 副本.xlsx new file mode 100644 index 0000000..1b796a2 Binary files /dev/null and b/cl_stream_mybatis/src/main/webapp/upload/财报模板 - 副本.xlsx differ diff --git a/cl_stream_mybatis/src/test/java/Test2.java b/cl_stream_mybatis/src/test/java/Test2.java new file mode 100644 index 0000000..3c5a098 --- /dev/null +++ b/cl_stream_mybatis/src/test/java/Test2.java @@ -0,0 +1,32 @@ +import com.bfd.mf.entity.DataSaveManager; +import com.bfd.mf.entity.FieldNormaliz; +import com.bfd.mf.service.FieldNormalizService; +import com.bfd.mf.service.impl.FieldNormalizServiceImpl; +import com.bfd.mf.tools.ConnectionRmi; +import org.junit.Test; + +import java.rmi.RemoteException; +import java.util.HashMap; +import java.util.Map; + +public class Test2 { + private DataSaveManager datasaveManager = ConnectionRmi.getDataSaveManager(); + + @Test + public void test2(){ + FieldNormalizService fieldNormalizService = new FieldNormalizServiceImpl(); + FieldNormaliz fieldNormaliz = fieldNormalizService.getFieldNormalizById(1); + Map map = new HashMap(); + map.put("kafkaName", fieldNormaliz.getKafkaName()) ; + map.put("taskid", fieldNormaliz.getId()) ; + map.put("busniessType", fieldNormaliz.getBussinessType()) ; // 2=后台 1=前台 + map.put("esServerName",fieldNormaliz.getEsSerName()); // 1= 后台 2=前台 + map.put("indexName",fieldNormaliz.getEsSuffixNames()); + try { + datasaveManager.addTaskName(fieldNormaliz); + } catch (RemoteException e) { + e.printStackTrace(); + } + + } +} diff --git a/cl_stream_service/cl_stream_service.iml b/cl_stream_service/cl_stream_service.iml new file mode 100644 index 0000000..044fba6 --- /dev/null +++ b/cl_stream_service/cl_stream_service.iml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cl_stream_service/pom.xml b/cl_stream_service/pom.xml new file mode 100644 index 0000000..c63a7e4 --- /dev/null +++ b/cl_stream_service/pom.xml @@ -0,0 +1,314 @@ + + + + cl_stream + com.bfd.mf + 2.0-SNAPSHOT + + 4.0.0 + + cl_stream_service + + + com.bfd.mf.runstart.RunStartService + UTF-8 + true + 1.8 + + + + + + + utils-0.0.1-SNAPSHOT + utils-0.0.1-SNAPSHOT + 1.0.0 + system + ${project.basedir}/../../jarlib/utils-0.0.1-SNAPSHOT.jar + + + BfdRedisTools-2.0 + BfdRedisTools-2.0 + 1.0.0 + system + ${project.basedir}/../../jarlib/BfdRedisTools-2.0.jar + + + slf4j-api + org.slf4j + 1.7.22 + + + org.apache.kafka + kafka-clients + 0.10.2.0 + + + slf4j-api + org.slf4j + + + + + com.alibaba + fastjson + 1.1.22 + + + bfd_harpc_service + bfd_harpc_service + 0.0.1 + system + ${project.basedir}/../../jarlib/bfd_harpc_service-0.0.1.jar + + + + com.baifendian + harpc + 1.2 + + + netty + io.netty + + + curator-recipes + org.apache.curator + + + curator-framework + org.apache.curator + + + slf4j-api + org.slf4j + + + + log4j + log4j + + + javax.inject + javax.inject + + + fastjson + com.alibaba + + + guava + com.google.guava + + + httpclient + org.apache.httpcomponents + + + + + + + org.apache.httpcomponents + httpclient + 4.5.1 + + + commons-logging + commons-logging + + + + + com.bfd.nlp + nlp_common_util + 1.1 + system + ${project.basedir}/../../jarlib/nlp_common_util-1.1.jar + + + net.sf.json-lib + json-lib + 2.4 + jdk15 + + + kafka-utils + kafka + 0.10 + + + log4j + log4j + + + zookeeper + org.apache.zookeeper + + + slf4j-log4j12 + org.slf4j + + + + + mysql + mysql-connector-java + 5.1.29 + + + + + org.apache.commons + commons-lang3 + 3.1 + + + commons-logging + commons-logging + 1.1.1 + + + commons-logging + commons-logging-api + 1.0.4 + + + commons-lang + commons-lang + 2.4 + + + + + org.json + json + 20170516 + + + log4j + log4j + 1.2.17 + + + + bfd + hanlp-portable + 1.6.8 + system + ${project.basedir}/../../jarlib/hanlp-portable-1.6.8.jar + + + classifier4j + classifier4j + 0.6 + + + + + + + + + + com.bfd + elastiUtils + 0.0.1-SNAPSHOT + + + commons-codec + commons-codec + + + commons-logging + commons-logging + + + + + net.sourceforge.javacsv + javacsv + 2.0 + + + + org.apache.poi + poi + 3.15 + + + org.apache.poi + poi-ooxml + 3.15 + + + + redis.clients + jedis + 2.6.0 + + + com.wandoulabs.jodis + jodis + 0.1.2 + + + slf4j-api + org.slf4j + + + + + org.slf4j + slf4j-api + RELEASE + + + + + + + + maven-compiler-plugin + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-shade-plugin + 1.4 + + + package + + shade + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + com.bfd.mf.runstart.RunStartService + + + + + + + + + + \ No newline at end of file diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/AllKeys.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/AllKeys.java new file mode 100644 index 0000000..8386486 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/AllKeys.java @@ -0,0 +1,149 @@ +package com.bfd.mf.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class AllKeys { + private static Map map = new HashMap(); + + public static Map getMap() { + return map; + } + + public static void setMap(Map map) { + AllKeys.map = map; + } + + static { + map.put("age",""); + map.put("area",""); + map.put("attitudesCount",""); + map.put("attr",""); + map.put("author",""); + map.put("authorId",""); + map.put("authorLevel",""); + map.put("authornickname",""); + map.put("availability",0); + map.put("avatar",""); + map.put("brand",""); + map.put("brandId",""); + map.put("cate",""); + map.put("channel",""); + map.put("city",""); + map.put("collectCount",0); + map.put("commentId",""); + map.put("commentScore",0); + map.put("commentsCount",0); + map.put("commentUrl",""); + map.put("content",""); + map.put("contentLength",0); + map.put("contentSimHash",""); + map.put("contentTag",""); + map.put("country",""); + map.put("crawlDataFlag",""); + map.put("crawlDate",new Date ()); + map.put("crawlDay",0); + map.put("crawlTime",0); + map.put("crawlTimeStr",""); + map.put("createDate",new Date ()); + map.put("createDay",0); + map.put("createTime",0); + map.put("createTimeStr",""); + map.put("dataCount",0); + map.put("dataId",""); + map.put("docId",""); + map.put("docType",""); + map.put("downCnt",0); + map.put("egc",0); + map.put("enSource",""); + map.put("expression",new ArrayList<>()); + map.put("extension",""); + map.put("fansCount",""); + map.put("favorCnt",0); + map.put("filePath",new ArrayList<>()); + map.put("imagePath",new ArrayList<>()); + map.put("videoPath",new ArrayList<>()); + map.put("finalPhrase",""); + map.put("firstListBrand",""); + map.put("fiveListBrand",""); + map.put("forumScore",""); + map.put("forwardAttitudesCount",0); + map.put("forwardAuthor",""); + map.put("forwardAvatar",""); + map.put("forwardCommentsCount",0); + map.put("forwardContent",""); + map.put("forwardImgs",new ArrayList<>()); + map.put("forwardPostSource",""); + map.put("forwardPubTime",0); + map.put("forwardQuoteCount",0); + map.put("forwardUrl",""); + map.put("forwardUserId",""); + map.put("forwardUserType",0); + map.put("forwardUserUrl",""); + map.put("fourListBrand",""); + map.put("friendsCount",""); + map.put("getSource",""); + map.put("hashTag",new ArrayList<>()); + map.put("hlKeywords",new ArrayList<>()); + map.put("impression",""); + map.put("isDownload","false"); + map.put("isVip",0); + map.put("language",""); + map.put("lastModifiedTime",0); + map.put("listBrand",""); + map.put("location",""); + map.put("nomorprice",0); + map.put("opinions",new ArrayList<>()); + map.put("originalPhrase",""); + map.put("otherSourceJson",""); + map.put("pageCommentCount",0); + map.put("pageTranspondCount",0); + map.put("pageType",""); + map.put("pgc",0); + map.put("pictureList",new ArrayList<>()); + map.put("places",new ArrayList<>()); + map.put("postCount",""); + map.put("postId",""); + map.put("postSource",""); + map.put("price",0); + map.put("primary",0); + map.put("productParameter",""); + map.put("projectName",""); + map.put("promotionInfo",""); + map.put("province",""); + map.put("pubDate",new Date()); + map.put("pubDay",0); + map.put("pubTime",0); + map.put("pubTimeStr",""); + map.put("quoteCount",0); + map.put("readCount",0); + map.put("resolution",""); + map.put("secondListBrand",""); + map.put("sex",""); + map.put("sign",""); + map.put("siteId",""); + map.put("skuProperties",""); + map.put("smallImgs",new ArrayList<>()); + map.put("source",""); + map.put("sysAbstract",""); + map.put("sysKeywords",""); + map.put("sysSentiment",0); + map.put("threeListBrand",""); + map.put("thumbnails",""); + map.put("title",""); + map.put("titleLength",0); + map.put("titleSimHash",""); + map.put("translateContent",""); + map.put("translateTitle",""); + map.put("ugc",0); + map.put("url",""); + map.put("urlHash",""); + map.put("userType",""); + map.put("userUrl",""); + map.put("videoTime",""); + map.put("videoUrl",""); + map.put("viewCnt",0); + } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/AreaCategoryEntity.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/AreaCategoryEntity.java new file mode 100644 index 0000000..d61be60 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/AreaCategoryEntity.java @@ -0,0 +1,71 @@ +package com.bfd.mf.entity; + +import java.io.Serializable; +import java.util.Objects; + +public class AreaCategoryEntity implements Serializable{ + + private String area; + private String city; + private String country; + private String province; + + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + AreaCategoryEntity that = (AreaCategoryEntity) o; + return Objects.equals(area, that.area) && + Objects.equals(city, that.city) && + Objects.equals(country, that.country) && + Objects.equals(province, that.province); + } + + @Override + public int hashCode() { + return Objects.hash(area, city, country, province); + } + + @Override + public String toString() { + return "AreaCategoryEntity{" + + "area='" + area + '\'' + + ", city='" + city + '\'' + + ", country='" + country + '\'' + + ", province='" + province + '\'' + + '}'; + } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/FieldNormaliz.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/FieldNormaliz.java new file mode 100644 index 0000000..742bb51 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/FieldNormaliz.java @@ -0,0 +1,227 @@ +package com.bfd.mf.entity; + +import java.io.Serializable; +import java.util.Map; +import java.util.Set; + +public class FieldNormaliz implements Serializable{ + + private static final long serialVersionUID = 1L; + + private int id ; + + private String kafkaName ; + + private int kafkaSerName ; + + private int esSerName ; + + private String esSuffixNames ; + + private String docType ; + + private int isSemtimentApi ; + + private boolean ishlKeyword ; + + private int bussinessType ; + + private Map fieldNormalizeContentMap ; + + private Map fieldNormalizeCommentMap ; + + private Map>> fieldDataMap ; + + private Map fieldInfo ; + + private String groupId ; + + private String createTime ; + + private String finshTime ; + + private int status ; + + private String projectName ; + + private Map>> userfieldDataMap ; + + private String kafkaSuffixName ; + + public String getKafkaSuffixName() { + return kafkaSuffixName; + } + + public void setKafkaSuffixName(String kafkaSuffixName) { + this.kafkaSuffixName = kafkaSuffixName; + } + + public String getKafkaName() { + return kafkaName; + } + + public void setKafkaName(String kafkaName) { + this.kafkaName = kafkaName; + } + + public int getKafkaSerName() { + return kafkaSerName; + } + + public void setKafkaSerName(int kafkaSerName) { + this.kafkaSerName = kafkaSerName; + } + + public int getEsSerName() { + return esSerName; + } + + public void setEsSerName(int esSerName) { + this.esSerName = esSerName; + } + + public String getDocType() { + return docType; + } + + public void setDocType(String docType) { + this.docType = docType; + } + + public int getIsSemtimentApi() { + return isSemtimentApi; + } + + public void setIsSemtimentApi(int isSemtimentApi) { + this.isSemtimentApi = isSemtimentApi; + } + + public int getBussinessType() { + return bussinessType; + } + + public void setBussinessType(int bussinessType) { + this.bussinessType = bussinessType; + } + + public Map getFieldNormalizeContentMap() { + return fieldNormalizeContentMap; + } + + public void setFieldNormalizeContentMap(Map fieldNormalizeContentMap) { + this.fieldNormalizeContentMap = fieldNormalizeContentMap; + } + + public Map getFieldNormalizeCommentMap() { + return fieldNormalizeCommentMap; + } + + public void setFieldNormalizeCommentMap(Map fieldNormalizeCommentMap) { + this.fieldNormalizeCommentMap = fieldNormalizeCommentMap; + } + + public Map>> getFieldDataMap() { + return fieldDataMap; + } + + public Map> getFieldDataMapByType(String type){ + return fieldDataMap.get(type); + } + + public void addFieldDataMap(String type, Map fixFieldData, Integer bussinessType){ + Set keys = fixFieldData.keySet() ; + Map> fieldMaps = fieldDataMap.get(bussinessType) ; + Map fieldMap = fieldMaps.get(type) ; + for(String key : keys){ + fieldMap.put(key, key) ; + } + fieldMaps.put(type, fieldMap); + fieldDataMap.put(bussinessType, fieldMaps) ; + } + + public void setFieldDataMap(Map>> fieldDataMap) { + this.fieldDataMap = fieldDataMap; + } + + public Map getFieldInfo() { + return fieldInfo; + } + + public void setFieldInfo(Map fieldInfo) { + this.fieldInfo = fieldInfo; + } + + public boolean isIshlKeyword() { + return ishlKeyword; + } + + public void setIshlKeyword(boolean ishlKeyword) { + this.ishlKeyword = ishlKeyword; + } + + public String getEsSuffixNames() { + return esSuffixNames; + } + + public void setEsSuffixNames(String esSuffixNames) { + this.esSuffixNames = esSuffixNames; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getFinshTime() { + return finshTime; + } + + public void setFinshTime(String finshTime) { + this.finshTime = finshTime; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public Map>> getUserfieldDataMap() { + return userfieldDataMap; + } + + public void setUserfieldDataMap(Map>> userfieldDataMap) { + this.userfieldDataMap = userfieldDataMap; + } + + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/KafkaInfo.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/KafkaInfo.java new file mode 100644 index 0000000..2131b3e --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/KafkaInfo.java @@ -0,0 +1,65 @@ +//package com.bfd.mf.entity; +// +//public class KafkaInfo { +// +// private String kafka_server ; +// +// private String kafka_topic ; +// +// private Integer kafka_read_num ; +// +// private String es_server ; +// +// private String es_index_name ; +// +// private String es_index_type ; +// +// public String getKafka_server() { +// return kafka_server; +// } +// +// public void setKafka_server(String kafka_server) { +// this.kafka_server = kafka_server; +// } +// +// public String getKafka_topic() { +// return kafka_topic; +// } +// +// public void setKafka_topic(String kafka_topic) { +// this.kafka_topic = kafka_topic; +// } +// +// public Integer getKafka_read_num() { +// return kafka_read_num; +// } +// +// public void setKafka_read_num(Integer kafka_read_num) { +// this.kafka_read_num = kafka_read_num; +// } +// +// public String getEs_server() { +// return es_server; +// } +// +// public void setEs_server(String es_server) { +// this.es_server = es_server; +// } +// +// public String getEs_index_name() { +// return es_index_name; +// } +// +// public void setEs_index_name(String es_index_name) { +// this.es_index_name = es_index_name; +// } +// +// public String getEs_index_type() { +// return es_index_type; +// } +// +// public void setEs_index_type(String es_index_type) { +// this.es_index_type = es_index_type; +// } +// +//} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/MfFieldInfo.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/MfFieldInfo.java new file mode 100644 index 0000000..52eae5a --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/MfFieldInfo.java @@ -0,0 +1,38 @@ +package com.bfd.mf.entity; + +import java.util.List; + +public class MfFieldInfo { + + private List kafkaJsonString ; + + private List kafkaJsonArray ; + + public MfFieldInfo(List kafkaJsonString, List kafkaJsonArray) { + super(); + this.kafkaJsonString = kafkaJsonString; + this.kafkaJsonArray = kafkaJsonArray; + } + + public List getKafkaJsonString() { + return kafkaJsonString; + } + + public void setKafkaJsonString(List kafkaJsonString) { + this.kafkaJsonString = kafkaJsonString; + } + + public List getKafkaJsonArray() { + return kafkaJsonArray; + } + + public void setKafkaJsonArray(List kafkaJsonArray) { + this.kafkaJsonArray = kafkaJsonArray; + } + + @Override + public String toString() { + return "FieldInfo [kafkaJsonString=" + kafkaJsonString + ", kafkaJsonArray=" + kafkaJsonArray + "]"; + } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/MfFixFieldInfo.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/MfFixFieldInfo.java new file mode 100644 index 0000000..b66b4d2 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/MfFixFieldInfo.java @@ -0,0 +1,31 @@ +//package com.bfd.mf.entity; +// +//public class MfFixFieldInfo { +// +// private String fix_field_name ; +// +// private String fix_field_value ; +// +// public MfFixFieldInfo(String fix_field_name, String fix_field_value) { +// super(); +// this.fix_field_name = fix_field_name; +// this.fix_field_value = fix_field_value; +// } +// +// public String getFix_field_name() { +// return fix_field_name; +// } +// +// public void setFix_field_name(String fix_field_name) { +// this.fix_field_name = fix_field_name; +// } +// +// public String getFix_field_value() { +// return fix_field_value; +// } +// +// public void setFix_field_value(String fix_field_value) { +// this.fix_field_value = fix_field_value; +// } +// +//} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/TypeEntity.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/TypeEntity.java new file mode 100644 index 0000000..c4e3812 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/TypeEntity.java @@ -0,0 +1,30 @@ +package com.bfd.mf.entity; + +import javax.swing.plaf.PanelUI; + +public class TypeEntity { + public static final String TYPE = "type"; + public static final String PAGETYPE = "pagetype"; + // 海外站点页面 + public static final String STORYDETAILPAGE = "storyDetailPage"; + public static final String SOCIALCOMMENT = "socialComment"; + // 微博页面 + public static final String KEYWORD = "keyword"; + public static final String WEIBO = "weibo"; + public static final String COMMENT = "comment"; + public static final String REPOST = "repost"; + // 论坛页面 + public static final String BBSPOST = "bbspost"; + // 新闻页面 + public static final String NEWSCONTENT = "newscontent"; + public static final String NEWSCOMMENT = "newscomment"; + // 电商页面 + public static final String ECCONTENT = "eccontent"; + public static final String ECCOMMENT = "eccomment"; //eccomment + // 用户页面 + public static final String HOME = "home"; + public static final String BBSUSERINFO = "bbsuserinfo"; + public static final String NEWSUSER = "newsuser"; + public static final String USERINFOPAGE = "userInfoPage"; + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfChannelInfo.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfChannelInfo.java new file mode 100644 index 0000000..eac29bd --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfChannelInfo.java @@ -0,0 +1,40 @@ +package com.bfd.mf.entity.mysql; + + +import com.bfd.crawler.utils.JsonUtils; +import com.bfd.mf.service.tools.DBUtil; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MfChannelInfo { + +public static Map channelInfoMap = new HashMap(); + + public static void loadChannelInfo(){ + //List> channelInfoList = DBUtil.getInstance("db_stat").query("select * from mf_channel_info"); + List> channelInfoList = DBUtil.getInstance("db_stat").query("select cid,site_type from cl_site"); + if(channelInfoList.size() > 0){ + for(Map channelInfo : channelInfoList){ + String channel = channelInfo.get("site_type").toString(); + if(channel.equals("0")){ + channel = "社交媒体"; + } + if(channel.equals("1")){ + channel = "网络视频"; + } + if(channel.equals("2")){ + channel = "网络资讯"; + } + if(channel.equals("3")){ + channel = "网络资讯"; + } + if(channel.equals("4")){ + channel = "电商网站"; + } + channelInfoMap.put(channelInfo.get("cid").toString(),channel); + } + } + System.out.println(JsonUtils.toJSONString(channelInfoMap)); + } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfDoctypeInfo.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfDoctypeInfo.java new file mode 100644 index 0000000..d244d55 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfDoctypeInfo.java @@ -0,0 +1,43 @@ +package com.bfd.mf.entity.mysql; + + +import com.bfd.mf.service.tools.DBUtil; +import com.bfd.mf.service.tools.JsonUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MfDoctypeInfo { + + public static Map docTypeInfos = new HashMap(); + public static void loadDocTypeInfo(){ + //List> souceInfoList = DBUtil.getInstance("db_stat").query("select * from mf_doctype_info"); + List> souceInfoList = DBUtil.getInstance("db_stat").query("select cid,site_type from cl_site"); + if(souceInfoList.size() > 0){ + for(Map souceInfo : souceInfoList){ + //System.out.println("[ DoctypeInfo ]cid : " +souceInfo.get("cid") + " doc_type : "+ souceInfo.get("doc_type") ); + String docType = souceInfo.get("site_type").toString(); + if(docType.equals("0")){ + docType = "social"; + } + if(docType.equals("1")){ + docType = "video"; + } + if(docType.equals("2")){ + docType = "news"; + } + if(docType.equals("3")){ + docType = "news"; + } + if(docType.equals("4")){ + docType = "item"; + } + docTypeInfos.put(souceInfo.get("cid").toString(), docType); + } + } + System.out.println(JsonUtils.toJSONString(docTypeInfos)); + } + + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfFieldInfo.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfFieldInfo.java new file mode 100644 index 0000000..2c9323a --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfFieldInfo.java @@ -0,0 +1,98 @@ +package com.bfd.mf.entity.mysql; + +import com.bfd.mf.service.tools.DBUtil; +import com.bfd.mf.service.tools.JsonUtils; +import org.apache.commons.lang.StringUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MfFieldInfo { + + public static Map>> fieldNormalizeInfoMap = new HashMap>>(); + + + public static void loadBackstageFieldInfo(){ + List> fieldList = DBUtil.getInstance("db_stat").query("select * from mf_field_info"); + System.out.println(JsonUtils.toJSONString(fieldList)+"ssss"); + Map> allfields = new HashMap>(); + Map weibocontentdata = new HashMap(); + Map ecContentdata = new HashMap(); + Map newsContentdata = new HashMap(); + Map bbsContentdata = new HashMap(); + Map weiboCommentdata = new HashMap(); + Map ecCommentdata = new HashMap(); + Map newsCommentdata = new HashMap(); + Map bbsCommentdata = new HashMap(); + Map abroadcontentdata = new HashMap(); + Map abroadcommentdata = new HashMap(); + Map userInfodata = new HashMap<>(); + if( fieldList.size() > 0 ){ + for(Map fielMap : fieldList){ + System.out.print(fielMap.get("abroadcommentfieldname")+"userInfofieldName"); + if(fielMap.get("weibocontentfieldname")!= null && StringUtils.isNotBlank(fielMap.get("weibocontentfieldname").toString())){ + weibocontentdata = excField(fielMap.get("weibocontentfieldname").toString(), fielMap.get("esfieldname").toString(), weibocontentdata); + } + if(fielMap.get("eccontentfieldname")!= null && StringUtils.isNotBlank(fielMap.get("eccontentfieldname").toString())){ + ecContentdata = excField(fielMap.get("eccontentfieldname").toString(), fielMap.get("esfieldname").toString(), ecContentdata); + } + if(fielMap.get("newscontentfieldname")!= null && StringUtils.isNotBlank(fielMap.get("newscontentfieldname").toString())){ + newsContentdata = excField(fielMap.get("newscontentfieldname").toString(), fielMap.get("esfieldname").toString(), newsContentdata); + } + if(fielMap.get("bbscontentfieldname")!= null && StringUtils.isNotBlank(fielMap.get("bbscontentfieldname").toString())){ + bbsContentdata = excField(fielMap.get("bbscontentfieldname").toString(), fielMap.get("esfieldname").toString(), bbsContentdata); + } + if(fielMap.get("weibocommentfieldname")!= null && StringUtils.isNotBlank(fielMap.get("weibocommentfieldname").toString())){ + weiboCommentdata = excField(fielMap.get("weibocommentfieldname").toString(), fielMap.get("esfieldname").toString(), weiboCommentdata); + } + if(fielMap.get("eccommentfieldname")!= null && StringUtils.isNotBlank(fielMap.get("eccommentfieldname").toString())){ + ecCommentdata = excField(fielMap.get("eccommentfieldname").toString(), fielMap.get("esfieldname").toString(), ecCommentdata); + } + if(fielMap.get("newscommentfieldname")!= null && StringUtils.isNotBlank(fielMap.get("newscommentfieldname").toString())){ + newsCommentdata = excField(fielMap.get("newscommentfieldname").toString(), fielMap.get("esfieldname").toString(), newsCommentdata); + } + if(fielMap.get("bbscommentfieldname")!= null && StringUtils.isNotBlank(fielMap.get("bbscommentfieldname").toString())){ + bbsCommentdata = excField(fielMap.get("bbscommentfieldname").toString(), fielMap.get("esfieldname").toString(), bbsCommentdata); + } + if(fielMap.get("abroadcontentfieldname") != null && StringUtils.isNotBlank(fielMap.get("abroadcontentfieldname").toString())){ + abroadcontentdata = excField(fielMap.get("abroadcontentfieldname").toString(), fielMap.get("esfieldname").toString(), abroadcontentdata); + } + if(fielMap.get("abroadcommentfieldname") != null && StringUtils.isNotBlank(fielMap.get("abroadcommentfieldname").toString())){ + abroadcommentdata = excField(fielMap.get("abroadcommentfieldname").toString(), fielMap.get("esfieldname").toString(), abroadcommentdata); + } + if(fielMap.get("userinfofieldname") != null && StringUtils.isNotBlank(fielMap.get("userinfofieldname").toString())){ + userInfodata = excField(fielMap.get("userinfofieldname").toString(), fielMap.get("esfieldname").toString(), userInfodata); + } + } + + allfields.put("keyword", weibocontentdata); + allfields.put("comment", weiboCommentdata); + + allfields.put("eccontent", ecContentdata); + allfields.put("eccomment", ecCommentdata); + + allfields.put("newscontent", newsContentdata); + allfields.put("newscomment", newsCommentdata); + + allfields.put("bbspost", bbsContentdata); + allfields.put("bbspost_comment", bbsCommentdata); + + allfields.put("storyDetailPage", abroadcontentdata); + allfields.put("socialComment", abroadcommentdata); + allfields.put("userInfoPage",userInfodata); + fieldNormalizeInfoMap.put(1, allfields) ; + } + } + + + private static Map excField(String value, String esValue, Map fieldMap){ + value = value.replaceAll("\\(.*?\\)", ""); + String[] fieldValues = value.split("/") ; + for(int i = 0 ; i < fieldValues.length ; i++){ + fieldMap.put(fieldValues[i], esValue) ; + } + return fieldMap ; + } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfFieldTableInfo.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfFieldTableInfo.java new file mode 100644 index 0000000..743e197 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfFieldTableInfo.java @@ -0,0 +1,27 @@ +package com.bfd.mf.entity.mysql; + + +import com.bfd.mf.service.tools.DBUtil; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MfFieldTableInfo { + + public static Map> tableInfoMap = new HashMap>(); + + public static void loadTableInfo(){ + List> tableInfoList = DBUtil.getInstance("db_stat").query("select * from mf_field_table_info where bussiness_type = 1"); + + if(tableInfoList.size() > 0){ + Map tablefieldValue = new HashMap(); + for(Map tableInfo : tableInfoList){ + tablefieldValue.put(tableInfo.get("col_name").toString(), tableInfo.get("col_type").toString()); + } + tableInfoMap.put(1, tablefieldValue); + } + + } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfFieldType.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfFieldType.java new file mode 100644 index 0000000..ba1580c --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfFieldType.java @@ -0,0 +1,38 @@ +package com.bfd.mf.entity.mysql; + + +import com.bfd.mf.entity.MfFieldInfo; +import com.bfd.mf.service.tools.DBUtil; + +import java.util.*; + +public class MfFieldType { + + public static Map fieldStringTypes = new HashMap(); + + public static void loadFieldType(){ + List> fieldtypeList = DBUtil.getInstance("db_stat").query("select * from mf_field_type"); + if(fieldtypeList.size()> 0){ + MfFieldInfo fieldInfo ; + for(Map fieldtypeMap : fieldtypeList){ + List JsonStringresult = new ArrayList(); + List jsonArrayresult = new ArrayList(); + if(fieldtypeMap.get("kafkajsonstring") != null){ + JsonStringresult = Arrays.asList(fieldtypeMap.get("kafkajsonstring").toString().split(",")) ; + } + if(fieldtypeMap.get("kafkajsonarray") != null){ + jsonArrayresult = Arrays.asList(fieldtypeMap.get("kafkajsonarray").toString().split(",")) ; + } + + fieldInfo = new MfFieldInfo(JsonStringresult,jsonArrayresult); + fieldStringTypes.put(fieldtypeMap.get("kafka_type").toString(), fieldInfo); + } + } + + } +// +// public static void main(String[] args) { +// List JsonStringresult = Arrays.asList("attr".split(",")) ; +// System.out.println(JsonStringresult); +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfSouceInfo.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfSouceInfo.java new file mode 100644 index 0000000..19b0834 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/MfSouceInfo.java @@ -0,0 +1,25 @@ +package com.bfd.mf.entity.mysql; + + +import com.bfd.mf.service.tools.DBUtil; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MfSouceInfo { + public static Map souceInfos = new HashMap(); + + public static void loadSouceInfo(){ + List> souceInfoList = DBUtil.getInstance("db_stat").query("select cid,site_name from cl_site"); + //List> souceInfoList = DBUtil.getInstance("db_stat").query("select cid,source from mf_source_info"); + if(souceInfoList.size() > 0){ + for(Map souceInfo : souceInfoList){ + souceInfos.put(souceInfo.get("cid").toString(), souceInfo.get("site_name").toString()); + //souceInfos.put(souceInfo.get("cid").toString(), souceInfo.get("area").toString()); + //System.out.println(souceInfo.get("cid").toString()+" == "+souceInfo.get("site_name").toString()); + } + } + } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/SubjectTask.java b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/SubjectTask.java new file mode 100644 index 0000000..934addf --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/entity/mysql/SubjectTask.java @@ -0,0 +1,66 @@ +package com.bfd.mf.entity.mysql; + + +import com.bfd.crawler.utils.JsonUtils; +import com.bfd.mf.service.tools.DBUtil; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SubjectTask { + + public static Map>> subjectTaskMap = new HashMap<>(); + public static void loadSubjectTask(){ + subjectTaskMap.clear(); + List> subjectTaskList = DBUtil.getInstance("db_stat").query("SELECT cst.id, cst.subject_id, cst.task_id, ct.cid, ct.crawl_data_flag,cs.export_to_kafka,cs.kafka_addr,cs.go_fast_addr FROM cl_subject_task cst JOIN cl_subject cs ON (cst.subject_id = cs.id) LEFT JOIN cl_task ct ON (cst.task_id = ct.id );"); + if(subjectTaskList.size() > 0){ + String key = ""; + for(Map subjectTask : subjectTaskList){ //{subject_id=10222, name=我是张三, task_id=188, id=71, crawl_data_flag=aaa} + key = subjectTask.get("cid") + "#####" + subjectTask.get("crawl_data_flag"); + Map value = new HashMap<>(); + List> valueList = new ArrayList<>(); + String v_subject_id = ""; + String v_go_fast_addr = ""; + String v_export_to_kafka = ""; + String v_kafka_addr = ""; + String v_task_id = ""; + String v_external_id =""; + if(null != subjectTask.get("subject_id")) { + v_subject_id = subjectTask.get("subject_id").toString(); + } + if(null != subjectTask.get("go_fast_addr")) { + v_go_fast_addr = subjectTask.get("go_fast_addr").toString(); + } + if(null != subjectTask.get("kafka_addr")) { + v_kafka_addr = subjectTask.get("kafka_addr").toString(); + } + if(null != subjectTask.get("export_to_kafka")){ + v_export_to_kafka = subjectTask.get("export_to_kafka").toString(); + } + if(null !=subjectTask.get("task_id")){ + v_task_id = subjectTask.get("task_id").toString(); + } + if(null !=subjectTask.get("external_id")){ + v_task_id = subjectTask.get("external_id").toString(); + } + value.put("subject_id",v_subject_id); + value.put("go_fast_addr",v_go_fast_addr); + value.put("export_to_kafka",v_export_to_kafka); + value.put("kafka_addr",v_kafka_addr); + value.put("task_id",v_task_id); + value.put("external_id",v_external_id); + key = key.toLowerCase(); + if(subjectTaskMap.containsKey(key)){ + valueList = subjectTaskMap.get(key); + valueList.add(value); + }else{ + valueList.add(value); + } + subjectTaskMap.put(key,valueList); + } + System.out.println(JsonUtils.toJSONString(subjectTaskMap)); + } + } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/runstart/RunStartService.java b/cl_stream_service/src/main/java/com/bfd/mf/runstart/RunStartService.java new file mode 100644 index 0000000..4ee62e5 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/runstart/RunStartService.java @@ -0,0 +1,94 @@ +package com.bfd.mf.runstart; + + +import com.bfd.mf.entity.mysql.*; +import com.bfd.mf.service.rmi.ServiceManager; +import com.bfd.mf.service.rmi.impl.ServiceManagerImpl; +import com.bfd.mf.service.tools.DBUtil; +import com.bfd.mf.service.tools.HanLPUtils; +import crawler.open.util.RedisUtil; +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; + +import java.net.MalformedURLException; +import java.rmi.AlreadyBoundException; +import java.rmi.Naming; +import java.rmi.RemoteException; +import java.rmi.registry.LocateRegistry; +import java.util.Timer; +import java.util.TimerTask; + +public class RunStartService { + private static final Logger LOG = Logger.getLogger(RunStartService.class); + + private static int checkMsqlIndextimer = 5000 ; + private static String log4jPath = "../etc/log4j.properties"; + private static String dbPath = "../etc/db.properties"; + private static String redisPath = "../etc/redis.properties"; + static { + PropertyConfigurator.configureAndWatch(log4jPath); + DBUtil.init(dbPath); + RedisUtil.init(redisPath); + } + + public static void main(String[] args) { + + startRmiService(); + MfFieldInfo.loadBackstageFieldInfo(); // field_info + MfFieldType.loadFieldType(); // field_type + MfSouceInfo.loadSouceInfo(); // source_info + MfFieldTableInfo.loadTableInfo(); // field_table_info + MfDoctypeInfo.loadDocTypeInfo(); // doctype_info + MfChannelInfo.loadChannelInfo(); // channel_info + HanLPUtils.initAnalyzer(); + + while (true){ + SubjectTask.loadSubjectTask(); + try { + Thread.sleep(60000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } +// new AreaCategoryMappingUtils(); + } + + public static void startListen(){ + Timer t = new Timer(); + t.schedule(new RunStartService().new StartListenMsqlThread(), 2000, checkMsqlIndextimer); + } + + class StartListenMsqlThread extends TimerTask{ + @Override + public void run() { + } + } + + public static void startRmiService() { + try { + /*** 创建一个远程对象 ***/ + ServiceManager serviceManager = new ServiceManagerImpl(); + /*** + * 本地主机上的远程对象注册表Registry的实例, 并指定端口为8888,这一步必不可少(Java默认端口是1099), + * 必不可缺的一步,缺少注册表创建,则无法绑定对象到远程注册表上 + ***/ + LocateRegistry.createRegistry(8899); + Naming.bind("//127.0.0.1:8899/serviceManager", serviceManager); + /*** 把远程对象注册到RMI注册服务器上,并命名为taskManager ***/ + /*** 绑定的URL标准格式为:rmi://host:port/name(其中协议名可以省略,下面两种写法都是正确的) ***/ + System.out.println(">>>>>INFO:远程IHello对象绑定成功!"); + } catch (RemoteException e) { + System.out.println("创建远程对象发生异常!"); + LOG.error("RunStart>>>创建远程对象发生异常!"); + e.printStackTrace(); + } catch (MalformedURLException e) { + System.out.println("发生URL畸形异常!"); + LOG.error("RunStart>>>发生URL畸形异常!"); + e.printStackTrace(); + } catch (AlreadyBoundException e) { + e.printStackTrace(); + } + } + + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/annotation/SetProperty.java b/cl_stream_service/src/main/java/com/bfd/mf/service/annotation/SetProperty.java new file mode 100644 index 0000000..ce25646 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/annotation/SetProperty.java @@ -0,0 +1,12 @@ +package com.bfd.mf.service.annotation; + +import java.lang.annotation.*; + +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD}) + +public @interface SetProperty { + String propertyName(); + String propertyValue(); +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ExtendTypeInterface.java b/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ExtendTypeInterface.java new file mode 100644 index 0000000..d1c5626 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ExtendTypeInterface.java @@ -0,0 +1,9 @@ +package com.bfd.mf.service.extendType; + +import java.util.Map; + +public interface ExtendTypeInterface { + + Map exec() ; + void end(); +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ForegroundExtendType.java b/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ForegroundExtendType.java new file mode 100644 index 0000000..a8a0f52 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ForegroundExtendType.java @@ -0,0 +1,470 @@ +package com.bfd.mf.service.extendType; + +import com.alibaba.fastjson.JSONObject; +import com.bfd.crawler.kafka7.KfkProducer; +import com.bfd.crawler.utils.JsonUtils; +import com.bfd.mf.entity.MfFieldInfo; +import com.bfd.mf.entity.FieldNormaliz; +import com.bfd.mf.entity.TypeEntity; +import com.bfd.mf.service.tools.WriteMethod; +import crawler.open.util.RedisUtil; +import org.apache.log4j.Logger; +import java.util.*; +import static com.bfd.crawler.utils.DataUtil.calcMD5; + +public class ForegroundExtendType extends ParentExctendType implements Runnable{ + + private static final Logger LOG = Logger.getLogger(ForegroundExtendType.class); + private String data ; + private FieldNormaliz fieldNormaliz ; + private KfkProducer kfkProducer ; + private String kafkaName ; + + public ForegroundExtendType(String data, FieldNormaliz fieldNormaliz, KfkProducer kfkProducer){ + this.data = data ; + this.fieldNormaliz = fieldNormaliz ; + this.kfkProducer = kfkProducer ; + this.kafkaName = fieldNormaliz.getKafkaName() ; + } + + public Map exec() { + try { + Map dataMap = JsonUtils.parseObject(data); + String projectName = fieldNormaliz.getProjectName(); + int kafkaServerName = fieldNormaliz.getKafkaSerName(); + String kafkaName = fieldNormaliz.getKafkaName(); + int esSerName = fieldNormaliz.getEsSerName(); + String kafkaSuffixName = fieldNormaliz.getKafkaSuffixName(); + LOG.info("[ForegroundExtendType] exec >>> "+ data); + if(!dataMap.containsKey("crawlDataFlag")){ + dataMap = getCrawlDataFlag(dataMap); + } + + if(!dataMap.containsKey("brand")){ + dataMap.put("brand",""); + } + String cid = (String) dataMap.get("cid"); + if(dataMap.containsKey(TypeEntity.TYPE)||dataMap.containsKey(TypeEntity.PAGETYPE)){ + String type =""; + if (cid.equals("sina")){ + type = (String) dataMap.get(TypeEntity.PAGETYPE); + }else{ + type = (String) dataMap.get(TypeEntity.TYPE);} + if(type.contains("list")){ + return null; + } + if(type.equals("weibo")){ + type = "keyword"; + } + if(type.equals("home")||type.equals("bbsuserinfo")){ + type = "userInfoPage"; + } + // 如果是电商详情,直接写入到 redis + if (type.equals(TypeEntity.ECCONTENT)) { + String product_id = (String) dataMap.get("product_id"); + String keys = cid + "#" + product_id; + int dbindex = hash(keys, 9); + LOG.info("[ ForegroundExtendType ] 往 Redis 中灌入商品详情数据 dbIndex = " + dbindex + " ; keys = " + keys); + RedisUtil.set(keys, data, dbindex); + } else { + Map fieldInfoMap = fieldNormaliz.getFieldInfo(); + Map newdataMap = new HashMap(dataMap); + if(newdataMap.containsKey("comments") && newdataMap.get("comments").toString().equals("[]")){ + LOG.info("This data have no comments " + data); + return null; + } + // 如果是电商评论,需要把电商详情从 redis 中拿出来组装一下再进行处理 + if (type.equals(TypeEntity.ECCOMMENT)) { // 如果页面类型是 电商评论: + if (newdataMap.containsKey("product_id")) { + String product_id = (String) newdataMap.get("product_id"); + if (null != product_id && !("").equals(product_id)) { + } else if (newdataMap.containsKey("comments")) { + List> comments = (List>) newdataMap.get("comments"); + Map comment = comments.get(0); + if (comment.containsKey("product_id")) { + product_id = (String) comment.get("product_id"); + newdataMap.put("product_id", product_id); + } + } + } else if (newdataMap.containsKey("comments")) { + List> comments = (List>) newdataMap.get("comments"); + Map comment = comments.get(0); + if (comment.containsKey("product_id")) { + String product_id = (String) comment.get("product_id"); + newdataMap.put("product_id", product_id); + } + } + newdataMap = disposeEcComment(cid, newdataMap); + } + + ParralleData pd = getParralleData(fieldInfoMap, newdataMap, type, cid, projectName); + List> datas = pd.getParralleData(); + datas = new ArrayList<>(new HashSet<>(datas)); + + //System.out.println("######" + JsonUtils.toJSONString(datas)); + + // needSentimentApi = 1 是需要 0 不需要 + this.installData(kafkaServerName, datas, kafkaName, true, + fieldNormaliz.getIsSemtimentApi(), type, cid, projectName, kafkaSuffixName, esSerName); + + } + } + } catch (Exception e) { + e.printStackTrace(); + LOG.error("parse err data:"+data); + kfkProducer.send(kafkaName+"_err", "parse data error: the data is "+data); + } + return null; + } + + /** + * + */ + private Map getCrawlDataFlag(Map dataMap) { + try{ + if(dataMap.containsKey("attr")) { + Map attr = (Map) dataMap.get("attr"); + if(attr.containsKey("crawlDataFlag")){ + String crawlDataFlag = (String) attr.get("crawlDataFlag"); + dataMap.put("crawlDataFlag",crawlDataFlag); + } + if(attr.containsKey("listbrand")){ + String listbrand = (String) attr.get("listbrand"); + dataMap.put("listbrand",listbrand); + } + if(attr.containsKey("project_name")){ + String project_name = (String) attr.get("project_name"); + dataMap.put("project_name",project_name); + } + if(attr.containsKey("product_url")){ + String product_url = (String) attr.get("product_url"); + dataMap.put("product_url",product_url); + } + if(attr.containsKey("attachTag")){ + String attachTag = (String) attr.get("attachTag"); + dataMap.put("attachTag",attachTag); + } + if (attr.containsKey("attachtag")) { + Map attachtag = (Map) attr.get("attachtag"); + if (attachtag.containsKey("crawlDataFlag")) { + dataMap.put("crawlDataFlag", attachtag.get("crawlDataFlag")); + } else { + dataMap.put("crawlDataFlag", "没有数据采集标识位"); + } + if (attachtag.containsKey("project_name")) { + dataMap.put("project_name", attachtag.get("project_name")); + } else { + dataMap.put("project_name", "没有添加项目名"); + } + if (attachtag.containsKey("listbrand")) { + dataMap.put("listbrand", attachtag.get("listbrand")); + } + } + if (attr.containsKey("purl")) { + dataMap.put("purl", attr.get("purl")); + } + } + }catch (Exception e){ + e.printStackTrace(); + } + return dataMap; + } + + /** + * 这个方法中,字段映射取的是 前台ES 的字段映射哦 + */ + private ParralleData getParralleData(Map fieldInfoMap, Map newdataMap, + String type, String cid, String projectName) { + try{ + Map>> fieldData = fieldNormaliz.getFieldDataMap(); + Map> fieldtypeDataMap = fieldData.get(1); + System.out.println( cid + " --- " + type + " *** "+JsonUtils.toJSONString(fieldtypeDataMap)); + Map fieldDataMap = fieldtypeDataMap.get(type); + Map fixFieldMap = this.loadFixedField(type, 1, cid);// 获取一些必须的字段数据 + + Set keyset = fixFieldMap.keySet(); + for (String key : keyset) { + fieldDataMap.put(key, key); + } + System.out.print("cid"+"ssssssssss"+JsonUtils.toJSONString(fieldDataMap)); + fieldDataMap.remove("cid"); + newdataMap.putAll(fixFieldMap); + //System.out.println(newdataMap+"我是基础参数啊"); + String datanew = JSONObject.toJSONString(newdataMap); // 组装了基础参数的数据 + + MfFieldInfo fieldInfo = fieldInfoMap.get(type); + List kafkaJsonString = fieldInfo.getKafkaJsonString(); // [attr] + List kafkaJsonArray = fieldInfo.getKafkaJsonArray(); // [comments, replys] + // fieldDataMap 是映射好的字段Map + ParralleData pd = new ParralleData(); + + this.exeFileData(datanew, kafkaJsonString, kafkaJsonArray, fieldDataMap, + pd.getChunkId("", 0, -1), pd, type, projectName, cid); + return pd; + + }catch (Exception e){ + e.printStackTrace(); + return null; + } + } + +// private Map disposeEcComment(String cid,Map newdataMap) { +// try{ +// if(newdataMap.containsKey("product_id")) { +// String product_id = (String) newdataMap.get("product_id"); +// if(null != product_id && !("").equals(product_id)) { +// String keys = cid + "#" + product_id; +// int dbindex = hash(keys, 9); +// if (RedisUtil.exists(keys, dbindex)) { // 先去 redis中查询是否存在,不存直接忽略 +// LOG.info("[ForegroundExtendType] exec >>> 电商灌数:该商品在 Redis 中有!!! keys = " + keys + " ; dbindex = " + dbindex); +// newdataMap = getECContentDetail(keys, newdataMap, dbindex); +// if (newdataMap == null) { +// LOG.error("[ForegroundExtendType] exec >>> 电商灌数:从Redis中获取电商详情信息失败!!! keys = " + keys + " ; dbindex = " + dbindex); +// return null; +// } +// } else { +// LOG.error("[ForegroundExtendType] exec >>> 电商灌数:该 key 在 Redis 中不存在!!! keys = " + keys + " ; dbindex = " + dbindex); +// return null; +// } +// } +// } +// return newdataMap; +// }catch (Exception e){ +// e.printStackTrace(); +// return null; +// } +// } + + /** + * 将 bbs 数据灌入 ES + * 因为论坛是不区分页面类型的 bbspost 中 如果有 replys 中的,只要有 replys 就说明有评论,需要将 replys 中的内容灌入到 type_comment 的索引中 + */ +// private void putBBSpostData(int bussinessType, String cid, String type, +// String projectName, Map fieldInfoMap, +// Map dataMap, int kafkaServerName, +// int esSerName,String kafkaSuffixName) { +// try{ +// if(bussinessType != 1) { // 往后台灌 +// Map newdataMap = new HashMap(dataMap); +// MfFieldInfo fieldInfo = fieldInfoMap.get(type); +// List kafkaJsonString = fieldInfo.getKafkaJsonString(); +// List kafkaJsonArray = fieldInfo.getKafkaJsonArray(); +// Map fixFieldMap = this.loadFixedField(type, bussinessType, 1, cid); +// newdataMap.putAll(fixFieldMap); +// String datanew = JSONObject.toJSONString(newdataMap); +// Map>> fieldData = fieldNormaliz.getFieldDataMap(); +// Map> fieldtypeDataMap = fieldData.get(2); +// Map fieldDataMap = fieldtypeDataMap.get(type); +// Set keyset = fixFieldMap.keySet(); +// for (String key : keyset) { +// fieldDataMap.put(key, key); +// } +// ParralleData pd = new ParralleData(); +// this.exeFileData(datanew, kafkaJsonString, kafkaJsonArray, fieldDataMap, +// pd.getChunkId("", 0, -1), pd, type, bussinessType, projectName, cid); +// List> datas = pd.getParralleData(); +// datas = new ArrayList>(new HashSet>(datas)); +// +// this.installData(kafkaServerName, datas, kafkaName, true, fieldNormaliz.getIsSemtimentApi(), +// type, cid, bussinessType, projectName, kafkaSuffixName, esSerName); +// +// Map newdataMap2 = new HashMap(dataMap); +// if(newdataMap2.containsKey("replys") || newdataMap2.get("replys").toString().length() > 2) { +// MfFieldInfo fieldInfo2 = fieldInfoMap.get(type + "_comment"); +// List kafkaJsonString2 = fieldInfo2.getKafkaJsonString(); +// List kafkaJsonArray2 = fieldInfo2.getKafkaJsonArray(); +// Map fixFieldMap2 = this.loadFixedField(type, bussinessType, 0, cid); +// newdataMap2.putAll(fixFieldMap2); +// String datanew2 = JSONObject.toJSONString(newdataMap2); +// Map fieldDataMap2 = fieldtypeDataMap.get(type + "_comment"); +// Set keyset2 = fixFieldMap2.keySet(); +// for (String key : keyset2) { +// fieldDataMap2.put(key, key); +// } +// ParralleData pd2 = new ParralleData(); +// this.exeFileData(datanew2, kafkaJsonString2, kafkaJsonArray2, fieldDataMap2, +// pd2.getChunkId("", 0, -1), pd2, type + "_comment", bussinessType, projectName, cid); +// List> datas2 = pd2.getParralleData(); +// datas2 = new ArrayList>(new HashSet>(datas2)); +// +// this.installData(kafkaServerName, datas2, kafkaName, false, fieldNormaliz.getIsSemtimentApi(), +// type + "_comment", cid, bussinessType, projectName, kafkaSuffixName, esSerName); +// +// }else{ +// System.out.println("============没有回帖============================================================================="); +// System.out.println(JSONObject.toJSONString(newdataMap2)); +// } +// }else { // 往前台灌 +// if(dataMap.containsKey("contents")){ // 说明要灌bbs 的主贴,有时有replys,有时没有replys +// Map newdataMap = new HashMap(dataMap); +// if (newdataMap.containsKey("replys")) { +// newdataMap.remove("replys"); +// } +// ParralleData pd = getPD(fieldInfoMap, newdataMap, type, bussinessType, cid, projectName); +// List> datas = pd.getParralleData(); +// datas = new ArrayList>(new HashSet>(datas)); +// +// this.installData(kafkaServerName, datas, kafkaName, true, fieldNormaliz.getIsSemtimentApi(), +// type, cid, bussinessType, projectName, kafkaSuffixName, esSerName); +// +// if(dataMap.containsKey("replys") && dataMap.get("replys").toString().length() > 2){ +// Map newdataMap2 = new HashMap(dataMap); +// MfFieldInfo fieldInfo2 = fieldInfoMap.get(type + "_comment"); +// List kafkaJsonString2 = fieldInfo2.getKafkaJsonString(); +// List kafkaJsonArray2 = fieldInfo2.getKafkaJsonArray(); +// Map fixFieldMap2 = this.loadFixedField(type, bussinessType, 0, cid); +// newdataMap2.putAll(fixFieldMap2); +// String datanew2 = JSONObject.toJSONString(newdataMap2); +// Map>> fieldData = fieldNormaliz.getFieldDataMap(); +// Map> fieldtypeDataMap = fieldData.get(2); +// Map fieldDataMap2 = fieldtypeDataMap.get(type + "_comment"); +// Set keyset2 = fixFieldMap2.keySet(); +// for (String key : keyset2) { +// fieldDataMap2.put(key, key); +// } +// ParralleData pd2 = new ParralleData(); +// this.exeFileData(datanew2, kafkaJsonString2, kafkaJsonArray2, fieldDataMap2, +// pd2.getChunkId("", 0, -1), pd2, type + "_comment", bussinessType, projectName, cid); +// List> datas2 = pd2.getParralleData(); +// datas2 = new ArrayList>(new HashSet>(datas2)); +// +// this.installData(kafkaServerName, datas2, kafkaName, false, fieldNormaliz.getIsSemtimentApi(), +// type + "_comment", cid, bussinessType, projectName, kafkaSuffixName, esSerName); +// +// } +// }else{ // 没有 contents 的时候就说明只是回帖数据,因此必须得有 replys +// if(dataMap.containsKey("replys") && dataMap.get("replys").toString().length() > 2){ +// Map newdataMap2 = new HashMap(dataMap); +// MfFieldInfo fieldInfo2 = fieldInfoMap.get(type + "_comment"); +// List kafkaJsonString2 = fieldInfo2.getKafkaJsonString(); +// List kafkaJsonArray2 = fieldInfo2.getKafkaJsonArray(); +// Map fixFieldMap2 = this.loadFixedField(type, bussinessType, 0, cid); +// newdataMap2.putAll(fixFieldMap2); +// String datanew2 = JSONObject.toJSONString(newdataMap2); +// Map>> fieldData = fieldNormaliz.getFieldDataMap(); +// Map> fieldtypeDataMap = fieldData.get(2); +// Map fieldDataMap2 = fieldtypeDataMap.get(type + "_comment"); +// Set keyset2 = fixFieldMap2.keySet(); +// for (String key : keyset2) { +// fieldDataMap2.put(key, key); +// } +// ParralleData pd2 = new ParralleData(); +// this.exeFileData(datanew2, kafkaJsonString2, kafkaJsonArray2, fieldDataMap2, +// pd2.getChunkId("", 0, -1), pd2, type + "_comment", bussinessType, projectName, cid); +// List> datas2 = pd2.getParralleData(); +// datas2 = new ArrayList>(new HashSet>(datas2)); +// +// this.installData(kafkaServerName, datas2, kafkaName, false, fieldNormaliz.getIsSemtimentApi(), +// type + "_comment", cid, bussinessType, projectName, kafkaSuffixName, esSerName); +// +// }else{// 如果没有contents 并且 replys 也是空的,就是一条无效数据啊,不用入库; +// System.out.println("---------- 这是一条无效数据 ----------"); +// System.out.println("-- "+JSONObject.toJSONString(dataMap)); +// } +// } +// } +// }catch (Exception e){ +// e.printStackTrace(); +// } +// } + + + /** + * 获取redis 中的电商主贴信息 + */ + private Map disposeEcComment(String cid,Map newdataMap) { + try{ + if(newdataMap.containsKey("product_id")) { + String product_id = (String) newdataMap.get("product_id"); + if(null != product_id && !("").equals(product_id)) { + String keys = cid + "#" + product_id; + int dbindex = hash(keys, 9); + if (RedisUtil.exists(keys, dbindex)) { // 先去 redis中查询是否存在,不存直接忽略 + LOG.info("[ForegroundExtendType] exec >>> 电商灌数:该商品在 Redis 中有!!! keys = " + keys + " ; dbindex = " + dbindex); + newdataMap = getECContentDetail(keys, newdataMap, dbindex); + if (newdataMap == null) { + LOG.error("[ForegroundExtendType] exec >>> 电商灌数:从Redis中获取电商详情信息失败!!! keys = " + keys + " ; dbindex = " + dbindex); + return null; + } + } else { + LOG.error("[ForegroundExtendType] exec >>> 电商灌数:该 key 在 Redis 中不存在!!! keys = " + keys + " ; dbindex = " + dbindex); + return null; + } + } + } + return newdataMap; + }catch (Exception e){ + e.printStackTrace(); + return null; + } + } + + /** + * 获取电商详情数据,提取需要的字段 + */ + private Map getECContentDetail(String keys, Map newdataMap,int dbindex) { + try{ + String value = RedisUtil.get(keys,dbindex); + if(null != value && !("").equals(value)) { + Map eccontentMap = JsonUtils.parseObject(value); + newdataMap.putAll(eccontentMap); +// System.out.println("======================== " + JsonUtils.toJSONString(eccontentMap)); +// if (eccontentMap.containsKey("itemname")) { +// newdataMap.put("itemname", eccontentMap.get("itemname")); +// } +// if (eccontentMap.containsKey("parameter")) { +// newdataMap.put("parameter", eccontentMap.get("parameter")); +// } +// if (eccontentMap.containsKey("price")) { +// newdataMap.put("price", eccontentMap.get("price")); +// } +// if (eccontentMap.containsKey("nomorprice")) { +// newdataMap.put("nomorprice", eccontentMap.get("nomorprice")); +// } +// if (eccontentMap.containsKey("mouthcount")) { +// newdataMap.put("mouthcount", eccontentMap.get("mouthcount")); +// } +// if (eccontentMap.containsKey("shopname")) { +// newdataMap.put("shopname", eccontentMap.get("shopname")); +// } +// if(eccontentMap.containsKey("shop_id")){ +// newdataMap.put("shop_id",eccontentMap.get("shop_id")); +// } +// if (eccontentMap.containsKey("url")) { +// newdataMap.put("product_url", eccontentMap.get("url")); +// } +// if(eccontentMap.containsKey("brand")){ +// newdataMap.put("brand",eccontentMap.get("brand")); +// } +// if(eccontentMap.containsKey("brand_id")){ +// newdataMap.put("brand_id",eccontentMap.get("brand_id")); +// } +// if(eccontentMap.containsKey("cate")){ +// newdataMap.put("cate",eccontentMap.get("cate")); +// } +// if(eccontentMap.containsKey("score")){ +// newdataMap.put("score",eccontentMap.get("score")); +// + } + }catch (Exception e){ + e.printStackTrace(); + return null; + } + return newdataMap; + } + + @Override + public void run() { + exec(); + } + + + + public int hash(String str, int size) { + String md5 = calcMD5(str); + String head = md5.substring(0, 4); + return Integer.parseInt(head, 16) % size; + } + + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ParentExctendType.java b/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ParentExctendType.java new file mode 100644 index 0000000..3f0d4c7 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ParentExctendType.java @@ -0,0 +1,617 @@ +package com.bfd.mf.service.extendType; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.bfd.crawler.kafka7.KfkProducer; +import com.bfd.mf.entity.AreaCategoryEntity; +import com.bfd.mf.entity.TypeEntity; +import com.bfd.mf.entity.mysql.MfChannelInfo; +import com.bfd.mf.entity.mysql.MfDoctypeInfo; +import com.bfd.mf.entity.mysql.MfSouceInfo; +import com.bfd.mf.entity.mysql.SubjectTask; +import com.bfd.mf.service.tools.*; +import com.bfd.mf.service.utils.AvailcontentApiUtils; +import com.bfd.mf.service.utils.HlkkwUtils; +import com.bfd.mf.service.utils.OpinionApiUtils; +import com.bfd.mf.service.utils.SentimentApiUtils; +import com.bfd.nlp.common.util.object.TObjectUtils; +import com.bfd.nlp.common.util.string.TStringUtils; +import com.hankcs.hanlp.HanLP; +import com.hankcs.hanlp.seg.common.Term; +import net.sf.json.JSONObject; +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; + +public class ParentExctendType { + + private static final Logger LOG = Logger.getLogger(ParentExctendType.class); + + public Map loadFixedField() { + return null; + } + + /** + * 组装一些默认值 1 + */ + public Map loadFixedField(String type ,int bbsifcontent,String cid){ + Map fixFieldMap = new HashMap(); + + long dateTime = System.currentTimeMillis() ; + fixFieldMap.put("enSource",cid.toLowerCase()); + fixFieldMap.put("source", MfSouceInfo.souceInfos.get(cid)); + if(type.equals(TypeEntity.KEYWORD) || type.equals(TypeEntity.WEIBO) || + type.equals(TypeEntity.NEWSCONTENT) || type.equals(TypeEntity.REPOST) || + type.equals(TypeEntity.STORYDETAILPAGE)){ // 微博关键词,微博大V,新闻主贴,论坛,海外社交主贴 + if(bbsifcontent == 1){ + fixFieldMap.put("primary", 1); + fixFieldMap.put("primaryPost", "1"); + }else{ + fixFieldMap.put("primary", 0); + fixFieldMap.put("primaryPost", "0"); + fixFieldMap.put("sign", 2); // 2=评论,1=转发 + } + }else if (type.contains("user")){ + fixFieldMap.put("primary",2); + fixFieldMap.put("primaryPost", "2"); + }else{ + fixFieldMap.put("primary", 0); + fixFieldMap.put("primaryPost", "0"); + if(type.equals(TypeEntity.REPOST)){ // 转发 + fixFieldMap.put("sign", 1); + }else if(type.equals(TypeEntity.COMMENT)){ // 评论 + fixFieldMap.put("sign", 2); + } + } + // 创建时间 + fixFieldMap.put("createTime", dateTime); + fixFieldMap.put("createTimeStr", DataCheckUtil.getCurrentTime(dateTime)); + fixFieldMap.put("createDay", DataCheckUtil.getDay(dateTime)); + fixFieldMap.put("createDate", DataCheckUtil.getDate(dateTime)); + fixFieldMap.put("lastModifiedTime", dateTime) ; + // 数据类型 跟 站点相关 相关 + fixFieldMap.put("docType", MfDoctypeInfo.docTypeInfos.get(cid)); + fixFieldMap.put("channel", MfChannelInfo.channelInfoMap.get(cid)); + + fixFieldMap.put("contentTag","nomal"); + // 商情后台打标预留的字段 + fixFieldMap.put("dataCount",0); +// fixFieldMap.put("egc",0); +// fixFieldMap.put("pgc",0); +// fixFieldMap.put("ugc",0); + // 打情感需要预留的字段 + fixFieldMap.put("sentiment", "0"); + fixFieldMap.put("summary", ""); + // 数据有效性 + fixFieldMap.put("availability",1); + return fixFieldMap ; + } + + + + + public void exeFileData(String fieldValue , List kafkaJsonString, + List kafkaJsonArray, Map fieldDataMap, + int chunkId, ParralleData pd, String type, String projectName, String cid){ + try { + JSONObject dataMap = JSONObject.fromObject(fieldValue); + Set keySet = dataMap.keySet(); + for(String colKey: keySet){ + //WriteMethod.writeMethod("10b2.txt",colKey); + Object colValue = dataMap.get(colKey) ; + if(kafkaJsonString.contains(colKey)){ + try{ + if(StringUtils.isNotBlank(colValue.toString())){ + exeFileData(colValue.toString(), kafkaJsonString , kafkaJsonArray, fieldDataMap, chunkId , pd, type, projectName, cid); + } + }catch(Exception e){ + e.printStackTrace(); + LOG.error("[ParentExctendType] >>> exeFileData kafkaJsonString colValue :"+colValue) ; + } + } else if (kafkaJsonArray.contains(colKey)){ + try{ + if(StringUtils.isNotBlank(colValue.toString())){ + List dataList = JSON.parseArray(colValue.toString(),String.class); + if(dataList.size() > 0){ + for(String dataObject : dataList){ + int childChunkId = pd.getChunkId(dataObject, 0, chunkId); + exeFileData(dataObject, kafkaJsonString, kafkaJsonArray, fieldDataMap ,childChunkId , pd, type, projectName, cid); + } + } + } + }catch(Exception e){ + e.printStackTrace(); + LOG.error("[ParentExctendType] >>> exeFileData kafkaJsonArray colValue :"+colValue) ; + } + } else if (fieldDataMap.containsKey(colKey)){ + if(colValue!=null){ + pd.addData(chunkId, fieldDataMap.get(colKey), colValue.toString(), type, projectName, cid); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + LOG.error("[ParentExctendType >>> exeFileData data "+fieldValue); + } + } + + + /** + * 组装写入ES 的数据 + */ + public void installData(int kafkaServerName, List> datas, + String KafkaTopic, boolean iscallhlk, int isSenApi, + String type, String cid, + String projectName, String kafkaSuffixName, int esSerName) { + LOG.debug("ParentExctendType installData >>> start install data!!!!!"); + for (Map data : datas) { + //LOG.info("[ParentExctendType] installData : cid = " + cid + " ; data = " + JsonUtils.toJSONString(data)); + if (data.size() > 0) { + Map newmap = new HashMap(data); + String title = ""; + if(newmap.containsKey("title")){ + title = newmap.get("title"); + } + String content = ""; + if(newmap.containsKey("content")) { + content = newmap.get("content"); + if (!newmap.containsKey("title")) { + title = content; + newmap.put("title", content); + newmap.put("titleLength", newmap.get("contentLength")); + newmap.put("titleSimHash", newmap.get("contentSimHash")); + // 调用之前替换掉 content 中乱七八糟的符号之类的 + } + if (StringUtils.isNotBlank(content)) { + newmap = callhlKeyword(iscallhlk, content, newmap); //hlKeywords & sysKeywords 提取 + newmap = callsysAbstract(content, newmap); // sysAbstract 提取 + newmap = callOpinions(content, newmap); // 词云-评价 提取 + newmap = callPlace(title,content,newmap); // 词云-地点 提取 + SentimentApiUtils sentimentApiUtils = new SentimentApiUtils(); + Double sentiment = sentimentApiUtils.getSentimentValue(content); + newmap.put("sysSentiment",sentiment.toString()); + } + content = StringFilter(content); + this.callPhrase(title, content, newmap, data.get("docType")); // 长文本处理 + // 如果网络不同不能调用文本相关的结果 + } + newmap = typeIsKeyword(type,newmap,title,content); + newmap = aboutAddress(newmap); + + if(!newmap.containsKey("isDownload")){ + newmap.put("isDownload","false"); + } + if(!newmap.containsKey("_id_") && newmap.containsKey("dataId")){ + newmap.put("_id_",MfMD5Util.GetMD5Code(newmap.get("dataId"))); + } + if(newmap.containsKey("docType") && newmap.get("docType").toString().equals("item")){ + newmap.put("primary","1"); + newmap.remove("primaryPost"); + } + if(type.contains("comment") || type.contains("socialComment")){ + //System.out.println("评论数据哦,docId = " + newmap.get("docId") + " == "+newmap.get("content") + " ----- " + newmap.get("postId") + " -- "+newmap.get("commentId")); + String dataId = cid+"#"+newmap.get("docId")+"#"+newmap.get("pubTime")+"#"+newmap.get("author")+"#"+newmap.get("content"); + newmap.put("dataId",MfMD5Util.GetMD5Code(dataId)); + newmap.put("_id_",MfMD5Util.GetMD5Code(dataId)); + } + + JSONObject jsonObject = JSONObject.fromObject(newmap); + + if(!newmap.containsKey("docId")){ + WriteMethod.writeMethod("error.txt", jsonObject.toString()); + } + WriteMethod.writeMethod("result.txt", jsonObject.toString()); +// System.out.println("kafkaServerName :" + kafkaServerName + " | " + "kafkaTopic : " +KafkaTopic + " | suffixName: " + kafkaSuffixName ); + KfkProducer.getInstance(kafkaServerName,KafkaTopic).send(KafkaTopic+"_"+kafkaSuffixName, jsonObject.toString()); + } + } + } + + + public void installData(int kafkaServerName,String KafkaTopic,String kafkaSuffixName,List> datas, + String type, String cid) { + LOG.debug("ParentExctendType installData >>> start install data!!!!!"); + for (Map data : datas) { + //LOG.info("[ParentExctendType] installData : cid = " + cid + " ; data = " + JsonUtils.toJSONString(data)); + if (data.size() > 0) { + Map newmap = new HashMap(data); + String title = ""; + if(newmap.containsKey("title")){ + title = newmap.get("title"); + } + + String content = ""; + if(newmap.containsKey("content")) { + content = newmap.get("content"); + if (!newmap.containsKey("title")) { + title = content; + newmap.put("title", content); + newmap.put("titleLength", newmap.get("contentLength")); + newmap.put("titleSimHash", newmap.get("contentSimHash")); + // 调用之前替换掉 content 中乱七八糟的符号之类的 + } +// if (StringUtils.isNotBlank(content)) { +// newmap = callhlKeyword(iscallhlk, content, newmap); //hlKeywords & sysKeywords 提取 +// newmap = callsysAbstract(content, newmap); // sysAbstract 提取 +// newmap = callOpinions(content, newmap); // 词云-评价 提取 +// } +// content = StringFilter(content); +// this.callPhrase(title, content, newmap, data.get("docType")); + // 如果网络不同不能调用文本相关的结果 + } + newmap = typeIsKeyword(type,newmap,title,content); + newmap = aboutAddress(newmap); + + + if(!newmap.containsKey("isDownload")){ + newmap.put("isDownload","false"); + } + if(!newmap.containsKey("_id_")){ + newmap.put("_id_",MfMD5Util.GetMD5Code(newmap.get("dataId"))); + } + + if(type.contains("comment")){ + System.out.println("评论数据哦,docId = " + newmap.get("docId") + " == "+newmap.get("content")); + String dataId = cid+"#"+newmap.get("docId")+"#"+newmap.get("pubTime")+"#"+newmap.get("author")+"#"+newmap.get("content"); + newmap.put("dataId",MfMD5Util.GetMD5Code(dataId)); + newmap.put("_id_",MfMD5Util.GetMD5Code(dataId)); + } + + Map>> subjectTaskMap = SubjectTask.subjectTaskMap; + String crawlDataFlag = newmap.get("crawlDataFlag"); + if(subjectTaskMap.containsKey(crawlDataFlag)){ + System.out.println("----- " + subjectTaskMap.get(crawlDataFlag)); + } + + if(newmap.containsKey("pubTimeStr")){ + String pubTimeStr = newmap.get("pubTimeStr"); + String indexName = "cl_index_" + pubTimeStr.split(" ")[0].trim(); + newmap.put("indexName",indexName); + } + + JSONObject jsonObject = JSONObject.fromObject(newmap); + WriteMethod.writeMethod("result.txt", jsonObject.toString()); + KfkProducer.getInstance(kafkaServerName,KafkaTopic).send(KafkaTopic+"_"+kafkaSuffixName, jsonObject.toString()); + } + } + } + + private Map aboutAddress(Map newmap) { + try { + if (AreaCategoryMappingUtils.set.size() > 0) { + resetWeiboArea(newmap, "province"); + resetWeiboArea(newmap, "city"); + resetWeiboArea(newmap, "location"); + AreaCategoryEntity areaCategoryCityEntity = null; + AreaCategoryEntity areaCategoryAreaEntity = null; + AreaCategoryEntity areaCategoryProvinceEntity = null; + for (AreaCategoryEntity areaCategoryEntity : AreaCategoryMappingUtils.set) { + String city = areaCategoryEntity.getCity(); + String area = areaCategoryEntity.getArea(); + String province = areaCategoryEntity.getProvince(); + if (newmap.containsKey("city")) { + String originalProvince = ""; + String ocity = ""; + String originalCity = newmap.get("city"); + if (originalCity.contains(" ")) { + String[] citys = originalCity.split(" "); + originalProvince = citys[0]; + ocity = citys[1]; + } else { + ocity = originalCity; + if (newmap.containsKey("province")) { + originalProvince = newmap.get("province"); + } + } + try { + if (ocity.contains(city) && originalProvince.contains(province)) { + areaCategoryCityEntity = JSON.parseObject(JSON.toJSONString(areaCategoryEntity), + AreaCategoryEntity.class); + } + if (ocity.contains(area) && originalProvince.contains(province)) { + areaCategoryAreaEntity = JSON.parseObject(JSON.toJSONString(areaCategoryEntity), + AreaCategoryEntity.class); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + if (newmap.containsKey("province")) { + String originalProvince = newmap.get("province"); + if (originalProvince.contains(province)) { + areaCategoryProvinceEntity = JSON.parseObject(JSON.toJSONString(areaCategoryEntity), + AreaCategoryEntity.class); + } + } + if (newmap.containsKey("location")) { + String location = newmap.get("location"); + if (TStringUtils.isNotEmpty(location)) { + if (location.contains(province)) { + areaCategoryProvinceEntity = JSON.parseObject(JSON.toJSONString(areaCategoryEntity), + AreaCategoryEntity.class); + } + if (location.contains(province) && location.contains(city)) { + areaCategoryCityEntity = JSON.parseObject(JSON.toJSONString(areaCategoryEntity), + AreaCategoryEntity.class); + } + } + } + } + boolean cityFlag = false; + if (areaCategoryAreaEntity != null) { + updateRegionInfo(newmap, areaCategoryAreaEntity); + cityFlag = true; + } + if (areaCategoryCityEntity != null && !cityFlag) { + areaCategoryCityEntity.setArea(null); + updateRegionInfo(newmap, areaCategoryCityEntity); + cityFlag = true; + } + if (areaCategoryProvinceEntity != null && !cityFlag) { + areaCategoryProvinceEntity.setArea(null); + areaCategoryProvinceEntity.setCity(null); + updateRegionInfo(newmap, areaCategoryProvinceEntity); + } + } + }catch (Exception e){ + e.printStackTrace(); + } + return newmap; + } + + private Map typeIsKeyword(String type, Map newmap,String title,String content) { + if(type.equals("keyword")){ // 如果是微博的关键词入口博文 + if(newmap.containsKey("forwardContent") && StringUtils.isNotEmpty(newmap.get("forwardContent"))){ + title = newmap.get("forwardContent") ; + }else{ + if (StringUtils.isNotEmpty(content)){ + title = content; + } + } + /**去除表情*/ + String filterTitle = WeiboFilterUtils.removeEmotion(title); + /**去除Url*/ + filterTitle = WeiboFilterUtils.removeURLs(filterTitle); + /**去除用户标识*/ + filterTitle = WeiboFilterUtils.removeUserMentions(filterTitle); + if(StringUtils.isNotEmpty(filterTitle)){ + List terms = HanLP.segment(filterTitle); + StringBuffer sb = new StringBuffer(); + for (Term term:terms + ) { + // 移除地理标识 + if(term.nature.equals("ns") || term.nature.equals("w")){ + continue; + }else{ + sb.append(term.word); + } + } + title = sb.toString(); + } + List phraseLists = HanLP.extractPhrase(title, 5); + StringBuffer sb =new StringBuffer("weibo"); + if(TObjectUtils.isListEmpty(phraseLists)){ + if(TStringUtils.isEmpty(title)) + sb.append("_"+System.nanoTime()); + else + sb.append("_"+title); + }else{ + for (String word:phraseLists) { + sb.append("_"+word); + } + } + newmap.put("finalPhrase", sb.toString()); + } + return newmap; + } + + private String StringFilter(String str) throws PatternSyntaxException { + String regEx = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]"; + Pattern p = Pattern.compile(regEx); + Matcher m = p.matcher(str); + return m.replaceAll("").trim(); + } + + + /** + * 页面类型是微博的话需要此方法 获取省份和城市 + */ + private static void resetWeiboArea(Map jsonObject,String field){ + String docType= jsonObject.get("docType"); + if(docType.equals("weibo")){ + if(jsonObject.containsKey(field)){ + String value = jsonObject.get(field); + for (String d_province:AreaCategoryMappingUtils.DIRECT_CITY) { + if(value.contains(d_province)){ + jsonObject.put("province",d_province); + jsonObject.put("city",d_province); + } + } + } + } + } + + //dj-20200113 获取地区信息,主要针对微博 + private static void updateRegionInfo(Map jsonObject,AreaCategoryEntity areaCategoryEntity){ + + if(TStringUtils.isNotEmpty(areaCategoryEntity.getCountry())){ + jsonObject.put("country",areaCategoryEntity.getCountry()); + } + if(TStringUtils.isNotEmpty(areaCategoryEntity.getProvince())){ + jsonObject.put("province",areaCategoryEntity.getProvince()); + } + if(TStringUtils.isNotEmpty(areaCategoryEntity.getCity())){ + jsonObject.put("city",areaCategoryEntity.getCity()); + } + if(TStringUtils.isNotEmpty(areaCategoryEntity.getArea())){ + jsonObject.put("area",areaCategoryEntity.getArea()); + } + } + // dj-20200113 获取组装字段 emotionEntry + private String callEmotionEntry(){ + JSONArray jsonArray = new JSONArray(); + JSONObject entryObject= new JSONObject(); + entryObject.put("entryName","default"); + Double emotionValue = 0.5d; + entryObject.put("emotionValue", emotionValue); + String offSet = ""; + entryObject.put("offSet",offSet); + jsonArray.add(entryObject); + return jsonArray.toJSONString() ; + } + + // dj-20200113 获取组装字段 sysAbstract + private Map callsysAbstract(String content , Map newmap){ + String sysAbstract = "" ; + if(content.length() > 10){ + sysAbstract = HlkkwUtils.getSysAbstract(content); + }else{ + sysAbstract = content+ "。"; + } + newmap.put("sysAbstract", sysAbstract) ; + return newmap ; + } + + // dj-20200113 获取组装字段 hlKeywords 和 sysKeywords ; 样例:{hlKeywords=["欧莱雅","一直"], sysKeywords={"一直":0.9945585,"欧莱雅":0.9945585}} + private Map callhlKeyword(boolean iscallhlk, String content, Map newmap){ + List hlKeyword = new ArrayList(); + if(iscallhlk){ + hlKeyword = HlkkwUtils.getHLKkeyword(content, newmap); + } + newmap.put("hlKeywords", JSON.toJSONString(hlKeyword)); + return newmap ; + } + + // dj-20200113 availability 这个参数的意思是判断是否为有效数据 + private Map callPost(String content, Map newmap){ + newmap.put("availability", AvailcontentApiUtils.post(content)+""); + return newmap ; + } + + // dj-20200113 contentTag 该参数默认为 nomal 同时获取 hashTags expression 话题和表情 + private Map callcontentTag(Map newmap, String docType,String content){ + return HlkkwUtils.initContentTag(newmap, docType, content); + } + // dj-20200113 获取组装字段 places 词云 - 地点 + private Map callPlace(String content ,String title, Map newmap){ + List places = HanLPUtils.placeRecognize(new String[]{content,title});; + newmap.put("places", JSON.toJSONString(places)); + return newmap ; + } + + // dj-20200113 opinions 字段 情感词提取,词云-评价,主要针对微博和电商的数据 + private Map callOpinions(String content , Map newmap){ + List opinion = OpinionApiUtils.getOpinion(content) ; + newmap.put("opinions", JSON.toJSONString(opinion)); + return newmap ; + } + + // 字段的截取 + private String callPhrase(String title ,String content, Map newmap, String docType){ + return HlkkwUtils.processLongText(title, content, newmap, docType) ; + } + +// public static void main(String[] args) { +// ParentExctendType p = new ParentExctendType(); +// //String content = "【世卫组织:#有效新冠疫苗可能会在年底出现#】世界卫生组织3日表示,虽然有效新冠疫苗的交付目前暂无确切时间表,但到今年年底可能会有候选疫苗显示出对新冠病毒有效,关键问题是疫苗产能能否跟上需求。世卫组织已就未来疫苗产能问题与业界充分沟通,呼吁其做好规划,以便未来能通过技术转移或 \u200B\u200B\u200B\u200B...展开全文c"; +// String content = "【香港特区国安委正式成立,林郑月娥担任主席;法国总理辞职,新总理是他| 早读】O香港特区国安委正式成立,林郑月娥担任主席;...-上海今日24-29℃ 多云到阴-骆惠宁任香港国安委顾问-山东通报苟晶反映被顶替上学情况-北京低风险地区出京不再需要阴性证明-北京女子核酸阳性,隔离期多次破坏报警器外出-研究:新冠病毒可能会 \u200B\u200B\u200B\u200B...展开全文"; +// Map a = new HashMap<>(); +// a = p.callhlKeyword(true,content,a,1); +// a = p.callPlace(content,content,a); +// a = p.callOpinions(content,a); +// a = p.callcontentTag(a,"weibo",content); +// System.out.println( JSONObject.fromObject(a).toString()); +// +//// ParentExctendType exctendType = new ParentExctendType(); +//// boolean iscall = true; +//// String content = "一直用欧莱雅"; +//// Map newmap = new HashMap<>(); +//// int bussinessType = 1; +//// newmap = exctendType.callhlKeyword(iscall,content,newmap,bussinessType); +//// System.out.println(newmap); +// } + + +// public static void main(String[] args) { +// +// ParentExctendType parentExctendType = new ParentExctendType(); +// +// //String content = "{\"cid\":\"Nxhs\",\"charset\":\"utf-8\",\"comments\":[{\"comment_time\":\"2019-09-06 18:31:04\",\"up_cnt\":0,\"comment_content\":\"66\",\"news_id\":\"5d4251d100000000260298ea\",\"username\":\"东禾\",\"answers\":[{\"answers_time\":\"2019-01-01\",\"content\":\"123\",\"username\":\"zs\"},{\"answers_time\":\"2019-02-02\",\"content\":\"1234\",\"username\":\"zs1\"}]},{\"comment_time\":\"2019-08-27 15:14:45\",\"up_cnt\":0,\"comment_content\":\"666\",\"news_id\":\"5d4251d100000000260298ea\",\"username\":\"珍艺\",\"answers\":[{\"answers_time\":\"2019-09-09\",\"content\":\"999\",\"username\":\"zs99\"},{\"answers_time\":\"2019-07-07\",\"content\":\"2222\",\"username\":\"zs222\"}]},{\"comment_time\":\"2019-08-18 13:43:24\",\"up_cnt\":0,\"comment_content\":\"66\",\"news_id\":\"5d4251d100000000260298ea\",\"username\":\"麻辣妹纸\"},{\"comment_time\":\"2019-08-16 20:39:17\",\"up_cnt\":0,\"comment_content\":\"66\",\"news_id\":\"5d4251d100000000260298ea\",\"username\":\"余香\"},{\"comment_time\":\"2019-08-11 15:22:19\",\"up_cnt\":0,\"comment_content\":\"666\",\"news_id\":\"5d4251d100000000260298ea\",\"username\":\"ZERO\"},{\"comment_time\":\"2019-08-10 09:08:09\",\"up_cnt\":0,\"comment_content\":\"666\",\"news_id\":\"5d4251d100000000260298ea\",\"username\":\"清贺贺\"},{\"comment_time\":\"2019-08-09 23:36:27\",\"up_cnt\":0,\"comment_content\":\"666\",\"news_id\":\"5d4251d100000000260298ea\",\"username\":\"小红薯5B855028\"},{\"comment_time\":\"2019-08-09 23:36:08\",\"up_cnt\":0,\"comment_content\":\"666\",\"news_id\":\"5d4251d100000000260298ea\",\"username\":\"小红薯5B855028\"},{\"comment_time\":\"2019-08-09 17:47:00\",\"up_cnt\":0,\"comment_content\":\"一组……组在哪?\",\"news_id\":\"5d4251d100000000260298ea\",\"username\":\"可可(锞锞)\"},{\"comment_time\":\"2019-08-09 00:49:00\",\"up_cnt\":0,\"comment_content\":\"66\",\"news_id\":\"5d4251d100000000260298ea\",\"username\":\"雅望天堂_584D00FD\"}],\"type\":\"newscomment\",\"attr\":{\"tname\":\"小红书\",\"purl\":\"https://www.xiaohongshu.com/discovery/item/5d4251d100000000260298ea\",\"keyword\":\"哪吒\",\"attachtag\":{\"listbrand\":\"哪吒\",\"project_name\":\"Innovation_Compass\"}},\"news_id\":\"5d4251d100000000260298ea\",\"creation_time\":\"111223\"}" ; +// String content = "{\"attr\":{\"tname\":\"小红书\",\"purl\":\"https://www.xiaohongshu.com/discovery/item/5c33757c000000000900ffe6\",\"keyword\":\"生态保护\",\"attachtag\":{\"listbrand\":\"生态保护\",\"project_name\":\"VFC\"}},\"charset\":\"utf-8\",\"cid\":\"Nxhs\",\"comments\":[{\"comment_time\":\"2019-02-10 19:12:23\",\"up_cnt\":0,\"comment_content\":\"这么多垃圾还零污染,昧着良心说瞎话也稍微处理一下图片先啦[笑>哭R] [笑哭R] [笑哭R]\",\"username\":\"king\"},{\"comment_time\":\"2019-02-06 13:53:41\",\"up_cnt\":0,\"comment_content\":\"这身体\",\"username\":\"RXP一饶\"},{\"comment_time\":\"2019-01-27 16:31:40\",\"up_cnt\":0,\"comment_content\":\"美了美了美了美了\",\"username\":\"澳门酒店酒店管家\"},{\"comment_time\":\"2019-01-25 23:43:42\",\"up_cnt\":0,\"comment_content\":\"您好 在吗\",\"username\":\"小红薯E8F73B9\"},{\"comment_time\":\"2019-01-17 23:42:11\",\"up_cnt\":0,\"comment_content\":\"又是我羡慕的筷子腿,看来还要接着努力减肥了\",\"username\":\"拽拽的喵喵喵\"},{\"comment_time\":\"2019-01-13 14:53:42\",\"up_cnt\":1,\"comment_content\":\"生活到处>都是美,可是是缺这样的美景吗?不!是缺这样美丽的人!\",\"news_id\":\"5c33757c000000000900ffe6\",\"username\":\"花开院\"},{\"comment_time\":\"2019-01-12 10:21:27\",\"up_cnt\":0,\"comment_content\":\"超级棒\",\"username\":\"LCW\"},{\"comment_time\":\"2019-01-09 11:28:00\",\"up_cnt\":0,\"comment_content\":\"完美\",\"username\":\"蕉家高定XJXJ1616\"},{\"comment_time\":\"2019-01-09 08:31:37\",\"up_cnt\":0,\"comment_content\":\"这身材看了真受不了\",\"username\":\"情义丶杰倫 情聚四海\"},{\"comment_time\":\"2019-01-08 23:33:49\",\"up_cnt\":0,\"comment_content\":\"身材好啊\",\"username\":\"小红薯9142EA7\"}],\"creation_time\":1569378908,\"dataCount\":0,\"enSource\":\"nxhs\",\"news_id\":\"5c33757c000000000900ffe6\",\"plate\":\"\",\"primary\":0,\"primaryPost\":\"0\",\"projectName\":\"VFC\",\"sentiment\":\"0\",\"source\":\"小红书\",\"summary\":\"\",\"type\":\"newscomment\"}" ; +// List kafkaJsonString = new ArrayList(); +// kafkaJsonString.add("attr"); +// List kafkaJsonArray = new ArrayList(); +// kafkaJsonArray.add("comments"); +// kafkaJsonArray.add("answers"); +// Map fieldData = new HashMap(); +// //{creation_time=crawlTime, comment_time=pubTimeStr, replyfloor=replyfloor, sentiment=sentiment, +// //view_cnt=readCount, commenter_level=commenter_level, refer_comm_time=pubTimeStr, primaryPost=primaryPost, +// //plate=plate, purl=url, source=source, news_id=docId, content=content, dataCount=dataCount, down_cnt=down_cnt, +// //comment_content=content, listbrand=listBrand, keyword=keyword, enSource=enSource, summary=summary, +// //commenter_img=avatar, url=comment_url, collect_cnt=collectCount, refer_replyfloor=replyfloor, +// //refer_comm_username=author, up_cnt=attitudesCount, answers_time=pubTimeStr, favor_cnt=favor_cnt, +// //refer_comm_content=content, projectName=projectName, like_cnt=like_cnt, username=author, +// //reply_cnt=pageCommentCount, primary=primary} +// fieldData.put("creation_time", "crawlTime"); +// fieldData.put("comment_time", "pubTimeStr"); +// fieldData.put("replyfloor", "replyfloor"); +// fieldData.put("sentiment", "sentiment"); +// fieldData.put("readCount", "readCount"); +// fieldData.put("commenter_level", "commenter_level"); +// fieldData.put("refer_comm_time", "pubTimeStr"); +// fieldData.put("primaryPost", "primaryPost"); +// fieldData.put("plate", "plate"); +// fieldData.put("purl", "url"); +// fieldData.put("source", "source"); +// fieldData.put("news_id", "docId"); +// fieldData.put("content", "content"); +// fieldData.put("dataCount", "dataCount"); +// fieldData.put("down_cnt", "down_cnt"); +// fieldData.put("comment_content", "content"); +// fieldData.put("listbrand", "listBrand"); +// fieldData.put("keyword", "keyword"); +// fieldData.put("enSource", "enSource"); +// fieldData.put("summary", "summary"); +// fieldData.put("commenter_img", "avatar"); +// fieldData.put("url", "comment_url"); +// fieldData.put("collect_cnt", "collectCount"); +// fieldData.put("refer_replyfloor", "replyfloor"); +// fieldData.put("refer_comm_username", "author"); +// fieldData.put("up_cnt", "attitudesCount"); +// fieldData.put("answers_time", "pubTimeStr"); +// fieldData.put("favor_cnt", "favor_cnt"); +// fieldData.put("refer_comm_content", "content"); +// fieldData.put("projectName", "projectName"); +// fieldData.put("like_cnt", "like_cnt"); +// fieldData.put("username", "author"); +// fieldData.put("reply_cnt", "pageCommentCount"); +// fieldData.put("primary", "primary"); +// /*fieldData.put("comment_time", "time"); +// fieldData.put("up_cnt", "attruite"); +// fieldData.put("comment_content", "content"); +// fieldData.put("username", "author"); +// fieldData.put("cid", "source"); +// fieldData.put("answers_time", "time"); +// fieldData.put("content", "content"); +// fieldData.put("username", "author");*/ +// //ParralleData parralleData = new ParralleData(); +// //parentExctendType.exeFileData(content,kafkaJsonString, kafkaJsonArray ,fieldData, parralleData.getChunkId("", 0, -1), parralleData, "newscomment" ,2); +// //List> datas = parralleData.getParralleData(); +// /*System.out.println("111111111111 = "+datas.size()); +// for(Map data : datas) { +// System.out.println(data); +// } */ +// +// //System.out.println(parentExctendType.callEmotionEntry()); +// //Map map = new HashMap(); +// // System.out.println(parentExctendType.callcontentTag(map,"weibo","#nihao#")); +// // System.out.println(parentExctendType.callPlace("我在广州很好","我在北京很好",map)); +// +// System.out.println(new ParentExctendType().StringFilter("-")); +// +// } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ParralleData.java b/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ParralleData.java new file mode 100644 index 0000000..5cff58b --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/ParralleData.java @@ -0,0 +1,514 @@ +package com.bfd.mf.service.extendType; + +import com.bfd.mf.entity.TypeEntity; +import com.bfd.mf.entity.mysql.MfDoctypeInfo; +import com.bfd.mf.service.tools.*; +import net.sf.json.JSONObject; +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; + +import java.util.*; +import java.util.Map.Entry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; + +public class ParralleData { + + private static final Logger LOG = Logger.getLogger(ParralleData.class); + + private List chunkTextList = new ArrayList(); + + private Map chunkIdPatternId = new HashMap(); + + private Map chunkData = new HashMap(); + + public int getChunkId(String chunkText ,int patternId, int parentChunkId) { + int id = 0; + String vText = ""; + if(parentChunkId==-1){ + vText = patternId+""; + } else{ + vText = patternId+"_"+chunkText; + } + if(chunkTextList.contains(vText)) { + id = chunkTextList.indexOf(vText); + } else { + chunkTextList.add(vText); + id = chunkTextList.size()-1; + this.chunkData.put(id, new ChunkData(id)); + } + chunkIdPatternId.put(id, parentChunkId); + return id; + } + + + public void addData(int chunkId, String dataName, List value) { + this.chunkData.get(chunkId).addData(dataName, value); + } + + public void addData(int chunkId, String dataName, String value, String type, String projectName, String cid) { + WriteMethod.writeMethod("10b.txt",chunkId + " === " + dataName + " === " + value + " === " + cid); + String doctype = MfDoctypeInfo.docTypeInfos.get(cid); + if(dataName.equals("crawlTime")){ + List valueList = new ArrayList(); + valueList.add(DataCheckUtil.convertStringTotime(value)); + this.addData(chunkId, "crawlTimeStr", valueList); + + List valueList2 = new ArrayList(); + long daylong = DataCheckUtil.convertStringToLong(value); + valueList2.add(daylong+""); + this.addData(chunkId, dataName, valueList2); + + List dayList = new ArrayList(); + dayList.add(DataCheckUtil.getDay(daylong)+""); + this.addData(chunkId, "crawlDay", dayList); + + List dateList = new ArrayList(); + dateList.add(DataCheckUtil.getDate(daylong)+""); + this.addData(chunkId, "crawlDate", dateList); + + } else if(dataName.equals("pubTimeStr")){ + List valueList = new ArrayList(); + List valueList2 = new ArrayList(); + if(value.contains("-")){ + value = DataCheckUtil.chechData2(value); + valueList.add(DateUtil.getTimeMillis(value)+""); + valueList2.add(value); + }else if(value.contains("1")){ + if(value.length() == 10){ + value = Long.valueOf(value) * 1000 +""; + }else{ + value = Long.valueOf(value) +""; + } + valueList.add(value); + valueList2.add(DateUtil.getDateTime(Long.valueOf(value))); + }else if(StringUtils.isBlank(value)){ + valueList.add("0"); + valueList2.add(""); + } + this.addData(chunkId, "pubTime", valueList); + this.addData(chunkId, dataName, valueList2); + + long pubTime = Long.valueOf(valueList.get(0)); + List pubDayList = new ArrayList(); + pubDayList.add(DataCheckUtil.getDay(pubTime)+""); + this.addData(chunkId, "pubDay", pubDayList); + + List pubDateList = new ArrayList(); + pubDateList.add(DataCheckUtil.getDate(pubTime)+""); + this.addData(chunkId, "pubDate", pubDateList); + + } else if(dataName.equals("pageCommentCount") || dataName.equals("commentsCount")){ // 页面显示评论数和评论数 + List valueList = new ArrayList(); + valueList.add(value); + this.addData(chunkId, "commentsCount", valueList); + this.addData(chunkId, "pageCommentCount", valueList); + } else if(dataName.equals("pageTranspondCount") || dataName.equals("quoteCount")){ // 页面显示转发数和转发数 + List valueList = new ArrayList(); + if(value.endsWith("万+")){ + value = value.substring(0,value.indexOf("万+")) + "0000" ; + } + valueList.add(value); + this.addData(chunkId, "quoteCount", valueList); + this.addData(chunkId, "pageTranspondCount", valueList); + } else if(dataName.equals("listBrand")){ + List valueList = new ArrayList(); + if(type.equals("eccomment")){// 如果是电商评论的 listBrand 需要拆分一下 + if(value != "" && value.contains("@#@")){ + String brandList = ""; + String firstListBrand = "" ; + String secondListBrand = "" ; + String threeListBrand = "" ; + String plate = ""; + brandList = value.substring(0,value.lastIndexOf("@#@")); + plate = value.substring(value.lastIndexOf("@#@")+3); + String[] listbrands = brandList.split("@#@"); + if(listbrands.length == 1){ + firstListBrand = listbrands[0]; + }else if(listbrands.length == 2){ + firstListBrand = listbrands[0]; + secondListBrand = listbrands[1]; + }else if(listbrands.length == 3){ + firstListBrand = listbrands[0]; + secondListBrand = listbrands[1]; + threeListBrand = listbrands[2]; + } + List brandLists = new ArrayList(); + List firstListBrandList = new ArrayList(); + List secondListBrandList = new ArrayList(); + List threeListBrandList = new ArrayList(); + List plateList = new ArrayList(); + brandLists.add(brandList); + firstListBrandList.add(firstListBrand); + secondListBrandList.add(secondListBrand); + threeListBrandList.add(threeListBrand); + plateList.add(plate); + this.addData(chunkId, "brand", plateList); + this.addData(chunkId, "plate", plateList); + this.addData(chunkId, "brandList", brandLists); + this.addData(chunkId, "firstListBrand", firstListBrandList); + this.addData(chunkId, "secondListBrand", secondListBrandList); + this.addData(chunkId, "threeListBrand", threeListBrandList); + } + }else if(type.startsWith("news")){ + List plateList = new ArrayList(); + plateList.add(value); + this.addData(chunkId, "plate", plateList); + } + valueList.add(value); + this.addData(chunkId, dataName, valueList); + } else if(dataName.equals("url")){ + List urlHashList = new ArrayList() ; + urlHashList.add(MfMD5Util.GetMD5Code(value)); + this.addData(chunkId, "urlHash", urlHashList); + + List urlList = new ArrayList(); + urlList.add(value); + this.addData(chunkId, dataName, urlList); + + } else if (dataName.equals("avatar")){ + List avatarList = new ArrayList() ; + if(value.contains("http:https:")){ + value = value.replace("http:https:","https:"); + } + avatarList.add(value); + this.addData(chunkId, dataName, avatarList); + }else if(dataName.equals("pictureList")){ + List pictureList = new ArrayList() ; + pictureList.add(value); + this.addData(chunkId, dataName, pictureList); + } else if(dataName.equals("title")){ + List TitleList = new ArrayList() ; + TitleList.add(value); + this.addData(chunkId, dataName, TitleList); + + List TitleHashList = new ArrayList() ; + TitleHashList.add(MfMD5Util.GetMD5Code(value)); + this.addData(chunkId, "titleSimHash", TitleHashList); + + List TitleLength = new ArrayList() ; + TitleLength.add(String.valueOf(value.length())); + this.addData(chunkId, "titleLength", TitleLength); + } else if(dataName.equals("content")){ + List contentList = new ArrayList() ; + contentList.add(value); + this.addData(chunkId, dataName, contentList); + + List ContentLength = new ArrayList() ; + ContentLength.add(String.valueOf(value.length())); + this.addData(chunkId, "contentLength", ContentLength); + + List contentTitleHashList = new ArrayList() ; + contentTitleHashList.add(MfMD5Util.GetMD5Code(value)); + this.addData(chunkId, "contentSimHash", contentTitleHashList); + } else if(dataName.equals("commentScore")){ // 电商的评论评分 + List commentScoreList = new ArrayList() ; + int newValue = 0 ; + if(StringUtils.isNotBlank(value)){ + try{ + if(value.endsWith("分")){ + value = value.substring(0, value.length()-1); + newValue = (int) (Math.ceil(Double.valueOf(value)/2)) ; + }else{ + if(value.matches("\\d+\\.\\d+")){ + value = value.substring(0, value.indexOf(".")); + } + newValue = Integer.valueOf(value) ; + } + }catch(Exception e){ + e.printStackTrace(); + LOG.error("ParralleData <<<< addData commentScore convert error value:"+value); + } + } + commentScoreList.add(newValue+""); + this.addData(chunkId, dataName, commentScoreList); + + } else if(dataName.equals("keyword")){ + List keywordList = new ArrayList() ; + keywordList.add(value) ; + if(type.startsWith("bbs")){ + this.addData(chunkId, "plate", keywordList); + this.addData(chunkId, "listBrand", keywordList); + } + this.addData(chunkId, dataName, keywordList); + } else if(dataName.equals("usertype")) { + List usertypeList = new ArrayList(); + usertypeList.add(value); + this.addData(chunkId, dataName, usertypeList); + }else if (dataName.equals("postId")){ + List postIdList = new ArrayList<>(); + postIdList.add(value); + this.addData(chunkId, "postId", postIdList); + if (type.equals("userInfoPage")){ + this.addData(chunkId, "authorId", postIdList); + } + String docId = cid+"#"+value; + List docIdList = new ArrayList() ; + docIdList.add("bfd_"+doctype+"_"+MfMD5Util.GetMD5Code(docId)); + this.addData(chunkId,"docId",docIdList); + + List dataIdList = new ArrayList<>(); + dataIdList.add(MfMD5Util.GetMD5Code("bfd_"+doctype+"_"+MfMD5Util.GetMD5Code(docId))); + this.addData(chunkId,"dataId",dataIdList); + this.addData(chunkId,"_id_",dataIdList); + + } else if(dataName.equals("attitudesCount")){ + List attitudesCountList ; + if(type.equals(TypeEntity.STORYDETAILPAGE)){ + if(StringUtils.isNotBlank(value)){ + JSONObject dataMap = JSONObject.fromObject(value); + if(dataMap.containsKey("totalCount")){ + attitudesCountList = new ArrayList(); + String totalCount = dataMap.get("totalCount").toString(); + attitudesCountList.add(totalCount); + this.addData(chunkId, dataName,attitudesCountList); + } + if(dataMap.containsKey("likeCount")){ + attitudesCountList = new ArrayList(); + String likeCount = dataMap.get("likeCount").toString(); + attitudesCountList.add(likeCount); + this.addData(chunkId, "firstListBrand",attitudesCountList); + } + if(dataMap.containsKey("loveCount")){ + attitudesCountList = new ArrayList(); + String loveCount = dataMap.get("loveCount").toString(); + attitudesCountList.add(loveCount); + this.addData(chunkId, "secondListBrand",attitudesCountList); + } + if(dataMap.containsKey("hahaCount")){ + attitudesCountList = new ArrayList(); + String hahaCount = dataMap.get("hahaCount").toString(); + attitudesCountList.add(hahaCount); + this.addData(chunkId, "threeListBrand",attitudesCountList); + } + if(dataMap.containsKey("angryCount")){ + attitudesCountList = new ArrayList(); + String angryCount = dataMap.get("angryCount").toString(); + attitudesCountList.add(angryCount); + this.addData(chunkId, "fourListBrand",attitudesCountList); + } + if(dataMap.containsKey("wowCount")){ + attitudesCountList = new ArrayList(); + String wowCount = dataMap.get("wowCount").toString(); + attitudesCountList.add(wowCount); + this.addData(chunkId, "fiveListBrand",attitudesCountList); + } + if(dataMap.containsKey("sadCount")){ + attitudesCountList = new ArrayList(); + String sadCount = dataMap.get("sadCount").toString(); + attitudesCountList.add(sadCount); + this.addData(chunkId, "listBrand",attitudesCountList); + } + } + }else{ + attitudesCountList = new ArrayList(); + attitudesCountList.add(value) ; + this.addData(chunkId, dataName,attitudesCountList); + } + } else if(dataName.equals("projectName")){ + List projectNameList = new ArrayList() ; + if(type.startsWith("bbs")){ + if(value.contains("|")){ + projectNameList.add(value.split("|")[1]) ; + }else{ + projectNameList.add(projectName) ; + } + }else{ + if(StringUtils.isNotBlank(value)){ + projectNameList.add(value) ; + }else{ + projectNameList.add(projectName) ; + } + } + this.addData(chunkId, dataName,projectNameList); + } else if(dataName.equals("source")){ + List valueList = new ArrayList(); + valueList.add(value); + this.addData(chunkId, dataName, valueList); + } else if (dataName.equals("filePath")){ + List valueList = new ArrayList(); + List valueList2 = new ArrayList(); + if (value!= null && value.length()!= 0){ + if(value instanceof String){ + valueList.add(value); + this.addData(chunkId, "filePath", valueList); + } + valueList2.add("1"); + this.addData(chunkId, "ugc", valueList2); + } + this.addData(chunkId, dataName, valueList); + }else if (dataName.equals("imagePath")){ + List valueList = new ArrayList(); + List valueList2 = new ArrayList(); + if (value!= null && value.length()!= 0){ + if(value instanceof String){ + valueList.add(value); + this.addData(chunkId, "imagePath", valueList); + } + valueList2.add("1"); + this.addData(chunkId, "pgc", valueList2); + } + this.addData(chunkId, dataName, valueList); + }else if (dataName.equals("videoPath")){ + System.out.print(value+"videoPath是是"); + List valueList = new ArrayList(); + List valueList2 = new ArrayList(); + if (value!= null && value.length()!= 0){ + if(value instanceof String){ + valueList.add(value); + System.out.println(valueList+"valuevalue是"); + this.addData(chunkId, "videoPath", valueList); + + } + valueList2.add("1"); + this.addData(chunkId, "egc", valueList2); + } + this.addData(chunkId, dataName, valueList); + } + else{ + List valueList = new ArrayList(); + valueList.add(value); + this.addData(chunkId, dataName, valueList); + } + } + + private String upperCase(String str) { + char[] ch = str.toCharArray(); + if (ch[0] >= 'a' && ch[0] <= 'z') { + ch[0] = (char) (ch[0] - 32); + } + return new String(ch); + } + + private String StringFilter(String str) throws PatternSyntaxException { + String regEx = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]"; + Pattern p = Pattern.compile(regEx); + Matcher m = p.matcher(str); + return m.replaceAll("").trim(); + } + + private List getChildChunkData( int parentChunkId ) { + List chunkDataList = new ArrayList(); + for (Entry e : this.chunkIdPatternId.entrySet() ) { + if( e.getValue() == parentChunkId ) { + chunkDataList.add( this.chunkData.get(e.getKey()) ); + } + } + return chunkDataList; + } + + public List> getParralleData() { + List> reData = new ArrayList>(); + if(this.chunkData.containsKey(0)) { + List vdList = this.chunkData.get(0).getParralleData(); + int vdListSize = vdList.size(); + if( vdListSize > 0 ) { + for ( ValueData vd : vdList ) { + String dataName = vd.getDataName(); + List values = vd.getValue(); + for( int i =0; i()); + reData.get(i).put( dataName, values.get(i) ); + } + } + } + } + return reData; + } + + class ChunkData{ + + private Map chunkData = new HashMap(); + + private Set dataNameSet = new TreeSet(); + + private Map dataNameValueSize = new HashMap(); + + private int maxSize = 0; + + private int chunkId; + + ChunkData(int chunkId) { + this.chunkId = chunkId; + } + + public void addData(String dataName, List value) { + if ( !dataNameSet.add(dataName) ) { + chunkData.get(dataName).addValue(value); + } else { + ValueData vd = new ValueData(dataName); + vd.addValue(value); + chunkData.put(dataName, vd); + } + int size = chunkData.get(dataName).size(); + maxSize = size > maxSize ? size : maxSize; + dataNameValueSize.put(dataName, size); + } + + + List getParralleData() { + List valueDataList = new ArrayList(); + this.getChildValue(); + for( Entry e : chunkData.entrySet() ) { + if(e.getValue().size() < this.maxSize) { + e.getValue().lastFill(maxSize); + } + + valueDataList.add(e.getValue()); + } + return valueDataList; + } + + private void getChildValue() { + List childChunkDataList = getChildChunkData( this.chunkId ); + for( ChunkData cd : childChunkDataList ) { + List vdList = cd.getParralleData(); + for( ValueData vd : vdList ) { + this.addData( vd.getDataName(), vd.getValue() ); + } + } + } + + } + + class ValueData{ + + private String dataName; + + private List value = new ArrayList(); + + public ValueData(String dataName){ + this.dataName = dataName; + } + + public String getDataName() { + return this.dataName; + } + + public void addValue(List value) { + this.value.addAll(new ArrayList(value)); + } + + public void lastFill( int size ) { + if(this.value.size()>0) { + String lastValue = this.value.get(this.value.size()-1); + for ( int i=this.value.size(); i getValue() { + return this.value; + } + + public int size() { + return this.value.size(); + } + + } + +} + + diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/SentimentCache.java b/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/SentimentCache.java new file mode 100644 index 0000000..fdc7910 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/extendType/SentimentCache.java @@ -0,0 +1,101 @@ +//package com.bfd.mf.service.extendType; +// +//import java.util.HashMap; +//import java.util.Map; +//import java.util.Vector; +//import com.bfd.crawler.kafka7.KfkProducer; +//import com.bfd.mf.service.utils.SentimentApiUtils; +// +//public class SentimentCache { +// +// public static Map sentimentCacheMap = new HashMap(); +// +// private Vector cacheData = new Vector(); +// +// private int maxCacheSem = 300 ; +// +// private SentimentApiUtils sentimentApiUtils ; +// +// private int callSen ; +// +// private KfkProducer kfkProducer ; +// +// private String kafkaName ; +// +// private long lastWriteTime = System.currentTimeMillis(); +// +// private static long maxOutWriteTime = 2 * 60 * 1000 ; +// +// private int currentCacheNum = 0; +// +// private String kafkaSuffixName ; +// +// private SentimentCache(int kafkaServeName,String kafkaName, int callSen,String kafkaSuffixName){ +// this.kafkaSuffixName = kafkaSuffixName ; +// this.callSen = callSen ; +// this.kafkaName = kafkaName ; +// this.kfkProducer = KfkProducer.getInstance(kafkaServeName, kafkaName) ; +// if(callSen == 1){ +// this.sentimentApiUtils = new SentimentApiUtils(); +// } +// new Thread(new CheckWirteTimeOut()).start(); +// } +// +// public static SentimentCache getSentimentCache(int kafkaServerName, String type, int callSen,String kafkaSuffixName, int esSerName){ +// if(sentimentCacheMap.containsKey(esSerName+"#"+kafkaServerName+"#"+type)){ +// return sentimentCacheMap.get(esSerName+"#"+kafkaServerName+"#"+type) ; +// }else{ +// SentimentCache elkInsertDataCache = new SentimentCache(kafkaServerName ,type, callSen, kafkaSuffixName); +// sentimentCacheMap.put(esSerName+"#"+kafkaServerName+"#"+type, elkInsertDataCache); +// return elkInsertDataCache ; +// } +// } +// +// public void addCache(String dataMap){ +// try { +// synchronized (cacheData) { +// this.currentCacheNum ++ ; +// cacheData.add(dataMap); +// if(currentCacheNum >= maxCacheSem){ +// this.exeSentiment(); +// } +// } +// }catch(Exception e){ +// e.printStackTrace(); +// } +// } +// +// private void exeSentiment(){ +// synchronized (cacheData) { +// if(callSen == 1){ +// Vector newDatas = this.sentimentApiUtils.getSentimentValue(cacheData); +// if(newDatas.size() > 0){ +// kfkProducer.send(kafkaName + "_"+kafkaSuffixName, newDatas) ; +// } +// }else{ +// if(cacheData.size() > 0){ +// kfkProducer.send(kafkaName + "_"+kafkaSuffixName, cacheData) ; +// } +// } +// cacheData = new Vector(); +// } +// this.currentCacheNum = 0; +// this.lastWriteTime = System.currentTimeMillis(); +// } +// +// class CheckWirteTimeOut implements Runnable { +// @Override +// public void run() { +// while (true) { +// try { +// if (System.currentTimeMillis() - lastWriteTime > maxOutWriteTime) { +// exeSentiment(); +// } +// Thread.sleep(1000 * 1 * 60); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +// } +// } +//} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/kafka/IKafka.java b/cl_stream_service/src/main/java/com/bfd/mf/service/kafka/IKafka.java new file mode 100644 index 0000000..40a865a --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/kafka/IKafka.java @@ -0,0 +1,11 @@ +package com.bfd.mf.service.kafka; + +import java.util.List; + +public interface IKafka { + public void read(); + public void read(String readTopicName); + public void read(String readTopicName, String groupId); + public void write(int kafakSerName, List data, String writeTopicName); + public void stop(); +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/kafka/ReadKafka.java b/cl_stream_service/src/main/java/com/bfd/mf/service/kafka/ReadKafka.java new file mode 100644 index 0000000..3182de8 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/kafka/ReadKafka.java @@ -0,0 +1,114 @@ +package com.bfd.mf.service.kafka; + +import com.bfd.crawler.kafka7.KfkConsumer; +import com.bfd.crawler.kafka7.KfkProducer; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.List; +import java.util.concurrent.BlockingQueue; + +public class ReadKafka implements IKafka{ + private static Log LOG = LogFactory.getLog(ReadKafka.class); + private BlockingQueue queue; + private String defaultReadTopicName; + private int threadNums; + private String groupId; + private int kafkaServerName ; + private int esSerName ; + + public ReadKafka(BlockingQueue queue,String topicName,int threadNums,String groupId,int kafkaServerName, int esSerName){ + this.queue = queue; + this.defaultReadTopicName = topicName; + this.threadNums =threadNums; + this.groupId = groupId; + this.kafkaServerName = kafkaServerName ; + this.esSerName = esSerName ; + } + + public void read(){ + KfkConsumer.startReadThread(this.queue, this.defaultReadTopicName,this.threadNums,this.groupId,this.kafkaServerName); + } + + @Override + public void read(String readTopicName) { + KfkConsumer.startReadThread(this.queue, readTopicName,this.threadNums,this.groupId,this.kafkaServerName); + } + + @Override + public void read(String readTopicName, String groupId) { + KfkConsumer.startReadThread(this.queue, readTopicName,this.threadNums,groupId,this.kafkaServerName); + } + + @Override + public void write(int kafakSerName, List data,String writeTopicName) { + KfkProducer.getInstance(kafakSerName,"").send(writeTopicName,data); + } + + + @Override + public void stop() { + LOG.info("ending:kfk consumer:stopping..."); + KfkConsumer.stopKfkConsumerThreads(); + LOG.info("ending:kfk consumer:closed"); + } + + /** + * for test + * */ +// public static void main(String[] args) { +// test2(); +// } + +// public static void test2(){ +// BlockingQueue queue = new LinkedBlockingDeque(); +// String topicName = "hrygwbcon1"; +// int threadNums = 5; +// ReadKafka kfk = new ReadKafka(queue, topicName, threadNums,"bbs_group_test",1,1); +// kfk.read(); +// while(true){ +// if(queue.size()>0){ +// try { +// System.out.println(queue.take()); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// }else{ +//// kfk.stop(); +//// break; +// } +// } +// +// } + +// public static void test1(){ +// +// +// +// BlockingQueue queue = new LinkedBlockingDeque(); +// String topicName = "test_hrn"; +// int threadNums = 5; +// ReadKafka kfk = new ReadKafka(queue, topicName, threadNums,"test_group_2",1,1); +//// List data = new ArrayList(); +//// for(int i=1000;i<1010;i++){ +//// data.add("test_" + i); +//// } +//// kfk.write(data); +// +// +// kfk.read(); +// while(true){ +// if(queue.size()>0){ +// try { +// System.out.println(queue.take()); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// }else{ +//// kfk.stop(); +//// break; +// } +// } +// +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/listen/ListenKafkaManager.java b/cl_stream_service/src/main/java/com/bfd/mf/service/listen/ListenKafkaManager.java new file mode 100644 index 0000000..a6f70d8 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/listen/ListenKafkaManager.java @@ -0,0 +1,76 @@ +package com.bfd.mf.service.listen; + + +import com.bfd.crawler.kafka7.KfkProducer; +import com.bfd.mf.entity.FieldNormaliz; +import com.bfd.mf.service.extendType.ForegroundExtendType; +import com.bfd.mf.service.kafka.ReadKafka; +import com.bfd.mf.service.tools.DateUtil; + +import java.util.concurrent.LinkedBlockingDeque; +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + + +public class ListenKafkaManager implements Runnable{ + + private LinkedBlockingDeque queue= new LinkedBlockingDeque(5000); + + private boolean isRun = true; + + private FieldNormaliz fieldNormaliz; + + private ThreadPoolExecutor spiderPoolExec ; + + private int addNum = 0 ; + + private KfkProducer kfkProducer ; + + public ListenKafkaManager(FieldNormaliz fieldNormaliz){ + String kafkaname = fieldNormaliz.getKafkaName() ; + int croePoolsize = 30 ; + int maximumPoolsize = 60; + long keepAliveTime = 0; + this.spiderPoolExec = new ThreadPoolExecutor(croePoolsize, maximumPoolsize, keepAliveTime, TimeUnit.SECONDS, new SynchronousQueue()); + this.fieldNormaliz = fieldNormaliz ; + this.kfkProducer = KfkProducer.getInstance(fieldNormaliz.getKafkaSerName(),kafkaname+"_err"); + ReadKafka readKafka = new ReadKafka(queue , kafkaname ,10, fieldNormaliz.getGroupId(), fieldNormaliz.getKafkaSerName(),fieldNormaliz.getEsSerName()); + readKafka.read(); + + } + + @Override + public void run() { + while(isRun){ + if(this.queue.size() < 1){ + DateUtil.sleep(1); + continue; + } + String data = this.queue.poll(); + if(data == null) continue ; + addTask(data); + addNum++; + } + } + + public int getReadKafkaNum(){ + return addNum ; + } + + private void addTask(String data){ + while (spiderPoolExec.getPoolSize() >= spiderPoolExec.getMaximumPoolSize() || spiderPoolExec.getActiveCount() >= spiderPoolExec.getMaximumPoolSize()) { + try { + Thread.sleep(200); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + spiderPoolExec.submit(new ForegroundExtendType(data, fieldNormaliz, kfkProducer)); + } + + public void setSwitch(boolean flag){ + this.isRun = flag ; + } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/listen/ListenTaskManager.java b/cl_stream_service/src/main/java/com/bfd/mf/service/listen/ListenTaskManager.java new file mode 100644 index 0000000..0781e7e --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/listen/ListenTaskManager.java @@ -0,0 +1,41 @@ +package com.bfd.mf.service.listen; + +import com.bfd.mf.entity.FieldNormaliz; +import com.bfd.mf.entity.mysql.MfFieldInfo; +import com.bfd.mf.entity.mysql.MfFieldType; +import com.bfd.mf.service.tools.JsonUtils; +import org.apache.log4j.Logger; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +public class ListenTaskManager { + + private static final Logger LOG = Logger.getLogger(ListenTaskManager.class); + + private static Set listenkafkaTopicThreadObj = new TreeSet(); + + public static Map listenKafkaManagers = new HashMap(); + + public static void addKafkaTopicListen(FieldNormaliz fieldNormaliz){ + String kafkaTopicName = fieldNormaliz.getKafkaName() ; + int kafkaServerName = fieldNormaliz.getKafkaSerName() ; + int esSerName = fieldNormaliz.getEsSerName(); + LOG.info("[ListenTaskManager] addKafkaTopicListen >>> kafkaTopicName :"+kafkaTopicName); + if (!listenkafkaTopicThreadObj.contains(esSerName+"#"+kafkaServerName+"#"+kafkaTopicName)) { + listenkafkaTopicThreadObj.add(esSerName+"#"+kafkaServerName+"#"+kafkaTopicName); + fieldNormaliz.setFieldDataMap(MfFieldInfo.fieldNormalizeInfoMap); + fieldNormaliz.setFieldInfo(MfFieldType.fieldStringTypes); + System.out.println("@@@@@@@@@@ " + JsonUtils.toJSONString(fieldNormaliz)); + ListenKafkaManager listenKafkaManager = new ListenKafkaManager(fieldNormaliz); + new Thread(listenKafkaManager).start(); + listenKafkaManagers.put(kafkaTopicName, listenKafkaManager); + }else{ + LOG.debug("[ListenTaskManager] addKafkaTopicListen >>> kafkaTopicName :"+kafkaTopicName +" 任务已经存在"); + } + } + + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/rmi/ServiceManager.java b/cl_stream_service/src/main/java/com/bfd/mf/service/rmi/ServiceManager.java new file mode 100644 index 0000000..95cd84f --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/rmi/ServiceManager.java @@ -0,0 +1,21 @@ +package com.bfd.mf.service.rmi; + + +import com.bfd.mf.entity.FieldNormaliz; + +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.util.Map; + +public interface ServiceManager extends Remote{ + + public void addTaskName(FieldNormaliz fieldNormaliz) throws RemoteException; + + public void stopImprotTask(int kafkaSerName, String kafkaName) throws RemoteException ; + + public void startImprotTask(String kafkaName) throws RemoteException ; + + public String getNowImportEsNum(String indexSuffixName, String docType) throws RemoteException; + + public int getNowKafkaNum(Map paramMap) throws RemoteException ; +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/rmi/impl/ServiceManagerImpl.java b/cl_stream_service/src/main/java/com/bfd/mf/service/rmi/impl/ServiceManagerImpl.java new file mode 100644 index 0000000..af511c0 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/rmi/impl/ServiceManagerImpl.java @@ -0,0 +1,115 @@ +package com.bfd.mf.service.rmi.impl; + +import com.bfd.crawler.kafka7.KfkConsumer; +import com.bfd.crawler.utils.JsonUtils; +import com.bfd.mf.entity.FieldNormaliz; +import com.bfd.mf.service.listen.ListenKafkaManager; +import com.bfd.mf.service.listen.ListenTaskManager; +import com.bfd.mf.service.rmi.ServiceManager; +import org.apache.log4j.Logger; + +import java.rmi.RemoteException; +import java.rmi.server.UnicastRemoteObject; +import java.util.Map; + +public class ServiceManagerImpl extends UnicastRemoteObject implements ServiceManager { + private static final Logger LOG = Logger.getLogger(ServiceManagerImpl.class); + private static final long serialVersionUID = 3861777587327339448L; + public ServiceManagerImpl() throws RemoteException { + super(); + } + + /** + * 添加一个灌数任务 + */ + @Override + public void addTaskName(FieldNormaliz fieldNormaliz) throws RemoteException { + LOG.info("[TaskManagerImpl] addTaskName param : " + JsonUtils.toJSONString(fieldNormaliz)); + ListenTaskManager.addKafkaTopicListen(fieldNormaliz); + } + + @Override + public void stopImprotTask(int kafkaSerName,String kafkaName) throws RemoteException{ + LOG.info("[TaskManagerImpl] stopImprotTask param : " + kafkaName); + if(ListenTaskManager.listenKafkaManagers.size() > 0){ + KfkConsumer.stopKfkConsumerThreads(kafkaSerName,kafkaName); + ListenKafkaManager listenKafkaManager = ListenTaskManager.listenKafkaManagers.get(kafkaName) ; + listenKafkaManager.setSwitch(false); + ListenTaskManager.listenKafkaManagers.remove(kafkaName); + } + + } + + @Override + public void startImprotTask(String kafkaName) throws RemoteException{ + LOG.info("[TaskManagerImpl] startImprotTask param : " + kafkaName); + if(ListenTaskManager.listenKafkaManagers.size() > 0){ + ListenKafkaManager listenKafkaManager = ListenTaskManager.listenKafkaManagers.get(kafkaName) ; + listenKafkaManager.setSwitch(true); + } + } + + @Override + public String getNowImportEsNum(String indexSuffixName, String docType) throws RemoteException{ + return "0"; + } + + + +// /*@Override +// public String getNowKafkaNum(Map paramMap) throws RemoteException{ +// JSONArray jsonarry = null; +// if(RunStart.kafkaInfoMap.size() > 0){ +// List jsondata = new ArrayList(); +// Map newKafkaValue ; +// for(Map.Entry> entry : RunStart.kafkaInfoMap.entrySet()){ +// Map kafkaValues = entry.getValue(); +// newKafkaValue = new HashMap(kafkaValues); +// String kafkaName = kafkaValues.get("kafkaName").toString(); +// int kafkaServeName = Integer.valueOf(kafkaValues.get("kafkaServeName").toString()); +// int taskid = Integer.valueOf(kafkaValues.get("taskid").toString()); +// int busniessType = Integer.valueOf(kafkaValues.get("busniessType").toString()); +// int readNum = 0 ; +// if(ListenTaskManager.listenKafkaManagers.size() > 0){ +// ListenKafkaManager listenKafkaManager = ListenTaskManager.listenKafkaManagers.get(kafkaName) ; +// readNum = listenKafkaManager.getReadKafkaNum() ; +// } +// newKafkaValue.put("readKafkaNum", readNum); +// JSONObject object = JSONObject.fromObject(newKafkaValue); +// jsondata.add(object.toString()) ; +// } +// jsonarry = JSONArray.fromObject(jsondata); +// } +// return jsonarry.toString() ; +// }*/ + + /** + * 获取 kafka 当前条数 + * 启动一个任务最先调用的就是这个方法 + * @param paramMap + * @return + * @throws RemoteException + */ + @Override + public int getNowKafkaNum(Map paramMap) throws RemoteException{ + LOG.info("[TaskManagerImpl] getNowKafkaNum param : " + JsonUtils.toJSONString(paramMap)); + String kafkaName = paramMap.get("kafkaName").toString() ; + int readNum = 0 ; + if(ListenTaskManager.listenKafkaManagers.size() > 0){ + ListenKafkaManager listenKafkaManager = ListenTaskManager.listenKafkaManagers.get(kafkaName) ; + readNum = listenKafkaManager.getReadKafkaNum() ; + } + LOG.info("[TaskManagerImpl] getNowKafkaNum readNum : " + readNum); + return readNum ; + } + +// public static void main(String[] args) { +// List jsondata = new ArrayList(); +// Map newKafkaValue = new HashMap(); +// newKafkaValue.put("name", "zs"); +// newKafkaValue.put("age", 1); +// JSONObject object = JSONObject.fromObject(newKafkaValue); +// jsondata.add(object.toString()); +// System.out.println(JSONArray.fromObject(jsondata).toString()); +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/AreaCategoryMappingUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/AreaCategoryMappingUtils.java new file mode 100644 index 0000000..dc66499 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/AreaCategoryMappingUtils.java @@ -0,0 +1,33 @@ +package com.bfd.mf.service.tools; + + +import com.bfd.mf.entity.AreaCategoryEntity; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class AreaCategoryMappingUtils { + + public static Set set = new HashSet<>(); + + public static List DIRECT_CITY = new ArrayList<>(); + + public AreaCategoryMappingUtils(){ + try { + DIRECT_CITY.add("北京"); + DIRECT_CITY.add("天津"); + DIRECT_CITY.add("上海"); + DIRECT_CITY.add("重庆"); +// codisUtils = new CodisUtils(); +// set = new HashSet<>(JSON.parseArray(codisUtils.get("dict"), AreaCategoryEntity.class)); + }catch(Exception e){ + e.printStackTrace(); + } + } +// public static void main(String[] args) { +// AreaCategoryMappingUtils areaCategoryMappingUtils = new AreaCategoryMappingUtils(); +// System.out.println(JsonUtils.toJSONString(set)); +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/BfdJodis.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/BfdJodis.java new file mode 100644 index 0000000..2fedf77 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/BfdJodis.java @@ -0,0 +1,1287 @@ +/* + * Copyright (C) 2016 Baifendian Corporation + *

    + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

    + * http://www.apache.org/licenses/LICENSE-2.0 + *

    + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.bfd.mf.service.tools; + +import com.bfd.nlp.common.util.object.TObjectUtils; +import com.wandoulabs.jodis.JedisResourcePool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPoolConfig; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @author: EricLiutyy (Zheng Liu) + * @date: 16/8/13 13:46 + * @description: BFD Codis client for business ID based codis cluster + *

    + *  1) Add Exception Processing logic
    + *  2) Add binary object support
    + *  3) Add necessary log
    + *
    + *  TODO: Code Restructure
    + *
    + *  
    + */ + +public class BfdJodis { + + private static Logger logger = LoggerFactory.getLogger(BfdJodis.class); + + private JedisResourcePool jedisPool = null; + private String businessID = ""; + + /** + * @param zkAddr ZooKeeper connect string. e.g., "zk1:2181" + * @param zkSessionTimeoutMs ZooKeeper session timeout in ms + * @param zkPath the codis proxy dir on ZooKeeper. e.g., "/zk/codis/db_xxx/proxy" + * @param poolConfig same as JedisPool + * @param timeout timeout of JedisPool + * @param businessID your business ID + */ + public BfdJodis(String zkAddr, int zkSessionTimeoutMs, String zkPath, + JedisPoolConfig poolConfig, int timeout, String businessID) { + + this.jedisPool = new RoundRobinJedisPool(zkAddr, zkSessionTimeoutMs, zkPath, poolConfig, + timeout); + this.businessID = businessID; + } + + /** + * @param zkAddr ZooKeeper connect string. e.g., "zk1:2181" + * @param zkSessionTimeoutMs ZooKeeper session timeout in ms + * @param zkPath the codis proxy dir on ZooKeeper. e.g., "/zk/codis/db_xxx/proxy" + * @param poolConfig same as JedisPool + * @param businessID your business ID + */ + public BfdJodis(String zkAddr, int zkSessionTimeoutMs, String zkPath, + JedisPoolConfig poolConfig, String businessID) { + + this.jedisPool = new RoundRobinJedisPool(zkAddr, zkSessionTimeoutMs, zkPath, poolConfig); + this.businessID = businessID; + } + + private String AddBid(String key) { + return this.businessID + '_' + key; + } + + private String[] AddBids(String... keys) { + String[] ret = new String[keys.length]; + for (int i = 0; i < keys.length; i++) { + ret[i] = this.businessID + '_' + keys[i]; + } + return ret; + } + + private String[] AddBidsDiv(String... keys) throws ValueException { + String[] ret = new String[keys.length]; + for (int i = 0; i < keys.length; i++) { + if (0 == (i % 2)) { + ret[i] = this.businessID + '_' + keys[i]; + } else if (keys[i].length() > 1048576) { + throw new ValueException("the value is too bigger than 1M"); + } + ret[i] = keys[i]; + } + return ret; + } + + public String set(final String key, String value) throws ValueException { + if (value.length() > 1048576) { + throw new ValueException("the value is too bigger than 1M"); + } + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return jediscon.set(AddBid(key), value); + } catch (Exception e) { + logger.error("[BfdJodis] Failed to set data to Codis, e = {}", e.getMessage(), e); + return "ERROR"; + } finally { + if (jediscon != null) { + jediscon.close(); + } + } + } + + + public String setexBytes(final String key, int seconds, final byte[] value) { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.setex(AddBid(key).getBytes(), seconds, value); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.setex(AddBid(key).getBytes(), seconds, value); + jediscon.close(); + return ret; + } + } + + + public String setBytes(final String key, final byte[] value) { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.set(AddBid(key).getBytes(), value); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.set(AddBid(key).getBytes(), value); + jediscon.close(); + return ret; + } + } + + /** + * Eric Added + */ + public String setObject(final String key, final Object value) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return jediscon.set(AddBid(key).getBytes(), TObjectUtils.serialize(value)); + } catch (Exception e) { + logger.error("[BfdJodis] Set Object error...", e); + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + return "FAIL"; + } + + + public byte[] getBytes(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + byte[] ret = jediscon.get(AddBid(key).getBytes()); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + byte[] ret = jediscon.get(AddBid(key).getBytes()); + jediscon.close(); + return ret; + } + } + + public String get(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.get(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.get(AddBid(key)); + jediscon.close(); + return ret; + } + } + + /** + * Eric Added

    Get Object from queue + */ + public Object getObject(final String key) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return TObjectUtils.unserialize(jediscon.get(AddBid(key).getBytes())); + } catch (Exception e) { + logger.error("[BfdJodis] Failed to get object from Codis...", e); + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + return null; + } + + public List mget(final String... keys) { + try { + Jedis jediscon = jedisPool.getResource(); + List ret = jediscon.mget(AddBids(keys)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + List ret = jediscon.mget(AddBids(keys)); + jediscon.close(); + return ret; + } + } + + public String mset(final String... keysvalues) throws ValueException { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.mset(AddBidsDiv(keysvalues)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.mset(AddBidsDiv(keysvalues)); + jediscon.close(); + return ret; + } + } + + + public Boolean exists(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + Boolean ret = jediscon.exists(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Boolean ret = jediscon.exists(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public Long del(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.del(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.del(AddBid(key)); + jediscon.close(); + return ret; + } + } + + /** + * Eric Added

    Delete object by bytes key + */ + public Long delObject(final String key) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return jediscon.del(AddBid(key).getBytes()); + } catch (Exception e) { + logger.error("[BfdJodis] Failed to delete object from Codis...", e); + return -1L; + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + } + + public Long del(final String... keys) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.del(AddBids(keys)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.del(AddBids(keys)); + jediscon.close(); + return ret; + } + } + + public String type(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.type(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.type(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public Long expire(final String key, final int seconds) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.expire(AddBid(key), seconds); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.expire(AddBid(key), seconds); + jediscon.close(); + return ret; + } + } + + /** + * Set with expire time + */ + public String setex(final String key, final int seconds, String value) throws ValueException { + if (value.length() > 1048576) { + throw new ValueException("the value is too bigger than 1M"); + } + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return jediscon.setex(AddBid(key), seconds, value); + } catch (Exception e) { + logger.error("[BfdJodis] Failed to set data to Codis, e = {}", e.getMessage(), e); + return "ERROR"; + } finally { + if (jediscon != null) { + jediscon.close(); + } + } + } + + public Long setnx(final String key, final String value) throws ValueException { + if (value.length() > 1048576) { + throw new ValueException("the value is too bigger than 1M"); + } + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.setnx(AddBid(key), value); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.setnx(AddBid(key), value); + jediscon.close(); + return ret; + } + } + + public boolean setnxWithExpire(final String key, final String value, long expireSeconds) + throws Exception { + Jedis jediscon = null; + try { + if (value.length() > 1048576) { + throw new ValueException("the value is too bigger than 1M"); + } + + jediscon = jedisPool.getResource(); + String wrapperKey = AddBid(key); + String ret = jediscon.set(wrapperKey, value, "nx", "ex", expireSeconds); + logger.info("[BfdJodis] Execute setnxWithExpire succeed, key: {}, expire: {} s.", wrapperKey, + expireSeconds); + return ret != null; + } finally { + if (jediscon != null) { + jediscon.close(); + } + } + } + + public String getSet(final String key, final String value) throws ValueException { + if (value.length() > 1048576) { + throw new ValueException("the value is too bigger than 1M"); + } + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.getSet(AddBid(key), value); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.getSet(AddBid(key), value); + jediscon.close(); + return ret; + } + } + + public Long decr(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.decr(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.decr(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public Long incr(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.incr(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.incr(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public Long incrBy(final String key, final long integer) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.incrBy(AddBid(key), integer); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.incrBy(AddBid(key), integer); + jediscon.close(); + return ret; + } + } + + public Long decrBy(final String key, final long integer) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.decrBy(AddBid(key), integer); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.decrBy(AddBid(key), integer); + jediscon.close(); + return ret; + } + } + + public Long append(final String key, final String value) throws ValueException { + if (value.length() > 1048576) { + throw new ValueException("the value is too bigger than 1M"); + } + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.append(AddBid(key), value); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.append(AddBid(key), value); + jediscon.close(); + return ret; + } + } + + public Long llen(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.llen(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.llen(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public List lrange(final String key, final long start, final long end) { + try { + Jedis jediscon = jedisPool.getResource(); + List ret = jediscon.lrange(AddBid(key), start, end); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + List ret = jediscon.lrange(AddBid(key), start, end); + jediscon.close(); + return ret; + } + } + + /** + * Eric Added + */ + public List lrangeObject(final String key, final long start, final long end) { + Jedis jediscon = null; + List list = null; + try { + jediscon = jedisPool.getResource(); + List ret = jediscon.lrange(AddBid(key).getBytes(), start, end); + list = new ArrayList(); + for (byte[] obj : ret) { + list.add(TObjectUtils.unserialize(obj)); + } + + } catch (Exception e) { + logger.error("[BfdJodis] Failed to lrangeObject data from queue...", e); + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + return list; + } + + public String ltrim(final String key, final long start, final long end) { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.ltrim(AddBid(key), start, end); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.ltrim(AddBid(key), start, end); + jediscon.close(); + return ret; + } + } + + public String lset(final String key, final long index, final String value) throws ValueException { + if (value.length() > 1048576) { + throw new ValueException("the value is too bigger than 1M"); + } + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.lset(AddBid(key), index, value); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.lset(AddBid(key), index, value); + jediscon.close(); + return ret; + } + } + + public Long lrem(final String key, final long count, final String value) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.lrem(AddBid(key), count, value); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.lrem(AddBid(key), count, value); + jediscon.close(); + return ret; + } + } + + public String lpop(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.lpop(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.lpop(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public Long lpush(final String key, final String... strings) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.lpush(AddBid(key), strings); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.lpush(AddBid(key), strings); + jediscon.close(); + return ret; + } + } + + /** + * Added by Eric

    LPush Object list + */ + public void lpushObject(final String key, final List objects) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + for (Object o : objects) { + try { + Long ret = jediscon.lpush(AddBid(key).getBytes(), TObjectUtils.serialize(o)); + logger.info("[BfdJodis] lpush, key : {}, value: {}, ret: {}", AddBid(key), + o, ret); + } catch (Exception e) { + logger.error("[BfdJodis] Error adding object to queue. o = {}", o); + } + } + } catch (Exception e) { + logger.error("[BfdJodis] Failed to lpush object list to codis...", e); + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + } + + + public Long rpush(final String key, final String... strings) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.rpush(AddBid(key), strings); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.rpush(AddBid(key), strings); + jediscon.close(); + return ret; + } + } + + /** + * Added by Eric

    LPush Object list + */ + public void rpushObject(final String key, final List objects) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + for (Object o : objects) { + try { + Long ret = jediscon.rpushx(AddBid(key).getBytes(), TObjectUtils.serialize(o)); + } catch (Exception e) { + logger.error("[BfdJodis] Error adding object to queue. o = {}", o); + } + } + } catch (Exception e) { + logger.error("[BfdJodis] Failed to rpush object list to codis...", e); + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + } + + public String rpop(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.rpop(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.rpop(AddBid(key)); + jediscon.close(); + return ret; + } + } + + + /** + * Added by Eric

    Get object with rpop + */ + public Object lpopObject(final String key) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return TObjectUtils.unserialize(jediscon.lpop(AddBid(key).getBytes())); + } catch (Exception e) { + logger.error("[BfdJodis] Failed to get object with lpopObject...", e); + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + return null; + } + + /** + * Added by Eric

    Get object with rpop + */ + public Object rpopObject(final String key) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return TObjectUtils.unserialize(jediscon.rpop(AddBid(key).getBytes())); + } catch (Exception e) { + logger.error("[BfdJodis] Failed to get object with rpopObject...", e); + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + return null; + } + + + /** + * Added by Eric + */ + public Object hgetObject(final String key, final String field) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return TObjectUtils.unserialize(jediscon.hget(AddBid(key).getBytes(), field.getBytes())); + } catch (Exception e) { + logger.error("[BfdJodis] Failed to hgetObject object from codis map, k: {}, v: {}...", key, + field, e); + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + return null; + } + + /** + * Added by Eric + */ + public Long hsetObject(final String key, final String field, final Object value) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return jediscon.hset(AddBid(key).getBytes(), field.getBytes(), TObjectUtils.serialize(value)); + } catch (Exception e) { + logger.error("[BfdJodis] Failed to hsetObject object into codis map, k: {}, v: {}...", key, + field, e); + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + return -1L; + } + + /** + * Added by Eric + */ + public boolean hexistObject(final String key, final String field) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return jediscon.hexists(AddBid(key).getBytes(), field.getBytes()); + } catch (Exception e) { + logger.error("[BfdJodis] Failed to check object in map, k: {}, v: {}...", key, field, e); + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + return false; + } + + /** + * Added by Eric + */ + public Long hdelObject(final String key, final String field) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return jediscon.hdel(AddBid(key).getBytes(), field.getBytes()); + } catch (Exception e) { + logger.error("[BfdJodis] Failed to delete object in map, k: {}, v: {}...", key, field, e); + } finally { + if (null != jediscon) { + jediscon.close(); + } + } + return -1L; + } + + + public String spop(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.spop(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.spop(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public Long scard(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.scard(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.scard(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public Boolean sismember(final String key, final String member) { + try { + Jedis jediscon = jedisPool.getResource(); + Boolean ret = jediscon.sismember(AddBid(key), member); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Boolean ret = jediscon.sismember(AddBid(key), member); + jediscon.close(); + return ret; + } + } + + public Set smembers(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + Set ret = jediscon.smembers(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Set ret = jediscon.smembers(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public Long sadd(final String key, final String... members) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.sadd(AddBid(key), members); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.sadd(AddBid(key), members); + jediscon.close(); + return ret; + } + } + + public Long srem(final String key, final String... members) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.srem(AddBid(key), members); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.srem(AddBid(key), members); + jediscon.close(); + return ret; + } + } + + public Long zadd(final String key, final double score, final String member) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zadd(AddBid(key), score, member); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zadd(AddBid(key), score, member); + jediscon.close(); + return ret; + } + } + + public Double zincrby(final String key, final double score, final String member) { + try { + Jedis jediscon = jedisPool.getResource(); + Double ret = jediscon.zincrby(AddBid(key), score, member); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Double ret = jediscon.zincrby(AddBid(key), score, member); + jediscon.close(); + return ret; + } + } + + public Long zrem(final String key, final String... members) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zrem(AddBid(key), members); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zrem(AddBid(key), members); + jediscon.close(); + return ret; + } + } + + public Long zrank(final String key, final String member) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zrank(AddBid(key), member); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zrank(AddBid(key), member); + jediscon.close(); + return ret; + } + } + + public Long zrevrank(final String key, final String member) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zrevrank(AddBid(key), member); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zrevrank(AddBid(key), member); + jediscon.close(); + return ret; + } + } + + public Set zrange(final String key, final long start, final long end) { + try { + Jedis jediscon = jedisPool.getResource(); + Set ret = jediscon.zrange(AddBid(key), start, end); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Set ret = jediscon.zrange(AddBid(key), start, end); + jediscon.close(); + return ret; + } + } + + public Set zrevrange(final String key, final long start, final long end) { + try { + Jedis jediscon = jedisPool.getResource(); + Set ret = jediscon.zrevrange(AddBid(key), start, end); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Set ret = jediscon.zrevrange(AddBid(key), start, end); + jediscon.close(); + return ret; + } + } + + public Set zrangeByScore(final String key, final double min, final double max) { + try { + Jedis jediscon = jedisPool.getResource(); + Set ret = jediscon.zrangeByScore(AddBid(key), min, max); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Set ret = jediscon.zrangeByScore(AddBid(key), min, max); + jediscon.close(); + return ret; + } + } + + public Long zcount(final String key, final double min, final double max) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zcount(AddBid(key), min, max); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zcount(AddBid(key), min, max); + jediscon.close(); + return ret; + } + } + + public Long zcard(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zcard(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zcard(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public Double zscore(final String key, final String member) { + try { + Jedis jediscon = jedisPool.getResource(); + Double ret = jediscon.zscore(AddBid(key), member); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Double ret = jediscon.zscore(AddBid(key), member); + jediscon.close(); + return ret; + } + } + + public Long zremrangeByRank(final String key, final long start, final long end) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zremrangeByRank(AddBid(key), start, end); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zremrangeByRank(AddBid(key), start, end); + jediscon.close(); + return ret; + } + } + + public Long zremrangeByScore(final String key, final double start, final double end) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zremrangeByScore(AddBid(key), start, end); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.zremrangeByScore(AddBid(key), start, end); + jediscon.close(); + return ret; + } + } + + public Long hset(final String key, final String field, final String value) throws ValueException { + if (value.length() > 1048576) { + throw new ValueException("the value is too bigger than 1M"); + } + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.hset(AddBid(key), field, value); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.hset(AddBid(key), field, value); + jediscon.close(); + return ret; + } + } + + + public String hget(final String key, final String field) { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.hget(AddBid(key), field); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.hget(AddBid(key), field); + jediscon.close(); + return ret; + } + } + + public List hmget(final String key, final String... fields) { + try { + Jedis jediscon = jedisPool.getResource(); + List ret = jediscon.hmget(AddBid(key), fields); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + List ret = jediscon.hmget(AddBid(key), fields); + jediscon.close(); + return ret; + } + } + + public String hmset(final String key, final Map hash) { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.hmset(AddBid(key), hash); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.hmset(AddBid(key), hash); + jediscon.close(); + return ret; + } + } + + /** + * Monified by Eric + */ + public Long hincrBy(final String key, final String field, final long value) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return jediscon.hincrBy(AddBid(key), field, value); + } catch (Exception e) { + logger.error("[BfdJodis] hincrBy Exception, e = {}", e.getMessage(), e); + return -1L; + } finally { + if (jediscon != null) { + jediscon.close(); + } + } + } + + public Boolean hexists(final String key, final String field) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + return jediscon.hexists(AddBid(key), field); + } catch (Exception e) { + logger.error("[BfdJodis] hexists Exception, e = {}", e.getMessage(), e); + } finally { + if (jediscon != null) { + jediscon.close(); + } + } + return Boolean.FALSE; + } + + public Long hdel(final String key, final String... fields) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.hdel(AddBid(key), fields); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.hdel(AddBid(key), fields); + jediscon.close(); + return ret; + } + } + + public Long hlen(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.hlen(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.hlen(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public Set hkeys(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + Set ret = jediscon.hkeys(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Set ret = jediscon.hkeys(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public List hvals(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + List ret = jediscon.hvals(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + List ret = jediscon.hvals(AddBid(key)); + jediscon.close(); + return ret; + } + } + + /*** + * @Fixed corrected by quanyou.chang + * @param key + * @return + */ + public Map hgetAll(final String key) { + Jedis jediscon = null; + try { + jediscon = jedisPool.getResource(); + Map ret = jediscon.hgetAll(AddBid(key)); + return ret; + } catch (Exception e) { + logger.error("[BfdJodis] hincrBy Exception, e = {}", e.getMessage(), e); + return null; + } finally { + if (jediscon != null) { + jediscon.close(); + } + } + } + + public Long pfadd(final String key, final String... strings) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.pfadd(AddBid(key), strings); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.pfadd(AddBid(key), strings); + jediscon.close(); + return ret; + } + } + + public Long pfcount(final String key) { + try { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.pfcount(AddBid(key)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + Long ret = jediscon.pfcount(AddBid(key)); + jediscon.close(); + return ret; + } + } + + public String pfmerge(final String key, final String... strings) { + try { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.pfmerge(AddBid(key), AddBids(strings)); + jediscon.close(); + return ret; + } catch (Exception e) { + Jedis jediscon = jedisPool.getResource(); + String ret = jediscon.pfmerge(AddBid(key), AddBids(strings)); + jediscon.close(); + return ret; + } + } + + public Long hsetnx(final String key, final String field, final String value) { + try (Jedis jedis = jedisPool.getResource()) { + return jedis.hsetnx(AddBid(key), field, value); + } catch (Exception e) { + logger.error("hsetnx统计出现异常" + e); + return -1l; + } + } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/CharUtil.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/CharUtil.java new file mode 100644 index 0000000..f8981ca --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/CharUtil.java @@ -0,0 +1,66 @@ +package com.bfd.mf.service.tools; + +import java.util.regex.Pattern; + +public class CharUtil { + +// public static void main(String[] args) { +// String[] strArr = new String[] { "腾马化:竞争到最后都是人品的竞争","www.micmiu.com", "!@#$%^&*()_+{}[]|\"'?/:;<>,.", "!¥……()——:;“”‘’《》,。?、", "不要啊", "やめて", "韩佳人", "???" }; +// for (String str : strArr) { +// System.out.println("===========> 测试字符串:" + str); +// System.out.println("正则判断结果:" + isChineseByREG(str) + " -- " + isChineseByName(str)); +// System.out.println("Unicode判断结果 :" + isChinese(str)); +// System.out.println("详细判断列表:"); +// char[] ch = str.toCharArray(); +// for (int i = 0; i < ch.length; i++) { +// char c = ch[i]; +// System.out.println(c + " --> " + (isChinese(c) ? "是" : "否")); +// } +// } +// } + + // 根据Unicode编码完美的判断中文汉字和符号 + private static boolean isChinese(char c) { + Character.UnicodeBlock ub = Character.UnicodeBlock.of(c); + if (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS + || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B + || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS + || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION) { + return true; + } + return false; + } + + // 完整的判断中文汉字和符号 + public static boolean isChinese(String strName) { + char[] ch = strName.toCharArray(); + for (int i = 0; i < ch.length; i++) { + char c = ch[i]; + if (isChinese(c)) { + return true; + } + } + return false; + } + + // 只能判断部分CJK字符(CJK统一汉字) + public static boolean isChineseByREG(String str) { + if (str == null) { + return false; + } + Pattern pattern = Pattern.compile("[\\u4E00-\\u9FBF]+"); + return pattern.matcher(str.trim()).find(); + } + + // 只能判断部分CJK字符(CJK统一汉字) + public static boolean isChineseByName(String str) { + if (str == null) { + return false; + } + // 大小写不同:\\p 表示包含,\\P 表示不包含 + // \\p{Cn} 的意思为 Unicode 中未被定义字符的编码,\\P{Cn} 就表示 Unicode中已经被定义字符的编码 + String reg = "\\p{InCJK Unified Ideographs}&&\\P{Cn}"; + Pattern pattern = Pattern.compile(reg); + return pattern.matcher(str.trim()).find(); + } +} \ No newline at end of file diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/CodisUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/CodisUtils.java new file mode 100644 index 0000000..7c6e0e5 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/CodisUtils.java @@ -0,0 +1,191 @@ +package com.bfd.mf.service.tools; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import redis.clients.jedis.JedisPoolConfig; + +import java.util.List; +import java.util.Set; + + +/** + * Created by BFD_377 on 2016/8/31. + */ +public class CodisUtils { + private static Logger logger = LoggerFactory.getLogger(CodisUtils.class); + + private BfdJodis bfdJodis = null; + /** + * 业务主键 + */ + private String businessId = null; + + public String type = ""; + + + public CodisUtils() { + try { + this.businessId = "mf_area_mapping" ; + JedisPoolConfig poolConfig = new JedisPoolConfig(); + bfdJodis = new BfdJodis("172.18.1.147:2182,172.18.1.148:2182,172.18.1.145:2182", 20000, "/zk/codis/db_MediaForceV3/proxy", poolConfig, 3000, businessId); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } + + + /*** + * 从coids当中获取实体名称,以及对应的别名 + * @return + */ + public JSONObject getEntryLists() { + JSONObject jsonObject = new JSONObject(); + + Set keysSet = bfdJodis.hkeys(businessId); + + for (String key : keysSet) { + logger.info("[CodisUtils Model] get Entry Name,the name is {}", key); + String sysWords = bfdJodis.hgetObject(businessId, key).toString(); + jsonObject.put(key, JSONArray.parseArray(sysWords)); + } + return jsonObject; + } + + public Object getObject(String key) { + + return bfdJodis.hgetObject(businessId, key); + + } + + + public Long delByBusinessId() { + return bfdJodis.del(businessId); + } + + + /** + * 设置类map结构 bussinessId_key, name, value + * + * @param key + * @param field + * @param object + * @return + */ + public long hsetObject(String key, String field, Object object) { + try { + return bfdJodis.hsetObject(key, field, object); + } catch (Exception e) { + e.printStackTrace(); + return -1l; + } + } + + /** + * 返回数量 + * + * @param key + * @return + */ + public int hgetObject(String key) { + try { + return Integer.parseInt(bfdJodis.hgetObject(businessId, key).toString()); + } catch (Exception e) { + e.printStackTrace(); + } + return 0; + } + + + /** + * 实现分布式锁 + * + * @param key + * @param value + * @return + */ + public Long setnx(String key, String value) { + try { + return bfdJodis.setnx(key, value); + } catch (ValueException e) { + e.printStackTrace(); + return null; + } + } + + + /** + * 统计次数 + * + * @param key + * @return + */ + public Long incr(String key) { + return bfdJodis.incr(key); + } + + + /** + * + */ + public String set(String key,String value){ + try { + return bfdJodis.set(key, value); + } catch (ValueException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 获取之前的值,设置现在的值 + * + * @param key + * @param value + * @return + */ + public String getSet(String key, String value) { + try { + return bfdJodis.getSet(key, value); + } catch (ValueException e) { + e.printStackTrace(); + return null; + } + } + + public String get(String key) { + String result = bfdJodis.get(key); + logger.info("get current key from codis:" + businessId +"_"+key,"the result is "+result); + return result; + } + + + public Long hIncrBy(String key, String field, long val) { + try { + return bfdJodis.hincrBy(key, field, val); + } catch (Exception e) { + return bfdJodis.hincrBy(key, field, val); + } + } + + + public Long hsetnx(String key, String field, String value) { + return bfdJodis.hsetnx(key, field, value); + } + public Long append(String key, String value) { + try { + return bfdJodis.append(key, value); + } catch (ValueException e) { + e.printStackTrace(); + } + return 0L; + } + + public List lrange(String key){ + return bfdJodis.lrange(key, 0, -1); + } + + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/CustomStopWordsProvider.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/CustomStopWordsProvider.java new file mode 100644 index 0000000..c924f5d --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/CustomStopWordsProvider.java @@ -0,0 +1,36 @@ +package com.bfd.mf.service.tools; + + +import net.sf.classifier4J.IStopWordProvider; +import net.sf.classifier4J.util.ToStringBuilder; + +import java.util.Arrays; + +/** + * Created by Changquanyou on 2017/9/8. + */ +public class CustomStopWordsProvider implements IStopWordProvider { + private String[] stopWords = (String[]) DataTypeSelectUtils.getStopEnDictSets().toArray(new String[0]); + private String[] sortedStopWords = null; + + public CustomStopWordsProvider() { + this.sortedStopWords = this.getStopWords(); + Arrays.sort(this.sortedStopWords); + } + + public String[] getStopWords() { + return this.stopWords; + } + + public boolean isStopWord(String word) { + return word != null && !"".equals(word)?Arrays.binarySearch(this.sortedStopWords, word.toLowerCase()) >= 0:false; + } + + public String toString() { + return (new ToStringBuilder(this)).append("stopWords.size()", (double)this.sortedStopWords.length).toString(); + } + +// public static void main(String[] args) { +// System.out.println(new CustomStopWordsProvider()); +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DBConnectionManager.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DBConnectionManager.java new file mode 100644 index 0000000..4b911e0 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DBConnectionManager.java @@ -0,0 +1,226 @@ +package com.bfd.mf.service.tools; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.*; + +public class DBConnectionManager { + + private static DBConnectionManager m_dbInstance; + + private static int m_ClientNum; + + @SuppressWarnings("rawtypes") + private Vector drivers = new Vector(); + @SuppressWarnings("rawtypes") + private Hashtable pools = new Hashtable(); + public int nCount; + public int iConID; + + public static synchronized DBConnectionManager getInstance(String name) { + if (m_dbInstance == null) + m_dbInstance = new DBConnectionManager(name); + m_ClientNum++; + return m_dbInstance; + } + + private DBConnectionManager(String name) { + init(name); + } + + public void freeConnection(String name, Connection con) { + DBConnectionPool pool = (DBConnectionPool) pools.get(name); + if (pool != null) { + pool.freeConnection(con); + } + } + + public Connection getConnection(String name) { + DBConnectionPool pool = (DBConnectionPool) pools.get(name); + if (pool != null) + return pool.getConnection(); + return null; + } + + public Connection getConnection(String name, long time) { + DBConnectionPool pool = (DBConnectionPool) pools.get(name); + if (pool != null) { + return pool.getConnection(time); + } + return null; + } + + @SuppressWarnings("rawtypes") + public void release() { + if (--m_ClientNum != 0) + return; + Enumeration allPools = pools.elements(); + while (allPools.hasMoreElements()) { + DBConnectionPool pool = (DBConnectionPool) allPools.nextElement(); + pool.release(); + } + Enumeration allDrivers = drivers.elements(); + while (allDrivers.hasMoreElements()) { + Driver driver = (Driver) allDrivers.nextElement(); + try { + DriverManager.deregisterDriver(driver); + } catch (SQLException e) { + } + } + System.gc(); + } + + @SuppressWarnings({ "unchecked"}) + private void createPools(Map props) { + Set propNames = props.keySet(); + for(String name:propNames){ + if (name.endsWith(".url")) { + String poolName = name.substring(0, name.lastIndexOf(".")); + String url = props.get(poolName + ".url"); + if (url == null) { + continue; + } + String user = props.get(poolName + ".user"); + String password = props.get(poolName + ".password"); + String maxconn="0"; + if(props.containsKey(poolName + ".maxconn")) + maxconn = props.get(poolName + ".maxconn"); + else + maxconn = "50"; + int max = 0; + try { + max = Integer.parseInt(maxconn); + } catch (Exception e) { + max = 50; + } + + DBConnectionPool pool = new DBConnectionPool(poolName, url, user, password, max); + pools.put(poolName, pool); + } + + } + } + + private void init(String name) { + Map config=PropertiesUtil.getProperties(name); + + if(config==null){ + System.exit(-1); + } + + loadDrivers(config); + createPools(config); + } + + @SuppressWarnings("unchecked") + private void loadDrivers(Map props) { + String driverClasses = props.get("drivers"); + StringTokenizer st = new StringTokenizer(driverClasses); + while (st.hasMoreElements()) { + String driverClassName = st.nextToken().trim(); + try { + Driver driver = (Driver) Class.forName(driverClassName).newInstance(); + DriverManager.registerDriver(driver); + drivers.addElement(driver); + } catch (Exception e) { + } + } + } + + class DBConnectionPool { + private int checkedOut; + @SuppressWarnings("rawtypes") + private Vector freeConnections = new Vector(); + private int maxConn; + private String name; + private String password; + private String URL; + private String user; + + public DBConnectionPool(String name, String URL, String user, String password, int maxConn) { + this.name = name; + this.URL = URL; + this.user = user; + this.password = password; + this.maxConn = maxConn; + } + + @SuppressWarnings("unchecked") + public synchronized void freeConnection(Connection con) { + freeConnections.addElement(con); + checkedOut--; + notifyAll(); + } + + @SuppressWarnings("resource") + public synchronized Connection getConnection() { + Connection con = null; + if (freeConnections.size() > 0) { + con = (Connection) freeConnections.firstElement(); + freeConnections.removeElementAt(0); + try { + if (con.isClosed() || !con.isValid(2)) { + checkedOut--; + con = null; + con = getConnection(); + } + } catch (SQLException e) { + checkedOut--; + con = null; + con = getConnection(); + } + } else if (maxConn == 0 || checkedOut < maxConn) { + con = newConnection(); + }else{ + } + + if (con != null) { + checkedOut++; + } + return con; + } + + public synchronized Connection getConnection(long timeout) { + long startTime = 0; + Connection con; + while ((con = getConnection()) == null) { + try { + wait(timeout); + } catch (InterruptedException e) { + } + if (startTime++ >= timeout) { + return null; + } + } + return con; + } + + @SuppressWarnings("rawtypes") + public synchronized void release() { + Enumeration allConnections = freeConnections.elements(); + while (allConnections.hasMoreElements()) { + Connection con = (Connection) allConnections.nextElement(); + try { + con.close(); + } catch (SQLException e) { + } + } + freeConnections.removeAllElements(); + } + + private Connection newConnection() { + Connection con = null; + try { + if (user == null) + con = DriverManager.getConnection(URL); + else + con = DriverManager.getConnection(URL, user, password); + } catch (SQLException e) { + return null; + } + return con; + } + } +} \ No newline at end of file diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DBUtil.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DBUtil.java new file mode 100644 index 0000000..1ee241c --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DBUtil.java @@ -0,0 +1,326 @@ +package com.bfd.mf.service.tools; + +import java.sql.*; +import java.util.*; + + +/** + * the operation of the db + * @author ruining.he + * @createTime 2015年5月5日上午10:28:56 + * */ +public class DBUtil { + + private static String etc_path = ""; + private static DBConnectionManager dbManager = null; + private static Map map = Collections.synchronizedMap(new HashMap()); + private String conn_name; + + private DBUtil(String conn){ + if(dbManager==null) + dbManager = DBConnectionManager.getInstance(etc_path); + this.conn_name = conn; + } + + public static void init(String path){ + etc_path = path; + } + + public static DBUtil getInstance(String connectionName){ + if("".equals(etc_path) && dbManager==null){ + System.exit(0); + } + if(map.containsKey(connectionName)) + return map.get(connectionName); + else{ + DBUtil dbUtil = new DBUtil(connectionName); + map.put(connectionName, dbUtil); + return dbUtil; + } + } + + private DBConnectionManager getDBCONConnectionManager(){ + return dbManager; + } + + public List> query(String querySql){ + List> list = new ArrayList>(); + List columns = new ArrayList(); + + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn=null; + while(conn == null){ + conn = dbm.getConnection(conn_name); +// DateUtil.sleep(1); + } + + Statement statement = null; + ResultSet rs = null; + try { + conn.setAutoCommit(false); + statement=conn.createStatement(); + rs=statement.executeQuery(querySql); + ResultSetMetaData data = rs.getMetaData(); + for(int i=1;i<=data.getColumnCount();i++) { + columns.add(data.getColumnName(i)); + } + while(rs.next()) { + HashMap map = new HashMap(); + for(int i=0;i> queryOriginalColumn(String querySql){ + List> list = new ArrayList>(); + List columns = new ArrayList(); + + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn=null; + while(conn == null){ + conn = dbm.getConnection(conn_name); + try { + Thread.currentThread().sleep(1*1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + Statement statement = null; + ResultSet rs = null; + try { + conn.setAutoCommit(false); + statement=conn.createStatement(); + rs=statement.executeQuery(querySql); + ResultSetMetaData data = rs.getMetaData(); + for(int i=1;i<=data.getColumnCount();i++){ + columns.add(data.getColumnName(i)); + } + while(rs.next()){ + HashMap map = new HashMap(); + for(int i=0;i> getQuaryResult(String quartReplyTable,String iid,Object node_name,Object website_source,Object keyword,Object title ,Object url){ + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn=null; + while(conn == null){ + conn = dbm.getConnection(conn_name); + + } + Statement statement = null; + ResultSet rs = null; + String querySql = ""; + try { + conn.setAutoCommit(false); + statement=conn.createStatement(); + rs=statement.executeQuery("select * from "+quartReplyTable+" where iid = '"+iid+"'"); + List> datalist = new ArrayList>(); + while(rs.next()){ + Map dataMap = new HashMap(); + dataMap.put("node_name", node_name); + dataMap.put("website_source", website_source); + dataMap.put("iid", rs.getObject("iid")); + dataMap.put("keyword", keyword); + dataMap.put("title", title); + dataMap.put("url", url); + dataMap.put("node_type", rs.getObject("node_type")); + dataMap.put("authorname", rs.getObject("authorname")); + dataMap.put("publicNumberName", rs.getObject("publicNumberName")); + dataMap.put("newstime", rs.getObject("newstime")); + dataMap.put("contents", rs.getObject("contents")); + dataMap.put("reply_cnt", rs.getObject("reply_cnt")); + dataMap.put("forward_num", rs.getObject("forward_num")); + dataMap.put("reply_up_cnt", rs.getObject("reply_up_cnt")); + dataMap.put("click_num", rs.getObject("click_num")); + int reply_cnt = 0; + if(rs.getObject("reply_cnt") != null){ + reply_cnt = Integer.parseInt((String) rs.getObject("reply_cnt")); + } + int forward_num = 0 ; + if(rs.getObject("forward_num") != null ){ + forward_num = Integer.parseInt((String) rs.getObject("forward_num")); + + } + dataMap.put("integra_sound_vol",1 + reply_cnt + forward_num); + dataMap.put("cate", rs.getObject("cate")); + dataMap.put("page_reply_cnt", rs.getObject("page_reply_cnt")); + dataMap.put("page_forward_num", rs.getObject("page_forward_num")); + datalist.add(dataMap); + + } + + return datalist; + } catch (Exception e) { + } finally{ + try { + if(rs!=null) + rs.close(); + if(statement!=null) + statement.close(); + } catch (Exception e2) { + } + dbm.freeConnection(conn_name, conn); + } + return null; + } + + + public int quaryCount(String querySql){ + + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn=null; + while(conn == null){ + conn = dbm.getConnection(conn_name); + try { + Thread.currentThread().sleep(1*1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + Statement statement = null; + ResultSet rs = null; + try { + conn.setAutoCommit(false); + statement=conn.createStatement(); + rs=statement.executeQuery(querySql); + while(rs.next()){ + return rs.getInt(1); + } + + conn.commit(); + } catch (Exception e) { + } finally{ + try { + if(rs!=null) + rs.close(); + if(statement!=null) + statement.close(); + } catch (Exception e2) { + } + dbm.freeConnection(conn_name, conn); + } + return 0; + + } + + public void executeBatch(List sqlCache){ + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn=null; + while(conn == null){ + conn = dbm.getConnection(conn_name); + } + try { + conn.setAutoCommit(false); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Statement statement = null; + try { + statement = conn.createStatement(); + for (int i = 0; i < sqlCache.size(); i++) { + statement.addBatch(sqlCache.get(i)); + } + statement.executeBatch(); + conn.commit(); + System.out.println("mysql execute batch committed..."); + }catch (Exception bue) { + bue.printStackTrace(); + + }finally{ + if(statement!=null){ + try { + statement.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + if(conn!=null){ + dbm.freeConnection(conn_name, conn); + } + } + + + } + + + public int execute(String sql){ + DBConnectionManager dbm=getDBCONConnectionManager(); + Connection conn= null; + while(conn == null){ + conn = dbm.getConnection(conn_name); +// DateUtil.sleep(1); + } + Statement st = null; + + try { + conn.setAutoCommit(false); + st = conn.createStatement(); + int rs = st.executeUpdate(sql); + conn.commit(); + return rs; +// } catch (com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException e1){ +//// return ConfigCache.CODE_EXIST_IN_DB_AND_NOT_EXIST_IN_DUPLICATE; +// return -10; + }catch (Exception e) { + + }finally{ + try { + if(st!=null) + st.close(); + } catch (Exception e2) { + } + dbm.freeConnection(conn_name, conn); + } + return 0; + } + +// public static void main(String[] args) { +// DBUtil.init("C:\\Users\\BFD_482\\workspace-luna\\etc\\db.properties"); +// List> l = DBUtil.getInstance("show_crawl_conf").query("SELECT * FROM `ecConfig`"); +// List> ll = DBUtil.getInstance("show_crawl_list").query("SELECT * FROM `eclist_000`"); +// +// +// } + +} \ No newline at end of file diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DataCheckUtil.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DataCheckUtil.java new file mode 100644 index 0000000..a627e7e --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DataCheckUtil.java @@ -0,0 +1,298 @@ +package com.bfd.mf.service.tools; + +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +public class DataCheckUtil { + + public static Pattern datePattrn = Pattern.compile("^\\d{4}\\-\\d{2}\\-\\d{2}\\s\\d{2}\\:\\d{2}:\\d{2}$"); + + public static Pattern dayPattrn = Pattern.compile("^\\d{2,4}\\-\\d{1,2}\\-\\d{1,2}$"); + + private static SimpleDateFormat ddf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + public static Pattern p = Pattern.compile("\\s+"); + + private static final Logger LOG = Logger.getLogger(DataCheckUtil.class); + + public static String chechData2(String dataStr){ + dataStr = dataStr.replace("Z",""); + dataStr = checkData(dataStr); + Matcher matcher = datePattrn.matcher(dataStr); + if(!matcher.find()){ + System.out.println("格式错误,使用当前时间 : " + dataStr); + dataStr = DateUtil.getDateTime(); + }else{ + dataStr = matcher.group(0); + } + return dataStr; + } + + public static String checkData(String dataStr){ + SimpleDateFormat ddf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + if(StringUtils.isBlank(dataStr)){ + return ddf.format(new Date()); + } + if(dataStr.contains("-:")){ + dataStr = dataStr.replace("-:",":"); + } + if(dataStr.contains(":-")){ + dataStr = dataStr.replace(":-",":"); + } + + Matcher matcher = datePattrn.matcher(dataStr); + + if(!matcher.find()){ + dataStr = dataStr.trim(); + if(!p.matcher(dataStr).find()){ + if(!dayPattrn.matcher(dataStr).find()){ + return ddf.format(new Date()); + } + } + + String[] dates = dataStr.split("\\s+"); + String years = ""; + String times = ""; + if(dates.length == 2){ + years = dates[0]; + times = dates[1]; + }else{ + years = dates[0]; + } + + if(years.contains("/")){ + years = years.replace("/", "-"); + } + String[] yearStr = years.split("-"); + String yms = "" ; + if(yearStr.length == 3){ + String year = yearStr[0]; + String month = yearStr[1]; + String day = yearStr[2]; + if(year.length() == 2){ + year = "20"+year; + } + if(month.length() == 1){ + month = "0"+month; + } + if(day.length() == 1){ + day = "0"+day; + } + yms = year+"-"+month+"-"+day; + } + + String hms = ""; + if(StringUtils.isBlank(times)){ + hms = "00:00:00"; + }else{ + times = times.replace("/", ":"); + if(times.contains(":")){ + String[] timeStr = times.split(":"); + if( timeStr.length >= 3 ){ + String hours = timeStr[0]; + String mins = timeStr[1]; + String s = timeStr[2]; + + if(hours.length() == 1){ + hours = "0"+hours; + } + if(mins.length() == 1){ + mins = "0"+mins; + } + if(s.length() == 1){ + s = "0"+s; + } + hms = hours+":"+mins+":"+s; + }else if(timeStr.length == 2){ + String hours = timeStr[0]; + String mins = timeStr[1]; + String s = "00"; + if(hours.length() == 1){ + hours = "0"+hours; + } + if(mins.length() == 1){ + mins = "0"+mins; + } + hms = hours+":"+mins+":"+s; + } else { + String hours = timeStr[0]; + String mins = "00" ; + String s = "00"; + if(hours.length() == 1){ + hours = "0"+hours; + } + hms = hours+":"+mins+":"+s; + } + }else{ + if(isNum(times) && times.length()==2){ + hms = times+":00:00"; + }else if(isNum(times) && times.length()==1){ + hms = "0"+times+":00:00"; + }else{ + hms = "00:00:00" ; + } + } + } + if(StringUtils.isBlank(yms)){ + return ddf.format(new Date()); + } + if(yms != "" || hms != ""){ + return yms+" "+hms; + } + } + return dataStr ; + } + + private static boolean isNum(String time){ + Pattern p = Pattern.compile("\\d+"); + if(p.matcher(time).find()){ + return true ; + } + return false ; + } + + public static String convertStringTotime(String datetime){ + if(StringUtils.isBlank(datetime)){ + return DateUtil.getDateTime(System.currentTimeMillis()); + } + String creationTime = ""; + if(datetime.length() == 13){ + creationTime = DateUtil.getDateTime(Long.valueOf(datetime)); + }else{ + creationTime = DateUtil.getDateTime(Long.valueOf(datetime) *1000); + } + return creationTime ; + + } + + public static long convertStringToLong(String datetime){ + if(StringUtils.isBlank(datetime)){ + return System.currentTimeMillis(); + } + long creationTime ; + if(datetime.length() == 13){ + creationTime = Long.valueOf(datetime); + }else{ + creationTime = Long.valueOf(datetime) *1000; + } + return creationTime ; + } + + public static long convertTimeTotime(String datetime){ + if(StringUtils.isBlank(datetime)){ + return System.currentTimeMillis() / 1000; + } + long creationTime ; + if(datetime.length() == 13){ + creationTime = Long.valueOf(datetime) / 1000; + }else{ + creationTime = Long.valueOf(datetime) ; + } + return creationTime ; + + } + + + public static long convertDateTotime(String datetime){ + if(StringUtils.isBlank(datetime)){ + return System.currentTimeMillis() / 1000; + } + long creationTime = 0; + try { + SimpleDateFormat ddf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + creationTime = Long.valueOf(ddf1.parse(datetime).getTime()) / 1000; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return creationTime ; + + } + + public static String getCurrentTime(){ + SimpleDateFormat ddf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return ddf.format(new Date()); + } + + public static String getCurrentTime(long dateTime){ + SimpleDateFormat ddf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return ddf.format(new Date(dateTime)); + } + + public static String getDate(long dateTime){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); + return sdf.format(new Date(dateTime)); + } + + public static String getDate(String dateTime){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); + SimpleDateFormat ddf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + Date date = ddf.parse(dateTime) ; + return sdf.format(date); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + LOG.error("DataCheckUtil getDate() err data:"+dateTime); + + } + return sdf.format(new Date()); + } + + public static long getDay(long dateTime){ + try{ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String dayStr = sdf.format(new Date(dateTime)); + Date date = sdf.parse(dayStr); + return date.getTime(); + }catch(Exception e){ + e.printStackTrace(); + LOG.error("DataCheckUtil getDay() err data:"+dateTime); + } + return 0; + } + + public static long getDay(String dateTime){ + try{ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Date date = sdf.parse(dateTime); + return date.getTime(); + }catch(Exception e){ + e.printStackTrace(); + LOG.error("DataCheckUtil getDay2() err data:"+dateTime); + } + return 0; + } + + +// public static void main(String[] args) { +// //System.out.println(checkData("")); +// /*System.out.println(System.currentTimeMillis()); +// System.out.println(Calendar.getInstance().getTimeInMillis() / 1000); +// System.out.println(new Date().getTime() / 1000); +// System.out.println(DateUtil.getDateTime((System.currentTimeMillis() / 1000) * 1000)); +// System.out.println(convertStringTotime("1558077405")); +// System.out.println(convertTimeTotime(null));*/ +// //System.out.println(DateUtil.getTimeMillis("2019-03-01 01:01:01")); +// +// /*String aa = DataCheckUtil.convertStringTotime("1563245342"); +// System.out.println(aa);*/ +// /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// try { +// Date date = sdf.parse("2019-03-01"); +// System.out.println(date.getTime()); +// } catch (ParseException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// }*/ +// System.out.println(getDate("2019-03-01 01:01:01")); +// } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DataTypeSelectUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DataTypeSelectUtils.java new file mode 100644 index 0000000..440e541 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DataTypeSelectUtils.java @@ -0,0 +1,123 @@ +package com.bfd.mf.service.tools; + +/** + * Created by quanyou.chang@baifendian.com on 2016/8/19. + */ + +import org.apache.log4j.Logger; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * description:数据类型判断-----》media or news + */ +public class DataTypeSelectUtils { + private static final Logger logger = Logger.getLogger(DataTypeSelectUtils.class); + + + private static Set stopDictSets; + + private static Set stopEnDictSets; + + private static Set posTagDictSets; + private static Map cityMapping; + + // private static String indexTemplate = ""; + static{ + try { + stopDictSets = new HashSet<>(); + BufferedReader stopWordsIn = new BufferedReader(new InputStreamReader(new FileInputStream("../etc/stopWords.txt"))); + String stopWord = ""; + while ((stopWord = stopWordsIn.readLine()) != null){ + stopDictSets.add(stopWord); + } + logger.info("The Stop Dict Set Size Is : "+ stopDictSets.size()); + + stopEnDictSets = new HashSet<>(); + BufferedReader stopEnWordsIn = new BufferedReader(new InputStreamReader(new FileInputStream("../etc/stopWordsEN.txt"))); + String stopEnWord = ""; + while ((stopEnWord = stopEnWordsIn.readLine()) != null){ + stopEnDictSets.add(stopEnWord); + } + logger.info("The EN Stop Dict Set Size Is : "+ stopEnDictSets.size()); + + + posTagDictSets = new HashSet<>(); + BufferedReader posTagWordsIn = new BufferedReader(new InputStreamReader(new FileInputStream("../etc/posTag.txt"))); + String posTagWord = ""; + while ((posTagWord = posTagWordsIn.readLine()) != null){ + posTagDictSets.add(posTagWord); + } + logger.info("The Pos Tag Dict Set Size Is : "+ posTagDictSets.size()); + /*cityMapping = new HashMap<>(); + BufferedReader cityMappingIn = new BufferedReader(new InputStreamReader(DataTypeSelectUtils.class.getResourceAsStream("/cityMapping.txt"))); + String cityLine = ""; + while ((cityLine = cityMappingIn.readLine()) != null){ + String[] arrays = cityLine.split(" "); + String province = arrays [0]; + String city = arrays [1]; + cityMapping.put(city,province); + } + logger.info("The City of Province mapping size is : "+ cityMapping.size()); + + BufferedReader indexMappingIn = new BufferedReader(new InputStreamReader(DataTypeSelectUtils.class.getResourceAsStream("/indexTemplate.json"))); + String templateIn; + while ((templateIn = indexMappingIn.readLine()) != null){ + indexTemplate += templateIn; + } + logger.info("The index of index mapping size is : "+ indexTemplate);*/ + + + }catch (Exception e){ + e.printStackTrace(); + logger.error("[DataTypeSelectUtils data type parse error]",e); + System.exit(1); + } + } + + /** + * 停用词列表 + * @return + */ + public static Set getStopDictSets(){ + return stopDictSets; + } + + /** + * EN 停用词列表 + * @return + */ + public static Set getStopEnDictSets(){ + return stopEnDictSets; + } + + /** + * source 修正来源表 + * @return + */ + public static Set getPosTagDictSets(){ + return posTagDictSets; + } + + /** + * city + * province + * @return + */ + /* public static Map getCityMapping(){ + return cityMapping; + }*/ + + /** + * 获取索引列表 + * @return + */ + /* public static String getIndexTemplate(){ + return indexTemplate; + }*/ +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DateUtil.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DateUtil.java new file mode 100644 index 0000000..0680c40 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/DateUtil.java @@ -0,0 +1,868 @@ +package com.bfd.mf.service.tools; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.text.ParseException; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + + +/** + * 日期处理工具类 + */ + +public class DateUtil { + //~ Static fields/initializers ============================================= + + + private static Log log = LogFactory.getLog(DateUtil.class); + private static String defaultDatePattern = null; + private static String timePattern = "HH:mm"; + public static final String TS_FORMAT = DateUtil.getDatePattern() + " HH:mm:ss.S"; + private static Calendar cale = Calendar.getInstance(); + + + //~ Methods ================================================================ + + public DateUtil(){ + } + + /** + * 获得服务器当前日期及时间,以格式为:yyyy-MM-dd HH:mm:ss的日期字符串形式返回 + */ + public static String getDateTime(){ + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return datetime.format(Calendar.getInstance().getTime()); + } catch(Exception e){ + log.debug("DateUtil.getDateTime():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器当前日期及时间,以格式为:yyyy-MM-dd HH:mm:ss的日期字符串形式返回 + */ + public static String getDateTime(long date){ + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return datetime.format(new Date(date)); + } catch(Exception e){ + log.debug("DateUtil.getDateTime():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器当前日期,以格式为:yyyy-MM-dd的日期字符串形式返回 + */ + public static String getDate(){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + return date.format(Calendar.getInstance().getTime()); + } catch(Exception e){ + log.debug("DateUtil.getDate():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器当前时间,以格式为:HH:mm:ss的日期字符串形式返回 + */ + public static String getTime(){ + String temp = ""; + try{ + SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss"); + temp += time.format(cale.getTime()); + return temp; + } catch(Exception e){ + log.debug("DateUtil.getTime():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器当前时间,以格式为:HH:mm:ss的日期字符串形式返回 + */ + public static int getHour(){ + int temp = 0; + try{ + temp = Calendar.getInstance().get(Calendar.HOUR_OF_DAY); + return temp; + } catch(Exception e){ + log.debug("DateUtil.getTime():" + e.getMessage()); + return 0; + } + } + + /** + * 返回日期加X天后的日期 + */ + @SuppressWarnings("static-access") + public static int getHour(String fromdate){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + GregorianCalendar gCal = new GregorianCalendar(); + Date datetime = date.parse(fromdate) ; + gCal.setTime(datetime) ; + return gCal.get(gCal.HOUR_OF_DAY); + } catch(Exception e){ + log.debug("DateUtil.addDay():" + e.toString()); + return 0; + } + } + + + public static int getMinute(){ + int temp = 0; + try{ + temp = Calendar.getInstance().get(Calendar.MINUTE); + return temp; + } catch(Exception e){ + log.debug("DateUtil.getTime():" + e.getMessage()); + return 0; + } + } + + + /** + * 统计时开始日期的默认值, + * 今年的开始时间 + */ + public static String getStartDate(){ + try{ + return getYear() + "-01-01"; + } catch(Exception e){ + log.debug("DateUtil.getStartDate():" + e.getMessage()); + return ""; + } + } + + /** + * 统计时结束日期的默认值 + */ + public static String getEndDate(){ + try{ + return getDate(); + } catch(Exception e){ + log.debug("DateUtil.getEndDate():" + e.getMessage()); + return ""; + } + } + + + /** + * 获得服务器当前日期的年份 + */ + public static String getYear(){ + try{ + //返回的int型,需要字符串转换 + return String.valueOf(cale.get(Calendar.YEAR)); + } catch(Exception e){ + log.debug("DateUtil.getYear():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器当前日期的月份 + */ + public static String getMonth(){ + try{ + //一个数字格式,非常好 + java.text.DecimalFormat df = new java.text.DecimalFormat(); + df.applyPattern("00"); + return df.format((cale.get(Calendar.MONTH) + 1)); + //return String.valueOf(cale.get(Calendar.MONTH) + 1); + } catch(Exception e){ + log.debug("DateUtil.getMonth():" + e.getMessage()); + return ""; + } + } + + /** + * 获得服务器在当前月中天数 + */ + public static String getDay(){ + try{ + return String.valueOf(cale.get(Calendar.DAY_OF_MONTH)); + } catch(Exception e){ + log.debug("DateUtil.getDay():" + e.getMessage()); + return ""; + } + } + + /** + * 比较两个日期相差的天数, + * 第一个日期要比第二个日期要晚 + */ + public static int getDays(String date1,String date2){ + int margin; + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + ParsePosition pos = new ParsePosition(0); + ParsePosition pos1 = new ParsePosition(0); + Date dt1 = date.parse(date1,pos); + Date dt2 = date.parse(date2,pos1); + long l = dt1.getTime() - dt2.getTime(); + margin = (int)(l / (24 * 60 * 60 * 1000)); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getDays():" + e.toString()); + return 0; + } + } + + /** + * 比较两个日期相差的 小时数, + * 第一个日期要比第二个日期要晚 + */ + public static int getHours(String date1,String date2){ + int margin; + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ParsePosition pos = new ParsePosition(0); + ParsePosition pos1 = new ParsePosition(0); + Date dt1 = datetime.parse(date1,pos); + Date dt2 = datetime.parse(date2,pos1); + long l = dt1.getTime() - dt2.getTime(); + margin = (int)(l / ( 60 * 60 * 1000)); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getHours():" + e.toString()); + return 0; + } + } + + /** + * 比较两个日期相差的分钟数, + * 第一个日期要比第二个日期要晚 + */ + public static int getMinutes(String date1,String date2){ + int margin; + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ParsePosition pos = new ParsePosition(0); + ParsePosition pos1 = new ParsePosition(0); + Date dt1 = datetime.parse(date1,pos); + Date dt2 = datetime.parse(date2,pos1); + long l = dt1.getTime() - dt2.getTime(); + margin = (int)(l / ( 60 * 1000)); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getMinutes():" + e.toString()); + return 0; + } + } + + /** + * 返回日期加X天后的日期 + */ + @SuppressWarnings("static-access") + public static int getMinutes(String fromdate){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + GregorianCalendar gCal = new GregorianCalendar(); + Date datetime = date.parse(fromdate) ; + gCal.setTime(datetime) ; + return gCal.get(gCal.MINUTE); + } catch(Exception e){ + log.debug("DateUtil.addDay():" + e.toString()); + return 0; + } + } + + /** + * 比较两个日期相差的秒数, + * 第一个日期要比第二个日期要晚 + */ + public static int getSeconds(String date1,String date2){ + int margin; + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date dt1 = datetime.parse(date1); + Date dt2 = datetime.parse(date2); + long dateintvlong = dt1.getTime() - dt2.getTime(); + margin = (int)(dateintvlong /1000); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getSeconds():" + e.toString()); + return 0; + } + } + + + /** + * 比较两个日期相差的天数,格式不一样 + * 第一个日期要比第二个日期要晚 + */ + public static double getDoubledays(String date1,String date2){ + double margin; + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ParsePosition pos = new ParsePosition(0); + ParsePosition pos1 = new ParsePosition(0); + Date dt1 = datetime.parse(date1,pos); + Date dt2 = datetime.parse(date2,pos1); + long l = dt1.getTime() - dt2.getTime(); + margin = (l / (24 * 60 * 60 * 1000.00)); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getMargin():" + e.toString()); + return 0; + } + } + + + /** + * 比较两个日期相差的月数 + */ + public static int getMonthMargin(String date1,String date2){ + int margin; + try{ + margin = (Integer.parseInt(date2.substring(0,4)) - Integer.parseInt(date1.substring(0,4)))* 12; + margin += (Integer.parseInt(date2.substring(4,7).replaceAll("-0","-")) - Integer.parseInt(date1.substring(4,7).replaceAll("-0","-"))); + return margin; + } catch(Exception e){ + log.debug("DateUtil.getMargin():" + e.toString()); + return 0; + } + } + + /** + * 返回日期加X天后的日期 + */ + public static String addDay(String fromdate,int i){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + GregorianCalendar gCal = new GregorianCalendar(Integer.parseInt(fromdate.substring(0,4)),Integer.parseInt(fromdate.substring(5,7))-1,Integer.parseInt(fromdate.substring(8,10))); + gCal.add(GregorianCalendar.DATE,i); + return date.format(gCal.getTime()); + } catch(Exception e){ + log.debug("DateUtil.addDay():" + e.toString()); + return getDate(); + } + } + + /** + * 返回日期加X天后的日期 + */ + public static String addDay(int i){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + Calendar cale = Calendar.getInstance() ; + cale.add(Calendar.DAY_OF_MONTH, i) ; + return date.format(cale.getTime()); + } catch(Exception e){ + log.debug("DateUtil.addDay():" + e.toString()); + return getDate(); + } + } + + /** + * 返回日期加X月后的日期 + */ + public static String addMonth(String fromdate,int i){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + GregorianCalendar gCal = new GregorianCalendar(Integer.parseInt(fromdate.substring(0,4)),Integer.parseInt(fromdate.substring(5,7))-1,Integer.parseInt(fromdate.substring(8,10))); + gCal.add(GregorianCalendar.MONTH,i); + return date.format(gCal.getTime()); + } catch(Exception e){ + log.debug("DateUtil.addMonth():" + e.toString()); + return getDate(); + } + } + + /** + * 返回日期加X年后的日期 + */ + public static String addYear(String fromdate,int i){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + GregorianCalendar gCal = new GregorianCalendar(Integer.parseInt(fromdate.substring(0,4)),Integer.parseInt(fromdate.substring(5,7))-1,Integer.parseInt(fromdate.substring(8,10))); + gCal.add(GregorianCalendar.YEAR,i); + return date.format(gCal.getTime()); + } catch(Exception e){ + log.debug("DateUtil.addYear():" + e.toString()); + return ""; + } + } + + + /** + * 返回某年某月中的最大天 + */ + public static int getMaxDay(String year,String month){ + int day = 0; + try{ + int iyear = Integer.parseInt(year); + int imonth = Integer.parseInt(month); + if(imonth == 1 || imonth == 3 || imonth == 5 || imonth == 7 || imonth == 8 || imonth == 10 || imonth == 12){ + day = 31; + } else if(imonth == 4 || imonth == 6 || imonth == 9 || imonth == 11){ + day = 30; + } else if((0 == (iyear % 4)) && (0 != (iyear % 100)) || (0 == (iyear % 400))){ + day = 29; + } else{ + day = 28; + } + return day; + } catch(Exception e){ + log.debug("DateUtil.getMonthDay():" + e.toString()); + return 1; + } + } + + + + /** + * 格式化日期 + */ + @SuppressWarnings("static-access") + public String rollDate(String orgDate,int Type,int Span){ + try{ + String temp = ""; + int iyear,imonth,iday; + int iPos = 0; + char seperater = '-'; + if(orgDate == null || orgDate.length() < 6){ + return ""; + } + + iPos = orgDate.indexOf(seperater); + if(iPos > 0){ + iyear = Integer.parseInt(orgDate.substring(0,iPos)); + temp = orgDate.substring(iPos + 1); + } else{ + iyear = Integer.parseInt(orgDate.substring(0,4)); + temp = orgDate.substring(4); + } + + iPos = temp.indexOf(seperater); + if(iPos > 0){ + imonth = Integer.parseInt(temp.substring(0,iPos)); + temp = temp.substring(iPos + 1); + } else{ + imonth = Integer.parseInt(temp.substring(0,2)); + temp = temp.substring(2); + } + + imonth--; + if(imonth < 0 || imonth > 11){ + imonth = 0; + } + + iday = Integer.parseInt(temp); + if(iday < 1 || iday > 31) + iday = 1; + + Calendar orgcale = Calendar.getInstance(); + orgcale.set(iyear,imonth,iday); + temp = this.rollDate(orgcale,Type,Span); + return temp; + }catch(Exception e){ + return ""; + } + } + + public static String rollDate(Calendar cal,int Type,int Span){ + try{ + SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd"); + String temp = ""; + Calendar rolcale; + rolcale = cal; + rolcale.add(Type,Span); + temp = date.format(rolcale.getTime()); + return temp; + }catch(Exception e){ + return ""; + } + } + + /** + * + * 返回默认的日期格式 + * + */ + public static synchronized String getDatePattern() { + defaultDatePattern = "yyyy-MM-dd"; + return defaultDatePattern; + } + + /** + * 将指定日期按默认格式进行格式代化成字符串后输出如:yyyy-MM-dd + */ + public static final String getDate(Date aDate) { + SimpleDateFormat df = null; + String returnValue = ""; + + if (aDate != null) { + df = new SimpleDateFormat(getDatePattern()); + returnValue = df.format(aDate); + } + + return (returnValue); + } + + + + /** + * 取得给定日期的时间字符串,格式为当前默认时间格式 + */ + public static String getTimeNow(Date theTime) { + return getDateTime(timePattern, theTime); + } + + /** + * 取得当前时间的Calendar日历对象 + */ + public Calendar getToday() throws ParseException { + Date today = new Date(); + SimpleDateFormat df = new SimpleDateFormat(getDatePattern()); + String todayAsString = df.format(today); + Calendar cal = new GregorianCalendar(); + cal.setTime(convertStringToDate(todayAsString)); + return cal; + } + + /** + * 将日期类转换成指定格式的字符串形式 + */ + public static final String getDateTime(String aMask, Date aDate) { + SimpleDateFormat df = null; + String returnValue = ""; + + if (aDate == null) { + log.error("aDate is null!"); + } else { + df = new SimpleDateFormat(aMask); + returnValue = df.format(aDate); + } + return (returnValue); + } + + /** + * 将指定的日期转换成默认格式的字符串形式 + */ + public static final String convertDateToString(Date aDate) { + return getDateTime(getDatePattern(), aDate); + } + + + /** + * 将日期字符串按指定格式转换成日期类型 + * @param aMask 指定的日期格式,如:yyyy-MM-dd + * @param strDate 待转换的日期字符串 + */ + + public static final Date convertStringToDate(String aMask, String strDate) + throws ParseException { + SimpleDateFormat df = null; + Date date = null; + df = new SimpleDateFormat(aMask); + + if (log.isDebugEnabled()) { + log.debug("converting '" + strDate + "' to date with mask '" + + aMask + "'"); + } + try { + date = df.parse(strDate); + } catch (ParseException pe) { + log.error("ParseException: " + pe); + throw pe; + } + return (date); + } + + /** + * 将日期字符串按默认格式转换成日期类型 + */ + public static Date convertStringToDate(String strDate) + throws ParseException { + Date aDate = null; + + try { + if (log.isDebugEnabled()) { + log.debug("converting date with pattern: " + getDatePattern()); + } + aDate = convertStringToDate(getDatePattern(), strDate); + } catch (ParseException pe) { + log.error("Could not convert '" + strDate + + "' to a date, throwing exception"); + throw new ParseException(pe.getMessage(), + pe.getErrorOffset()); + + } + + return aDate; + } + + /** + * 返回一个JAVA简单类型的日期字符串 + */ + public static String getSimpleDateFormat(){ + SimpleDateFormat formatter=new SimpleDateFormat(); + String NDateTime=formatter.format(new Date()); + return NDateTime; + } + + /** + * 将两个字符串格式的日期进行比较 + * @param last 要比较的第一个日期字符串 + * @param now 要比较的第二个日期格式字符串 + * @return true(last 在now 日期之前),false(last 在now 日期之后) + */ + public static boolean compareTo(String last, String now) { + try { + SimpleDateFormat formatter = new SimpleDateFormat( + "yyyy-MM-dd HH:mm:ss"); + Date temp1 = formatter.parse(last); + Date temp2 = formatter.parse(now); + if (temp1.after(temp2)) + return false; + else if (temp1.before(temp2)) + return true; + } catch (ParseException e) { + log.debug(e.getMessage()); + } + return false; + } + + + /** + * 将两个字符串格式的日期进行比较 + * @param last 要比较的第一个日期字符串 + * @param now 要比较的第二个日期格式字符串 + * @return true(last 在now 日期之前),false(last 在now 日期之后) + */ + public static boolean compareToForBBS(String last, String now) { + try { + if(last.equals(now)) + return true; + SimpleDateFormat formatter = new SimpleDateFormat( + "yyyy-MM-dd"); + Date temp1 = formatter.parse(last); + Date temp2 = formatter.parse(now); + if (temp1.after(temp2)) + return false; + else if (temp1.before(temp2)) + return true; + } catch (ParseException e) { + log.debug(e.getMessage()); + } + return false; + } + + + + + + /** + * 为查询日期添加最小时间 + * @param 目标类型Date + * @param 转换参数Date + * @return + */ + @SuppressWarnings("deprecation") + public static Date addStartTime(Date param) { + Date date = param; + try{ + date.setHours(0); + date.setMinutes(0); + date.setSeconds(0); + return date; + }catch(Exception ex){ + return date; + } + } + + + + /** + * 为查询日期添加最大时间 + * @param 目标类型Date + * @param 转换参数Date + * @return + */ + @SuppressWarnings("deprecation") + public static Date addEndTime(Date param) { + Date date = param; + try{ + date.setHours(23); + date.setMinutes(59); + date.setSeconds(0); + return date; + }catch(Exception ex){ + return date; + } + } + + + + /** + * 返回系统现在年份中指定月份的天数 + * @param 月份month + * @return 指定月的总天数 + */ + @SuppressWarnings("deprecation") + public static String getMonthLastDay(int month) + { + Date date=new Date(); + int[][] day={{0,30,28,31,30,31,30,31,31,30,31,30,31}, + {0,31,29,31,30,31,30,31,31,30,31,30,31}}; + int year=date.getYear()+1900; + if(year%4==0 && year%100!=0 || year%400==0) + { + return day[1][month]+""; + } + else + { + return day[0][month]+""; + } + } + + /** + * 返回指定年份中指定月份的天数 + * @param 年份year + * @param 月份month + * @return 指定月的总天数 + */ + public static String getMonthLastDay(int year,int month) + { + int[][] day={{0,30,28,31,30,31,30,31,31,30,31,30,31}, + {0,31,29,31,30,31,30,31,31,30,31,30,31}}; + if(year%4==0 && year%100!=0 || year%400==0) + { + return day[1][month]+""; + } + else + { + return day[0][month]+""; + } + } + + /** + * 取得当前时间的日戳 + * @return + */ + @SuppressWarnings("deprecation") + public static String getTimestamp(){ + Date date=new Date(); + String timestamp=""+(date.getYear()+1900)+date.getMonth()+date.getDate()+date.getMinutes()+date.getSeconds()+date.getTime(); + return timestamp; + } + /** + * 取得指定时间的日戳 + * @return + */ + @SuppressWarnings("deprecation") + public static String getTimestamp(Date date){ + String timestamp=""+(date.getYear()+1900)+date.getMonth()+date.getDate()+date.getMinutes()+date.getSeconds()+date.getTime(); + return timestamp; + } + + + public static Date getDate(String time) { + Date date = new Date(); + try { + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + date = datetime.parse(time); + } catch (ParseException e) { + e.printStackTrace(); + } + return date; + } + + + public static long getTimeMillis(String datetime){ + long timemillis = 0 ; + Calendar cal = Calendar.getInstance(); + Date date = getDate(datetime) ; + cal.setTime(date) ; + timemillis = cal.getTimeInMillis() ; + return timemillis ; + } + + + public static long getsmallSec(String datetime1,String datetime2){ + long time1 = 0 ; + long time2 = 0 ; + long time = 0 ; + if(datetime1!=null){ + time1 = getTimeMillis(datetime1) ; + } + if(datetime2!=null){ + time2 = getTimeMillis(datetime2) ; + } + if(time1==0){ + time = time2 ; + }else if(time2==0){ + time = time1 ; + }else if(time1>time2){ + time = time2 ; + }else{ + time = time1 ; + } + time = time/1000 ; + return time ; + } + + /** + * @Description: TODO + * @param calendarField 修改的字段 + * @param calc add/sub + * @param n + * @return  + *  + * @return String    + * @throws + */ + public static String getDatetimeNfieldgap(int calendarField,String calc,int n){ + try{ + SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar cal = Calendar.getInstance() ; + int value = cal.get(calendarField) ; + if(calc.equals("add")){ + cal.set(calendarField, value+n) ; + }else if(calc.equals("sub")){ + cal.set(calendarField, value-n); + } + return datetime.format(cal.getTime()); + } catch(Exception e){ + log.debug("DateUtil.getDay():" + e.getMessage()); + return "" ; + } + } + + @SuppressWarnings("static-access") + public static void sleep(int seconds){ + if(seconds<1) + return; + try { + Thread.currentThread().sleep(seconds*1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @SuppressWarnings("static-access") + public static void sleepLong(long millisecond){ + if(millisecond<1) + return; + try { + Thread.currentThread().sleep(millisecond); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + +// public static void main(String[] args) { +// String flag = getDateTime(0); +// System.out.println(flag); +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/EnLPUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/EnLPUtils.java new file mode 100644 index 0000000..5eea43c --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/EnLPUtils.java @@ -0,0 +1,92 @@ +package com.bfd.mf.service.tools; + +/** + * Created by quanyou.chang@baifendian.com on 2016/8/8. + */ + +import com.alibaba.fastjson.JSON; +import net.sf.classifier4J.DefaultTokenizer; +import net.sf.classifier4J.Utilities; +import net.sf.classifier4J.summariser.SimpleSummariser; + +import java.util.*; + +/** + * description:HanLP Process For KeyWords And Abstract + */ +public class EnLPUtils { + private static CustomStopWordsProvider customStopWordsProvider = new CustomStopWordsProvider(); + private static SimpleSummariser simpleSummariser = new SimpleSummariser(); + + + private static Map sortByValue(Map map,int topSize) { + List list = new LinkedList(map.entrySet()); + Collections.sort(list, new Comparator() { + + public int compare(Object o1, Object o2) { + return -((Comparable) ((Map.Entry) (o1)).getValue()) + .compareTo(((Map.Entry) (o2)).getValue()); + + } + }); + Map result = new LinkedHashMap(); + int index = 0; + for (Iterator it = list.iterator(); it.hasNext();) { + Map.Entry entry = (Map.Entry) it.next(); + + index++; + + result.put(entry.getKey(), entry.getValue()); + + if(index == topSize){ + break; + } + } + return result; + } + + /**返回权重*/ + public static String getKeywordList(String document, int size){ + Map wordsMap = Utilities.getWordFrequency(document, false, new DefaultTokenizer(), customStopWordsProvider); + Map resultMap = sortByValue(wordsMap, size); + return JSON.toJSONString(resultMap); + } + + /**返回权重*/ + public static String getKeywordList(String document){ + @SuppressWarnings("unchecked") + Map wordsMap = Utilities.getWordFrequency(document, false, new DefaultTokenizer(), customStopWordsProvider); + return JSON.toJSONString(wordsMap); + } + /**返回词列表和权重*/ + public static String getKeywordListWithOutWeight(String document, int size){ + Map wordsMap = Utilities.getWordFrequency(document, false, new DefaultTokenizer(), customStopWordsProvider); + Map resultMap = sortByValue(wordsMap, size); + List lists = new ArrayList<>(resultMap.keySet()); + Collections.sort(lists); + return JSON.toJSONString(lists); + } + + /**返回摘要信息*/ + public static String extractSummary(String document, int size){ + return simpleSummariser.summarise(document,size); + } + + /** 分词 */ + public static String splitWords(String document){ + Map wordsMap = Utilities.getWordFrequency(document, false, new DefaultTokenizer(), customStopWordsProvider); + StringBuffer sb = new StringBuffer(); + Set segmentList = wordsMap.keySet(); + for (String term:segmentList) { + sb.append(term); + } + return sb.toString(); + } + + +// public static void main(String [] args){ +// +// /* System.err.println(extractSummary("Malia Obamawas 10 years old and in the fifth grade when her father became president, and next week she's set to start a new chapter.   She's off to Harvard.   The 19-year-old is ending a gap year that sparked a national conversation about the trendand unfolded across multiple continents. Soon she is decamping for the venerable Ivy League school in Cambridge, Mass.   Harvard's dorms open to freshmen Tuesday, and classes begin Aug. 30. The university is a familiar place for Obama's alumni parents, who both graduated from Harvard Law School. It also is no stranger to celebrity students and is the alma mater of eight U.S. presidents. That President Barack Obama's friends and former administration officials hold faculty posts at Harvard means his daughter won't be entirely on her own. A Secret Service detail will ensure that too.   \"How time flies,\" said Anita McBride, a chief of staff for former first lady Laura Bush, whose daughters Barbara and Jenna first welcomed Michelle Obama and her daughters into the White Houseafter the 2008 election.   The White House florist had made bouquets for the Obama girls. The Bush daughters gave them the grand tour, teaching them how to slide down the banister in the solarium. The departing White House daughters also gave the Obama girls a friendly letter full of their well wishes and advice.   Tribune news services\tMalia Obama's gap year is truly taking shape.   Starting next month, the 18-year-old daughter of former President Barack Obamaand Michelle Obama who graduated from Sidwell Friends last May but won't attend Harvard University until fall will intern for Hollywood heavyweight Harvey Weinsteinin the...   Malia Obama's gap year is truly taking shape.   Starting next month, the 18-year-old daughter of former President Barack Obamaand Michelle Obama who graduated from Sidwell Friends last May but won't attend Harvard University until fall will intern for Hollywood heavyweight Harvey Weinsteinin the...   (Tribune news services)   \"Here's a girl who's grown up in the public eye and who's been able to maintain a normal, private life and make regular, everyday decisions about her education and life choices,\" McBride said.   \"She took advantage of a very interesting opportunity at a very unique time in her life, an in-between time in her life,\" she added. Delaying her Harvard start meant Malia Obama would arrive on campus with less visibility and pressure than had she started in 2016 during her father's final months in the Oval Office, added McBride, now with American University's School of Public Affairs.   Malia Obama's gap year coinciding with her family leaving the White House in January gave her time and space to unwind with her parents and sister. \"They had precious family time they were able to enjoy as the entire family was going through a transition,\" McBride said.   The Obamas moved into a home Washington's Kalorama neighborhood, letting Sasha Obama finish Sidwell Friends School, from which Malia Obama graduated in 2016. Sixteen-year-old Sasha will finish Sidwell in 2019.   Katherine Skiba\tMalia Obama will take a gap year after graduating from high school and then attend Harvard University in the fall of 2017, the White House said Sunday, a decision that frees her from the scrutiny of arriving on campus while her father is still president.Obama, 17, the older of the president's two...   Malia Obama will take a gap year after graduating from high school and then attend Harvard University in the fall of 2017, the White House said Sunday, a decision that frees her from the scrutiny of arriving on campus while her father is still president.Obama, 17, the older of the president's two...   (Katherine Skiba)   The Obamas announced in May 2016 that Malia Obama had been accepted to Harvard but was taking a gap year. Her 12 months of me time, according to news accounts, featured an extended trip last fall to Bolivia and Peru, a journey reportedly organized by a Boulder, Colo., company called Where There Be Dragons. Eva Vanek, director of admissions for the firm, declined to talk about Malia Obama but spoke generally about its gap-year and summer programs, saying they operated in 19 countries in Asia, Africa and South and Central America.   The aim is a cross-cultural, experiential education, Vanek said. That means no five-star hotels or fancy buses, but rather home stays with local families, volunteer work, trips on public buses and often, language immersion. The small-group trips \"aren't touristic. They aim to broaden students' perspectives about the world and themselves through these really intimate experiences,\" she said.   The goal is to let participants become \"competent travelers and more evolved humans,\" Vanek added.   Last February, Malia Obama started an internship with the Weinstein Co., an employee there said. It's a film and television production and distribution company founded by brothers Bob and Harvey Weinstein. She hit the Sundance Film Festival in January, was spotted in Aspen, Colo., in February, traveled in June with her parents and sister to Bali and rocked out with her younger sister in August at Chicago's Lollapalooza.   Because of her gap year, Malia Obama will join Harvard's Class of 2021, an exclusive group about to get an expensive education.   Harvard's tuition, fees, room and board run $65,509 for the upcoming school year, though many students get need-based financial aid. Only 5.4 percent of the 39,041 students who applied to be in the Class of 2020 were admitted: some 2,110 students. Altogether Harvard has about 6,700 undergraduates and 14,500 graduate and professional students.   The school boasts nearly 3,900 courses in 49 undergraduate fields of study, or \"concentrations.\" All freshmen must take Expository Writing 20, but otherwise there is no preset curriculum. Those admitted into her 2021 class are, by a slim majority of 50.9 percent, mostly nonwhite, according to university officials, who declined to comment on the former first daughter.   Soon she'll be able to stroll Harvard Yard, shop at the campus store called \"The COOP\" and perhaps take meals with other freshmen at Annenberg Hall, a high-ceiling dining hall that draws comparisons to the Great Hall in the Harry Potter series. And she'll hit the books. University officials tell students to budget up to $1,200 a year for textbooks.   The college experience is one the Bush daughters anticipated. As the Obama family prepared to leave the White House, they sent the two teens another letter, previewing life as a former president's kids.   \"Enjoy college. As most of the world knows, we did,\" they said in one passage. \"And you won't have the weight of the world on your young shoulders anymore.",3)); +// System.err.println(extractSummary("I love china 中国",2));*/ +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/HanLPUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/HanLPUtils.java new file mode 100644 index 0000000..d02cf9b --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/HanLPUtils.java @@ -0,0 +1,178 @@ +package com.bfd.mf.service.tools; + +/** + * Created by quanyou.chang@baifendian.com on 2016/8/8. + */ + +import com.alibaba.fastjson.JSON; +import com.hankcs.hanlp.HanLP; +import com.hankcs.hanlp.corpus.document.sentence.Sentence; +import com.hankcs.hanlp.corpus.tag.Nature; +import com.hankcs.hanlp.model.perceptron.PerceptronLexicalAnalyzer; +import com.hankcs.hanlp.seg.Segment; +import com.hankcs.hanlp.seg.common.Term; +import com.hankcs.hanlp.summary.TextRankKeyword; + +import java.io.IOException; +import java.util.*; + +/** + * description:HanLP Process For KeyWords And Abstract + */ +public class HanLPUtils { + + private static Map puntuationMap = new HashMap(); + + static{ + puntuationMap.put(":", ":"); + puntuationMap.put(",", ","); + puntuationMap.put(";", ";"); + puntuationMap.put("?", "?"); + puntuationMap.put("。", "."); + + } + + private static TextRankKeyword textRankKeyword = new TextRankKeyword(); + private static PerceptronLexicalAnalyzer analyzer; + + public static void initAnalyzer(){ + try { + analyzer = new PerceptronLexicalAnalyzer("/opt/data/nlp/hanlp/data/model/perceptron/pku199801/cws.bin", HanLP.Config.PerceptronPOSModelPath,HanLP.Config.PerceptronNERModelPath); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /**返回权重*/ + public static String getKeywordList(String document, int size){ + Map wordsMap = textRankKeyword.getTermAndRank(document, Integer.valueOf(size)); + return JSON.toJSONString(wordsMap); + } + + public static String getKeywordList(String document){ + Map wordsMap = textRankKeyword.getTermAndRank(document); + return JSON.toJSONString(wordsMap); + } + /**返回摘要信息*/ + public static String extractSummary(String document, int size){ + StringBuffer sb = new StringBuffer(); + List sentenceList = HanLP.extractSummary(document, size); + for (String sentence:sentenceList){ + sb.append(sentence).append("。"); + } + return sb.toString(); + } + + public static String splitWords(String document){ + StringBuffer sb = new StringBuffer(); + //1:对标点符号进行中英文替换 + for (Map.Entry entry : puntuationMap.entrySet()){ + if(document.contains(entry.getKey())){ + document = document.replaceAll(entry.getKey(),entry.getValue()); + } + } + List segmentList = HanLP.segment(document); + for (Term term:segmentList) { + if( DataTypeSelectUtils.getStopDictSets().contains(term.word) ||DataTypeSelectUtils.getPosTagDictSets().contains(term.nature)) + continue; + sb.append(term.word); + } + return sb.toString(); + } + // ns为地名识别 + public static List placeRecognize(String[] sentences){ + Segment segment = HanLP.newSegment().enablePlaceRecognize(true); + Set placeSet = new HashSet<>(); + for (String sentence : sentences) + { + List termList = segment.seg(sentence); + termList.forEach(term ->{ + if(term.nature.toString().equals(Nature.ns.toString())){ + placeSet.add(term.word); + } + }); + } + return new ArrayList<>(placeSet); + } + + public static List placeRecognizeWithCws(String[] sentences){ + Set placeSet = new HashSet<>(); + try { + for (String sentence : sentences) { + Sentence termList = analyzer.analyze(sentence); + termList.forEach(term -> { + if (term.getLabel().equals(Nature.ns.toString())) { + placeSet.add(term.getValue()); + } + }); + } + }catch(Exception e){ + e.printStackTrace(); + } + return new ArrayList(placeSet); + } + +// public static void main(String [] args){ +// /* System.err.println(System.getenv()); +// String HANLP_ROOT = System.getenv("HANLP_ROOT"); +// System.err.println(HANLP_ROOT); +// HanLP.Config +// String content = "产业园"; +// List ns = placeRecognize(new String[]{content}); +// ns.forEach(nature->System.err.println(nature)); +// */ +//// String content = "马云的重大宣布,沸腾了北京 沸腾了全中国!"; +//// List ns = placeRecognize(new String[]{content}); +//// ns.forEach(nature->System.err.println(nature)); +//// JSONObject jsonObject = new JSONObject(); +// // parseListBrand(jsonObject,"护肤类-唇部润肤/唇部护理-唇膜-香奈儿(Chanel)"); +// +// /* String str = getKeywordList( +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。" + +// "" + +// "" + +// "" + +// "" + +// "" + +// "" + +// "",15); +// +// +// System.out.println(str); +// +// System.out.println( MfMD5Util.GetMD5Code(DataProcessUtils.StringFilter(HanLPUtils.splitWords("马云的重大宣布,沸腾了北京 沸腾了全中国!")))); +// System.out.println( MfMD5Util.GetMD5Code(DataProcessUtils.StringFilter(HanLPUtils.splitWords("冠农品牌+华糖云商”强强联合打造红色产业航母")))); +// +// System.out.println(HanLP.segment( "\t\n" + +// "惨烈!上海某国有大行分行走了800人!银行为啥留不住人了?")); +// System.err.println(extractSummary("#警方资讯# 【和平分局在沈阳万科成立驻企警务工作室】5月16日上午,和平分局授予沈阳万科“沈阳市公安局和平分局警企共建单位”,在沈阳万科成立驻企警务工作室,派驻助企民警并聘请沈阳万科总经理肖劲为警风警纪监督员。",3)); +// System.err.println(HanLPUtils.getKeywordList("Malia Obamawas 10 years old and in the fifth grade when her father became president, and next week she's set to start a new chapter.   She's off to Harvard.   The 19-year-old is ending a gap year that sparked a national conversation about the trendand unfolded across multiple continents. Soon she is decamping for the venerable Ivy League school in Cambridge, Mass.   Harvard's dorms open to freshmen Tuesday, and classes begin Aug. 30. The university is a familiar place for Obama's alumni parents, who both graduated from Harvard Law School. It also is no stranger to celebrity students and is the alma mater of eight U.S. presidents. That President Barack Obama's friends and former administration officials hold faculty posts at Harvard means his daughter won't be entirely on her own. A Secret Service detail will ensure that too.   \"How time flies,\" said Anita McBride, a chief of staff for former first lady Laura Bush, whose daughters Barbara and Jenna first welcomed Michelle Obama and her daughters into the White Houseafter the 2008 election.   The White House florist had made bouquets for the Obama girls. The Bush daughters gave them the grand tour, teaching them how to slide down the banister in the solarium. The departing White House daughters also gave the Obama girls a friendly letter full of their well wishes and advice.   Tribune news services\tMalia Obama's gap year is truly taking shape.   Starting next month, the 18-year-old daughter of former President Barack Obamaand Michelle Obama who graduated from Sidwell Friends last May but won't attend Harvard University until fall will intern for Hollywood heavyweight Harvey Weinsteinin the...   Malia Obama's gap year is truly taking shape.   Starting next month, the 18-year-old daughter of former President Barack Obamaand Michelle Obama who graduated from Sidwell Friends last May but won't attend Harvard University until fall will intern for Hollywood heavyweight Harvey Weinsteinin the...   (Tribune news services)   \"Here's a girl who's grown up in the public eye and who's been able to maintain a normal, private life and make regular, everyday decisions about her education and life choices,\" McBride said.   \"She took advantage of a very interesting opportunity at a very unique time in her life, an in-between time in her life,\" she added. Delaying her Harvard start meant Malia Obama would arrive on campus with less visibility and pressure than had she started in 2016 during her father's final months in the Oval Office, added McBride, now with American University's School of Public Affairs.   Malia Obama's gap year coinciding with her family leaving the White House in January gave her time and space to unwind with her parents and sister. \"They had precious family time they were able to enjoy as the entire family was going through a transition,\" McBride said.   The Obamas moved into a home Washington's Kalorama neighborhood, letting Sasha Obama finish Sidwell Friends School, from which Malia Obama graduated in 2016. Sixteen-year-old Sasha will finish Sidwell in 2019.   Katherine Skiba\tMalia Obama will take a gap year after graduating from high school and then attend Harvard University in the fall of 2017, the White House said Sunday, a decision that frees her from the scrutiny of arriving on campus while her father is still president.Obama, 17, the older of the president's two...   Malia Obama will take a gap year after graduating from high school and then attend Harvard University in the fall of 2017, the White House said Sunday, a decision that frees her from the scrutiny of arriving on campus while her father is still president.Obama, 17, the older of the president's two...   (Katherine Skiba)   The Obamas announced in May 2016 that Malia Obama had been accepted to Harvard but was taking a gap year. Her 12 months of me time, according to news accounts, featured an extended trip last fall to Bolivia and Peru, a journey reportedly organized by a Boulder, Colo., company called Where There Be Dragons. Eva Vanek, director of admissions for the firm, declined to talk about Malia Obama but spoke generally about its gap-year and summer programs, saying they operated in 19 countries in Asia, Africa and South and Central America.   The aim is a cross-cultural, experiential education, Vanek said. That means no five-star hotels or fancy buses, but rather home stays with local families, volunteer work, trips on public buses and often, language immersion. The small-group trips \"aren't touristic. They aim to broaden students' perspectives about the world and themselves through these really intimate experiences,\" she said.   The goal is to let participants become \"competent travelers and more evolved humans,\" Vanek added.   Last February, Malia Obama started an internship with the Weinstein Co., an employee there said. It's a film and television production and distribution company founded by brothers Bob and Harvey Weinstein. She hit the Sundance Film Festival in January, was spotted in Aspen, Colo., in February, traveled in June with her parents and sister to Bali and rocked out with her younger sister in August at Chicago's Lollapalooza.   Because of her gap year, Malia Obama will join Harvard's Class of 2021, an exclusive group about to get an expensive education.   Harvard's tuition, fees, room and board run $65,509 for the upcoming school year, though many students get need-based financial aid. Only 5.4 percent of the 39,041 students who applied to be in the Class of 2020 were admitted: some 2,110 students. Altogether Harvard has about 6,700 undergraduates and 14,500 graduate and professional students.   The school boasts nearly 3,900 courses in 49 undergraduate fields of study, or \"concentrations.\" All freshmen must take Expository Writing 20, but otherwise there is no preset curriculum. Those admitted into her 2021 class are, by a slim majority of 50.9 percent, mostly nonwhite, according to university officials, who declined to comment on the former first daughter.   Soon she'll be able to stroll Harvard Yard, shop at the campus store called \"The COOP\" and perhaps take meals with other freshmen at Annenberg Hall, a high-ceiling dining hall that draws comparisons to the Great Hall in the Harry Potter series. And she'll hit the books. University officials tell students to budget up to $1,200 a year for textbooks.   The college experience is one the Bush daughters anticipated. As the Obama family prepared to leave the White House, they sent the two teens another letter, previewing life as a former president's kids.   \"Enjoy college. As most of the world knows, we did,\" they said in one passage. \"And you won't have the weight of the world on your young shoulders anymore.",5)); +// +// System.err.println(HanLP.extractPhrase("Malia Obamawas 10 years old and in the fifth grade when her father became president, and next week she's set to start a new chapter.   She's off to Harvard.   The 19-year-old is ending a gap year that sparked a national conversation about the trendand unfolded across multiple continents. Soon she is decamping for the venerable Ivy League school in Cambridge, Mass.   Harvard's dorms open to freshmen Tuesday, and classes begin Aug. 30. The university is a familiar place for Obama's alumni parents, who both graduated from Harvard Law School. It also is no stranger to celebrity students and is the alma mater of eight U.S. presidents. That President Barack Obama's friends and former administration officials hold faculty posts at Harvard means his daughter won't be entirely on her own. A Secret Service detail will ensure that too.   \"How time flies,\" said Anita McBride, a chief of staff for former first lady Laura Bush, whose daughters Barbara and Jenna first welcomed Michelle Obama and her daughters into the White Houseafter the 2008 election.   The White House florist had made bouquets for the Obama girls. The Bush daughters gave them the grand tour, teaching them how to slide down the banister in the solarium. The departing White House daughters also gave the Obama girls a friendly letter full of their well wishes and advice.   Tribune news services\tMalia Obama's gap year is truly taking shape.   Starting next month, the 18-year-old daughter of former President Barack Obamaand Michelle Obama who graduated from Sidwell Friends last May but won't attend Harvard University until fall will intern for Hollywood heavyweight Harvey Weinsteinin the...   Malia Obama's gap year is truly taking shape.   Starting next month, the 18-year-old daughter of former President Barack Obamaand Michelle Obama who graduated from Sidwell Friends last May but won't attend Harvard University until fall will intern for Hollywood heavyweight Harvey Weinsteinin the...   (Tribune news services)   \"Here's a girl who's grown up in the public eye and who's been able to maintain a normal, private life and make regular, everyday decisions about her education and life choices,\" McBride said.   \"She took advantage of a very interesting opportunity at a very unique time in her life, an in-between time in her life,\" she added. Delaying her Harvard start meant Malia Obama would arrive on campus with less visibility and pressure than had she started in 2016 during her father's final months in the Oval Office, added McBride, now with American University's School of Public Affairs.   Malia Obama's gap year coinciding with her family leaving the White House in January gave her time and space to unwind with her parents and sister. \"They had precious family time they were able to enjoy as the entire family was going through a transition,\" McBride said.   The Obamas moved into a home Washington's Kalorama neighborhood, letting Sasha Obama finish Sidwell Friends School, from which Malia Obama graduated in 2016. Sixteen-year-old Sasha will finish Sidwell in 2019.   Katherine Skiba\tMalia Obama will take a gap year after graduating from high school and then attend Harvard University in the fall of 2017, the White House said Sunday, a decision that frees her from the scrutiny of arriving on campus while her father is still president.Obama, 17, the older of the president's two...   Malia Obama will take a gap year after graduating from high school and then attend Harvard University in the fall of 2017, the White House said Sunday, a decision that frees her from the scrutiny of arriving on campus while her father is still president.Obama, 17, the older of the president's two...   (Katherine Skiba)   The Obamas announced in May 2016 that Malia Obama had been accepted to Harvard but was taking a gap year. Her 12 months of me time, according to news accounts, featured an extended trip last fall to Bolivia and Peru, a journey reportedly organized by a Boulder, Colo., company called Where There Be Dragons. Eva Vanek, director of admissions for the firm, declined to talk about Malia Obama but spoke generally about its gap-year and summer programs, saying they operated in 19 countries in Asia, Africa and South and Central America.   The aim is a cross-cultural, experiential education, Vanek said. That means no five-star hotels or fancy buses, but rather home stays with local families, volunteer work, trips on public buses and often, language immersion. The small-group trips \"aren't touristic. They aim to broaden students' perspectives about the world and themselves through these really intimate experiences,\" she said.   The goal is to let participants become \"competent travelers and more evolved humans,\" Vanek added.   Last February, Malia Obama started an internship with the Weinstein Co., an employee there said. It's a film and television production and distribution company founded by brothers Bob and Harvey Weinstein. She hit the Sundance Film Festival in January, was spotted in Aspen, Colo., in February, traveled in June with her parents and sister to Bali and rocked out with her younger sister in August at Chicago's Lollapalooza.   Because of her gap year, Malia Obama will join Harvard's Class of 2021, an exclusive group about to get an expensive education.   Harvard's tuition, fees, room and board run $65,509 for the upcoming school year, though many students get need-based financial aid. Only 5.4 percent of the 39,041 students who applied to be in the Class of 2020 were admitted: some 2,110 students. Altogether Harvard has about 6,700 undergraduates and 14,500 graduate and professional students.   The school boasts nearly 3,900 courses in 49 undergraduate fields of study, or \"concentrations.\" All freshmen must take Expository Writing 20, but otherwise there is no preset curriculum. Those admitted into her 2021 class are, by a slim majority of 50.9 percent, mostly nonwhite, according to university officials, who declined to comment on the former first daughter.   Soon she'll be able to stroll Harvard Yard, shop at the campus store called \"The COOP\" and perhaps take meals with other freshmen at Annenberg Hall, a high-ceiling dining hall that draws comparisons to the Great Hall in the Harry Potter series. And she'll hit the books. University officials tell students to budget up to $1,200 a year for textbooks.   The college experience is one the Bush daughters anticipated. As the Obama family prepared to leave the White House, they sent the two teens another letter, previewing life as a former president's kids.   \"Enjoy college. As most of the world knows, we did,\" they said in one passage. \"And you won't have the weight of the world on your young shoulders anymore.",1)); +//*/ +// } + +// public static void parseListBrand(JSONObject jsonObject, String listBrand) { +// if (StringUtils.isNotEmpty(listBrand)) { +// int a = listBrand.lastIndexOf("-"); +// String brandList = listBrand.substring(0,a); +// jsonObject.put(ESConstant.BRAND_LIST,brandList); +// System.out.println(brandList); +// } +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/HttpClientUtil.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/HttpClientUtil.java new file mode 100644 index 0000000..260f790 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/HttpClientUtil.java @@ -0,0 +1,221 @@ +package com.bfd.mf.service.tools; + +import com.alibaba.fastjson.JSON; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.net.URI; +import java.nio.charset.Charset; +import java.util.*; + + +/** + * httpclient 工具类,提供get,post两类请求方法 + * + * @author BFD-yudong.chen + * + */ +public class HttpClientUtil { + private static final Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); + + private static CloseableHttpClient httpclient = HttpClients.createDefault(); + + public static int requestTimeOut = 5000; + + /** + * + */ + public static ArrayList builderParams(Map param) { + ArrayList params = new ArrayList(); + for (String key : param.keySet()) { + params.add(new BasicNameValuePair(key, param.get(key).toString())); + } + return params; + } + + /** + * + */ + public static Map httpGet(String url, Map param, HashMap headers) { + + CloseableHttpClient httpclient = HttpClients.createDefault(); + Map result = new HashMap(); + try { + RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(requestTimeOut).setConnectTimeout(requestTimeOut).build(); + // 创建httpget + HttpGet httpget = new HttpGet(url); + List params = builderParams(param); + + String str = EntityUtils.toString(new UrlEncodedFormEntity(params,Charset.forName("UTF-8"))); + if(!"".equals(str)){ + httpget.setURI(new URI(httpget.getURI().toString() + "?" + str)); + } + System.out.println("executing request " + httpget.getURI()); + for(String key: headers.keySet()){ + httpget.setHeader(key,headers.get(key).toString()); + } + httpget.setConfig(requestConfig); + // 执行get请求 + CloseableHttpResponse response = httpclient.execute(httpget); + try { + // 获取响应实体 + HttpEntity entity = response.getEntity(); + // 响应状 + System.out.println(response.getStatusLine()); + result.put("code", response.getStatusLine().getStatusCode()); + if (entity != null) { + String content = EntityUtils.toString(entity); + //System.out.println(content); +// content = content.replace(" ", ""); + result.put("entity",content); + } + } finally { + response.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + httpclient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + } + + public static String httpPost(String url, List> param) { + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); + HttpPost httppost = new HttpPost(url); + StringEntity strEntity; + String resultContent = ""; + try { + strEntity = new StringEntity(JSON.toJSONString(param),Charset.forName("UTF-8")); + strEntity.setContentEncoding("UTF-8"); + strEntity.setContentType("application/json"); + httppost.setHeader("Content-type","application/json; charset=utf-8"); + httppost.setHeader("Accept","application/json"); + httppost.setEntity(strEntity); + CloseableHttpResponse response = httpclient.execute(httppost); + try { + HttpEntity entity = response.getEntity(); + if (entity != null) { + String content = EntityUtils.toString(entity); + resultContent = content ; + } + } finally { + response.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + httpclient.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return resultContent; + } + + public static String httpPost(String url, Map param) { + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); + HttpPost httppost = new HttpPost(url); + StringEntity strEntity; + String resultContent = ""; + try { + strEntity = new StringEntity(JSON.toJSONString(param),Charset.forName("UTF-8")); + strEntity.setContentEncoding("UTF-8"); + strEntity.setContentType("application/json"); + httppost.setHeader("Content-type","application/json; charset=utf-8"); + httppost.setHeader("Accept","application/json"); + httppost.setEntity(strEntity); + CloseableHttpResponse response = httpclient.execute(httppost); + try { + HttpEntity entity = response.getEntity(); + if (entity != null) { + String content = EntityUtils.toString(entity); + resultContent = content ; + } + } finally { + response.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + httpclient.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return resultContent; + } + + public static String httpPost(String url, Vector param) { + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); + HttpPost httppost = new HttpPost(url); + StringEntity strEntity; + String resultContent = ""; + try { + + strEntity = new StringEntity(param.toString(),Charset.forName("UTF-8")); + strEntity.setContentEncoding("UTF-8"); + strEntity.setContentType("application/json"); + httppost.setHeader("Content-type","application/json; charset=utf-8"); + httppost.setHeader("Accept","application/json"); + httppost.setEntity(strEntity); + CloseableHttpResponse response = httpclient.execute(httppost); + try { + HttpEntity entity = response.getEntity(); + if (entity != null) { + String content = EntityUtils.toString(entity); + resultContent = content ; + } + } finally { + response.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + httpclient.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return resultContent; + } + +// public static void main(String[] args) { +// HashMap headers = new HashMap(); +//// headers.put("Accpet", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"); +//// headers.put("Accept-Encoding", "gzip, deflate, br"); +//// headers.put("Accept-Language", "zh-CN,zh;q=0.9"); +//// headers.put("Cache-Control", "max-age=0"); +//// headers.put("Connection", "keep-alive"); +////// headers.put("DNT", 1); +//// headers.put("Referer", "https://lf.meituan.com/s/%E9%A9%BF%E5%AE%B6365/"); +//// headers.put("Host", "lf.meituan.com"); +// headers.put("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"); +//// headers.put("Upgrade-Insecure-Requests", 1); +//// headers.put("Cookie", "xhs_spses.5dde=*;Hm_lvt_9df7d19786b04345ae62033bd17f6278=1545035206,1545035398,1545097729,1545097841;Hm_lvt_d0ae755ac51e3c5ff9b1596b0c09c826=1545035206,1545035398,1545097730,1545097841;xhs_spid.5dde=ca9ad206dbfe1683.1545097841.1.1545097844.1545097841.b661d74e-3a5a-423f-81b2-ce5784118e43;xhsTrackerId=8e5d8691-35bc-4072-c06f-69c2b9ba5106;Hm_lpvt_d0ae755ac51e3c5ff9b1596b0c09c826=1545097841;xhsuid=4emQ9P7LMXW66bQn;beaker.session.id=a2e01d7483b2f22a2c5bfd04b9ff5f51e4cabafbgAJ9cQEoVQNfaWRxAlUgYTA5MTk5YmRlMTAzNDUzYzlmOTEzODNiYmZmNGM1OWRxA1UOX2FjY2Vzc2VkX3RpbWVxBEdB1wYUnFUNPVUOX2NyZWF0aW9uX3RpbWVxBUdB1wYUnFUNOXUu;extra_exp_ids=;ANTI=db01a13120|1545098440|b919656933;Hm_lpvt_9df7d19786b04345ae62033bd17f6278=1545097841;"); +// HttpClientUtil.httpGet("https://lf.meituan.com/s/%E9%A9%BF%E5%AE%B6365/", new HashMap(), headers); +// //http://rule.sq.baifendian.com/wordcloud +// HttpClientUtil.httpPost("http://rule.sq.baifendian.com/wordcloud",headers); +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/JsonUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/JsonUtils.java new file mode 100644 index 0000000..ab8f2d5 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/JsonUtils.java @@ -0,0 +1,84 @@ +package com.bfd.mf.service.tools; + +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.List; +import java.util.Map; + +public class JsonUtils { + + private static final Log log = LogFactory.getLog(JsonUtils.class); + + private static JsonFactory _jsonFactory = null; + static { + if (_jsonFactory == null) { + _jsonFactory = new JsonFactory(); + _jsonFactory.enable(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS); + _jsonFactory.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); + } + } + + public static String toJSONString(Object object) { + // return JSON.toJSONString(object); + ObjectMapper om = new ObjectMapper(_jsonFactory); + try { + om.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); + return om.writeValueAsString(object); + } catch (Exception e) { + log.warn("to json string exception, will use fastjson to parse", e); + } + return null; + } + + public static Object parseObject(String str) throws Exception { + ObjectMapper om = new ObjectMapper(_jsonFactory); + return om.readValue(str.getBytes(), Object.class); + } + + public static Object parseObjectNoException(String str) { + Object o=null; + try { + o = parseObject(str); + } catch (Exception e) { + log.error("parse str to json error"+str,e); + o=null; + } + return o; + } + + @SuppressWarnings("unchecked") + public static Map parseMapNoException(String str) { + Object o=null; + try { + o = parseObject(str); + } catch (Exception e) { + log.error("parse str to json error"+str,e); + o=null; + return null; + } + + Map m=null; + try { + m = (Map)o; + } catch (Exception e) { + log.error("parse jsonobject to map error"+m,e); + return null; + } + return m; + } + + public static Object parse(String str) throws Exception { + return parseObject(str); + } + + @SuppressWarnings("unchecked") + public static List parseArray(String str) throws Exception { + ObjectMapper om = new ObjectMapper(_jsonFactory); + return (List) om.readValue(str.getBytes(), Object.class); + } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/LoadExcel.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/LoadExcel.java new file mode 100644 index 0000000..022d0cb --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/LoadExcel.java @@ -0,0 +1,6 @@ +package com.bfd.mf.service.tools; + +public class LoadExcel { + public void loadExcelFile(){ } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/LoadProperties.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/LoadProperties.java new file mode 100644 index 0000000..28d2498 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/LoadProperties.java @@ -0,0 +1,99 @@ +package com.bfd.mf.service.tools; + +import java.io.*; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +public class LoadProperties { + + /** + * 配置文件路径 + */ + private static String CONFIG_FILE_PATH = "./conf.Properties"; + /** + * 保存配置文件信息的map + */ + public static HashMap map = new HashMap(); + + /** + * 创建配置对象,声明输入流对象,读取配置文件 + */ + public static void loadConfigFile(){ + try { + /***创建配置对象***/ + Properties properties = new Properties(); + /***声明输入流对象***/ + FileInputStream fis = new FileInputStream(CONFIG_FILE_PATH); + BufferedReader bf = new BufferedReader(new InputStreamReader(fis,"UTF-8")); + /***加载配置文件***/ + properties.load(bf); + /***关闭流***/ + fis.close(); + /***创建枚举对象***/ + Enumeration enu = properties.keys(); + while(enu.hasMoreElements()){ + String key = (String) enu.nextElement(); + String value = properties.getProperty(key); + + map.put(key, value); + System.out.println("打印配置文件信息:\n"+key+" -- "+value+"\n"); + } + //读取 + //readFile(); + System.out.println("配置文件加载完成!"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static Map getValue(String keySuffix){ + Map configParams = new HashMap(); + for(String configkey : map.keySet()){ + if(configkey.startsWith(keySuffix)){ + String configValue = map.get(configkey); + configkey = configkey.substring(configkey.indexOf(keySuffix+".") + keySuffix.length() + 1); + configParams.put(configkey, configValue); + } + } + return configParams ; + } + + + public static void readFile(){ + + try{ + File commentF = new File("./comment"); + BufferedReader commentbr = new BufferedReader(new FileReader(commentF)); + String commentrow; + StringBuffer commentProperties = new StringBuffer(); + while((commentrow = commentbr.readLine())!=null) { + commentProperties.append(commentrow+"\n"); + } + map.put("es_comment", commentProperties.toString()); + commentbr.close(); + File contentF = new File("./content"); + BufferedReader contentbr = new BufferedReader(new FileReader(contentF)); + String contentrow; + StringBuffer contentProperties = new StringBuffer(); + while((contentrow = contentbr.readLine())!=null) { + contentProperties.append(contentrow+"\n"); + } + map.put("es_content", contentProperties.toString()); + contentbr.close(); + }catch(Exception e){ + e.printStackTrace(); + } + } + + +// public static void main(String[] args) { +// //loadConfigFile(); +// //System.out.println(getValue("JD")); +// //readFile(); +// //System.out.println(map.get("es_content")); +// +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/MfMD5Util.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/MfMD5Util.java new file mode 100644 index 0000000..df93ea5 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/MfMD5Util.java @@ -0,0 +1,53 @@ +package com.bfd.mf.service.tools; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class MfMD5Util { + + private final static String[] strDigits = {"0", "1", "2", "3", "4", "5", + "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; + + public MfMD5Util() { + } + + private static String byteToArrayString(byte bByte) { + int iRet = bByte; + // System.out.println("iRet="+iRet); + if (iRet < 0) { + iRet += 256; + } + int iD1 = iRet / 16; + int iD2 = iRet % 16; + return strDigits[iD1] + strDigits[iD2]; + } + + private static String byteToNum(byte bByte) { + int iRet = bByte; + System.out.println("iRet1=" + iRet); + if (iRet < 0) { + iRet += 256; + } + return String.valueOf(iRet); + } + + private static String byteToString(byte[] bByte) { + StringBuffer sBuffer = new StringBuffer(); + for (int i = 0; i < bByte.length; i++) { + sBuffer.append(byteToArrayString(bByte[i])); + } + return sBuffer.toString(); + } + + public static String GetMD5Code(String strObj) { + String resultString = null; + try { + resultString = new String(strObj); + MessageDigest md = MessageDigest.getInstance("MD5"); + resultString = byteToString(md.digest(strObj.getBytes())); + } catch (NoSuchAlgorithmException ex) { + ex.printStackTrace(); + } + return resultString; + } +} \ No newline at end of file diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/NlpUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/NlpUtils.java new file mode 100644 index 0000000..14f92e0 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/NlpUtils.java @@ -0,0 +1,71 @@ +package com.bfd.mf.service.tools; + +import com.bfd.nlp.common.util.string.TStringUtils; +import org.apache.commons.lang3.StringUtils; + +/** + * Created by Changquanyou on 2017/9/11. + */ +public class NlpUtils { + + /** + 通过正则 匹配会有问题: 中文字符串中含有 英文符号;会识别成英文 + private static String reg_charset = "^[\\u4e00-\\u9fa5]*$"; + private static Pattern p = Pattern.compile(reg_charset); + */ + /**判断中英文*/ + public static boolean isChinese(String sentence){ + if(StringUtils.isEmpty(sentence)) + return false; + return CharUtil.isChinese(sentence); + } + + public static String getKeywordList(String document, int size){ + if(isChinese(document)) + return HanLPUtils.getKeywordList(document, size); + return EnLPUtils.getKeywordList(document, size); + } + + public static String getKeywordList(String document){ + if(isChinese(document)) + return HanLPUtils.getKeywordList(document); + return EnLPUtils.getKeywordList(document); + } + + public static String extractSummary(String document, int size){ + if(isChinese(document)) + return HanLPUtils.extractSummary(document,size); + return EnLPUtils.extractSummary(document, size); + } + + /** + * 跨语言的分词: + * 支持中文简体 和 英文 + * @FIXED + **/ + public static String splitWords(String document){ + String result; + if(CharUtil.isChinese(document)){ + result = HanLPUtils.splitWords(document); + }else{ + result = EnLPUtils.splitWords(document); + } + /** 分完词是空;就返回自己本身 */ + if(TStringUtils.isEmpty(result)) + return document; + return result; + } + +// public static void main(String[] args) { +// String splitTitle1 = splitWords("成长保CEO路小得:技术推动在线教育进入4.0时代"); +// // String splitTitle2 = splitWords("成长保CEO路小得:技术推动在线教育进入4.0时代"); +// // String filterTitle1= DataProcessUtils.StringFilter(splitTitle1); +// +// // String filterTitle2= DataProcessUtils.StringFilter(splitTitle2); +// String aaa = getKeywordList("Automatic Wrap-Around Labeler Machine (ALB-515)"); +// System.err.println(splitTitle1); +// // System.err.println(splitTitle2); +// System.err.println("aa:"+aaa); +// } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/PropertiesUtil.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/PropertiesUtil.java new file mode 100644 index 0000000..db0bfb9 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/PropertiesUtil.java @@ -0,0 +1,33 @@ +package com.bfd.mf.service.tools; + +import java.io.*; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +/** + * properties文件读取 + * @author ruining.he + * */ +public class PropertiesUtil { + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Map getProperties(String filePath){ + Properties properties=new Properties(); + try { + Reader reader = new InputStreamReader(new FileInputStream(new File(filePath)), "utf8"); + properties.load(reader); + return new HashMap(properties); + } catch (FileNotFoundException e) { + } catch (IOException e) { + } + return null; + } + +// public static void main(String[] args) { +// Map map = getProperties("E:\\BaiFenDian\\工作文档\\5月\\B版_develop\\test\\info-config"); +// for(String k:map.keySet()){ +// System.out.println(k + ":" + map.get(k)); +// } +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/ReadExcelUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/ReadExcelUtils.java new file mode 100644 index 0000000..e459fa9 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/ReadExcelUtils.java @@ -0,0 +1,204 @@ +package com.bfd.mf.service.tools; + +import org.apache.commons.lang.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ReadExcelUtils { + + private static String KOL_EXCEL = "字段类型v_0.5(1).xlsx"; + + private static String HEAD_EXCEL = "SQ_head_field.xlsx"; + + private static final String EXCEL_XLS = "xls"; + + private static final String EXCEL_XLSX = "xlsx"; + + public static Map ebxnames = new HashMap(); + + public static Workbook getWorkbok(InputStream in,File file) throws IOException{ + Workbook wb = null; + if(file.getName().endsWith(EXCEL_XLS)){ //Excel 2003 + wb = new HSSFWorkbook(in); + }else if(file.getName().endsWith(EXCEL_XLSX)){ // Excel 2007/2010 + wb = new XSSFWorkbook(in); + } + return wb; + } + + + public static void checkExcelVaild(File file) throws Exception{ + if(!file.exists()){ + throw new Exception("文件不存在"); + } + if(!(file.isFile() && (file.getName().endsWith(EXCEL_XLS) || file.getName().endsWith(EXCEL_XLSX)))){ + throw new Exception("文件不是Excel"); + } + } + + + public static List readExcel() { + + try{ + File excelFile = new File(KOL_EXCEL); // 创建文件对象 + FileInputStream in = new FileInputStream(excelFile); // 文件流 + checkExcelVaild(excelFile); + Workbook workbook = getWorkbok(in,excelFile); + Sheet sheet = workbook.getSheetAt(0); + List sqlString = new ArrayList(); + + for (int rowNum = 2; rowNum <= sheet.getLastRowNum(); rowNum++) { + StringBuffer stringsql = new StringBuffer(); + stringsql.append("insert into field_info ("); + stringsql.append("esfieldName,weiboContentfieldName,ecContentfieldName,newsContentfieldName,bbsContentfieldName,") ; + stringsql.append("weiboCommentfieldName,ecCommentfieldName,newsCommentfieldName,bbsCommentfieldName) value ("); + Row hssfRow = sheet.getRow(rowNum); + if (hssfRow != null ) { + String esColName = ""; + if(hssfRow.getCell(1)!=null){ + esColName = hssfRow.getCell(1).getStringCellValue().trim(); + } + + String weibocontent = ""; + if(hssfRow.getCell(3)!=null){ + weibocontent = hssfRow.getCell(3).getStringCellValue().trim(); + } + + String eccontent = ""; + if(hssfRow.getCell(4)!=null){ + eccontent = hssfRow.getCell(4).getStringCellValue().trim(); + } + + String newscontent = ""; + if(hssfRow.getCell(5)!=null){ + newscontent = hssfRow.getCell(5).getStringCellValue().trim(); + } + + String bbscontent = ""; + if(hssfRow.getCell(6)!=null){ + bbscontent = hssfRow.getCell(6).getStringCellValue().trim(); + } + + String weibocomment = ""; + if(hssfRow.getCell(7)!=null){ + weibocomment = hssfRow.getCell(7).getStringCellValue().trim(); + } + + String eccomment = ""; + if(hssfRow.getCell(8)!=null){ + eccomment = hssfRow.getCell(8).getStringCellValue().trim(); + } + + String newscomment = ""; + if(hssfRow.getCell(9)!=null){ + newscomment = hssfRow.getCell(9).getStringCellValue().trim(); + } + + String bbscomment = ""; + if(hssfRow.getCell(10)!=null){ + bbscomment = hssfRow.getCell(10).getStringCellValue().trim(); + } + + if(StringUtils.isNotBlank(weibocontent) || StringUtils.isNotBlank(eccontent) || StringUtils.isNotBlank(newscontent) || StringUtils.isNotBlank(bbscontent) + || StringUtils.isNotBlank(weibocomment) || StringUtils.isNotBlank(eccomment) || StringUtils.isNotBlank(newscomment) || StringUtils.isNotBlank(bbscomment)){ + stringsql.append("'"+esColName+"',").append("'"+weibocontent+"',").append("'"+eccontent+"',").append("'"+newscontent+"',").append("'"+bbscontent+"',").append("'"+weibocomment+"',").append("'"+eccomment+"',").append("'"+newscomment+"',").append("'"+bbscomment).append("')"); + sqlString.add(stringsql.toString()); + System.out.println(stringsql.toString()); + } + + } + + + } + return sqlString ; + //exeBacthSql(sqlString); + + + }catch(Exception e){ + e.printStackTrace(); + } + + return null ; + + } + + + public static List readheadExcel() { + try{ + File excelFile = new File(HEAD_EXCEL); // 创建文件对象 + FileInputStream in = new FileInputStream(excelFile); // 文件流 + checkExcelVaild(excelFile); + Workbook workbook = getWorkbok(in,excelFile); + Sheet sheet = workbook.getSheetAt(0); + List sqlString = new ArrayList(); + for (int rowNum = 1; rowNum <= sheet.getLastRowNum(); rowNum++) { + StringBuffer stringsql = new StringBuffer(); + stringsql.append("insert into field_head_info ("); + stringsql.append("esfieldName,weiboContentfieldName,ecContentfieldName,newsContentfieldName,bbsContentfieldName") ; + stringsql.append(") value ("); + Row hssfRow = sheet.getRow(rowNum); + if (hssfRow != null ) { + String esColName = ""; + if(hssfRow.getCell(0)!=null){ + esColName = hssfRow.getCell(0).getStringCellValue().trim(); + } + String weibocontent = ""; + if(hssfRow.getCell(2)!=null){ + weibocontent = hssfRow.getCell(2).getStringCellValue().trim(); + } + String eccontent = ""; + if(hssfRow.getCell(3)!=null){ + eccontent = hssfRow.getCell(3).getStringCellValue().trim(); + } + String newscontent = ""; + if(hssfRow.getCell(4)!=null){ + newscontent = hssfRow.getCell(4).getStringCellValue().trim(); + } + String bbscontent = ""; + if(hssfRow.getCell(5)!=null){ + bbscontent = hssfRow.getCell(5).getStringCellValue().trim(); + } + if(StringUtils.isNotBlank(weibocontent) || StringUtils.isNotBlank(eccontent) || StringUtils.isNotBlank(newscontent) || StringUtils.isNotBlank(bbscontent)){ + stringsql.append("'"+esColName+"',").append("'"+weibocontent+"',").append("'"+eccontent+"',").append("'"+newscontent+"',").append("'"+bbscontent).append("')"); + sqlString.add(stringsql.toString()); + System.out.println(stringsql.toString()); + } + } + } + return sqlString ; + }catch(Exception e){ + e.printStackTrace(); + } + return null ; + } + + private static void exeBacthSql(List sqlCache){ + DBUtil.getInstance("").executeBatch(sqlCache); + } + + +// public static void main(String[] args) { +// DBUtil.init("./db.properties"); +// try { +// //List sqlCache = readExcel(); +// List sqlCache2 = readheadExcel(); +// DBUtil.getInstance("db_stat").executeBatch(sqlCache2); +// } catch (Exception e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/RoundRobinJedisPool.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/RoundRobinJedisPool.java new file mode 100644 index 0000000..d1a8f8c --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/RoundRobinJedisPool.java @@ -0,0 +1,268 @@ +/* + * Copyright (C) 2016 Baifendian Corporation + *

    + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

    + * http://www.apache.org/licenses/LICENSE-2.0 + *

    + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.bfd.mf.service.tools; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.google.common.io.Closeables; +import com.wandoulabs.jodis.BoundedExponentialBackoffRetryUntilElapsed; +import com.wandoulabs.jodis.JedisResourcePool; +import org.apache.curator.framework.CuratorFramework; +import org.apache.curator.framework.CuratorFrameworkFactory; +import org.apache.curator.framework.imps.CuratorFrameworkState; +import org.apache.curator.framework.recipes.cache.ChildData; +import org.apache.curator.framework.recipes.cache.PathChildrenCache; +import org.apache.curator.framework.recipes.cache.PathChildrenCache.StartMode; +import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent; +import org.apache.curator.framework.recipes.cache.PathChildrenCacheListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; +import redis.clients.jedis.JedisPoolConfig; +import redis.clients.jedis.exceptions.JedisException; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * A round robin connection pool for connecting multiple codis proxies based on Jedis and Curator. + * + * @author Apache9 + */ +public class RoundRobinJedisPool implements JedisResourcePool { + + private static final Logger LOG = LoggerFactory.getLogger(RoundRobinJedisPool.class); + + private static final ObjectMapper MAPPER = new ObjectMapper(); + + private static final String JSON_NAME_CODIS_PROXY_ADDR = "addr"; + + private static final String JSON_NAME_CODIS_PROXY_STATE = "state"; + + private static final String CODIS_PROXY_STATE_ONLINE = "online"; + + private static final int CURATOR_RETRY_BASE_SLEEP_MS = 100; + + private static final int CURATOR_RETRY_MAX_SLEEP_MS = 30 * 1000; + + private static final int JEDIS_POOL_TIMEOUT_UNSET = -1; + + private static final ImmutableSet RESET_TYPES = Sets + .immutableEnumSet(PathChildrenCacheEvent.Type.CHILD_ADDED, + PathChildrenCacheEvent.Type.CHILD_UPDATED, + PathChildrenCacheEvent.Type.CHILD_REMOVED); + + private final CuratorFramework curatorClient; + + private final boolean closeCurator; + + private final PathChildrenCache watcher; + + private static final class PooledObject { + public final String addr; + + public final JedisPool pool; + + public PooledObject(String addr, JedisPool pool) { + this.addr = addr; + this.pool = pool; + } + + } + + private volatile ImmutableList pools = ImmutableList.of(); + + private final AtomicInteger nextIdx = new AtomicInteger(-1); + + private final JedisPoolConfig poolConfig; + + private final int timeout; + + /** + * Create a RoundRobinJedisPool with default timeout.

    We create a CuratorFramework with infinite retry number. + * If you do not like the behavior, use the other constructor that allow you pass a CuratorFramework created by + * yourself. + * + * @param zkAddr ZooKeeper connect string. e.g., "zk1:2181" + * @param zkSessionTimeoutMs ZooKeeper session timeout in ms + * @param zkPath the codis proxy dir on ZooKeeper. e.g., "/zk/codis/db_xxx/proxy" + * @param poolConfig same as JedisPool + * @see #RoundRobinJedisPool(String, int, String, JedisPoolConfig, int) + */ + public RoundRobinJedisPool(String zkAddr, int zkSessionTimeoutMs, String zkPath, + JedisPoolConfig poolConfig) { + this(zkAddr, zkSessionTimeoutMs, zkPath, poolConfig, JEDIS_POOL_TIMEOUT_UNSET); + } + + /** + * Create a RoundRobinJedisPool.

    We create a CuratorFramework with infinite retry number. If you do not like the + * behavior, use the other constructor that allow you pass a CuratorFramework created by yourself. + * + * @param zkAddr ZooKeeper connect string. e.g., "zk1:2181" + * @param zkSessionTimeoutMs ZooKeeper session timeout in ms + * @param zkPath the codis proxy dir on ZooKeeper. e.g., "/zk/codis/db_xxx/proxy" + * @param poolConfig same as JedisPool + * @param timeout timeout of JedisPool + * @see #RoundRobinJedisPool(CuratorFramework, boolean, String, JedisPoolConfig, int) + */ + public RoundRobinJedisPool(String zkAddr, int zkSessionTimeoutMs, String zkPath, + JedisPoolConfig poolConfig, int timeout) { + this(CuratorFrameworkFactory + .builder() + .connectString(zkAddr) + .sessionTimeoutMs(zkSessionTimeoutMs) + .retryPolicy( + new BoundedExponentialBackoffRetryUntilElapsed(CURATOR_RETRY_BASE_SLEEP_MS, + CURATOR_RETRY_MAX_SLEEP_MS, -1L)).build(), true, zkPath, + poolConfig, timeout); + } + + /** + * Create a RoundRobinJedisPool with default timeout. + * + * @param curatorClient We will start it if it has not started yet. + * @param closeCurator Whether to close the curatorClient passed in when close. + * @param zkPath the codis proxy dir on ZooKeeper. e.g. "/zk/codis/db_xxx/proxy" + * @param poolConfig same as JedisPool + */ + public RoundRobinJedisPool(CuratorFramework curatorClient, boolean closeCurator, String zkPath, + JedisPoolConfig poolConfig) { + this(curatorClient, closeCurator, zkPath, poolConfig, JEDIS_POOL_TIMEOUT_UNSET); + } + + /** + * Create a RoundRobinJedisPool. + * + * @param curatorClient We will start it if it has not started yet. + * @param closeCurator Whether to close the curatorClient passed in when close. + * @param zkPath the codis proxy dir on ZooKeeper. e.g. "/zk/codis/db_xxx/proxy" + * @param poolConfig same as JedisPool + * @param timeout timeout of JedisPool + */ + public RoundRobinJedisPool(CuratorFramework curatorClient, boolean closeCurator, String zkPath, + JedisPoolConfig poolConfig, int timeout) { + this.poolConfig = poolConfig; + this.timeout = timeout; + this.curatorClient = curatorClient; + this.closeCurator = closeCurator; + watcher = new PathChildrenCache(curatorClient, zkPath, true); + watcher.getListenable().addListener(new PathChildrenCacheListener() { + + public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) + throws Exception { + StringBuilder sb = new StringBuilder("zookeeper event received: type=") + .append(event.getType()); + if (event.getData() != null) { + ChildData data = event.getData(); + sb.append(", path=").append(data.getPath()).append(", stat=") + .append(data.getStat()); + } + LOG.info(sb.toString()); + if (RESET_TYPES.contains(event.getType())) { + resetPools(); + } + } + }); + // we need to get the initial data so client must be started + if (curatorClient.getState() == CuratorFrameworkState.LATENT) { + curatorClient.start(); + } + try { + watcher.start(StartMode.BUILD_INITIAL_CACHE); + } catch (Exception e) { + throw new JedisException(e); + } + resetPools(); + } + + private void resetPools() { + ImmutableList pools = this.pools; + Map addr2Pool = Maps.newHashMapWithExpectedSize(pools.size()); + for (PooledObject pool : pools) { + addr2Pool.put(pool.addr, pool); + } + ImmutableList.Builder builder = ImmutableList.builder(); + for (ChildData childData : watcher.getCurrentData()) { + try { + JsonNode proxyInfo = MAPPER.readTree(childData.getData()); + if (!CODIS_PROXY_STATE_ONLINE.equals(proxyInfo.get(JSON_NAME_CODIS_PROXY_STATE) + .asText())) { + continue; + } + String addr = proxyInfo.get(JSON_NAME_CODIS_PROXY_ADDR).asText(); + PooledObject pool = addr2Pool.remove(addr); + if (pool == null) { + LOG.info("Add new proxy: " + addr); + String[] hostAndPort = addr.split(":"); + String host = hostAndPort[0]; + int port = Integer.parseInt(hostAndPort[1]); + if (timeout == JEDIS_POOL_TIMEOUT_UNSET) { + pool = new PooledObject(addr, new JedisPool(poolConfig, host, port)); + } else { + pool = new PooledObject(addr, + new JedisPool(poolConfig, host, port, timeout)); + } + } + builder.add(pool); + } catch (Exception e) { + LOG.warn("parse " + childData.getPath() + " failed", e); + } + } + this.pools = builder.build(); + for (PooledObject pool : addr2Pool.values()) { + LOG.info("Remove proxy: " + pool.addr); + pool.pool.close(); + } + } + + public Jedis getResource() { + ImmutableList pools = this.pools; + if (pools.isEmpty()) { + throw new JedisException("Proxy list empty"); + } + for (; ; ) { + int current = nextIdx.get(); + int next = current >= pools.size() - 1 ? 0 : current + 1; + if (nextIdx.compareAndSet(current, next)) { + return pools.get(next).pool.getResource(); + } + } + } + + public void close() { + try { + Closeables.close(watcher, true); + } catch (IOException e) { + LOG.error("IOException should not have been thrown", e); + } + if (closeCurator) { + curatorClient.close(); + } + List pools = this.pools; + this.pools = ImmutableList.of(); + for (PooledObject pool : pools) { + pool.pool.close(); + } + } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/ValueException.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/ValueException.java new file mode 100644 index 0000000..64739b8 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/ValueException.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2016 Baifendian Corporation + *

    + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

    + * http://www.apache.org/licenses/LICENSE-2.0 + *

    + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.bfd.mf.service.tools; + +/** + * @author: EricLiutyy (Zheng Liu) + * @date: 16/8/11 20:17 + * @descirption: + */ +public class ValueException extends Exception { + public ValueException(String msg) { + super(msg); + } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/WeiboFilterUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/WeiboFilterUtils.java new file mode 100644 index 0000000..f7337be --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/WeiboFilterUtils.java @@ -0,0 +1,210 @@ +package com.bfd.mf.service.tools; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Created by Changquanyou on 2017/6/12. + * 微博数据 filter + * 1:去除 用户名 + * 2:去除 url + * 3:去除 表情 + * 4:去除 tag + */ +public class WeiboFilterUtils { + /** + * URL正则表达式 + */ + private static final Pattern urlPattern = Pattern.compile( + "(?:^|[\\W])((ht|f)tp(s?):\\/\\/|www\\.)" + + "(([\\w\\-]+\\.){1,}?([\\w\\-.~]+\\/?)*" + + "[\\p{Alnum}.,%_=?&#\\-+()\\[\\]\\*$~@!:/{};']*)", + Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL); + private static final Pattern hashtagPattern = + Pattern.compile("#[^#]+#"); + + private static final Pattern emotionPattern = + Pattern.compile("\\[([^\\[\\]]+)\\]"); + + private static final Pattern usermentionPattern = + Pattern.compile("@[\u4e00-\u9fa5a-zA-Z0-9_-]{2,30}"); + /** + * 去掉文本中URLs + * @param text + * @return + */ + public static String removeURLs(String text){ + Matcher matcher; + String newTweet = text.trim(); + String cleanedText=""; + while(!newTweet.equals(cleanedText)){ + cleanedText=newTweet; + matcher = urlPattern.matcher(cleanedText); + newTweet = matcher.replaceAll(""); + newTweet =newTweet.trim(); + } + return cleanedText; + } + + /** + * 获得文本中URL列表 + * @param originalString + * @return + */ + private static List getURLs(String originalString){ + List urlsSet=new ArrayList(); + Matcher matcher = urlPattern.matcher(originalString); + while (matcher.find()) { + int matchStart = matcher.start(1); + int matchEnd = matcher.end(); + String tmpUrl=originalString.substring(matchStart,matchEnd); + urlsSet.add(tmpUrl); + // now you have the offsets of a URL match + originalString=originalString.replace(tmpUrl,""); + matcher = urlPattern.matcher(originalString); + } + return urlsSet; + } + /** + * Hashtag正则表达式 + */ +// private static final Pattern hashtagPattern = +// Pattern.compile("(?:^|\\s|[\\p{Punct}&&[^/]])(#[\\p{L}0-9-_]+)"); + + private static String removeHashtags(String text){ + Matcher matcher; + String newTweet = text.trim(); + String cleanedText=""; + while(!newTweet.equals(cleanedText)){ + cleanedText=newTweet; + matcher = hashtagPattern.matcher(cleanedText); + newTweet = matcher.replaceAll(""); + newTweet =newTweet.trim(); + } + return cleanedText; + } + + + /** + * 用户@正则表达式 + * 新浪微博中的用户名格式为是“4-30个字符,支持英文、数字、"_"或减号”, + * 也就是说,支持中文、字母、数字、下划线及减号,并且是4到30个字符(这里暂且认为汉字为一个字符) + * 那么在写匹配的表达式的时候就可以这么来写: @[\u4e00-\u9fa5a-zA-Z0-9_-]{4,30} + */ + // private static final Pattern usermentionPattern = +// Pattern.compile("(?:^|\\s|[\\p{Punct}&&[^/]])(@[\\p{L}0-9-_]+)"); + + public static String removeUserMentions(String text){ + Matcher matcher; + String newTweet = text.trim(); + String cleanedText=""; + while(!newTweet.equals(cleanedText)){ + cleanedText=newTweet; + matcher = usermentionPattern.matcher(cleanedText); + newTweet = matcher.replaceAll(""); + newTweet =newTweet.trim(); + } + return cleanedText; + } + + private static List getUsermentions(String originalString){ + List usermentionsSet=new ArrayList(); + Matcher matcher = usermentionPattern.matcher(originalString); + while (matcher.find()) { +// int matchStart = matcher.start(1); + int matchStart = matcher.start(); + int matchEnd = matcher.end(); + String tmpUsermention=originalString.substring(matchStart,matchEnd); + usermentionsSet.add(tmpUsermention); + originalString=originalString.replace(tmpUsermention,""); + matcher = usermentionPattern.matcher(originalString); + } + return usermentionsSet; + } + + public static String removeEmotion(String text){ + Matcher matcher; + String newTweet = text.trim(); + String cleanedText=""; + while(!newTweet.equals(cleanedText)){ + cleanedText=newTweet; + matcher = emotionPattern.matcher(cleanedText); + newTweet = matcher.replaceAll(""); + newTweet =newTweet.trim(); + } + return cleanedText; + } + + + /** + * 获取博文中提到的话题 + */ + public static List getHashtags(String originalString){ + List hashtagSet=new ArrayList(); + Matcher matcher = hashtagPattern.matcher(originalString); + while (matcher.find()) { +// int matchStart = matcher.start(1); + int matchStart = matcher.start(); + int matchEnd = matcher.end(); + String tmpHashtag=originalString.substring(matchStart,matchEnd); + hashtagSet.add(tmpHashtag); + originalString=originalString.replace(tmpHashtag,""); + matcher = hashtagPattern.matcher(originalString); + } + return hashtagSet; + } + + /** + * 获取博文中的表情 + */ + public static List getEmotion(String originalString){ + List usermentionsSet=new ArrayList(); + Matcher matcher = emotionPattern.matcher(originalString); + while (matcher.find()) { + int matchStart = matcher.start(); + int matchEnd = matcher.end(); + String tmpUsermention=originalString.substring(matchStart,matchEnd); + usermentionsSet.add(tmpUsermention); + originalString=originalString.replace(tmpUsermention,""); + matcher = emotionPattern.matcher(originalString); + } + return usermentionsSet; + } + +// public static void main(String [] args){ +// String t1= "#大数据#[赶火车]"; +// String t2= "#大数据#[dads][sasa][sasa]http://c.biancheng.net/cpp/view/7011.html"; +// String t3 = "接下来就是见证奇迹的时刻[跪了]你把这杯推到我面前是什么意思,全身上下每个毛孔都在拒绝,喝到墨水会不会秒变大章鱼![悲伤]我不听,这回墨水和锐澳墨水概念鸡尾酒得我亲自来倒给你喝!@RIO锐澳鸡尾酒 @天猫 #国潮来了# http://t.cn/EKINFJ0 http://t.cn/EKSLwxx "; +// System.out.println(removeHashtags(t1)); +// System.out.println(getEmotion(t2)); +// System.out.println(removeURLs(removeEmotion(t2))); +// +// +// System.out.println(getEmotion(t3)); +// System.out.println(getHashtags(t3)); +// +//// String ww = "@M鹿M 我在安慕希#奔跑吧#能量榜上为你打call啦,你就是最火力全开的奔跑兄弟! http://t.cn/RBS4Wzj安慕希奔跑... \n"; +//// System.err.println(ww); +//// System.err.println(removeUserMentions(removeURLs(removeEmotion(ww)))); +//// +//// ww= "做梦都想着来的那天在机场被安检大哥没收的几盒没喝上的安慕希…… http://t.cn/R0QMmol韩国·明洞 \n"; +//// System.err.println(removeUserMentions(removeURLs(removeEmotion(ww)))); +//// List terms = HanLP.segment(removeUserMentions(removeURLs(removeEmotion(ww)))); +//// for (Term term:terms +//// ) { +//// System.err.println(term.nature); +//// System.err.println(term); +//// } +//// List list = getHashtags("#aaaaa#aaaaaaaaaaa#bbbbbbbb#"); +//// list.forEach(tag->{ +//// System.err.println(tag); +//// }); +// } + + + + + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/tools/WriteMethod.java b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/WriteMethod.java new file mode 100644 index 0000000..194b420 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/tools/WriteMethod.java @@ -0,0 +1,21 @@ +package com.bfd.mf.service.tools; + +import java.io.FileWriter; +import java.io.IOException; + +/** + * Created by BFD-229 on 2017/7/6. + */ +public class WriteMethod { + public static void writeMethod(String fileName, String json){ + try{ + FileWriter writer=new FileWriter(fileName,true); + writer.write(json+"\n"); + writer.close(); + } catch (IOException e) + { + e.printStackTrace(); + } + } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/utils/AvailcontentApiUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/AvailcontentApiUtils.java new file mode 100644 index 0000000..92e15a9 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/AvailcontentApiUtils.java @@ -0,0 +1,32 @@ +package com.bfd.mf.service.utils; + +import com.alibaba.fastjson.JSONObject; +import com.bfd.mf.service.tools.HttpClientUtil; + +import java.util.HashMap; +import java.util.Map; + +/** + * 调用接口 获取数据的有效性 + */ +public class AvailcontentApiUtils { //http://rule.sq.baifendian.com/availcontent + public final static String apiUrl = "http://rule.sq.baifendian.com/availcontent" ; + + public static Integer post(String content) { + int postResult = 2; + try{ + Map param= new HashMap(); + param.put("content", content); + String result = HttpClientUtil.httpPost(apiUrl, param); + JSONObject jsonData = JSONObject.parseObject(result); + if(null != jsonData || !("").equals(jsonData)) { + Integer availability = Integer.parseInt(jsonData.get("availability").toString()); + postResult = availability; + } + }catch(Exception e){ + e.printStackTrace(); + } + return postResult; + } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/utils/HlkkwUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/HlkkwUtils.java new file mode 100644 index 0000000..ac363c0 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/HlkkwUtils.java @@ -0,0 +1,267 @@ +package com.bfd.mf.service.utils; + + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.bfd.mf.service.tools.*; +import com.hankcs.hanlp.HanLP; +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; + +import java.text.Collator; +import java.util.*; +import java.util.regex.Pattern; + +public class HlkkwUtils { + + private static final Logger LOG = Logger.getLogger(HlkkwUtils.class); + private static String placeUrl = "http://rule.sq.baifendian.com/nerplace"; + + public static List getHLKkeyword(String content, Map newmap){ + List hlKeyWord = new ArrayList(); + try{ + String words = NlpUtils.getKeywordList(content, 10) ; + JSONObject wordsJsonObject = JSONObject.parseObject(words); + Set stringSet = wordsJsonObject.keySet(); + stringSet = getKeyWord(stringSet); + hlKeyWord = new ArrayList<>(stringSet); + newmap.put("sysKeywords", words) ; + }catch(Exception e){ + e.printStackTrace(); + } + return hlKeyWord ; + } + + public static String getSysAbstract(String content){ + return NlpUtils.extractSummary(content, 3) ; + } + + public static List getPlace(String content, String title){ + List placeList = HanLPUtils.placeRecognizeWithCws(new String[]{content}); + //List placeList = new ArrayList<>(); + List hlanLpAndLTPList = null; + if(placeList != null && placeList.size() != 0) { + hlanLpAndLTPList = getLtpAndHanLpPlace(content, title , placeList); + }else{ + hlanLpAndLTPList = placeList; + } + if (!placeList.isEmpty()) { + return hlanLpAndLTPList ; + } + return hlanLpAndLTPList ; + } + + private static List getLtpAndHanLpPlace(String content, String title, List placeList){ + List ltpList = getLtpPlace(content,title); + List ltpAndHlanlpList = new ArrayList<>(); + if (placeList != null && ltpList != null) { + for (String word : placeList) { + if (ltpList.contains(word)) { + ltpAndHlanlpList.add(word); + } + } + return ltpAndHlanlpList; + }else{ + return placeList; + } + } + + private static List getLtpPlace(String content, String title) { + Map param= new HashMap(); + param.put("content", content); + param.put("title", title); +// String result = HttpClientUtil.httpPost("http://intrest.ner.mediaforce.cn/ner_ns", param); + String result = HttpClientUtil.httpPost(placeUrl, param); +// System.out.println(result); + if(StringUtils.isNotEmpty(result)) { + String[] ltpArray = result.split(" "); + List ltpList = Arrays.asList(ltpArray); + return ltpList; + }else{ + return new ArrayList<>(); + } + } + + /** + * 处理长文本 + */ + public static String processLongText(String title,String content, Map newmap ,String docType){ + String contentSimHash = ""; + try { + int titleSize = title.length(); + int contentSize = content.length(); + /**content includes title*/ + if(content.contains(title)){ + int beginIndex = (contentSize - 3 *titleSize)>0?3 *titleSize:contentSize; + int endIndex = (contentSize - 3 *titleSize)>0?(contentSize - 3 *titleSize):0; + int lastTitleIndex = content.lastIndexOf(title); + int firstTitleIndex = content.indexOf(title); + if(firstTitleIndex >=0 && firstTitleIndex < beginIndex) + content = content.replaceFirst(title,""); + if(lastTitleIndex >=0 && lastTitleIndex > firstTitleIndex && endIndex <= lastTitleIndex) + content = replaceLast(content,title,""); + } + List phraseLists = HanLP.extractPhrase(content, 50); + //LOG.info("[HlkkwUtils processLongText] phraseListsSize : "+phraseLists.size()); + /**@FIXED check if phrase list is empty*/ + if(phraseLists == null || phraseLists.size() == 0){ + List normalizeLists = new ArrayList<>(); + normalizeLists.add(System.nanoTime()+""); + normalizeLists.add(docType); + newmap.put("originalPhrase", JSON.toJSONString(normalizeLists)); + newmap.put("finalPhrase", JSON.toJSONString(normalizeLists)); + /*-1 标记 mark failed */ + newmap.put("phraseMark","-1"); + contentSimHash = MfMD5Util.GetMD5Code(JSON.toJSONString(normalizeLists)); + LOG.info("[processLongText method] could't extract phrase info,please checkout the docId "+newmap.get("docId")); + }else{ + newmap.put("originalPhrase", JSON.toJSONString(phraseLists)); + phraseLists = sortByTF(phraseLists,content,7,title); + /**sort by default order*/ + Collections.sort(phraseLists,new Comparator(){ + Collator clt= Collator.getInstance(); + @Override + public int compare(String o1, String o2) { + return clt.compare(o1, o2); + } + }); + String phraseStr = ""; + for (String str:phraseLists + ) { + phraseStr +=str; + } + newmap.put("finalPhrase", JSON.toJSONString(phraseLists)); + contentSimHash = MfMD5Util.GetMD5Code(phraseStr); + } + }catch(Exception e){ + e.printStackTrace(); + LOG.error("getHashByPhrase method is error {}",e); + contentSimHash = MfMD5Util.GetMD5Code(docType+"_"+System.nanoTime()); + } + return contentSimHash; + } + + public static String replaceLast(String str, String oldValue, String newValue) { + str = StringUtils.reverse(str); + str = str.replaceFirst(StringUtils.reverse(oldValue), StringUtils.reverse(newValue)); + str = StringUtils.reverse(str); + return str; + } + + + public static List sortByTF(List phraseLists,String content,int topPhraseNumber,String title){ + List lists = new ArrayList<>(); + int topNumber = 2; + int topIndex =0; + /**1:get top 2 phrase */ + for (String phrase:phraseLists) { + if(topIndex < topNumber){ + lists.add(phrase); + }else{ + break; + } + topIndex ++ ; + } + Map phraseMap = new TreeMap<>(); + for (String phrase:phraseLists) { + phraseMap.put(phrase,content.split(phrase).length -1); + } + List> list = new ArrayList<>(phraseMap.entrySet()); + + Collections.sort(list,new Comparator>() { + /**降序排列*/ + @Override + public int compare(Map.Entry o1, Map.Entry o2) { + return - o1.getValue().compareTo(o2.getValue()); + } + }); + int index =0; + for (Map.Entry e: list) { + /**出现在标题中的值;需要ignore;*/ + if(index < topPhraseNumber){ + // if(!title.contains(e.getKey())){ + lists.add(e.getKey()); + index ++; + // } + }else{ + break; + } + } + return lists; + } + + + public static Map initContentTag(Map newmap,String docType ,String content){ + newmap.put("contentTag","normal"); +// if(docType.equals("weibo")){ +// List hashTags = WeiboFilterUtils.getHashtags(content); +// if(!hashTags.isEmpty()){ +// newmap.put("hashTag",JSON.toJSONString(hashTags)); +// } +// List expression = WeiboFilterUtils.getEmotion(content); +// if(!expression.isEmpty()){ +// newmap.put("expression",JSON.toJSONString(expression)); +// } +// } + return newmap ; + } + + + /** + * 去掉特殊字符等不必要的数据 + */ + public static Set getKeyWord(Set set) { + Set resultSet = new HashSet(); + resultSet.addAll(set); + //String E1 = "[`~!@$%^&*()+=|{}':;',.<>/?~!@¥%……&*()——+|{}【】‘;:”“’。,、?]"; + String E1 = "[`~!#@$%^&*()+=|{}':;',.<>/?~!@¥%……&*()——+|{}【】‘;:”“’。,、?]"; + String E2 = "[a-zA-Z]";// 英文 + String E3 = "[0-9]";// 数字 + Pattern p = Pattern.compile(E1); + for (String s : set) { + if (s.length() == 1) { + if (s.matches(E2)) { + resultSet.remove(s); + continue; + } + if (s.matches(E3)) { + resultSet.remove(s); + continue; + } + if (s.equals("#")) { + resultSet.remove(s); + continue; + } + } + if (p.matcher(s).find()) { + resultSet.remove(s); + } + } + return resultSet; + } + +// public static void main(String[] args) { +// // System.out.println(getHLKkeyword("我从小看你长大#萌宠##王一博##可爱##治愈##动物保护# ​[憧憬][憧憬][憧憬],!&^*")); +// Map json = new HashMap(); +// json.put("docId", "1234"); +// processLongText("你好","我很好",json,"weibo"); +// System.out.println(json); +// +// } +//public static void main(String[] args) { +// String title = "香水收到了,是正品,味道好闻,价格实惠,物超所值,赞????????"; +// String content = "香水收到了,是正品,味道好闻,价格实惠,物超所值,赞????????"; +// Map map = new HashMap<>(); +// String docType = "item"; +// +// String regEx = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]"; +// Pattern p = Pattern.compile(regEx); +// Matcher m = p.matcher(content); +// content = m.replaceAll("").trim(); // c5940d55aa06119ab2f40260f031955e +// //title = m.replaceAll("").trim(); +// +// String a = processLongText(title,content,map,docType); +// System.out.println(a); +// +//} +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/utils/OpinionApiUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/OpinionApiUtils.java new file mode 100644 index 0000000..1efb738 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/OpinionApiUtils.java @@ -0,0 +1,44 @@ +package com.bfd.mf.service.utils; + + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.bfd.mf.service.tools.HttpClientUtil; +import org.apache.log4j.Logger; + +import java.util.*; + +/** + * content 中的 情感词提取 + */ +public class OpinionApiUtils { + private static final Logger logger = Logger.getLogger(OpinionApiUtils.class); + private static String sentimentUrl = "http://rule.sq.baifendian.com/sentiment_trigger"; + + public static List getOpinion(String content) { + List result = new ArrayList<>(); + try{ + Map param= new HashMap(); + param.put("content", content); + String resReuslt = HttpClientUtil.httpPost(sentimentUrl, param); + if(resReuslt == "" || "".equals(resReuslt)){ + Thread.sleep(3000); + resReuslt = HttpClientUtil.httpPost(sentimentUrl, param); + } + //System.out.println(" **** OpinionHttpClientUtils resReuslt = " + resReuslt); + JSONObject jsonData = JSONObject.parseObject(resReuslt); + //System.out.println("[OpinionHttpClientUtils] getOpinion 88888 : "+jsonData.get("sentiment_words")); + if(!jsonData.get("sentiment_words").toString().contains("[") && !jsonData.get("sentiment_words").toString().contains("]")){ + result.addAll(new HashSet<>(JSONArray.parseArray("[]", String.class))); + }else { + result.addAll(new HashSet<>(JSONArray.parseArray(jsonData.getJSONArray("sentiment_words").toJSONString(), String.class))); + } + }catch(Exception e){ + e.printStackTrace(); + logger.error("OpinionHttpClientUtils>>> getOpinion---content:"+content); + } + return result ; + + } + +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/utils/SentimentApiUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/SentimentApiUtils.java new file mode 100644 index 0000000..89065ac --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/SentimentApiUtils.java @@ -0,0 +1,152 @@ +package com.bfd.mf.service.utils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import com.bfd.crawler.utils.JsonUtils; +import com.bfd.mf.service.tools.HttpClientUtil; +import com.bfd.mf.service.tools.WriteMethod; +import org.apache.log4j.Logger; + +/** + * Bert 情感 + */ +public class SentimentApiUtils { + + private static final Logger LOG = Logger.getLogger(SentimentApiUtils.class); + + public final static String apiUrl = "http://172.18.1.166:15038/bertsentiment" ; + + public double getSentimentValue(String title){ +// long a = System.currentTimeMillis(); + String result = null; + List> lists = new ArrayList>(); + Map params = new HashMap(); + params.put("title", title); + params.put("summary", "很好"); + params.put("sentiment", "0"); + lists.add(params); + + result = HttpClientUtil.httpPost(apiUrl, lists); +// System.out.println(result); + try { + List> results = (List>) JsonUtils.parseArray(result); + double score = Double.valueOf(results.get(0).get("sentiment").toString()); +// long b = System.currentTimeMillis(); +// System.out.println(b-a); + return score ; + } catch (Exception e) { + e.printStackTrace(); + } + + return 0.0 ; + } + + public synchronized Vector getSentimentValue(Vector datas){ + Vector datanews = null ; + Vector resultV = null ; + try { + resultV = new Vector(); + if(datas.size() > 0){ + datanews = new Vector(datas); + datas.clear(); + List> results = new ArrayList<>(); + Map param ; + if(results.size() > 0){ + for(Map res : results){ + param = new HashMap(res); + for(Map.Entry entry : res.entrySet()){ + String mapKey = entry.getKey(); + Object mapValue = entry.getValue(); + if(mapKey.equals("title")){ + param.remove("title"); + } + + if(mapKey.equals("tittles")){ + param.put("title", mapValue); + param.remove("tittles"); + } + + if(mapKey.equals("contens")){ + param.put("content", mapValue); + param.remove("contens"); + } + + if(mapKey.equals("summary")){ + param.remove("summary"); + } + + if(mapKey.equals("sentiment")){ + param.put("sysSentiment", mapValue); + param.remove("sentiment"); + } + } + resultV.add(JsonUtils.toJSONString(param)); + } + } + } + return resultV ; + } catch (Exception e) { + e.printStackTrace(); + LOG.error("SentimentApiUtils>>> getSentimentValue data : "+datanews); + } + return resultV ; + } + +// public synchronized Vector getSentimentValue(Vector datas){ +// Vector datanews = null ; +// Vector resultV = null ; +// try { +// resultV = new Vector(); +// if(datas.size() > 0){ +// datanews = new Vector(datas); +// datas.clear(); +// List> results = new ArrayList<>(); +// String result = HttpClientUtil.httpPost(apiUrl, datanews); +// results = JsonUtils.parseArray(result); +// +// Map param ; +// if(results.size() > 0){ +// for(Map res : results){ +// param = new HashMap(res); +// for(Map.Entry entry : res.entrySet()){ +// String mapKey = entry.getKey(); +// Object mapValue = entry.getValue(); +// if(mapKey.equals("title")){ +// param.remove("title"); +// } +// +// if(mapKey.equals("tittles")){ +// param.put("title", mapValue); +// param.remove("tittles"); +// } +// +// if(mapKey.equals("contens")){ +// param.put("content", mapValue); +// param.remove("contens"); +// } +// +// if(mapKey.equals("summary")){ +// param.remove("summary"); +// } +// +// if(mapKey.equals("sentiment")){ +// param.put("sysSentiment", mapValue); +// param.remove("sentiment"); +// } +// } +// resultV.add(JsonUtils.toJSONString(param)); +// } +// } +// } +// return resultV ; +// } catch (Exception e) { +// e.printStackTrace(); +// LOG.error("SentimentApiUtils>>> getSentimentValue data : "+datanews); +// } +// return resultV ; +// } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/utils/TransferclfApiUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/TransferclfApiUtils.java new file mode 100644 index 0000000..47a65be --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/TransferclfApiUtils.java @@ -0,0 +1,23 @@ +package com.bfd.mf.service.utils; + +import com.alibaba.fastjson.JSONObject; +import com.bfd.mf.service.tools.HttpClientUtil; + +import java.util.HashMap; +import java.util.Map; + +/** + * 电商数据属性判断 + */ +public class TransferclfApiUtils { + + public final static String apiUrl = "http://rule.sq.baifendian.com/transferclf" ; + + public static String post(String content){ + Map datanews = new HashMap<>(); + datanews.put("content",content); + String result = HttpClientUtil.httpPost(apiUrl, datanews); + Map resultMap = JSONObject.parseObject(result); + return resultMap.get("result").toString(); + } +} diff --git a/cl_stream_service/src/main/java/com/bfd/mf/service/utils/WordCloudApiUtils.java b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/WordCloudApiUtils.java new file mode 100644 index 0000000..9bfee20 --- /dev/null +++ b/cl_stream_service/src/main/java/com/bfd/mf/service/utils/WordCloudApiUtils.java @@ -0,0 +1,20 @@ +package com.bfd.mf.service.utils; + +import com.alibaba.fastjson.JSONObject; +import com.bfd.mf.service.tools.HttpClientUtil; + +import java.util.HashMap; +import java.util.Map; + +public class WordCloudApiUtils { + public final static String apiUrl = "http://rule.sq.baifendian.com/wordcloud" ; + + public static String post(String content){ + Map datanews = new HashMap<>(); + datanews.put("content",content); + String result = HttpClientUtil.httpPost(apiUrl, datanews); + Map resultMap = JSONObject.parseObject(result); + System.out.println(resultMap); + return resultMap.toString(); + } +} diff --git a/cl_stream_service/src/main/resources/hanlp.properties b/cl_stream_service/src/main/resources/hanlp.properties new file mode 100644 index 0000000..e7518b1 --- /dev/null +++ b/cl_stream_service/src/main/resources/hanlp.properties @@ -0,0 +1,41 @@ +#本配置文件中的路径的根目录,根目录+其他路径=完整路径(支持相对路径,请参考:https://github.com/hankcs/HanLP/pull/254) +#Windows用户请注意,路径分隔符统一使用/ +root=/opt/data/nlp/hanlp/ +#root=/Users/mountain/Documents/nlp/hanlp/ +#root = D:/opt/data/nlp/hanlp + +#好了,以上为唯一需要修改的部分,以下配置项按需反注释编辑。 + +#核心词典路径 +#CoreDictionaryPath=data/dictionary/CoreNatureDictionary.txt +#2元语法词典路径 +#BiGramDictionaryPath=data/dictionary/CoreNatureDictionary.ngram.txt +#自定义词典路径,用;隔开多个自定义词典,空格开头表示在同一个目录,使用“文件名 词性”形式则表示这个词典的词性默认是该词性。优先级递减。 +#所有词典统一使用UTF-8编码,每一行代表一个单词,格式遵从[单词] [词性A] [A的频次] [词性B] [B的频次] ... 如果不填词性则表示采用词典的默认词性。 +CustomDictionaryPath=data/dictionary/custom/CustomDictionary.txt; 现代汉语补充词库.txt; 全国地名大全.txt ns; 人名词典.txt; 机构名词典.txt; 上海地名.txt ns;data/dictionary/person/nrf.txt nrf; +#停用词词典路径 +#CoreStopWordDictionaryPath=data/dictionary/stopwords.txt +#同义词词典路径 +#CoreSynonymDictionaryDictionaryPath=data/dictionary/synonym/CoreSynonym.txt +#人名词典路径 +#PersonDictionaryPath=data/dictionary/person/nr.txt +#人名词典转移矩阵路径 +#PersonDictionaryTrPath=data/dictionary/person/nr.tr.txt +#繁简词典根目录 +#tcDictionaryRoot=data/dictionary/tc +#HMM分词模型 +#HMMSegmentModelPath=data/model/segment/HMMSegmentModel.bin +#分词结果是否展示词性 +#ShowTermNature=true +#IO适配器,实现com.hankcs.hanlp.corpus.io.IIOAdapter接口以在不同的平台(Hadoop、Redis等)上运行HanLP +#默认的IO适配器如下,该适配器是基于普通文件系统的。 +#IOAdapter=com.hankcs.hanlp.corpus.io.FileIOAdapter +#感知机词法分析器 +#PerceptronCWSModelPath=data/model/perceptron/pku199801/cws.bin +#PerceptronPOSModelPath=data/model/perceptron/pku199801/pos.bin +#PerceptronNERModelPath=data/model/perceptron/pku199801/ner.bin +#CRF词法分析器 +#CRFCWSModelPath=data/model/crf/pku199801/cws.txt +#CRFPOSModelPath=data/model/crf/pku199801/pos.txt +#CRFNERModelPath=data/model/crf/pku199801/ner.txt +#更多配置项请参考 https://github.com/hankcs/HanLP/blob/master/src/main/java/com/hankcs/hanlp/HanLP.java#L59 自行添加 \ No newline at end of file diff --git a/dataSaveManager/dataSaveManager.iml b/dataSaveManager/dataSaveManager.iml new file mode 100644 index 0000000..65d8133 --- /dev/null +++ b/dataSaveManager/dataSaveManager.iml @@ -0,0 +1,1047 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dataSaveManager/pom.xml b/dataSaveManager/pom.xml new file mode 100644 index 0000000..7980398 --- /dev/null +++ b/dataSaveManager/pom.xml @@ -0,0 +1,18 @@ + + + + cl_stream + com.bfd.mf + 2.0-SNAPSHOT + + 4.0.0 + + dataSaveManager + + + + + + \ No newline at end of file diff --git a/dataSaveManager/src/main/java/com/bfd/mf/datasave/rmi/DataSaveManager.java b/dataSaveManager/src/main/java/com/bfd/mf/datasave/rmi/DataSaveManager.java new file mode 100644 index 0000000..7b7fc52 --- /dev/null +++ b/dataSaveManager/src/main/java/com/bfd/mf/datasave/rmi/DataSaveManager.java @@ -0,0 +1,21 @@ +package com.bfd.mf.datasave.rmi; + + +import com.bfd.mf.entity.FieldNormaliz; + +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.util.Map; + +public interface DataSaveManager extends Remote{ + + public void addTaskName(FieldNormaliz fieldNormaliz) throws RemoteException; + + public void stopImprotTask(int kafkaSerName, String kafkaName) throws RemoteException ; + + public void startImprotTask(String kafkaName) throws RemoteException ; + + public long getNowImportEsNum(Map param) throws RemoteException; + + public int getNowKafkaNum() throws RemoteException ; +} diff --git a/dataSaveManager/src/main/java/com/bfd/mf/entity/DataSaveManager.java b/dataSaveManager/src/main/java/com/bfd/mf/entity/DataSaveManager.java new file mode 100644 index 0000000..4f4d065 --- /dev/null +++ b/dataSaveManager/src/main/java/com/bfd/mf/entity/DataSaveManager.java @@ -0,0 +1,21 @@ +package com.bfd.mf.entity; + + +import com.bfd.mf.entity.FieldNormaliz; + +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.util.Map; + +public interface DataSaveManager extends Remote{ + + public void addTaskName(FieldNormaliz fieldNormaliz) throws RemoteException; + + public void stopImprotTask(int kafkaSerName, String kafkaName) throws RemoteException ; + + public void startImprotTask(String kafkaName) throws RemoteException ; + + public long getNowImportEsNum(Map param) throws RemoteException; + + public int getNowKafkaNum() throws RemoteException ; +} diff --git a/dataSaveManager/src/main/java/com/bfd/mf/entity/FieldInfo.java b/dataSaveManager/src/main/java/com/bfd/mf/entity/FieldInfo.java new file mode 100644 index 0000000..5d3185f --- /dev/null +++ b/dataSaveManager/src/main/java/com/bfd/mf/entity/FieldInfo.java @@ -0,0 +1,39 @@ +package com.bfd.mf.entity; + +import java.util.List; + +public class FieldInfo { + + private String kafka_type ; + + private List kafkaJsonString ; + + private List kafkaJsonArray ; + + public String getKafka_type() { + return kafka_type; + } + + public void setKafka_type(String kafka_type) { + this.kafka_type = kafka_type; + } + + public List getKafkaJsonString() { + return kafkaJsonString; + } + + public void setKafkaJsonString(List kafkaJsonString) { + this.kafkaJsonString = kafkaJsonString; + } + + public List getKafkaJsonArray() { + return kafkaJsonArray; + } + + public void setKafkaJsonArray(List kafkaJsonArray) { + this.kafkaJsonArray = kafkaJsonArray; + } + + + +} diff --git a/dataSaveManager/src/main/java/com/bfd/mf/entity/FieldNormaliz.java b/dataSaveManager/src/main/java/com/bfd/mf/entity/FieldNormaliz.java new file mode 100644 index 0000000..1dbe416 --- /dev/null +++ b/dataSaveManager/src/main/java/com/bfd/mf/entity/FieldNormaliz.java @@ -0,0 +1,207 @@ +package com.bfd.mf.entity; + +import java.io.Serializable; +import java.util.Map; +import java.util.Set; + +public class FieldNormaliz implements Serializable{ + + private static final long serialVersionUID = 1L; + + private int id ; + + private String kafkaName ; + + private int kafkaSerName ; + + private int esSerName ; + + private String esSuffixNames ; + + private String docType ; + + private int isSemtimentApi ; + + private boolean ishlKeyword ; + + private int bussinessType ; + + private Map fieldNormalizeContentMap ; + + private Map fieldNormalizeCommentMap ; + + private Map>> fieldDataMap ; + + private Map fieldInfo ; + + private String groupId ; + + private String createTime ; + + private String finshTime ; + + private int status ; + + private String projectName ; + + public String getKafkaName() { + return kafkaName; + } + + public void setKafkaName(String kafkaName) { + this.kafkaName = kafkaName; + } + + public int getKafkaSerName() { + return kafkaSerName; + } + + public void setKafkaSerName(int kafkaSerName) { + this.kafkaSerName = kafkaSerName; + } + + public int getEsSerName() { + return esSerName; + } + + public void setEsSerName(int esSerName) { + this.esSerName = esSerName; + } + + public String getDocType() { + return docType; + } + + public void setDocType(String docType) { + this.docType = docType; + } + + public int getIsSemtimentApi() { + return isSemtimentApi; + } + + public void setIsSemtimentApi(int isSemtimentApi) { + this.isSemtimentApi = isSemtimentApi; + } + + public int getBussinessType() { + return bussinessType; + } + + public void setBussinessType(int bussinessType) { + this.bussinessType = bussinessType; + } + + public Map getFieldNormalizeContentMap() { + return fieldNormalizeContentMap; + } + + public void setFieldNormalizeContentMap(Map fieldNormalizeContentMap) { + this.fieldNormalizeContentMap = fieldNormalizeContentMap; + } + + public Map getFieldNormalizeCommentMap() { + return fieldNormalizeCommentMap; + } + + public void setFieldNormalizeCommentMap(Map fieldNormalizeCommentMap) { + this.fieldNormalizeCommentMap = fieldNormalizeCommentMap; + } + + public Map>> getFieldDataMap() { + return fieldDataMap; + } + + public Map> getFieldDataMapByType(String type){ + return fieldDataMap.get(type); + } + + public void addFieldDataMap(String type, Map fixFieldData, Integer bussinessType){ + Set keys = fixFieldData.keySet() ; + Map> fieldMaps = fieldDataMap.get(bussinessType) ; + Map fieldMap = fieldMaps.get(type) ; + for(String key : keys){ + fieldMap.put(key, key) ; + } + fieldMaps.put(type, fieldMap); + fieldDataMap.put(bussinessType, fieldMaps) ; + } + + public void setFieldDataMap(Map>> fieldDataMap) { + this.fieldDataMap = fieldDataMap; + } + + public Map getFieldInfo() { + return fieldInfo; + } + + public void setFieldInfo(Map fieldInfo) { + this.fieldInfo = fieldInfo; + } + + public boolean isIshlKeyword() { + return ishlKeyword; + } + + public void setIshlKeyword(boolean ishlKeyword) { + this.ishlKeyword = ishlKeyword; + } + + public String getEsSuffixNames() { + return esSuffixNames; + } + + public void setEsSuffixNames(String esSuffixNames) { + this.esSuffixNames = esSuffixNames; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getFinshTime() { + return finshTime; + } + + public void setFinshTime(String finshTime) { + this.finshTime = finshTime; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + +} diff --git a/serviceManager/pom.xml b/serviceManager/pom.xml new file mode 100644 index 0000000..8e91fbe --- /dev/null +++ b/serviceManager/pom.xml @@ -0,0 +1,18 @@ + + + + cl_stream + com.bfd.mf + 2.0-SNAPSHOT + + 4.0.0 + + serviceManager + + + + + + \ No newline at end of file diff --git a/serviceManager/serviceManager.iml b/serviceManager/serviceManager.iml new file mode 100644 index 0000000..b96cadd --- /dev/null +++ b/serviceManager/serviceManager.iml @@ -0,0 +1,1045 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/serviceManager/src/main/java/com/bfd/mf/entity/FieldInfo.java b/serviceManager/src/main/java/com/bfd/mf/entity/FieldInfo.java new file mode 100644 index 0000000..5d3185f --- /dev/null +++ b/serviceManager/src/main/java/com/bfd/mf/entity/FieldInfo.java @@ -0,0 +1,39 @@ +package com.bfd.mf.entity; + +import java.util.List; + +public class FieldInfo { + + private String kafka_type ; + + private List kafkaJsonString ; + + private List kafkaJsonArray ; + + public String getKafka_type() { + return kafka_type; + } + + public void setKafka_type(String kafka_type) { + this.kafka_type = kafka_type; + } + + public List getKafkaJsonString() { + return kafkaJsonString; + } + + public void setKafkaJsonString(List kafkaJsonString) { + this.kafkaJsonString = kafkaJsonString; + } + + public List getKafkaJsonArray() { + return kafkaJsonArray; + } + + public void setKafkaJsonArray(List kafkaJsonArray) { + this.kafkaJsonArray = kafkaJsonArray; + } + + + +} diff --git a/serviceManager/src/main/java/com/bfd/mf/entity/FieldNormaliz.java b/serviceManager/src/main/java/com/bfd/mf/entity/FieldNormaliz.java new file mode 100644 index 0000000..1dbe416 --- /dev/null +++ b/serviceManager/src/main/java/com/bfd/mf/entity/FieldNormaliz.java @@ -0,0 +1,207 @@ +package com.bfd.mf.entity; + +import java.io.Serializable; +import java.util.Map; +import java.util.Set; + +public class FieldNormaliz implements Serializable{ + + private static final long serialVersionUID = 1L; + + private int id ; + + private String kafkaName ; + + private int kafkaSerName ; + + private int esSerName ; + + private String esSuffixNames ; + + private String docType ; + + private int isSemtimentApi ; + + private boolean ishlKeyword ; + + private int bussinessType ; + + private Map fieldNormalizeContentMap ; + + private Map fieldNormalizeCommentMap ; + + private Map>> fieldDataMap ; + + private Map fieldInfo ; + + private String groupId ; + + private String createTime ; + + private String finshTime ; + + private int status ; + + private String projectName ; + + public String getKafkaName() { + return kafkaName; + } + + public void setKafkaName(String kafkaName) { + this.kafkaName = kafkaName; + } + + public int getKafkaSerName() { + return kafkaSerName; + } + + public void setKafkaSerName(int kafkaSerName) { + this.kafkaSerName = kafkaSerName; + } + + public int getEsSerName() { + return esSerName; + } + + public void setEsSerName(int esSerName) { + this.esSerName = esSerName; + } + + public String getDocType() { + return docType; + } + + public void setDocType(String docType) { + this.docType = docType; + } + + public int getIsSemtimentApi() { + return isSemtimentApi; + } + + public void setIsSemtimentApi(int isSemtimentApi) { + this.isSemtimentApi = isSemtimentApi; + } + + public int getBussinessType() { + return bussinessType; + } + + public void setBussinessType(int bussinessType) { + this.bussinessType = bussinessType; + } + + public Map getFieldNormalizeContentMap() { + return fieldNormalizeContentMap; + } + + public void setFieldNormalizeContentMap(Map fieldNormalizeContentMap) { + this.fieldNormalizeContentMap = fieldNormalizeContentMap; + } + + public Map getFieldNormalizeCommentMap() { + return fieldNormalizeCommentMap; + } + + public void setFieldNormalizeCommentMap(Map fieldNormalizeCommentMap) { + this.fieldNormalizeCommentMap = fieldNormalizeCommentMap; + } + + public Map>> getFieldDataMap() { + return fieldDataMap; + } + + public Map> getFieldDataMapByType(String type){ + return fieldDataMap.get(type); + } + + public void addFieldDataMap(String type, Map fixFieldData, Integer bussinessType){ + Set keys = fixFieldData.keySet() ; + Map> fieldMaps = fieldDataMap.get(bussinessType) ; + Map fieldMap = fieldMaps.get(type) ; + for(String key : keys){ + fieldMap.put(key, key) ; + } + fieldMaps.put(type, fieldMap); + fieldDataMap.put(bussinessType, fieldMaps) ; + } + + public void setFieldDataMap(Map>> fieldDataMap) { + this.fieldDataMap = fieldDataMap; + } + + public Map getFieldInfo() { + return fieldInfo; + } + + public void setFieldInfo(Map fieldInfo) { + this.fieldInfo = fieldInfo; + } + + public boolean isIshlKeyword() { + return ishlKeyword; + } + + public void setIshlKeyword(boolean ishlKeyword) { + this.ishlKeyword = ishlKeyword; + } + + public String getEsSuffixNames() { + return esSuffixNames; + } + + public void setEsSuffixNames(String esSuffixNames) { + this.esSuffixNames = esSuffixNames; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getFinshTime() { + return finshTime; + } + + public void setFinshTime(String finshTime) { + this.finshTime = finshTime; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + +} diff --git a/serviceManager/src/main/java/com/bfd/mf/service/rmi/ServiceManager.java b/serviceManager/src/main/java/com/bfd/mf/service/rmi/ServiceManager.java new file mode 100644 index 0000000..95cd84f --- /dev/null +++ b/serviceManager/src/main/java/com/bfd/mf/service/rmi/ServiceManager.java @@ -0,0 +1,21 @@ +package com.bfd.mf.service.rmi; + + +import com.bfd.mf.entity.FieldNormaliz; + +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.util.Map; + +public interface ServiceManager extends Remote{ + + public void addTaskName(FieldNormaliz fieldNormaliz) throws RemoteException; + + public void stopImprotTask(int kafkaSerName, String kafkaName) throws RemoteException ; + + public void startImprotTask(String kafkaName) throws RemoteException ; + + public String getNowImportEsNum(String indexSuffixName, String docType) throws RemoteException; + + public int getNowKafkaNum(Map paramMap) throws RemoteException ; +}