id
stringlengths 36
36
| text
stringlengths 1
1.25M
|
---|---|
d77d268f-0774-4089-b6fc-c1f9c382fb02
|
public String getName() {
return name;
}
|
9f44f5c9-67b2-4738-a160-464e52377374
|
public void setName(final String name) {
this.name = name;
}
|
5ac36742-2238-4e2d-93ce-dc8133f2d0e0
|
@Override
public void commence(HttpServletRequest arg0, HttpServletResponse arg1,
AuthenticationException arg2) throws IOException, ServletException {
arg1.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
}
|
1461f626-42fa-4969-9663-309946ea707d
|
@Override
public void onAuthenticationSuccess(final HttpServletRequest request,
final HttpServletResponse response, final Authentication authentication)
throws ServletException, IOException {
final SavedRequest savedRequest = requestCache.getRequest(request, response);
if (savedRequest == null) {
clearAuthenticationAttributes(request);
return;
}
final String targetUrlParameter = getTargetUrlParameter();
if (isAlwaysUseDefaultTargetUrl()
|| (targetUrlParameter != null && StringUtils.hasText(request
.getParameter(targetUrlParameter)))) {
requestCache.removeRequest(request, response);
clearAuthenticationAttributes(request);
return;
}
clearAuthenticationAttributes(request);
// Use the DefaultSavedRequest URL
// final String targetUrl = savedRequest.getRedirectUrl();
// logger.debug("Redirecting to DefaultSavedRequest Url: " + targetUrl);
// getRedirectStrategy().sendRedirect(request, response, targetUrl);
}
|
624a4867-3f43-43cd-98e8-0c1586526a1d
|
public void setRequestCache(final RequestCache requestCache) {
this.requestCache = requestCache;
}
|
81dbfd79-dc1d-42f6-afb3-715a0c37e225
|
public static void main(String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new MainSession(),
args);
System.exit(res);
}
|
8a544530-acc9-4f46-a5d5-99d8c5afd9c3
|
@Override
public int run(String[] args) throws Exception {
if (args.length < 2) {
System.err.println("Usage: <input_path> <output_path>");
System.exit(-1);
}
//input parameter
String inputPath = args[0];
String outputPath = args[1];
String intPath = outputPath + "Job1";
//job1
Configuration conf = new Configuration();
Job job1 = new Job(conf, "Sort-Time");
job1.setJarByClass(SortMap.class);
job1.setMapperClass(SortMap.class);
job1.setReducerClass(SortReduce.class);
job1.setPartitionerClass(SortPartitioner.class);
job1.setGroupingComparatorClass(BrowerIDGroupingComparator.class);
job1.setMapOutputKeyClass(BrowserID.class);
job1.setMapOutputValueClass(NullWritable.class);
job1.setOutputKeyClass(Text.class);
job1.setOutputValueClass(LongWritable.class);
job1.setInputFormatClass(TextInputFormat.class);
job1.setOutputFormatClass(TextOutputFormat.class);
FileInputFormat.setInputPaths(job1, new Path(inputPath));
FileOutputFormat.setOutputPath(job1, new Path(intPath));
//job2
Job job2 = new Job(conf, "Computer Session list");
job2.setJarByClass(SessionMap.class);
job2.setMapperClass(SessionMap.class);
job2.setReducerClass(SessionReduce.class);
job1.setInputFormatClass(TextInputFormat.class);
job1.setOutputFormatClass(TextOutputFormat.class);
job2.setMapOutputKeyClass(Text.class);
job2.setMapOutputValueClass(LongWritable.class);
job2.setOutputKeyClass(Text.class);
job2.setOutputValueClass(Text.class);
//log file
//note /part*
FileInputFormat.setInputPaths(job2, new Path(intPath+"/part*"));
FileOutputFormat.setOutputPath(job2, new Path(outputPath));
//job control
ControlledJob controlledJob1 = new ControlledJob(job1.getConfiguration());
ControlledJob controlledJob2 = new ControlledJob(job2.getConfiguration());
controlledJob2.addDependingJob(controlledJob1);
JobControl jobControl = new JobControl("JobControlDemoGroup");
jobControl.addJob(controlledJob1);
jobControl.addJob(controlledJob2);
Thread jobControlThread = new Thread(jobControl);
jobControlThread.start();
while (!jobControl.allFinished()){
//System.out.println("Sleep to finish");
Thread.sleep(500);
}
jobControl.stop();
return 0;
}
|
589b15cd-d5b5-46d3-bc6e-b50cdee6efb8
|
@Override
protected void reduce(Text browserId, Iterable<LongWritable> listEvent,
Context context) throws IOException, InterruptedException {
///input browserId , List[] time[] ---> browserID,List[] Session
List<Session> sessionList = new ArrayList<Session>();
Iterator<LongWritable> eventList = listEvent.iterator();
LongWritable event = new LongWritable();
event = eventList.next();
Long currentTime = new Long(0L);
Long beginTime = new Long(0L);
// add event to block smallEvent;
Session session = new Session();
beginTime = event.get();
currentTime = event.get();
//System.out.println("CurrentTime in: " + currentTime);
session.setBeginTime(beginTime);
while (eventList.hasNext()) {
event = eventList.next();
// System.out.println("CurrentTime get : " + event.get());
if (event.get() - currentTime >= LIMITTIME){
session.setEndTime(currentTime);
// System.out.println("Session If: " + session.toString());
sessionList.add(session);
beginTime = event.get();
session.setBeginTime(beginTime);
}
currentTime = event.get();
// System.out.println("CurrentTime : " + currentTime);
}
session.setEndTime(currentTime);
// System.out.println("Session Last : " + session.toString());
sessionList.add(session);
// System.out.println("Session Reduce : " + browserId.toString() + "--" + sessionList.toString());
context.write(browserId, new Text(sessionList.toString()));
}
|
d53cb959-a246-499b-9e48-c011046fd7ec
|
@Override
protected void reduce(BrowserID arg0, Iterable<NullWritable> arg1,Context context)
throws IOException, InterruptedException {
System.out.println("Reduce :" + arg0.toString());
context.write(new Text(arg0.getBrowserId()),new Text(arg0.getTime().toString()));
}
|
aa07eaa4-6ce2-4df9-9634-123c20d38be5
|
@Override
protected void map(LongWritable key, Text line, Context context)
throws IOException, InterruptedException {
String[] data = line.toString().split("\t");
browserId = new Text(data[0].toString().trim());
Time = new LongWritable(Long.parseLong(data[1].toString().trim()));
System.out.println( " Session Map :" + browserId + "-" + Time.toString());
context.write(browserId, Time);
}
|
8708c076-22f5-48a1-a368-1ba3e8a65bfb
|
@Override
protected void map(LongWritable key, Text line, Context context)
throws IOException, InterruptedException {
String[] data = line.toString().split("\t");
Text browserId = new Text(data[2].toString().trim());
try {
Date date = new Date();
date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss",
Locale.ENGLISH).parse(data[1].toString().trim());
browser.setBrowserId(browserId);
browser.setTime(new LongWritable(date.getTime()));
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(browser.toString());
context.write(browser, nullwritable);
}
|
019250dd-388f-455a-9278-67d679a32a20
|
public BrowerIDGroupingComparator() {
super(BrowserID.class,true);
}
|
beeb5ae1-0997-496f-ba5e-4446b400a296
|
@Override
public int compare(WritableComparable a, WritableComparable b) {
BrowserID A = (BrowserID) a;
BrowserID B = (BrowserID) b;
return A.compareTo(B);
}
|
338ebe39-7290-46f5-b88a-5560d47179da
|
public Event() {
id = new LongWritable();
timestamp = new LongWritable();
url = new Text();
resolution = new Text();
brower = new Text();
os = new Text();
deviceModel = new Text();
deviceType = new Text();
ipInfo = new Text();
referralUrl = new Text();
}
|
79012740-b526-4862-96f5-e9d16d2dc67c
|
public void getEvent(Event k){
this.id = k.getId();
this.timestamp = k.getTimestamp();
this.url = k.getUrl();
this.resolution = k.getResolution();
this.brower = k.getBrower();
this.os = k.getOs();
this.deviceType = k.getDeviceType();
this.deviceModel = k.getDeviceModel();
this.ipInfo = k.getIpInfo();
this.referralUrl = k.getReferralUrl();
}
|
96d4e502-91d2-4e5e-a989-5f602df4f1cd
|
@Override
public int compareTo(Event o) {
// TODO Auto-generated method stub
int result = timestamp.compareTo(o.timestamp);
return result;
}
|
4733d39b-5858-46f6-8ea3-976074c93b46
|
@Override
public int hashCode() {
// TODO Auto-generated method stub
return this.timestamp.hashCode();
}
|
aaeb2da0-a37b-49c6-9dc1-3eaab6420507
|
@Override
public String toString() {
// TODO Auto-generated method stub
//return id.toString() + "--" + timestamp.toString() + "++" + url.toString() + "/"+ resolution.toString() + "/"
//+ "/" + brower.toString() + "/"+ os.toString() +"/" +deviceModel.toString() + "/" + deviceType.toString() + "/" + ipInfo.toString() + "/" + referralUrl.toString() ;
return "{ " + timestamp.toString() + " }";
}
|
442096e7-8dd4-4502-b6cb-bfc009708e19
|
public Event(Event k) {
id = new LongWritable();
timestamp = new LongWritable();
url = new Text();
resolution = new Text();
brower = new Text();
os = new Text();
deviceModel = new Text();
deviceType = new Text();
ipInfo = new Text();
referralUrl = new Text();
this.id = k.getId();
this.timestamp = k.getTimestamp();
this.url = k.getUrl();
this.resolution = k.getResolution();
this.brower = k.getBrower();
this.os = k.getOs();
this.deviceType = k.getDeviceType();
this.deviceModel = k.getDeviceModel();
this.ipInfo = k.getIpInfo();
this.referralUrl = k.getReferralUrl();
}
|
3083765f-00c6-40be-8074-29388fdc4c5b
|
public LongWritable getId() {
return this.id;
}
|
6d85cac2-6073-432b-9043-4495157b1516
|
public void setId(LongWritable id) {
this.id = id;
}
|
f2568b12-2560-4522-b068-753cf8eb2cf3
|
public LongWritable getTimestamp() {
return this.timestamp;
}
|
7ca90e18-480e-44b4-8cae-ceb3c84c15ec
|
public void setTimestamp(LongWritable timestamp) {
this.timestamp = timestamp;
}
|
53a29cb3-fbad-440c-af74-1290e470d4c0
|
public Text getUrl() {
return this.url;
}
|
ecbda311-0ca2-455f-813e-f679fdda2dea
|
public void setUrl(Text url) {
this.url = url;
}
|
e69aa224-3ef9-4dea-a696-386f83dfcdf8
|
public Text getResolution() {
return this.resolution;
}
|
32481bdf-0a37-4193-97f8-d2fe5cfbb643
|
public void setResolution(Text resolution) {
this.resolution = resolution;
}
|
bc30db4b-d691-4cd7-88fb-f92e355ff474
|
public Text getBrower() {
return this.brower;
}
|
ab52e343-ef56-48ca-8060-bbd2e7bed8e2
|
public void setBrower(Text brower) {
this.brower = brower;
}
|
7c43cf1a-1b06-4629-9841-9c9d12c6cd02
|
public Text getOs() {
return this.os;
}
|
066bea1f-fa7c-461d-9df4-7c7e75a007d0
|
public void setOs(Text os) {
this.os = os;
}
|
2319ebce-5c8b-48e5-9181-54f0b6f6bdd2
|
public Text getDeviceType() {
return this.deviceType;
}
|
846026fa-b24e-4101-b456-909db7ee9015
|
public void setDeviceType(Text deviceType) {
this.deviceType = deviceType;
}
|
3b225dd7-113a-408c-8f0b-2c22a7c1a91f
|
public Text getDeviceModel() {
return this.deviceModel;
}
|
f48c9813-55ce-40d9-908b-423e8ca8f57d
|
public void setDeviceModel(Text deviceModel) {
this.deviceModel = deviceModel;
}
|
ac79ca48-acc4-4bbd-b7b5-15756b1c3825
|
public Text getIpInfo() {
return this.ipInfo;
}
|
55b1251d-152f-48ef-8e0a-81ab2fd951f9
|
public void setIpInfo(Text ipInfo) {
this.ipInfo = ipInfo;
}
|
c150ffdd-491c-445b-a5fa-aee084d92a68
|
public Text getReferralUrl() {
return referralUrl;
}
|
46f2272e-e0fa-4bc0-9c2f-7b43919da9f0
|
public void setReferralUrl(Text referralUrl) {
this.referralUrl = referralUrl;
}
|
1254533d-288c-4fd2-b192-f7d6575dfe4a
|
public void readFields(DataInput arg0) throws IOException {
// TODO Auto-generated method stub
id.readFields(arg0);
timestamp.readFields(arg0);
url.readFields(arg0);
resolution.readFields(arg0);
brower.readFields(arg0);
os.readFields(arg0);
deviceType.readFields(arg0);
deviceModel.readFields(arg0);
ipInfo.readFields(arg0);
referralUrl.readFields(arg0);
}
|
8b5d9cf3-08f6-4c21-a896-8a7b622734b3
|
public void write(DataOutput arg0) throws IOException {
// TODO Auto-generated method stub
id.write(arg0);
timestamp.write(arg0);
url.write(arg0);
resolution.write(arg0);
brower.write(arg0);
os.write(arg0);
deviceType.write(arg0);
deviceModel.write(arg0);
ipInfo.write(arg0);
referralUrl.write(arg0);
}
|
acc9a13c-f45c-4c3c-bf47-dd8d18f6b144
|
@Override
public String toString() {
// TODO Auto-generated method stub
return "[" + beginTime.toString() + "--->" + endTime.toString() + "]";
}
|
a47c8f81-ebe2-4487-9486-a46f6115ad7a
|
public Session() {
beginTime = new Long(0L);
endTime = new Long(0L);
}
|
371a19b1-55a1-43f1-80db-1a97d0e3d0a3
|
public Long getBeginTime() {
return beginTime;
}
|
95d6abd0-8829-441f-9926-cc50f185e560
|
public void setBeginTime(Long beginTime) {
this.beginTime = beginTime;
}
|
a44be293-2454-4fbb-b811-7a524c822228
|
public Long getEndTime() {
return endTime;
}
|
4ee6f782-6ece-430b-a41b-86b5f911cb99
|
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
|
5007bca2-3128-4bb3-a510-79e2fcc62c2d
|
public Collection<Project> getProjects() {
return projects;
}
|
acc422cc-9b5a-44e4-b2de-58ece4395ce9
|
public void setProjects(Collection<Project> projects) {
this.projects = projects;
}
|
caf39ed7-d7da-483e-96e0-5a7d31b31f39
|
public Long getId() {
return id;
}
|
0e6c954e-1e8c-4e08-82b9-0a922c4c01e0
|
public void setId(Long id) {
this.id = id;
}
|
b236cc88-c011-4a61-9ff9-59fcae0d5813
|
public String getName() {
return name;
}
|
ecf35d9b-3ce8-460e-8eff-5fdb582eb369
|
public void setName(String name) {
this.name = name;
}
|
3cca8bf5-571d-4560-8ffe-5d48f6e9a630
|
public String getAddress() {
return address;
}
|
b1fde389-c5ed-4c4f-bc32-1d08d1cb6d9a
|
public void setAddress(String address) {
this.address = address;
}
|
af0ee129-d22b-4449-8b4f-119195699c88
|
public String getContactName() {
return contactName;
}
|
aa2621d1-ea15-4c4c-8375-ca0d1433abde
|
public void setContactName(String contactName) {
this.contactName = contactName;
}
|
a17f5d6b-632f-4ee6-8102-cec5ff8c221a
|
public String getPhoneNumber() {
return phoneNumber;
}
|
566ae370-e4e4-469e-ad3a-dd646806240a
|
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
|
2b807952-0a1a-4b3a-a09e-171d44167858
|
public String getEmail() {
return email;
}
|
c9e2dc9d-b8c9-4888-88c4-16646c6b1785
|
public void setEmail(String email) {
this.email = email;
}
|
272993bb-fcc4-4fe7-b1d8-8c2024b4abb3
|
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
|
c151f0f4-3e84-47a1-b328-1caaa6d7cf64
|
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Organization)) {
return false;
}
Organization other = (Organization) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
|
bb06f628-94fd-4f7f-8ad3-6936af562d07
|
@Override
public String toString() {
return "com.entwa.coursework.Organization[ id=" + id + " ]";
}
|
d12d56e5-f5f1-419a-8125-d9670df9415b
|
public Long getId() {
return id;
}
|
e1d46e15-ed54-40bc-8fc0-290d20d6d435
|
public void setId(Long id) {
this.id = id;
}
|
af023285-58bb-44b1-8d93-1395e51815a8
|
public String getTitle() {
return title;
}
|
2ef9304e-77bc-4065-b829-43fa24321048
|
public void setTitle(String title) {
this.title = title;
}
|
2247096d-e585-4b82-8460-16b0544d7057
|
public String getObjective() {
return objective;
}
|
ca5207be-9001-4f93-b327-18c64408cf1d
|
public void setObjective(String objective) {
this.objective = objective;
}
|
53418c3b-8202-475c-8a2a-4b7207ae6e03
|
public String getAcademicQuestions() {
return academicQuestions;
}
|
1f6b4d28-8695-459f-a088-8bd37ae1074c
|
public void setAcademicQuestions(String academicQuestions) {
this.academicQuestions = academicQuestions;
}
|
ece0897d-1d48-4349-a54e-f28fcbef7611
|
public String getDeliverables() {
return deliverables;
}
|
be5855dc-f2b6-4260-a745-8a0ee6bd095e
|
public void setDeliverables(String deliverables) {
this.deliverables = deliverables;
}
|
cbaf9a49-b06b-4484-948d-7526098fb635
|
public String getDifficulty() {
return difficulty;
}
|
3acaf0cf-2187-4df5-85b7-e40aac63891f
|
public void setDifficulty(String difficulty) {
this.difficulty = difficulty;
}
|
bef8e609-81af-43d7-a90a-d28ed606b43b
|
public Organization getOrganization() {
return organization;
}
|
630de779-d130-4f1c-8685-8cdd3926eae3
|
public void setOrganization(Organization organization) {
this.organization = organization;
}
|
1e3539f1-7073-41e9-9894-f31df35d2ac1
|
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
|
5667b9c5-d799-43c1-8119-58d141aadcc7
|
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Project)) {
return false;
}
Project other = (Project) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
|
37969a3b-d940-4e88-aaf4-57ce6e06f18f
|
@Override
public String toString() {
return "com.entwa.coursework.Project[ id=" + id + " ]";
}
|
91e1adab-fe18-4c27-ba07-a986637df429
|
public PaginationHelper(int pageSize) {
this.pageSize = pageSize;
}
|
a8f0107c-3645-4d63-9d9c-7b0fa95bdcb6
|
public abstract int getItemsCount();
|
b50a102e-d2fc-44ff-a227-86c748ab1f1e
|
public abstract DataModel createPageDataModel();
|
dc6d9f48-363a-4048-a609-426958780f25
|
public int getPageFirstItem() {
return page * pageSize;
}
|
dd4530a2-01ef-4612-8ce5-0487650b3501
|
public int getPageLastItem() {
int i = getPageFirstItem() + pageSize - 1;
int count = getItemsCount() - 1;
if (i > count) {
i = count;
}
if (i < 0) {
i = 0;
}
return i;
}
|
0018ff3c-f396-41db-951d-705615375f95
|
public boolean isHasNextPage() {
return (page + 1) * pageSize + 1 <= getItemsCount();
}
|
ab8af7ad-9da4-4609-bf16-1b017d1f7d6f
|
public void nextPage() {
if (isHasNextPage()) {
page++;
}
}
|
a51cde8a-77ff-4f48-9097-2152d51ac0c4
|
public boolean isHasPreviousPage() {
return page > 0;
}
|
7d9bd766-8756-4d04-9de7-fd3268d2c8d7
|
public void previousPage() {
if (isHasPreviousPage()) {
page--;
}
}
|
afda2a22-b6f1-4dc8-9486-6994f41c696e
|
public int getPageSize() {
return pageSize;
}
|
44358972-5420-4345-850a-6a4efa1d2ff4
|
public static SelectItem[] getSelectItems(List<?> entities, boolean selectOne) {
int size = selectOne ? entities.size() + 1 : entities.size();
SelectItem[] items = new SelectItem[size];
int i = 0;
if (selectOne) {
items[0] = new SelectItem("", "---");
i++;
}
for (Object x : entities) {
items[i++] = new SelectItem(x, x.toString());
}
return items;
}
|
bdedfad7-37e3-4a77-9af1-aa0b02bba0da
|
public static void addErrorMessage(Exception ex, String defaultMsg) {
String msg = ex.getLocalizedMessage();
if (msg != null && msg.length() > 0) {
addErrorMessage(msg);
} else {
addErrorMessage(defaultMsg);
}
}
|
d181d0be-3d98-4c6e-b256-14656b40d984
|
public static void addErrorMessages(List<String> messages) {
for (String message : messages) {
addErrorMessage(message);
}
}
|
acdc507b-5648-4c99-9ce7-27d3a72a5d32
|
public static void addErrorMessage(String msg) {
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
FacesContext.getCurrentInstance().addMessage(null, facesMsg);
}
|
20852391-85e4-4233-90d6-5cf2109e1b02
|
public static void addSuccessMessage(String msg) {
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
FacesContext.getCurrentInstance().addMessage("successInfo", facesMsg);
}
|
ed112caf-7542-4126-ad44-7d7fbafc6a34
|
public static String getRequestParameter(String key) {
return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(key);
}
|
bf682ad6-d104-402f-9783-eab0e6f10a09
|
public static Object getObjectFromRequestParameter(String requestParameterName, Converter converter, UIComponent component) {
String theId = JsfUtil.getRequestParameter(requestParameterName);
return converter.getAsObject(FacesContext.getCurrentInstance(), component, theId);
}
|
4c85d663-f9e6-404a-81c2-7c77f01faefb
|
@Override
protected EntityManager getEntityManager() {
return em;
}
|
22e1a798-6aa5-4d73-a7ac-98e26965a5c8
|
public ProjectFacade() {
super(Project.class);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.