blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e8c588f34b176492eed837fcd7bc67aae827d477 | 8b52e6f74d3792421d80a1112ca9cbfebeeafcd8 | /Common/src/main/java/com/zhenhappy/ems/entity/WCustomer.java | 23f3b443d5df55266614ab7cfe3c6ad523223d77 | [] | no_license | wangxdxicec/XICEC-JHX-EMS | 1ee4ceac3cea216a4a9a6d101504d9cb41d9067b | 56d07bd461562cde58320bd66aad6ccf8a8c0228 | refs/heads/master | 2020-05-21T04:23:26.664099 | 2017-02-04T01:15:07 | 2017-02-04T01:15:07 | 54,453,657 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,243 | java | package com.zhenhappy.ems.entity;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* WcustomerInfo entity. @author MyEclipse Persistence Tools
*/
@Entity
@Table(name = "visitor_Info", schema = "dbo")
public class WCustomer implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
// Fields
private Integer id;
private String email;
private String checkingNo;
private String password;
private String firstName;
private String lastName;
private String sex;
private String company;
private String position;
private Integer country;
private String province;
private String city;
private String address;
private String backupEmail;
private String mobilePhoneCode;
private String mobilePhone;
private String telephoneCode;
private String telephone;
private String telephoneCode2;
private String faxCode;
private String fax;
private String faxCode2;
private String website;
private String remark;
private String createdIp;
private Date createdTime;
private String updatedIp;
private Date updateTime;
private Integer sendEmailNum;
private Integer sendMsgNum;
private Date sendEmailDate;
private Date sendMsgDate;
private Integer isActivated;
private Boolean isMobile;
private Boolean isjudged;
private Integer isProfessional;
private Integer IsReaded;
private Boolean isDisabled;
private String guid;
// Constructors
/** default constructor */
public WCustomer() {
}
/** minimal constructor */
public WCustomer(Integer id) {
this.id = id;
}
public WCustomer(Integer id, String email, String checkingNo,
String password, String firstName, String lastName, String sex,
String company, String position, Integer country, String province,
String city, String address, String backupEmail,
String mobilePhoneCode, String mobilePhone, String telephoneCode,
String telephone, String telephoneCode2, String faxCode,
String fax, String faxCode2, String website, String remark,
String createdIp, Date createdTime, String updatedIp,
Date updateTime, Integer sendEmailNum,Integer sendMsgNum,
Date sendEmailDate, Date sendMsgDate, Boolean isDisabled, String guid, Integer isProfessional, Boolean isjudged,
Boolean isMobile, Integer isActivated) {
this.id = id;
this.email = email;
this.checkingNo = checkingNo;
this.password = password;
this.firstName = firstName;
this.lastName = lastName;
this.sex = sex;
this.company = company;
this.position = position;
this.country = country;
this.province = province;
this.city = city;
this.address = address;
this.backupEmail = backupEmail;
this.mobilePhoneCode = mobilePhoneCode;
this.mobilePhone = mobilePhone;
this.telephoneCode = telephoneCode;
this.telephone = telephone;
this.telephoneCode2 = telephoneCode2;
this.faxCode = faxCode;
this.fax = fax;
this.faxCode2 = faxCode2;
this.website = website;
this.remark = remark;
this.createdIp = createdIp;
this.createdTime = createdTime;
this.updatedIp = updatedIp;
this.updateTime = updateTime;
this.sendEmailNum = sendEmailNum;
this.sendMsgNum = sendMsgNum;
this.sendEmailDate = sendEmailDate;
this.sendMsgDate = sendMsgDate;
this.isDisabled = isDisabled;
this.guid = guid;
this.isProfessional = isProfessional;
this.isjudged = isjudged;
this.isMobile = isMobile;
this.isActivated = isActivated;
}
// Property accessors
@Id
@Column(name = "ID", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "Email", length = 250)
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
@Column(name = "CheckingNo")
public String getCheckingNo() {
return this.checkingNo;
}
public void setCheckingNo(String checkingNo) {
this.checkingNo = checkingNo;
}
@Column(name = "Password", length = 250)
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
@Column(name = "FirstName")
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@Column(name = "LastName")
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Column(name = "Sex")
public String getSex() {
return this.sex;
}
public void setSex(String sex) {
this.sex = sex;
}
@Column(name = "Company")
public String getCompany() {
return this.company;
}
public void setCompany(String company) {
this.company = company;
}
@Column(name = "Position")
public String getPosition() {
return this.position;
}
public void setPosition(String position) {
this.position = position;
}
@Column(name = "Country")
public Integer getCountry() {
return this.country;
}
public void setCountry(Integer country) {
this.country = country;
}
@Column(name = "Province", length = 50)
public String getProvince() {
return this.province;
}
public void setProvince(String province) {
this.province = province;
}
@Column(name = "City")
public String getCity() {
return this.city;
}
public void setCity(String city) {
this.city = city;
}
@Column(name = "Address")
public String getAddress() {
return this.address;
}
public void setAddress(String address) {
this.address = address;
}
@Column(name = "BackupEmail", length = 250)
public String getBackupEmail() {
return this.backupEmail;
}
public void setBackupEmail(String backupEmail) {
this.backupEmail = backupEmail;
}
@Column(name = "MobilePhoneCode", length = 50)
public String getMobilePhoneCode() {
return this.mobilePhoneCode;
}
public void setMobilePhoneCode(String mobilePhoneCode) {
this.mobilePhoneCode = mobilePhoneCode;
}
@Column(name = "MobilePhone", length = 250)
public String getMobilePhone() {
return this.mobilePhone;
}
public void setMobilePhone(String mobilePhone) {
this.mobilePhone = mobilePhone;
}
@Column(name = "TelephoneCode", length = 50)
public String getTelephoneCode() {
return this.telephoneCode;
}
public void setTelephoneCode(String telephoneCode) {
this.telephoneCode = telephoneCode;
}
@Column(name = "Telephone", length = 250)
public String getTelephone() {
return this.telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
@Column(name = "TelephoneCode2")
public String getTelephoneCode2() {
return this.telephoneCode2;
}
public void setTelephoneCode2(String telephoneCode2) {
this.telephoneCode2 = telephoneCode2;
}
@Column(name = "FaxCode", length = 50)
public String getFaxCode() {
return this.faxCode;
}
public void setFaxCode(String faxCode) {
this.faxCode = faxCode;
}
@Column(name = "Fax", length = 250)
public String getFax() {
return this.fax;
}
public void setFax(String fax) {
this.fax = fax;
}
@Column(name = "FaxCode2")
public String getFaxCode2() {
return this.faxCode2;
}
public void setFaxCode2(String faxCode2) {
this.faxCode2 = faxCode2;
}
@Column(name = "Website", length = 250)
public String getWebsite() {
return this.website;
}
public void setWebsite(String website) {
this.website = website;
}
@Column(name = "Remark")
public String getRemark() {
return this.remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Column(name = "CreateIP")
public String getCreatedIp() {
return this.createdIp;
}
public void setCreatedIp(String createdIp) {
this.createdIp = createdIp;
}
@Column(name = "CreateTime", length = 23)
public Date getCreatedTime() {
return this.createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
@Column(name = "UpdateIP")
public String getUpdatedIp() {
return this.updatedIp;
}
public void setUpdatedIp(String updatedIp) {
this.updatedIp = updatedIp;
}
@Column(name = "UpdateTime", length = 23)
public Date getUpdateTime() {
return this.updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Column(name = "SendEmailNum")
public Integer getSendEmailNum() {
return this.sendEmailNum;
}
public void setSendEmailNum(Integer sendEmailNum) {
this.sendEmailNum = sendEmailNum;
}
@Column(name = "SendEmailDate", length = 23)
public Date getSendEmailDate() {
return this.sendEmailDate;
}
public void setSendEmailDate(Date sendEmailDate) {
this.sendEmailDate = sendEmailDate;
}
@Column(name = "GUID")
public String getGuid() {
return this.guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
@Column(name = "Isjudged")
public Boolean getIsjudged() {
return isjudged;
}
public void setIsjudged(Boolean isjudged) {
this.isjudged = isjudged;
}
@Column(name = "IsDisabled")
public Boolean getIsDisabled() {
return isDisabled;
}
public void setIsDisabled(Boolean disabled) {
isDisabled = disabled;
}
@Column(name = "IsProfessional")
public Integer getIsProfessional() {
return isProfessional;
}
public void setIsProfessional(Integer professional) {
isProfessional = professional;
}
@Column(name = "IsMobile")
public Boolean getIsMobile() {
return isMobile;
}
public void setIsMobile(Boolean mobile) {
isMobile = mobile;
}
@Column(name = "SendMsgNum")
public Integer getSendMsgNum() {
return sendMsgNum;
}
public void setSendMsgNum(Integer sendMsgNum) {
this.sendMsgNum = sendMsgNum;
}
@Column(name = "SendMsgDate", length = 23)
public Date getSendMsgDate() {
return sendMsgDate;
}
public void setSendMsgDate(Date sendMsgDate) {
this.sendMsgDate = sendMsgDate;
}
@Column(name = "IsReaded")
public Integer getIsReaded() {
return IsReaded;
}
public void setIsReaded(Integer isReaded) {
IsReaded = isReaded;
}
@Column(name = "IsActivated")
public Integer getIsActivated() {
return isActivated;
}
public void setIsActivated(Integer isActivated) {
this.isActivated = isActivated;
}
} | [
"wangxd@xicec.com"
] | wangxd@xicec.com |
bc593ed4c21264957a3b9c3711171dabd74e2a0e | 544eaea6f902883958ccca53d190b420aecb8976 | /5,6장-클래스와 객체/src/studentsubject/StudentSubjectMain.java | cb38ea3bb1fb9430b379404d301b9980109f9202 | [] | no_license | NohSeunghyun/Java_1 | 6b57995ece3bcf46da93b759170cd61fbadefd2c | 80fd2b77841ffb37853a39188071f2b7556aeb7e | refs/heads/main | 2023-07-19T21:55:19.614015 | 2021-08-23T05:23:29 | 2021-08-23T05:23:29 | 398,980,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | package studentsubject;
public class StudentSubjectMain {
public static void main(String[] args) {
//학생 생성
Student s=new Student(1001, "홍길동");
s.addSubject("자바", 95);
s.addSubject("JSP", 87);
Student s2=new Student(1002, "이순신");
s2.addSubject("자바", 90);
s2.addSubject("JSP", 97);
s2.addSubject("스플링", 100);
System.out.println("----------학생 성적 정보 출력----------");
s.showStudentInfo();//홍길동의 성적정보
System.out.println("========================================");
s2.showStudentInfo();//이순신의 성적정보
}//메인문
}//클래스문
/*******************************************************************************************************/ | [
"noreply@github.com"
] | noreply@github.com |
33a803a351ff36514014e17ca1f4d1ee7fb1e367 | 4d8db9a65c2f843b5ceb26a77f431ca97d8212d6 | /src/com/secquan/util/NodeData.java | fc64eed3309294b6a3de63774ed35464e9b2155b | [] | no_license | naozibuhao/SecQuanCknife | 2f2fcf8201b3e678bf41a5c7ff719a69337b6ff7 | 8a7bd95a45fb37c5c409a72a960b3016b9401dd4 | refs/heads/master | 2021-04-24T21:31:43.627557 | 2018-06-11T10:56:51 | 2018-06-11T10:56:51 | 117,065,001 | 46 | 11 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.secquan.util;
public class NodeData
{
public int nodetype;
public String nodedata;
public NodeData(int nodetype,String nodedata)
{
this.nodetype = nodetype;
this.nodedata = nodedata;
}
public String toString() {
return this.nodedata;
}
public class DataType
{
public final static int DATABASE = 1;
public final static int TABLE = 2;
public final static int COLUMN = 3;
}
}
| [
"o1313113@qq.com"
] | o1313113@qq.com |
7cbb02a52e6cad665f84e4fa3ab4d75ddc21586f | 0f5ec76fa5c0062989a183e557922c4c223124a6 | /src/main/java/com/thinkgem/jeesite/modules/taier/service/CollectService.java | ec05e98f5ea8f2b7fec5ef360e2eb7efe616a88a | [
"Apache-2.0"
] | permissive | 770915026/jeesite | 4844191f3e3e5cd0ce83334adea2c3068b4d3ba5 | bf358138f5afc9d856fddb86f95f6cdc2f8c6237 | refs/heads/master | 2020-04-27T18:31:08.349474 | 2019-03-08T16:43:01 | 2019-03-08T16:43:01 | 174,574,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,437 | java | /**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.taier.service;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.taier.entity.Collect;
import com.thinkgem.jeesite.modules.taier.dao.CollectDao;
/**
* 收藏Service
* @author xuyongqiang
* @version 2018-08-27
*/
@Service
@Transactional(readOnly = true)
public class CollectService extends CrudService<CollectDao, Collect> {
public Collect get(String id) {
return super.get(id);
}
public List<Collect> findList(Collect collect) {
return super.findList(collect);
}
public Page<Collect> findPage(Page<Collect> page, Collect collect) {
return super.findPage(page, collect);
}
@Transactional(readOnly = false)
public void save(Collect collect) {
super.save(collect);
}
@Transactional(readOnly = false)
public void delete(Collect collect) {
super.delete(collect);
}
public int getNumOfCollectThisAct(Collect collect) {
return dao.getNumOfCollectThisAct(collect);
}
@Transactional(readOnly = false)
public Collect getByUserAndActivity(Collect collect){
return dao.getByUserAndActivity(collect);
}
} | [
"770915026@qq.com"
] | 770915026@qq.com |
fecb94b08d51eda2509db1d9dcc05ced678d53b3 | e0e78d27663553a8b71f23cc9e3c1fa0997e52d8 | /src/neuralNets/NeuronConnection.java | f4bfe9fe7a226a577326dbff62c052d6016c080c | [] | no_license | paddington33/NeuralNetwork-AI2 | 0058db7248c9c5235f630cc5f00646aef9eb88dc | eaabc33fe1f412e690df8bed717df335915f3491 | refs/heads/master | 2020-05-04T13:00:17.787351 | 2012-03-06T20:32:01 | 2012-03-06T20:32:01 | 3,598,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 797 | java | package neuralNets;
public class NeuronConnection {
private Neuron inputNeuron,outputNeuron;
private double weight;
private final double defaultWeight = 1.0;
public NeuronConnection(Neuron input, Neuron output)
{
this.inputNeuron = input;
this.outputNeuron = output;
this.weight = defaultWeight;
}
public NeuronConnection(Neuron input, Neuron output, double weight)
{
this.inputNeuron = input;
this.outputNeuron = output;
this.weight = weight;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
public Neuron getInputNeuron() {
return inputNeuron;
}
public Neuron getOutputNeuron() {
return outputNeuron;
}
public void addWeight(double deltaWeight) {
this.weight += deltaWeight;
}
}
| [
"paddington33@gmail.com"
] | paddington33@gmail.com |
34f7dfddb87f02496af954342d9dfe8e42a17ab0 | f43ef1add051d76fe84b0f69092ad305929116a5 | /autotest/Tests/src/main/java/com/tle/webtests/framework/factory/RefreshingElementHandler.java | b3342a7f580feae58172d8fedb789946be4209d2 | [
"Apache-2.0",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"EPL-1.0",
"LGPL-2.0-or-later",
"Classpath-exception-2.0",
"LicenseRef-scancode-jdom",
"ICU",
"Apache-1.1",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"GPL-1.0-or-later",
"CPL-1.0",
"C... | permissive | PenghaiZhang/openEQUELLA | 93d29f9dab013e2fa19a9a7ae4d71cac2c7269bb | c2da9954bd4768e785b3b2f281305c16936f4511 | refs/heads/develop | 2023-07-20T02:20:23.684651 | 2023-07-19T00:12:20 | 2023-07-19T00:12:20 | 207,188,550 | 0 | 0 | Apache-2.0 | 2020-06-17T13:08:07 | 2019-09-08T23:51:30 | Java | UTF-8 | Java | false | false | 3,915 | java | package com.tle.webtests.framework.factory;
import com.google.common.base.Function;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.support.ui.FluentWait;
public class RefreshingElementHandler implements InvocationHandler {
private static final FluentWait<Object> waiter =
new FluentWait<Object>(Void.class)
.withTimeout(10, TimeUnit.SECONDS)
.pollingEvery(50, TimeUnit.MILLISECONDS);
private LazyTemplatedElementLocator locator;
private RefreshingElementProxyCreator proxyCreator;
public RefreshingElementHandler(
RefreshingElementProxyCreator proxyCreator, LazyTemplatedElementLocator locator) {
this.locator = locator;
this.proxyCreator = proxyCreator;
}
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args)
throws Throwable {
try {
return waiter.until(
new Function<Object, InvokeResponse>() {
@Override
public InvokeResponse apply(Object arg0) {
if (method.getName().equals("toString")) {
return new InvokeResponse(locator.toString());
}
if (method.getName().equals("findNonWrapped")) {
return new InvokeResponse(locator.findNonWrapped());
}
WebElement element = locator.findElement();
try {
Object returnVal;
if (method.getName().equals("getWrappedElement")) {
if (element instanceof WrapsElement) {
returnVal = ((WrapsElement) element).getWrappedElement();
} else {
returnVal = element;
}
} else {
returnVal = method.invoke(element, args);
if (method.getName().equals("findElement")
&& locator.isWrapChildElements()
&& !(returnVal instanceof RefreshableElement)) {
returnVal =
proxyCreator.proxyForLocator(
getClass().getClassLoader(),
new LazyTemplatedElementLocator(
locator.getPageObject(),
(WebElement) returnVal,
(SearchContext) proxy,
(By) args[0]));
}
}
return new InvokeResponse(returnVal);
} catch (InvocationTargetException ite) {
if (ite.getCause() instanceof StaleElementReferenceException) {
locator.invalidateCache();
return null;
} else {
throw new InvokeException(ite.getCause());
}
} catch (Throwable t) {
throw new InvokeException(t);
}
}
})
.returnValue;
} catch (InvokeException e) {
throw e.getCause();
}
}
public static class InvokeException extends RuntimeException {
private static final long serialVersionUID = 1L;
public InvokeException(Throwable t) {
super(t);
}
}
public static class InvokeResponse {
final Object returnValue;
public InvokeResponse(Object returnValue) {
this.returnValue = returnValue;
}
}
}
| [
"doolse@gmail.com"
] | doolse@gmail.com |
c7b31a342bd1a7537c1774168da430f79598595f | 428e3505df1fe3ec727f25997caac71efa5e1620 | /app/src/main/java/codepath/com/googleimagesearch/SearchFiltersActivity.java | ba2af02509246fa2ec5dd2fea88b693a5c0f4f62 | [] | no_license | teekirol/codepath-google-image-search | 13187debb5d2f21aecbf84fcf5854f6fca70a00e | 5d8e2e802d4dca7fb04e9a926541b27f3dc7b8e3 | refs/heads/master | 2021-01-15T16:53:21.383906 | 2015-04-22T17:20:15 | 2015-04-22T17:20:15 | 30,622,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,547 | java | package codepath.com.googleimagesearch;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import codepath.com.googleimagesearch.models.Filter;
public class SearchFiltersActivity extends ActionBarActivity {
private Spinner sizeSpinner;
private Spinner colorSpinner;
private Spinner typeSpinner;
private EditText etSite;
private Button btnSave;
public static int SEARCH_FILTERS_RESULT_OK = 200;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search_filters);
setupViews();
}
private void setupViews() {
Intent i = getIntent();
Filter f = i.getParcelableExtra("filter");
sizeSpinner = (Spinner) findViewById(R.id.spinnerSize);
if(f.getSize() != null) {
setSpinnerToValue(sizeSpinner, f.getSize());
} else {
setSpinnerToValue(sizeSpinner, "");
}
colorSpinner = (Spinner) findViewById(R.id.spinnerColor);
if(f.getColor() != null) {
setSpinnerToValue(colorSpinner, f.getColor());
} else {
setSpinnerToValue(colorSpinner, "");
}
typeSpinner = (Spinner) findViewById(R.id.spinnerType);
if(f.getType() != null) {
setSpinnerToValue(typeSpinner, f.getType());
} else {
setSpinnerToValue(typeSpinner, "");
}
etSite = (EditText) findViewById(R.id.etSite);
etSite.setText(f.getSite());
btnSave = (Button) findViewById(R.id.btnSave);
btnSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Filter f = new Filter(sizeSpinner.getSelectedItem().toString(),
colorSpinner.getSelectedItem().toString(),
typeSpinner.getSelectedItem().toString(),
etSite.getText().toString());
Intent i = new Intent();
i.putExtra("filter", f);
setResult(SEARCH_FILTERS_RESULT_OK, i);
finish();
}
});
}
private void setSpinnerToValue(Spinner sp, String value) {
int index = 0;
SpinnerAdapter adapter = sp.getAdapter();
for(int i = 0; i < adapter.getCount(); i++) {
if(adapter.getItem(i).equals(value)) {
index = i;
break;
}
}
sp.setSelection(index);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_search_filters, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"leelorik@gmail.com"
] | leelorik@gmail.com |
844c9d6ad9ce7ebe0a3562a05bbc320f208646c3 | 1c4da8f8555d431c096fb797d86893a6c8a096b0 | /src/main/java/com/tpadsz/ssm/dao/UserDao.java | d9d68f284b3fe8328a209fddf0d5765eadcb7ba9 | [] | no_license | Mr-Wen-404/web-ssm | 11e91517880a622917e5aa19879b555181e893da | 22f20ef167fd88287378b147f4ece1511eb01f5a | refs/heads/master | 2022-06-28T07:39:23.214421 | 2020-04-29T11:34:19 | 2020-04-29T11:34:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package com.tpadsz.ssm.dao;
import com.tpadsz.ssm.model.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* Created by Zhangxq on 2016/7/15.
*/
public interface UserDao {
User selectUserById(@Param("userId") Long userId);
Map<String,Object> getUserById(int id);
User selectUserByPhoneOrEmail(@Param("emailOrPhone") String emailOrPhone, @Param("state") Short state);
List<User> selectAllUser();
User selectByName(User user);
void updateUser(Map map);
}
| [
"766256898@qq.com"
] | 766256898@qq.com |
47ae2f25015bd46982de8c501f5b747190696aca | e20e42085ae2ac00ee9b34c19d300f842da72e5c | /src/main/java/com/che/analytics/AnalyticsMain.java | 279fe9f0a4788cfe028223ba51adb32d464f6b70 | [] | no_license | engrchetan/flink-analytics-demo | b7a12c3cc303c747f3ab09f3584dc0a5e5868fbd | d1dd6ee8149b24a531a66a48c4808edf080a06bf | refs/heads/master | 2021-06-22T07:31:28.739962 | 2017-08-28T23:13:36 | 2017-08-28T23:13:36 | 100,301,443 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 670 | java | /**
*
*/
package com.che.analytics;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import com.che.analytics.controller.AnalyticsManager;
/**
* @author chetan
*
*/
public class AnalyticsMain {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
StreamExecutionEnvironment executionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment();
executionEnvironment.setBufferTimeout(1); // Low latency!
AnalyticsManager analyticsManager = new AnalyticsManager();
analyticsManager.startPricing(executionEnvironment);
executionEnvironment.execute();
}
}
| [
"chetan@localhost"
] | chetan@localhost |
167aac01788fea425a650aea01cb05534e418e78 | 929cb9698b17f1c49e55de8e8513a3f202d6315f | /src/com/breeze/framwork/netserver/RequestBreezePointIF.java | 0674af7ee253979fd674c128f7095b08fb5a7938 | [] | no_license | breezeloganluo/breezeJava | 574bb820f62a7819cb561e2ddeb4166ce72ed7a7 | b16ff746560fc104bd01c8aed96f1e49684a1e8e | refs/heads/master | 2020-06-27T13:14:26.061965 | 2017-07-13T00:59:14 | 2017-07-13T00:59:14 | 97,058,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package com.breeze.framwork.netserver;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public interface RequestBreezePointIF {
/**
* 处理具体的进入模块配合外面的Servlet使用
* @param request ServletReauest
* @param response ServletResponse
* @throws ServletException
* @throws IOException
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException ;
/**
* 本次调用的业务名称
*/
public String getPointName();
}
| [
"breezeloganluo@hotmail.com"
] | breezeloganluo@hotmail.com |
0aa905349efe90d14a27ef7fdbe73fcd3d08a32b | 7db59b2bcfdb45b2f08aed19506dedc64ac58e55 | /server/StudentObject.java | 11954d30d340e40d9c5dd952852c076e02e84168 | [
"MIT"
] | permissive | SalAlba/JAX-WS | c1c2b3cdb7f177e81254c53c7a8d7621f07ff612 | 698b198d6900ebb42816d44a4f8b3247b4d546dc | refs/heads/master | 2020-03-18T09:15:47.447960 | 2018-05-23T10:34:27 | 2018-05-23T10:34:27 | 134,553,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 908 | java | package server;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement( name = "StudentObject" )
public class StudentObject implements Serializable {
// FIELD...
private static final long serialVersionUID = 1L;
@XmlElement
private int id;
@XmlElement
private String name;
@XmlElement
private double score;
// CONSTRUCTOR ...
public StudentObject() {
}
public StudentObject(int id, String name, double score) {
this.id = id;
this.name = name;
this.score = score;
}
// GET/SET ...
public int getId() {
return id;
}
public String getName() {
return name;
}
public double getScore() {
return score;
}
// ...
@Override
public String toString() {
return "<StudentObject>[ "+ id + ", " + name + ", " + score +" ]";
}
}
| [
"noreply@github.com"
] | noreply@github.com |
823cf1467d6b043350838fd33ddf47f62a8c8098 | a878ca6437fae345a759491ff5280f6ad5498671 | /pet-clinic-web/src/test/java/com/hassanmahmud/hmpetclinic/HmPetClinicApplicationTests.java | 6f329ed046c891dbea3804b39c5eba41febea6b8 | [] | no_license | hass123uk/spring5-pet-clinic | f770a395ec341e13d84e77025ac93a64808af239 | c0dc5b66015e92d6470de900c39bc6f62ae10f4b | refs/heads/master | 2022-08-20T04:01:07.456340 | 2020-05-19T21:06:48 | 2020-05-19T21:06:48 | 261,861,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 234 | java | package com.hassanmahmud.hmpetclinic;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class HmPetClinicApplicationTests {
@Test
void contextLoads() {
}
}
| [
"hass123uk@hotmail.com"
] | hass123uk@hotmail.com |
92191a559b538a4be44953b23e8e051a92604591 | 2689de62f081865574fb81dc45926ea3d07771ad | /src/main/java/vdb/mydb/filestat/tool/FilesTool.java | f710aee1849fd82f1b7608e111f2150a016e2642 | [
"BSD-2-Clause"
] | permissive | cas-bigdatalab/vdb2020 | e7efaed6b71b5e5604e9aa7396ce59025e375a83 | ec08d687ae41bc94f04b6a56c05dfa6db226a8a3 | refs/heads/master | 2022-07-21T04:57:47.857759 | 2019-05-27T09:13:00 | 2019-05-27T09:18:50 | 159,260,460 | 0 | 0 | BSD-2-Clause | 2022-06-29T19:32:23 | 2018-11-27T01:58:57 | JavaScript | UTF-8 | Java | false | false | 2,026 | java | package vdb.mydb.filestat.tool;
import java.io.File;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.FileSystemResource;
import vdb.metacat.DataSet;
import vdb.mydb.VdbManager;
import vdb.mydb.filestat.impl.RepositoryManager;
import vdb.mydb.filestat.impl.ServerRepository;
import vdb.mydb.repo.FileRepository;
import vdb.mydb.repo.RepositoryFile;
import vdb.mydb.util.CatalogUtil;
public class FilesTool
{
public RepositoryManager getRepositoryManager(DataSet ds)
{
File xml = new File(CatalogUtil.getDataSetRoot(ds), "files.xml");
if (xml.exists())
{
try
{
XmlBeanFactory factory = new XmlBeanFactory(
new FileSystemResource(xml));
RepositoryManager rm = (RepositoryManager) factory
.getBean(factory
.getBeanNamesForType(RepositoryManager.class)[0]);
rm.addRepository(new ServerRepository(ds));
return rm;
}
catch (Exception e)
{
e.printStackTrace();
}
}
else
{
RepositoryManager rm = new RepositoryManager();
rm.addRepository(new ServerRepository(ds));
return rm;
}
return null;
}
public FileRepository getRepository(String uri, String name)
{
DataSet ds = VdbManager.getEngine().getCatalog().fromUri(uri);
return getRepository(ds, name);
}
public FileRepository getRepository(DataSet ds, String name)
{
RepositoryManager rm = getRepositoryManager(ds);
if (rm != null && rm.getRepositories() != null)
{
for (FileRepository ir : rm.getRepositories())
{
ir.setDataSet(ds);
if (ir.getName().equalsIgnoreCase(name))
return ir;
}
}
return null;
}
public RepositoryFile getRootFile(DataSet ds, String repositoryName)
{
FileRepository ir = getRepository(ds.getUri(), repositoryName);
return ir.getRoot();
}
public RepositoryFile getRootFile(String uri, String repositoryName)
{
DataSet ds = VdbManager.getEngine().getCatalog().fromUri(uri);
FileRepository ir = getRepository(ds.getUri(), repositoryName);
return ir.getRoot();
}
}
| [
"caohaiquan1219@163.com"
] | caohaiquan1219@163.com |
74585ed3f08b93a7c2efbc74758e5b0dd896b41b | 418aa2de5fe441b1e4c4c12f1ffcd704c2f58dae | /04-baking/app/src/main/java/com/esanz/nano/ezbaking/respository/api/RetrofitClient.java | 893c7f364d31e7c33e62f4acdac9be6e5379ee3f | [
"MIT"
] | permissive | esanz91/Android-Nanodegree | 77d0468de95bd8b305182fc1c1ccc42738a80560 | 6abc48e0ccd3ffacc71c5e6ef237de208649f095 | refs/heads/master | 2020-03-17T02:38:54.623651 | 2018-09-30T03:18:58 | 2018-09-30T03:18:58 | 133,199,040 | 0 | 0 | MIT | 2018-09-29T20:17:29 | 2018-05-13T02:23:55 | Java | UTF-8 | Java | false | false | 1,205 | java | package com.esanz.nano.ezbaking.respository.api;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import java.util.concurrent.TimeUnit;
import io.reactivex.schedulers.Schedulers;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
public class RetrofitClient {
private static final String BASE_MOVIE_URL = "http://go.udacity.com/";
private static Retrofit RETROFIT_INSTANCE;
private RetrofitClient() {
}
public static Retrofit getInstance(@NonNull final OkHttpClient okHttpClient) {
if (null == RETROFIT_INSTANCE) {
RETROFIT_INSTANCE = new Retrofit.Builder()
.baseUrl(BASE_MOVIE_URL)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory
.createWithScheduler(Schedulers.from(AsyncTask.THREAD_POOL_EXECUTOR)))
.client(okHttpClient)
.build();
}
return RETROFIT_INSTANCE;
}
}
| [
"esanz91@gmail.com"
] | esanz91@gmail.com |
a24a1fbe17da2b3e2a3acf7c1b77ccb114319624 | 896885ec575259adcf63da1dc9aff1fd19197ab5 | /TP2/src/untref/ldp4/servlet/IniciarSesion.java | 1be7098dd6d7fe61985f014cc32a7bc6c8af7c27 | [] | no_license | MaVic14/TP-LDP4 | 81823a219ce1b4ce11b44ea7970e7eb00d55402c | efa806b03d678856276edb1f9c2a9f1215478558 | refs/heads/master | 2020-06-04T17:34:21.325449 | 2015-04-08T02:15:13 | 2015-04-08T02:15:13 | 33,427,241 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,101 | java | package untref.ldp4.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class IniciarSesion
*/
@WebServlet("/IniciarSesion")
public class IniciarSesion extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* Default constructor.
*/
public IniciarSesion() {
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
| [
"adriancastiglione@gmail.com"
] | adriancastiglione@gmail.com |
7fa1a070bffaec56597d5f09bcc4fe61cc5c2219 | 66759cdb5c947209b86a996f7a504fb36afc2692 | /src/main/java/com/wavelabs/dao/BookingsDao.java | 622b231e29117aa635653193c8d0eaf3986cb3b8 | [] | no_license | TharunBairoju/CalendarApp | 4faa55e6b9a5a309f90663c37fec5ff598a17099 | 6bfaedc8d7fd6972be708830860965ad094b2b93 | refs/heads/master | 2021-01-23T05:24:58.241572 | 2017-05-31T17:42:14 | 2017-05-31T17:42:14 | 92,967,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,271 | java | package com.wavelabs.dao;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Component;
import com.wavelabs.model.Bookings;
import com.wavelabs.model.Provider;
import com.wavelabs.model.Status;
import com.wavelabs.model.TimeSlots;
import com.wavelabs.util.SessionUtil;
/**
* This class will interact with data base
*
* @author tharunkumarb
*
*/
@Component
public class BookingsDao {
public BookingsDao() {
}
Logger logger = Logger.getLogger(BookingsDao.class);
/**
* This method will gets the booking using receiverid and the timeslotid
*
* @param receiverid
* @param timeslotid
* @return
*/
public Bookings getBooking(int receiverid, int timeslotid) {
Session session = SessionUtil.getSession();
Bookings booking = null;
try {
Criteria criteria = session.createCriteria(Bookings.class);
criteria.add(Restrictions.eq("receiver.id", receiverid));
criteria.add(Restrictions.eq("timeslot.id", timeslotid));
criteria.add(Restrictions.eq("status", Status.process));
booking = (Bookings) criteria.uniqueResult();
session.close();
} catch (Exception e) {
logger.info("something went wrong getting bookings");
logger.info("cause " + e.getCause());
}
return booking;
}
/**
* This method will gets the bookings by timeslots
*
* @param timeslot
* @return
*/
@SuppressWarnings("unchecked")
public List<Bookings> getBookingByTimeslot(TimeSlots timeslot) {
Session session = SessionUtil.getSession();
List<Bookings> bookingslist = new ArrayList<Bookings>();
try {
Criteria criteria = session.createCriteria(Bookings.class);
criteria.add(Restrictions.eq("timeslot.id", timeslot.getId()));
criteria.add(Restrictions.eq("status", Status.process));
bookingslist = criteria.list();
} catch (Exception e) {
logger.info("something went wrong getting bokings");
logger.info("cause " + e.getCause());
} finally {
session.close();
}
return bookingslist;
}
/**
* This method will cancel the bookings
*
* @param timeslotlist
* @return List<String>
*/
public List<String> cancelBookingForRemaining(List<TimeSlots> timeslotlist) {
Session session = SessionUtil.getSession();
List<String> msgData = new ArrayList<String>();
for (TimeSlots timeslot : timeslotlist) {
List<Bookings> bookinglist = getBookingByTimeslot(timeslot);
for (Bookings bookings : bookinglist) {
bookings.setStatus(Status.cancel);
session.update(bookings);
session.flush();
msgData.add(bookings.getReceiver().getName() + ","
+ bookings.getReceiver().getPhoneNumber() + ","
+ bookings.getReceiver().getEmail() + ","
+ timeslot.getSlot().getProvider().getName() + ","
+ Status.cancel.toString() + ","
+ timeslot.getFromTime().toString());
}
session.beginTransaction().commit();
}
session.close();
return msgData;
}
/**
* This method gets the method the by status
*
* @param receiverid
* @param timeslotid
* @return Bookings
*/
public Bookings getBookingByStatus(int receiverid, int timeslotid) {
Session session = SessionUtil.getSession();
Bookings booking = null;
try {
Criteria criteria = session.createCriteria(Bookings.class);
criteria.add(Restrictions.eq("receiver.id", receiverid));
criteria.add(Restrictions.eq("timeslot.id", timeslotid));
criteria.add(Restrictions.or(
Restrictions.eq("status", Status.process),
Restrictions.eq("status", Status.booked)));
booking = (Bookings) criteria.uniqueResult();
} catch (Exception e) {
logger.info("something went wrong getting bokings");
logger.info("cause " + e.getCause());
}finally{
session.close();
}
return booking;
}
/**
* This method gets the bookings by timeslots
*
* @param timeSlots
* @return Bookings
*/
public Bookings getBookedBookings(TimeSlots timeSlots) {
Session session = SessionUtil.getSession();
Bookings booking = null;
try {
Criteria criteria = session.createCriteria(Bookings.class);
criteria.add(Restrictions.eq("timeslot.id", timeSlots.getId()));
criteria.add(Restrictions.eq("status", Status.booked));
booking = (Bookings) criteria.uniqueResult();
} catch (Exception e) {
logger.info("something went wrong getting bokings");
logger.info("cause " + e.getCause());
}finally{
session.close();
}
return booking;
}
/**
* This method gets the list of bookings based on the provider
*
* @param provider
* @return List<Bookings>
*/
public List<Bookings> getBookings(Provider provider) {
Session session = SessionUtil.getSession();
logger.info("getting bookings");
Criteria criteria = session.createCriteria(Bookings.class);
criteria.createAlias("timeslot", "timeslot");
criteria.createAlias("timeslot.slot", "slot");
criteria.createAlias("slot.provider", "provider");
criteria.add(Restrictions.eq("provider.id", provider.getId()));
criteria.add(Restrictions.eq("status", Status.process));
@SuppressWarnings("unchecked")
List<Bookings> bookings = criteria.list();
logger.info(bookings);
session.close();
return bookings;
}
}
| [
"tharun.it05@gmail.com"
] | tharun.it05@gmail.com |
abbcdf24c2ea458859d06ddbc7991f478efe8059 | 553fb172c10f8499b8ecac66b8a5b95fdd3ba716 | /ssou/sprweb08_summary/src/pack/model/HelloModel.java | 9082f0710623b07dd54764e46293fa463ff0d7a4 | [] | no_license | ahg2656/KICCampus | e171a638de8af536cfaa273b42027fa68a9aae95 | e6e9075afcf60144ddfc18569a2cda8691401cbd | refs/heads/master | 2020-04-01T20:33:20.414533 | 2018-11-05T12:01:51 | 2018-11-05T12:01:51 | 153,609,319 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 360 | java | package pack.model;
import java.util.Calendar;
public class HelloModel {
public String process() {
int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
if(hour >= 6 && hour <= 10) {
return "좋은 아침입니다.";
} else if(hour >= 12 && hour <= 15) {
return "맛점하세요.";
} else {
return "안녕하세요.";
}
}
}
| [
"ahg2656@naver.com"
] | ahg2656@naver.com |
3f2fd25262ee4d6321a1ab7b14715ae7d3310506 | 12294bccaa3968eb902d7f2ed75a50cbf7759bf3 | /src/Line.java | f741416b423e584b8af33c724299269c17536d4a | [] | no_license | TwardowskaA/Zadanie-4-2 | cc937d2c617124f4df56aaf08f0d8e8ba472428b | 0c1937bab5e23fbf95f8b8194a59cf96b4f2606d | refs/heads/master | 2020-03-23T01:58:09.119707 | 2018-07-14T13:30:57 | 2018-07-14T13:30:57 | 140,948,520 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | public class Line {
Point p1;
Point p2;
Line(int x1, int y1, int x2, int y2) {
p1 = new Point(x1, y1);
p2 = new Point(x2, y2);
}
}
| [
"twardowska123@gmail.com"
] | twardowska123@gmail.com |
c27e2c824bbcfb88a1b43103fabbaf0ec761fcab | 459b0fb47b62cbf772e8bfbd089e0bd36a3416be | /src/main/java/com/example/mapper/AdminUserMapper.java | 73588b5e21bc69003334fe31dd09d2cc671b34a4 | [] | no_license | LiGuangyang01/student-management | a85aabf900198c770e4ac4ce96485e2f1ff12e89 | 06d4b8f97b11e237bb729eec2466f79197a6c528 | refs/heads/main | 2023-03-16T23:09:01.789107 | 2021-03-10T09:04:06 | 2021-03-10T09:04:06 | 345,115,376 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,218 | java | package com.example.mapper;
import com.example.entity.User;
import com.example.entity.TeacherInformation;
import org.springframework.stereotype.Repository;
import java.util.List;
//@Mapper
@Repository
public interface AdminUserMapper {
//登录
public User findByUsername(String username);
//返回所有管理员用户信息给前端页面
public List<User> findAdminByroles(String roles);
//返回所有教师用户信息给前端页面
public List<TeacherInformation> findTeacherByroles(String roles);
//增加各种登录用户
public void addLoginUser(User loginUser);
//修改各种用户数据
public void updateLoginUser(User loginUser);
//根据id查找教师详细表的teacherId
public int findTeacheridById(Integer id);
//增加教师用户详细信息
public void addTeacherInformation(TeacherInformation teacherInformation);
//修改教师用户数据
public void updateTeacherInformation(TeacherInformation teacherInformation);
//根据id返回管理员用户对象
public User findAdminById(Integer id);
//
public TeacherInformation findTeacherById(Integer id);
public void deleteLoginUser(Integer[] id);
}
| [
"2660142977@qq.com"
] | 2660142977@qq.com |
876826e915b0b3c6de08989723e101a56b15debe | 4459f4aa9b6c3477615f9b6e32e7fa1ed17a83c1 | /src/main/java/com/restaurant/eatenjoy/util/mail/ConsoleMailService.java | 3363e8708ca067ed2f11ebe098714f3a73059710 | [] | no_license | f-lab-edu/eat-enjoy | d471f85555fd13118788e5f775c9832c563a6001 | 7d701258d3163513460db77b1aa3e4c6b49e4dfe | refs/heads/develop | 2023-06-20T09:39:32.632495 | 2021-07-20T11:15:33 | 2021-07-20T11:15:33 | 338,736,634 | 13 | 4 | null | 2021-07-20T11:15:34 | 2021-02-14T05:31:35 | Java | UTF-8 | Java | false | false | 622 | java | package com.restaurant.eatenjoy.util.mail;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import com.restaurant.eatenjoy.util.security.Role;
import lombok.extern.log4j.Log4j2;
@Log4j2
@Profile("default")
@Component
public class ConsoleMailService implements MailService {
@Override
public void send(MailMessage mailMessage) {
log.info("Check Mail Token URL: {}", CHECK_MAIL_TOKEN_URL
.replace("ROLE", mailMessage.getRole() == Role.USER ? "users" : "owners")
.replace("EMAIL", mailMessage.getTo())
.replace("TOKEN", mailMessage.getToken()));
}
}
| [
"baekseongsa@naver.com"
] | baekseongsa@naver.com |
cb7da098030c62ba10305a61819228d68f893d6d | 36698a8464c18cfe4476b954eed4c9f3911b5e2c | /ZimbraSelenium/src/java/com/zimbra/qa/selenium/projects/ajax/tests/mail/mail/FlagUnFlagMail.java | 20b42fec43c31f266ad92bfc03a50d733522e778 | [] | no_license | mcsony/Zimbra-1 | 392ef27bcbd0e0962dce99ceae3f20d7a1e9d1c7 | 4bf3dc250c68a38e38286bdd972c8d5469d40e34 | refs/heads/master | 2021-12-02T06:45:15.852374 | 2011-06-13T13:10:57 | 2011-06-13T13:10:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,379 | java | package com.zimbra.qa.selenium.projects.ajax.tests.mail.mail;
import java.util.*;
import org.testng.annotations.Test;
import com.zimbra.qa.selenium.framework.items.*;
import com.zimbra.qa.selenium.framework.items.FolderItem.SystemFolder;
import com.zimbra.qa.selenium.framework.ui.*;
import com.zimbra.qa.selenium.framework.util.*;
import com.zimbra.qa.selenium.projects.ajax.core.AjaxCommonTest;
public class FlagUnFlagMail extends AjaxCommonTest {
@SuppressWarnings("serial")
public FlagUnFlagMail() {
logger.info("New "+ FlagUnFlagMail.class.getCanonicalName());
// All tests start at the login page
super.startingPage = app.zPageMail;
// Make sure we are using an account with message view
super.startingAccountPreferences = new HashMap<String, String>() {{
put("zimbraPrefGroupMailBy", "message");
}};
}
@Test( description = "Un-Flag a mail by clicking flagged icon",
groups = { "smoke" })
public void UnFlagMail_01() throws HarnessException {
// Create the message data to be sent
String subject = "subject"+ ZimbraSeleniumProperties.getUniqueString();
FolderItem inboxFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Inbox);
app.zGetActiveAccount().soapSend(
"<AddMsgRequest xmlns='urn:zimbraMail'>" +
"<m l='"+ inboxFolder.getId() +"' f='f'>" +
"<content>From: foo@foo.com\n" +
"To: foo@foo.com \n" +
"Subject: "+ subject +"\n" +
"MIME-Version: 1.0 \n" +
"Content-Type: text/plain; charset=utf-8 \n" +
"Content-Transfer-Encoding: 7bit\n" +
"\n" +
"simple text string in the body\n" +
"</content>" +
"</m>" +
"</AddMsgRequest>");
// Create a mail item to represent the message
MailItem mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:("+ subject +")");
ZAssert.assertStringContains(mail.getFlags(), "f", "Verify message is initially flagged");
// Click Get Mail button
app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);
// Select the item
app.zPageMail.zListItem(Action.A_LEFTCLICK, mail.dSubject);
// Flag the item
app.zPageMail.zListItem(Action.A_MAIL_UNFLAG, mail.dSubject);
// Get the item from the list
List<MailItem> messages = app.zPageMail.zListGetMessages();
ZAssert.assertNotNull(messages, "Verify the message list exists");
MailItem listmail = null;
for (MailItem m : messages) {
logger.info("Subject: looking for "+ mail.dSubject +" found: "+ m.gSubject);
if ( mail.dSubject.equals(m.gSubject) ) {
listmail = m;
break;
}
}
GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount());
// Make sure the GUI shows "flagged"
ZAssert.assertNotNull(listmail, "Verify the message is in the list");
ZAssert.assertFalse(listmail.gIsFlagged, "Verify the message is flagged in the list");
// Make sure the server shows "flagged"
mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:("+ subject +")");
ZAssert.assertStringDoesNotContain(mail.getFlags(), "f", "Verify the message is not flagged in the server");
}
@Test( description = "Un-Flag a mail by using shortcut 'mf'",
groups = { "functional" })
public void UnFlagMail_02() throws HarnessException {
// Create the message data to be sent
String subject = "subject"+ ZimbraSeleniumProperties.getUniqueString();
FolderItem inboxFolder = FolderItem.importFromSOAP(app.zGetActiveAccount(), SystemFolder.Inbox);
app.zGetActiveAccount().soapSend(
"<AddMsgRequest xmlns='urn:zimbraMail'>" +
"<m l='"+ inboxFolder.getId() +"' f='f'>" +
"<content>From: foo@foo.com\n" +
"To: foo@foo.com \n" +
"Subject: "+ subject +"\n" +
"MIME-Version: 1.0 \n" +
"Content-Type: text/plain; charset=utf-8 \n" +
"Content-Transfer-Encoding: 7bit\n" +
"\n" +
"simple text string in the body\n" +
"</content>" +
"</m>" +
"</AddMsgRequest>");
// Create a mail item to represent the message
MailItem mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:("+ subject +")");
ZAssert.assertStringContains(mail.getFlags(), "f", "Verify message is initially flagged");
// Click Get Mail button
app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);
// Select the item
app.zPageMail.zListItem(Action.A_LEFTCLICK, mail.dSubject);
// Flag the item
app.zPageMail.zKeyboardShortcut(Shortcut.S_MAIL_MARKFLAG);
// Get the item from the list
List<MailItem> messages = app.zPageMail.zListGetMessages();
ZAssert.assertNotNull(messages, "Verify the message list exists");
MailItem listmail = null;
for (MailItem m : messages) {
logger.info("Subject: looking for "+ mail.dSubject +" found: "+ m.gSubject);
if ( mail.dSubject.equals(m.gSubject) ) {
listmail = m;
break;
}
}
GeneralUtility.syncDesktopToZcsWithSoap(app.zGetActiveAccount());
// Make sure the GUI shows "flagged"
ZAssert.assertNotNull(listmail, "Verify the message is in the list");
ZAssert.assertFalse(listmail.gIsFlagged, "Verify the message is flagged in the list");
// Make sure the server shows "flagged"
mail = MailItem.importFromSOAP(app.zGetActiveAccount(), "subject:("+ subject +")");
ZAssert.assertStringDoesNotContain(mail.getFlags(), "f", "Verify the message is not flagged in the server");
}
}
| [
"dstites@autobase.net"
] | dstites@autobase.net |
38539fce75438bdd8d7a597f8aea7316d911cb0f | 5b15fd9ecae4f04b68062203e5df0e593dfa796a | /src/main/java/arrays/MinimumElementChallenge.java | 53fe0cc8d427a171bc9dc2546e6fa79d13d0f024 | [] | no_license | avoevodin81/Udemy | df78a7c99fb212f523365904f2d05c2e9bdb19eb | 9031e26758c27f5dc3ee56631f046a6052839747 | refs/heads/master | 2020-07-09T11:01:00.157430 | 2019-12-09T16:24:22 | 2019-12-09T16:24:22 | 203,953,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,105 | java | package arrays;
import java.util.Scanner;
public class MinimumElementChallenge {
private static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
System.out.println("Enter count:");
int count = scanner.nextInt();
scanner.nextLine();
int[] returnedArray = readIntegers(count);
int returnedMin = findMin(returnedArray);
System.out.println("min = " + returnedMin);
scanner.close();
}
private static int[] readIntegers(int count) {
int[] array = new int[count];
for (int i = 0; i < array.length; i++) {
System.out.println("Enter a number:");
int number = scanner.nextInt();
scanner.nextLine();
array[i] = number;
}
return array;
}
private static int findMin(int[] array) {
int min = Integer.MAX_VALUE;
for (int i = 0; i < array.length; i++) {
int value = array[i];
if (min > value) {
min = value;
}
}
return min;
}
}
| [
"avoevodin81@gmail.com"
] | avoevodin81@gmail.com |
d8433ef08f1d71341b4883559c21c70571529d8f | 718a8498e6da032fcdd976691ad07fb646bd9703 | /test_12.4/src/code1/PersonArrays.java | 9c80a188260d138b414ce2932821a7f337d08482 | [] | no_license | Nineodes19/happy-end | 716cb8026e5e9d1175ac068fdd866852a97f9494 | 07ec40c587f5247cd8e59e259c1c9dc14d1c488e | refs/heads/master | 2022-07-13T05:53:10.808060 | 2020-10-24T15:18:36 | 2020-10-24T15:18:36 | 217,953,407 | 0 | 0 | null | 2022-06-21T04:03:12 | 2019-10-28T02:47:47 | Java | UTF-8 | Java | false | false | 605 | java | package code1;
/**
* @program:test_12.4
* @author: Nine_odes
* @description:
* @create:2019-12-04 14:40
*/
class PersonArrays<T>{
private T[] personList;
public PersonArrays(T[] personList) {
this.personList = personList;
}
public boolean Insert(int index, T e){
if(index >= 0 && index < personList.length){
personList[index] = e;
return true;
}
return false;
}
public T get(int index){
if(index >= 0 && index < personList.length){
return personList[index];
}
return null;
}
}
| [
"3100863513@qq.com"
] | 3100863513@qq.com |
de77a679b04ec92fd829c72b5a79394b67e6318b | 74bf2128a2b59f5862c6cc1355d6692420a07ebf | /Calculator/src/com/example/calculator/MainActivity.java | 264d5af4ca77a0219ad089d1e43f1dedccccd686 | [] | no_license | Aayushi-Shrawagi/Android | d5585338886f78f3b37adc5b3a6de1ddc6a98cc4 | c3728de14362721dad3f65b393d44013ba199d31 | refs/heads/main | 2023-03-23T06:33:30.953967 | 2021-03-23T14:31:15 | 2021-03-23T14:31:15 | 350,737,349 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 8,664 | java | package com.example.calculator;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.AdapterView.OnItemSelectedListener;
import java.util.*;
public class MainActivity extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
Spinner mySpinner=(Spinner)findViewById(R.id.spinner1);
ArrayAdapter<String> adap=new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_list_item_1,
getResources().getStringArray(R.array.brackets));//(context,resourceFile,data)
//setting to dropDown menu
adap.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mySpinner.setAdapter(adap);
final Spinner spinner = (Spinner) findViewById(R.id.spinner1);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
//use postion value
String op="";
switch (position)
{
case 0:
op = "";
break;
case 1:
op = "(";
break;
case 2:
op = ")";
break;
}
TextView display=(TextView) findViewById(R.id.textView1);
display.append(op);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
return true;
}
public void clear(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.setText("");
}
public void del(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
CharSequence val=display.getText();
val=val.subSequence(0,val.length()- 1);
display.setText(val);
}
public void button_0(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("0");
}
public void button_1(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("1");
}
public void button_2(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("2");
}
public void button_3(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("3");
}
public void button_4(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("4");
}
public void button_5(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("5");
}
public void button_6(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("6");
}
public void button_7(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("7");
}
public void button_8(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("8");
}
public void button_9(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("9");
}
public void plus_button(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("+");
}
public void minus_button(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("-");
}
public void mul_button(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("x");
}
public void div_button(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("÷");
}
public void per_button(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append("%");
}
public void dot_button(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
display.append(".");
}
public int precedence(char ele)
{
switch(ele)
{
//case '(':return 4;
case 'x':
case '÷':return 3;
case '+':
case '-':return 2;
default:return 1;
}
}
public String infpos(CharSequence exp)
{
String res="";
Stack<Character> stack=new Stack<Character>();
//System.out.println(exp.length());
for(int i=0;i<exp.length();i++)
{
//System.out.println("abd");
String num="";
char ele=exp.charAt(i);
//System.out.println(i);
//System.out.println(ele);
if(Character.isDigit(ele))
{
while(Character.isDigit(ele)||ele=='.')
{
num+=ele;
i++;
if(i<exp.length())
ele=exp.charAt(i);
else
break;
//System.out.println(ele);
}
//System.out.println(num);
res+=num+',';
//System.out.println(res);
i--;
//System.out.println(i);
}
else if(ele=='(')
{
stack.push(ele);
}
else if (ele == ')')
{
while ((!stack.isEmpty()) &&(stack.peek() != '(') )
res += stack.pop();
stack.pop();
}
else
{
//System.out.println("abd");
//System.out.println(stack.isEmpty());
while(!stack.isEmpty() && precedence(ele)<=precedence(stack.peek()))
{
res+=stack.pop();
}
stack.push(ele);
}
}
//System.out.println(stack.isEmpty());
while(!stack.isEmpty())
{
if(stack.peek()=='(')
return "invalid expression";
//System.out.println(stack.pop());
res+=stack.pop();
}
return res;
}
public float evaluatePostfix(String pos)
{
Stack<Float> stack=new Stack<Float>();
//System.out.println(pos.length());
for(int i=0;i<pos.length();i++)
{
String num="";
char c=pos.charAt(i);
if(Character.isDigit(c))
{
while(c!=',')
{
num+=c;
i++;
if(i<pos.length())
c=pos.charAt(i);
else
break;
//System.out.println(ele);
}
//i--;
//System.out.println(num);
stack.push(Float.parseFloat(num));
}
else
{
float val1 = stack.pop();
float val2 = stack.pop();
//System.out.println(val2);
//System.out.println(val1);
switch(c)
{
case '+':
stack.push(val2+val1);
break;
case '-':
stack.push(val2- val1);
break;
case '÷':
stack.push(val2/val1);
break;
case 'x':
stack.push(val2*val1);
break;
}
//System.out.println(stack.peek());
}
}
return stack.pop();
}
public void equal_button(View view)
{
TextView display=(TextView) findViewById(R.id.textView1);
CharSequence values=display.getText();
//String exp=(String)values;
float ans;
String val=values.toString();
if((val).contains("%"))
{
String proc=val.substring(0,val.length()-1);
ans=Float.parseFloat(proc);
ans/=100;
}
else
{
String pos=infpos(values);
ans=evaluatePostfix(pos);
//display.setText(pos);
}
display.setText(""+ans);
}
} | [
"noreply@github.com"
] | noreply@github.com |
bcbb500148a15bc2f77d9064487b96c601f31ae0 | 52e2f54df038dd83c01cd5b6dc6adca94fa045a7 | /source_code/Server/NewConnection.java | ddecf0fbaeaf2dd347e3c4712bed5b7c29757096 | [] | no_license | ewoner/JavaMud | 71d28bf8d65e6750c0de3948fb7c15a8888da3b4 | d6a84dd539210206aed960f880be09bba4e94231 | refs/heads/master | 2021-01-11T21:21:08.245639 | 2019-11-14T05:13:48 | 2019-11-14T05:13:48 | 78,770,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,780 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Server;
import Mud.MyTimer;
import Server.Handler.NewHandler;
import Server.Protocol.NewProtocol;
import Server.ServerExceptions.ServerException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.util.Iterator;
import java.util.Set;
import java.util.Stack;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @param <P>
* @author Administrator
*/
public class NewConnection<P extends NewProtocol> {
private SocketChannel socket;
private P protocol;
private Stack<NewHandler> handlerstack;
private long creationtime;
private boolean closed;
private Selector readSelector;
private ByteBuffer readBuffer, writeBuffer;
private final int BUFFERSIZE = 8000;
private CharsetDecoder asciiDecoder;
private Charset ascii;
private boolean isblocking;
private String m_sendbuffer;
private long m_lastSendTime;
private boolean m_checksendtime;
public NewConnection(P protocol) {
this.protocol = protocol;
handlerstack = new Stack<NewHandler>();
creationtime = MyTimer.GetTimeMS();
closed = false;
ascii = Charset.forName("US-ASCII");
asciiDecoder = ascii.newDecoder();
readBuffer = ByteBuffer.allocateDirect(BUFFERSIZE);
writeBuffer = ByteBuffer.allocateDirect(BUFFERSIZE);
m_sendbuffer = "";
}
public NewConnection(SocketChannel socket, P protocol) throws ServerException {
this(protocol);
try {
this.socket = socket;
readSelector = Selector.open();
socket.configureBlocking(false);
socket.register(readSelector, SelectionKey.OP_READ, new StringBuffer());
} catch (IOException ex) {
throw new ServerException(ex, this.getClass().getName());
}
}
public int GetBufferedBytes() {
return m_sendbuffer.length();
}
public void BufferData(String p_buffer) {
m_sendbuffer = m_sendbuffer.concat(p_buffer);
}
public long getLastSendTime() {
return m_lastSendTime;
}
public void close() {
closed = true;
}
public void closeSocket() throws ServerException {
try {
getSocket().close();
} catch (IOException ex) {
throw new ServerException(ex, this.getClass().getName());
}
if (getHandler() != null) {
getHandler().leave();
}
while (getHandler() != null) {
handlerstack.pop();
}
}
public long getCreationTime() {
return creationtime;
}
public boolean isClosded() {
return closed;
}
public void switchHandler(NewHandler handler) {
if (getHandler() != null) {
getHandler().leave(); // leave the current state if it exists
handlerstack.pop(); // pop the pointer off
}
handlerstack.push(handler);
handler.enter(); // enter the new state
}
public void addHandler(NewHandler handler) {
if (getHandler() != null) {
getHandler().leave(); // leave the current state if it exists
}
handlerstack.push(handler);
handler.enter(); // enter the new state
}
public void removeHandler() {
getHandler().leave(); // leave current state
handlerstack.pop(); // pop the pointer off
if (getHandler() != null) // if old state exists,
{
getHandler().enter(); // tell it connection has re-entered
}
}
public NewHandler getHandler() {
if (handlerstack.size() == 0) {
return null;
}
return handlerstack.peek();
}
public void clearHandlers() {
// leave the current handler
if (getHandler() != null) {
getHandler().leave();
}
// delete all the handlers on the stack
while (getHandler() != null) {
handlerstack.pop();
}
}
public void sendBuffer() throws ServerException {
if (m_sendbuffer.length() > 0) {
// send the data, and erase as much as was sent from the buffer.
int sent = send(m_sendbuffer);
if (sent >= m_sendbuffer.length()) {
m_sendbuffer = "";
} else {
m_sendbuffer = m_sendbuffer.substring(sent);
}
if (sent > 0) {
// since data was sent successfully, reset the send time.
m_lastSendTime = MyTimer.GetTimeS();
m_checksendtime = false;
} else {
// no data was sent, so mark down that the sending time
// needs to be checked, to see if the socket is entering
// client deadlock
if (!m_checksendtime) {
// if execution gets here, that means that this connection
// has previously not had any problems sending data, so
// mark down the time that the sending problem started.
// note that it may have started earlier, but since we didn't
// start sending data earlier, there really is no way to know
// for sure when it started.
m_checksendtime = true;
m_lastSendTime = MyTimer.GetTimeS();
}
} // end no-data-sent check
} // end buffersize check}
}
public int send(String data) throws ServerException {
prepWriteBuffer(data);
long nbytes = 0;
long toWrite = writeBuffer.remaining();
try {
while (nbytes != toWrite) {
nbytes += getSocket().write(writeBuffer);
try {
Thread.sleep(10);
} catch (InterruptedException e) {
}
}
Logger.getLogger(NewConnection.class.getName()).info("New Connection: Sent---->\n" + data + "\n");
} catch (Exception e) {
throw new ServerException(e, this.getClass().getName());
}
writeBuffer.rewind();
return (int) nbytes;
}
public void receive() throws ServerException {
try {
//Logger.getLogger(NewConnection.class.getName()).info("New Connection: receive");
int keysReady = keysReady = getReadSelector().select();
if (keysReady > 0) {
Set readyKeys = getReadSelector().selectedKeys();
for (Iterator i = readyKeys.iterator(); i.hasNext();) {
SelectionKey key = (SelectionKey) i.next();
i.remove();
String result = readRequest(key);
// System.out.println("<----- NewConnection.recieve()\n" + result + "----->");
protocol.Translate(this, result.toCharArray(), result.length());
}
}
} catch (Exception ex) {
throw new ServerException(ex, this.getClass().getName());
}
}
public P getProtocol() {
return protocol;
}
private void prepWriteBuffer(String result) {
writeBuffer.clear();
result += "\r\n";
writeBuffer.put(result.getBytes());
writeBuffer.flip();
}
private String readRequest(SelectionKey key) throws ServerException {
// System.out.println("<------ NC: readRequest ------>");
String result = "";
SocketChannel incomingChannel = (SocketChannel) key.channel();
try {
int bytesRead = incomingChannel.read(readBuffer);
if (bytesRead == -1) {
Logger.getLogger(NewConnection.class.getName()).warning("disconnect:" + incomingChannel.socket().getInetAddress() +
", end-of-stream");
closed = true;
}
readBuffer.flip();
result = asciiDecoder.decode(readBuffer).toString();
readBuffer.clear();
//System.out.println(result);
} catch (IOException ie) {
if (ie.getMessage() != null && ie.getMessage().contains("forcibly closed")) {
Logger.getLogger(NewConnection.class.getName()).warning("disconnect:" + incomingChannel.socket().getInetAddress() +
", forcibly cloaded.");
closed = true;
} else {
Logger.getLogger(NewConnection.class.getName()).log(Level.SEVERE, "ERROR in readRequest()--" + ie.toString(), ie);
throw new ServerException(ie, this.getClass().getName(), "ERROR in readRequest() --");
}
} catch (Exception ioe) {
Logger.getLogger(NewConnection.class.getName()).log(Level.SEVERE, "ERROR in readRequest()--" + ioe.toString(), ioe);
throw new ServerException(ioe, this.getClass().getName(), "ERROR in readRequest() --");
}
return result;
}
void setBlocking(boolean blockmode) throws ServerException {
try {
this.getSocket().configureBlocking(blockmode);
} catch (IOException ex) {
throw new ServerException(ex, this.getClass().getName());
}
isblocking = blockmode;
}
/**
* @return the socket
*/
public SocketChannel getSocket() {
return socket;
}
/**
* @return the readSelector
*/
public Selector getReadSelector() {
return readSelector;
}
}
| [
"ewoner@gmail.com"
] | ewoner@gmail.com |
486c7f1bf672241ae7054abbc98b128b57e5592e | e69da0cb06109d205eda124fac93e56519567b54 | /SpringBootWB/springboot-01-HelloWorld/src/main/java/com/zhenguo/controller/TestController.java | d7cb83411a2e1a77acf659b2b74a42c8e5404830 | [] | no_license | 897775813/springboot | 77a75fee63667d2880bba110b8e04b437e3403de | 4b6f580fa54f57196c957c370b321e491f124782 | refs/heads/master | 2020-04-01T04:03:39.656573 | 2018-12-03T03:02:07 | 2018-12-03T03:02:07 | 152,848,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package com.zhenguo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
@RequestMapping("/hello")
public String print_helloworld() {
return "Hello World!!";
}
}
| [
"897775813@qq.com"
] | 897775813@qq.com |
8a4fdf42676577c261ebc51ee9daf9c4dc33db43 | aa6ad79c3cb2f790e32d6561561b88e165944e58 | /SpringMVC_Demo03/src/main/java/com/springmvc/controller/FileUploadController.java | c0b29a36550fc72c188319bc7dee34fa587df03a | [] | no_license | q878740953/springMVC_Study | 1e68840323969e0d374c49116b332cc1d826f76f | 36540fae232fc75958c92639edfece04abcf16e7 | refs/heads/master | 2022-12-07T20:47:26.619834 | 2020-09-02T06:56:57 | 2020-09-02T06:56:57 | 292,205,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,849 | java | package com.springmvc.controller;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemIterator;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.MultipartStream;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
@Controller
public class FileUploadController {
/**
* 使用传统方式上传
* @param body
* @param request
* @return
* @throws Exception
*/
@RequestMapping("/upload01")
public String uploadFile01(String body, HttpServletRequest request) throws Exception {
String path = request.getSession().getServletContext().getRealPath("/upload/");
File file = new File(path);
// 判断如果upload文件夹不存在,则创建要和新的
if (!file.exists()){
file.mkdir();
}
// 解析request请求,获得上传文件项
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
// 解析request
Map<String, List<FileItem>> listMap = upload.parseParameterMap(request);
for (String s : listMap.keySet()) {
List<FileItem> items = listMap.get(s);
for (FileItem item : items) {
// 判断item是否是文件项
if (item.isFormField()){
// 说明是表单项
}
else {
// 文件项
// 获取文件名
String name = item.getName();
// 完成文件上传
item.write(new File(path, name));
}
}
}
return "success";
}
/**
* 使用springmvc上传
*/
@RequestMapping("/upload02")
public String upload02(HttpServletRequest request, MultipartFile upload) throws IOException {
// 获得需要上传的路径
String path = request.getSession().getServletContext().getRealPath("/upload/");
File file = new File(path);
if (!file.exists()){
file.mkdirs();
}
// 获取文件的名字
String name = upload.getOriginalFilename();
// 上传文件
upload.transferTo(new File(path, name));
return "success";
}
}
| [
"878740953@qq.com"
] | 878740953@qq.com |
adbb9fed7e31d8e47328871c9e68c8b7f5462440 | bf73b51657955d172ab7d7de938745dd0a3f3339 | /stockProfile.java | 1ff4c37f85daef7cf79ae0fd22d3d23eacf0932c | [] | no_license | soumildesai/stockmarketsimulator | 0f62af5f9c43e171fb3d6d808c22020b08b3bc3a | fd5bca002da262b8dcd444fe737a5f2e5e0db579 | refs/heads/main | 2023-03-03T18:24:03.524088 | 2021-02-05T00:22:49 | 2021-02-05T00:22:49 | 334,691,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,928 | java | package stock.market.simulator;
public class stockProfile {
private final String profileName;
private double buyPrice;
private double sellPrice;
private double change;
private double margin;
private int quantity;
// Class constructor for stock that has been bought
public stockProfile(String pName, double sPrice, double bPrice, int quant) {
profileName = pName;
buyPrice = bPrice;
sellPrice = sPrice;
quantity = quant;
}
// Class constructor for all stocks when program is launched
public stockProfile(String pName, double sPrice, double bPrice, double m) {
profileName = pName;
buyPrice = bPrice;
sellPrice = sPrice;
margin = m;
change = 0;
}
// Method to retrieve the quatity of stocks bought
public int getQuantity() {
return quantity;
}
// Method to set the number of a stock that has been bought
public void setQuantity(int q) {
quantity = q;
}
// Method to retrieve the profile name
public String getProfileName() {
return profileName;
}
// Method to retrieve the buy price
public double getBuyPrice() {
return buyPrice;
}
// Method to retrieve the sell price
public double getSellPrice() {
return sellPrice;
}
// Method to set the buy price
public void setBuyPrice(double bPrice) {
buyPrice = bPrice;
}
// Method to set the sell price
public void setSellPrice(double sPrice) {
sellPrice = sPrice;
}
// Method to get the margin
public double getMargin() {
return margin;
}
// Method to set the change in current and previous rate
public void setChange(double c) {
change = c;
}
// Method to get the change in current and previous rate
public double getChange() {
return change;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
ae8cce1b288b73022db6d9584dc239446450b33e | 6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386 | /google/cloud/gaming/v1beta/google-cloud-gaming-v1beta-java/proto-google-cloud-gaming-v1beta-java/src/main/java/com/google/cloud/gaming/v1beta/TargetStateOrBuilder.java | 51cba9c5d172de5e7f51d28a359b329bc2dc91fa | [
"Apache-2.0"
] | permissive | oltoco/googleapis-gen | bf40cfad61b4217aca07068bd4922a86e3bbd2d5 | 00ca50bdde80906d6f62314ef4f7630b8cdb6e15 | refs/heads/master | 2023-07-17T22:11:47.848185 | 2021-08-29T20:39:47 | 2021-08-29T20:39:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 1,509 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/gaming/v1beta/common.proto
package com.google.cloud.gaming.v1beta;
public interface TargetStateOrBuilder extends
// @@protoc_insertion_point(interface_extends:google.cloud.gaming.v1beta.TargetState)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* Details about Agones fleets.
* </pre>
*
* <code>repeated .google.cloud.gaming.v1beta.TargetDetails details = 1;</code>
*/
java.util.List<com.google.cloud.gaming.v1beta.TargetDetails>
getDetailsList();
/**
* <pre>
* Details about Agones fleets.
* </pre>
*
* <code>repeated .google.cloud.gaming.v1beta.TargetDetails details = 1;</code>
*/
com.google.cloud.gaming.v1beta.TargetDetails getDetails(int index);
/**
* <pre>
* Details about Agones fleets.
* </pre>
*
* <code>repeated .google.cloud.gaming.v1beta.TargetDetails details = 1;</code>
*/
int getDetailsCount();
/**
* <pre>
* Details about Agones fleets.
* </pre>
*
* <code>repeated .google.cloud.gaming.v1beta.TargetDetails details = 1;</code>
*/
java.util.List<? extends com.google.cloud.gaming.v1beta.TargetDetailsOrBuilder>
getDetailsOrBuilderList();
/**
* <pre>
* Details about Agones fleets.
* </pre>
*
* <code>repeated .google.cloud.gaming.v1beta.TargetDetails details = 1;</code>
*/
com.google.cloud.gaming.v1beta.TargetDetailsOrBuilder getDetailsOrBuilder(
int index);
}
| [
"bazel-bot-development[bot]@users.noreply.github.com"
] | bazel-bot-development[bot]@users.noreply.github.com |
3a56efc85fd39d201f17e4a079ddd2b7eda5f264 | ceb527a2166e10dad480d6533c18785635bacbc1 | /kodilla-spring-basic/src/main/java/com/kodilla/spring/basic/dependency_injection/homework/DeliveryInterface.java | f0bfdcc3c5d82e7b1862b59d30d1785466dac94f | [] | no_license | awojciechowicz/adrian_wojciechowicz-kodilla_tester | 8347355b5fc3b37f0f2290266f4da096e7ad15ac | 101a1b48ca7fa86827d5d75634bad0dc906e1ee1 | refs/heads/master | 2023-05-04T23:58:00.441761 | 2021-05-24T20:49:53 | 2021-05-24T20:49:53 | 334,507,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 170 | java | package com.kodilla.spring.basic.dependency_injection.homework;
public interface DeliveryInterface {
public boolean deliverPackage(String address, double weight);
}
| [
"adrianwojciechowicz@gmail.com"
] | adrianwojciechowicz@gmail.com |
9896b371037f6e9a84a1ea8b2185d0da18e580f3 | 0ac43bfbc1807af2ecc90b4c638760b60e71e814 | /News.java | b2a7af98bdf9aa2105582e5a9083df6694166d21 | [] | no_license | afiivy/NewsApp | 65b18b94a5b547782003a268ebe4b2fa03fd1c91 | 0d51dadb8e8148e969db78b8433ccc81e7cd5f88 | refs/heads/master | 2021-07-05T06:05:01.342581 | 2019-05-12T03:18:44 | 2019-05-12T03:18:44 | 154,044,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,330 | java | package com.example.android.newsapp;
import org.apache.commons.lang3.StringUtils;
public class News {
private String mWebUrl;
private String mSectionName;
private String mAuthorsName;
private String mAuthorsLastname;
private String mDate;
private String mImageUrl;
private String mWebTitle;
public News(String title, String sectionName, String authorsName,
String authorsLastname, String date, String url, String imageUrl) {
mWebTitle = title;
mSectionName = sectionName;
mAuthorsName = authorsName;
mAuthorsLastname = authorsLastname;
mWebUrl = url;
mDate = date;
mImageUrl = imageUrl;
}
public String getTitle() {
return mWebTitle;
}
public String getTopic() {
return mSectionName;
}
public String getAuthor() {
if (mAuthorsName != null && mAuthorsLastname != null) {
return StringUtils.capitalize ( mAuthorsName ) + " " + StringUtils.capitalize ( mAuthorsLastname );
}
return null;
}
public String getDate() {
return mDate;
}
public String getUrl() {
return mWebUrl;
}
public String getImageUrl() {
return mImageUrl;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
fd6be091084258709d18a107806ef6fff470daca | ccf2473a1097306619c6944d7378bcb37f656fbc | /KSP_LABA3_result/CartService/src/main/java/ru/mirea/CartService/CartDbConnection.java | 0dfd378f2518340222a4ad78c032554d493b3c6f | [] | no_license | pupysheva/KSP_resultKurs | 6399f48844ccc80ecc31787be1f473e859041729 | 203f24f62b7586ce8277b1f145cf724318ad1588 | refs/heads/master | 2022-05-08T12:41:10.094405 | 2019-12-02T22:33:44 | 2019-12-02T22:33:44 | 167,825,461 | 0 | 0 | null | 2022-03-31T18:46:11 | 2019-01-27T15:39:51 | Java | UTF-8 | Java | false | false | 3,514 | java | package ru.mirea.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.sql.ResultSet;
import java.util.List;
@Component
public class CartDbConnection {
volatile int id_cart = 0;
private final JdbcTemplate jdbcTemplate;
@Autowired
public CartDbConnection(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
//Получить корзину
public List<Cart> getCart(int user_id){
return jdbcTemplate.query("select * from Cart where user_id = ?", new Object[]{user_id},(ResultSet resultSet, int rowNum) -> {
return new Cart(resultSet.getInt("id"), resultSet.getInt("user_id"), resultSet.getInt("item_id"),resultSet.getString("type"),resultSet.getDouble("price") );
});
}
//Удалить корзину
public String deleteCart(int user_id) {
try {
jdbcTemplate.update("DELETE FROM Cart WHERE user_id = ?", user_id);
}catch(DataAccessException dataAccessException){
return "ERROR";
}
return "Item hes been removed";
}
//Удалить запись в таблице
public String deleteOneItem(int user_id,int id) {
try {
jdbcTemplate.update("DELETE FROM Cart WHERE user_id = ? AND id=?", user_id,id);
}catch(DataAccessException dataAccessException){
return "ERROR";
}
return "Item hes been removed";
}
//Положить Item в корзину//Связь с бд Item
public String putItem_inCart(String type, int user_id, int id, double price) {
String tempString = "Item added successfully";
String tempStringNOT = "Item not added";
try {
//System.out.println(price+" price in Connection");
jdbcTemplate.update("INSERT INTO Cart (id,user_id,item_id,type,price) values(?,?,?,?,?)", new Object[]{id_cart++, user_id, id, type, price});
return tempString;
}catch (DataAccessException dataAccessException) {
return tempStringNOT;
}
}
//Оплатить корзину//Нужна связь с бд баланс и итем (списать средства) Запрос не используется
public String payCart(int user_id) {
double result = jdbcTemplate.queryForObject("SELECT bal.balance - SUM(i.price) " +
"FROM cart ca " +
"INNER JOIN Item i ON i.id = ca.item_id AND ca.user_id = ? LEFT JOIN Balance bal ON bal.user_id = ca.user_id GROUP BY ca.user_id",
Double.class ,new Object[]{user_id});
if (result >= 0) {
deleteCart(user_id);
//jdbcTemplate.update("UPDATE Item SET count = (count - ?) WHERE id = ? ", new Object[]{1, id});
/////updateBalance2(user_id, result);
return "Cart has been successfully paid";
}
else return "You cannot afford this purchase";
}
public double getCartCost(int user_id) {
try {
return jdbcTemplate.queryForObject("Select SUM (price) FROM Cart WHERE user_id = ? GROUP bY user_id", Double.class, user_id);
}catch(DataAccessException dataAccessException) {
return -0;
}
}
} | [
"noreply@github.com"
] | noreply@github.com |
6c95b8fc0bd3253623a7e0f03a4f30a782ea411c | a56ba805951167a2a89449b8fe7c95f607dd9342 | /src/main/java/training.java | 0483b766dc9d09e4b96c56c3adec43314605d38b | [] | no_license | Xrustq/00_Entrance_test_task | a37b621818e9e82146f7cede421c621fdbaab4df | 421e7bdf5763109fa0a79671d617a55e8584cde0 | refs/heads/master | 2020-03-18T06:34:11.571219 | 2018-05-22T11:27:34 | 2018-05-22T11:27:34 | 134,398,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 125 | java |
public class training {
public static void main(String[] args) {
System.out.println("Hello world! 2");
}
}
| [
"rust8013@gmail.com"
] | rust8013@gmail.com |
0f20d16fd86e16f10e890db6c050c1fc5c1fdb93 | 0c6a74c86dcf1eb563c09168e1e3e3a4e65f3b8d | /src/main/java/com/imxiaomai/bms/entity/BorrowBookLog.java | 20655d934ab20353624cafe300a83b809d8df324 | [
"Apache-2.0"
] | permissive | xiaomaipu/bms | b7dac71994485acaeed2529ca793c60e663b0ef6 | c38a9b4106690c4cd616339dc8482f32d5c7d776 | refs/heads/master | 2020-03-11T23:07:57.757962 | 2018-05-11T03:19:49 | 2018-05-11T03:19:49 | 130,313,066 | 28 | 5 | Apache-2.0 | 2018-05-09T08:18:57 | 2018-04-20T05:27:12 | Java | UTF-8 | Java | false | false | 1,674 | java | package com.imxiaomai.bms.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* 借书日志
* Created by hyy on 2018/1/24.
*/
@Table(name = "borrow_book_log")
public class BorrowBookLog implements Serializable{
private static final long serialVersionUID = 8912168686048125380L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "book_id")
private Integer bookId;
@Column(name = "user_id")
private Integer userId;
private Integer state;
private String created;
private String updated;
private Integer yn;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getBookId() {
return bookId;
}
public void setBookId(Integer bookId) {
this.bookId = bookId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public String getCreated() {
return created;
}
public void setCreated(String created) {
this.created = created;
}
public String getUpdated() {
return updated;
}
public void setUpdated(String updated) {
this.updated = updated;
}
public Integer getYn() {
return yn;
}
public void setYn(Integer yn) {
this.yn = yn;
}
}
| [
"526372898@qq.com"
] | 526372898@qq.com |
099f327736806427bb3d59ab2143fc517f34cb3a | de0ebd2361c80805658a1fa8e8db58ed47c56620 | /Genie/src/genie/editor/NetgearCall.java | a45aff866e59384700644b8415c0f670eea37a7c | [] | no_license | SiteView/GDT | 6487aa974385e1908df21a7c6a9e4d3687962eba | 6aaf9585da9665ae18ddfde7a094ef617adecaa6 | refs/heads/master | 2021-06-28T21:22:11.099432 | 2017-01-11T03:13:13 | 2017-01-11T03:13:13 | 78,597,529 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 29,254 | java | package genie.editor;
import genie.MethodCall.SOAPClient4XG;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.wb.swt.SWTResourceManager;
public class NetgearCall extends EditorPart {
public static final String ID = "Genie.NetgearCall";
public Label lblLocal;
public static Color color=new Color(null,255,255,255);
private Text text;//MethodName
private Text text_1;//Arguments
private Text text_2;//Result
private Text text_3;//SOAPUrl
private Text text_4;//ModleName
private Text text_5;//input params
private Text text_6;//other
private Text text_7;//Instructions for use
Tree tree;
Group grpCall ;
Combo combo;
Label label;
String s;
String key;
String value;
public static TreeItem treeitem;
public static TreeItem item1;
public static TreeItem treeitem1;
public static TreeItem treeitem2;
public static TreeItem treeitem3;
public static TreeItem treeitem4;
public static TreeItem treeitem5;
public static TreeItem treeitem6;
public static TreeItem treeitem7;
public static TreeItem treeitem8;
private static Map map=new HashMap<String,String>();
private static Map map1 = new HashMap<String, String>();
private static Map map2 = new HashMap<String, String>();
private static Map map3 = new HashMap<String, String>();
private static Map map4 = new HashMap<String, String>();
private static Map map5 = new HashMap<String, String>();
private static Map map6 = new HashMap<String, String>();
private static Map map7 = new HashMap<String, String>();
private static Map map8 = new HashMap<String, String>();
private static List list1 = new ArrayList<String>();
private static List list2 = new ArrayList<String>();
static{
map.put("Authenticate", "urn:NETGEAR-ROUTER:service:DeviceConfig:1#Authenticate");
map.put("GetAPInfo", "urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetAPInfo");
map.put("SetExtenderMode", "urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetExtenderMode");
map.put("ConfigurationStarted", "urn:NETGEAR-ROUTER:service:DeviceConfig:1#ConfigurationStarted");
map.put("SetRouterWLANWPAPSKByPassphrase", "urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetRouterWLANWPAPSKByPassphrase");
map.put("SetWLANWPAPSKByPassphrase", "urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetWLANWPAPSKByPassphrase");
map.put("ConfigurationFinished", "urn:NETGEAR-ROUTER:service:DeviceConfig:1#ConfigurationFinished");
map.put("SetEnable", "urn:NETGEAR-ROUTER:service:DeviceConfig:1#SetEnable");
map.put("GetRouterWLANWPAInfo", "urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetRouterWLANWPAInfo");
map1.put("ConfigurationStarted",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#ConfigurationStarted");
map1.put("ConfigurationFinished",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#ConfigurationFinished");
map1.put("IsDLNASupported",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#IsDLNASupported");
map1.put("IsDLNAEnabled",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#IsDLNAEnabled");
map1.put("SetDLNAStatus",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#SetDLNAStatus");
map1.put("SetEnable",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#SetEnable");
map1.put("SetGUILanguage",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#SetGUILanguage");
map1.put("SetConfiguration",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#SetConfiguration");
map1.put("Loaddefault",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#Loaddefault");
map1.put("SetFirmware",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#SetFirmware");
map1.put("SetBlockSiteEnable",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#SetBlockSiteEnable");
map1.put("SetBlockSiteName",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#SetBlockSiteName");
map1.put("GetBlockSiteInfo",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#GetBlockSiteInfo");
map1.put("SetTimeZone",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#SetTimeZone");
map1.put("SetTrafficMeterOptions",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#SetTrafficMeterOptions");
map1.put("GetTrafficMeterOptions",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#GetTrafficMeterOptions");
map1.put("GetTrafficMeterStatistics",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#GetTrafficMeterStatistics");
map1.put("GetTimeZoneInfo",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#GetTimeZoneInfo");
map1.put("GetInfo",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#GetInfo");
map1.put("GetTrafficMeterEnabled",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#GetTrafficMeterEnabled");
map1.put("EnableTrafficMeter",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#EnableTrafficMeter");
map1.put("Reboot",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#Reboot");
map1.put("CheckNewFirmware",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#CheckNewFirmware");
map1.put("UpdateNewFirmware",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#UpdateNewFirmware");
map1.put("ResetToFactoryDefault",
"urn:NETGEAR-ROUTER:service:DeviceConfig:1#ResetToFactoryDefault");
map2.put("GetAttachDevice","urn:NETGEAR-ROUTER:service:DeviceInfo:1#GetAttachDevice");
map2.put("GetSysUpTime","urn:NETGEAR-ROUTER:service:DeviceInfo:1#GetSysUpTime");
map2.put("GetInfo","urn:NETGEAR-ROUTER:service:DeviceInfo:1#GetInfo");
map3.put("SetIPInterfaceInfo",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#SetIPInterfaceInfo");
map3.put("SetSmartWizardDetection",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#SetSmartWizardDetection");
map3.put("SetDSLConfig",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#SetDSLConfig");
map3.put("GetPPPConnStatus",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#GetPPPConnStatus");
map3.put("GetConnectionTypeInfo",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#GetConnectionTypeInfo");
map3.put("GetModemInfo",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#GetModemInfo");
map3.put("GetDNSLookUpStatus",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#GetDNSLookUpStatus");
map3.put("GetPortMappingInfo",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#GetPortMappingInfo");
map3.put("SetConnectionType",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#SetConnectionType");
map3.put("SetMACAddress",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#SetMACAddress");
map3.put("SetMaxMTUSize",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#SetMaxMTUSize");
map3.put("AddPortMapping",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#AddPortMapping");
map3.put("DeletePortMapping",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#DeletePortMapping");
map3.put("GetInfo",
"urn:NETGEAR-ROUTER:service:WANIPConnection:1#GetInfo");
map4.put("SetConnectionType","urn:NETGEAR-ROUTER:service:WAN3GInterfaceConfig:1#SetConnectionType");
map4.put("Set3GConfig","urn:NETGEAR-ROUTER:service:WAN3GInterfaceConfig:1#Set3GConfig");
map4.put("GetInfo","urn:NETGEAR-ROUTER:service:WAN3GInterfaceConfig:1#GetInfo");
map4.put("Get3GInfo","urn:NETGEAR-ROUTER:service:WAN3GInterfaceConfig:1#Get3GInfo");
map5.put("GetEthernetLinkStatus",
"urn:NETGEAR-ROUTER:service:WANEthernetLinkConfig:1#GetEthernetLinkStatus");
map5.put("SetWANRelease",
"urn:NETGEAR-ROUTER:service:WANEthernetLinkConfig:1#SetWANRelease");
map5.put("SetWANRenew",
"urn:NETGEAR-ROUTER:service:WANEthernetLinkConfig:1#SetWANRenew");
map6.put("SetConfigLANSubnet",
"urn:NETGEAR-ROUTER:service:LANConfigSecurity:1#SetConfigLANSubnet");
map6.put("SetConfigLANIP",
"urn:NETGEAR-ROUTER:service:LANConfigSecurity:1#SetConfigLANIP");
map6.put("SetConfigLAN",
"urn:NETGEAR-ROUTER:service:LANConfigSecurity:1#SetConfigLAN");
map6.put("SetConfigDHCPEnable",
"urn:NETGEAR-ROUTER:service:LANConfigSecurity:1#SetConfigDHCPEnable");
map6.put("SetConfigPassword",
"urn:NETGEAR-ROUTER:service:LANConfigSecurity:1#SetConfigPassword");
map6.put("GetInfo",
"urn:NETGEAR-ROUTER:service:LANConfigSecurity:1#GetInfo");
map7.put("GetWLANInfo",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetWLANInfo");
map7.put("GetWEPSecurityKeys",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetWEPSecurityKeys");
map7.put("GetWPASecurityKeys",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetWPASecurityKeys");
map7.put("GetInfo",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetInfo");
map7.put("GetWPSMode",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetWPSMode");
map7.put("GetSSID",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetSSID");
map7.put("GetChannelInfo",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetChannelInfo");
map7.put("Get5GChannelInfo",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#Get5GChannelInfo");
map7.put("GetSSIDBroadcast",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetSSIDBroadcast");
map7.put("SetEnable",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetEnable");
map7.put("SetChannel",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetChannel");
map7.put("Set5GChannel",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#Set5GChannel");
map7.put("SetSSID",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetSSID");
map7.put("SetSSIDBroadcast",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetSSIDBroadcast");
map7.put("SetWLANWPAPSKByPassphrase",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetWLANWPAPSKByPassphrase");
map7.put("SetWLANNoSecurity",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetWLANNoSecurity");
map7.put("SetWLANWEPByKeys",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetWLANWEPByKeys");
map7.put("SetWLANWEPByPassphrase",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetWLANWEPByPassphrase");
map7.put("SetWPSMode",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetWPSMode");
map7.put("SetConfigPassword",
"urn:NETGEAR-ROUTER:service:WLANConfiguration:1#SetConfigPassword");
map8.put("Authenticate",
"urn:NETGEAR-ROUTER:service:ParentalControl:1#Authenticate");
map8.put("GetEnableStatus",
"urn:NETGEAR-ROUTER:service:ParentalControl:1#GetEnableStatus");
map8.put("DeleteMACAddress",
"urn:NETGEAR-ROUTER:service:ParentalControl:1#DeleteMACAddress");
map8.put("EnableParentalControl",
"urn:NETGEAR-ROUTER:service:ParentalControl:1#EnableParentalControl");
map8.put("GetAllMACAddresses",
"urn:NETGEAR-ROUTER:service:ParentalControl:1#GetAllMACAddresses");
}
public NetgearCall() {
// TODO Auto-generated constructor stub
}
@Override
public void doSave(IProgressMonitor monitor) {
// TODO Auto-generated method stub
}
@Override
public void doSaveAs() {
// TODO Auto-generated method stub
}
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
// TODO Auto-generated method stub
this.setInput(input);
this.setSite(site);
this.setPartName(input.getName());
}
@Override
public boolean isDirty() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isSaveAsAllowed() {
// TODO Auto-generated method stub
return false;
}
@Override
public void createPartControl(Composite parent) {
// TODO Auto-generated method stub
FillLayout fl_parent = new FillLayout();
fl_parent.type = SWT.VERTICAL;
parent.setLayout(fl_parent);
SashForm sashForm = new SashForm(parent, SWT.VERTICAL);
sashForm.setBackground(color);
lblLocal = new Label(sashForm, SWT.CENTER);
lblLocal.setFont(SWTResourceManager.getFont("宋体", 16, SWT.NORMAL));
lblLocal.setText("ExtenderAndGenieAPI(Local)");
lblLocal.setBackground(color);
Composite composite = new Composite(sashForm, SWT.NONE);
composite.setLayout(new FillLayout(SWT.HORIZONTAL));
SashForm sashForm_1=new SashForm(composite, SWT.NONE);
composite.setBackground(color);
Group grpMethodname = new Group(sashForm_1, SWT.NONE);
grpMethodname.setText("MethodName");
grpMethodname.setLayout(new FillLayout(SWT.HORIZONTAL));
grpMethodname.setBackground(color);
tree = new Tree(grpMethodname, SWT.BORDER);
if (list1.size() == 0) {
list1.add("GenieAPI(local)");
list1.add("NetgearExtender");
}
if (list2.size() == 0) {
list2.add("DeviceConfig");
list2.add("DeviceInfo");
list2.add("WANIPConnection");
list2.add("WAN3GInterfaceConfig");
list2.add("WANEthernetLinkConfig");
list2.add("LANConfigSecurity");
list2.add("WLANConfiguration");
list2.add("ParentalControl");
}
for(Iterator iter=list1.iterator(); iter.hasNext();){
String element = (String) iter.next();
treeitem=new TreeItem(tree, SWT.NONE);
treeitem.setData(element);
treeitem.setText(element);
if (treeitem.getText().equals("GenieAPI(local)")) {
for (Iterator it = list2.iterator(); it.hasNext();) {
String element1 = (String) it.next();
item1 = new TreeItem(treeitem, SWT.NONE);
item1.setData(element1);
item1.setText(element1);
if (item1.getText().equals("DeviceConfig")) {
Set set1 = map1.keySet();
for (Iterator it1 = set1.iterator(); it1.hasNext();) {
String ele1 = (String) it1.next();
treeitem1 = new TreeItem(item1, SWT.NONE);
treeitem1.setData(ele1);
treeitem1.setText(ele1);
}
} else if (item1.getText().equals("DeviceInfo")) {
Set set2 = map2.keySet();
for (Iterator it2 = set2.iterator(); it2.hasNext();) {
String ele2 = (String) it2.next();
treeitem2 = new TreeItem(item1, SWT.NONE);
treeitem2.setData(ele2);
treeitem2.setText(ele2);
}
} else if (item1.getText().equals("WANIPConnection")) {
Set set3 = map3.keySet();
for (Iterator it3 = set3.iterator(); it3.hasNext();) {
String ele3 = (String) it3.next();
treeitem3 = new TreeItem(item1, SWT.NONE);
treeitem3.setData(ele3);
treeitem3.setText(ele3);
}
} else if (item1.getText().equals("WAN3GInterfaceConfig")) {
Set set4 = map4.keySet();
for (Iterator it4 = set4.iterator(); it4.hasNext();) {
String element4 = (String) it4.next();
treeitem4 = new TreeItem(item1, SWT.NONE);
treeitem4.setData(element4);
treeitem4.setText(element4);
}
} else if (item1.getText().equals("WANEthernetLinkConfig")) {
Set set5 = map5.keySet();
for (Iterator it5 = set5.iterator(); it5.hasNext();) {
String element5 = (String) it5.next();
treeitem5 = new TreeItem(item1, SWT.NONE);
treeitem5.setData(element5);
treeitem5.setText(element5);
}
} else if (item1.getText().equals("LANConfigSecurity")) {
Set set6 = map6.keySet();
for (Iterator it6 = set6.iterator(); it6.hasNext();) {
String element6 = (String) it6.next();
treeitem6 = new TreeItem(item1, SWT.NONE);
treeitem6.setData(element6);
treeitem6.setText(element6);
}
} else if (item1.getText().equals("WLANConfiguration")) {
Set set7 = map7.keySet();
for (Iterator it7 = set7.iterator(); it7.hasNext();) {
String element7 = (String) it7.next();
treeitem7 = new TreeItem(item1, SWT.NONE);
treeitem7.setData(element7);
treeitem7.setText(element7);
}
} else if (item1.getText().equals("ParentalControl")) {
Set set8 = map8.keySet();
for (Iterator it8 = set8.iterator(); it8.hasNext();) {
String element8 = (String) it8.next();
treeitem8 = new TreeItem(item1, SWT.NONE);
treeitem8.setData(element8);
treeitem8.setText(element8);
}
}
}
} else if(treeitem.getText().equals("NetgearExtender")){
Set set=map.keySet();
for (Iterator it = set.iterator(); it.hasNext();) {
String element1 = (String) it.next();
item1 = new TreeItem(treeitem, SWT.NONE);
item1.setData(element1);
item1.setText(element1);
}
}
}
tree.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
s=(String) e.item.getData();
TreeItem lastitem = (TreeItem) e.item;
// System.out.println(s);
if(s.equals("GenieAPI(local)")||s.equals("NetgearExtender")
||s.equals("DeviceConfig")||s.equals("DeviceInfo")
||s.equals("WANIPConnection")||s.equals("WAN3GInterfaceConfig")
||s.equals("WANEthernetLinkConfig")||s.equals("LANConfigSecurity")
||s.equals("WLANConfiguration")||s.equals("ParentalControl")){
text.setText("");//MethodName
combo.setText("");//ModleName
text_5.setText("");//input params
text_1.setText("");//Arguments
text_2.setText("");//Result
}else if(s.equals("Authenticate")&&lastitem.getParentItem().getText().equals("NetgearExtender")){
text.setText(s);//MethodName
combo.setText("DeviceConfig");//ModleName
text_5.setText("NewUsername,admin;NewPassword,password");//input params
text_1.setText(map.get(s).toString());//Arguments
text_2.setText("");//Result
}else if(s.equals("GetAPInfo")&&lastitem.getParentItem().getText().equals("NetgearExtender")){
text.setText(s);//MethodName
combo.setText("WLANConfiguration");//ModleName
text_5.setText("NewRadio,2.4G");//input params
text_1.setText(map.get(s).toString());//Arguments
text_2.setText("");//Result
}else if(s.equals("SetExtenderMode")&&lastitem.getParentItem().getText().equals("NetgearExtender")){
text.setText(s);//MethodName
combo.setText("WLANConfiguration");//ModleName
text_5.setText("NewExtenderMode,Internet Surfing;New2GRadioMode,Extender;New5GRadioMode, ;NewBondEthernet, ");//input params
text_1.setText(map.get(s).toString());//Arguments
text_2.setText("");//Result
}else if(s.equals("ConfigurationStarted")&&lastitem.getParentItem().getText().equals("NetgearExtender")){
text.setText(s);//MethodName
combo.setText("DeviceConfig");//ModleName
text_5.setText("");//input params
text_1.setText(map.get(s).toString());//Arguments
text_2.setText("");//Result
}else if(s.equals("SetRouterWLANWPAPSKByPassphrase")&&lastitem.getParentItem().getText().equals("NetgearExtender")){
text.setText(s);//MethodName
combo.setText("WLANConfiguration");//ModleName
text_5.setText("NewRadio,2.4G;NewSSID,WNDR4500;NewChannel,Auto;NewWirelessMode,Auto;NewWPAEncryptionModes,WPA2-PSK-AES;NewWPAPassphrase,siteview;NewVerify,0");//input params
text_1.setText(map.get(s).toString());//Arguments
text_2.setText("");//Result
}else if(s.equals("SetWLANWPAPSKByPassphrase")&&lastitem.getParentItem().getText().equals("NetgearExtender")){
text.setText(s);//MethodName
combo.setText("WLANConfiguration");//ModleName
text_5.setText("NewRadio,2.4G;NewSSID,WNDR4500_EXT;NewChannel,Auto;NewWirelessMode,Auto;NewWPAEncryptionModes,WPA2-PSK-AES;NewWPAPassphrase,siteview");//input params
text_1.setText(map.get(s).toString());//Arguments
text_2.setText("");//Result
}else if(s.equals("ConfigurationFinished")&&lastitem.getParentItem().getText().equals("NetgearExtender")){
text.setText(s);//MethodName
combo.setText("DeviceConfig");//ModleName
text_5.setText("NewConfigStatus,1");//input params
text_1.setText(map.get(s).toString());//Arguments
text_2.setText("");//Result
}else if(s.equals("SetEnable")&&lastitem.getParentItem().getText().equals("NetgearExtender")){
text.setText(s);//MethodName
combo.setText("DeviceConfig");//ModleName
text_5.setText("NewEnable,0");//input params
text_1.setText(map.get(s).toString());//Arguments
text_2.setText("");//Result
}else if(s.equals("GetRouterWLANWPAInfo")&&lastitem.getParentItem().getText().equals("NetgearExtender")){
text.setText(s);//MethodName
combo.setText("WLANConfiguration");//ModleName
text_5.setText("NewRadio,2.4G");//input params
text_1.setText(map.get(s).toString());//Arguments
text_2.setText("");//Result
}else{
text.setText(s);//MethodName
combo.setText(lastitem.getParentItem().getText());//ModleName
text_5.setText("");//input params
text_1.setText("urn:NETGEAR-ROUTER:service:"+combo.getText()+":1#"+text.getText());//Arguments
text_2.setText("");//Result
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
}
});
sashForm_1.setBackground(color);
grpCall = new Group(sashForm_1, SWT.NONE);
grpCall.setText("Call");
grpCall.setBackground(color);
Label urllabel = new Label(grpCall, SWT.NONE);//SOAPUrl
urllabel.setBounds(10, 32, 79, 12);
urllabel.setText("Host");
urllabel.setBackground(color);
text_3 = new Text(grpCall, SWT.BORDER);
text_3.setText("http://");
text_3.setBounds(95, 26, 291, 18);
text_3.setBackground(color);
Label lblMethodname = new Label(grpCall, SWT.NONE);//MethodName
lblMethodname.setBounds(10, 68, 79, 12);
lblMethodname.setText("MethodName");
lblMethodname.setBackground(color);
text = new Text(grpCall, SWT.BORDER);
text.setBounds(95, 62, 291, 18);
text.setBackground(color);
Label lblModelname = new Label(grpCall, SWT.NONE);//ModleName
lblModelname.setBounds(10, 104, 79, 12);
lblModelname.setText("ModleName");
lblModelname.setBackground(color);
combo = new Combo(grpCall, SWT.NONE);
combo.setBounds(95, 98, 150, 18);
combo.add("other");
combo.add("DeviceConfig");
combo.add("DeviceInfo");
combo.add("LANConfigSecurity");
combo.add("ParentalControl");
combo.add("Time");
combo.add("WANEthernetLinkConfig");
combo.add("WANIPConnection");
combo.add("WLANConfiguration");
combo.add("WAN3GInterfaceConfig");
text_6 = new Text(grpCall, SWT.BORDER);
text_6.setBounds(250, 98, 136, 19);
text_6.setBackground(color);
combo.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
// TODO Auto-generated method stub
if( combo.getText().equals("DeviceConfig")||combo.getText().equals("DeviceInfo")
||combo.getText().equals("LANConfigSecurity")||combo.getText().equals("ParentalControl")
||combo.getText().equals("Time")||combo.getText().equals("WANEthernetLinkConfig")
||combo.getText().equals("WANIPConnection")||combo.getText().equals("WLANConfiguration")
||combo.getText().equals("WAN3GInterfaceConfig")){
text_1.setText("");
text_1.setText("urn:NETGEAR-ROUTER:service:"+combo.getText()+":1#"+text.getText());
}else if(combo.getText().equals("other")){
text_1.setText("");
text_1.setText("urn:NETGEAR-ROUTER:service:"+text_6.getText()+":1#"+text.getText());
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
}
});
Label inputlabel = new Label(grpCall, SWT.NONE);//input params
inputlabel.setBounds(10, 140, 79, 12);
inputlabel.setText("input params");
inputlabel.setBackground(color);
text_5 = new Text(grpCall, SWT.BORDER | SWT.WRAP|SWT.V_SCROLL);
text_5.setBounds(95, 134, 291, 58);
text_5.setBackground(color);
Label tishilabel1 = new Label(grpCall, SWT.NONE);
tishilabel1.setBounds(95, 200, 250, 12);
tishilabel1.setText("(例:参数名1,参数值1;参数名2,参数值2)");
tishilabel1.setBackground(color);
Label tishilabel2 = new Label(grpCall, SWT.NONE);
tishilabel2.setBounds(95, 218, 250, 12);
tishilabel2.setText("(若参数值为空请用空格代替)");
tishilabel2.setBackground(color);
Label lblArguments = new Label(grpCall, SWT.NONE);
lblArguments.setBounds(10, 300, 79, 12);
lblArguments.setText("Arguments");
lblArguments.setBackground(color);
text_1 = new Text(grpCall, SWT.BORDER | SWT.WRAP);//Arguments
text_1.setBounds(95, 245, 306, 223);
text_1.setBackground(color);
Label lblResult = new Label(grpCall, SWT.NONE);//Result
lblResult.setText("Result");
lblResult.setBounds(421, 157, 54, 12);
lblResult.setBackground(color);
text_2 = new Text(grpCall, SWT.BORDER | SWT.WRAP|SWT.V_SCROLL);
text_2.setBounds(487, 42, 350, 349);
text_2.setEditable(false);
text_2.setBackground(color);
Button button = new Button(grpCall, SWT.NONE);
button.addSelectionListener(new SelectionAdapter() {//调用按钮的事件
public void widgetSelected(SelectionEvent e) {
// StringBuffer xml=new StringBuffer();
// System.out.println("Arguments:"+text_1.getText());
// System.out.println("APIName:"+text.getText());
// System.out.println("SoapUrl:"+text_3.getText());
// String params=text_5.getText();
// System.out.println("input params:"+params);
// if(!(params.equals(""))){
// String [] keyvalue = params.split(";");
// xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
// xml.append("<SOAP-ENV:Envelope \r\n");
// xml.append("xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\r\n");
// xml.append("xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" \r\n");
// xml.append("xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\">\r\n");
// xml.append("<SOAP-ENV:Body>\r\n");
// xml.append("<"+text.getText()+">\r\n");
// for (int i = 0; i < keyvalue.length; i++) {
// String [] zoo = keyvalue[i].split(",");
// key=zoo[0];
// value=zoo[1];
// if(value.equals(" ")){
// value="";
// }
// System.out.println("key:"+key);
// System.out.println("value:"+value);
// xml.append("<"+key+" xsi:type=\"xsd:string\" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\">"+value+"</"+key+">\r\n");
// }
// xml.append("</"+text.getText()+">\r\n");
// xml.append("</SOAP-ENV:Body>\r\n");
// xml.append("</SOAP-ENV:Envelope>\r\n");
// String body=xml.toString();
// System.out.println("body:"+body);
// }else{
// xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
// xml.append("<SOAP-ENV:Envelope \r\n");
// xml.append("xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\r\n");
// xml.append("xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" \r\n");
// xml.append("xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\">\r\n");
// xml.append("<SOAP-ENV:Body>\r\n");
// xml.append("<"+text.getText()+">\r\n");
// xml.append("</"+text.getText()+">\r\n");
// xml.append("</SOAP-ENV:Body>\r\n");
// xml.append("</SOAP-ENV:Envelope>\r\n");
// String body=xml.toString();
// System.out.println("body:"+body);
//
// }
text_2.setText(SOAPClient4XG.localflowConnection(text_3.getText(),text.getText(),text_1.getText(),text_5.getText()));//result
}
});
button.setBounds(95, 495, 72, 22);
button.setText("submit");
Label explain = new Label(grpCall, SWT.NONE);//Instructions for use
explain.setBounds(10, 640, 120, 12);
explain.setText("Instructions for use");
explain.setBackground(color);
text_7 = new Text(grpCall, SWT.BORDER | SWT.WRAP);//Arguments
text_7.setEditable(false);
text_7.setBounds(135, 585, 406, 123);
text_7.setBackground(color);
text_7.setText("如果您需要自己添加SOAP API,可以在MethodName中填写API,ModleName中选择API相应的类型 ,input params中填写参数名和参数值.\n\r\n"+
"需要特别提醒您的是,如果ModleName中没有您所需要的API类型,您务必先在右侧的方框中填写你自己所需的类型,然后再将ModleName的值设为other");
sashForm_1.setWeights(new int[] {116, 475});
sashForm.setWeights(new int[] {1,20});
}
@Override
public void setFocus() {
// TODO Auto-generated method stub
}
}
| [
"fang.yu@dragonflow.com"
] | fang.yu@dragonflow.com |
85441d361c67df791d9e1415a8557ee757b851cc | 84f65cc9adf5989262bd8e77fb8499ea837e660e | /Project1/src/QLSoThu/Animal.java | 513171e2c152e821bd4fc07dfa324eb2eadf7403 | [] | no_license | huyhue/core-java | e611c2da1e015b2684c027a8bb8b77e8483478f7 | f2d2eac37e82a124443eab4204cdb60ec4025812 | refs/heads/master | 2022-11-30T05:52:36.023548 | 2020-07-30T07:32:34 | 2020-07-30T07:32:34 | 259,975,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 897 | java | package QLSoThu;
public abstract class Animal {
String ten;
int tuoi;
String moTa;
void xemThongTin(){
System.out.println("Ten: "+ten);
System.out.println("Tuoi: "+tuoi);
System.out.println("Mo Ta: "+moTa);
}
abstract void tiengKeu();
public Animal() {
}
public Animal(String ten) {
super();
this.ten = ten;
}
public Animal(String ten, int tuoi) {
super();
this.ten = ten;
this.tuoi = tuoi;
}
public Animal(String ten, int tuoi, String moTa) {
super();
this.ten = ten;
this.tuoi = tuoi;
this.moTa = moTa;
}
void Add() {
}
void Add(String ten) {
this.ten= ten;
}
void Add(String ten, int tuoi) {
this.ten= ten;
this.tuoi = tuoi;
}
void Add(String ten, int tuoi, String moTa) {
this.ten= ten;
this.tuoi = tuoi;
this.moTa = moTa;
}
}
| [
"tpgiahuy5@gmail.com"
] | tpgiahuy5@gmail.com |
bda378b62bc98645fd33357d2f193445427c257b | b512720872e7ae83c98ce9577012630b29b85b09 | /src/main/java/euphonia/core/transfer/TransferFactory.java | 4e18a13b60589d7754be40d560ae17d60cde6c75 | [] | no_license | rodrigomanhaes/euphonia | e777c908ca5c0092186d98c90f649abff10fd5d2 | a5f90199e817e756cdaba30089d77ca6f4ed34da | refs/heads/master | 2022-07-07T18:24:55.312282 | 2010-09-22T23:00:20 | 2010-09-22T23:00:20 | 171,296 | 1 | 0 | null | 2022-06-29T19:30:47 | 2009-04-08T19:18:43 | Java | UTF-8 | Java | false | false | 311 | java | package euphonia.core.transfer;
public class TransferFactory
{
public static TransferStrategy concat()
{
return new Concat();
}
public static TransferStrategy concat(String fill)
{
return new Concat(fill);
}
public static TransferStrategy split(String regex)
{
return new Split(regex);
}
} | [
"rmanhaes@gmail.com"
] | rmanhaes@gmail.com |
100726f29c58d218b65ff5224555dea9722ae39b | dd8be51f8ae61ebc56f91011fb51e587b484d642 | /common/src/main/java/com/ldy/common/constant/Constant.java | 43eaa615a79ed51dd23d9eba1d8caebc126a9cbf | [] | no_license | EndSmile/EoaSplit | 299e0bbcb8e5c9f47ace310243bbac6a65c5524f | 93db0a83b388dd686925084c1832349075db7506 | refs/heads/master | 2020-04-05T13:04:47.167204 | 2017-06-30T02:15:57 | 2017-06-30T02:15:57 | 95,058,773 | 10 | 1 | null | null | null | null | UTF-8 | Java | false | false | 101 | java | package com.ldy.common.constant;
/**
* Created by ldy on 2017/6/21.
*/
public class Constant {
}
| [
"745472638@qq.com"
] | 745472638@qq.com |
1ce857064dae78b22fd7af8060e932bb1f120ae3 | 9c11df852208ef601a9e50beb592402fd7ecbf36 | /tm/src/main/java/com/alibaba/fescar/tm/api/TransactionalExecutor.java | a5526f44ad3e85ab3cfdd0249493650c358ff21f | [
"Apache-2.0"
] | permissive | sherlock-hao/fescar | fdf158bd2b1985cfe9489fb97d2a509d4e5a85df | a3fd69805b1257bf8c5fd27f7157d15a1c332495 | refs/heads/develop | 2020-04-23T19:43:22.950008 | 2019-02-21T09:49:11 | 2019-02-21T09:49:11 | 167,112,968 | 0 | 0 | Apache-2.0 | 2019-01-23T03:47:40 | 2019-01-23T03:47:39 | null | UTF-8 | Java | false | false | 5,705 | java | /*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* 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.alibaba.fescar.tm.api;
/**
* Callback for executing business logic in a global transaction.
*/
public interface TransactionalExecutor {
/**
* Execute the business logic here.
*
* @return What the business logic returns.
* @throws Throwable Any throwable during executing.
*/
Object execute() throws Throwable;
/**
* Global transaction timeout in MILLISECONDS.
*
* @return timeout in MILLISECONDS.
*/
int timeout();
/**
* Given name of the global transaction instance.
*
* @return Given name.
*/
String name();
/**
* The enum Code.
*/
enum Code {
/**
* Begin failure code.
*/
//
BeginFailure,
/**
* Commit failure code.
*/
//
CommitFailure,
/**
* Rollback failure code.
*/
//
RollbackFailure,
/**
* Rollback done code.
*/
//
RollbackDone,
/**
* Rollback ignore code.
*/
//
RollbackIgnore
}
/**
* The type Execution Ignore exception.
* if thrown ,fescar framework will ignore the business error and will not cause roll back
*/
class ExecutionIgnoreException extends ExecutionException {
public ExecutionIgnoreException(Throwable cause) {
super(null,cause,Code.RollbackIgnore);
}
}
/**
* The type Execution exception.
*/
class ExecutionException extends Exception {
private GlobalTransaction transaction;
private Code code;
private Throwable originalException;
/**
* Instantiates a new Execution exception.
*
* @param transaction the transaction
* @param cause the cause
* @param code the code
*/
public ExecutionException(GlobalTransaction transaction, Throwable cause, Code code) {
this(transaction, cause, code, null);
}
/**
* Instantiates a new Execution exception.
*
* @param transaction the transaction
* @param code the code
* @param originalException the original exception
*/
public ExecutionException(GlobalTransaction transaction, Code code, Throwable originalException) {
this(transaction, null, code, originalException);
}
/**
* Instantiates a new Execution exception.
*
* @param transaction the transaction
* @param cause the cause
* @param code the code
* @param originalException the original exception
*/
public ExecutionException(GlobalTransaction transaction, Throwable cause, Code code, Throwable originalException) {
this(transaction, null, cause, code, originalException);
}
/**
* Instantiates a new Execution exception.
*
* @param transaction the transaction
* @param message the message
* @param cause the cause
* @param code the code
* @param originalException the original exception
*/
public ExecutionException(GlobalTransaction transaction, String message, Throwable cause, Code code, Throwable originalException) {
super(message, cause);
this.transaction = transaction;
this.code = code;
this.originalException = originalException;
}
/**
* Gets transaction.
*
* @return the transaction
*/
public GlobalTransaction getTransaction() {
return transaction;
}
/**
* Sets transaction.
*
* @param transaction the transaction
*/
public void setTransaction(GlobalTransaction transaction) {
this.transaction = transaction;
}
/**
* Gets code.
*
* @return the code
*/
public Code getCode() {
return code;
}
/**
* Sets code.
*
* @param code the code
*/
public void setCode(Code code) {
this.code = code;
}
/**
* Gets original exception.
*
* @return the original exception
*/
public Throwable getOriginalException() {
return originalException;
}
/**
* Sets original exception.
*
* @param originalException the original exception
*/
public void setOriginalException(Throwable originalException) {
this.originalException = originalException;
}
}
}
| [
"153004802@qq.com"
] | 153004802@qq.com |
aa658ee6a906645ed5c342bf557b5989c934abfb | ad0c92f8c30f27fd1b9163e3e71bdedd9c31a1be | /src/main/java/com/uncub/blog/dao/CustomUserMapper.java | ad1516c13d3a49fba1a6123291df987680ffa31e | [] | no_license | tuwh/blog | 8faf2742c2b5f7be4aa64133b795a3f37c26960d | 3c65626b001a59679248f01a3149f522f0fce04a | refs/heads/master | 2021-04-15T17:58:15.694201 | 2018-08-12T05:07:56 | 2018-08-12T05:07:56 | 126,583,273 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package com.uncub.blog.dao;
import com.uncub.blog.dto.ResourcePermission;
import com.uncub.blog.dto.base.Role;
import com.uncub.blog.dto.base.User;
import org.mybatis.spring.annotation.MapperScan;
import java.util.List;
@MapperScan
public interface CustomUserMapper {
List<Role> queryRoleByUserId(Integer id);
List<ResourcePermission> queryPermissionByUserId(Integer id);
}
| [
"461175170@qq.com"
] | 461175170@qq.com |
43bacfd402890c37c9e32e5b4ace24df12023a0e | 14970ee11e71b839ba2c86e1ce65e344de28325c | /plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELReader.java | 35eda4c2f1c1e7074c90b36333b82084386b66d7 | [
"EPL-1.0",
"Apache-2.0"
] | permissive | wso2/devstudio-tooling-bps | e300529639e22fd430612601d7d76b9a9bd56dd0 | 5a5d080d94bb30ac6a5fb404c2a6b989653cc78d | refs/heads/master | 2023-06-28T18:29:45.578389 | 2021-01-04T06:46:48 | 2021-01-04T06:46:48 | 53,044,989 | 34 | 19 | Apache-2.0 | 2021-01-04T06:46:49 | 2016-03-03T11:23:24 | Java | UTF-8 | Java | false | false | 129,785 | java | /*******************************************************************************
* Copyright (c) 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.bpel.model.resource;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import javax.wsdl.WSDLException;
import javax.wsdl.extensions.ExtensibilityElement;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import org.apache.xerces.parsers.DOMParser;
import org.eclipse.bpel.model.Activity;
import org.eclipse.bpel.model.Assign;
import org.eclipse.bpel.model.AssignE4X;
import org.eclipse.bpel.model.BPELFactory;
import org.eclipse.bpel.model.BPELPackage;
import org.eclipse.bpel.model.BPELPlugin;
import org.eclipse.bpel.model.Branches;
import org.eclipse.bpel.model.Catch;
import org.eclipse.bpel.model.CatchAll;
import org.eclipse.bpel.model.Compensate;
import org.eclipse.bpel.model.CompensateScope;
import org.eclipse.bpel.model.CompensationHandler;
import org.eclipse.bpel.model.CompletionCondition;
import org.eclipse.bpel.model.Condition;
import org.eclipse.bpel.model.Copy;
import org.eclipse.bpel.model.Correlation;
import org.eclipse.bpel.model.CorrelationPattern;
import org.eclipse.bpel.model.CorrelationSet;
import org.eclipse.bpel.model.CorrelationSets;
import org.eclipse.bpel.model.Correlations;
import org.eclipse.bpel.model.Documentation;
import org.eclipse.bpel.model.Else;
import org.eclipse.bpel.model.ElseIf;
import org.eclipse.bpel.model.Empty;
import org.eclipse.bpel.model.EndpointReferenceRole;
import org.eclipse.bpel.model.EventHandler;
import org.eclipse.bpel.model.Exit;
import org.eclipse.bpel.model.Expression;
import org.eclipse.bpel.model.BPELExtensibleElement;
import org.eclipse.bpel.model.Extension;
import org.eclipse.bpel.model.ExtensionAssignOperation;
import org.eclipse.bpel.model.Extensions;
import org.eclipse.bpel.model.FailureHandling;
import org.eclipse.bpel.model.FaultHandler;
import org.eclipse.bpel.model.FaultOnFailure;
import org.eclipse.bpel.model.Flow;
import org.eclipse.bpel.model.ForEach;
import org.eclipse.bpel.model.From;
import org.eclipse.bpel.model.FromPart;
import org.eclipse.bpel.model.FromParts;
import org.eclipse.bpel.model.If;
import org.eclipse.bpel.model.Import;
import org.eclipse.bpel.model.Invoke;
import org.eclipse.bpel.model.Link;
import org.eclipse.bpel.model.Links;
import org.eclipse.bpel.model.MessageExchange;
import org.eclipse.bpel.model.MessageExchanges;
import org.eclipse.bpel.model.OnAlarm;
import org.eclipse.bpel.model.OnEvent;
import org.eclipse.bpel.model.OnMessage;
import org.eclipse.bpel.model.OpaqueActivity;
import org.eclipse.bpel.model.PartnerActivity;
import org.eclipse.bpel.model.PartnerLink;
import org.eclipse.bpel.model.PartnerLinks;
import org.eclipse.bpel.model.Pick;
import org.eclipse.bpel.model.Process;
import org.eclipse.bpel.model.Query;
import org.eclipse.bpel.model.Receive;
import org.eclipse.bpel.model.RepeatUntil;
import org.eclipse.bpel.model.Reply;
import org.eclipse.bpel.model.Rethrow;
import org.eclipse.bpel.model.RetryDelay;
import org.eclipse.bpel.model.RetryFor;
import org.eclipse.bpel.model.Scope;
import org.eclipse.bpel.model.Sequence;
import org.eclipse.bpel.model.ServiceRef;
import org.eclipse.bpel.model.Snippet;
import org.eclipse.bpel.model.Source;
import org.eclipse.bpel.model.Sources;
import org.eclipse.bpel.model.Target;
import org.eclipse.bpel.model.Targets;
import org.eclipse.bpel.model.TerminationHandler;
import org.eclipse.bpel.model.Throw;
import org.eclipse.bpel.model.To;
import org.eclipse.bpel.model.ToPart;
import org.eclipse.bpel.model.ToParts;
import org.eclipse.bpel.model.Validate;
import org.eclipse.bpel.model.Variable;
import org.eclipse.bpel.model.Variables;
import org.eclipse.bpel.model.Wait;
import org.eclipse.bpel.model.While;
import org.eclipse.bpel.model.extensions.BPELActivityDeserializer;
import org.eclipse.bpel.model.extensions.BPELExtensionDeserializer;
import org.eclipse.bpel.model.extensions.BPELExtensionRegistry;
import org.eclipse.bpel.model.extensions.BPELUnknownExtensionDeserializer;
import org.eclipse.bpel.model.extensions.ServiceReferenceDeserializer;
import org.eclipse.bpel.model.impl.FromImpl;
import org.eclipse.bpel.model.impl.FromPartImpl;
import org.eclipse.bpel.model.impl.OnEventImpl;
import org.eclipse.bpel.model.impl.OnMessageImpl;
import org.eclipse.bpel.model.impl.PartnerActivityImpl;
import org.eclipse.bpel.model.impl.ToImpl;
import org.eclipse.bpel.model.impl.ToPartImpl;
import org.eclipse.bpel.model.messageproperties.Property;
import org.eclipse.bpel.model.messageproperties.util.MessagepropertiesConstants;
import org.eclipse.bpel.model.proxy.CorrelationSetProxy;
import org.eclipse.bpel.model.proxy.LinkProxy;
import org.eclipse.bpel.model.proxy.MessageExchangeProxy;
import org.eclipse.bpel.model.proxy.MessageProxy;
import org.eclipse.bpel.model.proxy.PartnerLinkProxy;
import org.eclipse.bpel.model.proxy.PartnerLinkTypeProxy;
import org.eclipse.bpel.model.proxy.PropertyProxy;
import org.eclipse.bpel.model.proxy.RoleProxy;
import org.eclipse.bpel.model.proxy.VariableProxy;
import org.eclipse.bpel.model.proxy.XSDElementDeclarationProxy;
import org.eclipse.bpel.model.proxy.XSDTypeDefinitionProxy;
import org.eclipse.bpel.model.util.BPELConstants;
import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.wst.wsdl.Message;
import org.eclipse.wst.wsdl.PortType;
import org.eclipse.xsd.XSDElementDeclaration;
import org.eclipse.xsd.XSDTypeDefinition;
import org.eclipse.xsd.util.XSDConstants;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.SAXParseException;
/**
* BPELReader is invoked from BPELResourceImpl to parse the BPEL file and
* create a Process object.
*/
@SuppressWarnings("nls")
public class BPELReader implements ErrorHandler {
// The process we are reading
private Process process = null;
// Bugzilla 324165
// The resource we are reading from
private Resource fCurrentResource = null;
// The successfully loaded resource
private Resource fResource = null;
// The document builder controls various DOM characteristics
private DocumentBuilder docBuilder = null;
// Registry for extensibility element serializers and deserializers
private BPELExtensionRegistry extensionRegistry = BPELExtensionRegistry.getInstance();
private DOMParser fDOMParser;
/** The XML Error handler */
ErrorHandler fErrorHandler = null;
/** The WS-BPEL Specification says how to resolve variables, taking into
* account scopes, etc. Technically, no one should override this behavior,
* but replacing this field with another implementation could allow
* you to optimize the search or provide different behavior.
*/
public static VariableResolver VARIABLE_RESOLVER = new BPELVariableResolver();
/**
* The WS-BPEL Specification says how to resolve links, taking into
* account scopes, etc. Technically, no one should override this behavior,
* but replacing this field with another implementation could allow
* you to optimize the search or provide different behavior.
*/
public static LinkResolver LINK_RESOLVER = new BPELLinkResolver();
List<Runnable> fPass2Runnables = new ArrayList<Runnable>();
/**
* Construct a new BPELReader using the given DocumentBuilder to determine
* how the DOM tree is constructed.
*
* @param builder the document builder to use when parsing the file
* @throws IOException if no document builder is specified
*/
public BPELReader (DocumentBuilder builder) throws IOException {
if (builder == null) {
throw new IOException(BPELPlugin.INSTANCE.getString("%BPELReader.missing_doc_builder"));
}
this.docBuilder = builder;
}
/**
* @param parser
*/
public BPELReader (DOMParser parser ) {
this.fDOMParser = parser;
}
/**
* Read from the given Document into the given resource.
*
* @param resource the EMF resource to construct
* @param Document the document to read the BPEL from
*/
public void read(BPELResource resource, Document doc) {
this.fResource = resource;
// Pass 1 and 2 are inside the try so they don't occur if
// an error happens during parsing.
// In pass 1 we parse and create the structural elements and attributes.
pass1(doc);
// In pass 2, we run any postLoadRunnables which need to happen after
// pass 1 (for example, establishing object links to variables).
pass2();
}
/**
*
*/
public BPELReader () {
this.fDOMParser = new LineCapturingDOMParser();
// domParser.setProperty("http://xml.org/sax/features/namespaces",true);
try {
fDOMParser.setFeature( "http://apache.org/xml/features/dom/defer-node-expansion", false );
fDOMParser.setFeature( "http://apache.org/xml/features/xinclude", false);
} catch (SAXNotRecognizedException e) {
BPELPlugin.log("Not Recognized DOM Parser Feature",e );
} catch (SAXNotSupportedException e) {
BPELPlugin.log("Not Supported DOM Parser Feature",e );
}
}
/**
* Set the error handler
* @param errorHandler
*/
public void setErrorHandler ( ErrorHandler errorHandler ) {
fErrorHandler = errorHandler;
}
void armErrorHandler ( ) {
assert (docBuilder != null || fDOMParser != null);
if (docBuilder != null) {
docBuilder.setErrorHandler(fErrorHandler != null ? fErrorHandler : this);
} else {
fDOMParser.setErrorHandler(fErrorHandler != null ? fErrorHandler : this);
}
}
Document read ( InputSource inputSource ) throws IOException, SAXException {
assert (docBuilder != null || fDOMParser != null) : "No document builder/parser set";
if (docBuilder != null) {
return docBuilder.parse(inputSource);
}
fDOMParser.parse(inputSource);
return fDOMParser.getDocument();
}
/**
* Read from the given input stream into the given resource.
*
* @param resource the EMF resource to construct
* @param inputStream the input stream to read the BPEL from
*/
public void read (BPELResource resource, InputStream inputStream) {
armErrorHandler ();
Document doc = null;
try {
InputSource inputSource = new InputSource(inputStream);
inputSource.setPublicId( resource.getURI().toString() );
inputSource.setSystemId( resource.getURI().toString() );
resource.setErrorHandler(fErrorHandler != null ? fErrorHandler : this);
// Bugzilla 324165
// set the resource currently being loaded so the error handler can
// attach diagnostics to it
fCurrentResource = resource;
doc = read ( inputSource );
// After the document has successfully parsed, it's okay
// to assign the resource.
fResource = resource;
} catch (SAXException sax) {
// the error handlers will catch this.
} catch (IOException ioe) {
BPELPlugin.log("I/O Error Reading BPEL XML", ioe ) ;
} finally {
}
// Bugzilla 324165
if (doc != null) {
pass1(doc);
pass2();
}
fCurrentResource = null;
}
/**
* Return the resource that was used to read in this BPEL process.
*
* @return the resource that was used to read in this BPEL process.
*/
public Resource getResource () {
return fResource;
}
/**
* @param xmlSource the XML source
* @param sourceDescription some textual description of the source (for example Clipboard).
* @return a list of objects
*/
public List<EObject> fromXML ( String xmlSource , String sourceDescription , Resource resource ) {
armErrorHandler ();
if (sourceDescription == null) {
sourceDescription = "String";
}
Document doc = null;
try {
InputSource inputSource = new InputSource(new StringReader ( xmlSource ));
inputSource.setPublicId( sourceDescription );
// Bugzilla 324165
// set the resource currently being loaded so the error handler can
// attach diagnostics to it
fCurrentResource = resource;
doc = read (inputSource);
} catch (SAXException sax) {
// done by the handler.
} catch (IOException ioe) {
BPELPlugin.log("I/O Error Reading BPEL XML", ioe ) ;
} finally {
}
if (doc == null) {
fCurrentResource = null;
return Collections.emptyList();
}
fResource = resource;
// Pass 1 and 2 are inside the try so they don't occur if
// an error happens during parsing.
// In pass 1 we parse and create the structural elements and attributes.
List<EObject> result = parseDocument(doc);
// In pass 2, we run any postLoadRunnables which need to happen after
// pass 1 (for example, establishing object links to variables).
pass2();
fCurrentResource = null;
return result;
}
/**
* In pass 1, we parse and create the structural elements and attributes,
* and add the process to the EMF resource's contents
* @param document the DOM document to parse
*/
protected void pass1 (Document document) {
Process p = xml2Resource(document);
if (p != null) {
fResource.getContents().add(p);
}
}
/**
* In pass 2, we run any post load runnables which were queued during pass 1.
*/
protected void pass2() {
try {
for(Runnable r : fPass2Runnables) {
r.run();
}
} finally {
fPass2Runnables.clear();
}
}
/**
* Returns a list of child nodes of <code>parentElement</code> that are
* {@link Element}s.
* Returns an empty list if no elements are found.
*
* @param parentElement the element to find the children of
* @return a node list of the children of parentElement
*/
protected List<Element> getChildElements(Element parentElement) {
List<Element> list = new ArrayList<Element>();
NodeList children = parentElement.getChildNodes();
for (int i=0; i < children.getLength(); i++) {
if (children.item(i).getNodeType() == Node.ELEMENT_NODE)
list.add( (Element) children.item(i));
}
return list;
}
/**
* Returns a list of child nodes of <code>parentElement</code> that are
* {@link Element}s with a BPEL namespace that have the given <code>localName</code>.
* Returns an empty list if no matching elements are found.
*
* @param parentElement the element to find the children of
* @param localName the localName to match against
* @return a node list of the matching children of parentElement
*/
public List<Element> getBPELChildElementsByLocalName(Element parentElement, String localName) {
List<Element> list = new ArrayList<Element>();
NodeList children = parentElement.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if (localName.equals(node.getLocalName()) && BPELUtils.isBPELElement(node)) {
list.add((Element) node);
}
}
return list;
}
/**
* Returns the first child node of <code>parentElement</code> that is an {@link Element}
* with a BPEL namespace and the given <code>localName</code>, or <code>null</code>
* if a matching element is not found.
*
* @param parentElement the element to find the children of
* @param localName the localName to match against
* @return the first matching element, or null if no element was found
*/
public Element getBPELChildElementByLocalName(Element parentElement, String localName) {
NodeList children = parentElement.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if (localName.equals(node.getLocalName()) && BPELUtils.isBPELElement(node)) {
return (Element) node;
}
}
return null;
}
/**
* Walk from the given element up through its parents, looking for any
* xmlns definitions. Collect them all in a map (mapping the prefix to
* the namespace value) and return the map.
*
* @param element the element to get the xmlns definitions for
* @return a map of visible xmlns definitions
*/
protected Map<String,String> getAllNamespacesForElement (Element element) {
Map<String,String> nsMap = new HashMap<String,String>();
Node tempNode = element;
while (tempNode != null && tempNode.getNodeType() == Node.ELEMENT_NODE) {
NamedNodeMap attrs = ((Element)tempNode).getAttributes();
for (int i = 0; i < attrs.getLength(); i++) {
Attr attr = (Attr)attrs.item(i);
// XML namespace attributes use the reserved namespace "http://www.w3.org/2000/xmlns/".
if (XSDConstants.XMLNS_URI_2000.equalsIgnoreCase(attr.getNamespaceURI())) {
final String key = BPELUtils.getNSPrefixMapKey(attr.getLocalName());
if (!nsMap.containsKey(key)) {
nsMap.put(key, attr.getValue());
}
}
}
tempNode = tempNode.getParentNode();
}
return nsMap;
}
/**
* For all attributes of the given element, ensure that their namespace
* prefixes are in the resource's prefix-to-namespace-map.
*
* @param eObject
* @param element
*/
protected void saveNamespacePrefix(EObject eObject, Element element) {
Map<String,String> nsMap = null; // lazy init since it may require a new map
NamedNodeMap attrs = element.getAttributes();
for (int i=0; i < attrs.getLength(); i++) {
Attr attr = (Attr) attrs.item(i);
// XML namespace attributes use the reserved namespace "http://www.w3.org/2000/xmlns/".
if (XSDConstants.XMLNS_URI_2000.equals(attr.getNamespaceURI())) {
if (nsMap == null) {
nsMap = BPELUtils.getNamespaceMap(eObject);
}
nsMap.put(BPELUtils.getNSPrefixMapKey(attr.getLocalName()), attr.getValue());
}
}
}
/**
* Given a DOM Element, find the child element which is a BPEL activity
* (of some type), parse it, and return the Activity.
*
* @param element the element in which to find an activity
* @return the activity, or null if no activity could be found
*/
protected Activity getChildActivity(Element element) {
NodeList activityElements = element.getChildNodes();
for (int i = 0; i < activityElements.getLength(); i++) {
if (activityElements.item(i).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
Element activityElement = (Element)activityElements.item(i);
Activity activity = xml2Activity(activityElement);
if (activity != null) {
return activity;
}
}
return null;
}
/**
* Sets a PartnerLink element for a given EObject. The given activity element
* must contain an attribute named "partnerLink".
*
* @param activityElement the DOM element of the activity
* @param eObject the EObject in which to set the partner link
*/
protected void setPartnerLink(Element activityElement, final EObject eObject, final EReference reference) {
if (!activityElement.hasAttribute("partnerLink")) {
return;
}
final String partnerLinkName = activityElement.getAttribute("partnerLink");
// We must do this as a post load runnable because the partner link might not
// exist yet.
fPass2Runnables.add(new Runnable() {
public void run() {
PartnerLink targetPartnerLink = BPELUtils.getPartnerLink(eObject, partnerLinkName);
if (targetPartnerLink == null) {
targetPartnerLink = new PartnerLinkProxy(getResource().getURI(), partnerLinkName);
}
eObject.eSet(reference, targetPartnerLink);
}
});
}
/**
* Sets a Variable element for a given EObject. The given activity element
* must contain an attribute with the given name
*
* @param activityElement the DOM element of the activity
* @param eObject the EObject in which to set the variable
* @param variableAttrName the name of the attribute containing the variable name
* @param reference the EReference which is the variable pointer in EObject
*/
protected void setVariable(Element activityElement, final EObject eObject, String variableNameAttr, final EReference reference) {
if (!activityElement.hasAttribute(variableNameAttr)) {
return;
}
final String variableName = activityElement.getAttribute(variableNameAttr);
// We must do this as a post load runnable because the variable might not
// exist yet.
fPass2Runnables.add(new Runnable() {
public void run() {
Variable targetVariable = getVariable(eObject, variableName);
if (targetVariable == null) {
targetVariable = new VariableProxy(getResource().getURI(), variableName);
}
eObject.eSet(reference, targetVariable);
}
});
}
/**
* Find a Property name in element (in the named attribute) and set it
* into the given EObject. If EObject is a CorrelationSet, add the property
* to the list of properties. If it is a To, set the property.
*
* @param element the DOM element containing the property name
* @param eObject the EObject in which to set the property
* @param propertyName the name of the attribute containing the property name
*/
protected void setProperties(Element element, EObject eObject, String propertyName) {
String propertyAttribute = element.getAttribute(propertyName);
// added by Grid.Qian
// we should permit user add a correlation without properties
if(propertyAttribute == null){
return;
}
StringTokenizer st = new StringTokenizer(propertyAttribute);
while (st.hasMoreTokens()) {
QName qName = BPELUtils.createQName(element, st.nextToken());
Property property = new PropertyProxy(getResource().getURI(), qName);
if (eObject instanceof CorrelationSet) {
((CorrelationSet)eObject).getProperties().add(property);
} else if (eObject instanceof To) {
((To)eObject).setProperty(property);
}
}
}
/**
* Sets a CompensationHandler element for a given eObject.
*/
protected void setCompensationHandler(Element element, EObject eObject) {
Element compensationHandlerElement = getBPELChildElementByLocalName(element, "compensationHandler");
if (compensationHandlerElement != null) {
CompensationHandler compensationHandler = xml2CompensationHandler(compensationHandlerElement);
xml2ExtensibleElement(compensationHandler, compensationHandlerElement);
if (eObject instanceof Invoke)
((Invoke)eObject).setCompensationHandler(compensationHandler);
else if (eObject instanceof Scope)
((Scope)eObject).setCompensationHandler(compensationHandler);
}
}
/**
* Sets a FaultHandler element for a given extensibleElement.
*/
protected void setFaultHandler(Element element, BPELExtensibleElement extensibleElement) {
List<Element> faultHandlerElements = getBPELChildElementsByLocalName(element, "faultHandlers");
if (faultHandlerElements.size() > 0) {
FaultHandler faultHandler = xml2FaultHandler(faultHandlerElements.get(0));
if (extensibleElement instanceof Process) {
((Process)extensibleElement).setFaultHandlers(faultHandler);
} else if (extensibleElement instanceof Invoke) {
((Invoke)extensibleElement).setFaultHandler(faultHandler);
}
}
}
/**
* Sets a EventHandler element for a given extensibleElement.
*/
protected void setEventHandler(Element element, BPELExtensibleElement extensibleElement) {
List<Element> eventHandlerElements = getBPELChildElementsByLocalName(element, "eventHandlers");
if (eventHandlerElements.size() > 0) {
EventHandler eventHandler = xml2EventHandler(eventHandlerElements.get(0));
if (extensibleElement instanceof Process) ((Process)extensibleElement).setEventHandlers(eventHandler);
else if (extensibleElement instanceof Scope) ((Scope)extensibleElement).setEventHandlers(eventHandler);
}
}
/**
* Sets the standard attributes (name, joinCondition, and suppressJoinFailure).
*/
protected void setStandardAttributes(Element activityElement, Activity activity) {
// Set name
Attr name = activityElement.getAttributeNode("name");
if (name != null && name.getSpecified())
activity.setName(name.getValue());
// Set suppress join failure
Attr suppressJoinFailure = activityElement.getAttributeNode("suppressJoinFailure");
if (suppressJoinFailure != null && suppressJoinFailure.getSpecified())
activity.setSuppressJoinFailure( Boolean.valueOf( suppressJoinFailure.getValue().equals("yes")));
}
/**
* Sets name, portType, operation, partner, variable and correlation for a given PartnerActivity object.
*/
protected void setOperationParms(final Element activityElement,
final PartnerActivity activity,
EReference variableReference,
EReference inputVariableReference,
EReference outputVariableReference,
EReference partnerReference) {
// Set partnerLink
setPartnerLink(activityElement, activity, partnerReference);
// Set portType
PortType portType = null;
if (activityElement.hasAttribute("portType")) {
portType = BPELUtils.getPortType(getResource().getURI(), activityElement, "portType");
activity.setPortType(portType);
}
// Set operation
if (activityElement.hasAttribute("operation")) {
if (portType != null) {
activity.setOperation(BPELUtils.getOperation(getResource().getURI(), portType, activityElement, "operation"));
} else {
((PartnerActivityImpl) activity).setOperationName(activityElement.getAttribute("operation"));
}
}
// Set variable
if (variableReference != null) {
setVariable(activityElement, activity, "variable", variableReference);
}
if (inputVariableReference != null) {
setVariable(activityElement, activity, "inputVariable", inputVariableReference);
}
if (outputVariableReference != null) {
setVariable(activityElement, activity, "outputVariable", outputVariableReference);
}
// Set correlations
Element correlationsElement = getBPELChildElementByLocalName(activityElement, "correlations");
if (correlationsElement != null) {
Correlations correlations = xml2Correlations(correlationsElement);
activity.setCorrelations(correlations);
}
}
/**
* Sets name, portType, operation, partner, variable and correlation for a given PartnerActivity object.
*/
protected void setOperationParmsOnMessage(final Element activityElement, final OnMessage onMessage) {
// Set partnerLink
setPartnerLink(activityElement, onMessage, BPELPackage.eINSTANCE.getOnMessage_PartnerLink());
// Set portType
PortType portType = null;
if (activityElement.hasAttribute("portType")) {
portType = BPELUtils.getPortType(getResource().getURI(), activityElement, "portType");
onMessage.setPortType(portType);
}
// Set operation
if (activityElement.hasAttribute("operation")) {
if (portType != null) {
onMessage.setOperation(BPELUtils.getOperation(getResource().getURI(), portType, activityElement, "operation"));
} else {
// If portType is not specified it will be resolved lazily and so will the operation.
// Save the deserialized name so the operation can be later resolved.
((OnMessageImpl) onMessage).setOperationName(activityElement.getAttribute("operation"));
}
}
// Set variable
setVariable(activityElement, onMessage, "variable", BPELPackage.eINSTANCE.getOnMessage_Variable());
// Set correlations
Element correlationsElement = getBPELChildElementByLocalName(activityElement, "correlations");
if (correlationsElement != null) {
Correlations correlations = xml2Correlations(correlationsElement);
onMessage.setCorrelations(correlations);
}
}
/**
* Sets name, portType, operation, partner, variable, messageType and correlation for a given PartnerActivity object.
*/
protected void setOperationParmsOnEvent(final Element activityElement, final OnEvent onEvent) {
// Set partnerLink
setPartnerLink(activityElement, onEvent, BPELPackage.eINSTANCE.getOnEvent_PartnerLink());
// Set portType
PortType portType = null;
if (activityElement.hasAttribute("portType")) {
portType = BPELUtils.getPortType(getResource().getURI(), activityElement, "portType");
onEvent.setPortType(portType);
}
// Set operation
if (activityElement.hasAttribute("operation")) {
if (portType != null) {
onEvent.setOperation(BPELUtils.getOperation(getResource().getURI(), portType, activityElement, "operation"));
} else {
((OnEventImpl) onEvent).setOperationName(activityElement.getAttribute("operation"));
}
}
// Set variable
if (activityElement.hasAttribute("variable")) {
Variable variable = BPELFactory.eINSTANCE.createVariable();
// Set name
String name = activityElement.getAttribute("variable");
variable.setName(name);
onEvent.setVariable(variable);
// Don't set the message type of the variable, this will happen
// in the next step.
}
// Set message type
if (activityElement.hasAttribute("messageType")) {
QName qName = BPELUtils.createAttributeValue(activityElement, "messageType");
Message messageType = new MessageProxy(getResource().getURI(), qName);
onEvent.setMessageType(messageType);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=336003
// "element" attribute was missing from original model
// Set xsd element
if (activityElement.hasAttribute("element")) {
QName qName = BPELUtils.createAttributeValue(activityElement,
"element");
XSDElementDeclaration element = new XSDElementDeclarationProxy(
getResource().getURI(), qName);
onEvent.setXSDElement(element);
} else {
onEvent.setXSDElement(null);
}
// Set correlations
Element correlationsElement = getBPELChildElementByLocalName(activityElement, "correlations");
if (correlationsElement != null) {
Correlations correlations = xml2Correlations(correlationsElement);
onEvent.setCorrelations(correlations);
}
}
/**
*
*/
protected List<EObject> parseDocument (Document document) {
Element element = (document != null)? document.getDocumentElement(): null;
List<EObject> list = new ArrayList<EObject>();
if (element == null) {
return list;
}
if (element.getLocalName().equals("bag")) {
for(Node n = element.getFirstChild(); n != null; n = n.getNextSibling()) {
if (n instanceof Element == false) {
continue;
}
EObject next = parseElement ( (Element) n );
if (next != null) {
list.add(next);
}
}
} else {
EObject next = parseElement(element);
if (next != null) {
list.add(next);
}
}
return list;
}
EObject parseElement ( Element element ) {
Method parseMethod = getParseMethod ( element );
if (parseMethod == null) {
return null;
}
try {
return (EObject) parseMethod.invoke(this, element) ;
} catch (Throwable t) {
t.printStackTrace();
//
}
return null;
}
Method getParseMethod ( Element element ) {
if (BPELUtils.isBPELElement( element ) == false) {
return null;
}
String methodName = element.getLocalName();
methodName = "xml2" + Character.toUpperCase(methodName.charAt(0)) + methodName.substring(1);
return lookupMethod ( getClass(), methodName, Element.class );
}
Method lookupMethod ( Class<?> target, String methodName, Class<?> ... args ) {
if (target == null || target == Object.class) {
return null ;
}
for(Method m : target.getDeclaredMethods()) {
if (methodName.equals(m.getName()) == false || m.getParameterTypes().length != args.length ) {
continue;
}
Class<?> argTypes[] = m.getParameterTypes();
for(int i=0; i < args.length; i++) {
if (argTypes[i].isAssignableFrom(args[i]) == false) {
continue;
}
}
return m;
}
return lookupMethod(target.getSuperclass(), methodName, args);
}
/**
* Converts an XML document to a BPEL Resource object.
*/
protected Process xml2Resource(Document document) {
Element processElement = (document != null)? document.getDocumentElement(): null;
if (processElement == null) {
return null;
}
return xml2Process(processElement);
}
/**
* Converts an XML process to a BPEL Process object.
*/
@SuppressWarnings("nls")
protected Process xml2Process(Element processElement) {
if (!processElement.getLocalName().equals("process")) {
return null;
}
if (!BPELConstants.isBPELNamespace(processElement.getNamespaceURI())) {
return null;
}
process = BPELFactory.eINSTANCE.createProcess();
process.setElement(processElement);
// Save all the references to external namespaces
saveNamespacePrefix(process, processElement);
// Handle Process element
if (processElement.hasAttribute("name"))
process.setName(processElement.getAttribute("name"));
if (processElement.hasAttribute("targetNamespace"))
process.setTargetNamespace(processElement.getAttribute("targetNamespace"));
if (processElement.hasAttribute("suppressJoinFailure"))
process.setSuppressJoinFailure( Boolean.valueOf( processElement.getAttribute("suppressJoinFailure").equals("yes")));
if (processElement.hasAttribute("exitOnStandardFault"))
process.setExitOnStandardFault( Boolean.valueOf( processElement.getAttribute("exitOnStandardFault").equals("yes")));
if (processElement.hasAttribute("variableAccessSerializable"))
process.setVariableAccessSerializable( Boolean.valueOf( processElement.getAttribute("variableAccessSerializable").equals("yes")));
if (processElement.hasAttribute("queryLanguage"))
process.setQueryLanguage(processElement.getAttribute("queryLanguage"));
if (processElement.hasAttribute("expressionLanguage"))
process.setExpressionLanguage(processElement.getAttribute("expressionLanguage"));
// Handle Import Elements
for(Element e : getBPELChildElementsByLocalName(processElement, "import")) {
process.getImports().add(xml2Import(e));
}
// Handle PartnerLinks Element
Element partnerLinksElement = getBPELChildElementByLocalName(processElement, "partnerLinks");
if (partnerLinksElement != null)
process.setPartnerLinks(xml2PartnerLinks(partnerLinksElement));
// Handle Variables Element
Element variablesElement = getBPELChildElementByLocalName(processElement, "variables");
if (variablesElement != null)
process.setVariables(xml2Variables(variablesElement));
// Handle CorrelationSets Element
Element correlationSetsElement = getBPELChildElementByLocalName(processElement, "correlationSets");
if (correlationSetsElement != null)
process.setCorrelationSets(xml2CorrelationSets(correlationSetsElement));
// Handle MessageExchanges Element
Element messageExchangesElements = getBPELChildElementByLocalName(processElement, "messageExchanges");
if (messageExchangesElements != null)
process.setMessageExchanges(xml2MessageExchanges(messageExchangesElements));
// Handle Extensions Element
Element extensionsElement = getBPELChildElementByLocalName(processElement, "extensions");
if (extensionsElement != null)
process.setExtensions(xml2Extensions(extensionsElement));
// Handle FaultHandler element
setFaultHandler(processElement, process);
// Handle CompensationHandler element
// In BPEL 2.0, there is no compensation handler on process
//setCompensationHandler(processElement, process);
// Handle EventHandler element
setEventHandler(processElement, process);
// Handle Activity elements
Activity activity = xml2Activity(processElement);
process.setActivity(activity);
xml2ExtensibleElement(process,processElement);
return process;
}
/**
* Converts an XML partnerLinks
*/
public PartnerLinks xml2PartnerLinks(Element partnerLinksElement) {
if (!partnerLinksElement.getLocalName().equals("partnerLinks")) {
return null;
}
PartnerLinks partnerLinks = BPELFactory.eINSTANCE.createPartnerLinks();
partnerLinks.setElement(partnerLinksElement);
// Save all the references to external namespaces
saveNamespacePrefix(partnerLinks, partnerLinksElement);
for(Element e : getBPELChildElementsByLocalName(partnerLinksElement, "partnerLink")) {
partnerLinks.getChildren().add( xml2PartnerLink(e) );
}
xml2ExtensibleElement(partnerLinks, partnerLinksElement);
return partnerLinks;
}
public Variables xml2Variables(Element variablesElement) {
if (!variablesElement.getLocalName().equals("variables"))
return null;
Variables variables = BPELFactory.eINSTANCE.createVariables();
variables.setElement(variablesElement);
// Save all the references to external namespaces
saveNamespacePrefix(variables, variablesElement);
for(Element e : getBPELChildElementsByLocalName(variablesElement, "variable")) {
variables.getChildren().add( xml2Variable( e ) );
}
xml2ExtensibleElement(variables, variablesElement);
// Move variables that are extensibility elements to the list of children
// JM: What is this supposed to accomplish?
List<Variable> toBeMoved = new BasicEList<Variable>();
for (Object next : variables.getExtensibilityElements() ) {
if (next instanceof Variable) {
toBeMoved.add((Variable) next);
}
}
List<?> extensibility = variables.getExtensibilityElements();
List<Variable> children = variables.getChildren();
for(Variable element : toBeMoved) {
extensibility.remove(element);
children.add(element);
}
return variables;
}
public CorrelationSets xml2CorrelationSets(Element correlationSetsElement) {
if (!correlationSetsElement.getLocalName().equals("correlationSets"))
return null;
CorrelationSets correlationSets = BPELFactory.eINSTANCE.createCorrelationSets();
correlationSets.setElement(correlationSetsElement);
// Save all the references to external namespaces
saveNamespacePrefix(correlationSets, correlationSetsElement);
for(Element e : getBPELChildElementsByLocalName(correlationSetsElement, "correlationSet")) {
correlationSets.getChildren().add(xml2CorrelationSet(e));
}
xml2ExtensibleElement(correlationSets, correlationSetsElement);
return correlationSets;
}
protected FromParts xml2FromParts(Element fromPartsElement) {
if (!fromPartsElement.getLocalName().equals("fromParts"))
return null;
FromParts fromParts = BPELFactory.eINSTANCE.createFromParts();
fromParts.setElement(fromPartsElement);
// Save all the references to external namespaces
saveNamespacePrefix(fromParts, fromPartsElement);
for(Element e : getBPELChildElementsByLocalName(fromPartsElement, "fromPart")) {
fromParts.getChildren().add(xml2FromPart(e));
}
xml2ExtensibleElement(fromParts, fromPartsElement);
return fromParts;
}
protected ToParts xml2ToParts(Element toPartsElement) {
if (!toPartsElement.getLocalName().equals("toParts"))
return null;
ToParts toParts = BPELFactory.eINSTANCE.createToParts();
toParts.setElement(toPartsElement);
// Save all the references to external namespaces
saveNamespacePrefix(toParts, toPartsElement);
for(Element e : getBPELChildElementsByLocalName(toPartsElement, "toPart")) {
toParts.getChildren().add(xml2ToPart(e));
}
xml2ExtensibleElement(toParts, toPartsElement);
return toParts;
}
protected FailureHandling xml2FailureHandling(Element failureHandlingElement) {
if (!failureHandlingElement.getLocalName().equals("failureHandling"))
return null;
FailureHandling failureHandling = BPELFactory.eINSTANCE.createFailureHandling();
failureHandling.setElement(failureHandlingElement);
// Save all the references to external namespaces
saveNamespacePrefix(failureHandling, failureHandlingElement);
// Reading faultOnFailure Element
Element faultOnFailureElement= null;
String localName = "faultOnFailure";
NodeList children = failureHandlingElement.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if (localName.equals(node.getLocalName())) {
faultOnFailureElement = (Element) node;
}
}
if (faultOnFailureElement != null) {
FaultOnFailure faultOnFailure = BPELFactory.eINSTANCE.createFaultOnFailure();
faultOnFailure.setElement(faultOnFailureElement);
xml2FaultOnFailure(faultOnFailure, faultOnFailureElement);
failureHandling.setFaultOnFailure(faultOnFailure);
}
// Reading retryFor Element
Element retryForElement= null;
localName = "retryFor";
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if (localName.equals(node.getLocalName())) {
retryForElement = (Element) node;
}
}
if (retryForElement != null) {
RetryFor retryFor = BPELFactory.eINSTANCE.createRetryFor();
retryFor.setElement(retryForElement);
xml2RetryFor(retryFor, retryForElement);
failureHandling.setRetryFor(retryFor);
}
// Reading retryDelay Element
Element retryDelayElement= null;
localName = "retryDelay";
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if (localName.equals(node.getLocalName())) {
retryDelayElement = (Element) node;
}
}
if (retryDelayElement != null) {
RetryDelay retryDelay = BPELFactory.eINSTANCE.createRetryDelay();
retryDelay.setElement(retryDelayElement);
xml2RetryDelay(retryDelay, retryDelayElement);
failureHandling.setRetryDelay(retryDelay);
}
xml2ExtensibleElement(failureHandling, failureHandlingElement);
return failureHandling;
}
protected FaultOnFailure xml2FaultOnFailure(FaultOnFailure faultOnFailure,Element faultOnFailureElement)
{
// Save all the references to external namespaces
saveNamespacePrefix(faultOnFailure, faultOnFailureElement);
if (faultOnFailureElement == null) {
return faultOnFailure;
}
//reading body of the faultOnFailure and add it into the faultOnFailure object
String data = getText(faultOnFailureElement);
if (data != null) {
if("true".equalsIgnoreCase(data)){
faultOnFailure.setValue(true);
}
else
{
faultOnFailure.setValue(false);
}
}
return faultOnFailure;
}
protected RetryFor xml2RetryFor(RetryFor retryFor,Element retryForElement)
{
// Save all the references to external namespaces
saveNamespacePrefix(retryFor, retryForElement);
if (retryForElement == null) {
return retryFor;
}
//reading body of the retryFor and add it into the retryFor object
String data = getText(retryForElement);
if (data != null) {
retryFor.setValue(Integer.parseInt(data));
}
return retryFor;
}
protected RetryDelay xml2RetryDelay(RetryDelay retryDelay,Element retryDelayElement)
{
// Save all the references to external namespaces
saveNamespacePrefix(retryDelay, retryDelayElement);
if (retryDelayElement == null) {
return retryDelay;
}
//reading body of the retryDelay and add it into the retryDelay object
String data = getText(retryDelayElement);
if (data != null) {
retryDelay.setValue(Integer.parseInt(data));
}
return retryDelay;
}
public MessageExchanges xml2MessageExchanges(Element messageExchangesElement) {
if (!messageExchangesElement.getLocalName().equals("messageExchanges"))
return null;
MessageExchanges messageExchanges = BPELFactory.eINSTANCE.createMessageExchanges();
messageExchanges.setElement(messageExchangesElement);
// Save all the references to external namespaces
saveNamespacePrefix(messageExchanges, messageExchangesElement);
for(Element e : getBPELChildElementsByLocalName(messageExchangesElement, "messageExchange")) {
messageExchanges.getChildren().add(xml2MessageExchange(e));
}
xml2ExtensibleElement(messageExchanges, messageExchangesElement);
return messageExchanges;
}
protected Extensions xml2Extensions(Element extensionsElement) {
if (!extensionsElement.getLocalName().equals("extensions"))
return null;
Extensions extensions = BPELFactory.eINSTANCE.createExtensions();
extensions.setElement(extensionsElement);
// Save all the references to external namespaces
saveNamespacePrefix(extensions, extensionsElement);
for(Element e : getBPELChildElementsByLocalName(extensionsElement, "extension")) {
extensions.getChildren().add(xml2Extension(e));
}
xml2ExtensibleElement(extensions, extensionsElement);
return extensions;
}
/**
* Converts an XML compensationHandler element to a BPEL CompensationHandler object.
*/
protected CompensationHandler xml2CompensationHandler(Element activityElement) {
CompensationHandler compensationHandler = BPELFactory.eINSTANCE.createCompensationHandler();
compensationHandler.setElement(activityElement);
// Save all the references to external namespaces
saveNamespacePrefix(compensationHandler, activityElement);
compensationHandler.setActivity(getChildActivity(activityElement));
return compensationHandler;
}
/**
* Converts an XML correlationSet element to a BPEL CorrelationSet object.
*/
protected CorrelationSet xml2CorrelationSet(Element correlationSetElement) {
CorrelationSet correlationSet = BPELFactory.eINSTANCE.createCorrelationSet();
correlationSet.setElement(correlationSetElement);
// Save all the references to external namespaces
saveNamespacePrefix(correlationSet, correlationSetElement);
if (correlationSetElement == null) return correlationSet;
// Set name
Attr name = correlationSetElement.getAttributeNode("name");
if (name != null && name.getSpecified())
correlationSet.setName(name.getValue());
setProperties(correlationSetElement, correlationSet, "properties");
xml2ExtensibleElement(correlationSet, correlationSetElement);
return correlationSet;
}
/**
* Converts an XML messageExchange element to a BPEL MessageExchange object.
*/
protected MessageExchange xml2MessageExchange(Element messageExchangeElement) {
if (!messageExchangeElement.getLocalName().equals("messageExchange"))
return null;
MessageExchange messageExchange = BPELFactory.eINSTANCE.createMessageExchange();
messageExchange.setElement(messageExchangeElement);
// Save all the references to external namespaces
saveNamespacePrefix(messageExchange, messageExchangeElement);
// Set name
if (messageExchangeElement.hasAttribute("name"))
messageExchange.setName(messageExchangeElement.getAttribute("name"));
xml2ExtensibleElement(messageExchange, messageExchangeElement);
return messageExchange;
}
/**
* Converts an XML extension element to a BPEL Extension object.
*/
protected Extension xml2Extension(Element extensionElement) {
Extension extension = BPELFactory.eINSTANCE.createExtension();
extension.setElement(extensionElement);
// Save all the references to external namespaces
saveNamespacePrefix(extension, extensionElement);
if (extensionElement == null) return extension;
// Set namespace
if (extensionElement.hasAttribute("namespace"))
extension.setNamespace(extensionElement.getAttribute("namespace"));
// Set mustUnderstand
if (extensionElement.hasAttribute("mustUnderstand"))
extension.setMustUnderstand( Boolean.valueOf( extensionElement.getAttribute("mustUnderstand").equals("yes")));
xml2ExtensibleElement(extension, extensionElement);
return extension;
}
/**
* Converts an XML partnerLink element to a BPEL PartnerLink object.
*/
protected PartnerLink xml2PartnerLink(Element partnerLinkElement) {
if (!partnerLinkElement.getLocalName().equals("partnerLink"))
return null;
PartnerLink partnerLink = BPELFactory.eINSTANCE.createPartnerLink();
partnerLink.setElement(partnerLinkElement);
// Save all the references to external namespaces
saveNamespacePrefix(partnerLink, partnerLinkElement);
// Set name
if (partnerLinkElement.hasAttribute("name"))
partnerLink.setName(partnerLinkElement.getAttribute("name"));
if (partnerLinkElement.hasAttribute("initializePartnerRole"))
partnerLink.setInitializePartnerRole( Boolean.valueOf( partnerLinkElement.getAttribute("initializePartnerRole").equals("yes")));
Attr partnerLinkTypeName = partnerLinkElement.getAttributeNode("partnerLinkType");
if (partnerLinkTypeName != null && partnerLinkTypeName.getSpecified()) {
QName sltQName = BPELUtils.createAttributeValue(partnerLinkElement, "partnerLinkType");
PartnerLinkTypeProxy slt = new PartnerLinkTypeProxy(getResource().getURI(), sltQName);
partnerLink.setPartnerLinkType(slt);
if(slt != null) {
partnerLink.setPartnerLinkType(slt);
if (partnerLinkElement.hasAttribute("myRole")) {
RoleProxy role = new RoleProxy(getResource(), slt, partnerLinkElement.getAttribute("myRole"));
partnerLink.setMyRole(role);
}
if (partnerLinkElement.hasAttribute("partnerRole")) {
RoleProxy role = new RoleProxy(getResource(), slt, partnerLinkElement.getAttribute("partnerRole"));
partnerLink.setPartnerRole(role);
}
}
}
xml2ExtensibleElement(partnerLink,partnerLinkElement);
return partnerLink;
}
/**
* Converts an XML variable element to a BPEL Variable object.
*/
protected Variable xml2Variable(Element variableElement) {
if (!variableElement.getLocalName().equals("variable"))
return null;
Variable variable = BPELFactory.eINSTANCE.createVariable();
variable.setElement(variableElement);
// Save all the references to external namespaces
saveNamespacePrefix(variable, variableElement);
// Set name
if (variableElement.hasAttribute("name")) {
String name = variableElement.getAttribute("name");
variable.setName(name);
}
if (variableElement.hasAttribute("messageType")) {
QName qName = BPELUtils.createAttributeValue(variableElement,"messageType");
Message messageType = new MessageProxy(getResource().getURI(), qName);
variable.setMessageType(messageType);
}
// Set xsd type
if (variableElement.hasAttribute("type")) {
QName qName = BPELUtils.createAttributeValue(variableElement, "type");
XSDTypeDefinition type = new XSDTypeDefinitionProxy(getResource().getURI(), qName);
variable.setType(type);
}
// Set xsd element
if (variableElement.hasAttribute("element")) {
QName qName = BPELUtils.createAttributeValue(variableElement, "element");
XSDElementDeclaration element = new XSDElementDeclarationProxy(getResource().getURI(), qName);
variable.setXSDElement(element);
}
// from-spec
Element fromElement = getBPELChildElementByLocalName(variableElement, "from");
if (fromElement != null) {
From from = BPELFactory.eINSTANCE.createFrom();
from.setElement(fromElement);
xml2From(from, fromElement);
variable.setFrom(from);
}
xml2ExtensibleElement(variable,variableElement);
return variable;
}
/**
* Converts an XML faultHandler element to a BPEL FaultHandler object.
*/
protected FaultHandler xml2FaultHandler(Element faultHandlerElement) {
String localName = faultHandlerElement.getLocalName();
if (!(localName.equals("faultHandlers") ||
localName.equals("invoke")))
return null;
FaultHandler faultHandler = BPELFactory.eINSTANCE.createFaultHandler();
if (localName.equals("faultHandlers")) {
// This is "overloaded", what's the proper facade for the fault handler element in this case.
faultHandler.setElement(faultHandlerElement);
}
// Save all the references to external namespaces
saveNamespacePrefix(faultHandler, faultHandlerElement);
for(Element e : getBPELChildElementsByLocalName(faultHandlerElement, "catch")) {
faultHandler.getCatch().add( xml2Catch(e));
}
Element catchAllElement = getBPELChildElementByLocalName(faultHandlerElement, "catchAll");
if (catchAllElement != null) {
CatchAll catchAll = xml2CatchAll(catchAllElement);
faultHandler.setCatchAll(catchAll);
}
// Only do this for an element named faultHandlers. If the element is named
// invoke, then there really is no fault handler, only a series of catches.
if (faultHandlerElement.getLocalName().equals("faultHandlers")) {
xml2ExtensibleElement(faultHandler, faultHandlerElement);
}
return faultHandler;
}
/**
* Converts an XML catchAll element to a BPEL CatchAll object.
*/
protected CatchAll xml2CatchAll(Element catchAllElement) {
if (!catchAllElement.getLocalName().equals("catchAll"))
return null;
CatchAll catchAll = BPELFactory.eINSTANCE.createCatchAll();
catchAll.setElement(catchAllElement);
// Save all the references to external namespaces
saveNamespacePrefix(catchAll, catchAllElement);
for(Element e : getChildElements(catchAllElement)) {
Activity activity = xml2Activity(e);
if (activity != null) {
catchAll.setActivity(activity);
break;
}
}
xml2ExtensibleElement(catchAll, catchAllElement);
return catchAll;
}
/**
* Converts an XML catch element to a BPEL Catch object.
*/
protected Catch xml2Catch(Element catchElement) {
Catch _catch = BPELFactory.eINSTANCE.createCatch();
_catch.setElement(catchElement);
// Save all the references to external namespaces
saveNamespacePrefix(_catch, catchElement);
if (catchElement == null) return _catch;
if (catchElement.hasAttribute("faultName")) {
QName qName = BPELUtils.createAttributeValue(catchElement, "faultName");
_catch.setFaultName(qName);
}
if (catchElement.hasAttribute("faultVariable")) {
// Set fault variable
Variable variable = BPELFactory.eINSTANCE.createVariable();
// TODO: Should not this be the variable proxy ?
variable.setName(catchElement.getAttribute("faultVariable"));
_catch.setFaultVariable(variable);
}
if (catchElement.hasAttribute("faultMessageType")) {
QName qName = BPELUtils.createAttributeValue(catchElement,"faultMessageType");
Message messageType = new MessageProxy(getResource().getURI(), qName);
_catch.setFaultMessageType(messageType);
}
if (catchElement.hasAttribute("faultElement")) {
QName qName = BPELUtils.createAttributeValue(catchElement,"faultElement");
XSDElementDeclaration element = new XSDElementDeclarationProxy(getResource().getURI(), qName);
_catch.setFaultElement(element);
}
// Set Activities
NodeList catchElements = catchElement.getChildNodes();
Element activityElement = null;
if (catchElements != null && catchElements.getLength() > 0) {
for (int i = 0; i < catchElements.getLength(); i++) {
if (catchElements.item(i).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
activityElement = (Element)catchElements.item(i);
Activity activity = xml2Activity(activityElement);
if (activity != null) {
_catch.setActivity(activity);
break;
}
}
}
xml2ExtensibleElement(_catch, catchElement);
return _catch;
}
/**
* Converts an XML activity element to a BPEL Activity object.
*/
public Activity xml2Activity(Element activityElement) {
Activity activity = null;
boolean checkExtensibility = true;
if (!BPELUtils.isBPELElement(activityElement))
return null;
String localName = activityElement.getLocalName();
if (localName.equals("process")){
activity = getChildActivity(activityElement);
checkExtensibility = false;
} else if (localName.equals("receive")) {
activity = xml2Receive(activityElement);
} else if (localName.equals("reply")) {
activity = xml2Reply(activityElement);
} else if (localName.equals("invoke")) {
activity = xml2Invoke(activityElement);
} else if (localName.equals("assign")) {
// Identifying the Correct Assign Activity
String childLocalName = "";
// Since E4X Assign Activity has at least one ExtensionAssignOperation by default
if (activityElement.getFirstChild() != null) {
//Reading all (*) child elements
NodeList node = activityElement.getElementsByTagName("*");
// checking for first child.
// This implementation supports only for either <copy> or <extensionAssignOpetion>
childLocalName = node.item(0).getLocalName();
if ("extensionAssignOperation".equalsIgnoreCase(childLocalName)) {
activity = xml2AssignE4X(activityElement);
} else if ("copy".equalsIgnoreCase(childLocalName)) {
activity = xml2Assign(activityElement);
}
} else {
// Default Assign Activity. Since there is no child elements.
activity = xml2Assign(activityElement);
}
} else if (localName.equals("throw")) {
activity = xml2Throw(activityElement);
} else if (localName.equals("exit")) {
activity = xml2Exit(activityElement);
} else if (localName.equals("wait")) {
activity = xml2Wait(activityElement);
} else if (localName.equals("empty")) {
activity = xml2Empty(activityElement);
} else if (localName.equals("sequence")) {
activity = xml2Sequence(activityElement);
} else if (localName.equals("if")) {
activity = xml2If(activityElement);
} else if (localName.equals("while")) {
activity = xml2While(activityElement);
} else if (localName.equals("pick")) {
activity = xml2Pick(activityElement);
} else if (localName.equals("flow")) {
activity = xml2Flow(activityElement);
} else if (localName.equals("scope")) {
activity = xml2Scope(activityElement);
} else if (localName.equals("compensate")) {
activity = xml2Compensate(activityElement);
} else if (localName.equals("compensateScope")) {
activity = xml2CompensateScope(activityElement);
} else if (localName.equals("rethrow")) {
activity = xml2Rethrow(activityElement);
} else if (localName.equals("extensionActivity")) {
// extensionActivity is a special case. It does not have any standard
// attributes or elements, nor is it an extensible element.
// Return immediately.
activity = xml2ExtensionActivity(activityElement);
return activity;
} else if (localName.equals("opaqueActivity")) {
activity = xml2OpaqueActivity(activityElement);
} else if (localName.equals("forEach")) {
activity = xml2ForEach(activityElement);
} else if (localName.equals("repeatUntil")) {
activity = xml2RepeatUntil(activityElement);
} else if (localName.equals("validate")) {
activity = xml2Validate(activityElement);
} else {
return null;
}
setStandardElements(activityElement, activity);
if (checkExtensibility) {
xml2ExtensibleElement(activity, activityElement);
// Save all the references to external namespaces
saveNamespacePrefix(activity, activityElement);
}
return activity;
}
protected void setStandardElements(Element activityElement, Activity activity) {
// Handle targets
Element targetsElement = getBPELChildElementByLocalName(activityElement, "targets");
if (targetsElement != null) {
activity.setTargets(xml2Targets(targetsElement));
}
// Handle sources
Element sourcesElement = getBPELChildElementByLocalName(activityElement, "sources");
if (sourcesElement != null) {
activity.setSources(xml2Sources(sourcesElement));
}
}
protected Targets xml2Targets(Element targetsElement) {
Targets targets = BPELFactory.eINSTANCE.createTargets();
targets.setElement(targetsElement);
for(Element e : getBPELChildElementsByLocalName(targetsElement, "target")) {
targets.getChildren().add( xml2Target(e));
}
// Join condition
Element joinConditionElement = getBPELChildElementByLocalName(targetsElement, "joinCondition");
if (joinConditionElement != null) {
targets.setJoinCondition(xml2Condition(joinConditionElement));
}
xml2ExtensibleElement(targets, targetsElement);
return targets;
}
protected Target xml2Target(Element targetElement) {
final Target target = BPELFactory.eINSTANCE.createTarget();
target.setElement(targetElement);
// Save all the references to external namespaces
saveNamespacePrefix(target, targetElement);
xml2ExtensibleElement(target, targetElement);
if (targetElement.hasAttribute("linkName")) {
final String linkName = targetElement.getAttribute("linkName");
fPass2Runnables.add(new Runnable() {
public void run() {
Link link = getLink(target.getActivity(), linkName);
if (link != null)
target.setLink(link);
else
target.setLink(new LinkProxy(getResource().getURI(), linkName));
}
});
}
return target;
}
protected Sources xml2Sources(Element sourcesElement) {
Sources sources = BPELFactory.eINSTANCE.createSources();
sources.setElement(sourcesElement);
for(Element e : getBPELChildElementsByLocalName(sourcesElement, "source")) {
sources.getChildren().add( xml2Source(e));
}
xml2ExtensibleElement(sources, sourcesElement);
return sources;
}
protected Source xml2Source(Element sourceElement) {
final String linkName = sourceElement.getAttribute("linkName");
final Source source = BPELFactory.eINSTANCE.createSource();
source.setElement(sourceElement);
// Save all the references to external namespaces
saveNamespacePrefix(source, sourceElement);
// Read transitionCondition element
Element transitionConditionElement = getBPELChildElementByLocalName(sourceElement, "transitionCondition");
if (transitionConditionElement != null) {
Condition transitionCondition = xml2Condition(transitionConditionElement);
source.setTransitionCondition(transitionCondition);
}
xml2ExtensibleElement(source, sourceElement);
fPass2Runnables.add(new Runnable() {
public void run() {
Link link = getLink(source.getActivity(), linkName);
if (link != null)
source.setLink(link);
else
source.setLink(new LinkProxy(getResource().getURI(), linkName));
}
});
return source;
}
/**
* Converts an XML scope element to a BPEL Scope object.
*/
protected Activity xml2Scope(Element scopeElement) {
Scope scope = BPELFactory.eINSTANCE.createScope();
scope.setElement(scopeElement);
//if (scopeElement == null) {
// return scope;
//}
Attr name = scopeElement.getAttributeNode("name");
if (name != null && name.getSpecified()) {
scope.setName(name.getValue());
}
Attr isolated = scopeElement.getAttributeNode("isolated");
if (isolated != null && isolated.getSpecified())
scope.setIsolated( Boolean.valueOf( isolated.getValue().equals("yes")));
// Handle attribute exitOnStandardFault
Attr exitOnStandardFault = scopeElement.getAttributeNode("exitOnStandardFault");
if (exitOnStandardFault != null && exitOnStandardFault.getSpecified())
scope.setExitOnStandardFault( Boolean.valueOf( exitOnStandardFault.getValue().equals("yes")));
// Handle Variables element
Element variablesElement = getBPELChildElementByLocalName(scopeElement, "variables");
if (variablesElement != null) {
Variables variables = xml2Variables(variablesElement);
scope.setVariables(variables);
}
// Handle CorrelationSet element
Element correlationSetsElement = getBPELChildElementByLocalName(scopeElement, "correlationSets");
if (correlationSetsElement != null) {
CorrelationSets correlationSets = xml2CorrelationSets(correlationSetsElement);
scope.setCorrelationSets(correlationSets);
}
// Handle PartnerLinks element
Element partnerLinksElement = getBPELChildElementByLocalName(scopeElement, "partnerLinks");
if (partnerLinksElement != null) {
PartnerLinks partnerLinks = xml2PartnerLinks(partnerLinksElement);
scope.setPartnerLinks(partnerLinks);
}
// MessageExchanges element
Element messageExchangesElement = getBPELChildElementByLocalName(scopeElement, "messageExchanges");
if (messageExchangesElement != null) {
MessageExchanges messageExchanges = xml2MessageExchanges(messageExchangesElement);
scope.setMessageExchanges(messageExchanges);
}
// Handle FaultHandler element
Element faultHandlerElement = getBPELChildElementByLocalName(scopeElement, "faultHandlers");
if (faultHandlerElement != null) {
FaultHandler faultHandler = xml2FaultHandler(faultHandlerElement);
scope.setFaultHandlers(faultHandler);
}
// Handle CompensationHandler element
setCompensationHandler(scopeElement, scope);
// Handler TerminationHandler element
Element terminationHandlerElement = getBPELChildElementByLocalName(scopeElement, "terminationHandler");
if (terminationHandlerElement != null) {
TerminationHandler terminationHandler = xml2TerminationHandler(terminationHandlerElement);
scope.setTerminationHandler(terminationHandler);
}
// Handler EventHandler element
setEventHandler(scopeElement, scope);
setStandardAttributes(scopeElement, scope);
// Handle activities
NodeList scopeElements = scopeElement.getChildNodes();
Element activityElement = null;
if (scopeElements != null && scopeElements.getLength() > 0) {
for (int i = 0; i < scopeElements.getLength(); i++) {
if (scopeElements.item(i).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
activityElement = (Element)scopeElements.item(i);
if (activityElement.getLocalName().equals("faultHandlers") ||
activityElement.getLocalName().equals("compensationHandler"))
{
continue;
}
Activity activity = xml2Activity(activityElement);
if (activity != null) {
scope.setActivity(activity);
break;
}
}
}
return scope;
}
/**
* Converts an XML flow element to a BPEL Flow object.
*/
protected Activity xml2Flow(Element flowElement) {
Flow flow = BPELFactory.eINSTANCE.createFlow();
flow.setElement(flowElement);
// if (flowElement == null) {
// return flow;
// }
Attr name = flowElement.getAttributeNode("name");
if (name != null && name.getSpecified())
flow.setName(name.getValue());
Element linksElement = getBPELChildElementByLocalName(flowElement, "links");
if (linksElement != null) {
Links links = xml2Links(linksElement);
flow.setLinks(links);
}
Element completionConditionElement = getBPELChildElementByLocalName(flowElement, "completionCondition");
if (completionConditionElement != null) {
CompletionCondition completionCondition = xml2CompletionCondition(completionConditionElement);
flow.setCompletionCondition(completionCondition);
}
setStandardAttributes(flowElement, flow);
NodeList flowElements = flowElement.getChildNodes();
Element activityElement = null;
if (flowElements != null && flowElements.getLength() > 0) {
for (int i = 0; i < flowElements.getLength(); i++) {
if ((flowElements.item(i).getNodeType() != Node.ELEMENT_NODE) ||
((Element)flowElements.item(i)).getLocalName().equals("links"))
continue;
activityElement = (Element)flowElements.item(i);
Activity activity = xml2Activity(activityElement);
if (activity != null) {
flow.getActivities().add(activity);
}
}
}
return flow;
}
protected Links xml2Links(Element linksElement) {
if (!linksElement.getLocalName().equals("links"))
return null;
Links links = BPELFactory.eINSTANCE.createLinks();
links.setElement(linksElement);
// Save all the references to external namespaces
saveNamespacePrefix(links, linksElement);
for(Element e : getBPELChildElementsByLocalName(linksElement, "link")) {
links.getChildren().add( xml2Link (e));
}
// extensibility elements
xml2ExtensibleElement(links, linksElement);
return links;
}
/**
* Converts an XML link element to a BPEL Link object.
*/
protected Link xml2Link(Element linkElement) {
Link link = BPELFactory.eINSTANCE.createLink();
link.setElement(linkElement);
// Save all the references to external namespaces
saveNamespacePrefix(link, linkElement);
Attr name = linkElement.getAttributeNode("name");
if (name != null && name.getSpecified())
link.setName(name.getValue());
xml2ExtensibleElement(link,linkElement);
return link;
}
/**
* Converts an XML pick element to a BPEL Pick object.
*/
protected Activity xml2Pick(Element pickElement) {
Pick pick = BPELFactory.eINSTANCE.createPick();
pick.setElement(pickElement);
// Set name
Attr name = pickElement.getAttributeNode("name");
if (name != null && name.getSpecified())
pick.setName(name.getValue());
// Set createInstance
Attr createInstance = pickElement.getAttributeNode("createInstance");
if (createInstance != null && createInstance.getSpecified())
pick.setCreateInstance(Boolean.valueOf(createInstance.getValue().equals("yes") ? "True":"False"));
NodeList pickElements = pickElement.getChildNodes();
Element pickInstanceElement = null;
if (pickElements != null && pickElements.getLength() > 0) {
for (int i = 0; i < pickElements.getLength(); i++) {
if (pickElements.item(i).getNodeType() != Node.ELEMENT_NODE)
continue;
pickInstanceElement = (Element)pickElements.item(i);
if (pickInstanceElement.getLocalName().equals("onAlarm")) {
OnAlarm onAlarm = xml2OnAlarm( pickInstanceElement );
pick.getAlarm().add(onAlarm);
}
else
if (pickInstanceElement.getLocalName().equals("onMessage")) {
OnMessage onMessage = xml2OnMessage(pickInstanceElement);
pick.getMessages().add(onMessage);
}
}
}
setStandardAttributes(pickElement, pick);
return pick;
}
/**
* Converts an XML eventHandler element to a BPEL eventHandler object.
*/
protected EventHandler xml2EventHandler(Element eventHandlerElement) {
EventHandler eventHandler = BPELFactory.eINSTANCE.createEventHandler();
eventHandler.setElement(eventHandlerElement);
// Save all the references to external namespaces
saveNamespacePrefix(eventHandler, eventHandlerElement);
NodeList eventHandlerElements = eventHandlerElement.getChildNodes();
Element eventHandlerInstanceElement = null;
if (eventHandlerElements != null && eventHandlerElements.getLength() > 0) {
for (int i = 0; i < eventHandlerElements.getLength(); i++) {
if (eventHandlerElements.item(i).getNodeType() != Node.ELEMENT_NODE)
continue;
eventHandlerInstanceElement = (Element)eventHandlerElements.item(i);
if (eventHandlerInstanceElement.getLocalName().equals("onAlarm")) {
OnAlarm onAlarm = xml2OnAlarm(eventHandlerInstanceElement);
eventHandler.getAlarm().add(onAlarm);
}
else if (eventHandlerInstanceElement.getLocalName().equals("onEvent")) {
OnEvent onEvent = xml2OnEvent(eventHandlerInstanceElement);
eventHandler.getEvents().add(onEvent);
}
}
}
xml2ExtensibleElement(eventHandler, eventHandlerElement);
return eventHandler;
}
/**
* Converts an XML onMessage element to a BPEL OnMessage object.
*/
protected OnMessage xml2OnMessage(Element onMessageElement) {
OnMessage onMessage = BPELFactory.eINSTANCE.createOnMessage();
onMessage.setElement(onMessageElement);
// Save all the references to external namespaces
saveNamespacePrefix(onMessage, onMessageElement);
// Set several parms
setOperationParmsOnMessage(onMessageElement, onMessage);
// Set activity
onMessage.setActivity(getChildActivity(onMessageElement));
// Set fromParts
Element fromPartsElement = getBPELChildElementByLocalName(onMessageElement, "fromParts");
if (fromPartsElement != null) {
FromParts fromParts = xml2FromParts(fromPartsElement);
onMessage.setFromParts(fromParts);
}
// Set messageExchange
setMessageExchange(onMessageElement, onMessage, BPELPackage.eINSTANCE.getOnMessage_MessageExchange());
xml2ExtensibleElement(onMessage, onMessageElement);
return onMessage;
}
/**
* Converts an XML onEvent element to a BPEL OnEvent object.
*/
protected OnEvent xml2OnEvent(Element onEventElement) {
OnEvent onEvent = BPELFactory.eINSTANCE.createOnEvent();
onEvent.setElement(onEventElement);
// Save all the references to external namespaces
saveNamespacePrefix(onEvent, onEventElement);
// Set several parms
setOperationParmsOnEvent(onEventElement, onEvent);
// Set activity
onEvent.setActivity(getChildActivity(onEventElement));
// Set fromParts
Element fromPartsElement = getBPELChildElementByLocalName(onEventElement, "fromParts");
if (fromPartsElement != null) {
FromParts fromParts = xml2FromParts(fromPartsElement);
onEvent.setFromParts(fromParts);
}
// Handle CorrelationSets Element
Element correlationSetsElement = getBPELChildElementByLocalName(onEventElement, "correlationSets");
if (correlationSetsElement != null)
onEvent.setCorrelationSets(xml2CorrelationSets(correlationSetsElement));
// Set messageExchange
setMessageExchange(onEventElement, onEvent, BPELPackage.eINSTANCE.getOnEvent_MessageExchange());
xml2ExtensibleElement(onEvent, onEventElement);
return onEvent;
}
/**
* Converts an XML onAlarm element to a BPEL OnAlarm object.
*/
protected OnAlarm xml2OnAlarm(Element onAlarmElement) {
OnAlarm onAlarm = BPELFactory.eINSTANCE.createOnAlarm();
onAlarm.setElement(onAlarmElement);
// Save all the references to external namespaces
saveNamespacePrefix(onAlarm, onAlarmElement);
// Set for element
Element forElement = getBPELChildElementByLocalName(onAlarmElement, "for");
if (forElement != null) {
Expression expression = xml2Expression(forElement);
onAlarm.setFor(expression);
}
// Set until element
Element untilElement = getBPELChildElementByLocalName(onAlarmElement, "until");
if (untilElement != null) {
Expression expression = xml2Expression(untilElement);
onAlarm.setUntil(expression);
}
// Set repeatEvery element
Element repeatEveryElement = getBPELChildElementByLocalName(onAlarmElement, "repeatEvery");
if (repeatEveryElement != null) {
Expression expression = xml2Expression(repeatEveryElement);
onAlarm.setRepeatEvery(expression);
}
// Set activity
onAlarm.setActivity(getChildActivity(onAlarmElement));
xml2ExtensibleElement(onAlarm, onAlarmElement);
return onAlarm;
}
/**
* Converts an XML while element to a BPEL While object.
*/
protected Activity xml2While(Element whileElement) {
While _while = BPELFactory.eINSTANCE.createWhile();
_while.setElement(whileElement);
// Handle condition element
Element conditionElement = getBPELChildElementByLocalName(whileElement, "condition");
if (conditionElement != null) {
Condition condition = xml2Condition(conditionElement);
_while.setCondition(condition);
}
NodeList whileElements = whileElement.getChildNodes();
Element activityElement = null;
if (whileElements != null && whileElements.getLength() > 0) {
for (int i = 0; i < whileElements.getLength(); i++) {
if (whileElements.item(i).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
activityElement = (Element) whileElements.item(i);
Activity activity = xml2Activity(activityElement);
if (activity != null) {
_while.setActivity(activity);
// only the first one
break ;
}
}
}
setStandardAttributes(whileElement, _while);
return _while;
}
/**
* Converts an XML terminationHandler element to a BPEL TerminationHandler object.
*/
protected TerminationHandler xml2TerminationHandler(Element terminationHandlerElement) {
TerminationHandler terminationHandler = BPELFactory.eINSTANCE.createTerminationHandler();
terminationHandler.setElement(terminationHandlerElement);
// Save all the references to external namespaces
saveNamespacePrefix(terminationHandler, terminationHandlerElement);
terminationHandler.setActivity(getChildActivity(terminationHandlerElement));
xml2ExtensibleElement(terminationHandler, terminationHandlerElement);
return terminationHandler;
}
/**
* Converts an XML if element to a BPEL If object.
*/
protected Activity xml2If(Element ifElement) {
If _if = BPELFactory.eINSTANCE.createIf();
_if.setElement(ifElement);
// Set activity
Activity activity = getChildActivity(ifElement);
if (activity != null) {
_if.setActivity(activity);
}
// Handle condition element
Element conditionElement = getBPELChildElementByLocalName(ifElement, "condition");
if (conditionElement != null) {
Condition condition = xml2Condition(conditionElement);
_if.setCondition(condition);
}
// Handle elseif
for(Element e : getBPELChildElementsByLocalName(ifElement, "elseif")) {
_if.getElseIf().add( xml2ElseIf ( e ));
}
// Handle else
Element elseElement = getBPELChildElementByLocalName(ifElement, "else");
if (elseElement != null) {
Else _else = xml2Else(elseElement);
_if.setElse(_else);
}
setStandardAttributes(ifElement, _if);
return _if;
}
/**
* Converts an XML elseIf element to a BPEL ElseIf object.
*/
protected ElseIf xml2ElseIf(Element elseIfElement) {
ElseIf elseIf = BPELFactory.eINSTANCE.createElseIf();
elseIf.setElement(elseIfElement);
// Save all the references to external namespaces
saveNamespacePrefix(elseIf, elseIfElement);
// Handle condition element
Element conditionElement = getBPELChildElementByLocalName(elseIfElement, "condition");
if (conditionElement != null) {
Condition condition = xml2Condition(conditionElement);
elseIf.setCondition(condition);
}
// Set activity
Activity activity = getChildActivity(elseIfElement);
if (activity != null) {
elseIf.setActivity(activity);
}
return elseIf;
}
/**
* Converts an XML condition element to a BPEL Condition object.
*/
protected Condition xml2Condition(Element conditionElement) {
Condition condition = BPELFactory.eINSTANCE.createCondition();
condition.setElement(conditionElement);
xml2Expression(conditionElement, condition);
return condition;
}
/**
* Converts an XML expression element to a BPEL Expression object.
*
* Accept a pre-constructed argument. This is good for sub-types
* of expression.
*
* Returns the second argument as a convenience.
*
*/
protected Expression xml2Expression(Element expressionElement, Expression expression) {
// Save all the references to external namespaces
saveNamespacePrefix(expression, expressionElement);
if (expressionElement == null) {
return expression;
}
// Set expressionLanguage
if (expressionElement.hasAttribute("expressionLanguage")) {
expression.setExpressionLanguage(expressionElement.getAttribute("expressionLanguage"));
}
// Set opaque
if (expressionElement.hasAttribute("opaque")) {
expression.setOpaque( Boolean.valueOf( expressionElement.getAttribute("opaque").equals("yes")));
}
String data = getText(expressionElement);
if (data != null) {
expression.setBody(data);
}
return expression;
}
/**
* Converts an XML expression element to a BPEL Expression object.
*/
protected Expression xml2Expression(Element expressionElement) {
Expression expression = BPELFactory.eINSTANCE.createExpression();
expression.setElement(expressionElement);
return xml2Expression(expressionElement, expression);
}
protected Else xml2Else(Element elseElement) {
Else _else = BPELFactory.eINSTANCE.createElse();
_else.setElement(elseElement);
// Save all the references to external namespaces
saveNamespacePrefix(_else, elseElement);
Activity activity = getChildActivity(elseElement);
_else.setActivity(activity);
return _else;
}
/**
* Converts an XML sequence element to a BPEL Sequence object.
*/
protected Activity xml2Sequence(Element sequenceElement) {
Sequence sequence = BPELFactory.eINSTANCE.createSequence();
sequence.setElement(sequenceElement);
// Set name
Attr name = sequenceElement.getAttributeNode("name");
if (name != null && name.getSpecified()) {
sequence.setName(name.getValue());
}
NodeList sequenceElements = sequenceElement.getChildNodes();
Element activityElement = null;
if (sequenceElements != null && sequenceElements.getLength() > 0) {
for (int i = 0; i < sequenceElements.getLength(); i++) {
if (sequenceElements.item(i).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
activityElement = (Element)sequenceElements.item(i);
Activity activity = xml2Activity(activityElement);
if (activity != null) {
sequence.getActivities().add(activity);
}
}
}
setStandardAttributes(sequenceElement, sequence);
return sequence;
}
/**
* Converts an XML empty element to a BPEL Empty object.
*/
protected Activity xml2Empty(Element emptyElement) {
Empty empty = BPELFactory.eINSTANCE.createEmpty();
empty.setElement(emptyElement);
setStandardAttributes(emptyElement, empty);
return empty;
}
/**
* Converts an XML opaqueActivity element to a BPEL OpaqueActivity object.
*/
protected Activity xml2OpaqueActivity(Element opaqueActivityElement) {
OpaqueActivity opaqueActivity = BPELFactory.eINSTANCE.createOpaqueActivity();
opaqueActivity.setElement(opaqueActivityElement);
setStandardAttributes(opaqueActivityElement, opaqueActivity);
return opaqueActivity;
}
/**
* Converts an XML valdateXML element to a BPEL ValidateXML object.
*/
protected Activity xml2Validate(Element validateElement) {
final Validate validate = BPELFactory.eINSTANCE.createValidate();
validate.setElement(validateElement);
setStandardAttributes(validateElement, validate);
if (validateElement.hasAttribute("variables")) {
String variables = validateElement.getAttribute("variables");
StringTokenizer st = new StringTokenizer(variables);
while (st.hasMoreTokens()) {
final String variableName = st.nextToken();
// We must do this as a post load runnable because the variable might not
// exist yet.
fPass2Runnables.add(new Runnable() {
public void run() {
Variable targetVariable = getVariable(validate, variableName);
if (targetVariable == null) {
targetVariable = new VariableProxy(getResource().getURI(), variableName);
}
validate.getVariables().add(targetVariable);
}
});
}
}
return validate;
}
/**
* Converts an XML rethrow element to a BPEL Rethrow object.
*/
protected Activity xml2Rethrow(Element rethrowElement) {
Rethrow rethrow = BPELFactory.eINSTANCE.createRethrow();
rethrow.setElement(rethrowElement);
setStandardAttributes(rethrowElement, rethrow);
return rethrow;
}
/**
* Converts an XML extensionactivity element to a BPEL ExtensionActivity object.
*/
protected Activity xml2ExtensionActivity(Element extensionActivityElement) {
// Do not call setStandardAttributes here because extensionActivityElement
// doesn't have them.
Activity extensionActivity = BPELFactory.eINSTANCE.createExtensionActivity();
// Find the child element.
List<Element> nodeList = getChildElements(extensionActivityElement);
if (nodeList.size() == 1) {
final Element child = nodeList.get(0);
// We found a child element. Look up a deserializer for this
// activity and call it.
String localName = child.getLocalName();
String namespace = child.getNamespaceURI();
final QName qname = new QName(namespace, localName);
final BPELActivityDeserializer deserializer = extensionRegistry.getActivityDeserializer(qname);
if (deserializer != null) {
// Deserialize the DOM element and return the new Activity
final Map<String,String> nsMap = getAllNamespacesForElement(child);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=334424
extensionActivity = deserializer.unmarshall(qname,child,extensionActivity,process,nsMap,extensionRegistry, getResource().getURI(), this);
// Now let's do the standard attributes and elements
setStandardAttributes(child, extensionActivity);
setStandardElements(child, extensionActivity);
// Don't do extensibility because extensionActivity is not extensible.
// If individual extensionActivity subclasses are actually extensible, they
// have to do this themselves in their deserializer.
// The created Activity that extends from ExtensioActivity should get the
// whole <extensionActivity>-DOM-Fragment, this is done here.
extensionActivity.setElement(extensionActivityElement);
final Activity ea = extensionActivity;
// Bug 120110 - run the deserializer again so it can resolve references to
// objects that were not fully realized in pass 1.
fPass2Runnables.add(new Runnable() {
public void run() {
deserializer.unmarshall(qname,child,ea,process,nsMap,extensionRegistry, getResource().getURI(), BPELReader.this);
}
});
return extensionActivity;
}
}
// Fallback is to create a new extensionActivity.
// Bugzilla 324115
setStandardAttributes(extensionActivityElement, extensionActivity);
setStandardElements(extensionActivityElement, extensionActivity);
extensionActivity.setElement(extensionActivityElement);
return extensionActivity;
}
/**
* Converts an XML wait element to a BPEL Wait object.
*/
protected Activity xml2Wait(Element waitElement) {
Wait wait = BPELFactory.eINSTANCE.createWait();
wait.setElement(waitElement);
// Set name
Attr name = waitElement.getAttributeNode("name");
if (name != null && name.getSpecified())
wait.setName(name.getValue());
// Set for element
Element forElement = getBPELChildElementByLocalName(waitElement, "for");
if (forElement != null) {
Expression expression = xml2Expression(forElement);
wait.setFor(expression);
}
// Set until element
Element untilElement = getBPELChildElementByLocalName(waitElement, "until");
if (untilElement != null) {
Expression expression = xml2Expression(untilElement);
wait.setUntil(expression);
}
setStandardAttributes(waitElement, wait);
return wait;
}
/**
* Converts an XML exit element to a BPEL Exit object.
*/
protected Activity xml2Exit(Element exitElement) {
Exit exit = BPELFactory.eINSTANCE.createExit();
exit.setElement(exitElement);
Attr name = exitElement.getAttributeNode("name");
if (name != null && name.getSpecified())
exit.setName(name.getValue());
setStandardAttributes(exitElement, exit);
return exit;
}
/**
* Converts an XML throw element to a BPEL Throw object.
*/
protected Activity xml2Throw(Element throwElement) {
Throw _throw = BPELFactory.eINSTANCE.createThrow();
_throw.setElement(throwElement);
if (throwElement.hasAttribute("name")) {
_throw.setName(throwElement.getAttribute("name"));
}
if (throwElement.hasAttribute("faultName")) {
QName qName = BPELUtils.createAttributeValue(throwElement, "faultName");
_throw.setFaultName(qName);
}
// Set fault variable name
setVariable(throwElement, _throw, "faultVariable", BPELPackage.eINSTANCE.getThrow_FaultVariable());
setStandardAttributes(throwElement, _throw);
return _throw;
}
/**
* Converts an XML assign element to a BPEL Assign object.
*/
protected Activity xml2Assign(Element assignElement) {
Assign assign = BPELFactory.eINSTANCE.createAssign();
assign.setElement(assignElement);
if (assignElement.hasAttribute("validate")) {
assign.setValidate( Boolean.valueOf( assignElement.getAttribute("validate").equals("yes")));
}
for (Element copyElement : getBPELChildElementsByLocalName(assignElement, "copy") ) {
assign.getCopy().add( xml2Copy ( copyElement ));
}
setStandardAttributes(assignElement, assign);
return assign;
}
/**
* Converts an XML copy element to a BPEL Copy object.
*/
protected Copy xml2Copy(Element copyElement) {
Copy copy = BPELFactory.eINSTANCE.createCopy();
copy.setElement(copyElement);
// Save all the references to external namespaces
saveNamespacePrefix(copy, copyElement);
Element fromElement = getBPELChildElementByLocalName(copyElement, "from");
if (fromElement != null) {
From from = BPELFactory.eINSTANCE.createFrom();
from.setElement(fromElement);
xml2From(from, fromElement);
copy.setFrom(from);
}
Element toElement = getBPELChildElementByLocalName(copyElement, "to");
if (toElement != null) {
To to = BPELFactory.eINSTANCE.createTo();
to.setElement(toElement);
xml2To(to, toElement);
copy.setTo(to);
}
if (copyElement.hasAttribute("keepSrcElementName"))
copy.setKeepSrcElementName( Boolean.valueOf( copyElement.getAttribute("keepSrcElementName").equals("yes")));
if (copyElement.hasAttribute("ignoreMissingFromData"))
copy.setIgnoreMissingFromData( Boolean.valueOf( copyElement.getAttribute("ignoreMissingFromData").equals("yes")));
xml2ExtensibleElement(copy, copyElement);
return copy;
}
/**
* Converts an XML toPart element to a BPEL ToPart object.
*/
protected ToPart xml2ToPart(Element toPartElement) {
ToPart toPart = BPELFactory.eINSTANCE.createToPart();
toPart.setElement(toPartElement);
// Save all the references to external namespaces
saveNamespacePrefix(toPart, toPartElement);
// Set part
Attr part = toPartElement.getAttributeNode("part");
if (part != null && part.getSpecified()) {
final String partAttr = toPartElement.getAttribute("part");
((ToPartImpl) toPart).setPartName(partAttr);
}
// Set fromVariable
setVariable(toPartElement, toPart, "fromVariable", BPELPackage.eINSTANCE.getToPart_FromVariable());
return toPart;
}
/**
* Converts an XML fromPart element to a BPEL FromPart object.
*/
protected FromPart xml2FromPart(Element fromPartElement) {
FromPart fromPart = BPELFactory.eINSTANCE.createFromPart();
fromPart.setElement(fromPartElement);
// Save all the references to external namespaces
saveNamespacePrefix(fromPart, fromPartElement);
// Set part
Attr part = fromPartElement.getAttributeNode("part");
if (part != null && part.getSpecified()) {
final String partAttr = fromPartElement.getAttribute("part");
((FromPartImpl) fromPart).setPartName(partAttr);
}
// Set toVariable
setVariable(fromPartElement, fromPart, "toVariable", BPELPackage.eINSTANCE.getFromPart_ToVariable());
return fromPart;
}
/**
* Converts an XML "to" element to a BPEL To object.
*/
protected To xml2To(To to, Element toElement) {
// The to-spec MUST be one of the following variants:
// 1. <to variable="BPELVariableName" part="NCName"?>
// <query queryLanguage="anyURI"?>?
// queryContent
// </query>
// </to>
//
// 2. <to partnerLink="NCName" />
//
// 3. <to variable="BPELVariableName" property="QName" />
//
// 4. <to expressionLanguage="anyURI"?>expression</to>
//
// 5. <to/>
// Save all the references to external namespaces
saveNamespacePrefix(to, toElement);
// Set variable
Attr variable = toElement.getAttributeNode("variable");
if (variable != null && variable.getSpecified()) {
setVariable(toElement, to, "variable", BPELPackage.eINSTANCE.getAbstractAssignBound_Variable());
}
// Set part
Attr part = toElement.getAttributeNode("part");
if (part != null && part.getSpecified()) {
final String partAttr = toElement.getAttribute("part");
((ToImpl) to).setPartName(partAttr);
}
// Set partnerLink
Attr partnerLink = toElement.getAttributeNode("partnerLink");
if (partnerLink != null && partnerLink.getSpecified()) {
setPartnerLink(toElement, to, BPELPackage.eINSTANCE.getAbstractAssignBound_PartnerLink());
}
// Set property
Attr property = toElement.getAttributeNode("property");
if (property != null && property.getSpecified()) {
setProperties(toElement, to, "property");
}
// Set query element
Element queryElement = getBPELChildElementByLocalName(toElement, "query");
if (queryElement != null) {
Query queryObject = BPELFactory.eINSTANCE.createQuery();
queryObject.setElement(queryElement);
to.setQuery(queryObject);
// Set queryLanguage
if (queryElement.hasAttribute("queryLanguage")) {
String queryLanguage = queryElement.getAttribute("queryLanguage");
queryObject.setQueryLanguage(queryLanguage);
}
// Set query text
// Get the condition text
String data = getText( queryElement );
if (data != null) {
queryObject.setValue(data);
}
} else {
if (partnerLink == null && variable == null){
// must be expression
Expression expressionObject = BPELFactory.eINSTANCE.createExpression();
to.setExpression(expressionObject);
// Set expressionLanguage
if (toElement.hasAttribute("expressionLanguage")) {
expressionObject.setExpressionLanguage(toElement.getAttribute("expressionLanguage"));
}
// Set expression text
// Get the condition text
String data = getText( toElement );
if (data != null) {
expressionObject.setBody(data);
}
}
}
return to;
}
/**
* Converts an XML "from" element to a BPEL From object.
*/
protected From xml2From(From from, Element fromElement) {
/** This is basically what's in xml2To */
// Save all the references to external namespaces
saveNamespacePrefix(from, fromElement);
// Set variable
Attr variable = fromElement.getAttributeNode("variable");
if (variable != null && variable.getSpecified()) {
setVariable(fromElement, from, "variable", BPELPackage.eINSTANCE.getAbstractAssignBound_Variable() );
}
// Set part
Attr part = fromElement.getAttributeNode("part");
if (part != null && part.getSpecified()) {
final String partAttr = fromElement.getAttribute("part");
((FromImpl) from).setPartName(partAttr);
}
// Set partnerLink
Attr partnerLink = fromElement.getAttributeNode("partnerLink");
if (partnerLink != null && partnerLink.getSpecified()) {
setPartnerLink(fromElement, from, BPELPackage.eINSTANCE.getAbstractAssignBound_PartnerLink());
}
// Set property
Attr property = fromElement.getAttributeNode("property");
if (property != null && property.getSpecified()) {
setProperties(fromElement, from, "property");
}
// Set query element
Element queryElement = getBPELChildElementByLocalName(fromElement, "query");
if (queryElement != null) {
Query queryObject = BPELFactory.eINSTANCE.createQuery();
queryObject.setElement(queryElement);
from.setQuery(queryObject);
// Set queryLanguage
if (queryElement.hasAttribute("queryLanguage")) {
String queryLanguage = queryElement.getAttribute("queryLanguage");
queryObject.setQueryLanguage(queryLanguage);
}
// Set query text
// Get the condition text
String data = getText ( queryElement );
if (data != null) {
queryObject.setValue(data);
}
}
Attr endpointReference = fromElement.getAttributeNode("endpointReference");
if (endpointReference != null && endpointReference.getSpecified()) {
from.setEndpointReference(EndpointReferenceRole.get(endpointReference.getValue()));
}
// Set service-ref element
Element serviceRefElement = getBPELChildElementByLocalName(fromElement, "service-ref");
Element literalElement = getBPELChildElementByLocalName(fromElement, "literal");
if (serviceRefElement != null) {
ServiceRef serviceRef = BPELFactory.eINSTANCE.createServiceRef();
// TODO: ? serviceRef.setElement(serviceRefElement);
from.setServiceRef(serviceRef);
// Set reference scheme
if (serviceRefElement.hasAttribute("reference-scheme")) {
String scheme = serviceRefElement.getAttribute("reference-scheme");
serviceRef.setReferenceScheme(scheme);
}
// Set the value of the service reference
// Determine whether or not there is an element in the child list.
Node candidateChild = null;
NodeList nodeList = serviceRefElement.getChildNodes();
int length = nodeList.getLength();
for (int i = 0; i < length; i++) {
Node child = nodeList.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
candidateChild = child;
break;
}
}
if (candidateChild == null) {
candidateChild = serviceRefElement.getFirstChild();
}
String data = getText(candidateChild);
if (data == null) {
// No text or CDATA node. If it's an element node, then
// deserialize and install.
if (candidateChild != null && candidateChild.getNodeType() == Node.ELEMENT_NODE) {
// Look if there's an ExtensibilityElement deserializer for this element
Element childElement = (Element)candidateChild;
QName qname = new QName(childElement.getNamespaceURI(), childElement.getLocalName());
BPELExtensionDeserializer deserializer=null;
try {
deserializer = (BPELExtensionDeserializer)extensionRegistry.queryDeserializer(BPELExtensibleElement.class,qname);
} catch (WSDLException e) {
// nothing
}
if (deserializer != null && !(deserializer instanceof BPELUnknownExtensionDeserializer)) {
// Deserialize the DOM element and add the new Extensibility element to the parent
// BPELExtensibleElement
try {
Map<String,String> nsMap = getAllNamespacesForElement(serviceRefElement);
ExtensibilityElement extensibilityElement=deserializer.unmarshall(BPELExtensibleElement.class,qname,childElement,process,nsMap,extensionRegistry,getResource().getURI(),this);
serviceRef.setValue(extensibilityElement);
} catch (WSDLException e) {
throw new WrappedException(e);
}
} else {
ServiceReferenceDeserializer referenceDeserializer = extensionRegistry.getServiceReferenceDeserializer(serviceRef.getReferenceScheme());
if (referenceDeserializer != null) {
Object serviceReference = referenceDeserializer.unmarshall(childElement, process);
serviceRef.setValue(serviceReference);
}
}
}
} else {
serviceRef.setValue(data);
}
}
// Literal node
if (literalElement != null) {
StringBuilder elementData = new StringBuilder(256);
NodeList nl = literalElement.getChildNodes();
outer : for (int i=0; i < nl.getLength(); i++) {
Node n = nl.item(i);
switch (n.getNodeType()) {
case Node.ELEMENT_NODE :
elementData.setLength(0);
elementData.append(BPELUtils.elementToString((Element)n));
break outer;
case Node.TEXT_NODE :
case Node.CDATA_SECTION_NODE :
// elementData.append( n.getTextContent() );
elementData.append( getText(n) );
break;
}
}
from.setUnsafeLiteral(Boolean.FALSE);
String elementDataFinal = elementData.toString();
if (isEmptyOrWhitespace(elementDataFinal) == false) {
from.setUnsafeLiteral(Boolean.TRUE);
from.setLiteral( elementDataFinal );
}
} else {
// must be expression
Expression expressionObject = BPELFactory.eINSTANCE.createExpression();
from.setExpression(expressionObject);
// Set expressionLanguage
if (fromElement.hasAttribute("expressionLanguage")) {
expressionObject.setExpressionLanguage(fromElement.getAttribute("expressionLanguage"));
}
// Set expression text
// Get the condition text
String data = getText( fromElement );
if (data != null) {
expressionObject.setBody(data);
}
}
// Set opaque
Attr opaque = fromElement.getAttributeNode("opaque");
if (opaque != null && opaque.getSpecified()) {
from.setOpaque( Boolean.valueOf( opaque.getValue().equals("yes")));
}
// See if there is an xsi:type attribue.
if (fromElement.hasAttribute("xsi:type")) {
QName qName = BPELUtils.createAttributeValue(fromElement, "xsi:type");
XSDTypeDefinition type = new XSDTypeDefinitionProxy(getResource().getURI(), qName);
from.setType(type);
}
return from;
}
/**
* Converts an XML assignE4X element to a BPEL Assign object.
*
*/
protected Activity xml2AssignE4X(Element assignE4XElement) {
AssignE4X assignE4X = BPELFactory.eINSTANCE.createAssignE4X();
assignE4X.setElement(assignE4XElement);
//setting Validate Attribute value
if (assignE4XElement.hasAttribute("validate")) {
assignE4X.setValidate( Boolean.valueOf( assignE4XElement.getAttribute("validate").equals("yes")));
}
// Reading "extensionAssignOperation" Elements and adding them in to assignE4X
for (Element extensionAssignOperationElement : getBPELChildElementsByLocalName(assignE4XElement, "extensionAssignOperation") ) {
assignE4X.getExtensionAssignOperation().add( xml2ExtensionAssignOperation(extensionAssignOperationElement));
}
setStandardAttributes(assignE4XElement, assignE4X);
return assignE4X;
}
/**
* Converts an XML ExtensionAssignOperation element to a BPEL ExtensionAssignOperation object.
*
*/
protected ExtensionAssignOperation xml2ExtensionAssignOperation(Element extensionAssignOperationElement) {
ExtensionAssignOperation extensionAssignOperation = BPELFactory.eINSTANCE.createExtensionAssignOperation();
extensionAssignOperation.setElement(extensionAssignOperationElement);
// Save all the references to external namespaces
saveNamespacePrefix(extensionAssignOperation, extensionAssignOperationElement);
// Reading snippet Element
Element snippetElement = getSnippet(extensionAssignOperationElement);
if (snippetElement != null) {
Snippet snippet = BPELFactory.eINSTANCE.createSnippet();
snippet.setElement(snippetElement);
xml2Snippet(snippet, snippetElement);
extensionAssignOperation.setSnippet(snippet);
}
xml2ExtensibleElement(extensionAssignOperation, extensionAssignOperationElement);
return extensionAssignOperation;
}
/**
* returns a Snippet element from parent ExtensionAssignperation
* @param parentElement
* @return
*/
private Element getSnippet(Element parentElement) {
String localName = "snippet";
// Reading child nodes and check for localName is equal to "snippet"
// by default snippet element is the first child of extensionAssignOperation element
// in this implementation.
NodeList children = parentElement.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if (localName.equals(node.getLocalName())) {
return (Element) node;
}
}
return null;
}
/**
* Converts an XML Snippet element to a Snippet object.
*/
protected Snippet xml2Snippet(Snippet snippet,Element snippetElement)
{
// Save all the references to external namespaces
saveNamespacePrefix(snippet, snippetElement);
if (snippetElement == null) {
return snippet;
}
//reading body of the snippet and add it into the Snippet object
String data = getText(snippetElement);
if (data != null) {
snippet.setBody(data);
}
return snippet;
}
/**
* Converts an XML import element to a BPEL Import object.
*/
protected Import xml2Import(Element importElement) {
if (!importElement.getLocalName().equals("import"))
return null;
Import imp = BPELFactory.eINSTANCE.createImport();
imp.setElement(importElement);
// Save all the references to external namespaces
saveNamespacePrefix(imp, importElement);
// namespace
if (importElement.hasAttribute("namespace"))
imp.setNamespace(importElement.getAttribute("namespace"));
// location
if (importElement.hasAttribute("location"))
imp.setLocation(importElement.getAttribute("location"));
// importType
if (importElement.hasAttribute("importType"))
imp.setImportType(importElement.getAttribute("importType"));
return imp;
}
/**
* Converts an XML invoke element to a BPEL Invoke object.
*/
protected Activity xml2Invoke(Element invokeElement) {
Invoke invoke = BPELFactory.eINSTANCE.createInvoke();
invoke.setElement(invokeElement);
// Set several parms
setStandardAttributes(invokeElement, invoke);
setOperationParms(invokeElement, invoke, null, BPELPackage.eINSTANCE.getInvoke_InputVariable(), BPELPackage.eINSTANCE.getInvoke_OutputVariable(), BPELPackage.eINSTANCE.getPartnerActivity_PartnerLink());
// Set compensationHandler
setCompensationHandler(invokeElement, invoke);
// Set the fault handler (for catche-s and catchAll-s)
FaultHandler faultHandler = xml2FaultHandler(invokeElement);
if (faultHandler != null && (!faultHandler.getCatch().isEmpty() || faultHandler.getCatchAll() != null)) {
// Only set this on the activity if there is at least one catch clause, or a catchAll clause
invoke.setFaultHandler(faultHandler);
}
Element toPartsElement = getBPELChildElementByLocalName(invokeElement, "toParts");
if (toPartsElement != null) {
ToParts toParts = xml2ToParts(toPartsElement);
invoke.setToParts(toParts);
}
// Set fromParts
Element fromPartsElement = getBPELChildElementByLocalName(invokeElement, "fromParts");
if (fromPartsElement != null) {
FromParts fromParts = xml2FromParts(fromPartsElement);
invoke.setFromParts(fromParts);
}
// Set failureHandling
NodeList children = invokeElement.getChildNodes();
Element failureHandlingElement = null;
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if ("failureHandling".equals(node.getLocalName())){
failureHandlingElement= (Element) node;
break;
}
}
if (failureHandlingElement != null) {
FailureHandling failureHandling = xml2FailureHandling(failureHandlingElement);
invoke.setFailureHandling(failureHandling);
}
return invoke;
}
/**
* Converts an XML reply element to a BPEL Reply object.
*/
protected Activity xml2Reply(Element replyElement) {
Reply reply = BPELFactory.eINSTANCE.createReply();
reply.setElement(replyElement);
// Set several parms
setStandardAttributes(replyElement, reply);
setOperationParms(replyElement, reply, BPELPackage.eINSTANCE.getReply_Variable(), null, null, BPELPackage.eINSTANCE.getPartnerActivity_PartnerLink());
if (replyElement.hasAttribute("faultName")) {
QName qName = BPELUtils.createAttributeValue(replyElement, "faultName");
reply.setFaultName(qName);
}
Element toPartsElement = getBPELChildElementByLocalName(replyElement, "toParts");
if (toPartsElement != null) {
ToParts toParts = xml2ToParts(toPartsElement);
reply.setToParts(toParts);
}
// Set messageExchange
setMessageExchange(replyElement, reply, BPELPackage.eINSTANCE.getReply_MessageExchange());
return reply;
}
/**
* Converts an XML receive element to a BPEL Receive object.
*/
protected Activity xml2Receive(Element receiveElement) {
Receive receive = BPELFactory.eINSTANCE.createReceive();
receive.setElement(receiveElement);
// Set several parms
setStandardAttributes(receiveElement, receive);
setOperationParms(receiveElement, receive, BPELPackage.eINSTANCE.getReceive_Variable(), null, null, BPELPackage.eINSTANCE.getPartnerActivity_PartnerLink());
// Set createInstance
if (receiveElement.hasAttribute("createInstance")) {
String createInstance = receiveElement.getAttribute("createInstance");
receive.setCreateInstance( Boolean.valueOf( createInstance.equals("yes")));
}
Element fromPartsElement = getBPELChildElementByLocalName(receiveElement, "fromParts");
if (fromPartsElement != null) {
FromParts fromParts = xml2FromParts(fromPartsElement);
receive.setFromParts(fromParts);
}
// Set messageExchange
setMessageExchange(receiveElement, receive, BPELPackage.eINSTANCE.getReceive_MessageExchange());
return receive;
}
/**
* Sets a MessageExchange element for a given EObject. The given activity
* element must contain an attribute named "messageExchange".
*
* @param activityElement
* the DOM element of the activity
* @param eObject
* the EObject in which to set the partner link
*/
protected void setMessageExchange(Element activityElement, final EObject eObject, final EReference reference) {
if (!activityElement.hasAttribute("messageExchange")) {
return;
}
final String messageExchangeName = activityElement.getAttribute("messageExchange");
// We must do this as a post load runnable because the partner link might not
// exist yet.
fPass2Runnables.add(new Runnable() {
public void run() {
MessageExchange targetMessageExchange = BPELUtils.getMessageExchange(eObject, messageExchangeName);
if (targetMessageExchange == null) {
targetMessageExchange = new MessageExchangeProxy(getResource().getURI(), messageExchangeName);
}
eObject.eSet(reference, targetMessageExchange);
}
});
}
/**
* Converts an XML forEach element to a BPEL ForEach object.
*/
protected Activity xml2ForEach(Element forEachElement) {
ForEach forEach = BPELFactory.eINSTANCE.createForEach();
forEach.setElement(forEachElement);
// Set several parms
setStandardAttributes(forEachElement, forEach);
if (forEachElement.hasAttribute("parallel")) {
forEach.setParallel(forEachElement.getAttribute("parallel").equals("yes"));
}
// Set counterName variable
if (forEachElement.hasAttribute("counterName")) {
Variable variable = BPELFactory.eINSTANCE.createVariable();
// TODO: How to facade this ?
variable.setName(forEachElement.getAttribute("counterName"));
QName qName = new QName(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "unsignedInt");
XSDTypeDefinition type = new XSDTypeDefinitionProxy(getResource().getURI(), qName);
variable.setType(type);
forEach.setCounterName(variable);
}
// Set startCounterValue element
Element startCounterValueElement = getBPELChildElementByLocalName(forEachElement, "startCounterValue");
if (startCounterValueElement != null) {
Expression expression = xml2Expression(startCounterValueElement);
forEach.setStartCounterValue(expression);
}
// Set finalCounterValue element
Element finalCounterValueElement = getBPELChildElementByLocalName(forEachElement, "finalCounterValue");
if (finalCounterValueElement != null) {
Expression expression = xml2Expression(finalCounterValueElement);
forEach.setFinalCounterValue(expression);
}
// Set completionCondition element
Element completionConditionElement = getBPELChildElementByLocalName(forEachElement, "completionCondition");
if (completionConditionElement != null) {
CompletionCondition completionCondition = xml2CompletionCondition(completionConditionElement);
forEach.setCompletionCondition(completionCondition);
}
// Set activity
Activity activity = getChildActivity(forEachElement);
if (activity instanceof Scope) {
forEach.setActivity(activity);
}
return forEach;
}
/**
* Converts an XML completionCondition element to a BPEL CompletionCondition object.
*/
protected CompletionCondition xml2CompletionCondition(Element completionConditionElement) {
CompletionCondition completionCondition = BPELFactory.eINSTANCE.createCompletionCondition();
completionCondition.setElement(completionConditionElement);
// Set branches element
Element branchesElement = getBPELChildElementByLocalName(completionConditionElement, "branches");
if (branchesElement != null) {
Branches branches = xml2Branches(branchesElement);
completionCondition.setBranches(branches);
}
return completionCondition;
}
/**
* Converts an XML branches element to a BPEL Branches object.
*/
protected Branches xml2Branches(Element branchesElement) {
Branches branches = BPELFactory.eINSTANCE.createBranches();
branches.setElement(branchesElement);
xml2Expression(branchesElement, branches);
if (branchesElement.hasAttribute("successfulBranchesOnly"))
branches.setCountCompletedBranchesOnly( Boolean.valueOf( branchesElement.getAttribute("successfulBranchesOnly").equals("yes")));
return branches;
}
/**
* Converts an XML documentation element to a BPEL Documentation object.
*/
protected Documentation xml2Documentation(Element documentationElement) {
Documentation documentation = BPELFactory.eINSTANCE.createDocumentation();
documentation.setElement(documentationElement);
if (documentationElement.hasAttribute("xml:lang")) {
documentation.setLang(documentationElement.getAttribute("xml:lang"));
}
if (documentationElement.hasAttribute("source")) {
documentation.setSource(documentationElement.getAttribute("source"));
}
String text = getText(documentationElement);
if (text != null) {
documentation.setValue(text);
}
return documentation;
}
/**
* Converts an XML repeatUntil element to a BPEL RepeatUntil object.
*/
protected Activity xml2RepeatUntil(Element repeatUntilElement) {
RepeatUntil repeatUntil = BPELFactory.eINSTANCE.createRepeatUntil();
repeatUntil.setElement(repeatUntilElement);
// Set several parms
setStandardAttributes(repeatUntilElement, repeatUntil);
// Handle condition element
Element conditionElement = getBPELChildElementByLocalName(repeatUntilElement, "condition");
if (conditionElement != null) {
Condition condition = xml2Condition(conditionElement);
repeatUntil.setCondition(condition);
}
NodeList repeatUntilElements = repeatUntilElement.getChildNodes();
Element activityElement = null;
if (repeatUntilElements != null && repeatUntilElements.getLength() > 0) {
for (int i = 0; i < repeatUntilElements.getLength(); i++) {
if (repeatUntilElements.item(i).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
activityElement = (Element)repeatUntilElements.item(i);
Activity activity = xml2Activity(activityElement);
if (activity != null) {
repeatUntil.setActivity(activity);
break;
}
}
}
return repeatUntil;
}
protected Correlations xml2Correlations(Element correlationsElement) {
if (!correlationsElement.getLocalName().equals("correlations"))
return null;
Correlations correlations = BPELFactory.eINSTANCE.createCorrelations();
correlations.setElement(correlationsElement);
// Save all the references to external namespaces
saveNamespacePrefix(correlations, correlationsElement);
for(Element e : getBPELChildElementsByLocalName(correlationsElement, "correlation")) {
correlations.getChildren().add( xml2Correlation(e));
}
// extensibility elements
xml2ExtensibleElement(correlations, correlationsElement);
return correlations;
}
/**
* Converts an XML correlation element to a BPEL Correlation object.
*/
protected Correlation xml2Correlation(Element correlationElement) {
final Correlation correlation = BPELFactory.eINSTANCE.createCorrelation();
correlation.setElement(correlationElement);
// Save all the references to external namespaces
saveNamespacePrefix(correlation, correlationElement);
if (correlationElement == null) return correlation;
// Set set
if (correlationElement.hasAttribute("set")) {
final String correlationSetName = correlationElement.getAttribute("set");
fPass2Runnables.add(new Runnable() {
public void run() {
CorrelationSet cSet = BPELUtils.getCorrelationSetForActivity(correlation, correlationSetName);
if (cSet == null) {
cSet = new CorrelationSetProxy(getResource().getURI(), correlationSetName);
}
correlation.setSet(cSet);
}
});
}
// Set initiation
Attr initiation = correlationElement.getAttributeNode("initiate");
if (initiation != null && initiation.getSpecified()) {
if (initiation.getValue().equals("yes"))
correlation.setInitiate("yes");
else if (initiation.getValue().equals("no"))
correlation.setInitiate("no");
else if (initiation.getValue().equals("join"))
correlation.setInitiate("join");
}
// Set pattern
Attr pattern = correlationElement.getAttributeNode("pattern");
if (pattern != null && pattern.getSpecified()) {
if (pattern.getValue().equals("request"))
correlation.setPattern(CorrelationPattern.REQUEST_LITERAL);
else if (pattern.getValue().equals("response"))
correlation.setPattern(CorrelationPattern.RESPONSE_LITERAL);
else if (pattern.getValue().equals("request-response"))
correlation.setPattern(CorrelationPattern.REQUESTRESPONSE_LITERAL);
}
xml2ExtensibleElement(correlation, correlationElement);
return correlation;
}
protected Compensate xml2Compensate(Element compensateElement) {
final Compensate compensate = BPELFactory.eINSTANCE.createCompensate();
compensate.setElement(compensateElement);
setStandardAttributes(compensateElement, compensate);
return compensate;
}
protected CompensateScope xml2CompensateScope (Element compensateScopeElement) {
final CompensateScope compensateScope = BPELFactory.eINSTANCE.createCompensateScope();
compensateScope.setElement(compensateScopeElement);
final String target = compensateScopeElement.getAttribute("target");
if (target != null && target.length() > 0) {
fPass2Runnables.add(new Runnable() {
public void run() {
compensateScope.setTarget(target);
}
});
}
setStandardAttributes(compensateScopeElement, compensateScope);
return compensateScope;
}
/**
* Converts an XML extensible element to a BPEL extensible element
*/
protected void xml2ExtensibleElement (BPELExtensibleElement extensibleElement, Element element) {
if (extensionRegistry == null) {
return;
}
// Handle the documentation element first
Element documentationElement = getBPELChildElementByLocalName(element, "documentation");
if (documentationElement != null) {
Documentation documentation = xml2Documentation(documentationElement);
extensibleElement.setDocumentation(documentation);
}
// Get the child nodes, elements and attributes
List<Node> nodes=new ArrayList<Node>();
NodeList nodeList = element.getChildNodes();
for (int i=0, n=nodeList.getLength(); i<n; i++) {
if (nodeList.item(i) instanceof Element) {
final String namespaceURI = ((Element)nodeList.item(i)).getNamespaceURI();
if (!(BPELConstants.isBPELNamespace(namespaceURI)))
nodes.add(nodeList.item(i));
}
}
NamedNodeMap nodeMap=element.getAttributes();
for (int i=0, n=nodeMap.getLength(); i<n; i++) {
Attr attr = (Attr)nodeMap.item(i);
if (attr.getNamespaceURI() != null && !attr.getNamespaceURI().equals(XSDConstants.XMLNS_URI_2000)) {
nodes.add(attr);
}
}
for (Node node : nodes ) {
// TODO What is this check for? If we're actually checking for
// the BPEL namespace, use BPELConstants instead.
if (MessagepropertiesConstants.isMessagePropertiesNamespace(node.getNamespaceURI())) {
continue;
}
if (node.getNodeType() == Node.ELEMENT_NODE) {
deserialize ( extensibleElement, (Element) node);
} else if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
deserialize ( extensibleElement, (Attr) node);
}
}
}
protected void deserialize ( BPELExtensibleElement ee, Element elm ) {
QName qname = new QName(elm.getNamespaceURI(),elm.getLocalName());
BPELExtensionDeserializer deserializer = null;
try {
deserializer = (BPELExtensionDeserializer)extensionRegistry.queryDeserializer (BPELExtensibleElement.class,qname);
} catch (WSDLException e) {
// we don't have one.
}
if (deserializer == null) {
return ;
}
// Deserialize the DOM element and add the new Extensibility element to the parent
// BPELExtensibleElement
Map<String,String> nsMap = getAllNamespacesForElement (elm);
try {
ExtensibilityElement extensibilityElement = deserializer.unmarshall(ee.getClass(),qname,elm,process,nsMap,extensionRegistry,getResource().getURI(),this);
ee.addExtensibilityElement(extensibilityElement);
} catch (WSDLException e) {
throw new WrappedException(e);
}
}
protected void deserialize ( BPELExtensibleElement ee, Attr attr) {
if (attr.getSpecified() == false) {
return ;
}
QName qname = new QName (attr.getNamespaceURI(),"extensibilityAttributes");
BPELExtensionDeserializer deserializer = null;
try {
deserializer = (BPELExtensionDeserializer) extensionRegistry.queryDeserializer(BPELExtensibleElement.class,qname);
} catch (WSDLException e) {
// ignore
}
if (deserializer == null) {
return ;
}
// Create a temp element to host the extensibility attribute
//
// This turns something that looks like this:
// <bpws:X someNS:Y="Z"/>
// into something that looks like this:
// <someNS:extensibilityAttributes xmlns:someNS="http://the.namespace" Y="Z"/>
Element tempElement = attr.getOwnerDocument().createElementNS(attr.getNamespaceURI(), attr.getPrefix() + ":extensibilityAttributes");
tempElement.setAttribute(BPELUtils.ATTR_XMLNS + ":" + attr.getPrefix(), attr.getNamespaceURI());
tempElement.setAttribute(attr.getLocalName(), attr.getNodeValue());
// Deserialize the temp DOM element and add the new Extensibility element to the parent
// BPELExtensibleElement
Map<String,String> nsMap = getAllNamespacesForElement( (Element) attr.getParentNode() );
try {
ExtensibilityElement extensibilityElement = deserializer.unmarshall(BPELExtensibleElement.class,qname,tempElement,process,nsMap,extensionRegistry,getResource().getURI(),this);
if (extensibilityElement!=null) {
ee.addExtensibilityElement (extensibilityElement);
}
} catch (WSDLException e) {
throw new WrappedException(e);
}
}
/**
* Checks for process type
* @param processElement
* @return true if process is abstract, false otherwise
*/
public boolean isAbstractProcess(Element processElement)
{
if (processElement != null) {
Map<String, String> nsMap = this.getAllNamespacesForElement(processElement);
if (nsMap.containsValue(BPELConstants.NAMESPACE_ABSTRACT_2007))
{
return true;
}
}
return false;
}
/**
* returns abstract process profile
* @param processElement
* @return namespace of abstract process profile
*/
public String getProfileNamespace(Element processElement)
{
if (processElement.getAttribute(BPELConstants.AT_ABSTRACT_PROFILES) != null){
return processElement.getAttribute(BPELConstants.AT_ABSTRACT_PROFILES);
}
return null;
}
/**
* Returns true if the string is either null or contains just whitespace.
* @param value
* @return true if empty or whitespace, false otherwise.
*/
static public boolean isEmptyOrWhitespace( String value )
{
if( value == null || value.length() == 0) {
return true;
}
for( int i = 0, j = value.length(); i < j; i++ )
{
if( ! Character.isWhitespace( value.charAt(i) ) ) {
return false;
}
}
return true;
}
/**
* Returns the text of the given node. If the node is an element node, its
* children text value is returned. Otherwise, the node is assumed to be
* the first child node and the siblings sequence is scanned.
*
*
*/
String getText (Node node) {
StringBuilder sb = new StringBuilder(128);
if (node instanceof Element) {
node = ((Element)node).getFirstChild();
}
boolean bCData = false;
while (node != null) {
switch (node.getNodeType()) {
case Node.TEXT_NODE :
if (bCData) {
break;
}
Text text = (Text) node;
sb.append(text.getData());
break;
case Node.CDATA_SECTION_NODE :
if (bCData == false) {
sb.setLength(0);
bCData = true;
}
CDATASection cdata = (CDATASection) node;
sb.append( cdata.getData() );
break;
}
node = node.getNextSibling();
}
String data = sb.toString();
if (isEmptyOrWhitespace(data)) {
return null;
}
return data;
}
/**
* @param eObject
* @param variableName
* @return the resolved variable
*/
public static Variable getVariable(EObject eObject, String variableName) {
return VARIABLE_RESOLVER.getVariable(eObject, variableName);
}
/**
* @param activity
* @param linkName
* @return the resolved link
*/
public static Link getLink(Activity activity, String linkName) {
return LINK_RESOLVER.getLink(activity, linkName);
}
/**
* @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
*/
@SuppressWarnings("boxing")
public void error (SAXParseException exception) {
String message = java.text.MessageFormat.format(
"Error in {0} [{2}:{3}] {4}",
exception.getPublicId(),
exception.getSystemId(),
exception.getLineNumber(),
exception.getColumnNumber(),
exception.getLocalizedMessage()
);
BPELPlugin.logMessage(message, exception, IStatus.ERROR);
// Bugzilla 324165
// add the error to resource
if (fCurrentResource!=null)
fCurrentResource.getErrors().add(new SAXParseDiagnostic(exception, SAXParseDiagnostic.ERROR));
}
/**
* @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
*/
@SuppressWarnings("boxing")
public void fatalError(SAXParseException exception) {
String message = java.text.MessageFormat.format(
"Fatal Error in {0} [{2}:{3}] {4}",
exception.getPublicId(),
exception.getSystemId(),
exception.getLineNumber(),
exception.getColumnNumber(),
exception.getLocalizedMessage()
);
BPELPlugin.logMessage(message, exception, IStatus.ERROR);
// Bugzilla 324165
// add the error to resource
if (fCurrentResource!=null)
fCurrentResource.getErrors().add(new SAXParseDiagnostic(exception, SAXParseDiagnostic.FATAL_ERROR));
}
/**
* @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
*/
@SuppressWarnings("boxing")
public void warning (SAXParseException exception) {
String message = java.text.MessageFormat.format(
"Warning in {0} [{2}:{3}] {4}",
exception.getPublicId(),
exception.getSystemId(),
exception.getLineNumber(),
exception.getColumnNumber(),
exception.getLocalizedMessage()
);
BPELPlugin.logMessage(message, exception, IStatus.WARNING);
// Bugzilla 324165
// add the error to resource
if (fCurrentResource!=null)
fCurrentResource.getErrors().add(new SAXParseDiagnostic(exception, SAXParseDiagnostic.WARNING));
}
}
| [
"mail.hasitha27@gmail.com"
] | mail.hasitha27@gmail.com |
37f220cabdca77cb3eadd93d685def9f0bd9f496 | c84b6d66be3d7545452e9916f3809861a668a88f | /app/src/main/java/com/further/run/anno/BindId.java | e47c28b10243ad615b8e6287ec7944df85161c1b | [] | no_license | smilewant/A-J | 874d89d97be773ec1e4a98f57f2a5f3015eceb4e | 7dda68d3ea78f5579132d0e52bd03c6f48dde5b5 | refs/heads/master | 2021-08-08T09:22:03.144055 | 2021-06-21T05:50:18 | 2021-06-21T05:50:18 | 171,210,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.further.run.anno;
import android.view.View;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Created by Hukuan
* 2018/5/18.
*/
@Retention(RetentionPolicy.RUNTIME)
//@Target({FIELD, TYPE})
public @interface BindId {
int value() default View.NO_ID;
}
| [
"www9890323"
] | www9890323 |
75b2aea7700a3d5b3469050bea0cb24e2a037324 | 4bb48b8994aaa1bb247531227d9dd86a1292b5ce | /src/test/java/ru/tw1911/java/ee/test/OperationStageCrudServiceDBIntTest.java | 1ddaf0480156f09495e18ad2bcf8aa1aff1ed225 | [] | no_license | tw1911/Test_JavaEE | d43e36546521292283b1823eafa318adc1bca0e6 | 2c66b7a0d55c4a138024f33848882c3fb44d4bf3 | refs/heads/master | 2020-04-12T04:11:57.486088 | 2018-12-18T14:56:11 | 2018-12-18T14:56:11 | 162,288,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,051 | java | package ru.tw1911.java.ee.test;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import ru.tw1911.java.ee.test.entity.OperationStage;
import ru.tw1911.java.ee.test.entity.OperationStageCode;
import ru.tw1911.java.ee.test.entity.OperationType;
import ru.tw1911.java.ee.test.entity.OperationTypeCode;
import ru.tw1911.java.ee.test.service.OperationStageCrudService;
import ru.tw1911.java.ee.test.service.OperationTypeCrudService;
import javax.persistence.EntityNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest
public class OperationStageCrudServiceDBIntTest {
OperationType operation1,operation2,operation3;
OperationStage stage1,stage2,stage3,stage4;
@Autowired
OperationTypeCrudService typeService;
@Autowired
OperationStageCrudService stageService;
List<OperationType> types = new ArrayList<>();
List<OperationStage> stages = new ArrayList<>();
@Before
public void setUp(){
typeService.deleteAll();
stageService.deleteAll();
stage1 = new OperationStage("Stage 1", OperationStageCode.DONE);
stage2 = new OperationStage("Stage 2", OperationStageCode.PROGRESS);
stage3 = new OperationStage("Stage 3", OperationStageCode.CREATED);
stage4 = new OperationStage("Stage 4", OperationStageCode.ABORTED);
Collections.addAll(stages,stage1,stage2,stage3);
operation1 = new OperationType("Operation 1", OperationTypeCode.CREATE);
operation2 = new OperationType("Operation 2", OperationTypeCode.UPDATE);
operation3 = new OperationType("Operation 3", OperationTypeCode.READ);
Collections.addAll(types,operation1,operation2,operation3);
types.forEach(type -> type.setOperStages(stages));
}
@Test
public void createTest(){
OperationStage st1 = stageService.create(stage1);
OperationStage fromDb = stageService.read(st1.getId());
Assert.assertEquals(st1.getId(),fromDb.getId());
Assert.assertEquals(st1.getOperationStageName(),fromDb.getOperationStageName());
Assert.assertEquals(st1.getOperStageCode(),fromDb.getOperStageCode());
}
@Test
public void createAllTest(){
Assert.assertEquals(stageService.readAll().size(),0);
stageService.createAll(stages);
Assert.assertEquals(stageService.readAll().size(),stages.size());
}
@Test
public void readTest(){
stageService.createAll(stages);
Assert.assertEquals(stageService.read(stages.get(0).getId()).getOperationStageName(),stage1.getOperationStageName());
}
@Test
public void readAllTest(){
Assert.assertEquals(stageService.createAll(stages).size(),stageService.readAll().size());
}
@Test
public void updateTest(){
stageService.create(stage4);
stage4.setOperStageCode(OperationStageCode.CREATED);
stageService.update(stage4);
Assert.assertEquals(stage4.getOperStageCode(),stageService.read(stage4.getId()).getOperStageCode());
}
@Test(expected = EntityNotFoundException.class)
public void updateNotExist(){
stageService.update(stage4);
}
@Test
public void deleteTest(){
typeService.createAll(types);
OperationStage fromDb = stageService.readAll().get(0);
stageService.delete(fromDb);
Assert.assertEquals(stageService.readAll().size(),stages.size()-1);
}
@Test
public void deleteAllTest(){
typeService.createAll(types);
Assert.assertEquals(stageService.readAll().size(),stages.size());
stageService.deleteAll();
Assert.assertEquals(stageService.readAll().size(),0);
}
@After
public void shutDown(){
}
}
| [
"rrumyantsev@cinimex.ru"
] | rrumyantsev@cinimex.ru |
771be8ef9aa425c446bcd03651262fde9a0736d0 | 51405b6c9e104e685fa523802ae8aa7dcf515aa3 | /src/me/ukl/hmod/partynet/PartyNetHandler.java | cca9750cee6c8d76915edfb3c59e5408ee22b11f | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | Herocraft/HeroMod | 7917788349186d9e3defe2bb9cb37f58cf2e702e | dc19e08cb75309a7263f7c21422bd57fa3f998d7 | refs/heads/master | 2021-01-21T00:21:16.887039 | 2015-04-09T21:07:33 | 2015-04-09T21:07:33 | 31,568,851 | 0 | 0 | null | 2015-03-02T23:18:55 | 2015-03-02T23:18:55 | null | UTF-8 | Java | false | false | 4,641 | java | package me.ukl.hmod.partynet;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.net.Socket;
import java.net.SocketException;
import java.util.Queue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import net.minecraft.client.Minecraft;
import me.ukl.hmod.partynet.recv.PartyPacketReceive;
import me.ukl.hmod.partynet.recv.PartyPacketReceiveHealth;
import me.ukl.hmod.partynet.recv.PartyPacketReceiveMana;
import me.ukl.hmod.partynet.recv.PartyPacketReceiveName;
import me.ukl.hmod.partynet.recv.PartyPacketReceivePosition;
import me.ukl.hmod.partynet.send.PartyPacket;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonReader;
public class PartyNetHandler {
private Socket sock;
private ReadThread reader;
private WriteThread writer;
public PartyNetHandler() {
}
public void connect(String host, int port) throws IOException {
sock = new Socket(host, port);
sock.setTcpNoDelay(true);
reader = new ReadThread(sock.getInputStream());
writer = new WriteThread(sock.getOutputStream());
new Thread(reader).start();
new Thread(writer).start();
new Thread() {
@Override
public void run() {
while (true) {
if (Minecraft.getMinecraft().theWorld == null && PartyNetHandler.this.sock != null) {
try {
PartyNetHandler.this.disconnect();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else if (PartyNetHandler.this.sock == null) {
return;
}
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}.start();
}
public void disconnect() throws IOException {
if (sock != null) {
reader.running.set(false);
writer.running.set(false);
sock.close();
reader = null;
writer = null;
sock = null;
}
}
public void send(PartyPacket pkt) {
if (sock != null && !sock.isClosed()) {
writer.writeQueue.add(pkt);
}
}
public PartyPacketReceive poll() {
return reader == null ? null : reader.readQueue.poll();
}
}
class ReadThread implements Runnable {
public Queue<PartyPacketReceive> readQueue = new ConcurrentLinkedQueue<PartyPacketReceive>();
public AtomicBoolean running = new AtomicBoolean(true);
private JsonReader reader;
private Gson gson;
public ReadThread(InputStream in) {
reader = new JsonReader(new BufferedReader(new InputStreamReader(in)));
gson = new Gson();
reader.setLenient(true);
}
@Override
public void run() {
while (running.get()) {
try {
JsonObject obj = gson.fromJson(reader, JsonObject.class);
if (obj == null || !obj.has("name")) {
continue;
}
String name = obj.get("name").getAsString();
PartyPacketReceive rcv = null;
if (obj.has("hp")) {
rcv = new PartyPacketReceiveHealth(obj.get("hp").getAsInt());
} else if (obj.has("mana")) {
rcv = new PartyPacketReceiveMana(obj.get("mana").getAsInt());
} else if (obj.has("fullName")) {
rcv = new PartyPacketReceiveName(obj.get("fullName").getAsString());
} else if (obj.has("x") && obj.has("y") && obj.has("z")) {
int x = obj.get("x").getAsInt();
int y = obj.get("y").getAsInt();
int z = obj.get("z").getAsInt();
rcv = new PartyPacketReceivePosition(x, y, z);
}
if (rcv != null) {
rcv.name = name;
readQueue.add(rcv);
}
} catch (Exception e) {
e.printStackTrace();
return;
}
}
}
}
class WriteThread implements Runnable {
public BlockingQueue<PartyPacket> writeQueue = new LinkedBlockingQueue<PartyPacket>();
public AtomicBoolean running = new AtomicBoolean(true);
private Writer writer;
private Gson gson;
public WriteThread(OutputStream out) {
writer = new BufferedWriter(new OutputStreamWriter(out));
gson = new Gson();
}
@Override
public void run() {
while (running.get()) {
try {
PartyPacket pkt = writeQueue.take();
String json = gson.toJson(pkt);
writer.write(json);
writer.flush();
} catch (InterruptedException e) {
e.printStackTrace();
return;
} catch (IOException e) {
e.printStackTrace();
return;
}
}
}
}
//class ReconnThread implements Runnable {
//
//}
| [
"unknownloner.online@gmail.com"
] | unknownloner.online@gmail.com |
3e6024cc09c31a02eb276e68b06e22c1371afcb6 | 47b6b680783602b32859d0e6936ec2130fd6c216 | /unit4-serviceAccessFromJava/02-part2-commandsAuthenticationAndFileUploading/03-GetCompanies/src/getcompanies/GetCompanies.java | a8ffa19b75a48538404c75f41e0629d8873052bc | [] | no_license | AdrianNavarroGabino/java-nodejs.services-and-processes-course | 601350e9258e6150413d8821b5701eedefebbfec | 3b158e46eaa930a24c1967742fe88bbe936f4ce2 | refs/heads/master | 2023-01-27T12:45:28.370724 | 2020-02-08T11:35:47 | 2020-02-08T11:35:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | // Adrián Navarro Gabino
package getcompanies;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class GetCompanies extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setTitle("Companies Manager");
stage.setScene(scene);
stage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
| [
"adriannavarrogabino@gmail.com"
] | adriannavarrogabino@gmail.com |
fc952a826c8815557599b91dc2bf450e58f0972f | 1ef138a3d43beb51575f9409701a3ee1bae07ecc | /GenericQueue/src/com/uttara/genericqueue/GenericNode.java | 8b94efafc631e6b2497cc0a10fcf7b271efc1c12 | [] | no_license | sanketha1990/datastructures | b5f0d8352676b19eae16bc1d69d8a1cd0d8b28f3 | 4ff8e0c81fbd7b810c1a3881cade55178777442a | refs/heads/master | 2022-12-03T02:49:00.306901 | 2020-08-18T08:59:02 | 2020-08-18T08:59:02 | 288,160,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package com.uttara.genericqueue;
public class GenericNode<T> {
private T data;
private GenericNode<T> next;
public GenericNode(T data) {
super();
this.data = data;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public GenericNode<T> getNext() {
return next;
}
public void setNext(GenericNode<T> next) {
this.next = next;
}
}
| [
"sanketha.cr@reltio.com"
] | sanketha.cr@reltio.com |
604c64578c32b4287da133fb71a1939bd7d9a5f1 | efa527eaf9cd829c319fe7b9f0a29bb744b2e496 | /app/src/main/java/ru/mail/my/towers/service/AppStateService.java | e7504ad6cb6a90bdadae1f9a2e46197d289eaaa5 | [] | no_license | fnail1/towers-android | 9cbfc197d403bbf581013acde1b3cacb00c2ffbb | 21cdd60ab10ffbdc9ccb0995b22d8d04d8c5b24c | refs/heads/master | 2020-07-30T15:02:24.084788 | 2017-02-04T17:55:38 | 2017-02-04T17:55:38 | 73,628,373 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,387 | java | package ru.mail.my.towers.service;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import java.util.HashSet;
import ru.mail.my.towers.toolkit.events.ObservableEvent;
import static ru.mail.my.towers.TowersApp.app;
import static ru.mail.my.towers.TowersApp.prefs;
public class AppStateService {
private static final long BACKGROUND_THRESHOLD = 1 * 60 * 1000;
public final ObservableEvent<DateChangedEventHandler, AppStateService, Void> dateChangedEvent = new ObservableEvent<DateChangedEventHandler, AppStateService, Void>(this) {
@Override
protected void notifyHandler(DateChangedEventHandler handler, AppStateService sender, Void args) {
handler.onDateTimeChanged();
}
};
public final ObservableEvent<AppStateEventHandler, AppStateService, Void> stateEvent = new ObservableEvent<AppStateEventHandler, AppStateService, Void>(this) {
@Override
protected void notifyHandler(AppStateEventHandler handler, AppStateService sender, Void args) {
handler.onAppStateChanged();
}
};
public final ObservableEvent<LowMemoryEventHandler, AppStateService, Void> lowMemoryEvent = new ObservableEvent<LowMemoryEventHandler, AppStateService, Void>(this) {
@Override
protected void notifyHandler(LowMemoryEventHandler handler, AppStateService sender, Void args) {
handler.onLowMemory();
}
};
public final ObservableEvent<ServerTimeOffsetChanged, AppStateService, Void> serverTimeOffsetChangedEvent = new ObservableEvent<ServerTimeOffsetChanged, AppStateService, Void>(this) {
@Override
protected void notifyHandler(ServerTimeOffsetChanged handler, AppStateService sender, Void args) {
handler.onServerTimeOffsetChanged();
}
};
private Activity mTopActivity;
private long serverTimeOffset;
private final HashSet<String> requiredPermissions = new HashSet<>();
public boolean initialized;
private boolean displayCurrentLocation;
private long lastForegroundTS;
public AppStateService(Context context, Preferences preferences) {
serverTimeOffset = preferences.getServerTimeOffset();
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_TIME_CHANGED);
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
filter.addAction(Intent.ACTION_DATE_CHANGED);
context.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
dateChangedEvent.fire(null);
}
}, filter);
initialized = true;
}
public Activity getTopActivity() {
return mTopActivity;
}
public void setTopActivity(@NonNull Activity topActivity) {
if (mTopActivity != topActivity) {
if (mTopActivity == null && SystemClock.elapsedRealtime() - lastForegroundTS > BACKGROUND_THRESHOLD)
displayCurrentLocation = true;
mTopActivity = topActivity;
onStateChanged();
}
}
public void resetTopActivity(@NonNull Context activity) {
if (mTopActivity == activity) {
mTopActivity = null;
lastForegroundTS = SystemClock.elapsedRealtime();
onStateChanged();
}
}
public boolean isForeground() {
return mTopActivity != null;
}
protected void onStateChanged() {
stateEvent.fire(null);
}
public void onLowMemory() {
lowMemoryEvent.fire(null);
}
protected void onServerTimeOffsetChanged() {
serverTimeOffsetChangedEvent.fire(null);
}
public long getServerTime() {
return getServerTime(System.currentTimeMillis());
}
public long getServerTime(long currentTimeMillis) {
return currentTimeMillis + serverTimeOffset;
}
public long getLocalTime(long serverTimeMillis) {
return serverTimeMillis - serverTimeOffset;
}
public void adjustServerTimeOffset(long time) {
long offset = time - System.currentTimeMillis();
if (Math.abs(offset - serverTimeOffset) > 3000) {
serverTimeOffset = offset;
prefs().setServerTimeOffset(serverTimeOffset);
onServerTimeOffsetChanged();
}
}
public void addPermissionRequested(String permission) {
requiredPermissions.add(permission);
}
public void onPermissionGranted(String permission) {
requiredPermissions.remove(permission);
}
public boolean isPermissionRequested(String permission) {
return requiredPermissions.contains(permission);
}
public boolean displayCurrentLocation() {
boolean b = this.displayCurrentLocation;
displayCurrentLocation = false;
return b;
}
public interface AppStateEventHandler {
void onAppStateChanged();
}
public interface LowMemoryEventHandler {
void onLowMemory();
}
public interface ServerTimeOffsetChanged {
void onServerTimeOffsetChanged();
}
public interface DateChangedEventHandler {
void onDateTimeChanged();
}
}
| [
"f.gvozdev@corp.mail.ru"
] | f.gvozdev@corp.mail.ru |
06ba8262a4338b4e729f952ce6f646175f44b756 | a3fd8429109cf9ca0c60253dc2c5c5e74769c1e2 | /Classes/Vehicle.java | c2a1645daddabb5c8578934098bb96a683605940 | [] | no_license | FAST-LAHORE/project-phase-3-cs-a-and-e-safe-city | 3d41da80f5fc7d819d12f0f0845ce0beb3b58f8c | c76edcfd47d79d1113c7f3e1f440dd1cfbb43f49 | refs/heads/master | 2020-04-08T11:49:03.702153 | 2018-12-10T19:17:10 | 2018-12-10T19:17:10 | 159,321,234 | 1 | 1 | null | 2018-12-10T07:36:47 | 2018-11-27T10:56:56 | Java | UTF-8 | Java | false | false | 3,314 | java | package Classes;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
@Entity
@Table(name = "VEHICLE")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Vehicle.findAll", query = "SELECT v FROM Vehicle v"),
@NamedQuery(name = "Vehicle.findByRegistrationnumber", query = "SELECT v FROM Vehicle v WHERE v.registrationnumber = :registrationnumber"),
@NamedQuery(name = "Vehicle.findById", query = "SELECT v FROM Vehicle v WHERE v.id = :id"),
@NamedQuery(name = "Vehicle.findByCnic", query = "SELECT v FROM Vehicle v WHERE v.cnic = :cnic"),
@NamedQuery(name = "Vehicle.findByVehicletype", query = "SELECT v FROM Vehicle v WHERE v.vehicletype = :vehicletype")})
public class Vehicle implements Serializable {
private static final long serialVersionUID = 1L;
@Basic(optional = false)
@Column(name = "REGISTRATIONNUMBER")
private String registrationnumber;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
@Basic(optional = false)
@Column(name = "CNIC")
private String cnic;
@Basic(optional = false)
@Column(name = "VEHICLETYPE")
private String vehicletype;
public Vehicle() {
}
public Vehicle(Integer id) {
this.id = id;
}
public Vehicle(Integer id, String registrationnumber, String cnic, String vehicletype) {
this.id = id;
this.registrationnumber = registrationnumber;
this.cnic = cnic;
this.vehicletype = vehicletype;
}
public String getRegistrationnumber() {
return registrationnumber;
}
public void setRegistrationnumber(String registrationnumber) {
this.registrationnumber = registrationnumber;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCnic() {
return cnic;
}
public void setCnic(String cnic) {
this.cnic = cnic;
}
public String getVehicletype() {
return vehicletype;
}
public void setVehicletype(String vehicletype) {
this.vehicletype = vehicletype;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@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 Vehicle)) {
return false;
}
Vehicle other = (Vehicle) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "modal.Vehicle[ id=" + id + " ]";
}
} | [
"noreply@github.com"
] | noreply@github.com |
dc1236e68a2f1f999b8c8e9263ae71688b47d9cf | 370b6b6e7ffab88824ce7765059c956bc965f87c | /nexus/nexus-core-plugins/nexus-ldap-plugin-parent/ldap-common/src/test/java/org/sonatype/security/ldap/realms/SimpleLdapManager.java | cfcc1d0c9d27eacd0d6eb100ef98aecd5a20bfdb | [] | no_license | peterlynch/nexus-core | d191866de6774e5c7eb76b6e518bf5af9d593bc8 | c3c8e986e396124e028b3d7fa8e3adc25cfe4e3d | refs/heads/master | 2021-01-16T22:54:27.609399 | 2010-10-15T15:53:02 | 2010-10-15T15:53:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,816 | java | /**
// * Sonatype Nexus (TM) Professional Version.
* Copyright (c) 2008 Sonatype, Inc. All rights reserved.
* Includes the third-party code listed at http://www.sonatype.com/products/nexus/attributions/.
* "Sonatype" and "Sonatype Nexus" are trademarks of Sonatype, Inc.
*/
package org.sonatype.security.ldap.realms;
import java.net.MalformedURLException;
import java.util.Set;
import java.util.SortedSet;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.util.StringUtils;
import org.apache.shiro.realm.ldap.LdapContextFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonatype.security.authentication.AuthenticationException;
import org.sonatype.security.ldap.LdapAuthenticator;
import org.sonatype.security.ldap.dao.LdapAuthConfiguration;
import org.sonatype.security.ldap.dao.LdapDAOException;
import org.sonatype.security.ldap.dao.LdapGroupDAO;
import org.sonatype.security.ldap.dao.LdapUser;
import org.sonatype.security.ldap.dao.LdapUserDAO;
import org.sonatype.security.ldap.dao.NoLdapUserRolesFoundException;
import org.sonatype.security.ldap.dao.NoSuchLdapGroupException;
import org.sonatype.security.ldap.dao.NoSuchLdapUserException;
import org.sonatype.security.ldap.realms.connector.DefaultLdapConnector;
import org.sonatype.security.ldap.realms.connector.LdapConnector;
import org.sonatype.security.ldap.realms.persist.LdapConfiguration;
import org.sonatype.security.ldap.realms.persist.model.CConnectionInfo;
import org.sonatype.security.ldap.realms.tools.LdapURL;
@Component( role = LdapManager.class )
public class SimpleLdapManager
implements LdapManager
{
private Logger logger = LoggerFactory.getLogger( getClass() );
@Requirement
private LdapAuthenticator ldapAuthenticator;
@Requirement
private LdapUserDAO ldapUserManager;
@Requirement
private LdapGroupDAO ldapGroupManager;
@Requirement
private LdapConfiguration ldapConfiguration;
private LdapConnector ldapManagerStrategy;
public SortedSet<String> getAllGroups()
throws LdapDAOException
{
return this.getLdapManagerConnector().getAllGroups();
}
public SortedSet<LdapUser> getAllUsers()
throws LdapDAOException
{
return this.getLdapManagerConnector().getAllUsers();
}
public String getGroupName( String groupId )
throws LdapDAOException, NoSuchLdapGroupException
{
return this.getLdapManagerConnector().getGroupName( groupId );
}
public LdapUser getUser( String username )
throws NoSuchLdapUserException,
LdapDAOException
{
return this.getLdapManagerConnector().getUser( username );
}
public Set<String> getUserRoles( String userId )
throws LdapDAOException, NoLdapUserRolesFoundException
{
return this.getLdapManagerConnector().getUserRoles( userId );
}
public SortedSet<LdapUser> getUsers( int userCount )
throws LdapDAOException
{
return this.getLdapManagerConnector().getUsers( userCount );
}
public SortedSet<LdapUser> searchUsers( String username )
throws LdapDAOException
{
return this.getLdapManagerConnector().searchUsers( username );
}
private LdapConnector getLdapManagerConnector()
throws LdapDAOException
{
if ( this.ldapManagerStrategy == null )
{
this.ldapManagerStrategy = new DefaultLdapConnector(
"test",
this.ldapUserManager,
this.ldapGroupManager,
this.getLdapContextFactory(),
this.getLdapAuthConfiguration() );
}
return this.ldapManagerStrategy;
}
protected LdapConfiguration getLdapConfiguration()
{
return this.ldapConfiguration;
}
protected LdapAuthConfiguration getLdapAuthConfiguration()
{
return this.getLdapConfiguration().getLdapAuthConfiguration();
}
protected LdapContextFactory getLdapContextFactory()
throws LdapDAOException
{
DefaultLdapContextFactory defaultLdapContextFactory = new DefaultLdapContextFactory();
if ( this.getLdapConfiguration() == null || this.getLdapConfiguration().readConnectionInfo() == null )
{
throw new LdapDAOException( "Ldap connection is not configured." );
}
CConnectionInfo connInfo = this.getLdapConfiguration().readConnectionInfo();
String url;
try
{
url = new LdapURL( connInfo.getProtocol(), connInfo.getHost(), connInfo.getPort(), connInfo.getSearchBase() )
.toString();
}
catch ( MalformedURLException e )
{
// log an error, because the user could still log in and fix the config.
this.logger.error( "LDAP Configuration is Invalid." );
throw new LdapDAOException( "Invalid LDAP URL: " + e.getMessage() );
}
defaultLdapContextFactory.setUsePooling( true );
defaultLdapContextFactory.setUrl( url );
defaultLdapContextFactory.setSystemUsername( connInfo.getSystemUsername() );
defaultLdapContextFactory.setSystemPassword( connInfo.getSystemPassword() );
defaultLdapContextFactory.setSearchBase( connInfo.getSearchBase() );
defaultLdapContextFactory.setAuthentication( connInfo.getAuthScheme() );
return defaultLdapContextFactory;
}
public LdapUser authenticateUser( String userId, String password ) throws AuthenticationException
{
try
{
LdapUser ldapUser = this.getUser( userId );
String authScheme = this.getLdapConfiguration().readConnectionInfo().getAuthScheme();
if ( StringUtils.isEmpty( this
.getLdapConfiguration().readUserAndGroupConfiguration().getUserPasswordAttribute() ) )
{
// auth with bind
this.ldapAuthenticator.authenticateUserWithBind(
ldapUser,
password,
this.getLdapContextFactory(),
authScheme );
}
else
{
// auth by checking password,
this.ldapAuthenticator.authenticateUserWithPassword( ldapUser, password );
}
// everything was successful
return ldapUser;
}
catch ( Exception e )
{
if( this.logger.isDebugEnabled())
{
this.logger.debug( "Failed to find user: " + userId, e );
}
}
throw new AuthenticationException( "User: " + userId + " could not be authenticated." );
}
}
| [
"bdemers@2aa8b3fc-8ebb-4439-a84f-95066eaea8ab"
] | bdemers@2aa8b3fc-8ebb-4439-a84f-95066eaea8ab |
23110816d17e7867ddb4c6830c1bb532b788eda5 | 34221f3f7738d7a33c693e580dc6a99789349cf3 | /app/src/main/java/defpackage/cmp.java | 0829160c328500959cb2859c9d3c0af22b05bf5f | [] | no_license | KobeGong/TasksApp | 0c7b9f3f54bc4be755b1f605b41230822d6f9850 | aacdd5cbf0ba073460797fa76f1aaf2eaf70f08e | refs/heads/master | 2023-08-16T07:11:13.379876 | 2021-09-25T17:38:57 | 2021-09-25T17:38:57 | 374,659,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package defpackage;
/* renamed from: cmp reason: default package */
/* compiled from: PG */
final class cmp implements java.lang.Runnable {
private final /* synthetic */ defpackage.cmo a;
cmp(defpackage.cmo cmo) {
this.a = cmo;
}
public final void run() {
this.a.a.a(this.a.b);
}
}
| [
"droidevapp1023@gmail.com"
] | droidevapp1023@gmail.com |
00a4862f3836cc1c50066b9017e4fb421ba4fbd6 | 66879fb5e25987ec0374f05445859c3069c47290 | /src/main/java/com/hs3/tasks/sys/BonusRiskClearJob.java | 8abdf334826cb120bdac1da59ac9f1e8c383c315 | [] | no_license | wangpiju/java-kernal | 0aceb90aa7705e18175a660fa64fa8f3b998779b | 17ef494cc4a1a3f86013f0330642d76965fc502c | refs/heads/master | 2020-04-01T09:18:18.310531 | 2018-10-15T07:20:51 | 2018-10-15T07:20:51 | 153,069,500 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 733 | java | package com.hs3.tasks.sys;
import com.hs3.entity.sys.SysClear;
import com.hs.comm.service.lotts.BonusRiskService;
import com.hs3.web.utils.SpringContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class BonusRiskClearJob extends SysClearJob {
private BonusRiskService bonusRiskService = SpringContext.getBean(BonusRiskService.class);
private static final Logger log = LoggerFactory.getLogger(BonusRiskClearJob.class);
@Override
protected void doClear(SysClear sysClear) {
try {
bonusRiskService.clearBonusPool();
bonusRiskService.initBonusPool();
} catch (Exception e) {
log.info("--> bonus risk clear error, ", e);
}
}
}
| [
"wangpiju0420@gmail.com"
] | wangpiju0420@gmail.com |
551ba75fdd6eee17da44a1c1ff5ccb2f6a80628d | f0ed4fd63d2b36b95df3f7baba96828d2b5836e0 | /aeweb/AdministracionEfectivo-jpa/src/main/java/mx/com/bcm/banamex/ae/persistencia/dao/impl/CatalogoContratoDAOImplBeanLocal.java | 54114803922b8d8ef21357209e889ce8075fca3c | [] | no_license | yamildelgado/ejb-bean | c09555fffaff8a07356f0b699f562e23f33d61ae | 704ef631b5c952c796c75a5265fae88db708065b | refs/heads/master | 2020-03-19T04:50:13.981119 | 2018-06-03T04:51:50 | 2018-06-03T04:51:50 | 135,872,808 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,636 | java | /** Todos los Derechos Reservados 2013 BCM.
* Bufete Consultor Mexicano
*
* Este software contiene informacion propiedad exclusiva del BCM considerada
* Confidencial. Queda totalmente prohibido su uso o divulgacion en forma
* parcial o total.
*
*/
package mx.com.bcm.banamex.ae.persistencia.dao.impl;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import mx.com.bcm.banamex.ae.persistencia.common.GlobalJpaDaoBean;
import mx.com.bcm.banamex.ae.persistencia.dao.CatalogoContratoDAOBeanLocal;
import mx.com.bcm.banamex.ae.persistencia.exception.EfectivoAplicacionDAOException;
import mx.com.bcm.banamex.ae.persistencia.modelo.Contrato;
import mx.com.bcm.banamex.ae.persistencia.vo.CriterioContratoVO;
/**
* @author OCE-WCD YAMIL OMAR DELGADO GONZALEZ
*
*/
@Stateless
public class CatalogoContratoDAOImplBeanLocal extends GlobalJpaDaoBean<Contrato> implements CatalogoContratoDAOBeanLocal {
@PersistenceContext
private EntityManager em;
/* (non-Javadoc)
* @see com.mx.bcm.banamex.ea.persistencia.dao.CatalogoContratoDAOBeanLocal#getContratoPorId(com.mx.bcm.banamex.ea.persistencia.vo.CriterioContratoVO)
*/
@Override
public Contrato getContratoPorId(CriterioContratoVO contratoVO)throws EfectivoAplicacionDAOException {
Contrato contrato=null;
Query query=this.em.createNamedQuery("Contrato.findByCntrtoNum", Contrato.class);
query.setParameter("cntrtoNum", contratoVO.getNumContrato());
query.setMaxResults(1);
contrato=(Contrato) query.getSingleResult();
return contrato;
}
}
| [
"oracle@MacBook-Pro-de-APPLE.local"
] | oracle@MacBook-Pro-de-APPLE.local |
2c901dc30798bbe508ffb1bb741e2c6f5c947d08 | cc964062abb1e448bfb383a61ebb51c2881826cd | /src/main/java/us/drullk/thermalsmeltery/common/gui/client/GuiExtruder.java | bfc0d4b3cb8da19f01d52400533452ab714678d7 | [] | no_license | digideskio/ThermalSmeltery | 3b5e6b09c6770e60d3d6c1c3eabd8bdce1f88e11 | a3c41d98256bd7438f41131c44e5e1a5b80f8d1c | refs/heads/master | 2021-01-20T01:43:15.094141 | 2016-01-11T06:53:59 | 2016-01-11T06:53:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,973 | java | package us.drullk.thermalsmeltery.common.gui.client;
import cofh.lib.gui.element.ElementButton;
import cofh.lib.gui.element.ElementDualScaled;
import cofh.lib.gui.element.ElementEnergyStored;
import cofh.lib.gui.element.ElementFluid;
import us.drullk.thermalsmeltery.common.tile.TileExtruder;
import us.drullk.thermalsmeltery.common.gui.container.ContainerExtruder;
import us.drullk.thermalsmeltery.common.gui.elements.ElementSlotBorder;
import us.drullk.thermalsmeltery.common.gui.elements.ElementTinkersTank;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class GuiExtruder extends GuiMachineBase
{
public static final ResourceLocation TEXTURE = new ResourceLocation("thermalsmeltery:textures/gui/castingExtruderGui.v6.png");
ElementSlotBorder[] tankOverlay = new ElementSlotBorder[2];
ElementSlotBorder outputOverlay;
ElementButton block;
ElementFluid progressFluid;
ElementDualScaled progressOverlay;
TileExtruder extruder;
public GuiExtruder(InventoryPlayer inventoryPlayer, TileEntity tileEntity)
{
super(new ContainerExtruder(inventoryPlayer, tileEntity), tileEntity, inventoryPlayer.player, TEXTURE);
this.generateInfo("tab.thermalsmeltery.machine.extruder", 3);
this.extruder = (TileExtruder)tileEntity;
}
@Override
public void initGui()
{
super.initGui();
this.addElement(new ElementEnergyStored(this, 8, 8, this.extruder.getEnergyStorage()));
this.tankOverlay[0] = (ElementSlotBorder)this.addElement((new ElementSlotBorder(this, 34, 9)).setSlotInfo(0, 3, 2).setVisible(false));
this.tankOverlay[1] = (ElementSlotBorder)this.addElement((new ElementSlotBorder(this, 34, 9)).setSlotInfo(2, 3, 1).setVisible(false));
this.addElement((new ElementTinkersTank(this, 34, 9, this.extruder.getTank())).setGauge(1));
this.outputOverlay = (ElementSlotBorder)this
.addElement((new ElementSlotBorder(this, 122, 26)).setSlotInfo(1, 1, 2).setVisible(true));
this.block = (ElementButton)this
.addElement(new ElementButton(this, 124, 54, "Block", 184, 0, 184, 20, 184, 40, 20, 20, "thermalsmeltery:textures/gui/castingExtruderGui.v5.png"));
this.progressFluid = (ElementFluid)this
.addElement((new ElementFluid(this, 75, 29))
.setFluid(extruder.getTank().getFluid())
.setSize(24, 17));
this.progressOverlay = (ElementDualScaled)this.addElement((new ElementDualScaled(this, 75, 29))
.setMode(1)
.setBackground(false)
.setSize(24, 16)
.setTexture("thermalsmeltery:textures/gui/elementProgressFluidArrow.png", 48, 16));
}
@Override
protected void updateElementInformation()
{
super.updateElementInformation();
tankOverlay[0].setVisible(this.extruder.hasSide(1));
tankOverlay[1].setVisible(this.extruder.hasSide(3));
outputOverlay.setVisible(this.extruder.hasSide(2));
if (!this.extruder.hasSide(1))
{
this.tankOverlay[1].slotRender = 2;
} else
{
this.tankOverlay[1].slotRender = 1;
}
if (this.extruder.block)
{
if (!this.extruder.blockFlag)
{
this.block.setToolTip("info.thermalsmeltery.toggleIngotWait");
this.block.setDisabled();
} else
{
this.block.setToolTip("info.thermalsmeltery.toggleIngot");
this.block.setSheetX(184);
this.block.setHoverX(184);
this.block.setActive();
}
} else if (this.extruder.blockFlag)
{
this.block.setToolTip("info.thermalsmeltery.toggleBlockWait");
this.block.setDisabled();
} else
{
this.block.setToolTip("info.thermalsmeltery.toggleBlock");
this.block.setSheetX(204);
this.block.setHoverX(204);
this.block.setActive();
}
this.progressFluid.setFluid(this.extruder.getTank().getFluid());
this.progressFluid.setSize(this.extruder.getScaledProgress(24), 16);
this.progressOverlay.setQuantity(this.extruder.getScaledProgress(24));
//System.out.println("width " + progressOverlay.getWidth() + " height " + progressOverlay.getHeight());
}
@Override
public void handleElementButtonClick(String var1, int var2)
{
if (var1.equals("Block") && this.extruder.block == this.extruder.blockFlag)
{
if (this.extruder.block)
{
playSound("random.click", 1.0F, 0.8F);
} else
{
playSound("random.click", 1.0F, 0.6F);
}
this.extruder.setMode(!this.extruder.block);
}
}
}
| [
"ericsplanet@mac.com"
] | ericsplanet@mac.com |
8f1410fc611ae4a5482ddb8ebf2678bf016a0ef1 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_74c216e51b4fbad2a6afc079d93e4dbaf1507e9a/HypGA/3_74c216e51b4fbad2a6afc079d93e4dbaf1507e9a_HypGA_s.java | d6512b1e33091c039c4a9777fd049faec5e894fa | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,186 | java | package fr.hyperfiction;
import android.util.Log;
import com.google.analytics.tracking.android.EasyTracker;
import com.google.analytics.tracking.android.GAServiceManager;
import com.google.analytics.tracking.android.GoogleAnalytics;
import com.google.analytics.tracking.android.Tracker;
import org.haxe.nme.GameActivity;
/**
* ...
* @author shoe[box]
*/
public class HypGA{
private static String TAG = "HypGA";
private static Tracker _gaTracker;
// -------o constructor
/**
* constructor
*
* @param
* @return void
*/
private void HypGA() {
Log.i( TAG, " constructor" );
}
// -------o public
/**
*
*
* @public
* @return void
*/
static public void startSession( String sUA_code , int iPeriod ){
Log.i( TAG, " startNewSession : "+sUA_code );
_gaTracker = GoogleAnalytics.getInstance( GameActivity.getContext( ) ).getTracker( sUA_code );
GoogleAnalytics.getInstance( GameActivity.getContext( ) ).setDebug( true );
setDispatch_period( iPeriod );
}
/**
*
*
* @public
* @return void
*/
static public void stopSession( ){
Log.i( TAG, "stopSession");
GoogleAnalytics.getInstance( GameActivity.getContext( ) ).closeTracker( _gaTracker );
}
/**
*
*
* @public
* @return void
*/
static public void setDispatch_period( int iPeriod ) {
Log.i( TAG, "setDispatch_period : "+iPeriod );
GAServiceManager.getInstance( ).setDispatchPeriod( iPeriod );
}
/**
*
*
* @public
* @return void
*/
static public void dispatch( ){
Log.i( TAG, "Force dispatch" );
}
/**
*
*
* @public
* @return void
*/
static public void trackEvent( String sCat , String sAction , String sLabel , int iVal ){
Log.i( TAG, "trackEvent : cat "+sCat+" || action : "+sAction+" || label : "+sLabel+" || iVal : "+iVal );
_gaTracker.sendEvent( sCat , sAction , sLabel , (long) iVal );
}
/**
*
*
* @public
* @return void
*/
static public void trackPageView( String sPage ){
Log.i( TAG, "trackPageView : "+sPage );
//GoogleAnalyticsTracker.getInstance( ).trackPageView( sPage );
_gaTracker.sendView( sPage );
}
/**
*
*
* @public
* @return void
*/
static public void sendTiming(
String sCat,
int iInterval,
String sName,
String sLabel
){
_gaTracker.sendTiming( sCat , iInterval , sName , sLabel );
}
/**
*
*
* @public
* @return void
*/
static public void sendSocial(
String sSocial_network,
String sAction,
String sTarget
){
_gaTracker.sendSocial( sSocial_network , sAction , sTarget );
}
/**
*
*
* @public
* @return void
*/
static public void setCustom_dimension( int iIndex , String sValue ){
_gaTracker.setCustomDimension( iIndex , sValue );
}
/**
*
*
* @public
* @return void
*/
static public void setCustom_metric( int iIndex , int iValue ){
_gaTracker.setCustomMetric( iIndex , (long) iValue );
}
// -------o protected
// -------o misc
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
f756a498d799d9da9d30c1a5f06c98e1262daba6 | 9ad56a3fb2f80df6a27a4af35aea500ee37f6e5e | /Practices/week14-2/src/Device.java | b3d39cf6cc580762dc64e7b244536363c106e429 | [] | no_license | coding-Benny/design-pattern | 71c496d0af3dcb5142ebb8128468a40322228eb9 | 0cf3777392f24d4c82c275f7d15b0aa675f4db19 | refs/heads/master | 2023-01-31T05:01:36.188019 | 2020-12-06T04:23:19 | 2020-12-06T04:23:19 | 296,181,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | public interface Device {
public boolean isEnabled();
public void enable();
public void disable();
public int getVolume();
public void setVolume(int volume);
public int getChannel();
public void setChannel(int channel);
public void printStatus();
}
| [
"sjeonghyeonz@gmail.com"
] | sjeonghyeonz@gmail.com |
e211d8a2cd69faffcefc4fe5f232b2f613f6a0ca | 8fb2d2bfc3c7273427cbeec7b99e8e463074f5ee | /gen/com/example/domicontact/R.java | f881165aa4bebcd7bc1124f3948a6b2e68904eb5 | [] | no_license | domjanjanos/DomiContact | 92ba07bbc062667f6eb192c2e529a058d4d21c3d | 9f7a0422ef8ba9afd7febd2d577641b0e7481f7e | refs/heads/master | 2020-09-21T13:20:13.608940 | 2016-09-08T13:51:11 | 2016-09-08T13:51:11 | 67,707,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,764 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.domicontact;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int action_settings=0x7f08000d;
public static final int button1=0x7f080003;
public static final int button2=0x7f080002;
public static final int button3=0x7f080001;
public static final int button4=0x7f080000;
public static final int dates=0x7f08000c;
public static final int editText1=0x7f08000b;
public static final int editText3=0x7f080009;
public static final int editText4=0x7f080007;
public static final int textView1=0x7f080004;
public static final int textView2=0x7f08000a;
public static final int textView3=0x7f080005;
public static final int textView5=0x7f080008;
public static final int textView6=0x7f080006;
}
public static final class layout {
public static final int activity_main=0x7f030000;
}
public static final class menu {
public static final int main=0x7f070000;
}
public static final class string {
public static final int action_settings=0x7f050001;
public static final int app_name=0x7f050000;
public static final int button_add_record=0x7f050002;
public static final int button_clear_all_record=0x7f050005;
public static final int button_new_record=0x7f050003;
public static final int button_read_record=0x7f050004;
public static final int text_Action=0x7f050006;
public static final int text_MaxRec=0x7f050007;
public static final int text_Name=0x7f050009;
public static final int text_Phone=0x7f050008;
public static final int text_Records=0x7f05000a;
public static final int text_hint_Contact_list=0x7f05000b;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f060000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f060001;
}
}
| [
"domjan.janos.junior@gmail.com"
] | domjan.janos.junior@gmail.com |
b82b1464684eed3c261ee098e6c85d7205ba5407 | 9ce5ebbaa162e4ff8e54030903a49aa389a763c5 | /src/integratedproject/ViewAppointmentController.java | 4b0fb9281f2abbb86a8797c347170f1639f0c2a8 | [] | no_license | ZubyWasTaken/Integrated-Project-1 | cccb63f24d9ce4414b3a58fbe99dc8913dab7f11 | 7bd1361634091d6882bd7a12df3db58a09bb8a38 | refs/heads/master | 2020-04-22T03:51:16.047966 | 2019-04-01T21:40:59 | 2019-04-01T21:40:59 | 170,102,814 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,803 | java | package integratedproject;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
/**
*
* @author Zuby
*/
public class ViewAppointmentController implements Initializable {
// Variables declared to be used by the code - these are linked to the
// according element in the FXML
@FXML
private Label lblUserID;
@FXML
private Label lblAppointment;
@FXML
private Label lblAppointmentID;
@FXML
private Label lblForename;
@FXML
private Label lblSurname;
@FXML
private Label lblDate;
@FXML
private Label lblDisplay;
@FXML
private Label lblStatus;
@FXML
private Label lblTime;
@FXML
private Button btnCancel;
// Cycles through appointments
@FXML
public void nextAppointment(ActionEvent event) throws IOException {
boolean found = ReadWrite.doesAppointmentExist(Patient.userID);
try {
if (found) {
lblDisplay.setText("");
List<List<String>> appointments = ReadWrite.returnAppointment();
// used to cycle through appointments
int maxCounter = appointments.size();
try {
Patient.counter++;
if (Patient.counter >= maxCounter) {
Patient.counter = 0;
}
// assigns variables from the data in the current appointment list
List<String> currentSelection = appointments.get(Patient.counter);
String appointmentID = currentSelection.get(0);
String appointmentType = currentSelection.get(1);
String userID = currentSelection.get(2);
String date = currentSelection.get(3);
String timeAppointment = currentSelection.get(4);
String status = currentSelection.get(5);
// gets users forename and surname
List<String> tempArray1 = ReadWrite.userForenameSurname(Patient.userID);
String forename = tempArray1.get(2);
String surname = tempArray1.get(3);
// displays the data onto the labels
lblForename.setText(forename);
lblSurname.setText(surname);
lblUserID.setText(userID);
lblAppointmentID.setText(appointmentID);
lblAppointment.setText(appointmentType);
lblTime.setText(timeAppointment);
lblDate.setText(date);
// validation
if (status.equals(" Pending")) {
lblStatus.setText(status);
} else if (status.equals(" In-progress")) {
lblStatus.setText(status);
} else if (status.equals(" Not-Complete")) {
lblStatus.setText(status);
} else if (status.equals(" Complete")) {
lblStatus.setText(status);
} else {
lblStatus.setText("Not Started.");
}
} catch (ArrayIndexOutOfBoundsException e) {
}
} else {
lblDisplay.setText("No appointments exist for this user.");
}
} catch (Exception e) {
Patient.counter = 0;
}
}
// closes current window and goes to user home window
@FXML
public void exitButton(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("FXML/UserHome.fxml"));
Scene scene = new Scene(root);
Stage reg = new Stage(StageStyle.DECORATED);
reg.setTitle("User Home");
reg.setScene(scene);
reg.show();
((Stage) (((Button) event.getSource()).getScene().getWindow())).close();
}
// cancel appointment button
@FXML
public void cancelAppointment(ActionEvent event) throws IOException, FileNotFoundException {
try {
// currentSelection is the appointment that is currently displayed
List<String> currentSelection = ReadWrite.displayAppointment();
// makes that list to a string
String listString = String.join(",", currentSelection);
System.out.println(listString);
// string is passed in to check if appoiintment infact exists
boolean found = ReadWrite.doesAppointmentExist(Patient.userID);
// if it exists it clears labels
if (found) {
Patient.counter = 0;
lblUserID.setText("");
lblAppointment.setText("");
lblForename.setText("");
lblSurname.setText("");
lblDate.setText("");
lblAppointmentID.setText("");
lblTime.setText("");
lblStatus.setText("");
//string is passed to method to delete it from users appointment files
boolean deleted = ReadWrite.appointmentDelete(listString);
if (deleted) {
//once deleted it clears labels again
lblUserID.setText("");
lblAppointment.setText("");
lblForename.setText("");
lblSurname.setText("");
lblDate.setText("");
lblAppointmentID.setText("");
lblTime.setText("");
lblStatus.setText("");
// success message, disables cancel button
lblDisplay.setText("Appointment successfully cancelled.");
btnCancel.setDisable(true);
} else {
lblDisplay.setText("Appointment failed to cancel.");
}
} else {
lblDisplay.setText("You have no appointment to cancel.");
}
} catch (IndexOutOfBoundsException e) {
lblDisplay.setText("You have no appointment to cancel.");
} catch (FileNotFoundException e) {
lblDisplay.setText("You have no appointment to cancel.");
}
}
@Override
public void initialize(URL url, ResourceBundle rb) {
}
}
| [
"zubairkhalid12@gmail.com"
] | zubairkhalid12@gmail.com |
1c1b4d1d44bb2961c266055fff9e42c77cf4ecd1 | 2e828500a0d25a36d9b382ef268d738e66300a0f | /app/src/main/java/com/example/lazyclock/utils/LBSAcquire.java | 79044929d623a58821b2bf4d6ba206f0bd163ad4 | [] | no_license | HulShun/LazyClock | 4f823694de82321d82bb614851f22ee986456572 | 23c30393907333780822c552d8a732846f8c18cf | refs/heads/master | 2016-09-15T14:54:53.428275 | 2016-03-16T08:06:22 | 2016-03-16T08:06:22 | 48,969,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,963 | java | package com.example.lazyclock.utils;
import android.content.Context;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
/**
* Created by Administrator on 2016/1/14.
*/
public class LBSAcquire {
private Context mContext;
private LocationClient mLoactionClient;
private String city;
public LBSAcquire(Context context) {
mContext = context;
mLoactionClient = new LocationClient(context);
initParams();
}
private void initParams() {
LocationClientOption option = new LocationClientOption();
option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
option.setCoorType("bd09ll");
option.setIsNeedAddress(true);
option.SetIgnoreCacheException(false);
option.setScanSpan(5000);
option.setTimeOut(10000);
option.setLocationNotify(true);
mLoactionClient.setLocOption(option);
}
/**
* 设置监听器
*
* @param locationListener
*/
public void setBDLocationListener(BDLocationListener locationListener) {
mLoactionClient.registerLocationListener(locationListener);
}
public void requireLocation() {
mLoactionClient.requestLocation();
}
/**
* 返回城市信息
*/
public String getCNLocationAcquire() {
return city;
}
public void startAcquire() {
if (mLoactionClient != null && !mLoactionClient.isStarted()) {
mLoactionClient.start();
}
if (mLoactionClient != null && mLoactionClient.isStarted()) {
mLoactionClient.requestLocation();
} else {
LogUtil.d("location", "百度地图定位开启失败");
}
}
public void stopAcquire() {
if (mLoactionClient != null && mLoactionClient.isStarted()) {
mLoactionClient.stop();
}
}
}
| [
"shunyigeren@gmail.com"
] | shunyigeren@gmail.com |
63ac7317113d6895871ba885eb495bb670cccbe8 | 39b208bc5aed7ff144035a7a2c19ad032d49651f | /icardea-caremanager-ws/src/main/java/org/hl7/v3/COCTMT220300UVApproval.java | 1b2fa8c0445f0693f2f4e4c8470f71d161c87cb6 | [] | no_license | coderunner4/icardea | 8f28864aaa7993dd71ac100f43a54af0b146133a | de50d91b8ede37acc6aaf48eea62bdda47710c4f | refs/heads/master | 2021-01-10T13:04:54.315708 | 2013-02-27T13:27:24 | 2013-02-27T13:27:24 | 46,989,557 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,290 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2010.08.03 at 01:53:59 PM EEST
//
package org.hl7.v3;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for COCT_MT220300UV.Approval complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="COCT_MT220300UV.Approval">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <group ref="{urn:hl7-org:v3}InfrastructureRootElements"/>
* <element name="id" type="{urn:hl7-org:v3}II"/>
* <element name="code" type="{urn:hl7-org:v3}CD" minOccurs="0"/>
* <element name="statusCode" type="{urn:hl7-org:v3}CS" minOccurs="0"/>
* <element name="holder" type="{urn:hl7-org:v3}COCT_MT220300UV.Holder" minOccurs="0"/>
* <element name="author" type="{urn:hl7-org:v3}COCT_MT220300UV.Author"/>
* </sequence>
* <attGroup ref="{urn:hl7-org:v3}InfrastructureRootAttributes"/>
* <attribute name="classCode" use="required" type="{urn:hl7-org:v3}ActClassContract" />
* <attribute name="moodCode" use="required" type="{urn:hl7-org:v3}ActMoodEventOccurrence" />
* <attribute name="nullFlavor" type="{urn:hl7-org:v3}NullFlavor" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "COCT_MT220300UV.Approval", propOrder = {
"realmCode",
"typeId",
"templateId",
"id",
"code",
"statusCode",
"holder",
"author"
})
public class COCTMT220300UVApproval {
protected List<CS> realmCode;
protected II typeId;
protected List<II> templateId;
@XmlElement(required = true)
protected II id;
protected CD code;
protected CS statusCode;
@XmlElementRef(name = "holder", namespace = "urn:hl7-org:v3", type = JAXBElement.class)
protected JAXBElement<COCTMT220300UVHolder> holder;
@XmlElement(required = true)
protected COCTMT220300UVAuthor author;
@XmlAttribute(required = true)
protected ActClassContract classCode;
@XmlAttribute(required = true)
protected ActMoodEventOccurrence moodCode;
@XmlAttribute
protected NullFlavor nullFlavor;
/**
* Gets the value of the realmCode property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the realmCode property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRealmCode().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CS }
*
*
*/
public List<CS> getRealmCode() {
if (realmCode == null) {
realmCode = new ArrayList<CS>();
}
return this.realmCode;
}
/**
* Gets the value of the typeId property.
*
* @return
* possible object is
* {@link II }
*
*/
public II getTypeId() {
return typeId;
}
/**
* Sets the value of the typeId property.
*
* @param value
* allowed object is
* {@link II }
*
*/
public void setTypeId(II value) {
this.typeId = value;
}
/**
* Gets the value of the templateId property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the templateId property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getTemplateId().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link II }
*
*
*/
public List<II> getTemplateId() {
if (templateId == null) {
templateId = new ArrayList<II>();
}
return this.templateId;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link II }
*
*/
public II getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link II }
*
*/
public void setId(II value) {
this.id = value;
}
/**
* Gets the value of the code property.
*
* @return
* possible object is
* {@link CD }
*
*/
public CD getCode() {
return code;
}
/**
* Sets the value of the code property.
*
* @param value
* allowed object is
* {@link CD }
*
*/
public void setCode(CD value) {
this.code = value;
}
/**
* Gets the value of the statusCode property.
*
* @return
* possible object is
* {@link CS }
*
*/
public CS getStatusCode() {
return statusCode;
}
/**
* Sets the value of the statusCode property.
*
* @param value
* allowed object is
* {@link CS }
*
*/
public void setStatusCode(CS value) {
this.statusCode = value;
}
/**
* Gets the value of the holder property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link COCTMT220300UVHolder }{@code >}
*
*/
public JAXBElement<COCTMT220300UVHolder> getHolder() {
return holder;
}
/**
* Sets the value of the holder property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link COCTMT220300UVHolder }{@code >}
*
*/
public void setHolder(JAXBElement<COCTMT220300UVHolder> value) {
this.holder = ((JAXBElement<COCTMT220300UVHolder> ) value);
}
/**
* Gets the value of the author property.
*
* @return
* possible object is
* {@link COCTMT220300UVAuthor }
*
*/
public COCTMT220300UVAuthor getAuthor() {
return author;
}
/**
* Sets the value of the author property.
*
* @param value
* allowed object is
* {@link COCTMT220300UVAuthor }
*
*/
public void setAuthor(COCTMT220300UVAuthor value) {
this.author = value;
}
/**
* Gets the value of the classCode property.
*
* @return
* possible object is
* {@link ActClassContract }
*
*/
public ActClassContract getClassCode() {
return classCode;
}
/**
* Sets the value of the classCode property.
*
* @param value
* allowed object is
* {@link ActClassContract }
*
*/
public void setClassCode(ActClassContract value) {
this.classCode = value;
}
/**
* Gets the value of the moodCode property.
*
* @return
* possible object is
* {@link ActMoodEventOccurrence }
*
*/
public ActMoodEventOccurrence getMoodCode() {
return moodCode;
}
/**
* Sets the value of the moodCode property.
*
* @param value
* allowed object is
* {@link ActMoodEventOccurrence }
*
*/
public void setMoodCode(ActMoodEventOccurrence value) {
this.moodCode = value;
}
/**
* Gets the value of the nullFlavor property.
*
* @return
* possible object is
* {@link NullFlavor }
*
*/
public NullFlavor getNullFlavor() {
return nullFlavor;
}
/**
* Sets the value of the nullFlavor property.
*
* @param value
* allowed object is
* {@link NullFlavor }
*
*/
public void setNullFlavor(NullFlavor value) {
this.nullFlavor = value;
}
}
| [
"yildiraykabak@gmail.com"
] | yildiraykabak@gmail.com |
50966aae5b4b3cbf49585be530a546d472a11047 | aecaf283d085ee974ff1fd50c238788a2c335b3e | /mobilesafe/src/bean/blackNumberInfo.java | e1480a4d0402bcf7cecec152b3a7915177bf5d7d | [
"Apache-2.0"
] | permissive | simplifiedrobot/git | 0da46a0df7995a8af5bec10dfdb2e9b311c31f99 | d57363a4b218f72ca3bcf17647793ded58741d69 | refs/heads/master | 2021-01-10T03:19:30.712245 | 2015-12-25T11:00:25 | 2015-12-25T11:00:25 | 47,459,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package bean;
public class blackNumberInfo {
String mode;
String number;
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
}
| [
"ws163163@yeah.net"
] | ws163163@yeah.net |
fb87c6678d0d9d450a935a1a132db5a657de53a2 | 75b4e6848e78944671ca810ea77f151e80b5519e | /app/src/androidTest/java/com/example/test_covid/ExampleInstrumentedTest.java | 7dd701cdf34872cf1b29df7780fe4e233c24a99d | [] | no_license | shyam2828/covid-19 | 1d0bffb0151012988139c36113b4da713c88f10a | b061a57f06048ed18c0c37d44a8127c849ca379f | refs/heads/master | 2022-09-21T10:54:04.907921 | 2020-06-05T07:55:09 | 2020-06-05T07:55:09 | 269,565,909 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | package com.example.test_covid;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.test_covid", appContext.getPackageName());
}
}
| [
"baddogs81@gmail.com"
] | baddogs81@gmail.com |
581c4384eff1a31462300b9ae8e9e987fb7bb664 | 218b2e0a18702702b1b09a1c2b79d6b8e612c571 | /backend/SSG/src/main/java/com/ssg/shopping/payment/data/Entity/CustomerPayment.java | 733316edacaeea32aa0aea719bcf9876b46aaf6c | [] | no_license | minchang0116/SCAN-GO | 48d85aecd57735b78fa7ad3a8eb5a421da2085af | fbd5b6a4e714c4e7c602a9f37205f92b3090d10e | refs/heads/master | 2023-05-28T21:47:27.998769 | 2021-06-12T05:26:08 | 2021-06-12T05:26:08 | 371,203,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,776 | java | package com.ssg.shopping.payment.data.Entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ssg.member.data.Member;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.UpdateTimestamp;
@Getter
@Entity
@NoArgsConstructor
@Table(name = "customer_payment")
public class CustomerPayment {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String storeId;
@Temporal(TemporalType.TIMESTAMP)
private Date txDateTime;
private String authHash;
private long paymentCount;
private long paymentAmount;
private String paymentPlan;
private String paymentResult;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "member_id")
private Member member;
@JsonIgnore
@OneToMany(mappedBy = "customerPayment")
private List<PaymentDetail> paymentDetail = new ArrayList<>();
public CustomerPayment(String storeId, Member member) {
this.storeId = storeId;
this.member = member;
}
public void update() {
long count = 0;
long amount = 0;
for(PaymentDetail pd : paymentDetail) {
count += pd.getQty();
amount += Long.parseLong(pd.getProduct().getProdPrice())*pd.getQty();
}
this.paymentCount = count;
this.paymentAmount = amount;
}
public void updatePay(Date txDateTime, String authHash) {
this.txDateTime = txDateTime;
this.authHash = authHash;
}
public void updateResult(String paymentPlan, String paymentResult) {
this.paymentPlan = paymentPlan;
this.paymentResult = paymentResult;
}
}
| [
"leegw217@naver.com"
] | leegw217@naver.com |
4e2c11cd0b81970d0cc12c9c1f24dd861678011e | 23198e346a6fe788ecda9df0ef0e2ca261abed75 | /hw03-1191236031/src/main/java/hr/fer/zemris/java/custom/collections/demo/ElementsGetterExample1.java | 44c5290b1c11cb0fe98862f5df7584749301b841 | [] | no_license | tomarga/Osnove-programskog-jezika-Java | 74b76df2e25c8b867f3d55ac1aa47161bfc19dca | a97e5307ea602170d0146bfe9aa12693315d30a0 | refs/heads/main | 2023-01-11T16:28:56.599810 | 2020-11-14T18:14:15 | 2020-11-14T18:14:15 | 312,864,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,491 | java | package hr.fer.zemris.java.custom.collections.demo;
import hr.fer.zemris.java.custom.collections.ArrayIndexedCollection;
import hr.fer.zemris.java.custom.collections.Collection;
import hr.fer.zemris.java.custom.collections.ElementsGetter;
//import hr.fer.zemris.java.custom.collections.LinkedListIndexedCollection;
public class ElementsGetterExample1 {
public static void main(String[] args) {
Collection col = new ArrayIndexedCollection();
// Collection col = new LinkedListIndexedCollection();
col.add("Ivo");
col.add("Ana");
col.add("Jasna");
ElementsGetter getter = col.createElementsGetter();
System.out.println("Ima nepredanih elemenata: " + getter.hasNextElement());
System.out.println("Jedan element: " + getter.getNextElement());
System.out.println("Ima nepredanih elemenata: " + getter.hasNextElement());
System.out.println("Jedan element: " + getter.getNextElement());
System.out.println("Ima nepredanih elemenata: " + getter.hasNextElement());
System.out.println("Jedan element: " + getter.getNextElement());
System.out.println("Ima nepredanih elemenata: " + getter.hasNextElement());
System.out.println("Jedan element: " + getter.getNextElement());
}
/*
* Ima nepredanih elemenata: true
* Jedan element: Ivo
* Ima nepredanih elemenata: true
* Jedan element: Ana
* Ima nepredanih elemenata: true
* Jedan element: Jasna
* Ima nepredanih elemenata: false
* Exception in thread "main" java.util.NoSuchElementException:
*/
}
| [
"tomarga@student.math.hr"
] | tomarga@student.math.hr |
bd2af25d9ddc49f55d1c19f0f8d9568e3ba726bf | 8a37231287e47468ace2352e3074f68cd6891e21 | /src/main/java/org/baali/struts/logon/LogonAction.java | b9d7e624d1e8c80677a8d76492281aa81825d76a | [] | no_license | Balaj-Manogar/StrutsTest | 1b6b0a7772a5b9ac6809b222bc128fead106d4a1 | 57a8c522eccf3628a3e2ee477d1fbb9243f195d1 | refs/heads/master | 2020-12-30T09:38:08.099859 | 2015-07-09T11:03:17 | 2015-07-09T11:03:17 | 38,759,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 919 | java | package org.baali.struts.logon;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class LogonAction extends Action
{
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res)
{
LogonForm af = (LogonForm) form;
String username = af.getUsername();
String password = af.getPassword();
if(username.equals("asd") && password.equals("asd"))
{
HttpSession session = req.getSession();
session.setAttribute("user", form);
//System.out.println("INPUT ATTR: " + mapping.getInput());
return mapping.findForward("welcome");
}
return mapping.findForward("loginAgain");
}
}
| [
"rajanbalaji2000@yahoo.co.in"
] | rajanbalaji2000@yahoo.co.in |
fe703f9c5a0b95cca47b8e7ddf10630778ac1639 | ece0480fb3ab1f2ea579bcd6003e53491b11985f | /src/main/java/com/shsxt/crm/controller/CusDevController.java | 07968938c5cfbb9625150c71e8023f5faf78e15e | [] | no_license | 2289589441/shsxt_crm | 342770e530577692327bd8e2eb1829e41d0a0f68 | ad9697f0af517218063e125f281d63394c5f07d6 | refs/heads/master | 2020-04-01T04:29:23.997248 | 2018-10-16T11:31:10 | 2018-10-16T11:31:10 | 152,826,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,506 | java | package com.shsxt.crm.controller;
import com.shsxt.crm.base.BaseController;
import com.shsxt.crm.model.ResultInfo;
import com.shsxt.crm.po.CusDevPlan;
import com.shsxt.crm.po.SaleChance;
import com.shsxt.crm.query.CusDevPlanQuery;
import com.shsxt.crm.query.SaleChanceQuery;
import com.shsxt.crm.service.CusDevPlanService;
import com.shsxt.crm.service.SaleChanceService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Map;
/**
* @author 康晓伟
* @auther: 康晓伟
* @date: 2018/10/16 14:02
* @description: shsxt_crm
*/
@Controller
@RequestMapping("cusDevPlan")
public class CusDevController extends BaseController {
@Resource
private SaleChanceService saleChanceService;
@Resource
private CusDevPlanService cusDevPlanService;
/**
* 加载页面
* @param sid
* @param model
* @return
*/
@RequestMapping("index")
public String index(Integer sid , Model model){
SaleChance saleChance = saleChanceService.queryById(sid);
model.addAttribute(saleChance);
return "cus_dev_plan_detail";
}
@RequestMapping("queryCusDevPlansByParams")
@ResponseBody
public Map<String, Object> queryCusDevPlansByParams(@RequestParam(defaultValue = "1")Integer page,
@RequestParam(defaultValue = "10")Integer rows,
CusDevPlanQuery cusDevPlanQuery){
cusDevPlanQuery.setPageNum(page);
cusDevPlanQuery.setPageSize(rows);
return cusDevPlanService.queryForPage(cusDevPlanQuery);
}
/**
* 添加 或 更新
* @param cusDevPlan
* @param sid
* @return
*/
@RequestMapping("saveOrUpdateCusDevPlans")
@ResponseBody
public ResultInfo saveOrUpdateCusDevPlans(CusDevPlan cusDevPlan, Integer sid){
cusDevPlanService.saveOrUpdateCusDevPlans(cusDevPlan, sid);
return success("操作成功");
}
/**
* 删除操作
* @param ids
* @return
*/
@RequestMapping("deleteCusDevPlan")
@ResponseBody
public ResultInfo deleteCusDevPlan(Integer[] ids){
cusDevPlanService.deleteBatch(ids);
return success("操作成功");
}
}
| [
"2289589441@qq.com"
] | 2289589441@qq.com |
e90c26b927beafcdc1fe33445f795c9397171c36 | 9b431f4efbd052e42075729117beb0d1c1691d21 | /src/main/java/dataprocess/DataPreprocessor.java | 3569309fec04a94dd235f8163242a3b7403ff30c | [] | no_license | xyzhu/imbalancelearningapp | 1c42d6792eff76025d7e47d7a53f626238d08e8c | c58eeece7fdc9bd94a7e021de96bfd41a3ce533f | refs/heads/master | 2021-07-23T03:01:34.388016 | 2019-12-02T06:31:11 | 2019-12-02T06:31:11 | 224,119,147 | 0 | 2 | null | 2020-10-13T17:53:43 | 2019-11-26T06:31:05 | Java | UTF-8 | Java | false | false | 1,565 | java | package dataprocess;
import weka.attributeSelection.AttributeSelection;
import weka.attributeSelection.Ranker;
import weka.attributeSelection.SymmetricalUncertAttributeEval;
import weka.core.Instances;
import weka.filters.Filter;
import weka.filters.unsupervised.attribute.RemoveUseless;
public class DataPreprocessor {
Instances data;
public DataPreprocessor(Instances data) {
this.data = data;
}
public Instances preprocessData() throws Exception {
System.out.println("Total number of attributes: "
+ data.numAttributes());
deleteUselessAttributes();
// selectAttributesCFS();
System.out.println("Use number of attributes: " + data.numAttributes());
return data;
}
public void deleteUselessAttributes() throws Exception {
data.deleteAttributeAt(0); // remove the attribute commit_id
data.deleteAttributeAt(0); // remove the attribute file_id
RemoveUseless ru = new RemoveUseless();
ru.setMaximumVariancePercentageAllowed(99.0);// remove attributes that
// have more than 90%
// same values
ru.setInputFormat(data);
data = Filter.useFilter(data, ru);
}
public void selectAttributesCFS() throws Exception {
AttributeSelection fs = new AttributeSelection();
SymmetricalUncertAttributeEval evaluator = new SymmetricalUncertAttributeEval();
fs.setEvaluator(evaluator);
Ranker rank = new Ranker();
rank.setNumToSelect(200);
fs.setSearch(rank);
fs.setSeed(2);
fs.SelectAttributes(data);
data = fs.reduceDimensionality(data);
}
}
| [
"qiang@qiangdeMacBook-Pro.local"
] | qiang@qiangdeMacBook-Pro.local |
2bf8b4909b560d68f54b9c3d7b594a0692dd283e | fa88d256b1b192f7c0453eec32f107810693a642 | /system-base/base-microservice-mapper/src/main/java/com/zhujunji/base/mapper/SysWorkItemMapper.java | 3f7ee94c36047e7784a8ce67c5dd0c49d3cd157e | [
"Apache-2.0"
] | permissive | Li1993/base_cloud | d966b10d1ba6c6c49b1190e0c8f2223e34d06ae3 | 867a99af2ae938630bfb927c636c42a9829ccf8f | refs/heads/main | 2023-07-08T02:00:04.002959 | 2021-08-12T09:08:59 | 2021-08-12T09:08:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package com.zhujunji.base.mapper;
import com.zhujunji.base.domain.SysWorkItemDO;
import org.springframework.stereotype.Repository;
@Repository
public interface SysWorkItemMapper {
/**
* 新增工作项信息
* @param workItemDO 工作项信息
* @return int
*/
int insert(SysWorkItemDO workItemDO);
/**
* 主键查询工作项信息
* @param workItemId 工作项 ID
* @return SysWorkItemDO
*/
SysWorkItemDO getById(Long workItemId);
}
| [
"zhujunji90s@gmail.com"
] | zhujunji90s@gmail.com |
60212b19e0427fba6ad71da733b9c46da2617082 | b0400aac410e15beb73a94335515945095eda237 | /dkplayer-sample/src/main/java/com/dueeeke/dkplayer/activity/list/tiktok/TikTok3Activity.java | ab10da2314e01619fef151206b8492be823c2b21 | [
"Apache-2.0"
] | permissive | ulfyyang/DKVideoPlayer | 7110afecfe71c162800f28c5d3746c4e55655d6b | 0c441f3ebba2e68e438640c6bbb70308615986ba | refs/heads/master | 2021-07-10T18:43:20.202334 | 2021-02-11T05:44:33 | 2021-02-11T05:44:33 | 227,975,503 | 0 | 0 | Apache-2.0 | 2021-02-11T05:44:34 | 2019-12-14T06:12:42 | Java | UTF-8 | Java | false | false | 6,614 | java | package com.dueeeke.dkplayer.activity.list.tiktok;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.widget.ViewPager2;
import com.dueeeke.dkplayer.R;
import com.dueeeke.dkplayer.activity.BaseActivity;
import com.dueeeke.dkplayer.adapter.Tiktok3Adapter;
import com.dueeeke.dkplayer.bean.TiktokBean;
import com.dueeeke.dkplayer.util.DataUtil;
import com.dueeeke.dkplayer.util.Utils;
import com.dueeeke.dkplayer.util.cache.PreloadManager;
import com.dueeeke.dkplayer.util.cache.ProxyVideoCacheManager;
import com.dueeeke.dkplayer.widget.VerticalViewPager;
import com.dueeeke.dkplayer.widget.controller.TikTokController;
import com.dueeeke.dkplayer.widget.render.TikTokRenderViewFactory;
import com.dueeeke.videoplayer.player.VideoView;
import com.dueeeke.videoplayer.util.L;
import java.util.ArrayList;
import java.util.List;
/**
* 模仿抖音短视频,使用ViewPager2实现,(实验性)
* Created by dueeeke on 2019/12/04.
*/
public class TikTok3Activity extends BaseActivity<VideoView> {
/**
* 当前播放位置
*/
private int mCurPos;
private List<TiktokBean> mVideoList = new ArrayList<>();
private Tiktok3Adapter mTiktok3Adapter;
private ViewPager2 mViewPager;
private PreloadManager mPreloadManager;
private TikTokController mController;
private static final String KEY_INDEX = "index";
private RecyclerView mViewPagerImpl;
public static void start(Context context, int index) {
Intent i = new Intent(context, TikTok3Activity.class);
i.putExtra(KEY_INDEX, index);
context.startActivity(i);
}
@Override
protected int getLayoutResId() {
return R.layout.activity_tiktok3;
}
@Override
protected int getTitleResId() {
return R.string.str_tiktok_3;
}
@Override
protected void initView() {
super.initView();
setStatusBarTransparent();
initViewPager();
initVideoView();
mPreloadManager = PreloadManager.getInstance(this);
addData(null);
Intent extras = getIntent();
int index = extras.getIntExtra(KEY_INDEX, 0);
mViewPager.post(new Runnable() {
@Override
public void run() {
if (index == 0) {
startPlay(0);
} else {
mViewPager.setCurrentItem(index, false);
}
}
});
}
private void initVideoView() {
mVideoView = new VideoView(this);
mVideoView.setLooping(true);
//以下只能二选一,看你的需求
mVideoView.setRenderViewFactory(TikTokRenderViewFactory.create());
// mVideoView.setScreenScaleType(VideoView.SCREEN_SCALE_CENTER_CROP);
mController = new TikTokController(this);
mVideoView.setVideoController(mController);
}
private void initViewPager() {
mViewPager = findViewById(R.id.vp2);
mViewPager.setOffscreenPageLimit(4);
mTiktok3Adapter = new Tiktok3Adapter(mVideoList);
mViewPager.setAdapter(mTiktok3Adapter);
mViewPager.setOverScrollMode(View.OVER_SCROLL_NEVER);
mViewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
private int mCurItem;
/**
* VerticalViewPager是否反向滑动
*/
private boolean mIsReverseScroll;
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
if (position == mCurItem) {
return;
}
mIsReverseScroll = position < mCurItem;
}
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
if (position == mCurPos) return;
mViewPager.post(new Runnable() {
@Override
public void run() {
startPlay(position);
}
});
}
@Override
public void onPageScrollStateChanged(int state) {
super.onPageScrollStateChanged(state);
if (state == VerticalViewPager.SCROLL_STATE_DRAGGING) {
mCurItem = mViewPager.getCurrentItem();
}
if (state == ViewPager2.SCROLL_STATE_IDLE) {
mPreloadManager.resumePreload(mCurPos, mIsReverseScroll);
} else {
mPreloadManager.pausePreload(mCurPos, mIsReverseScroll);
}
}
});
//ViewPage2内部是通过RecyclerView去实现的,它位于ViewPager2的第0个位置
mViewPagerImpl = (RecyclerView) mViewPager.getChildAt(0);
}
private void startPlay(int position) {
int count = mViewPagerImpl.getChildCount();
for (int i = 0; i < count; i++) {
View itemView = mViewPagerImpl.getChildAt(i);
Tiktok3Adapter.ViewHolder viewHolder = (Tiktok3Adapter.ViewHolder) itemView.getTag();
if (viewHolder.mPosition == position) {
mVideoView.release();
Utils.removeViewFormParent(mVideoView);
TiktokBean tiktokBean = mVideoList.get(position);
String playUrl = mPreloadManager.getPlayUrl(tiktokBean.videoDownloadUrl);
L.i("startPlay: " + "position: " + position + " url: " + playUrl);
mVideoView.setUrl(playUrl);
mController.addControlComponent(viewHolder.mTikTokView, true);
viewHolder.mPlayerContainer.addView(mVideoView, 0);
mVideoView.start();
mCurPos = position;
break;
}
}
}
public void addData(View view) {
int size = mVideoList.size();
mVideoList.addAll(DataUtil.getTiktokDataFromAssets(this));
//使用此方法添加数据,使用notifyDataSetChanged会导致正在播放的视频中断
mTiktok3Adapter.notifyItemRangeChanged(size, mVideoList.size());
}
@Override
protected void onDestroy() {
super.onDestroy();
mPreloadManager.removeAllPreloadTask();
//清除缓存,实际使用可以不需要清除,这里为了方便测试
ProxyVideoCacheManager.clearAllCache(this);
}
}
| [
"xinyunjian1995@gmail.com"
] | xinyunjian1995@gmail.com |
0fbd3bf2b4c1602a6df065a6f37092a40be2a08c | 1322571bc77e65c3ad0897220eb7d42ac801c6bd | /app/src/main/java/ca/uottawa/finalproject/SavedAlbumsActivity.java | 9d7bebb046473930b5e9cbe12fbaf13caa1aba65 | [] | no_license | SaeidPouramini/FinalProject | 3b632570300135e5a881122bb7a584de7486c5b7 | bc1226d2f543d2997a03a44d1cdc08740a4e4e4b | refs/heads/master | 2023-02-02T19:38:17.396152 | 2020-12-10T22:02:34 | 2020-12-10T22:02:34 | 314,412,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 858 | java | package ca.uottawa.finalproject;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
/**
* Activity for showing saved album's of the user
*
* this activity uses a toolbar and a fragment for the content
*/
public class SavedAlbumsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_saved_albums);
Toolbar toolbar = findViewById(R.id.toolbar_saved_albums);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
} | [
"pour0017@algonquinlive.com"
] | pour0017@algonquinlive.com |
d6dc1b482c30b2323126b1ff11d7215ad453577a | 13251c8e53f744fe752c49798ea5700ec9b2dfd0 | /src/main/java/com/csx/defaultmethods/conflict/B.java | 64e82fb22d68288103c9d8f36cac8a6d2ee33f11 | [] | no_license | chensongxian/java8 | b78b36488e2271b5916c2441f15c144fa5c73363 | 6cc74b3b4adbf7b3f1576fe6b6a4ed59f28b91b6 | refs/heads/master | 2021-04-03T05:31:06.002388 | 2018-05-15T02:07:51 | 2018-05-15T02:07:51 | 124,494,046 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 178 | java | package com.csx.defaultmethods.conflict;
/**
* @author csx
* @Package com.csx.defaultmethods.conflict
* @Description: TODO
* @date 2018/5/14 0014
*/
public interface B {
}
| [
"1164077611@qq.com"
] | 1164077611@qq.com |
df09ea937d6271872f3487888065dbbd36362b6c | 2e102febedff852776a324c219aea8f3e084bcee | /AbstractFactory/src/HumanFactory.java | f0fdb57823e257d9d4bd72f501738843d471850f | [] | no_license | akhtarmnnit/designpatternsimple | d935a9aad3fff697d1436c4494bb34b74c512f9a | 71d0f73053a7dc3791e41c858d38eed54165919a | refs/heads/master | 2022-04-20T14:45:41.516673 | 2020-04-18T00:07:40 | 2020-04-18T00:07:40 | 256,539,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 549 | java | public class HumanFactory extends AbstractFactory {
@Override
public Human getHuman(String human) {
if (human.equals(null)) return null;
if (human.equalsIgnoreCase("chILd")) {
return new Child();
} else if (human.equalsIgnoreCase("adult")) {
return new Adult();
} else if (human.equalsIgnoreCase("elDeR")) {
return new Elder();
}
return null;
}
@Override
public Pet getPet(String pet) {
// don't implement
return null;
}
} | [
"makhtarali@groupon.com"
] | makhtarali@groupon.com |
f0674f743e6afb56b32962f9b4f3a450a7cf6d0d | 8df7b7d1e58c5de1db4eea42ee46a44a93388270 | /src/servlets/gerants/team/reservationTournoi.java | 7bcae2a541931ad4dd0a7217bcd5d7df89b481f7 | [] | no_license | BenrkiaAnas/salleSport | b6c1c6b70dcd9b719c250d7d69c45b49b05bf1c1 | f3f96e239b73f3f1dcb48f1ee50f1189cbed7b3e | refs/heads/main | 2023-06-03T08:57:37.735119 | 2021-06-16T18:01:43 | 2021-06-16T18:01:43 | 363,517,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,094 | java | package servlets.gerants.team;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import dao.TeamRepository;
import dao.TournoiRepository;
import entities.Personne;
import entities.Team;
import entities.Tournoi;
/**
* Servlet implementation class reservationTournoi
*/
@WebServlet("/reservationTournoi")
public class reservationTournoi extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public reservationTournoi() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
HttpSession session = request.getSession();
Personne currentUser = (Personne) session.getAttribute("personne");
TournoiRepository tournoiRepository = new TournoiRepository();
List<Tournoi> tournois = tournoiRepository.findEspaceByTournoi(currentUser.getId_personne());
TeamRepository teamRepository = new TeamRepository();
List<Team> teams = teamRepository.getAllTeamsByUser(currentUser.getId_personne());
request.setAttribute("teams", teams);
System.out.println(tournois);
System.out.println(teams);
System.out.println("hhhhhhhhhhh");
request.getRequestDispatcher("Gerant/Reservation/tournoi.jsp").forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"anelbaki2@gamil.com"
] | anelbaki2@gamil.com |
6c020aff61f140b6e584dd56d8c5123786af36ae | 81719679e3d5945def9b7f3a6f638ee274f5d770 | /aws-java-sdk-applicationautoscaling/src/main/java/com/amazonaws/services/applicationautoscaling/model/transform/PutScalingPolicyRequestProtocolMarshaller.java | 5d6a59bbd59edfa22344049e2db6f34b74d90ae4 | [
"Apache-2.0"
] | permissive | ZeevHayat1/aws-sdk-java | 1e3351f2d3f44608fbd3ff987630b320b98dc55c | bd1a89e53384095bea869a4ea064ef0cf6ed7588 | refs/heads/master | 2022-04-10T14:18:43.276970 | 2020-03-07T12:15:44 | 2020-03-07T12:15:44 | 172,681,373 | 1 | 0 | Apache-2.0 | 2019-02-26T09:36:47 | 2019-02-26T09:36:47 | null | UTF-8 | Java | false | false | 2,759 | java | /*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.applicationautoscaling.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.applicationautoscaling.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* PutScalingPolicyRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class PutScalingPolicyRequestProtocolMarshaller implements Marshaller<Request<PutScalingPolicyRequest>, PutScalingPolicyRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.AWS_JSON).requestUri("/")
.httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true)
.operationIdentifier("AnyScaleFrontendService.PutScalingPolicy").serviceName("AWSApplicationAutoScaling").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public PutScalingPolicyRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<PutScalingPolicyRequest> marshall(PutScalingPolicyRequest putScalingPolicyRequest) {
if (putScalingPolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<PutScalingPolicyRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING,
putScalingPolicyRequest);
protocolMarshaller.startMarshalling();
PutScalingPolicyRequestMarshaller.getInstance().marshall(putScalingPolicyRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
8f15310404cc36499336b055d872c27be6aa5f38 | a0f04a360f99a2ee85f9c49201e7b8edcca8f1fa | /RestClient/app/src/test/java/com/semico/support/restclient/ExampleUnitTest.java | c20f7e13458c7ca88e7b1e68ee7cc6d2ce080abf | [
"Apache-2.0"
] | permissive | Luisginan/RestClient-Android | 90cbb7c6f276b6778e30bdb5a4deeb42ddbe4b5b | 0814f4909cef6b3670c0c3e3d50e9f43c03a6a64 | refs/heads/master | 2016-09-13T12:33:20.393230 | 2016-05-23T04:31:25 | 2016-05-23T04:31:25 | 59,444,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package com.semico.support.restclient;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"luiz@algolabsolution.com"
] | luiz@algolabsolution.com |
47ed937985f3af59fc8b09ce5ced0910274ac6bf | 55bb8bde8f1c00b78af53aaeeebad27d84f28d88 | /src/model/Booking.java | 0b2b0835be69ed10b2b10a4e290997bb9231bca3 | [] | no_license | jtht/HBV401G_final | d02ae074b816516c7847ebd2956f0b9b575439ce | 521070338fde9845ca69edbf35b85488144305c1 | refs/heads/master | 2021-01-01T05:43:22.536063 | 2016-04-20T18:42:38 | 2016-04-20T18:42:38 | 56,541,864 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,057 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package model;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import model.Interfaces.BookingInterface;
/**
*
* @author Mogget
*/
public class Booking implements BookingInterface{
private TripPackage packageToBook;
private User user;
final private pakki.OrderManager flightBooker = new pakki.OrderManager();
private int[] ret;
public int[] bookPackageForUser(TripPackage pakki, Profile profile, User user) {
List<pakki.Person> people = new ArrayList<>();
DateFormat df = new SimpleDateFormat("ddMMyy");
for(int i = 0; i < profile.getPartySize(); i++) {
people.add(flightBooker.makePersons(user.getName() + i,
df.format(user.getBirthDate()) + "-xxxx",
false,
false,
"seat" + i,
1));
}
pakki.Order tmp = flightBooker.makeOrder(people,
"tmp@tmp.tmp",
"555-tmp",
"",
profile.getYoungChildren() ? 1 : 0,
pakki.getFlight(),
1);
ret = new int[4];
ret[0] = tmp.getOrderNr();
boolean hotelret = HotelSearch.System.HotelBooker.bookHotel(user.getName(),
Integer.parseInt(df.format(user.getBirthDate())),
Date.from(profile.getDepartingDate().atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()),
Date.from(profile.getArrivalDate().atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()),
pakki.getHotel().rooms.get(0));
if(hotelret) {
ret[1] = 1;
} else {
ret[1] = -1;
}
return ret;
}
}
| [
"hikgk1@users.noreply.github.com"
] | hikgk1@users.noreply.github.com |
d1ce1ae53f7b36ce1d8565c58f3ef79a08682f77 | 458d3a75de1a916439f75af20aec3ff995d29f13 | /src/main/java/com/endava/internship2020/model/beverage/CoffeeLatte.java | 58c4fbcf223e5c7e4a73e2886b72eb31a6337b2b | [] | no_license | RichardTrombitas/Coffee-Shop | e53dcf952c6c05ca492f63faffbe1c591945322e | 5e3399018f9fad33df672e25444fc308e28e9cf2 | refs/heads/master | 2023-01-01T20:32:53.949760 | 2020-10-27T14:56:41 | 2020-10-27T14:56:41 | 307,738,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 608 | java | package com.endava.internship2020.model.beverage;
import com.endava.internship2020.model.Recipe;
import com.endava.internship2020.model.ingredient.coffeeBase.EspressoBase;
import com.endava.internship2020.model.ingredient.topping.MilkFoam;
import com.endava.internship2020.model.ingredient.topping.SteamedMilk;
public class CoffeeLatte extends Beverage {
public CoffeeLatte(){
super(BeverageType.COFFEE_LATTE.getName(),
new Recipe(BeverageType.COFFEE_LATTE.getName(), new EspressoBase(1)));
addTopping(new SteamedMilk(1.5));
addTopping(new MilkFoam(1));
}
}
| [
"richard.trombitas@yahoo.com"
] | richard.trombitas@yahoo.com |
c84cc7a629e86b9d5e11f91f3a9d1d1eda9d9ec4 | 9a80d20cd0e8a975e3a01ae15ecb62154bb7f3ea | /src/com/cacheserverdeploy/deploy/dataStructure/Stack.java | c5d970e85703ea5fb0ecdca106088ca1b8f58b65 | [] | no_license | zhenyutu/huawei-codecraft-2017 | 4c19ecc650c69aae4755fbffd2024667f08a1f7e | 2d9e9b3eae2092a4f768c23ec71c76ce0fb3c535 | refs/heads/master | 2021-03-24T09:35:03.853823 | 2017-03-11T11:28:43 | 2017-03-11T11:46:35 | 84,278,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,947 | java | package com.cacheserverdeploy.deploy.dataStructure;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Created by tuzhenyu on 17-3-10.
* @author tuzhenyu
*/
public class Stack<Item> implements Iterable<Item> {
private int N;
private Node<Item> first;
private static class Node<Item> {
private Item item;
private Node<Item> next;
}
public Stack() {
first = null;
N = 0;
}
public boolean isEmpty() {
return first == null;
}
public int size() {
return N;
}
public void push(Item item) {
Node<Item> oldfirst = first;
first = new Node<Item>();
first.item = item;
first.next = oldfirst;
N++;
}
public Item pop() {
if (isEmpty()) throw new NoSuchElementException("Stack underflow");
Item item = first.item;
first = first.next;
N--;
return item;
}
public Item peek() {
if (isEmpty()) throw new NoSuchElementException("Stack underflow");
return first.item;
}
public String toString() {
StringBuilder s = new StringBuilder();
for (Item item : this)
s.append(item + " ");
return s.toString();
}
public Iterator<Item> iterator() {
return new ListIterator<Item>(first);
}
private class ListIterator<Item> implements Iterator<Item> {
private Node<Item> current;
public ListIterator(Node<Item> first) {
current = first;
}
public boolean hasNext() {
return current != null;
}
public void remove() {
throw new UnsupportedOperationException();
}
public Item next() {
if (!hasNext()) throw new NoSuchElementException();
Item item = current.item;
current = current.next;
return item;
}
}
}
| [
"1572629866@qq.com"
] | 1572629866@qq.com |
eb55da2784cacc51e813f55e397fe35ed3891f14 | 64c92f62962b3707de056ed0bdb91b4ef7383bd1 | /src/main/java/com/lynch/domain/DownInfoB_LoRa.java | 929bdd79d5f029e093fb86663d73adadb9918bca | [] | no_license | flywind2/LoRaServer_Netty | fb80c4bfda4e9403d1e9dc2cdc26d14dc95cf9a9 | 05923c183a0ab46e9d2d128567f06e723785a9b4 | refs/heads/master | 2022-03-03T02:42:18.641252 | 2019-08-04T14:35:32 | 2019-08-04T14:35:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,256 | java | package com.lynch.domain;
import com.lynch.util.base64.base64__;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DownInfoB_LoRa implements DownInfoForm {
/**
* class B 的各项 JSON 数据
*/
private boolean imme;
private double tmms;
//private double tmst;
private boolean ncrc;
private float freq;
private int rfch;
private int powe;
private String modu;
private String datr;
private String codr;
private boolean ipol;
private int prea;
private int size;
private String data;
@Override
public DownInfoForm ConstructDownInfo(UpInfoForm info, byte[] data, int type) {
InfoLoraModEndForm infoLoraModEndForm = (InfoLoraModEndForm) info;
DownInfoB_LoRa downInfoB_LoRa = new DownInfoB_LoRa();
downInfoB_LoRa.setImme(false);
long finaltime = ClassBNodeOpens.slotsStart();
double cha = (double) 315964800 * 1000;
//可以和当前时间进行对比,从而抛弃已过时间点
//将已执行的时间舍弃
//downInfoB_LoRa.setTmst(infoLoraModEndForm.getTmst());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String sd = sdf.format(new Date((long) (finaltime + cha))); // 时间戳转换成时间
if (((finaltime + cha) - System.currentTimeMillis()) < 30000 && ((finaltime + cha) - System.currentTimeMillis()) > 0) {
downInfoB_LoRa.setTmms(finaltime);
System.out.println(sd);
System.out.println("N finaltime:" + finaltime);
}
//System.out.println(infoLoraModEndForm.getTmst());
downInfoB_LoRa.setNcrc(false);
downInfoB_LoRa.setFreq((float) 434.665);
downInfoB_LoRa.setRfch(0); //下行
downInfoB_LoRa.setCodr(infoLoraModEndForm.getCodr());
downInfoB_LoRa.setPowe(0);
downInfoB_LoRa.setModu("LORA");
downInfoB_LoRa.setDatr(infoLoraModEndForm.getDatr_lora());
downInfoB_LoRa.setIpol(false);
downInfoB_LoRa.setPrea(8);
downInfoB_LoRa.setSize(infoLoraModEndForm.getSize() + 2);
// System.out.println(data.length);
downInfoB_LoRa.setData(base64__.encode(data));
return downInfoB_LoRa;
}
public boolean isImme() {
return imme;
}
public void setImme(boolean imme) {
this.imme = imme;
}
public double getTmms() {
return tmms;
}
public void setTmms(double tmms) {
this.tmms = tmms;
}
public boolean isNcrc() {
return ncrc;
}
public void setNcrc(boolean ncrc) {
this.ncrc = ncrc;
}
public float getFreq() {
return freq;
}
public void setFreq(float freq) {
this.freq = freq;
}
public int getRfch() {
return rfch;
}
public void setRfch(int rfch) {
this.rfch = rfch;
}
public int getPowe() {
return powe;
}
public void setPowe(int powe) {
this.powe = powe;
}
public String getModu() {
return modu;
}
public void setModu(String modu) {
this.modu = modu;
}
public String getDatr() {
return datr;
}
public void setDatr(String datr) {
this.datr = datr;
}
public String getCodr() {
return codr;
}
public void setCodr(String codr) {
this.codr = codr;
}
public boolean isIpol() {
return ipol;
}
public void setIpol(boolean ipol) {
this.ipol = ipol;
}
public int getPrea() {
return prea;
}
public void setPrea(int prea) {
this.prea = prea;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
//
// public double getTmst() {
// return tmst;
// }
//
// public void setTmst(double tmst) {
// this.tmst = tmst;
// }
}
| [
"lynch_jach@126.com"
] | lynch_jach@126.com |
44694854110a9d2f511d25d40a212c0a7a09fb65 | 06454a954eebe3c00773e1231298cf77743e2dbb | /app/src/main/java/es/covalco/exemplerecycleview/CrudActivity.java | 78c5defc6ca0b369dc5ff339b47088cf676d85c4 | [] | no_license | MiquelCasals/recycle_view_example | 358b64f829bec7f0d577de25d44a6d992aa662ea | b3c4edd358d09f36c63c1f9589fb49feba733fbc | refs/heads/master | 2020-05-30T21:36:15.535805 | 2019-06-15T16:15:25 | 2019-06-15T16:15:25 | 189,974,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,755 | java | package es.covalco.exemplerecycleview;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
// Llibreria de les Validacions de camps del formulari
import com.basgeekball.awesomevalidation.AwesomeValidation;
import com.basgeekball.awesomevalidation.ValidationStyle;
import com.basgeekball.awesomevalidation.utility.RegexTemplate;
import java.util.ArrayList;
/**
* Exemple de manteniment de dades en formulari i gravació en BD SQLite
*/
public class CrudActivity extends Activity
implements View.OnClickListener,
AdapterView.OnItemSelectedListener {
// Declaramos los elementos de la interfaz
private Button btnCrear;
private Button btnVer;
private Button btnEliminar;
private EditText editNombre;
private EditText editComentario;
private TextView txtNombre;
private TextView txtComentario;
// Declaración del spinner y su Adapter
private Spinner spinComentarios;
private ArrayAdapter spinnerAdapter;
// Lista de comentarios y comentario actual
private ArrayList<Comentario> lista;
private Comentario comentario;
// Controlador de base de datos
private MyOpenHelper db;
private AwesomeValidation awesomeValidation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_crud);
awesomeValidation = new AwesomeValidation(ValidationStyle.BASIC);
// Obtenim tots els controls
editNombre = (EditText) findViewById(R.id.editNombre);
editComentario = (EditText) findViewById(R.id.editComentario);
txtNombre = (TextView) findViewById(R.id.txtNombre);
txtComentario = (TextView) findViewById(R.id.txtComentario);
txtNombre.setEnabled(false);
txtComentario.setEnabled(false);
btnCrear = (Button) findViewById(R.id.btnCrear);
btnVer = (Button) findViewById(R.id.btnVer);
btnEliminar = (Button) findViewById(R.id.btnEliminar);
btnCrear.setOnClickListener(this);
btnVer.setOnClickListener(this);
btnEliminar.setOnClickListener(this);
// Inciamos el controlador de la base de datos
db = new MyOpenHelper(this);
// Iniciamos el spinner y la lista de comentarios
spinComentarios = (Spinner) findViewById(R.id.spinComentarios);
lista = db.getComments();
// Creamos el adapter y lo asociamos al spinner
spinnerAdapter = new ArrayAdapter<Comentario>(this,
android.R.layout.simple_spinner_dropdown_item,
lista);
spinComentarios.setAdapter(spinnerAdapter);
spinComentarios.setOnItemSelectedListener(this);
// Añadimos la validación al formulario
addValidationToViews();
}
@Override
public void onClick(View view) {
// Acciones de cada botón
switch (view.getId()) {
// Botó Crear
case R.id.btnCrear:
if (awesomeValidation.validate()) {
// Insertamos un nuevo elemento en base de datos
db.insertar(editNombre.getText().toString(),
editComentario.getText().toString());
// Actualitzem el spinner de comentaris
refrescaSpinner();
// Here, we are sure that form is successfully validated. So, do your stuffs now...
Toast.makeText(this,
"Form validated Successfully",
Toast.LENGTH_LONG).show();
// Limpiamos el formulario
editNombre.setText("");
editComentario.setText("");
}
break;
// Botó Ver
case R.id.btnVer:
awesomeValidation.clear();
if (comentario != null) {
txtNombre.setText(comentario.getNombre());
txtComentario.setText(comentario.getComentario());
}
break;
// Botó Eliminar
case R.id.btnEliminar:
awesomeValidation.clear();
// Si hay algun comentario seleccionado lo borramos de la base de datos y actualizamos el spinner
if (comentario != null) {
db.borrar(comentario.getId());
refrescaSpinner();
// Limpiamos los datos del panel inferior
txtNombre.setText("");
txtComentario.setText("");
comentario = null;
}
break;
}
}
private void addValidationToViews() {
awesomeValidation.addValidation(this, R.id.editNombre,
RegexTemplate.NOT_EMPTY, R.string.invalid_nombre);
awesomeValidation.addValidation(this, R.id.editComentario,
RegexTemplate.NOT_EMPTY, R.string.invalid_comentario);
}
private void refrescaSpinner() {
// Actualizamos la llista de comentarios
lista = db.getComments();
// Actualizamos el adapter y lo asociamos de nuevo al spinner
spinnerAdapter = new ArrayAdapter<Comentario>(this,
android.R.layout.simple_spinner_dropdown_item,
lista);
spinComentarios.setAdapter(spinnerAdapter);
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
if (adapterView.getId() == R.id.spinComentarios) {
// SI hay elementos en la base de datos, establecemos el comentario actual a partir
// del indice del elemento seleccionado en el spinner.
if (lista.size() > 0) {
comentario = lista.get(position);
}
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
}
| [
"mcasals@covalco.es"
] | mcasals@covalco.es |
8c826a3195c821155502326f67ad2643007a12e9 | 123d36205407ed2fea67b466599f26e88c594078 | /blog-core/src/main/java/com/zyd/blog/util/RestClientUtil.java | d7f9c133aa82a1e3e7c2b721102664c62c88c07d | [
"MIT"
] | permissive | jackshine/DBlog | 7e9adb6f0da0ca7477c47d4eae30f0cc542a54af | 098669447fac6ef74a444f2e0030c2b68cd39232 | refs/heads/master | 2020-03-13T07:15:56.273092 | 2018-04-24T04:11:13 | 2018-04-24T04:11:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,488 | java | /**
* MIT License
* Copyright (c) 2018 yadong.zhang
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.zyd.blog.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.KeyStore;
import java.security.SecureRandom;
import java.util.Map;
import java.util.Set;
/**
* Http接口请求工具
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @date 2018/4/18 11:48
* @since 1.0
*/
public class RestClientUtil {
protected static final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.10 Safari/537.36";
private static final Logger LOGGER = LoggerFactory.getLogger(RestClientUtil.class);
public static String post(String urlString, Map<String, Object> params, Map<String, String> requestHeader) {
return post(urlString, null, null, params, requestHeader);
}
public static String post(String urlString, String certPath, String certPassword, Map<String, Object> params, Map<String, String> requestHeader) {
return request("POST", urlString, certPath, certPassword, params, "UTF-8", requestHeader);
}
public static String get(String urlString) {
return get(urlString, null, null, "UTF-8", null);
}
public static String get(String urlString, Map<String, String> requestHeader) {
return get(urlString, null, null, "UTF-8", requestHeader);
}
public static String get(String urlString, String encode) {
return get(urlString, null, null, encode, null);
}
public static String get(String urlString, String certPath, String certPassword, String encode, Map<String, String> requestHeader) {
return request("GET", urlString, certPath, certPassword, null, encode, null);
}
public static String put(String urlString) {
return get(urlString, null, null, "UTF-8", null);
}
public static String put(String urlString, String encode) {
return get(urlString, null, null, "UTF-8", null);
}
public static String put(String urlString, String certPath, String certPassword) {
return request("PUT", urlString, certPath, certPassword, null, "UTF-8", null);
}
/**
* @param method:
* GET/PUT/POST default GET
* @param urlString:
* requried
* @param certPath:
* if not null secure request
* @param certPassword:
* @param params:
* default null
*/
public static String request(String method, String urlString, String certPath, String certPassword, Map<String, Object> params, String encode, Map<String, String> requestHeader) {
// 解决因jdk版本问题造成的SSL请求失败的问题
java.lang.System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");
final HttpURLConnection connection;
try {
if (certPath != null && certPath.length() > 0) {
System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");
connection = openSecureConnection(urlString, certPath, certPassword);
} else {
connection = openConnection(urlString);
}
connection.setRequestMethod(method);
if (null != requestHeader) {
Set<Map.Entry<String, String>> entrySet = requestHeader.entrySet();
for (Map.Entry<String, String> entry : entrySet) {
connection.setRequestProperty(entry.getKey(), entry.getValue());
}
} else {
connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
connection.setRequestProperty("Accept-Charset", "utf-8");
connection.setRequestProperty("User-Agent", USER_AGENT);
}
connection.setDoOutput(true);
if (!CollectionUtils.isEmpty(params)) {
final OutputStream outputStream = connection.getOutputStream();
StringBuilder paramsStr = new StringBuilder();
Set<Map.Entry<String, Object>> set = params.entrySet();
for (Map.Entry<String, Object> stringObjectEntry : set) {
paramsStr.append(stringObjectEntry.getKey()).append("=").append(stringObjectEntry.getValue()).append("&");
}
paramsStr.setLength(paramsStr.length() - 1);
writeOutput(outputStream, paramsStr.toString());
outputStream.close();
}
LOGGER.info("RestClientUtil url: {}, response: {} : {}", urlString, connection.getResponseCode(), connection.getResponseMessage());
if (connection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
return readInput(connection.getInputStream(), encode);
} else {
return readInput(connection.getErrorStream(), encode);
}
} catch (Exception e) {
LOGGER.error("Http请求失败{}", urlString, e);
}
return null;
}
private static HttpsURLConnection openSecureConnection(final String urlString, final String certPath, final String certPassword) throws Exception {
final URL url = new URL(urlString);
final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509");
final KeyStore keyStore = KeyStore.getInstance("PKCS12");
final InputStream keyInput = new FileInputStream(certPath);
keyStore.load(keyInput, certPassword.toCharArray());
keyInput.close();
keyManagerFactory.init(keyStore, certPassword.toCharArray());
final SSLContext context = SSLContext.getInstance("TLS");
context.init(keyManagerFactory.getKeyManagers(), null, new SecureRandom());
final SSLSocketFactory socketFactory = context.getSocketFactory();
final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setSSLSocketFactory(socketFactory);
return connection;
}
protected static HttpURLConnection openConnection(final String urlString) throws Exception {
final URL url = new URL(urlString);
return (HttpURLConnection) url.openConnection();
}
protected static void writeOutput(final OutputStream outputStream, final String params) throws Exception {
ByteArrayInputStream inputStram = new ByteArrayInputStream(params.getBytes("UTF-8"));
final byte[] buffer = new byte[1024];
int length = 0;
while ((length = inputStram.read(buffer)) != -1) {
outputStream.write(buffer, 0, length);
}
}
protected static String readInput(final InputStream is, String encode) {
StringBuilder content = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, encode));) {
String line = "";
while ((line = reader.readLine()) != null) {
content.append(line);
}
} catch (Exception e) {
e.printStackTrace();
}
return content.toString();
}
}
| [
"yadong.zhang0415@gamil.com"
] | yadong.zhang0415@gamil.com |
ca996e123d7bcc2501ba8ed206b5af894f7512ce | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-ws/results/XWIKI-13942-4-3-Single_Objective_GGA-WeightedSum/org/xwiki/model/internal/reference/AbstractStringEntityReferenceResolver_ESTest_scaffolding.java | 15f99d9004a4684b49b958489a1bb59ad71c4f45 | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,209 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Mon Mar 30 17:03:21 UTC 2020
*/
package org.xwiki.model.internal.reference;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class AbstractStringEntityReferenceResolver_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.xwiki.model.internal.reference.AbstractStringEntityReferenceResolver";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(AbstractStringEntityReferenceResolver_ESTest_scaffolding.class.getClassLoader() ,
"org.xwiki.model.internal.reference.LocalizedStringEntityReferenceSerializer",
"org.xwiki.component.phase.Initializable",
"org.xwiki.model.internal.reference.AbstractStringEntityReferenceSerializer",
"org.xwiki.component.annotation.Component",
"org.xwiki.model.reference.EntityReference",
"org.xwiki.model.internal.reference.DefaultSymbolScheme$1",
"org.xwiki.model.internal.reference.SymbolScheme",
"org.xwiki.model.internal.reference.AbstractStringEntityReferenceResolver",
"org.xwiki.text.StringUtils",
"org.xwiki.component.phase.InitializationException",
"org.xwiki.model.internal.reference.DefaultSymbolScheme",
"org.apache.commons.lang3.StringUtils",
"org.xwiki.model.reference.EntityReferenceResolver",
"org.xwiki.model.internal.reference.ExplicitStringEntityReferenceResolver",
"org.xwiki.model.internal.reference.DefaultStringEntityReferenceSerializer",
"org.xwiki.model.reference.DocumentReference",
"org.xwiki.model.reference.LocalDocumentReference",
"org.xwiki.model.internal.reference.AbstractEntityReferenceResolver",
"org.xwiki.model.EntityType",
"org.xwiki.model.reference.EntityReferenceSerializer"
);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
f34a7ce4057cad25640c328813ba52939096acaa | 93e5dd567516abd477c648f81080482ce5e73ca9 | /src/com/xazd/April27/TestPhone.java | 8da80d09e6753f0fea5c3f734d7d73440f2a621b | [] | no_license | yzyu/Java | 0738c1c961c0bc8d08763223ac03c0469765c951 | 7b49395160038471e246c763650d0b6bfd166ca6 | refs/heads/master | 2020-04-28T09:37:29.665735 | 2019-03-12T03:22:09 | 2019-03-12T03:22:09 | 175,174,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package com.xazd.April27;
public class TestPhone {
public static void main(String[] args) {
Phone x = new Phone("小米", "android 6");
Cell f = new Cell("飞毛腿", 4000);
x.present();
x.download();
x.play();
x.fill(f);
}
}
| [
"785173617@qq.com"
] | 785173617@qq.com |
5b860f0332c5611ffa42f9c0801c889efedcdf8c | fe98fb10ed5545c2ba8115e08b083234448f9819 | /src/main/java/com/rest/webservices/restfulwebservices/SecurityConfiguration.java | 3922d4b2c17b0799d44bdcf0adad41efde628b39 | [] | no_license | sambit673/restful-web-services | 70eb2fedd7af9e2b6b2577f84cf907747438904e | 629ad6e8ace66aa119008195ed202b4202bc30d4 | refs/heads/master | 2022-02-15T17:21:06.343375 | 2019-09-10T07:14:44 | 2019-09-10T07:14:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package com.rest.webservices.restfulwebservices;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity.authorizeRequests().antMatchers("/").permitAll().and().authorizeRequests().antMatchers("/console/**").permitAll();
httpSecurity.csrf().disable();
httpSecurity.headers().frameOptions().disable();
}
}
| [
"devi.obilineni@tcs.com"
] | devi.obilineni@tcs.com |
e21222bf235bcaa4bbfc699171096795ad0c7fa1 | 2524e90b91b608ddd16ed143b5b3bf5ab1bcec6b | /codeforces/1420/B.java | d93d4b6f3b407f80f4e0539ef4980b48430ac8ce | [] | no_license | skittles1412/Harwest-Submissions | 2fa5f179eb48930cd7d8c62178bf17c263cdbeee | 42f42fb658b882842173997f6b9911f0d3c632aa | refs/heads/master | 2023-04-27T15:34:25.227750 | 2021-05-02T22:13:00 | 2021-05-06T18:03:37 | 325,848,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,666 | java | import java.io.BufferedOutputStream;
import java.io.Closeable;
import java.io.DataInputStream;
import java.io.Flushable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.InputMismatchException;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
static class TaskAdapter implements Runnable {
@Override
public void run() {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
FastReader in = new FastReader(inputStream);
Output out = new Output(outputStream);
BRockAndLever solver = new BRockAndLever();
int testCount = in.nextInt();
for(int i = 1; i<=testCount; i++)
solver.solve(i, in, out);
out.close();
}
}
public static void main(String[] args) throws Exception {
Thread thread = new Thread(null, new TaskAdapter(), "", 1<<28);
thread.start();
thread.join();
}
static class BRockAndLever {
public BRockAndLever() {
}
public void solve(int kase, InputReader in, Output pw) {
int n = in.nextInt();
long[] cnt = new long[32];
for(int i = 0; i<n; i++) {
cnt[Integer.numberOfLeadingZeros(in.nextInt())]++;
}
long ans = 0;
for(int i = 0; i<32; i++) {
ans += cnt[i]*(cnt[i]-1) >> 1;
}
pw.println(ans);
}
}
static interface InputReader {
int nextInt();
}
static class FastReader implements InputReader {
final private int BUFFER_SIZE = 1<<16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer;
private int bytesRead;
public FastReader(InputStream is) {
din = new DataInputStream(is);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public int nextInt() {
int ret = 0;
byte c = skipToDigit();
boolean neg = (c=='-');
if(neg) {
c = read();
}
do {
ret = ret*10+c-'0';
} while((c = read())>='0'&&c<='9');
if(neg) {
return -ret;
}
return ret;
}
private boolean isDigit(byte b) {
return b>='0'&&b<='9';
}
private byte skipToDigit() {
byte ret;
while(!isDigit(ret = read())&&ret!='-') ;
return ret;
}
private void fillBuffer() {
try {
bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
}catch(IOException e) {
e.printStackTrace();
throw new InputMismatchException();
}
if(bytesRead==-1) {
buffer[0] = -1;
}
}
private byte read() {
if(bytesRead==-1) {
throw new InputMismatchException();
}else if(bufferPointer==bytesRead) {
fillBuffer();
}
return buffer[bufferPointer++];
}
}
static class Output implements Closeable, Flushable {
public StringBuilder sb;
public OutputStream os;
public int BUFFER_SIZE;
public String lineSeparator;
public Output(OutputStream os) {
this(os, 1<<16);
}
public Output(OutputStream os, int bs) {
BUFFER_SIZE = bs;
sb = new StringBuilder(BUFFER_SIZE);
this.os = new BufferedOutputStream(os, 1<<17);
lineSeparator = System.lineSeparator();
}
public void println(long l) {
println(String.valueOf(l));
}
public void println(String s) {
sb.append(s);
println();
}
public void println() {
sb.append(lineSeparator);
}
private void flushToBuffer() {
try {
os.write(sb.toString().getBytes());
}catch(IOException e) {
e.printStackTrace();
}
sb = new StringBuilder(BUFFER_SIZE);
}
public void flush() {
try {
flushToBuffer();
os.flush();
}catch(IOException e) {
e.printStackTrace();
}
}
public void close() {
flush();
try {
os.close();
}catch(IOException e) {
e.printStackTrace();
}
}
}
}
| [
"61439840+skittles1412@users.noreply.github.com"
] | 61439840+skittles1412@users.noreply.github.com |
8b599bea2a59b47b96eb033f3a78bf70b128040c | 4acb89b41f4d8bcce92f94e6f98bf5ad0b8b1343 | /vertx-sql-client/src/main/java/io/vertx/sqlclient/impl/RowInternal.java | 3cd39523756d6d5c5ef88c2e28c6390879b4e2b9 | [
"Apache-2.0"
] | permissive | cocktail18/vertx-sql-client | 513db2bb56ae5c51cda0ed824edc2863fab3a49a | ee984b44d6c743d44d7cd6fd0ced7daf6527040e | refs/heads/master | 2020-07-22T16:41:14.015747 | 2019-08-26T11:41:17 | 2019-08-26T11:41:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 771 | java | /*
* Copyright (C) 2017 Julien Viet
*
* 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 io.vertx.sqlclient.impl;
import io.vertx.sqlclient.Row;
public interface RowInternal extends Row {
void setNext(RowInternal next);
RowInternal getNext();
}
| [
"julien@julienviet.com"
] | julien@julienviet.com |
c1e296006738557011052f8ff9dac8f238306612 | 3ab2ad7f48cb5788427a2e4ef1586c32caaee3ce | /gui/ElevatorFrame.java | 89b6af5014dabbf478d6ef63e752e7045d79b0a8 | [] | no_license | TDato/ElevatorSimulator | 51c0c555ded1134babfd1019b53f503d8613cea1 | 4871c95d167f2957ad06f8dbc5a9d36caa58a96a | refs/heads/master | 2021-03-30T22:22:52.998351 | 2018-03-08T21:50:38 | 2018-03-08T21:50:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,961 | java | package gui;
import direction.Direction;
import java.util.HashMap;
/**
*
* @author Tommy Dato
*/
public class ElevatorFrame extends javax.swing.JFrame {
private final HashMap<Integer, ElevatorPanel> elevatorPanels = new HashMap<>();
private final int maxFloors;
public ElevatorFrame(int max) {
initComponents();
maxFloors = max;
setTitle("Elevator Display");
}
public void addElevator(int id, int initValue) {
ElevatorPanel ep = new ElevatorPanel(id);
ep.setMax(maxFloors);
ep.setFloor(initValue);
this.getContentPane().add(ep);
elevatorPanels.put(id, ep);
pack();
setVisible(true);
}
public ElevatorPanel getPanel(int i) {
return elevatorPanels.get(i);
}
public void setDirection(int elev, Direction dir) {
getPanel(elev).setDirection(dir);
}
public void setFloor(int elev, int value) {
getPanel(elev).setFloor(value);
}
public void setNumRiders(int elev, int value) {
getPanel(elev).setNumRiders(value);
}
public void openDoors(int id) {
getPanel(id).openDoors();
}
public void closeDoors(int id) {
getPanel(id).closeDoors();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new java.awt.FlowLayout());
pack();
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}
| [
"tom.dato@gmail.com"
] | tom.dato@gmail.com |
7525b191d5981e19150b81c9ddc7467bd322796b | e2cb259ec64703b5a3a3eec62e6818cf4e55227c | /app/src/main/java/com/example/chatapplication/LoginActivity.java | 4f48fe4bf94016fb8ecdd4001d6a0c58b3b8f9f2 | [] | no_license | Guvez03/ChatApplication | 3855c48aff9395d85758c64dbc1603ab35ab83fa | a5072d94a6e955433c2437a2e0001ad7323edcc3 | refs/heads/master | 2022-08-24T14:50:33.687354 | 2020-05-29T19:21:19 | 2020-05-29T19:21:19 | 263,572,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,423 | java | package com.example.chatapplication;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.iid.FirebaseInstanceId;
public class LoginActivity extends AppCompatActivity {
public EditText email;
Toolbar toolbar;
public EditText password;
public Button sign__up_button;
private ImageButton sign__in_button;
private FirebaseAuth mAuth;
private ProgressDialog LoadingBar;
private FirebaseUser user;
private DatabaseReference databaseReference,UsersRef;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
email= findViewById(R.id.email);
password = findViewById(R.id.password);
sign__in_button = findViewById(R.id.sign__in_button);
sign__up_button = findViewById(R.id.sign__up_button);
LoadingBar = new ProgressDialog(this);
mAuth = FirebaseAuth.getInstance(); // firebase sınıfından yeni bir sınıf oluşturduk Verileri getirdik
user = mAuth.getCurrentUser(); // şuanki kullanıcı
databaseReference = FirebaseDatabase.getInstance().getReference(); // veritabanında bu referans işe işlemler yapabiliriz
UsersRef = FirebaseDatabase.getInstance().getReference().child("Profiles"); // veritabanında bu referans işe işlemler yapabiliriz
toolbar = (Toolbar) findViewById(R.id.toolbar);
if(user != null){
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
}
}
public void signin (View view) {
LoadingBar.setTitle("Giriş Yapılıyor");
LoadingBar.setMessage("Lütfen Bekleyin");
LoadingBar.setCanceledOnTouchOutside(false);
LoadingBar.show();
mAuth.signInWithEmailAndPassword(email.getText().toString(),password.getText().toString()).addOnCompleteListener(this,new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
String currentUserId = mAuth.getCurrentUser().getUid();
String deviceToken = FirebaseInstanceId.getInstance().getToken();
UsersRef.child(currentUserId).child("device_token")
.setValue(deviceToken)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task)
{
if (task.isSuccessful())
{
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
Toast.makeText(LoginActivity.this, "Giriş Başarılı...", Toast.LENGTH_SHORT).show();
LoadingBar.dismiss();
}
}
});
String userId = mAuth.getCurrentUser().getUid(); // kayıt olduğumuz verinin idsini aldık
databaseReference.child("Profil").child(userId).setValue(""); // ID yi veritabanına kaydettik
LoadingBar.dismiss();
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
}
else{
Toast.makeText(LoginActivity.this,"E-mail veya Password hatalı lütfen kontrol ediniz!",Toast.LENGTH_SHORT).show();
LoadingBar.dismiss();
}
}
});
// Intent ıntent = new Intent(LoginActivity.this, MainActivity.class);
// startActivity(ıntent);
}
public void signup (View view) {
// Kullanıcı oluşturmamız gerek
// toString metodu bir objenin içeriğini string olarak almamızı sağlar
/* mAuth.createUserWithEmailAndPassword(email.getText().toString(),password.getText().toString())
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
// onComplete methodu başarı veya başarısızlıklık durumunda tek sefer çalışır.
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
// task dediğimiz o andaki görevdir.
// eğer giriş başarılı ise kullanıcının email bilgisini görebiliriz.
FirebaseUser user = mAuth.getCurrentUser();
String usermail = user.getEmail().toString();
System.out.println("user e mail " + usermail);
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
}
else{
Toast.makeText(LoginActivity.this,"Başarısız",Toast.LENGTH_SHORT).show();
}
}
});*/
Intent register = new Intent(LoginActivity.this,RegisterActivity.class);
startActivity(register);
}
/* @Override
public void onStart() {
super.onStart();
if (user != null){
Intent intent = new Intent(LoginActivity.this,MainActivity.class);
startActivity(intent);
}
}*/
}
| [
"ahmetguvez03@hotmail.com"
] | ahmetguvez03@hotmail.com |
18751d362a78f9bda02560b5d872117e42842321 | f26e89c30c496d7f0fe8cb396ab38240a76be7b2 | /GameBoard/src/main/java/com/example/demo/controller/IGameBoardController.java | ad57279b6f0e475f2e99a88cf236e942b4491443 | [] | no_license | akashkanthale/MyGitRepo | a6a987842906ddb141979f81c025d7ea456ee21c | 071d56ae0a21ca1d9e927da525570b716c9cd23a | refs/heads/master | 2022-12-02T19:41:02.644566 | 2020-08-15T15:32:34 | 2020-08-15T15:32:34 | 287,771,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 171 | java | package com.example.demo.controller;
import com.example.demo.model.GameBoardModel;
public interface IGameBoardController {
public GameBoardModel createGameBoard();
} | [
"akashkanthale@gmail.com"
] | akashkanthale@gmail.com |
785c0e4a81b24e986650a5fd9a7e7a292fc1662b | d6f7ae78a6ff4571da92a378eab20576c0faf2f5 | /modules/citrus-integration/src/it/java/com/consol/citrus/javadsl/design/XMLValidationMatcherJavaIT.java | eba26e1a1275e4cd73e71dc5f2844fa98f552519 | [
"Apache-2.0"
] | permissive | debovema/citrus | 3ccb2be136f95efaf75503d9c9a7e65b7bcf5aa0 | 5e921676f87eacd08652f0812ab81c1d936023ed | refs/heads/master | 2021-01-24T11:08:07.297485 | 2016-10-07T13:56:14 | 2016-10-07T13:56:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,255 | java | /*
* Copyright 2006-2013 the original author or authors.
*
* 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.consol.citrus.javadsl.design;
import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;
import com.consol.citrus.annotations.CitrusTest;
import org.springframework.http.HttpStatus;
import org.testng.annotations.Test;
/**
* @author Christoph Deppisch
*/
@Test
public class XMLValidationMatcherJavaIT extends TestNGCitrusTestDesigner {
@CitrusTest
public void xmlValidationMatcher() {
variable("greetingText", "Hello Citrus");
parallel(
http().client("httpClient")
.send()
.post()
.payload("<testRequestMessage>" +
"<text>citrus:cdataSection('<data>" +
"<greeting>Hello Citrus</greeting>" +
"<timestamp>2012-07-01T00:00:00</timestamp>" +
"</data>')</text>" +
"</testRequestMessage>")
.contentType("text/xml")
.accept("text/xml, */*"),
sequential(
http().server("httpServerRequestEndpoint")
.receive()
.post("/test")
.payload("<testRequestMessage>" +
"<text>citrus:cdataSection('@matchesXml('<data>" +
"<greeting>${greetingText}</greeting>" +
"<timestamp>@ignore@</timestamp>" +
"</data>')@')</text>" +
"</testRequestMessage>")
.contentType("text/xml")
.accept("text/xml, */*")
.header("Authorization", "Basic c29tZVVzZXJuYW1lOnNvbWVQYXNzd29yZA==")
.extractFromHeader("citrus_jms_messageId", "correlation_id"),
http().server("httpServerResponseEndpoint")
.send()
.response(HttpStatus.OK)
.payload("<testResponseMessage>" +
"<text>Hello Citrus</text>" +
"</testResponseMessage>")
.version("HTTP/1.1")
.contentType("text/xml")
.header("citrus_jms_correlationId", "${correlation_id}")
)
);
http().client("httpClient")
.receive()
.response(HttpStatus.OK)
.payload("<testResponseMessage>" +
"<text>Hello Citrus</text>" +
"</testResponseMessage>")
.version("HTTP/1.1");
}
} | [
"deppisch@consol.de"
] | deppisch@consol.de |
b3280c546d2847328c72e862be8d369a3693f0e8 | 6c03828eb06c0286792a02d5faad11ef1c08ff97 | /singleton/src/main/java/com/andy/design/pattern/LazySingleton4ThreadWithCodeBlock.java | eaab2e16d8d3e65b4b90623f026fb73eb5408829 | [] | no_license | andy812713/design-pattern | a4b10e6bc42c5e431d7430c08bcca47a54fa99f3 | eee9544ff06f60e90f3e4b51b801b8cc13bfc9f6 | refs/heads/master | 2021-06-30T14:45:09.610014 | 2019-06-08T12:32:44 | 2019-06-08T12:32:44 | 176,295,193 | 0 | 0 | null | 2020-10-13T13:44:38 | 2019-03-18T13:44:43 | Java | UTF-8 | Java | false | false | 623 | java | package com.andy.design.pattern;
/**
* 懒加载
*/
public class LazySingleton4ThreadWithCodeBlock {
private static LazySingleton4ThreadWithCodeBlock instance = null;
private LazySingleton4ThreadWithCodeBlock(){}
/**
* 通过synchronized方法块,缩小同步范围,保证线程安全
* @return
*/
public static LazySingleton4ThreadWithCodeBlock getInstance() {
synchronized(LazySingleton4ThreadWithCodeBlock.class){
if(null == instance){
instance = new LazySingleton4ThreadWithCodeBlock();
}
}
return instance;
}
}
| [
"295268319@qq.com"
] | 295268319@qq.com |
6749f9afeaba77b14e41c790002d9f2197fd3483 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/6/6_983bd7ec29f458a01aa9a057e7fac86e82c93a7f/ComicViewerActivity/6_983bd7ec29f458a01aa9a057e7fac86e82c93a7f_ComicViewerActivity_t.java | a0f398db69aac57befbd01afc63b9c4bc485bc95 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 41,648 | java | /*******************************************************************************
* Copyright 2009 Robot Media SL
*
* 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 net.robotmedia.acv.ui;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
import net.androidcomics.acv.R;
import net.robotmedia.acv.Constants;
import net.robotmedia.acv.adapter.RecentListBaseAdapter;
import net.robotmedia.acv.comic.Comic;
import net.robotmedia.acv.logic.*;
import net.robotmedia.acv.provider.HistoryManager;
import net.robotmedia.acv.ui.settings.SettingsActivityPostHC;
import net.robotmedia.acv.ui.settings.SettingsActivityPreHC;
import net.robotmedia.acv.ui.widget.*;
import net.robotmedia.acv.utils.*;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.*;
import android.content.SharedPreferences.Editor;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Point;
import android.net.Uri;
import android.os.*;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.*;
import android.view.GestureDetector.OnGestureListener;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.*;
import android.widget.AdapterView.OnItemClickListener;
public class ComicViewerActivity extends ExtendedActivity implements OnGestureListener, GestureDetector.OnDoubleTapListener, ComicViewListener {
public final static String POSITION_EXTRA = "position";
private class LoadComicTask extends AsyncTask<String, Object, Comic> {
public int initialIndex = 0;
private ProgressDialog progressDialog;
@Override
protected Comic doInBackground(String... params) {
final String path = params[0];
Comic result = Comic.createComic(path);
if (result != null) {
HistoryManager.getInstance(ComicViewerActivity.this).remember(new File(path));
}
return result;
}
protected void onPostExecute (Comic result) {
if (progressDialog != null) progressDialog.dismiss();
if (result != null && !result.isError()) {
comic = result;
trackOpen();
mScreen.setVisibility(View.VISIBLE);
hideRecentItems();
preferencesController.savePreference(Constants.COMIC_PATH_KEY, comic.getPath());
mScreen.setComic(comic);
mScreen.goToScreen(initialIndex);
if(isHoneyComb()) {
new MenuHelper().invalidateOptionsMenu();
}
hideActionBar();
} else {
mScreen.setVisibility(View.GONE);
showRecentItems();
showDialog(Constants.DIALOG_LOAD_ERROR);
}
}
@Override
protected void onPreExecute () {
progressDialog = new ACVDialogFactory(ComicViewerActivity.this).createLoadProgressDialog();
progressDialog.show();
removePreviousComic(true);
}
}
private GestureDetector mGestureDetector;
private ImageButton mCornerTopLeft;
private ImageButton mCornerTopRight;
private ImageButton mCornerBottomLeft;
private ImageButton mCornerBottomRight;
private RelativeLayout mAdsContainer;
private boolean mainMenuActive = false;
protected Comic comic;
protected boolean destroyed = false;
protected ACVDialogFactory dialogFactory;
protected LoadComicTask loadComicTask = null;
protected boolean markCleanExitPending = false;
protected ViewGroup mRecentItems = null;
protected ListView mRecentItemsList = null;
protected RecentListBaseAdapter mRecentItemsListAdapter = null;
protected View mButtonsContainer;
protected View mMain;
protected ComicView mScreen;
protected PreferencesController preferencesController;
protected SharedPreferences preferences;
protected boolean requestedRotation = false;
private String mComicPath; // Used for testing
public String getComicPath() {
return mComicPath;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Constants.SCREEN_BROWSER_CODE && resultCode == RESULT_OK) {
int index = data.getIntExtra(BrowseActivity.POSITION_EXTRA, mScreen.getIndex());
if (isComicLoaded()) mScreen.goToScreen(index);
} else if (requestCode == Constants.SD_BROWSER_CODE && resultCode == RESULT_OK) {
String absolutePath = data.getStringExtra(Constants.COMIC_PATH_KEY);
this.loadComic(absolutePath);
} else if (requestCode == Constants.SETTINGS_CODE) {
boolean sensor = preferences.getBoolean(Constants.AUTO_ROTATE_KEY, false);
if (sensor) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
}
if (preferencesController.isLeftToRight()) {
if (preferencesController.isUsedForPreviousNext(Constants.TRACKBALL_RIGHT_KEY, Constants.TRACKBALL_LEFT_KEY) ||
preferencesController.isUsedForPreviousNext(Constants.INPUT_FLING_LEFT, Constants.INPUT_FLING_RIGHT) ||
preferencesController.isUsedForPreviousNext(Constants.INPUT_CORNER_BOTTOM_RIGHT, Constants.INPUT_CORNER_BOTTOM_LEFT)) {
showDialog(Constants.DIALOG_FLIP_CONTROLS);
}
} else {
if (preferencesController.isUsedForPreviousNext(Constants.TRACKBALL_LEFT_KEY, Constants.TRACKBALL_RIGHT_KEY) ||
preferencesController.isUsedForPreviousNext(Constants.INPUT_FLING_RIGHT, Constants.INPUT_FLING_LEFT) ||
preferencesController.isUsedForPreviousNext(Constants.INPUT_CORNER_BOTTOM_LEFT, Constants.INPUT_CORNER_BOTTOM_RIGHT)) {
showDialog(Constants.DIALOG_FLIP_CONTROLS);
}
}
this.adjustCornersVisibility(true); // Actions assigned to corners might have changed
adjustBrightness();
adjustLowMemoryMode();
if (isComicLoaded()) mScreen.goToScreen(mScreen.getIndex());
} else if (requestCode == Constants.SUBSCRIBE_CODE) {
switch (resultCode) {
case RESULT_OK:
DialogFactory.showSimpleAlert(this, true, R.string.dialog_subscribe_success_title, R.string.dialog_subscribe_success_text);
break;
case SubscribeActivity.RESULT_ERROR:
DialogFactory.showSimpleAlert(this, false, R.string.dialog_subscribe_error_title, R.string.dialog_subscribe_error_text);
break;
}
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
if(!isHoneyComb()) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
}
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
dialogFactory = new ACVDialogFactory(this);
mRecentItems = (ViewGroup) findViewById(R.id.main_recent);
mRecentItemsList = (ListView) findViewById(R.id.main_recent_list);
mRecentItemsList.setEmptyView(findViewById(R.id.main_recent_list_no_items));
mRecentItemsListAdapter = new RecentListBaseAdapter(this, R.layout.list_item_recent);
mRecentItemsListAdapter.setMaxNumItems(2);
mRecentItemsList.setAdapter(mRecentItemsListAdapter);
mRecentItemsList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String path = (String) parent.getItemAtPosition(position);
loadComic(path);
}
});
mGestureDetector = new GestureDetector(this);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
mButtonsContainer = findViewById(R.id.main_buttons_container);
mMain = findViewById(R.id.main_layout);
ImageView logo = (ImageView) findViewById(R.id.main_logo);
logo.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
showMenu();
}});
mScreen = (ComicView) findViewById(R.id.screen);
mScreen.setListener(this);
mCornerTopLeft = (ImageButton) findViewById(R.id.corner_top_left);
mCornerTopRight = (ImageButton) findViewById(R.id.corner_top_right);
mCornerBottomLeft = (ImageButton) findViewById(R.id.corner_bottom_left);
mCornerBottomRight = (ImageButton) findViewById(R.id.corner_bottom_right);
adjustCornersVisibility(true);
preferencesController = new PreferencesController(this);
mAdsContainer = (RelativeLayout) findViewById(R.id.mainAdsContainer);
adjustBrightness();
adjustLowMemoryMode();
// TODO: Shouldn't this be first?
if (startupOrientation(savedInstanceState)) { // If no orientation change was requested
preferencesController.checkCleanExit();
markCleanExitPending = true;
}
String comicPath = null;
if(savedInstanceState != null && savedInstanceState.containsKey(Constants.COMIC_PATH_KEY)) {
comicPath = savedInstanceState.getString(Constants.COMIC_PATH_KEY);
}
if(comicPath == null) {
showRecentItems();
showAds();
} else {
loadComic(comicPath);
}
}
@Override
public void onResume() {
mRecentItemsListAdapter.refresh();
super.onResume();
}
private void adjustLowMemoryMode() {
boolean lowMemory = preferences.getBoolean(PreferencesController.PREFERENCE_LOW_MEMORY, false);
mScreen.setPreload(!lowMemory);
mScreen.setLowMemoryTransitions(lowMemory);
}
private void adjustBrightness() {
WindowManager.LayoutParams lp = getWindow().getAttributes();
float brightness = (float) preferences.getInt(Constants.BRIGHTNESS_KEY, Math.round(lp.screenBrightness * 100)) / 100f;
if (brightness == 0) { // 0 renders the phone unusable
brightness = 1f/100f;
}
lp.screenBrightness = brightness;
getWindow().setAttributes(lp);
}
private void adjustCornerVisibility(ImageButton corner, String key, String defaultAction, boolean allInvisible) {
final String action = preferences.getString(key, defaultAction);
final boolean visible = !allInvisible && !Constants.ACTION_VALUE_NONE.equals(action);
if (visible) {
corner.setImageResource(R.drawable.corner_button);
} else {
corner.setImageDrawable(null);
}
}
private void adjustCornersVisibility(final boolean visible) {
final boolean allInvisible = !visible || preferences.getBoolean(Constants.PREFERENCE_INVISIBLE_CORNERS, false);
adjustCornerVisibility(mCornerTopLeft, Constants.INPUT_CORNER_TOP_LEFT, Constants.ACTION_VALUE_NONE, allInvisible);
adjustCornerVisibility(mCornerTopRight, Constants.INPUT_CORNER_TOP_RIGHT, Constants.ACTION_VALUE_NONE, allInvisible);
adjustCornerVisibility(mCornerBottomLeft, Constants.INPUT_CORNER_BOTTOM_LEFT, Constants.ACTION_VALUE_PREVIOUS, allInvisible);
adjustCornerVisibility(mCornerBottomRight, Constants.INPUT_CORNER_BOTTOM_RIGHT, Constants.ACTION_VALUE_NEXT, allInvisible);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
public boolean onDoubleTap(MotionEvent e) {
String action = preferences.getString(Constants.INPUT_DOUBLE_TAP, Constants.ACTION_VALUE_ZOOM_IN);
Point p = new Point(Math.round(e.getX()), Math.round(e.getY()));
if (Constants.ACTION_VALUE_ZOOM_IN.equals(action) && isComicLoaded() && mScreen.isMaxZoom()) {
return mScreen.zoom(-1, p);
} else {
return action(Constants.INPUT_DOUBLE_TAP, Constants.ACTION_VALUE_ZOOM_IN, p);
}
}
public boolean onDoubleTapEvent(MotionEvent e) {
return false;
}
public boolean onDown(MotionEvent e) {
return false;
}
public boolean onFling(MotionEvent e1, MotionEvent e2, float arg2, float arg3) {
if (mPinch) return false;
final double angle = MathUtils.getAngle(e1.getX(), e1.getY(), e2.getX(), e2.getY());
final int minFlingDifference = MathUtils.dipToPixel(this, Constants.MIN_FLING_DIFFERENCE_DIP);
final float distance = MathUtils.distance(e1.getX(), e1.getY(), e2.getX(), e2.getY());
boolean comicLoaded = isComicLoaded();
if (distance > minFlingDifference) {
if ((angle < Constants.MAX_FLING_ANGLE || Math.abs(angle - 180) < Constants.MAX_FLING_ANGLE)) {
if (e1.getX() > e2.getX()) { // Fling left
if (!comicLoaded || mScreen.isRightMost()) { return action(Constants.INPUT_FLING_LEFT, Constants.ACTION_VALUE_NEXT); }
} else { // Fling right
if (!comicLoaded || mScreen.isLeftMost()) { return action(Constants.INPUT_FLING_RIGHT, Constants.ACTION_VALUE_PREVIOUS); }
}
} else if (angle - 90 < Constants.MAX_FLING_ANGLE) {
if (e1.getY() > e2.getY()) { // Fling up
if (!comicLoaded || mScreen.isBottomMost()) { return action(Constants.INPUT_FLING_UP, Constants.ACTION_MENU); }
} else { // Fling down
if (!comicLoaded || mScreen.isTopMost()) { return action(Constants.INPUT_FLING_DOWN, Constants.ACTION_VALUE_NONE); }
}
}
}
return false;
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
String action = Constants.ACTION_VALUE_NONE;
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
action = preferences.getString(Constants.INPUT_VOLUME_UP, Constants.ACTION_VALUE_PREVIOUS);
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
action = preferences.getString(Constants.INPUT_VOLUME_DOWN, Constants.ACTION_VALUE_NEXT);
}
if (Constants.ACTION_VALUE_NONE.equals(action)) {
return super.onKeyUp(keyCode, event);
} else {
return true;
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
final String action = preferences.getString(Constants.INPUT_VOLUME_UP, Constants.ACTION_VALUE_PREVIOUS);
if (Constants.ACTION_VALUE_NONE.equals(action)) {
return super.onKeyDown(keyCode, event);
} else {
action(Constants.INPUT_VOLUME_UP, Constants.ACTION_VALUE_PREVIOUS);
return true;
}
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
final String action = preferences.getString(Constants.INPUT_VOLUME_DOWN, Constants.ACTION_VALUE_NEXT);
if (Constants.ACTION_VALUE_NONE.equals(action)) {
return super.onKeyDown(keyCode, event);
} else {
action(Constants.INPUT_VOLUME_DOWN, Constants.ACTION_VALUE_NEXT);
return true;
}
} else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
return action(Constants.TRACKBALL_RIGHT_KEY, Constants.ACTION_VALUE_NEXT);
} else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
return action(Constants.TRACKBALL_LEFT_KEY, Constants.ACTION_VALUE_PREVIOUS);
} else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
return action(Constants.TRACKBALL_UP_KEY, Constants.ACTION_VALUE_ZOOM_IN);
} else if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
return action(Constants.TRACKBALL_DOWN_KEY, Constants.ACTION_VALUE_ZOOM_OUT);
} else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
return action(Constants.TRACKBALL_CENTER_KEY, Constants.ACTION_VALUE_NEXT);
} else if (keyCode == KeyEvent.KEYCODE_BACK) {
final String action = preferences.getString(Constants.BACK_KEY, Constants.ACTION_VALUE_NONE);
if (Constants.ACTION_VALUE_NONE.equals(action)) {
return super.onKeyDown(keyCode, event);
} else if (Constants.ACTION_VALUE_PREVIOUS.equals(action) && mScreen.getIndex() == 0) {
return super.onKeyDown(keyCode, event);
} else {
action(Constants.BACK_KEY, Constants.ACTION_VALUE_NONE);
return true;
}
}
return super.onKeyDown(keyCode, event);
}
public void onLongPress(MotionEvent arg0) {
if (!mPinch) {
action(Constants.LONG_TAP_KEY, Constants.ACTION_VALUE_SCREEN_BROWSER);
}
}
@Override
public boolean onMenuItemSelected (int featureId, MenuItem item){
if(isHoneyComb()) {
boolean comicLoaded = isComicLoaded();
if(item.hasSubMenu()) {
Menu menu = item.getSubMenu();
switch(featureId) {
case R.id.item_share:
menu.findItem(R.id.item_share_screen).setVisible(comicLoaded);
menu.findItem(R.id.item_set_as).setVisible(comicLoaded);
break;
}
} else {
}
}
return super.onMenuItemSelected(featureId, item);
}
@Override
public void onPanelClosed (int featureId, Menu menu) {
super.onPanelClosed(featureId, menu);
hideActionBarDelayed();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
String actionValue = null;
switch (item.getItemId()) {
case R.id.item_zoom_in:
actionValue = Constants.ACTION_VALUE_ZOOM_IN;
break;
case R.id.item_zoom_out:
actionValue = Constants.ACTION_VALUE_ZOOM_OUT;
break;
case R.id.item_fit_width:
actionValue = Constants.ACTION_VALUE_FIT_WIDTH;
break;
case R.id.item_fit_height:
actionValue = Constants.ACTION_VALUE_FIT_HEIGHT;
break;
case R.id.item_actual_size:
actionValue = Constants.ACTION_VALUE_ACTUAL_SIZE;
break;
case R.id.item_first:
actionValue = Constants.ACTION_VALUE_FIRST;
break;
case R.id.item_previous:
actionValue = Constants.ACTION_VALUE_PREVIOUS;
break;
case R.id.item_next:
actionValue = Constants.ACTION_VALUE_NEXT;
break;
case R.id.item_previous_screen:
actionValue = Constants.ACTION_VALUE_PREVIOUS_SCREEN;
break;
case R.id.item_next_screen:
actionValue = Constants.ACTION_VALUE_NEXT_SCREEN;
break;
case R.id.item_last:
actionValue = Constants.ACTION_VALUE_LAST;
break;
case R.id.item_browse:
actionValue = Constants.ACTION_VALUE_SCREEN_BROWSER;
break;
case R.id.item_rotate:
actionValue = Constants.ACTION_VALUE_ROTATE;
break;
case R.id.item_settings:
actionValue = Constants.ACTION_VALUE_SETTINGS;
break;
case R.id.item_open:
actionValue = Constants.ACTION_VALUE_SD_BROWSER;
break;
case R.id.item_share_app:
actionValue = Constants.ACTION_VALUE_SHARE_APP;
break;
case R.id.item_set_as:
actionValue = Constants.ACTION_SET_AS;
break;
case R.id.item_share_screen:
actionValue = Constants.ACTION_VALUE_SHARE_SCREEN;
break;
case R.id.menu_close:
actionValue = Constants.ACTION_CLOSE;
break;
}
if (actionValue != null) {
return this.actionWithValue(actionValue, Constants.EVENT_VALUE_MENU, null);
} else {
return false;
}
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if(!isHoneyComb() && mScreen.isLoading()) {
return false;
}
boolean comicLoaded = isComicLoaded();
menu.findItem(R.id.item_share_screen).setVisible(comicLoaded);
menu.findItem(R.id.item_set_as).setVisible(comicLoaded);
menu.findItem(R.id.item_navigate).setVisible(comicLoaded);
menu.findItem(R.id.item_zoom).setVisible(comicLoaded);
menu.findItem(R.id.item_browse).setVisible(comicLoaded);
menu.findItem(R.id.item_rotate).setVisible(comicLoaded);
if (comicLoaded) {
boolean considerFrames = comic.hasFrames(mScreen.getIndex());
menu.findItem(R.id.item_next_screen).setVisible(considerFrames);
menu.findItem(R.id.item_previous_screen).setVisible(considerFrames);
}
return true;
}
public void onRequestSubscription() {
startSubscribeActivity();
}
public void onScreenLoadFailed() {
mScreen.setVisibility(View.INVISIBLE);
showRecentItems();
// Remove the comic path in case the comic is defective.
// If the page load failed because of an orientation change, the comic path is saved in the instance state anyway.
preferencesController.savePreference(Constants.COMIC_PATH_KEY, null);
removePreviousComic(true);
// Don't want to show an error if the activity was destroyed
if (!destroyed) {
showDialog(Constants.DIALOG_PAGE_ERROR);
}
}
private boolean mScrolling;
public boolean onScroll(MotionEvent downEvent, MotionEvent dragEvent, float distanceX, float distanceY) {
mScrolling = true;
if (isComicLoaded() && !mPinch) {
return mScreen.scroll(Math.round(distanceX), Math.round(distanceY));
} else {
return false;
}
}
public void onShowPress(MotionEvent arg0) {
}
private boolean detectCornerButton(MotionEvent e, boolean pressed, boolean action) {
final float x = e.getX();
final float y = e.getY();
final int width = mMain.getWidth();
final int height = mMain.getHeight();
final int cornerWidth = MathUtils.dipToPixel(this, Constants.CORNER_WIDTH_DIP);
String inputKey = null;
String defaultAction = null;
View button = null;
if (x <= cornerWidth && y <= cornerWidth) {
button = mCornerTopLeft;
inputKey = Constants.INPUT_CORNER_TOP_LEFT;
defaultAction = Constants.ACTION_VALUE_NONE;
} else if (x <= cornerWidth && y >= height - cornerWidth) {
button = mCornerBottomLeft;
inputKey = Constants.INPUT_CORNER_BOTTOM_LEFT;
defaultAction = Constants.ACTION_VALUE_PREVIOUS;
} else if (x >= width - cornerWidth && y <= cornerWidth) {
button = mCornerTopRight;
inputKey = Constants.INPUT_CORNER_TOP_RIGHT;
defaultAction = Constants.ACTION_VALUE_NONE;
} else if (x >= width - cornerWidth && y >= height - cornerWidth) {
button = mCornerBottomRight;
inputKey = Constants.INPUT_CORNER_BOTTOM_RIGHT;
defaultAction = Constants.ACTION_VALUE_NEXT;
}
boolean actionPerformed;
if (action && inputKey != null) {
actionPerformed = action(inputKey, defaultAction);
} else {
actionPerformed = false;
}
if (button != null) {
button.setPressed(pressed);
} else {
unpressCornerButtons();
}
return actionPerformed;
}
public boolean onSingleTapConfirmed(MotionEvent e) {
if (mPinch || mCornerButtonConsumed) return false; // TODO is pinch necessary?
final Point p = new Point(Math.round(e.getX()), Math.round(e.getY()));
boolean processed = action(Constants.SINGLE_TAP_KEY, Constants.ACTION_VALUE_NONE, p);
if(!processed)
toggleControls();
return processed;
}
private boolean mCornerButtonConsumed = false;
public boolean onSingleTapUp(MotionEvent e) {
if (mPinch) return false; // TODO is this necessary?
mCornerButtonConsumed = detectCornerButton(e, false, true);
return mCornerButtonConsumed;
}
public void onStop()
{
super.onStop();
if (markCleanExitPending) {
preferencesController.markCleanExit();
}
}
private void onActionDown(MotionEvent e) {
mPinch = false;
detectCornerButton(e, true, false);
}
private void onActionMove(MotionEvent e) {
if (mPinching && Reflect.getPointerCount(e) == 2) {
final float x0 = Reflect.getX(e, 0);
final float y0 = Reflect.getY(e, 0);
final float x1 = Reflect.getX(e, 1);
final float y1 = Reflect.getY(e, 1);
final float newDistance = MathUtils.distance(x0, y0, x1, y1);
float ratio = newDistance / pinchDistance;
ratio = 1 + (ratio - 1) * 0.5f;
mScreen.zoom(ratio, pinchCenter);
pinchDistance = newDistance;
}
detectCornerButton(e, true, false);
}
private void unpressCornerButtons() {
mCornerBottomLeft.setPressed(false);
mCornerBottomRight.setPressed(false);
mCornerTopLeft.setPressed(false);
mCornerTopRight.setPressed(false);
}
private void onActionUp(MotionEvent e) {
mPinching = false;
mScrolling = false;
unpressCornerButtons();
}
private void onActionPointerDown(MotionEvent e) {
if (!mScrolling && isComicLoaded()) {
mPinch = true;
mPinching = true;
final float x0 = Reflect.getX(e, 0);
final float y0 = Reflect.getY(e, 0);
final float x1 = Reflect.getX(e, 1);
final float y1 = Reflect.getY(e, 1);
pinchDistance = MathUtils.distance(x0, y0, x1, y1);
final int centerX = Math.round(x0 + x1) / 2;
final int centerY = Math.round(y0 + y1) / 2;
Point center = new Point(centerX, centerY);
pinchCenter = mScreen.toImagePoint(center);
}
}
private void onActionPointerUp(MotionEvent e) {}
private boolean mPinch = false;
private boolean mPinching = false;
private Point pinchCenter;
private float pinchDistance;
// TODO: Move pinch logic to SuperImageView.
@Override
public boolean onTouchEvent(MotionEvent e) {
final boolean wasScrolling = mScrolling;
final int action = e.getAction() & Reflect.ACTION_MASK();
switch (action) {
case MotionEvent.ACTION_DOWN:
this.onActionDown(e);
break;
case MotionEvent.ACTION_MOVE:
this.onActionMove(e);
break;
case MotionEvent.ACTION_UP:
this.onActionUp(e);
break;
}
if (action == Reflect.ACTION_POINTER_DOWN()) {
this.onActionPointerDown(e);
} else if (action == Reflect.ACTION_POINTER_UP()) {
this.onActionPointerUp(e);
}
if (mPinching) {
return true;
} else {
if (isComicLoaded() && (mScrolling || wasScrolling)) {
mScreen.scroll(e);
}
return mGestureDetector.onTouchEvent(e);
}
}
private boolean action(String preferenceKey, String defaultValue) {
return action(preferenceKey, defaultValue, null);
}
private boolean action(String preferenceKey, String defaultValue, Point p) {
final String actionValue = preferences.getString(preferenceKey, defaultValue);
return actionWithValue(actionValue, preferenceKey, p);
}
private boolean actionWithValue(String actionValue, String preferenceKey, Point p) {
boolean action = false;
// Actions that require a comic
if (isComicLoaded()) {
final int scrollIncrement = MathUtils.dipToPixel(this, Constants.MANUAL_SCROLL_INCREMENT_DIP);
if (Constants.ACTION_VALUE_PREVIOUS.equals(actionValue)) {
action = previous();
} else if (Constants.ACTION_VALUE_PREVIOUS_SCREEN.equals(actionValue)) {
action = previousScreen();
} else if (Constants.ACTION_VALUE_ZOOM_IN.equals(actionValue)) {
action = mScreen.zoom(1, p);
} else if (Constants.ACTION_VALUE_ZOOM_OUT.equals(actionValue)) {
action = mScreen.zoom(-1, p);
} else if (Constants.ACTION_VALUE_SCROLL_UP.equals(actionValue)) {
action = mScreen.scroll(0, -scrollIncrement);
} else if (Constants.ACTION_VALUE_SCROLL_DOWN.equals(actionValue)) {
action = mScreen.scroll(0, scrollIncrement);
} else if (Constants.ACTION_VALUE_SCROLL_LEFT.equals(actionValue)) {
action = mScreen.scroll(-scrollIncrement, 0);
} else if (Constants.ACTION_VALUE_SCROLL_RIGHT.equals(actionValue)) {
action = mScreen.scroll(scrollIncrement, 0);
} else if (Constants.ACTION_VALUE_FIRST.equals(actionValue)) {
action = first();
} else if (Constants.ACTION_VALUE_LAST.equals(actionValue)) {
action = last();
} else if (Constants.ACTION_VALUE_SCREEN_BROWSER.equals(actionValue)) {
startBrowseActivity();
action = true;
} else if (Constants.ACTION_VALUE_NEXT.equals(actionValue)) {
action = next();
} else if (Constants.ACTION_VALUE_NEXT_SCREEN.equals(actionValue)) {
action = nextScreen();
} else if (Constants.ACTION_VALUE_FIT_WIDTH.equals(actionValue)) {
action = mScreen.fitWidth();
} else if (Constants.ACTION_VALUE_FIT_HEIGHT.equals(actionValue)) {
action = mScreen.fitHeight();
} else if (Constants.ACTION_VALUE_FIT_SCREEN.equals(actionValue)) {
action = mScreen.fitScreen();
} else if (Constants.ACTION_VALUE_ACTUAL_SIZE.equals(actionValue)) {
action = mScreen.actualSize();
} else if (Constants.ACTION_VALUE_SHARE_SCREEN.equals(actionValue)) {
shareScreen();
action = true;
} else if (Constants.ACTION_SET_AS.equals(actionValue)) {
setAs();
action = true;
}
}
// Actions that do not require a comic
if (Constants.ACTION_VALUE_SETTINGS.equals(actionValue)) {
startSettingsActivity();
action = true;
} else if (Constants.ACTION_CLOSE.equals(actionValue)){
close();
action = true;
} else if (Constants.ACTION_VALUE_SD_BROWSER.equals(actionValue)) {
startSDBrowserActivity();
action = true;
} else if (Constants.ACTION_VALUE_ROTATE.equals(actionValue)) {
rotate();
action = true;
} else if (Constants.ACTION_VALUE_SHARE_APP.equals(actionValue)) {
shareApp();
return true;
} else if (Constants.ACTION_MENU.equals(actionValue)) {
showMenu();
return true;
}
if (action) {
TrackingManager.track(actionValue, Constants.EVENT_PARAM_INPUT, preferenceKey);
}
return action;
}
private void setAs() {
SetComicScreenAsTask task = new SetComicScreenAsTask(this, comic);
task.execute(mScreen.getIndex());
}
private void close() {
if (isComicLoaded()) {
removePreviousComic(true);
mScreen.setVisibility(View.GONE);
showRecentItems();
preferencesController.savePreference(Constants.COMIC_PATH_KEY, null);
showAds();
} else {
finish();
}
}
private String describeOrientation(int orientation) {
switch (orientation) {
case Configuration.ORIENTATION_LANDSCAPE:
return Constants.EVENT_VALUE_LANDSCAPE;
case Configuration.ORIENTATION_PORTRAIT:
return Constants.EVENT_VALUE_PORTRAIT;
case Configuration.ORIENTATION_SQUARE:
return Constants.EVENT_VALUE_SQUARE;
default:
return Constants.EVENT_VALUE_UNDEFINED;
}
}
private ArrayList<File> findCandidates(File file) {
File parent = file.getParentFile();
String[] allContents = parent.list();
TreeMap<String, File> aux = new TreeMap<String, File>();
HashMap<String, Integer> supportedExtensions = Constants.getSupportedExtensions(this);
if (allContents != null) {
String path = parent.getPath();
for (int i = 0; i < allContents.length; i++) {
String contentName = allContents[i];
String extension = FileUtils.getFileExtension(contentName);
if (!net.robotmedia.acv.utils.FileUtils.isHidden(contentName) && supportedExtensions.containsKey(extension.toLowerCase())) {
File contentFile = new File(path, contentName);
aux.put(contentFile.getName().toLowerCase(), contentFile);
}
}
}
ArrayList<File> candidates = new ArrayList<File>();
candidates.addAll(aux.values());
return candidates;
}
private File findNextComic() {
String comicPath = comic.getPath();
File file = new File(comicPath);
ArrayList<File> candidates = findCandidates(file);
String fileName = file.getName().toLowerCase();
boolean next = false;
File nextComic = null;
for (File candidate : candidates) {
if (next) {
nextComic = candidate;
break;
} else if (fileName.equals(candidate.getName().toLowerCase())) {
next = true;
}
}
return nextComic;
}
private File findPreviousComic() {
String comicPath = comic.getPath();
File file = new File(comicPath);
ArrayList<File> candidates = findCandidates(file);
String fileName = file.getName().toLowerCase();
File previousComic = null;
boolean previous = false;
for (File candidate : candidates) {
if (fileName.equals(candidate.getName().toLowerCase())) {
previous = true;
break;
} else {
previousComic = candidate;
}
}
if (previous) {
return previousComic;
} else {
return null;
}
}
private boolean first() {
return mScreen.goToScreen(0);
}
private boolean isComicLoaded() {
return (comic != null && comic.getLength() > 0 && !comic.isError());
}
private boolean last() {
return mScreen.goToScreen(comic.getLength() - 1);
}
private void loadComic(final String comicPath, final Intent intent) {
final File file = new File(comicPath);
int initialIndex = intent.getIntExtra(POSITION_EXTRA, 0);
if (initialIndex == 0) {
initialIndex = HistoryManager.getInstance(this).getBookmark(file);
}
loadComic(comicPath, initialIndex);
}
private void loadComic(final String comicPath) {
final File file = new File(comicPath);
final int initialIndex = HistoryManager.getInstance(this).getBookmark(file);
loadComic(comicPath, initialIndex);
}
private void loadComic(final String comicPath, final int initialIndex) {
final File file = new File(comicPath);
if (file.exists()) {
hideAds();
mComicPath = comicPath;
loadComicTask = new LoadComicTask();
loadComicTask.initialIndex = initialIndex;
loadComicTask.execute(comicPath);
}
}
private boolean next() {
int index = mScreen.getIndex();
int frameIndex = mScreen.getFrameIndex();
if (comic.hasFrames(index) && frameIndex + 1 < comic.getFramesSize(index)) {
return mScreen.next();
} else {
return nextScreen();
}
}
private boolean nextScreen() {
int index = mScreen.getIndex();
if (index + 1 >= comic.getLength()) { // Load next comic
File next = findNextComic();
if (next != null) {
this.loadComic(next.getPath(), 0);
return true;
}
} else {
return mScreen.nextScreen();
}
return false;
}
private boolean previous() {
int index = mScreen.getIndex();
int frameIndex = mScreen.getFrameIndex();
if (comic.hasFrames(index) && frameIndex > 0) {
return mScreen.previous();
} else {
return previousScreen();
}
}
private boolean previousScreen() {
int index = mScreen.getIndex();
if (index - 1 < 0) { // Load previous comic
File previous = findPreviousComic();
if (previous != null) {
this.loadComic(previous.getPath(), 0);
return true;
}
} else {
return mScreen.previousScreen();
}
return false;
}
private void rotate() {
int orientation = getResources().getConfiguration().orientation;
int requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
switch (orientation) {
case Configuration.ORIENTATION_LANDSCAPE:
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
orientation = Configuration.ORIENTATION_PORTRAIT;
break;
case Configuration.ORIENTATION_PORTRAIT:
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
orientation = Configuration.ORIENTATION_LANDSCAPE;
break;
}
Editor editor = preferences.edit();
editor.putInt(Constants.ORIENTATION_KEY, orientation);
editor.commit();
requestedRotation = true;
setRequestedOrientation(requestedOrientation);
}
private void shareApp() {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_app_title));
intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_app_message));
Intent chooser = Intent.createChooser(intent, getString(R.string.item_share_app_title));
startActivity(chooser);
}
private void shareScreen() {
ShareViewTask task = new ShareViewTask(this);
task.setRelativeTempPath(Constants.TEMP_PATH);
task.setChooserTitle(getString(R.string.item_share_screen_title));
task.setExtraSubject(getString(R.string.share_screen_title));
task.setExtraText(getString(R.string.share_screen_message));
task.setName(comic.getName());
task.execute(mScreen);
}
/**
* Shows the menu.
*/
private void showMenu() {
if(isHoneyComb() && !isIcecream())
showActionBar();
openOptionsMenu();
}
private void startBrowseActivity() {
if (isComicLoaded()) {
final Intent intent = new Intent(this, BrowseActivity.class);
intent.putExtra(BrowseActivity.POSITION_EXTRA, mScreen.getIndex());
final String comicID = comic.getID();
intent.putExtra(BrowseActivity.EXTRA_COMIC_ID, comicID);
startActivityForResult(intent, Constants.SCREEN_BROWSER_CODE);
}
}
private void startSDBrowserActivity() {
Intent myIntent = new Intent(this, SDBrowserActivity.class);
String comicsPath = preferences.getString(Constants.COMICS_PATH_KEY, Environment.getExternalStorageDirectory().getAbsolutePath());
myIntent.putExtra(Constants.COMICS_PATH_KEY, comicsPath);
startActivityForResult(myIntent, Constants.SD_BROWSER_CODE);
}
private void startSettingsActivity() {
if(!isHoneyComb()) {
startActivityForResult(new Intent(this, SettingsActivityPreHC.class), Constants.SETTINGS_CODE);
} else {
startActivityForResult(new Intent(this, SettingsActivityPostHC.class), Constants.SETTINGS_CODE);
}
}
private void startSubscribeActivity() {
Intent myIntent = new Intent(this, SubscribeActivity.class);
startActivityForResult(myIntent, Constants.SUBSCRIBE_CODE);
}
private boolean startupOrientation(Bundle savedInstanceState) {
boolean wasRequestedRotation = savedInstanceState != null ? savedInstanceState.getBoolean(Constants.REQUESTED_ROTATION_KEY) : false;
if (!wasRequestedRotation) { // If the activity was not created because of a rotation request
boolean sensor = preferences.getBoolean(Constants.AUTO_ROTATE_KEY, false);
if (sensor) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
} else {
int currentOrientation = getResources().getConfiguration().orientation;
int lastOrientation = preferences.getInt(Constants.ORIENTATION_KEY, currentOrientation);
int requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
switch (lastOrientation) {
case Configuration.ORIENTATION_LANDSCAPE:
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
break;
case Configuration.ORIENTATION_PORTRAIT:
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
break;
}
setRequestedOrientation(requestedOrientation);
return currentOrientation == lastOrientation;
}
}
return true;
}
private void trackOpen() {
TrackingManager.track(Constants.EVENT_OPEN,
Constants.EVENT_PARAM_TYPE, comic.getType(),
Constants.AUTO_ROTATE_KEY, String.valueOf(preferences.getBoolean(Constants.AUTO_ROTATE_KEY, false)),
Constants.DIRECTION_KEY, preferences.getString(Constants.DIRECTION_KEY, Constants.DIRECTION_LEFT_TO_RIGHT_VALUE),
Constants.SCALE_MODE_KEY, preferences.getString(Constants.SCALE_MODE_KEY, Constants.SCALE_MODE_NONE_VALUE),
Constants.TRANSITION_MODE_KEY, preferences.getString(Constants.TRANSITION_MODE_KEY, Constants.TRANSITION_MODE_TRANSLATE_VALUE),
Constants.SHOW_NUMBER_KEY, String.valueOf(preferences.getBoolean(Constants.SHOW_NUMBER_KEY, false)),
Constants.LOAD_LAST_KEY, String.valueOf(preferences.getBoolean(Constants.LOAD_LAST_KEY, true)),
Constants.ORIENTATION_KEY, describeOrientation(getResources().getConfiguration().orientation));
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case Constants.DIALOG_LOAD_ERROR:
return dialogFactory.createLoadErrorDialog();
case Constants.DIALOG_PAGE_ERROR:
return dialogFactory.createPageErrorDialog();
case Constants.DIALOG_FLIP_CONTROLS:
return dialogFactory.createFlipControlsDialog();
}
return null;
}
@Override
protected void onDestroy() {
super.onDestroy();
destroyed = true;
removePreviousComic(true);
if (loadComicTask != null) {
loadComicTask.cancel(true);
}
mScreen.destroy();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (isComicLoaded()) {
outState.putString(Constants.COMIC_PATH_KEY, comic.getPath());
}
outState.putBoolean(Constants.REQUESTED_ROTATION_KEY, requestedRotation);
}
protected void removePreviousComic(boolean emptyTemp) {
// Free the memory of the current comic
mScreen.recycleBitmaps();
if (emptyTemp) {
File tempDirectory = new File(Environment.getExternalStorageDirectory(), Constants.TEMP_PATH);
if(tempDirectory.exists())
FileUtils.deleteDirectory(tempDirectory);
}
if (comic != null) {
comic.destroy();
comic = null;
}
}
public void onAnimationEnd(ComicView comicView) {
this.adjustCornersVisibility(true);
}
public void onAnimationStart(ComicView comicView) {
this.adjustCornersVisibility(false);
}
@Override
public void onScreenChanged(int index) {
if(comic != null) {
final String path = comic.getPath();
HistoryManager.getInstance(this).setBookmark(new File(path), index);
}
}
private void showAds() {
hideAds();
View ad = AdsManager.getAd(this);
if(ad != null) {
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
lp.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
mAdsContainer.addView(ad, lp);
}
}
private void hideAds() {
AdsManager.destroyAds(this);
mAdsContainer.removeAllViews();
}
@Override
protected boolean toggleControls() {
boolean shown = super.toggleControls();
if(shown) {
showMenu();
}
return shown;
}
private void showRecentItems() {
mRecentItemsListAdapter.refresh();
mRecentItems.setVisibility(View.VISIBLE);
mButtonsContainer.setVisibility(View.INVISIBLE);
}
private void hideRecentItems() {
mRecentItems.setVisibility(View.GONE);
mButtonsContainer.setVisibility(View.VISIBLE);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
2e63022952b21a47dfc11c883675983df97d0a52 | e42b9539acb0b3982a231fd846b85bdb5652c456 | /UniShare/src/daoimpl/FacultyDaoImpl.java | 23c62b3df12bc5edfbf551b47c09f43907389322 | [] | no_license | djuricic1/ip19 | f1f6fbf7fabc444a42dc922c89b35f6db1bde264 | 40ba9ca5f7fc62fa984b382d74c9a78286fccfa9 | refs/heads/master | 2020-07-27T07:54:24.119516 | 2019-10-30T14:49:37 | 2019-10-30T14:49:37 | 209,012,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,438 | java | package daoimpl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import dao.FacultyDao;
import dto.Faculty;
public class FacultyDaoImpl implements FacultyDao {
private static ConnectionPool connectionPool = ConnectionPool.getConnectionPool();
private static final String SQL_GET_BY_ID = "SELECT * FROM faculty WHERE id=?";
private static final String SQL_GET_ALL = "SELECT * FROM faculty";
private static final String SQL_GET_BY_NAME = "SELECT * FROM faculty WHERE name=?";
@Override
public Faculty getFacultyById(int id) {
Connection connection = null;
ResultSet rs = null;
Faculty rV = new Faculty();
try {
connection = connectionPool.checkOut();
PreparedStatement pstmt = connection.prepareStatement(SQL_GET_BY_ID);
pstmt.setInt(1, id);
rs = pstmt.executeQuery();
if(rs.next()) {
rV.setId(rs.getInt("id"));
rV.setName(rs.getString("name"));
}
else {
return null;
}
pstmt.close();
} catch(SQLException exception) {
exception.printStackTrace();
} finally {
connectionPool.checkIn(connection);
}
return rV;
}
@Override
public List<Faculty> getAllFaculties() {
Connection connection = null;
ResultSet rs = null;
List<Faculty> faculties = new ArrayList<Faculty>();
try {
connection = connectionPool.checkOut();
PreparedStatement pstmt = connection.prepareStatement(SQL_GET_ALL);
rs = pstmt.executeQuery();
while(rs.next()) {
Faculty f = new Faculty();
f.setId(rs.getInt("id"));
f.setName(rs.getString("name"));
faculties.add(f);
}
pstmt.close();
} catch (SQLException e) {
// TODO: handle exception
e.printStackTrace();
} finally {
connectionPool.checkIn(connection);
}
return faculties;
}
@Override
public Faculty getFacultyByName(String facultyName) {
Connection connection = null;
ResultSet rs = null;
Faculty rV = new Faculty();
try {
connection = connectionPool.checkOut();
PreparedStatement pstmt = connection.prepareStatement(SQL_GET_BY_NAME);
pstmt.setString(1, facultyName);
rs = pstmt.executeQuery();
rs.next();
rV.setId(rs.getInt("id"));
rV.setName(rs.getString("name"));
pstmt.close();
} catch(SQLException exception) {
exception.printStackTrace();
} finally {
connectionPool.checkIn(connection);
}
return rV;
}
}
| [
"djdjuricic@domain.local"
] | djdjuricic@domain.local |
adcd241f4fb8b15e2bc85f1c1a245a70667439e7 | 9897fb5f293a0829fee0521f021894830e3ad9c5 | /src/bunny/code/CodeTemplateCompact.java | 04f7b273c5d2979f9a8cb010772b74f1bb9e2f62 | [] | no_license | ascane/bunny-dimension-library | 101eb6ebd3edf4d819f8b0cad54ff6cd1319686f | 779ff755eb7d3456662cef149ebdc99ab9f6744d | refs/heads/master | 2020-05-25T14:59:21.343979 | 2016-07-13T21:09:06 | 2016-07-13T21:09:06 | 61,982,751 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package bunny.code;
import java.io.PrintStream;
import java.util.Scanner;
public class CodeTemplateCompact {
static int n;
public static void main(String[] args) {
Scanner r = new Scanner(System.in);
PrintStream w = System.out;
Problem.init();
n = r.nextInt();
for (int c = 0; c < n; c++) {
Problem p = new Problem();
// Input
int t = r.nextInt();
p.data = new int[t];
for (int i = 0; i < t; i++) {
p.data[i] = r.nextInt();
}
p.solve();
// Output
w.println(p.result);
}
r.close();
w.close();
}
public static class Problem {
public int[] data;
public int result;
public static void init() {
}
public void solve() {
}
}
}
| [
"supercontact@126.com"
] | supercontact@126.com |
b8c144991187a0e5855b476a4cfbcc3b01b828d3 | 522739f7f95996741eb617308da2a2d547aefc2a | /app/src/test/java/com/example/shiboo/fajri_1202140198_modul1/ExampleUnitTest.java | 3d6db26ff16764fc426c1367a77a346be61b7f5b | [] | no_license | sikribo1/tpmodul1 | e07d0622c55935006c52531e02174961575b90de | 1a65f99c2f527409c779b760d0ae447fd975fab1 | refs/heads/master | 2021-05-04T14:31:45.141597 | 2018-02-04T17:07:25 | 2018-02-04T17:07:25 | 120,204,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | package com.example.shiboo.fajri_1202140198_modul1;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"fajri.kidal@gmail.com"
] | fajri.kidal@gmail.com |
55713fad51e3809ec1a5176bdcd90260cd101e0f | f27826af11e6e1c88980603f92311089a2a84f47 | /src/com/clarion/worksys/CompanyWorkNumTable/CompanyFourthPage.java | 0b53066c7973518275048b572c16a81f02c552d9 | [] | no_license | yaorong4700/waterInfoSystem | 780fe4e72dab20628f3ee65ff993cff5579c0735 | 98b58c031fe1254973fa214d675391d30f727eb9 | refs/heads/master | 2021-01-20T18:28:52.040293 | 2016-06-16T09:14:10 | 2016-06-16T09:14:10 | 60,671,012 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,812 | java | /**
* Copyright(C) 2011-2013 Clarion Corp. All rights reserved.
*
* 工数导出第四页
*
* @author chen_weijun@clarion.com.cn
* @create: 2012-2-21
* @histroy:
* 2012-2-21 chenweijun
* # 第二版
*
*/
package com.clarion.worksys.CompanyWorkNumTable;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import jxl.Cell;
import jxl.Workbook;
import jxl.format.Colour;
import jxl.format.UnderlineStyle;
import jxl.write.Label;
import jxl.write.Number;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import com.clarion.worksys.entity.ManHourDto;
import com.clarion.worksys.entity.Parma;
import com.clarion.worksys.entity.Project;
import com.clarion.worksys.entity.Project_task;
import com.clarion.worksys.util.Arith;
/**
* @author Chen_weijun
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class CompanyFourthPage {
/**
* 生成公司整体第四页(开发工数)的数据
* @param department 此处为“公司整体”
* @param listProject 公司所有项目的集合
* @param year 起始年份
* @param month 起始月份
* @param filenameString 唯一性字符串,防止文件重名
* @param allMonthListManHourDtoList 所有的工数信息
* @param listProjectTasksmp 所有的作业类型的集合
* @param workDayslist 每个月上班天数的集合
*/
public void updateFourthXLS(String department,List<Project> listProject,int year, int month,
String filenameString,List<List<ManHourDto>> allMonthListManHourDtoList,List<Project_task> listProjectTasksmp
,List<Integer> workDayslist) {
try {
File file = new File(Parma.TEMP_FILEFourthAddress);
if (!file.exists()) {
file.mkdirs();
}
File file1 = new File(Parma.TEMP_FILEFirstAddress);
if (!file1.exists()) {
file1.mkdirs();
}
int weiyiko=0;
if (month>=4&&month<=12) {
weiyiko=(month-4)*4+8;
}
if (month>=1&&month<=3) {
weiyiko=month*4+40;
}
List<Project_task> listProjectTasks=new ArrayList<Project_task>();
for (int i = 0; i < listProjectTasksmp.size(); i++) {
if (listProjectTasksmp.get(i).getCategory().equals("开发工数")) {
listProjectTasks.add(listProjectTasksmp.get(i));
}
}
for (int j = 0; j < listProjectTasks.size(); j++) {
String temp=listProjectTasks.get(j).getTask();
for (int i = j+1; i < listProjectTasks.size(); i++) {
if (temp.equals(listProjectTasks.get(i).getTask())) {
if (listProjectTasks.get(j).getMemo().equals(listProjectTasks.get(i).getMemo())) {
listProjectTasks.get(i).setTask("");
}
}
}
}
String strnameString1=Parma.TEMP_FILEFourthAddress+"/"+"集計データ"+department+year+"年"+month+"月"+".xls";//生成的模板存储所在地
String strnameString2=Parma.TEMP_FILEFirstAddress+"/"+"集計データ"+department+year+"年"+month+"月"+".xls";//由模板生成的最终文件所在地址
Workbook wb = Workbook.getWorkbook(new File(strnameString1));
WritableWorkbook book1 =Workbook.createWorkbook(new File(strnameString2), wb);
//add a Sheet.
WritableSheet sheetFour = book1.createSheet("开发工数", 3);
//去掉网格线
sheetFour.getSettings().setShowGridLines(false);
sheetFour.setColumnView(0,60);
sheetFour.setColumnView(2,15);
sheetFour.setColumnView(4,20);
sheetFour.setColumnView(5,20);
WritableFont fontb= new WritableFont(WritableFont.TIMES,10,WritableFont.BOLD);
WritableCellFormat formatb=new WritableCellFormat(fontb);
formatb.setAlignment(jxl.format.Alignment.CENTRE);
formatb.setBackground(Colour.LIGHT_TURQUOISE);
formatb.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
WritableCellFormat format1=new WritableCellFormat(fontb);
format1.setAlignment(jxl.format.Alignment.CENTRE);
format1.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE); //垂直居中
format1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
WritableFont fontb1_1= new WritableFont(WritableFont.TIMES,10,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.WHITE);//白色字体
WritableCellFormat format1_1=new WritableCellFormat(fontb1_1); //白色字体
format1_1.setAlignment(jxl.format.Alignment.CENTRE);
format1_1.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE); //垂直居中
//format1_1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
format1_1.setBorder(jxl.format.Border.LEFT,jxl.format.BorderLineStyle.THIN);
format1_1.setBorder(jxl.format.Border.RIGHT,jxl.format.BorderLineStyle.THIN);
format1_1.setBorder(jxl.format.Border.BOTTOM,jxl.format.BorderLineStyle.THIN);
format1_1.setBorder(jxl.format.Border.TOP,jxl.format.BorderLineStyle.NONE);//上边框不表示
WritableCellFormat format1_2=new WritableCellFormat(fontb); //text Alignment.center set
format1_2.setAlignment(jxl.format.Alignment.CENTRE);
format1_2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE); //垂直居中
format1_2.setBorder(jxl.format.Border.LEFT,jxl.format.BorderLineStyle.THIN);
format1_2.setBorder(jxl.format.Border.RIGHT,jxl.format.BorderLineStyle.THIN);
format1_2.setBorder(jxl.format.Border.TOP,jxl.format.BorderLineStyle.THIN);
format1_2.setBorder(jxl.format.Border.BOTTOM,jxl.format.BorderLineStyle.NONE);//下边框不表示
WritableCellFormat formatNum=new WritableCellFormat(fontb);
formatNum.setAlignment(jxl.format.Alignment.RIGHT);
formatNum.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE); //垂直居中
formatNum.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
WritableCellFormat formatTitle=new WritableCellFormat(fontb);
formatTitle.setAlignment(jxl.format.Alignment.LEFT);
formatTitle.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE); //垂直居中
formatTitle.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
WritableFont fontPerson= new WritableFont(WritableFont.ARIAL,10,WritableFont.BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLUE);//深蓝字体
WritableCellFormat formatPerson=new WritableCellFormat(fontPerson);
formatPerson.setAlignment(jxl.format.Alignment.CENTRE);
formatPerson.setBackground(Colour.LIGHT_TURQUOISE);
formatPerson.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
List<List<ManHourDto>> listManHourDtoTotal=new ArrayList<List<ManHourDto>>();;
for (int i = 0; i < allMonthListManHourDtoList.size(); i++) {
List<ManHourDto> ManHourDtoTotal=new ArrayList<ManHourDto>();
for (int m = 0; m < allMonthListManHourDtoList.get(i).size(); m++) {
if (("开发工数").equals(allMonthListManHourDtoList.get(i).get(m).getCategory())) {
ManHourDtoTotal.add(allMonthListManHourDtoList.get(i).get(m));
}
}
listManHourDtoTotal.add(ManHourDtoTotal);
}
List<Double> listsum9=new ArrayList<Double>();
List<Double> listsum10=new ArrayList<Double>();
for (int j = 0; j < listManHourDtoTotal.size(); j++) {
double sum9=0.0;
for (int m = 0; m < listManHourDtoTotal.get(j).size(); m++) {
for (int j2 = 0; j2 < Parma.strAdditionalProjDesignerCT.length; j2++) {
if (Parma.strAdditionalProjDesignerCT[j2].equals(listManHourDtoTotal.get(j).get(m).getTask())) {
if (286==listManHourDtoTotal.get(j).get(m).getProjectID()) {
sum9 = Arith.add(sum9,listManHourDtoTotal.get(j).get(m).getTimes());
}
}
}
}
listsum9.add(sum9);
}
for (int j = 0; j < listManHourDtoTotal.size(); j++) {
double sum10=0.0;
for (int m = 0; m < listManHourDtoTotal.get(j).size(); m++) {
for (int j2 = 0; j2 < Parma.strAdditionalProjDesignerDCOE.length; j2++) {
if (Parma.strAdditionalProjDesignerDCOE[j2].equals(listManHourDtoTotal.get(j).get(m).getTask())) {
if (304==listManHourDtoTotal.get(j).get(m).getProjectID()) {
sum10 = Arith.add(sum10,listManHourDtoTotal.get(j).get(m).getTimes());
}
}
}
}
listsum10.add(sum10);
}
Calendar c1=Calendar.getInstance();//获得系统当前日期
int yearsys=c1.get(Calendar.YEAR);
int monthsys=c1.get(Calendar.MONTH)+1;//系统日期从0开始算起
int daysys=c1.get(Calendar.DAY_OF_MONTH);
Label labelaLabel = new Label(0, 0, "集记日",format1);
sheetFour.addCell(labelaLabel);
sheetFour.mergeCells(1, 0, 2, 0);
Label labelaLabelmhk = new Label(1, 0, String.valueOf(yearsys)+"年"+String.valueOf(monthsys)+"月"+String.valueOf(daysys)+"日",format1);
sheetFour.addCell(labelaLabelmhk);
Label labelbLabel = new Label(0, 1, "对象",format1);
sheetFour.addCell(labelbLabel);
sheetFour.mergeCells(1, 1, 2, 1);
Label labelbLabelfg = new Label(1, 1, department,format1);
sheetFour.addCell(labelbLabelfg);
int rownum=2;
/**
* 开发工数DCOE--CT--OUTOUT项目
*/
for (int m = 0; m < Parma.strProjectClientNameDevelopPage.length; m++) {
rownum++;
List<Project> listDepartProjectsCT=new ArrayList<Project>();
for (int i = 0; i < listProject.size(); i++) {
if (("开发工数").equals(listProject.get(i).getCategory())) {
if ((Parma.strProjectClientNameDevelopPage[m]).equals(listProject.get(i).getProjectClientName())) {
listDepartProjectsCT.add(listProject.get(i));
}
}
}
Label labelckname= new Label(0,rownum, "项目名称",formatb);
sheetFour.addCell(labelckname);
for(int i=1;i<=Parma.strProjMonthTitle.length;i++)
{
Label label = new Label(i, rownum, Parma.strProjMonthTitle[i-1],formatb);
sheetFour.addCell(label);
}
int temp=Parma.strProjMonthTitle.length+1;
for(int i=Parma.strProjMonthTitle.length;i<Parma.strProjMonthTitle.length+Parma.strmonth.length-2;i++)
{
if (i%2==1) {
sheetFour.mergeCells(temp, rownum, temp+1, rownum);
Label label = new Label(temp, rownum, Parma.strmonth[i-Parma.strProjMonthTitle.length],formatPerson);
sheetFour.addCell(label);
temp=temp+2;
}
else {
sheetFour.mergeCells(temp, rownum, temp+1, rownum);
Label label = new Label(temp, rownum, Parma.strmonth[i-Parma.strProjMonthTitle.length],formatb);
sheetFour.addCell(label);
temp=temp+2;
}
}
rownum++;
for (int i = 0; i < listDepartProjectsCT.size(); i++) {
//sheetFour.mergeCells(0, rownum, 0, rownum+1);
if(listDepartProjectsCT.get(i).getProjectName() != null && !"".equals(listDepartProjectsCT.get(i).getProjectName())){
Label labelPjname = new Label(0, rownum, listDepartProjectsCT.get(i).getProjectName(),format1_2);
Label labelPjname_1 = new Label(0, rownum+1, listDepartProjectsCT.get(i).getProjectName(),format1_1);
sheetFour.addCell(labelPjname);
sheetFour.addCell(labelPjname_1);
}else{
Label labelPjname= new Label(0,rownum, listDepartProjectsCT.get(i).getProjectName(),formatTitle);
sheetFour.addCell(labelPjname);
}
sheetFour.mergeCells(1, rownum, 1, rownum+1);
Label labelYLname= new Label(1,rownum, listDepartProjectsCT.get(i).getProjectClientNo(),format1);
sheetFour.addCell(labelYLname);
sheetFour.mergeCells(2, rownum, 2, rownum+1);
Label labelDpartname= new Label(2,rownum, department,format1);
sheetFour.addCell(labelDpartname);
sheetFour.mergeCells(3, rownum, 3, rownum+1);
Label labelFunctionname= new Label(3,rownum, listDepartProjectsCT.get(i).getFunction(),format1);
sheetFour.addCell(labelFunctionname);
//sheetFour.mergeCells(4, rownum, 4, rownum+1);
//Label labelKuoDaname= new Label(4,rownum, listDepartProjectsCT.get(i).getTransferNo(),format1);
//sheetFour.addCell(labelKuoDaname);
Label labelKuoDaname= new Label(4,rownum, listDepartProjectsCT.get(i).getTransferNo(),format1_2);
sheetFour.addCell(labelKuoDaname);
Label labelKuoDaname_1= new Label(4,rownum+1, listDepartProjectsCT.get(i).getTransferNo(),format1_1);
sheetFour.addCell(labelKuoDaname_1);
sheetFour.mergeCells(5, rownum, 5, rownum+1);
Label labelClientname= new Label(5,rownum, listDepartProjectsCT.get(i).getProjectClientName(),format1);
sheetFour.addCell(labelClientname);
//sheetFour.mergeCells(6, rownum, 6, rownum+1);
if(listDepartProjectsCT.get(i).getCarMaker() != null && !"".equals(listDepartProjectsCT.get(i).getCarMaker())){
Label carmaker = new Label(6, rownum, listDepartProjectsCT.get(i).getCarMaker(),format1_2);
sheetFour.addCell(carmaker);
Label carmaker_1 = new Label(6, rownum+1, listDepartProjectsCT.get(i).getCarMaker(),format1_1);
sheetFour.addCell(carmaker_1);
}else{
sheetFour.mergeCells(6, rownum, 6, rownum+1);
Label carmaker= new Label(6,rownum, listDepartProjectsCT.get(i).getCarMaker(),format1);
sheetFour.addCell(carmaker);
}
Label labelkaifaname= new Label(7,rownum, "开发工数",format1);
sheetFour.addCell(labelkaifaname);
Label labelfudainame= new Label(7,rownum+1,"附带工数",format1);
sheetFour.addCell(labelfudainame);
int weiyi=weiyiko;
if (("185 工程设计部CT").equals(listDepartProjectsCT.get(i).getProjectName())) {
for (int mk = 0; mk < listManHourDtoTotal.size(); mk++) {
Number labelnLabel_d3wabm=new Number(weiyi, rownum, 0,formatNum);
sheetFour.addCell(labelnLabel_d3wabm);
Number labelil=new Number(weiyi+2, rownum, Arith.div(0, (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labelil);
Number labelnLabelfudaiabm=new Number(weiyi, rownum+1,listsum9.get(mk),formatNum);
sheetFour.addCell(labelnLabelfudaiabm);
Number labelbu=new Number(weiyi+2, rownum+1, Arith.div(listsum9.get(mk), (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labelbu);
double sum=0.0;
for (int j = 0; j < listManHourDtoTotal.get(mk).size(); j++) {
if (listDepartProjectsCT.get(i).getProjectID()==listManHourDtoTotal.get(mk).get(j).getProjectID()) {
sum = Arith.add(sum,listManHourDtoTotal.get(mk).get(j).getTimes());
}
}
sheetFour.mergeCells(weiyi+1, rownum, weiyi+1, rownum+1);
Number labelnLabfk=new Number(weiyi+1, rownum, (double)sum,formatNum);
sheetFour.addCell(labelnLabfk);
sheetFour.mergeCells(weiyi+1+2, rownum, weiyi+1+2, rownum+1);
Number labelftg=new Number(weiyi+1+2, rownum, Arith.div(sum, (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labelftg);
weiyi=weiyi+4;
}
rownum=rownum+2;
}
else if(("185 工程设计部DCOE").equals(listDepartProjectsCT.get(i).getProjectName())){
for (int mk = 0; mk < listManHourDtoTotal.size(); mk++) {
Number labelnLabel_d3wabm=new Number(weiyi, rownum, 0,formatNum);
sheetFour.addCell(labelnLabel_d3wabm);
Number labelil=new Number(weiyi+2, rownum, Arith.div(0, (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labelil);
Number labelnLabelfudaiabm=new Number(weiyi, rownum+1,listsum10.get(mk),formatNum);
sheetFour.addCell(labelnLabelfudaiabm);
Number labelbu=new Number(weiyi+2, rownum+1, Arith.div(listsum10.get(mk), (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labelbu);
double sum=0.0;
for (int j = 0; j < listManHourDtoTotal.get(mk).size(); j++) {
if (listDepartProjectsCT.get(i).getProjectID()==listManHourDtoTotal.get(mk).get(j).getProjectID()) {
sum = Arith.add(sum,listManHourDtoTotal.get(mk).get(j).getTimes());
}
}
sheetFour.mergeCells(weiyi+1, rownum, weiyi+1, rownum+1);
Number labelnLabfk=new Number(weiyi+1, rownum, (double)sum,formatNum);
sheetFour.addCell(labelnLabfk);
sheetFour.mergeCells(weiyi+1+2, rownum, weiyi+1+2, rownum+1);
Number labelftg=new Number(weiyi+1+2, rownum, Arith.div(sum, (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labelftg);
weiyi=weiyi+4;
}
rownum=rownum+2;
}
else {
for (int mk = 0; mk < listManHourDtoTotal.size(); mk++) {
double sumKaifa=0.0;
for (int j = 0; j < listManHourDtoTotal.get(mk).size(); j++) {
for (int j2 = 0; j2 < listProjectTasks.size(); j2++) {
if (("开发").equals(listProjectTasks.get(j2).getMemo())) {
if (listProjectTasks.get(j2).getCategory().equals(listManHourDtoTotal.get(mk).get(j).getCategory())) {
//if (listProjectTasks.get(j2).getTask().equals(listManHourDtoTotal.get(mk).get(j).getTask())) {
if (listProjectTasks.get(j2).getTaskID().equals(listManHourDtoTotal.get(mk).get(j).getTaskID())) {
if (listDepartProjectsCT.get(i).getProjectID()==listManHourDtoTotal.get(mk).get(j).getProjectID()) {
sumKaifa = Arith.add(sumKaifa,listManHourDtoTotal.get(mk).get(j).getTimes());
}
}
}
}
}
}
Number labelnLabel_d3wabm=new Number(weiyi, rownum,sumKaifa,formatNum);
sheetFour.addCell(labelnLabel_d3wabm);
Number labelftg=new Number(weiyi+2, rownum, Arith.div(sumKaifa, (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labelftg);
double sumFudai=0.0;
for (int j = 0; j < listManHourDtoTotal.get(mk).size(); j++) {
for (int j2 = 0; j2 < listProjectTasks.size(); j2++) {
if (("附带").equals(listProjectTasks.get(j2).getMemo())) {
if (listProjectTasks.get(j2).getCategory().equals(listManHourDtoTotal.get(mk).get(j).getCategory())) {
//if (listProjectTasks.get(j2).getTask().equals(listManHourDtoTotal.get(mk).get(j).getTask())) {
if (listProjectTasks.get(j2).getTaskID().equals(listManHourDtoTotal.get(mk).get(j).getTaskID())) {
if (listDepartProjectsCT.get(i).getProjectID()==listManHourDtoTotal.get(mk).get(j).getProjectID()) {
sumFudai = Arith.add(sumFudai,listManHourDtoTotal.get(mk).get(j).getTimes());
}
}
}
}
}
}
Number labelnLabelfudaiabm=new Number(weiyi, rownum+1,sumFudai,formatNum);
sheetFour.addCell(labelnLabelfudaiabm);
Number labelbu=new Number(weiyi+2, rownum+1, Arith.div(sumFudai, (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labelbu);
double sum=0.0;
for (int j = 0; j < listManHourDtoTotal.get(mk).size(); j++) {
if (listDepartProjectsCT.get(i).getProjectID()==listManHourDtoTotal.get(mk).get(j).getProjectID()) {
sum = Arith.add(sum,listManHourDtoTotal.get(mk).get(j).getTimes());
}
}
sheetFour.mergeCells(weiyi+1, rownum, weiyi+1, rownum+1);
Number labelnLabfk=new Number(weiyi+1, rownum,sum,formatNum);
sheetFour.addCell(labelnLabfk);
sheetFour.mergeCells(weiyi+1+2, rownum, weiyi+1+2, rownum+1);
Number labelfr=new Number(weiyi+1+2, rownum, Arith.div(sum, (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labelfr);
weiyi=weiyi+4;
}
rownum=rownum+2;
}
}
int weiyi=weiyiko;
sheetFour.mergeCells(0, rownum, Parma.strProjMonthTitle.length-1, rownum+1);
Label labelTotalname= new Label(0,rownum, "合计",format1);
sheetFour.addCell(labelTotalname);
Label labelkaifaname= new Label(6,rownum, "开发工数",format1);
sheetFour.addCell(labelkaifaname);
Label labelfudainame= new Label(6,rownum+1,"附带工数",format1);
sheetFour.addCell(labelfudainame);
for (int mk = 0; mk < listManHourDtoTotal.size(); mk++) {
double sumKaifa=0.0;
for (int i = 0; i < listDepartProjectsCT.size(); i++) {
for (int j = 0; j < listManHourDtoTotal.get(mk).size(); j++) {
for (int j2 = 0; j2 < listProjectTasks.size(); j2++) {
if (("开发").equals(listProjectTasks.get(j2).getMemo())) {
if (listProjectTasks.get(j2).getCategory().equals(listManHourDtoTotal.get(mk).get(j).getCategory())) {
//if (listProjectTasks.get(j2).getTask().equals(listManHourDtoTotal.get(mk).get(j).getTask())) {
if (listProjectTasks.get(j2).getTaskID().equals(listManHourDtoTotal.get(mk).get(j).getTaskID())) {
if (listDepartProjectsCT.get(i).getProjectID()==listManHourDtoTotal.get(mk).get(j).getProjectID()) {
sumKaifa = Arith.add(sumKaifa,listManHourDtoTotal.get(mk).get(j).getTimes());
}
}
}
}
}
}
}
Number labelnLabel_d3wabm=new Number(weiyi, rownum, sumKaifa,formatNum);
sheetFour.addCell(labelnLabel_d3wabm);
Number labelfr=new Number(weiyi+2, rownum, Arith.div(sumKaifa, (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labelfr);
double sumFudai=0.0;
for (int i = 0; i < listDepartProjectsCT.size(); i++) {
for (int j = 0; j < listManHourDtoTotal.get(mk).size(); j++) {
for (int j2 = 0; j2 < listProjectTasks.size(); j2++) {
if (("附带").equals(listProjectTasks.get(j2).getMemo())) {
if (listProjectTasks.get(j2).getCategory().equals(listManHourDtoTotal.get(mk).get(j).getCategory())) {
//if (listProjectTasks.get(j2).getTask().equals(listManHourDtoTotal.get(mk).get(j).getTask())) {
if (listProjectTasks.get(j2).getTaskID().equals(listManHourDtoTotal.get(mk).get(j).getTaskID())) {
if (listDepartProjectsCT.get(i).getProjectID()==listManHourDtoTotal.get(mk).get(j).getProjectID()) {
sumFudai = Arith.add(sumFudai,listManHourDtoTotal.get(mk).get(j).getTimes());
}
}
}
}
}
}
}
if (Parma.strProjectClientNameDevelopPage[m].equals("DCOE")) sumFudai+=listsum10.get(mk);
if (Parma.strProjectClientNameDevelopPage[m].equals("CT")) sumFudai+=listsum9.get(mk);
Number labelnLabelfudaiabm=new Number(weiyi, rownum+1, (double)sumFudai,formatNum);
sheetFour.addCell(labelnLabelfudaiabm);
Number labeled=new Number(weiyi+2, rownum+1, Arith.div(sumFudai, (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labeled);
double sumtotal=0.0;
for (int i = 0; i < listDepartProjectsCT.size(); i++) {
for (int j = 0; j < listManHourDtoTotal.get(mk).size(); j++) {
if (listDepartProjectsCT.get(i).getProjectID()==listManHourDtoTotal.get(mk).get(j).getProjectID()) {
sumtotal = Arith.add(sumtotal,listManHourDtoTotal.get(mk).get(j).getTimes());
}
}
}
sheetFour.mergeCells(weiyi+1, rownum, weiyi+1, rownum+1);
Number labelnLabfk=new Number(weiyi+1, rownum,sumtotal,formatNum);
sheetFour.addCell(labelnLabfk);
sheetFour.mergeCells(weiyi+1+2, rownum, weiyi+1+2, rownum+1);
Number labelfrt=new Number(weiyi+1+2, rownum, Arith.div(sumtotal, (workDayslist.get(mk)*8)),formatNum);
sheetFour.addCell(labelfrt);
weiyi=weiyi+4;
}
rownum=rownum+3;
}
/**
* 对剩余的空白部分进行单元格处理
*/
WritableCellFormat formatg=new WritableCellFormat(fontb);
formatg.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
for (int j = 2; j < rownum; j++) {
Cell celletemp = sheetFour.getCell(0, j);
String resultemp = celletemp.getContents();
if (!resultemp.isEmpty()) {
for (int k = 1; k <=(Parma.strmonth.length-2)*2+Parma.strProjMonthTitle.length-2; k++) {
Cell celletemp1 = sheetFour.getCell(k, j);
String resultemp1 = celletemp1.getContents();
if (resultemp1.isEmpty()) {
Label labelhLabel = new Label(k, j, null ,formatg);
sheetFour.addCell(labelhLabel);
}
}
}
}
book1.write();
book1.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public boolean deleteTempDir() {
File temp = new File(Parma.TEMP_FILEFirstAddress);
if (!temp.isFile()) {
String[] fileList = temp.list();
for (String string : fileList) {
File delDile = new File(Parma.TEMP_FILEFirstAddress+"/"+string);
if(delDile.isDirectory()){
}else{
delDile.delete();
}
}
temp.delete();
}
return true;
}
}
| [
"470032751@qq.com"
] | 470032751@qq.com |
b9d7c6d701be37e3d5e091bc9ed9f218ddd9bfac | 5b3124d08ed839e876de9f47af685589ccec5c9b | /ulearning-teacher/src/main/java/com/ky/ulearning/teacher/dao/ActivityDao.java | 6c2b36e0fa7ecf21e87d03668f5234129808c43e | [] | no_license | Hyidol/u-learning | b570b59ac6a7caed593d8105b462c9c4071661b7 | 859a5439e12a05eb2206817dfe68b46a5fdd67b0 | refs/heads/master | 2022-11-20T06:39:36.030533 | 2020-05-22T14:49:41 | 2020-05-22T14:49:41 | 299,804,019 | 0 | 1 | null | 2020-09-30T03:57:12 | 2020-09-30T03:57:11 | null | UTF-8 | Java | false | false | 1,009 | java | package com.ky.ulearning.teacher.dao;
import com.ky.ulearning.spi.common.dto.PageParam;
import com.ky.ulearning.spi.common.entity.ActivityEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 动态dao
*
* @author luyuhao
* @since 2020/04/01 00:00
*/
@Mapper
@Repository
public interface ActivityDao {
/**
* 插入动态
*
* @param activityEntity 动态对象
*/
void insert(ActivityEntity activityEntity);
/**
* 分页查询学生动态
*
* @param pageParam 分页参数
* @param teaId 教师id
* @return 学生动态集合
*/
List<ActivityEntity> listPage(@Param("teaId") Long teaId, @Param("pageParam") PageParam pageParam);
/**
* 分页查询学生动态 - 总记录
*
* @param teaId 教师id
* @return 总记录
*/
Integer countListPage(@Param("teaId") Long teaId);
}
| [
"ludaye1112@163.com"
] | ludaye1112@163.com |
be80a957f00e87d5a5e1037d3eed1d68730dd2f9 | 0ed0e0172497e97c44a39663f368ae040f253868 | /src/com/testcases/BrokenLinks.java | d28f751355ca02cc25807664fc6b29a8e8c98fb2 | [] | no_license | VeeraPrathapSelenium/April_Regular_730AM | da1946d57bc09f4dc3ad5c006dd400d78b2c691f | a68f2d8c6260fa5d166944b2e71030f0ed7b90ec | refs/heads/master | 2020-05-18T22:23:30.855729 | 2019-06-04T03:00:26 | 2019-06-04T03:00:26 | 184,690,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,222 | java | package com.testcases;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class BrokenLinks {
public static void main(String[] args) throws IOException {
// parent p=new child();
WebDriver driver=new ChromeDriver();
driver.get("https://www.facebook.com/");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
WebElement forgetpassword=driver.findElement(By.xpath("//a[text()='Forgotten account?']"));
String url=forgetpassword.getAttribute("href");
System.out.println("The url is :"+url);
URL ourl=new URL(url);
HttpURLConnection con=(HttpURLConnection) ourl.openConnection();
con.connect();
int responsecode=con.getResponseCode();
if(responsecode==200)
{
System.out.println("Link is active");
}else
{
System.out.println("Link is not active");
}
}
}
| [
"prathap.ufttest@gmail.com"
] | prathap.ufttest@gmail.com |
d89b02179b089e0fb007caaabae227db7cc9a2b2 | f20400a6b5992098b02c4b7151774199972ec1d6 | /src/com/jspxcms/core/service/impl/SpecValueServiceImpl.java | 0fe417ff14e01e4284b61b012763a287e2eb8bc7 | [] | no_license | mingsire/sitebox | 569fe921ce211469f19658968418638d4167540f | ca51e511e25df9ca687881964b5336c6a8e48a80 | refs/heads/master | 2020-06-24T18:20:02.368763 | 2016-11-24T02:22:41 | 2016-11-24T02:22:41 | 74,627,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,755 | java | package com.jspxcms.core.service.impl;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jspxcms.core.domain.Spec;
import com.jspxcms.core.domain.SpecValue;
import com.jspxcms.core.listener.SpecValueDeleteListener;
import com.jspxcms.core.repository.SpecValueDao;
import com.jspxcms.core.service.SpecValueService;
@Service
@Transactional(readOnly = true)
public class SpecValueServiceImpl implements SpecValueService {
public SpecValue get(Integer id) {
return dao.findOne(id);
}
@Transactional
public SpecValue[] save(String[] name, String[] image,
Spec spec) {
int len = name != null ? name.length : 0;
SpecValue[] beans = new SpecValue[len];
SpecValue bean;
for (int i = 0; i < len; i++) {
bean = new SpecValue();
bean.setSpec(spec);
bean.setName(name[i]);
if(image.length>0&&image.length == name.length){
bean.setImage(image[i]);
}else{
bean.setImage(null);
}
bean.setSeq(i);
bean.applyDefaultValue();
dao.save(bean);
beans[i] = bean;
}
spec.setSpecValues(Arrays.asList(beans));
return beans;
}
@Transactional
public SpecValue[] update(Integer[] id, String[] name,
String[] image, Spec spec) {
int len = id != null ? id.length : 0;
SpecValue[] beans = new SpecValue[len];
SpecValue bean;
// 修改和新增
for (int i = 0; i < len; i++) {
if (id[i] != null) {
bean = dao.findOne(id[i]);
} else {
bean = new SpecValue();
}
bean.setSpec(spec);
bean.setName(name[i]);
// bean.setImage(image[i]);
bean.setSeq(i);
bean.applyDefaultValue();
dao.save(bean);
beans[i] = bean;
}
// 删除
for (SpecValue item : spec.getSpecValues()) {
if (!ArrayUtils.contains(id, item.getId())) {
delete(item);
}
}
spec.setSpecValues(Arrays.asList(beans));
return beans;
}
@Transactional
public SpecValue delete(SpecValue bean) {
firePreDelete(new Integer[] { bean.getId() });
dao.delete(bean);
return bean;
}
private void firePreDelete(Integer[] ids) {
if (!CollectionUtils.isEmpty(deleteListeners)) {
for (SpecValueDeleteListener listener : deleteListeners) {
listener.preSpecValueDelete(ids);
}
}
}
private List<SpecValueDeleteListener> deleteListeners;
@Autowired(required = false)
public void setDeleteListeners(List<SpecValueDeleteListener> deleteListeners) {
this.deleteListeners = deleteListeners;
}
private SpecValueDao dao;
@Autowired
public void setDao(SpecValueDao dao) {
this.dao = dao;
}
}
| [
"793214774@qq.com"
] | 793214774@qq.com |
627142ecca7c55bc7a667c63790e21ee5047e875 | 751c21d9a3e6d2b4673139086aa9e4e15514c179 | /EX_03_SpringRestService/src/main/java/com/spring/rest/SpringApp.java | 4a980437d7852fc4ca81f8513379bbe6b7d24b1f | [] | no_license | javasuresh91/SpringMicroService | 23b7c481e78e362e9f38a115c0a6e93482dbb15d | 1381a07dbeefc2c1e4c02816e299116398fd9af6 | refs/heads/master | 2020-03-15T03:30:03.084064 | 2018-06-25T09:21:12 | 2018-06-25T09:21:12 | 131,943,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package com.spring.rest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringApp {
public static void main(String[] args) {
SpringApplication.run(SpringApp.class, args);
}
}
| [
"javasuresh91@gmail.com"
] | javasuresh91@gmail.com |
225fbc022e78baafb69d6b9e04705bf0d444c810 | e98a81844b8d000100c0989d3e296655a87842e7 | /mantis-tests/src/test/java/ua/stqa/pft/mantis/tests/appmanager/HelperBase.java | 424145e561c6248ebedbc095b69d78ce5849ecaf | [
"Apache-2.0"
] | permissive | amalinkovskiy/java_home_assignments | 6060fcfe1e640d66953d547ce21158292f36a1d9 | b335d8a3e39362f488389f7df2d92270d7025878 | refs/heads/master | 2021-01-19T08:38:37.820932 | 2017-06-09T13:37:37 | 2017-06-09T13:37:37 | 87,654,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,317 | java | package ua.stqa.pft.mantis.tests.appmanager;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
/**
* Created by amalinkovskiy on 4/23/2017.
*/
public class HelperBase {
protected WebDriver wd;
protected ApplicationManager app;
public HelperBase(ApplicationManager app) {
this.app = app;
this.wd = app.getDriver();
}
protected void click(By locator) {
wd.findElement(locator).click();
}
protected void type(By locator, String text) {
click(locator);
if (text != null){
String existingText = wd.findElement(locator).getAttribute("value");
if (! text.equals(existingText)){
wd.findElement(locator).clear();
wd.findElement(locator).sendKeys(text);
}
}
}
protected void login(String operation){
String page = "login_page.php";
if(operation.equals("ModifyUser")){
page = "/manage_user_page.php";
}
wd.get(app.getProperty("web.baseURL") + page);
if(operation.equals("ModifyUser")){
type(By.name("username"), app.getProperty("admin"));
type(By.name("password"), app.getProperty("adminPassword"));
click(By.cssSelector("input[value='Login']"));
}
}
}
| [
"amalinkovskiy@gmail.com"
] | amalinkovskiy@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.