text
stringlengths 10
2.72M
|
|---|
package com.raczy.ds;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.BiFunction;
/**
* Hash table with chaining implementations.
* Average case complexity of operations (find, insert, delete): O(1)
* Worst case complexity of operations (find, insert, delete): O(n)
*/
public class HashTable<K, V extends Comparable<V>> {
class HashNode<K, V extends Comparable<V>> {
private K key;
private V value;
// Reference to next
HashNode<K, V> next;
// Init
HashNode(K key, V value) {
this.key = key;
this.value = value;
}
// Accessors
public K getKey() {
return key;
}
public V getValue() {
return value;
}
public void setValue(V value) {
this.value = value;
}
public HashNode<K, V> getNext() {
return next;
}
public void setNext(HashNode<K, V> next) {
this.next = next;
}
}
// Constants
public static int DEFAULT_SIZE = 100;
// Config properties
// number of buckets
private int size;
// Functions
private BiFunction<K, Integer, Integer> hashFunction;
// Storage
private List<HashNode<K, V>> storage;
// Initialization
public HashTable() {
this.size = DEFAULT_SIZE;
this.hashFunction = getDefaultHashFunction();
this.storage = new ArrayList<>(Collections.nCopies(size, null));
}
public HashTable(int size, int bound, BiFunction<K, Integer, Integer> hashFunction) {
this.size = size;
this.hashFunction = hashFunction;
this.storage = new ArrayList<>(Collections.nCopies(size, null));
}
// Accessors
public int getSize() {
return size;
}
public BiFunction<K, Integer, Integer> getHashFunction() {
return hashFunction;
}
// Methods
public void add(K key, V value) {
// find chain head for given key
int hash = this.hashFunction.apply(key, this.size);
HashNode<K, V> head = storage.get(hash);
// check if node already exists
while(head != null) {
if (head.getKey().equals(key)) {
// node exist for given key, update its value
head.setValue(value);
return;
}
head = head.getNext();
}
// add new node with given key/value
head = storage.get(hash);
HashNode<K, V> node = new HashNode<>(key, value);
node.setNext(head);
storage.set(hash, node);
}
public void delete(K key) {
// find chain head for given key
int hash = this.hashFunction.apply(key, this.size);
HashNode<K, V> head = storage.get(hash);
HashNode<K, V> prev = null;
// search for key, storing reference to previous node
while (head != null) {
if (head.getKey().equals(key)) {
if (prev == null) {
storage.set(hash, head.next);
} else {
prev.setNext(head.next);
}
return;
}
prev = head;
head = head.getNext();
}
}
public V get(K key) {
// find chain head for given hey
int hash = this.hashFunction.apply(key, size);
HashNode<K, V> head = storage.get(hash);
// search for key
while(head != null) {
if (head.getKey().equals(key)) {
return head.getValue();
}
head = head.getNext();
}
// null if key doesn't exist
return null;
}
// utility
/**
* Default hash function. (hashCode absolute value) mod (nBuckets).
*/
BiFunction<K, Integer, Integer> getDefaultHashFunction() {
return (obj, m) -> Math.abs(obj.hashCode()% m);
}
}
|
package com.wooky.web.servlets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;
@WebServlet("language")
public class LanguageHandler extends HttpServlet {
private static final Logger LOG = LoggerFactory.getLogger(LanguageHandler.class);
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
String referrer = req.getParameter("referrer");
String language = req.getParameter("lang");
HttpSession session = req.getSession();
session.setAttribute("session_language", language);
LOG.info("The following language was stored in session and set: {}", language);
resp.sendRedirect(referrer);
LOG.info("Redirecting back to referrer: {}", referrer);
}
}
|
package com.tencent.mm.ui.base;
abstract class MMViewPager$a {
protected boolean bwt = false;
final /* synthetic */ MMViewPager tyS;
public abstract void play();
public MMViewPager$a(MMViewPager mMViewPager) {
this.tyS = mMViewPager;
}
public final boolean aSc() {
return this.bwt;
}
}
|
package com.intel.javanames;
import java.io.BufferedReader;
import java.io.File;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
class GoodPack{
String pack;
int count;
int total;
float rate;
float score;
public String toString(){
return pack + "["+count+"/"+total+"]";
}
}
class Uses{
HashMap<String,Vector<NameUse>> hsh = new HashMap<String,Vector<NameUse>>();
HashMap<String,Integer> counthsh = new HashMap<String,Integer>();
HashMap<String,Integer> packtotals = new HashMap<String,Integer>();
HashMap<String,Integer> packtypetotals = new HashMap<String,Integer>();
Vector<GoodPack> getGoodPacks(NameUse nu){
HashSet<String> all = nu.packs;
Vector<GoodPack> out = new Vector<GoodPack>();
for(String pack : all){
float total = packtotals.get(nu.name+pack);
float typetotal = packtypetotals.get(nu.name+nu.basetype+nu.typeargs+pack);
if(total >= 4 && (typetotal / total) >= 0.74){
GoodPack goodpack = new GoodPack();
goodpack.pack = pack;
goodpack.count = (int)typetotal;
goodpack.total = (int)total;
goodpack.rate = typetotal / total;
goodpack.score = typetotal + (typetotal/total);
out.add(goodpack);
}
}
return out;
}
void addUse(String pack, String name, String basetype, String typeargs){
if(typeargs == null){
typeargs = "";
}
if(!counthsh.containsKey(name)){
counthsh.put(name,1);
}else{
counthsh.put(name,counthsh.get(name)+1);
}
String packkey = name+pack;
if(!packtotals.containsKey(packkey)){
packtotals.put(packkey,1);
}else{
packtotals.put(packkey,packtotals.get(packkey)+1);
}
packkey = name+basetype+typeargs+pack;
if(!packtypetotals.containsKey(packkey)){
packtypetotals.put(packkey,1);
}else{
packtypetotals.put(packkey,packtypetotals.get(packkey)+1);
}
if(hsh.containsKey(name)){
for(NameUse u : hsh.get(name)){
if(u.name.equals(name)
&& u.basetype.equals(basetype)
&& Utils.eqOrNull(u.typeargs, typeargs)){
if(!u.packs.contains(pack)){
u.packs.add(pack);
}
u.count++;
return;
}
}
}else{
hsh.put(name, new Vector<NameUse>());
}
NameUse nu = new NameUse();
nu.packs = new HashSet<String>();
nu.packs.add(pack);
nu.name = name;
nu.basetype = basetype;
nu.typeargs = typeargs;
nu.count = 1;
hsh.get(name).add(nu);
}
}
class NameUse{
HashSet<String> packs; // which package
String name; // what variable name
String basetype; // what is the type
String typeargs; // what the type args are
int count; // how many times it appears
}
public class FindNames {
static Pattern typepat = Pattern.compile("(\\w+)(<[\\w\\s<>,]+>)?\\s+(\\w+)");
static Pattern packpat = Pattern.compile("package\\s+([\\w\\.]+)");
static Pattern strpat = Pattern.compile("\"[^\"]+\"");
static int count = 0;
public static boolean isKeyword(String s){
if(s.equals("import")) return true;
if(s.equals("public")) return true;
if(s.equals("private")) return true;
if(s.equals("transient")) return true;
if(s.equals("volatile")) return true;
if(s.equals("throws")) return true;
if(s.equals("package")) return true;
if(s.equals("final")) return true;
if(s.equals("protected")) return true;
if(s.equals("new")) return true;
if(s.equals("extends")) return true;
if(s.equals("throw")) return true;
if(s.equals("new")) return true;
if(s.equals("else")) return true;
if(s.equals("if")) return true;
if(s.equals("return")) return true;
if(s.equals("instanceof")) return true;
if(s.equals("with")) return true;
if(s.equals("class")) return true;
if(s.equals("interface")) return true;
if(s.equals("interfaceof")) return true;
if(s.equals("implements")) return true;
if(s.equals("static")) return true;
if(s.equals("native")) return true;
if(s.equals("synchronized")) return true;
return false;
}
public static void analyseFileContents(String filename,Uses uses) throws Exception {
BufferedReader reader = Utils.openInFile(filename);
String line;
String pack = null;
boolean incomment = false;
while((line = reader.readLine()) != null){
if(line.contains("/*")){
incomment = true;
}
if(line.contains("*/")){
incomment = false;
continue;
}
if(incomment){
continue;
}
if(line.contains("\"")) continue;
if(line.contains("//")) continue; // TODO: tidy up comment parsing
Matcher pm = packpat.matcher(line);
if(pm.find()){
pack = pm.group(1);
}
Matcher m = typepat.matcher(line);
while(m.find()){
String basetype = m.group(1);
String typeargs = m.group(2);
String name = m.group(3);
if(!isKeyword(basetype) && !isKeyword(name)){
uses.addUse(pack, name, basetype, typeargs);
}
}
}
reader.close();
}
static int depth = 0;
static void printFileName(String s){
for(int i = 0; i < depth; i++){
System.out.print(" ");
}
System.out.println(s);
}
public static void analyseFile(String filename,Uses uses) throws Exception{
// if(count > 100){
// return;
// }
printFileName(filename);
File file = new File(filename);
if(file.isDirectory()){
depth++;
File[] children = file.listFiles();
for(File child : children){
analyseFile(child.getAbsolutePath(),uses);
}
depth--;
}else if(filename.contains(".java")){
count++;
analyseFileContents(filename,uses);
}
}
public static void printUses(final Uses uses){
Vector<String> names = new Vector<String>(uses.counthsh.keySet());
Collections.sort(names,new Comparator<String>(){
public int compare(String x, String y){
return uses.counthsh.get(x) - uses.counthsh.get(y);
}
}
);
for(String name : names){
System.out.println("-- "+name+" : "+uses.counthsh.get(name)+" --");
Vector<NameUse> nus = uses.hsh.get(name);
Collections.sort(nus,new Comparator<NameUse>(){
public int compare(NameUse o1, NameUse o2) {
return o2.count - o1.count;
}
});
for(NameUse nu : nus){
String args;
if(nu.typeargs == null){
args = "";
}else{
args = nu.typeargs;
}
// Vector<String> sortedpacks = new Vector<String>(nu.packs);
// Collections.sort(sortedpacks);
Vector<GoodPack> goodpacks = uses.getGoodPacks(nu);
Collections.sort(goodpacks,new Comparator<GoodPack>(){
public int compare(GoodPack x, GoodPack y){
return (int)(1000*(y.score - x.score));
}
});
int goodtotal = 0;
for(GoodPack gp : goodpacks){
goodtotal+=gp.count;
}
System.out.println(" "+nu.basetype+args+":"+nu.count+"("+goodtotal+")"+" \t"+goodpacks);
}
}
}
/**
* @param args
*/
public static void main(String[] args) {
try{
System.err.println("Reading files:");
Uses uses = new Uses();
analyseFile(args[0],uses);
System.out.println("-- results --");
printUses(uses);
}catch(Exception e){
System.out.println(e);
}
}
}
|
package com.jim.multipos.ui.reports.discount;
import android.support.v4.app.Fragment;
import com.jim.multipos.config.scope.PerFragment;
import dagger.Binds;
import dagger.Module;
/**
* Created by Sirojiddin on 20.01.2018.
*/
@Module(
includes = DiscountReportPresenterModule.class
)
public abstract class DiscountReportFragmentModule {
@Binds
@PerFragment
abstract Fragment provideFragment(DiscountReportFragment discountReportFragment);
@Binds
@PerFragment
abstract DiscountReportView provideDiscountReportView(DiscountReportFragment discountReportFragment);
}
|
package exam.zipcode.service;
import java.util.*;
import exam.zipcode.dao.*;
import exam.zipcode.vo.*;
public class ZipCodeServiceImpl implements ZipCodeService {
// 사용할 Dao의 객체변수를 선언한다.
private ZipCodeDao zipcodeDao;
//자기자신 참조변수
private static ZipCodeServiceImpl service;
private ZipCodeServiceImpl() {
zipcodeDao = ZipCodeDaoImpl.getInstance();
}
public static ZipCodeServiceImpl getInstance() {
if(service == null) {
service = new ZipCodeServiceImpl();
}
return service;
}
@Override
public List<ZipCodeVO> getSearchZip(String comGet, String txtGet) {
return zipcodeDao.getSearchZip(comGet, txtGet);
}
}
|
package com.naztech.Controller;
import com.naztech.Dao.Gun;
import com.naztech.Dao.MachineGun;
import com.naztech.Services.KillerGun;
import com.naztech.Services.KillerMachineGun;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Gun AK47=KillerGun::kill;
System.out.println(AK47.Trigger());
Gun M16=new KillerGun()::killAll;
System.out.println(M16.Trigger());
MachineGun MS =KillerMachineGun::new;
KillerMachineGun M134=MS.getKillerMachineGun(5000);
System.out.println(M134.getNumberOfBullet());
}
}
|
package com.se.details.services.actors;
import akka.actor.AbstractActor;
import com.se.details.dto.PartdetailsFeatures;
import lombok.Getter;
import java.util.*;
import java.util.function.Supplier;
import java.util.function.UnaryOperator;
public abstract class DetailsPublisherActor extends AbstractActor
{
public abstract Map<String, List<PartdetailsFeatures>> getDetailsFeatures(DetailsMessage message);
protected Map<String, List<PartdetailsFeatures>> seedFeaturesResultMap(List<String> comIds)
{
Map<String, List<PartdetailsFeatures>> resultMap = new HashMap<>();
comIds.forEach(part -> resultMap.put(part, new ArrayList<PartdetailsFeatures>()));
return resultMap;
}
@Getter
public static final class DetailsMessage
{
private final List<String> comIds;
private final Set<String> feautres;
private final Long actorId;
private final UnaryOperator<Set<String>> defaultOrFilteredFeatures;
private final Supplier<Map<String, String>> featureMappingSupplier;
public DetailsMessage(List<String> comIds, Set<String> feautres, Long actorId, UnaryOperator<Set<String>> defaultOrFilteredFeatures, Supplier<Map<String, String>> featureMappingSupplier)
{
super();
this.comIds = comIds;
this.feautres = feautres;
this.actorId = actorId;
this.defaultOrFilteredFeatures = defaultOrFilteredFeatures;
this.featureMappingSupplier = featureMappingSupplier;
}
}
}
|
package com.tencent.mm.plugin.account.ui;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.account.a.j;
import com.tencent.mm.plugin.account.friend.a.z;
import com.tencent.mm.plugin.account.ui.EmailVerifyUI.3;
import com.tencent.mm.ui.base.h;
class EmailVerifyUI$3$1 implements OnClickListener {
final /* synthetic */ 3 ePY;
EmailVerifyUI$3$1(3 3) {
this.ePY = 3;
}
public final void onClick(DialogInterface dialogInterface, int i) {
z zVar = new z(EmailVerifyUI.a(this.ePY.ePX), EmailVerifyUI.b(this.ePY.ePX));
g.DF().a(zVar, 0);
EmailVerifyUI emailVerifyUI = this.ePY.ePX;
EmailVerifyUI emailVerifyUI2 = this.ePY.ePX;
this.ePY.ePX.getString(j.app_tip);
EmailVerifyUI.a(emailVerifyUI, h.a(emailVerifyUI2, this.ePY.ePX.getString(j.regby_email_verify_code_sending), true, new 1(this, zVar)));
}
}
|
package com.gcj.bean;
import java.util.Date;
/**
* Created with IntelliJ IDEA.
* User: Administrator
* Date: 13-12-20
* Time: 下午1:35
* To change this template use File | Settings | File Templates.
*/
public class UserOperationLogBean {
private Date updateTime;
private String userId;
private String p;
public UserOperationLogBean(Date updateTime, String userId, String p) {
this.updateTime = updateTime;
this.userId = userId;
this.p = p;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getP() {
return p;
}
public void setP(String p) {
this.p = p;
}
}
|
package br.com.treinar.jpa.model;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
@Entity
@Table(name = "EMP_DB")
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String firstName;
private String lastName;
private String dept;
private Double salary;
@ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinColumn(name = "adress_id")
private Address address;
@Temporal(TemporalType.DATE)
private Date birthday;
@Transient
private Integer idade;
@Enumerated(EnumType.STRING)
private EmployeeType tipo;
public Employee() {
}
public Employee(String firstName, String lastName, String dept, Double salary, Address address, Date birthday,
EmployeeType tipo) {
super();
this.firstName = firstName;
this.lastName = lastName;
this.dept = dept;
this.salary = salary;
this.address = address;
this.birthday = birthday;
this.tipo = tipo;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public Integer getIdade() {
return idade;
}
public void setIdade(Integer idade) {
this.idade = idade;
}
public Double getSalary() {
return salary;
}
public void setSalary(Double salary) {
this.salary = salary;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public EmployeeType getTipo() {
return tipo;
}
public void setTipo(EmployeeType tipo) {
this.tipo = tipo;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
@Override
public String toString() {
return "Employee [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", dept=" + dept
+ ", salary=" + salary + ", address=" + address + ", birthday=" + birthday + ", idade=" + idade
+ ", tipo=" + tipo + "]";
}
}
|
package com.angrykings.castles;
import com.angrykings.GameContext;
import com.angrykings.PhysicalEntity;
import com.angrykings.ResourceManager;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import org.andengine.entity.shape.IAreaShape;
import org.andengine.entity.sprite.Sprite;
import org.andengine.extension.physics.box2d.PhysicsFactory;
import org.andengine.extension.physics.box2d.PhysicsWorld;
import org.andengine.opengl.texture.region.TextureRegion;
import static org.andengine.extension.physics.box2d.util.constants.PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT;
public class Roof extends PhysicalEntity {
protected final TextureRegion roofTexture;
protected final Sprite roofSprite;
protected final Body roofBody;
public final static FixtureDef FIXTURE_DEF = PhysicsFactory.createFixtureDef(0.6f, 0.1f, 0.9f);
private final static float LINEAR_DAMPING = 0.1f;
private final static float ANGULAR_DAMPING = 0.1f;
public Roof(float x, float y) {
ResourceManager rm = ResourceManager.getInstance();
this.roofTexture = rm.getRoofTexture();
GameContext gc = GameContext.getInstance();
this.roofSprite = new Sprite(
x - this.roofTexture.getWidth() / 2,
y - this.roofTexture.getHeight() / 2,
this.roofTexture, gc.getVboManager()
);
// this.roofBody = createTriangleBody(gc.getPhysicsWorld(), roofSprite, BodyDef.BodyType.DynamicBody, Roof.FIXTURE_DEF);
this.roofBody = PhysicsFactory.createBoxBody(
gc.getPhysicsWorld(),
this.roofSprite,
BodyDef.BodyType.DynamicBody,
Stone.FIXTURE_DEF
);
}
@Override
public Body getBody() {
return roofBody;
}
/**
* Creates a Body based on a PolygonShape in the form of a triangle:
*/
private static Body createTriangleBody(final PhysicsWorld pPhysicsWorld, final IAreaShape pAreaShape, final BodyType pBodyType, final FixtureDef pFixtureDef) {
final float halfWidth = pAreaShape.getWidthScaled() * 0.5f / PIXEL_TO_METER_RATIO_DEFAULT;
final float halfHeight = pAreaShape.getHeightScaled() * 0.5f / PIXEL_TO_METER_RATIO_DEFAULT;
final float top = -halfHeight;
final float bottom = halfHeight;
final float left = -halfHeight;
final float centerX = 0;
final float right = halfWidth;
final Vector2[] vertices = {
new Vector2(centerX, top),
new Vector2(right, bottom),
new Vector2(left, bottom)
};
Body body = PhysicsFactory.createPolygonBody(pPhysicsWorld, pAreaShape, vertices, pBodyType, pFixtureDef);
body.setLinearDamping(Roof.LINEAR_DAMPING);
body.setAngularDamping(Roof.ANGULAR_DAMPING);
return body;
}
@Override
public IAreaShape getAreaShape() {
return roofSprite;
}
}
|
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.rest;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
import ${package}.service.EmpresaMicroServices;
/**
* Classe responsável por prover UPLOAD de arquivos como um recurso.
*
* @author
* @see JaxRsActivator
* @see EmpresaMicroServices
* @since 1.0
* @version 1.0.0
*/
@Path("/upload")
@RequestScoped
public class UploadRESTService {
private static final Logger log = Logger.getLogger(UploadRESTService.class.getName());
/**
* Método reponsável por receber arquivos (IMAGEM e PDF) e persisti-los no
* GED.
* <p>
* Os campos serão mapeados pela <b>{@code tag html name}</b>.
* <p>
* <b>IMPORTANTE: </b>As tags do tipo <b>text</b> {@code
* <input type="text"/>}serão ignoradas.
* <p>
* Os campos são mapeados pela {@code tag html name} do formulário.
*
* @author
* @see MultipartFormDataInput
* @since 1.0
* @param multipart
* /form-data
* @return Map no formato JSON
*/
@POST
@Path("/form")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public Response uploadFile(MultipartFormDataInput input) {
Map<String, String> retorno = new HashMap<>();
Map<String, List<InputPart>> uploadForm = input.getFormDataMap();
Set<String> keysForm = uploadForm.keySet();
for (String chave : keysForm) {
List<InputPart> inputParts = uploadForm.get(chave);
for (InputPart inputPart : inputParts) {
if (inputPart.getMediaType().getType().equalsIgnoreCase("image")
|| inputPart.getMediaType().getType().equalsIgnoreCase("application")) {
try {
InputStream inputStream = inputPart.getBody(InputStream.class, null);
log.info(chave + " - " + inputStream);
retorno.put(chave, "sucesso");
} catch (IOException e) {
retorno.put(chave, "falha");
}
} else {
retorno.put(chave, "ignorado");
}
}
}
return Response.status(200).entity(retorno).build();
}
}
|
package com.youthchina.dao.tianjian;
import com.youthchina.domain.tianjian.ComRichText;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* Created by zhongyangwu on 11/10/18.
*/
@Mapper
@Component
public interface RichTextMapper {
void addRichText(ComRichText comRichText);
ComRichText getAnswerBody(Integer id);
ComRichText getQuestionBody(Integer id);
ComRichText getEssayBody(Integer id);
ComRichText getBriefReviewBody(Integer id);
void updateRichText(ComRichText comRichText);
List<ComRichText> getSameTypeRichText(int rich_type);
}
|
package org.zxd.spring.boot.hystrix;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import lombok.extern.slf4j.Slf4j;
/**
* create by zhuxudong @ 2018年6月5日T下午3:12:54
*/
@RunWith(SpringRunner.class)
@SpringBootTest
@Slf4j
public class HystrixTest {
@SuppressWarnings({ "unused" })
@Test
public void test() throws InterruptedException, ExecutionException {
GetStockCommand getStockCommand = new GetStockCommand(1L);
Integer val = getStockCommand.execute();
getStockCommand = new GetStockCommand(1L);
Future<Integer> future = getStockCommand.queue();
val = future.get();
getStockCommand = new GetStockCommand(1L);
getStockCommand.observe().forEach(v -> {
log.info("value {}", v);
}, t -> {
log.error(t.getMessage(), t);
});
}
}
|
package readingmeter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.validation.constraints.NotNull;
@Entity
public class Consumption {
@Id
@GeneratedValue
private Long id;
@NotNull
private Month month;
@NotNull
private int consumption;
@JsonIgnore
@OneToOne
private Connection connection;
public String uri;
public Consumption(Month month, int consumption, Connection connection, String uri) {
this.month = month;
this.consumption = consumption;
this.connection = connection;
this.uri = uri;
}
public Month getMonth() {
return month;
}
public void setMonth(Month month) {
this.month = month;
}
public int getConsumption() {
return consumption;
}
public void setConsumption(int consumption) {
this.consumption = consumption;
}
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
}
|
package com.rohit.footballleagueapi;
import static org.junit.Assert.assertTrue;
import java.util.Objects;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import com.rohit.footballleagueapi.model.FootballLeagueStanding;
import com.rohit.footballleagueapi.service.FootballLeagueService;
@SpringBootTest
class FootballLeagueApiApplicationTests {
@Test
void contextLoads() {
}
@MockBean
private FootballLeagueService service;
@Test
public void getLeagueDetailsTest() throws Exception {
FootballLeagueStanding model = new FootballLeagueStanding();
Mockito.when(service.getStandings("England", "Championship", "Watford")).thenReturn(model);
assertTrue(Objects.nonNull(model));
}
}
|
package com.boot.spring.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.boot.spring.model.Manager;
import com.boot.spring.repository.ManagersRepository;
@Service
public class ManagerService {
@Autowired
private ManagersRepository managers;
public Manager save(Manager manager) {
return managers.save(manager);
}
public List<Manager> find() {
return managers.findAll();
}
}
|
package SikuliWrapper;
import java.rmi.Remote;
import java.rmi.RemoteException;
import org.sikuli.script.FindFailed;
public interface SikuliActions extends Remote {
void click(String target) throws RemoteException;
void rightClick(String target) throws RemoteException;
void wait(String target, int timeToWait) throws RemoteException;
void doubleClick(String target) throws RemoteException;
void type(String target, String text) throws RemoteException;
void type(String text) throws RemoteException;
void find(String target) throws RemoteException;
void dragDrop(String dragTarget, String dropTarget) throws RemoteException;
void hover(String target) throws RemoteException;
void waitVanish(String target) throws RemoteException;
}
|
package spring.learning.es.model;
public enum QUERY_TYPES {
MUST, MUST_NOT, SHOULD, FILTER, RANGE;
}
|
package com.union.design.common.util;
import org.apache.commons.lang3.StringUtils;
import java.beans.PropertyEditorSupport;
public class StringPropertyEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException {
if (StringUtils.isBlank(text)) {
setValue(null);
} else {
setValue(text.trim());
}
}
}
|
package cn.stormbirds.expressDelivery.entity;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* cn.stormbirds.express_delivery.entity
* </p>
*
* @author StormBirds Email:xbaojun@gmail.com
* @since 2019/9/3 18:45
*/
public class LogisticsTrackingSubBean {
/**
* ShipperCode : SF
* OrderCode : SF201608081055208281
* LogisticCode : 3100707578976
* PayType : 1
* ExpType : 1
* CustomerName :
* CustomerPwd :
* MonthCode :
* IsNotice : 0
* Sender : {"Name":"1255760","Tel":"","Mobile":"13700000000","ProvinceName":"广东省","CityName":"深圳市","ExpAreaName":"福田区","Address":"测试地址"}
* Receiver : {"Name":"1255760","Tel":"","Mobile":"13800000000","ProvinceName":"广东省","CityName":"深圳市","ExpAreaName":"龙华新区","Address":"测试地址2"}
* Commodity : [{"GoodsName":"书本"}]
*/
private String ShipperCode;
private String OrderCode;
private String LogisticCode;
private String PayType;
private String ExpType;
private String CustomerName;
private String CustomerPwd;
private String MonthCode;
private String IsNotice;
private SenderBean Sender;
private ReceiverBean Receiver;
private List<CommodityBean> Commodity;
public LogisticsTrackingSubBean(){}
public LogisticsTrackingSubBean(ExpressTracking expressTracking,
String senderName,
String senderTel,
String senderMobile,
String senderProvinceName,
String senderCityName,
String senderExpAreaName,
String senderAddress){
ReceiverBean receiverBean = new ReceiverBean();
receiverBean.setAddress(expressTracking.getReceiverAddress());
receiverBean.setCityName(expressTracking.getReceiverCity());
receiverBean.setExpAreaName(expressTracking.getReceiverArea());
receiverBean.setMobile(expressTracking.getReceiverPhone());
receiverBean.setName(expressTracking.getReceiverName());
receiverBean.setProvinceName(expressTracking.getReceiverProvince());
receiverBean.setTel("");
SenderBean senderBean = new SenderBean();
senderBean.setAddress(senderAddress);
senderBean.setCityName(senderCityName);
senderBean.setExpAreaName(senderExpAreaName);
senderBean.setMobile(senderMobile);
senderBean.setName(senderName);
senderBean.setProvinceName(senderProvinceName);
senderBean.setTel(senderTel);
List<CommodityBean> commodityBeanList = new ArrayList<>();
commodityBeanList.add(new CommodityBean(expressTracking.getItemTitle(),null,null,null,null,null,null));
this.ShipperCode = expressTracking.getShipperCode();
this.OrderCode = null;
this.LogisticCode = expressTracking.getTrackingNo();
this.PayType=null;
this.ExpType = null;
this.CustomerName = null;
this.CustomerPwd = null;
this.MonthCode = null;
this.IsNotice = null;
this.Sender = senderBean;
this.Receiver = receiverBean;
this.Commodity = commodityBeanList;
}
public String getShipperCode() {
return ShipperCode;
}
public void setShipperCode(String ShipperCode) {
this.ShipperCode = ShipperCode;
}
public String getOrderCode() {
return OrderCode;
}
public void setOrderCode(String OrderCode) {
this.OrderCode = OrderCode;
}
public String getLogisticCode() {
return LogisticCode;
}
public void setLogisticCode(String LogisticCode) {
this.LogisticCode = LogisticCode;
}
public String getPayType() {
return PayType;
}
public void setPayType(String PayType) {
this.PayType = PayType;
}
public String getExpType() {
return ExpType;
}
public void setExpType(String ExpType) {
this.ExpType = ExpType;
}
public String getCustomerName() {
return CustomerName;
}
public void setCustomerName(String CustomerName) {
this.CustomerName = CustomerName;
}
public String getCustomerPwd() {
return CustomerPwd;
}
public void setCustomerPwd(String CustomerPwd) {
this.CustomerPwd = CustomerPwd;
}
public String getMonthCode() {
return MonthCode;
}
public void setMonthCode(String MonthCode) {
this.MonthCode = MonthCode;
}
public String getIsNotice() {
return IsNotice;
}
public void setIsNotice(String IsNotice) {
this.IsNotice = IsNotice;
}
public SenderBean getSender() {
return Sender;
}
public void setSender(SenderBean Sender) {
this.Sender = Sender;
}
public ReceiverBean getReceiver() {
return Receiver;
}
public void setReceiver(ReceiverBean Receiver) {
this.Receiver = Receiver;
}
public List<CommodityBean> getCommodity() {
return Commodity;
}
public void setCommodity(List<CommodityBean> Commodity) {
this.Commodity = Commodity;
}
public static class SenderBean {
/**
* Name : 1255760
* Tel :
* Mobile : 13700000000
* ProvinceName : 广东省
* CityName : 深圳市
* ExpAreaName : 福田区
* Address : 测试地址
*/
private String Name;
private String Tel;
private String Mobile;
private String ProvinceName;
private String CityName;
private String ExpAreaName;
private String Address;
public String getName() {
return Name;
}
public void setName(String Name) {
this.Name = Name;
}
public String getTel() {
return Tel;
}
public void setTel(String Tel) {
this.Tel = Tel;
}
public String getMobile() {
return Mobile;
}
public void setMobile(String Mobile) {
this.Mobile = Mobile;
}
public String getProvinceName() {
return ProvinceName;
}
public void setProvinceName(String ProvinceName) {
this.ProvinceName = ProvinceName;
}
public String getCityName() {
return CityName;
}
public void setCityName(String CityName) {
this.CityName = CityName;
}
public String getExpAreaName() {
return ExpAreaName;
}
public void setExpAreaName(String ExpAreaName) {
this.ExpAreaName = ExpAreaName;
}
public String getAddress() {
return Address;
}
public void setAddress(String Address) {
this.Address = Address;
}
}
public static class ReceiverBean {
/**
* Name : 1255760
* Tel :
* Mobile : 13800000000
* ProvinceName : 广东省
* CityName : 深圳市
* ExpAreaName : 龙华新区
* Address : 测试地址2
*/
private String Name;
private String Tel;
private String Mobile;
private String ProvinceName;
private String CityName;
private String ExpAreaName;
private String Address;
public String getName() {
return Name;
}
public void setName(String Name) {
this.Name = Name;
}
public String getTel() {
return Tel;
}
public void setTel(String Tel) {
this.Tel = Tel;
}
public String getMobile() {
return Mobile;
}
public void setMobile(String Mobile) {
this.Mobile = Mobile;
}
public String getProvinceName() {
return ProvinceName;
}
public void setProvinceName(String ProvinceName) {
this.ProvinceName = ProvinceName;
}
public String getCityName() {
return CityName;
}
public void setCityName(String CityName) {
this.CityName = CityName;
}
public String getExpAreaName() {
return ExpAreaName;
}
public void setExpAreaName(String ExpAreaName) {
this.ExpAreaName = ExpAreaName;
}
public String getAddress() {
return Address;
}
public void setAddress(String Address) {
this.Address = Address;
}
}
public static class CommodityBean {
/**
* GoodsName : 书本
*/
private String GoodsName;
//String(20) 商品编码 O
private String GoodsCode;
// Int(5) 件数 O
private Integer Goodsquantity;
// Double(10) 商品价格 O
private Double GoodsPrice;
// Double 商品重量kg O
private Double GoodsWeight;
// String(50) 商品描述 O
private String GoodsDesc;
// Double 商品体积m3 O
private Double GoodsVol;
public CommodityBean() {
}
public CommodityBean(String goodsName, String goodsCode, Integer goodsquantity, Double goodsPrice, Double goodsWeight, String goodsDesc, Double goodsVol) {
GoodsName = goodsName;
GoodsCode = goodsCode;
Goodsquantity = goodsquantity;
GoodsPrice = goodsPrice;
GoodsWeight = goodsWeight;
GoodsDesc = goodsDesc;
GoodsVol = goodsVol;
}
public String getGoodsName() {
return GoodsName;
}
public void setGoodsName(String GoodsName) {
this.GoodsName = GoodsName;
}
public String getGoodsCode() {
return GoodsCode;
}
public void setGoodsCode(String goodsCode) {
GoodsCode = goodsCode;
}
public Integer getGoodsquantity() {
return Goodsquantity;
}
public void setGoodsquantity(Integer goodsquantity) {
Goodsquantity = goodsquantity;
}
public Double getGoodsPrice() {
return GoodsPrice;
}
public void setGoodsPrice(Double goodsPrice) {
GoodsPrice = goodsPrice;
}
public Double getGoodsWeight() {
return GoodsWeight;
}
public void setGoodsWeight(Double goodsWeight) {
GoodsWeight = goodsWeight;
}
public String getGoodsDesc() {
return GoodsDesc;
}
public void setGoodsDesc(String goodsDesc) {
GoodsDesc = goodsDesc;
}
public Double getGoodsVol() {
return GoodsVol;
}
public void setGoodsVol(Double goodsVol) {
GoodsVol = goodsVol;
}
}
}
|
package com.wmm.login.logindemo.bean;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
/**
* Created by wmm on 2019/7/8.
*/
@Slf4j
public class ResultBean {
private int code = 1;
private String msg = "Success !!";
private String msg_cn = "操作成功!";
private Object data = null;
public ResultBean() {
}
public ResultBean(int code, String msg, String msg_cn, Object data) {
this.code = code;
this.msg = msg;
this.msg_cn = msg_cn;
this.data = data;
}
public ResultBean success(String msg_cn) {
this.msg_cn = msg_cn;
return this;
}
public ResultBean failed(String msg_cn) {
this.code = 0;
this.msg = "Error !!";
this.msg_cn = msg_cn;
if (null!=msg_cn && !"".equals(msg_cn)){
log.info(msg_cn);
}
return this;
}
public ResultBean error(Exception e) {
this.code = 0;
this.msg = "Error !!";
if (e != null) {
this.msg_cn = "系统错误!错误信息:" + e.getMessage();
}
log.error(e.getMessage());
return this;
}
public int getCode() {
return code;
}
public ResultBean setCode(int code) {
this.code = code;
return this;
}
public String getMsg() {
return msg;
}
public ResultBean setMsg(String msg) {
this.msg = msg;
return this;
}
public String getMsg_cn() {
return msg_cn;
}
public ResultBean setMsg_cn(String msg_cn) {
this.msg_cn = msg_cn;
return this;
}
public Object getData() {
return data;
}
public <T> T getDataParseEntity(Class<T> clazz) {
return JSON.parseObject(JSON.toJSONString(this.data), clazz);
}
public ResultBean setData(Object data) {
this.data = data;
return this;
}
}
|
package com.tencent.mm.plugin.sns.ui;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import com.tencent.mm.plugin.sns.ui.ah.a;
class ah$a$1 implements OnCancelListener {
final /* synthetic */ ah nQh;
final /* synthetic */ a nQi;
ah$a$1(a aVar, ah ahVar) {
this.nQi = aVar;
this.nQh = ahVar;
}
public final void onCancel(DialogInterface dialogInterface) {
}
}
|
package com.android.lovesixgod.myrefreshlistview;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.SeekBar;
public class MainActivity extends AppCompatActivity {
private SeekBar seekBar;
private RefreshFirstView firstView;
private Button play;
private RefreshSecondView secondAnim;
private RefreshThirdView thirdAnim;
private Button toList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
seekBar = (SeekBar) findViewById(R.id.seek_bar);
firstView = (RefreshFirstView) findViewById(R.id.first_view);
play = (Button) findViewById(R.id.play_animation);
toList = (Button) findViewById(R.id.go_to_list);
secondAnim = (RefreshSecondView) findViewById(R.id.second_animation);
thirdAnim = (RefreshThirdView) findViewById(R.id.third_animation);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
float currentProgress = (float) progress / (float) seekBar.getMax();
firstView.setCurrentProgress(currentProgress);
firstView.postInvalidate();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
play.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AnimationDrawable second = (AnimationDrawable) secondAnim.getBackground();
second.start();
AnimationDrawable third = (AnimationDrawable) thirdAnim.getBackground();
third.start();
}
});
toList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, ListActivity.class);
startActivity(intent);
}
});
}
}
|
package zhaoyin;
import java.util.ArrayList;
/**
* Created by shugenniu on 2017/10/10.
*/
public class Main {
public static ArrayList<ArrayList<Integer>> allSubsets(ArrayList<Integer> set) {
ArrayList<ArrayList<Integer>> lists = new ArrayList<ArrayList<Integer>>();
int n = 1 << set.size();
for (int i = 0; i < n; i++) {
int index = 0;
int k = i;
ArrayList<Integer> list = new ArrayList<Integer>();
while (k > 0) {
if ((k & 1) > 0) {
list.add(set.get(index));
}
k >>= 1;
index++;
}
lists.add(list);
}
return lists;
}
}
|
//Exercise 2-3.
public class Time
{
public static void main (String[] args)
{
int hour = 22;
int minute = 49;
int second = 45;
final int NUM_SEC_IN_DAY = 86400;
System.out.print("The number of seconds since midnight is: ");
System.out.println((((hour * 60) + minute) * 60) + second); //82,185
System.out.println();
System.out.print("The number of seconds remaining in the day is: ");
System.out.println( NUM_SEC_IN_DAY - ((((hour * 60) + minute) * 60) + second));
System.out.println();
double hour2 = 22.0;
double maxhr2 = 24.0;
System.out.println("Fraction of the day that has passed: ");
System.out.println(hour2 / maxhr2);
System.out.println();
double oldhour = 22.0;
double oldmin = 49.0;
double oldsec = 45.0;
double newhour = 23.0;
double newmin = 12.0;
double newsec = 35.0;
double oldtime = ((((oldhour * 60) + oldmin) * 60) + oldsec);
double newtime = ((((newhour * 60) + newmin) * 60) + newsec);
double elapsedtime = newtime - oldtime;
System.out.print("Elapsed time in seconds is: ");
System.out.println(elapsedtime);
System.out.print("Elapsed time in minutes is: ");
System.out.println(elapsedtime / 60);
System.out.print("Elapsed time in hours is: ");
System.out.println((elapsedtime / 60) / 60);
}
}
|
package vanadis.annopro;
import org.junit.Test;
import java.util.Arrays;
import static org.junit.Assert.assertTrue;
public class EarlyBreakTest {
@SuppressWarnings({"ThrowableInstanceNeverThrown"})
@Test
public void testNoStackTrace() {
StackTraceElement[] stackTraceElements = new EarlyBreakException().getStackTrace();
assertTrue(Arrays.toString(stackTraceElements), stackTraceElements.length == 0);
}
}
|
package uk.org.mcdonnell.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Service;
import uk.org.mcdonnell.repository.Employee;
@Service
public class EmployeeService {
private List<Employee> employees;
public void create(Employee employee) {
getEmployees().add(employee);
}
public List<Employee> getEmployees() {
if (employees == null) {
employees = new ArrayList<Employee>();
}
return employees;
}
}
|
package fr.formation.spring.museum.converters;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import fr.formation.spring.museum.models.Locale;
import fr.formation.spring.museum.repositories.LocaleRepository;
@Component
public class IntegerToLocaleConverter implements Converter<String, Locale>
{
@Autowired
@Lazy(true)
public LocaleRepository localeRepository;
@Override
public Locale convert(String sourceStr) {
int source = Integer.parseInt(sourceStr);
Optional<Locale> rank = localeRepository.findById(source);
if (rank.isPresent())
return rank.get();
throw new IllegalArgumentException("Unknown locale id " + source);
}
}
|
package com.example.android_essential_05_hw2;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
public class ButtonsFragment extends Fragment implements View.OnClickListener {
Fragment currentFragment;
FragmentManager fragmentManager;
Fragment[] fragments;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.buttons, null);
Button btnLeft = (Button) v.findViewById(R.id.btnLeft);
Button btnRight = (Button) v.findViewById(R.id.btnRight);
btnLeft.setOnClickListener(this);
btnRight.setOnClickListener(this);
Activity activity = getActivity();
fragmentManager = ((FragmentActivity) activity).getSupportFragmentManager();
fragments = new Fragment[]{new Fragment1(), new Fragment2(), new Fragment3(), new Fragment4()};
currentFragment = fragments[0];
return v;
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btnLeft:
if(currentFragment != fragments[0]) {
for (int i = 0; i < fragments.length; i++) {
if(currentFragment == fragments[i]) {
currentFragment = fragments[i - 1];
break;
}
}
fragmentManager.beginTransaction().replace(R.id.frame_layout, currentFragment).commit();
}
break;
case R.id.btnRight:
if(currentFragment != fragments[fragments.length - 1]) {
for (int i = 0; i < fragments.length; i++) {
if(currentFragment == fragments[i]) {
currentFragment = fragments[i + 1];
break;
}
}
fragmentManager.beginTransaction().replace(R.id.frame_layout, currentFragment).commit();
}
break;
}
}
}
|
package PL.ReturnBook;
import BLL.ReturnBookController;
import DAL.BorrowingInfo;
import DAL.User;
import PL.Login.LoginForm;
import PL.SearchBook.SearchBookForm;
import PL.UpdateBookInformation.UpdateBookInformationForm;
import PL.UpdateBorrowingCardInfo.UpdateBorrowingCardInfoForm;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
public class ReturnBookListener {
private ArrayList<BorrowingInfo> infos;
private User user;
private ReturnBookController controller = new ReturnBookController();
private ArrayList<BorrowingInfo> select_infos = new ArrayList<>();
@FXML
private TextField addFeeTextField;
@FXML
private ComboBox catalogueCBox;
ObservableList<String> catalogueOptions =
FXCollections.observableArrayList("CardID", "BorrowingID");
@FXML
private TextField searchField;
@FXML
private HBox bottomHBox;
@FXML
private Label welcomeLabel;
public void setWelcomeLabel(String name) {
welcomeLabel.setText("Welcome, " + name);
}
public void setUser(User user) {
this.user = user;
}
/**
* init scene
*/
@FXML
private void initialize() {
catalogueCBox.setValue("CardID");
catalogueCBox.setItems(catalogueOptions);
}
/**
* handle Logout button
*
* @param actionEvent event created by action
*/
@FXML
public void handleLogoutButton(ActionEvent actionEvent) {
Node source = (Node) actionEvent.getSource();
Stage primaryStage = (Stage) source.getScene().getWindow();
LoginForm form = new LoginForm();
form.start(primaryStage, "You have been logged out");
}
/**
* handle Search button
*
* @param actionEvent event created by action
*/
@FXML
public void handleSearchButton(ActionEvent actionEvent) {
if (bottomHBox != null) {
bottomHBox.setAlignment(Pos.BASELINE_LEFT);
bottomHBox.getChildren().clear();
}
String keyword = searchField.getText();
String catalogue = catalogueCBox.getValue().toString().toLowerCase();
if (catalogue.equals("isbn")) {
catalogue = catalogue.toUpperCase();
}
infos = controller.getBorrowingInfo(keyword, catalogue);
if (infos != null) {
bottomHBox.getChildren().clear();
bottomHBox.getChildren().add(addTable());
} else {
Text resultText = new Text("No result match");
resultText.setId("resultText");
if (bottomHBox != null) {
bottomHBox.setAlignment(Pos.BASELINE_CENTER);
bottomHBox.getChildren().clear();
bottomHBox.getChildren().addAll(resultText);
}
}
}
/**
* handle Collect button
*
* @param actionEvent event created by action
*/
@FXML
private void handleCollectButton(ActionEvent actionEvent) {
Button source = (Button) actionEvent.getSource();
int i = Integer.parseInt(source.getId());
select_infos.add(infos.get(i));
source.setVisible(false);
}
/**
* handle Print Bill button
*
* @param actionEvent event created by action
*/
@FXML
private void handlePrintBillButton(ActionEvent actionEvent) {
Node source = (Node) actionEvent.getSource();
Scene scene = source.getScene();
Stage stage = (Stage) scene.getWindow();
BillForm form = new BillForm();
double addFee;
if (addFeeTextField.getText().equals("")) {
addFee = 0;
} else {
addFee = Double.parseDouble(addFeeTextField.getText());
}
form.start(stage, select_infos, addFee);
}
/**
* handle Undo button
*
* @param actionEvent event created by action
*/
@FXML
private void handleUndoButton(ActionEvent actionEvent) {
if (!select_infos.isEmpty())
select_infos.clear();
Node source = (Node) actionEvent.getSource();
Scene scene = source.getScene();
if (infos != null) {
if (!infos.isEmpty()) {
for (int i = 0; i < infos.size(); i++) {
Button button = (Button) scene.lookup("#" + i);
button.setVisible(true);
}
}
}
}
/**
* add table with borrowing info list
*
* @return GridPane object table-like
*/
private GridPane addTable() {
GridPane gridPane = new GridPane();
gridPane.setAlignment(Pos.BASELINE_LEFT);
gridPane.setVgap(7);
gridPane.setHgap(7);
gridPane.add(new Label("BorrowingID"), 0, 0);
gridPane.add(new Label("CardID"), 1, 0);
gridPane.add(new Label("BookNumber"), 2, 0);
gridPane.add(new Label("CopyNumber"), 3, 0);
gridPane.add(new Label("Status"), 4, 0);
gridPane.add(new Label("DueDate"), 5, 0);
int i = 0;
while (i < infos.size()) {
BorrowingInfo one = infos.get(i);
Label temp;
temp = new Label(Integer.toString(infos.get(i).getBorrowingID()));
temp.setId("BorrowingID" + i);
gridPane.add(temp, 0, i + 1);
temp = new Label(Integer.toString(infos.get(i).getCardNumber()));
temp.setId("CardID" + i);
gridPane.add(temp, 1, i + 1);
temp = new Label(infos.get(i).getBookNumber());
temp.setId("BookNumber" + i);
gridPane.add(temp, 2, i + 1);
temp = new Label(Integer.toString(infos.get(i).getCopyNumber()));
temp.setId("CopyNumber" + i);
gridPane.add(temp, 3, i + 1);
temp = new Label(infos.get(i).getStatus());
temp.setId("Status" + i);
gridPane.add(temp, 4, i + 1);
temp = new Label(extractDate(infos.get(i).getDueDate()));
temp.setId("DueDate" + i);
gridPane.add(temp, 5, i + 1);
Button selectButton = new Button("Collect");
selectButton.setId(Integer.toString(i));
selectButton.setOnAction(this::handleCollectButton);
gridPane.add(selectButton, 6, i + 1);
i++;
}
Button selectButton = new Button("PrintBill");
selectButton.setOnAction(this::handlePrintBillButton);
gridPane.add(selectButton, 6, i + 1);
selectButton = new Button("Undo");
selectButton.setOnAction(this::handleUndoButton);
gridPane.add(selectButton, 5, i + 1);
return gridPane;
}
private String extractDate(Date date) {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
return sdf.format(date);
}
@FXML
public void handleRBNavButton(ActionEvent actionEvent) {
Node source = (Node) actionEvent.getSource();
Scene scene = source.getScene();
Stage stage = (Stage) scene.getWindow();
ReturnBookForm form = new ReturnBookForm();
form.start(stage, user);
}
@FXML
public void handleABNavButton(ActionEvent actionEvent) {
Node source = (Node) actionEvent.getSource();
Scene scene = source.getScene();
Stage stage = (Stage) scene.getWindow();
SearchBookForm form = new SearchBookForm();
form.start(stage, user);
}
@FXML
public void handleUCNavButton(ActionEvent actionEvent) {
Node source = (Node) actionEvent.getSource();
Scene scene = source.getScene();
Stage stage = (Stage) scene.getWindow();
UpdateBorrowingCardInfoForm form = new UpdateBorrowingCardInfoForm();
form.start(stage, user);
}
@FXML
public void handleUBNavButton(ActionEvent actionEvent) {
Node source = (Node) actionEvent.getSource();
Scene scene = source.getScene();
Stage stage = (Stage) scene.getWindow();
UpdateBookInformationForm form = new UpdateBookInformationForm();
form.start(stage, user);
}
}
|
package com.catnap.springmvc.view;
import com.catnap.core.view.CatnapView;
/**
* Interface that links a {@link com.catnap.core.view.CatnapView} and a Spring {@link org.springframework.web.servlet.View}
* implementation.
*
* @author gwhit7
*/
public interface WrappingView<T extends CatnapView>
{
/**
* @return the underlying {@link com.catnap.core.view.CatnapView} implementation wrapped by this view.
*/
public T getWrappedView();
/**
* @return the character encoding returned by the underlying {@link com.catnap.core.view.CatnapView}
* implementation wrapped by this view. (Ex. "UTF-8" or "UTF-16")
*/
public String getCharacterEncoding();
/**
* @return name of the object in the {@link org.springframework.ui.Model} to render with Catnap.
*/
public String getModelName();
}
|
package com.ekiner.expensetracker.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.ekiner.expensetracker.model.Category;
public interface CategoryRepository extends JpaRepository<Category, Long>{
Category findByName(String name);
}
|
package uns.ac.rs.hostplatserver.constant;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum LabelStatus {
ACTIVE(30, "Active"),
DELETED(31, "Deleted");
private final long id;
private final String value;
}
|
package com.example.tarea1;
public class Comment {
String comment;
public Comment(String commentario){
comment = commentario;
}
public String getComment(){
return comment;
}
}
|
package in.tanjo.sushi;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.PopupMenu;
import butterknife.BindView;
import butterknife.OnClick;
import in.tanjo.sushi.adapter.MainAdapter;
import in.tanjo.sushi.adapter.NavigationAdapter;
import in.tanjo.sushi.listener.OnRecyclerViewAdapterItemClickListener;
import in.tanjo.sushi.model.AbsNoteModel;
import in.tanjo.sushi.model.CountableSushi;
import in.tanjo.sushi.model.Note;
import in.tanjo.sushi.model.NoteManager;
import in.tanjo.sushi.model.Sushi;
public class MainActivity extends AbsActivity {
@BindView(R.id.main_coordinatorlayout)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.main_drawerlayout)
DrawerLayout mDrawerLayout;
@BindView(R.id.main_recycler_view)
RecyclerView mMainRecyclerView;
@BindView(R.id.main_floating_action_button)
FloatingActionButton mFloatingActionButton;
@BindView(R.id.navigation_recycler_view)
RecyclerView mNavigationRecyclerView;
private NoteManager mNoteManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init();
}
@Override
public int getContentViewLayout() {
return R.layout.activity_main;
}
@Override
public int getToolbarId() {
return R.id.main_toolbar;
}
/**
* イニシャライザー
*/
private void init() {
mNoteManager = new NoteManager(this);
initToolbar();
mMainRecyclerView.setHasFixedSize(true);
mMainRecyclerView.setLayoutManager(new LinearLayoutManager(this));
updateMainAdapter();
initNavigaitonRecyclerView();
}
/**
* ナビゲーションを初期化
*/
private void initToolbar() {
if (getToolbar() == null) {
return;
}
getToolbar().setNavigationIcon(R.drawable.ic_menu_black_24dp);
getToolbar().setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDrawerLayout.openDrawer(mNavigationRecyclerView);
}
});
}
private void updateMainAdapter() {
MainAdapter mainAdapter = new MainAdapter(mNoteManager.getActiveNote().getSushis());
mainAdapter
.setOnRecyclerViewAdapterItemClickListener(new OnRecyclerViewAdapterItemClickListener<CountableSushi>() {
@Override
public void onItemClick(View v, RecyclerView.Adapter adapter, int position, CountableSushi model) {
model.setCount(model.getCount() + 1);
changeItem(position, model);
}
@Override
public void onItemLongClick(View v, RecyclerView.Adapter adapter, final int position,
final CountableSushi model) {
PopupMenu popupMenu = new PopupMenu(MainActivity.this, v);
popupMenu.getMenuInflater().inflate(R.menu.popup_countable_sushi_model_menu, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.popup_menu_sushi_delete:
removeItem(position, model);
snackbar(model.getName() + "を削除しました");
break;
case R.id.popup_menu_sushi_plus1:
model.setCount(model.getCount() + 1);
changeItem(position, model);
break;
case R.id.popup_menu_sushi_minus1:
if (model.getCount() - 1 >= 0) {
model.setCount(model.getCount() - 1);
}
changeItem(position, model);
break;
}
return true;
}
});
popupMenu.show();
}
});
mMainRecyclerView.setAdapter(mainAdapter);
}
/**
* ナビゲーションのリサイクルViewを初期化
*/
private void initNavigaitonRecyclerView() {
mNavigationRecyclerView.setHasFixedSize(true);
mNavigationRecyclerView.setLayoutManager(new LinearLayoutManager(this));
updateNavigationAdapter();
}
private void changeItem(int position, CountableSushi sushiModel) {
mNoteManager.getActiveNote().getSushis().set(position, sushiModel);
mMainRecyclerView.getAdapter().notifyItemChanged(position);
mNoteManager.saveActiveNote();
}
private void removeItem(int position, CountableSushi sushiModel) {
mNoteManager.getActiveNote().getSushis().remove(sushiModel);
mMainRecyclerView.getAdapter().notifyItemRemoved(position);
mNoteManager.saveActiveNote();
// スクロールができなくなるとなにもできなくなるので強制的に表示してあげる.
mFloatingActionButton.show();
}
/**
* Snackbar を表示させる.
*/
private void snackbar(String text) {
final Snackbar snackbar = Snackbar.make(coordinatorLayout, text, Snackbar.LENGTH_LONG);
snackbar.setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View v) {
snackbar.dismiss();
}
});
snackbar.show();
}
private void updateNavigationAdapter() {
NavigationAdapter navigationAdapter = new NavigationAdapter(mNoteManager.getNotesModel().getNotes());
navigationAdapter
.setOnRecyclerViewAdapterItemClickListener(new OnRecyclerViewAdapterItemClickListener<AbsNoteModel>() {
@Override
public void onItemClick(View v, RecyclerView.Adapter adapter, int position, AbsNoteModel model) {
if (!mNoteManager.contains(mNoteManager.getActiveNote())) {
mNoteManager.add(mNoteManager.getActiveNote());
mNoteManager.saveNotesModel();
}
mNoteManager.setActiveNote(mNoteManager.getNote(model.getId()));
mNoteManager.saveActiveNote();
updateMainAdapter();
mNavigationRecyclerView.getAdapter().notifyDataSetChanged();
mDrawerLayout.closeDrawers();
}
@Override
public void onItemLongClick(View v, RecyclerView.Adapter adapter, int position, final AbsNoteModel model) {
if (mNoteManager.getActiveNote().getId().equals(model.getId())) {
snackbar("現在使用中のファイルのため削除できません.");
} else {
new AlertDialog.Builder(MainActivity.this, R.style.AppDialog)
.setTitle("ノートの削除")
.setMessage(model.getTitle() + "を削除しますか?")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (mNoteManager.contains(model)) {
mNoteManager.remove(model);
mNavigationRecyclerView.getAdapter().notifyDataSetChanged();
}
}
})
.setNegativeButton("キャンセル", null)
.show();
}
}
});
mNavigationRecyclerView.setAdapter(navigationAdapter);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
switch (requestCode) {
case EditNoteActivity.REQUESTCODE_NOTE_OBJECT: {
receiveNote(data);
break;
}
case AddSushiActivity.REQUESTCODE_SUSHI_OBJECT: {
receiveSushi(data);
break;
}
}
}
}
/**
* この Activity で NoteModel を受け取ったときに処理する.
*/
private void receiveNote(Intent data) {
if (data == null) {
return;
}
Bundle bundle = data.getExtras();
if (bundle != null) {
Note note = (Note) bundle.getSerializable(EditNoteActivity.BUNDLEKEY_NOTE_OBJECT);
if (note != null) {
mNoteManager.setActiveNote(note);
updateMainAdapter();
snackbar("メモを更新しました");
mNoteManager.saveActiveNote();
mNoteManager.replace(mNoteManager.getActiveNote());
mNoteManager.saveNotesModel();
mNavigationRecyclerView.getAdapter().notifyDataSetChanged();
}
}
}
/**
* この Activity で SushiModel を受け取ったときに処理する.
*/
private void receiveSushi(Intent data) {
if (data == null) {
return;
}
Bundle bundle = data.getExtras();
if (bundle != null) {
Sushi sushi = (Sushi) bundle.getSerializable(AddSushiActivity.BUNDLE_KEY_SUSHI_MODEL);
if (sushi != null) {
addItem(new CountableSushi(sushi));
snackbar(sushi.getName() + "を追加しました");
}
}
}
private void addItem(CountableSushi sushiModel) {
mNoteManager.getActiveNote().getSushis().add(sushiModel);
mMainRecyclerView.getAdapter().notifyItemInserted(mNoteManager.getActiveNote().getSushis().size());
mNoteManager.saveActiveNote();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_create_new_note:
if (!mNoteManager.contains(mNoteManager.getActiveNote())) {
mNoteManager.add(mNoteManager.getActiveNote());
mNoteManager.saveNotesModel();
}
mNoteManager.setActiveNote(new Note());
mNoteManager.saveActiveNote();
updateMainAdapter();
mNavigationRecyclerView.getAdapter().notifyDataSetChanged();
break;
// case R.id.action_settings:
// snackbar("設定は開発中です");
// break;
case R.id.action_note_edit:
EditNoteActivity.startActivityWithNoteObjectAndRequestCode(this, mNoteManager.getActiveNote());
break;
case R.id.action_oaiso:
ResultActivity.startActivityWithNoteObject(this, mNoteManager.getActiveNote());
break;
case R.id.action_license:
LicenseActivity.startActivity(this);
break;
default:
break;
}
return super.onOptionsItemSelected(item);
}
@OnClick(R.id.main_floating_action_button)
void add() {
AddSushiActivity.startActivityWithSushiRequestCode(this);
}
}
|
package com.bdb.conexion;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.log4j.Logger;
public class ConnectMPX {
private static final Logger log;
static {
log = Logger.getLogger(com.bdb.conexion.AdmConexiones.class);
}
static Connection con=null;
public ConnectMPX(Conexion conexion) {
// creamos la conexión
/* try {
if ((con!=null) && (con.isClosed())){
con=null;
System.gc();
}
} catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace();
} */
/* if (con!=null) return; */
try {
Class.forName(conexion.getDriver());
con = DriverManager.getConnection(conexion.getUrl() ,conexion.getUsuario() , conexion.getPassword());
if(con != null)
System.out.println("Connection Successful!");
}
catch(Exception e) {
e.printStackTrace();
System.out.println("Error Trace in getConnection() : " + e.getMessage());
}
}
public void closeConnection() {
try {
con.clearWarnings();
if (!(con.isClosed())) con.close();
con=null;
System.gc();
} catch (SQLException e) { e.printStackTrace(); }
}
public Connection getConnection(){
return con;
}
}
|
/*
* Copyright (c) 2008-2013, Hazelcast, Inc. 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.
* 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.hazelcast.concurrent.semaphore;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.ISemaphore;
import com.hazelcast.test.HazelcastParallelClassRunner;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@RunWith(HazelcastParallelClassRunner.class)
@Category(QuickTest.class)
public class SemaphoreTest extends HazelcastTestSupport {
private HazelcastInstance hz;
@Before
public void setUp() {
hz = createHazelcastInstance();
}
@Test(timeout = 30000)
public void testAcquire() throws InterruptedException {
final ISemaphore semaphore = hz.getSemaphore(randomString());
int numberOfPermits = 20;
assertTrue(semaphore.init(numberOfPermits));
for (int i = 0; i < numberOfPermits; i++) {
assertEquals(numberOfPermits - i, semaphore.availablePermits());
semaphore.acquire();
}
assertEquals(semaphore.availablePermits(), 0);
}
@Test(timeout = 30000)
public void testRelease() {
final ISemaphore semaphore = hz.getSemaphore(randomString());
int numberOfPermits = 20;
for (int i = 0; i < numberOfPermits; i++) {
assertEquals(i, semaphore.availablePermits());
semaphore.release();
}
assertEquals(semaphore.availablePermits(), numberOfPermits);
}
@Test(timeout = 30000)
public void testMultipleAcquire() throws InterruptedException {
final ISemaphore semaphore = hz.getSemaphore(randomString());
int numberOfPermits = 20;
assertTrue(semaphore.init(numberOfPermits));
for (int i = 0; i < numberOfPermits; i += 5) {
assertEquals(numberOfPermits - i, semaphore.availablePermits());
semaphore.acquire(5);
}
assertEquals(semaphore.availablePermits(), 0);
}
@Test(timeout = 30000)
public void testMultipleRelease() {
final ISemaphore semaphore = hz.getSemaphore(randomString());
int numberOfPermits = 20;
for (int i = 0; i < numberOfPermits; i += 5) {
assertEquals(i, semaphore.availablePermits());
semaphore.release(5);
}
assertEquals(semaphore.availablePermits(), numberOfPermits);
}
@Test(timeout = 30000)
public void testDrain() throws InterruptedException {
final ISemaphore semaphore = hz.getSemaphore(randomString());
int numberOfPermits = 20;
assertTrue(semaphore.init(numberOfPermits));
semaphore.acquire(5);
int drainedPermits = semaphore.drainPermits();
assertEquals(drainedPermits, numberOfPermits - 5);
assertEquals(semaphore.availablePermits(), 0);
}
@Test(timeout = 30000)
public void testReduce() {
final ISemaphore semaphore = hz.getSemaphore(randomString());
int numberOfPermits = 20;
assertTrue(semaphore.init(numberOfPermits));
for (int i = 0; i < numberOfPermits; i += 5) {
assertEquals(numberOfPermits - i, semaphore.availablePermits());
semaphore.reducePermits(5);
}
assertEquals(semaphore.availablePermits(), 0);
}
@Test(timeout = 30000)
public void testTryAcquire() {
final ISemaphore semaphore = hz.getSemaphore(randomMapName());
int numberOfPermits = 20;
assertTrue(semaphore.init(numberOfPermits));
for (int i = 0; i < numberOfPermits; i++) {
assertEquals(numberOfPermits - i, semaphore.availablePermits());
assertEquals(semaphore.tryAcquire(), true);
}
assertFalse(semaphore.tryAcquire());
assertEquals(semaphore.availablePermits(), 0);
}
@Test(timeout = 30000)
public void testTryAcquireMultiple() {
final ISemaphore semaphore = hz.getSemaphore(randomString());
int numberOfPermits = 20;
assertTrue(semaphore.init(numberOfPermits));
for (int i = 0; i < numberOfPermits; i += 5) {
assertEquals(numberOfPermits - i, semaphore.availablePermits());
assertEquals(semaphore.tryAcquire(5), true);
}
assertEquals(semaphore.availablePermits(), 0);
}
@Test(timeout = 30000)
public void testInit_whenNotIntialized() {
ISemaphore semaphore = hz.getSemaphore(randomString());
boolean result = semaphore.init(2);
assertTrue(result);
assertEquals(2, semaphore.availablePermits());
}
@Test(timeout = 30000)
public void testInit_whenAlreadyIntialized() {
ISemaphore semaphore = hz.getSemaphore(randomString());
semaphore.init(2);
boolean result = semaphore.init(4);
assertFalse(result);
assertEquals(2, semaphore.availablePermits());
}
}
|
package com.osce.server.portal.user.role;
import com.osce.api.user.role.PfRoleService;
import com.osce.dto.user.role.PfRoleDto;
import com.osce.result.PageResult;
import com.osce.result.ResultFactory;
import com.osce.server.portal.BaseController;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @ClassName: PfRoleRestController
* @Description: 角色模块
* @Author yangtongbin
* @Date 2017/9/17 23:13
*/
@Controller
@RequestMapping(value = "/pf/p/role")
public class PfRoleController extends BaseController {
@Reference
private PfRoleService pfRoleService;
@PreAuthorize("hasAnyRole('ROLE_ROLE_MG','ROLE_SUPER')")
@RequestMapping("/page")
public String page() {
return "pages/user/role/role";
}
@PreAuthorize("hasAnyRole('ROLE_ROLE_MG','ROLE_SUPER')")
@RequestMapping("/form")
public String form(String formType, Model model) {
model.addAttribute("formType", formType);
return "pages/user/role/roleForm";
}
/**
* 获取所有角色
*
* @param dto
* @return
*/
@PreAuthorize("hasAnyRole('ROLE_ROLE_MG','ROLE_SUPER')")
@RequestMapping(value = "/list")
@ResponseBody
public PageResult listRoles(PfRoleDto dto) {
return ResultFactory.initPageResultWithSuccess(pfRoleService.countRoles(dto),
pfRoleService.listRoles(dto));
}
}
|
package centralized;
import logist.task.Task;
import java.util.HashMap;
import java.util.List;
import logist.simulation.Vehicle;
import logist.plan.Action.Delivery;
import logist.plan.Action.Pickup;
public class NextActionManager {
private HashMap<TAction, TAction> nextAction;
private HashMap<Vehicle, TAction> firstAction;
public NextActionManager(List<Vehicle> vehicles){
this.nextAction = new HashMap<TAction, TAction>();
this.firstAction = new HashMap<Vehicle, TAction>();
for(Vehicle v: vehicles){
firstAction.put(v, null);
}
}
public NextActionManager(NextActionManager other){
this.nextAction = new HashMap<TAction,TAction>(other.nextAction);
this.firstAction = new HashMap<Vehicle, TAction>(other.firstAction);
}
public TAction firstPick(Vehicle vk){
return firstAction.get(vk);
}
public TAction nextAction(TAction a){
//return null if last vehicle action
return nextAction.get(a);
}
public void setFirstAction(Vehicle v, TAction a){
//if(a != null && a.isDelivery()) {throw new IllegalArgumentException("First action can not be a delivery");}
firstAction.put(v, a);
}
public void setNextAction(TAction a1, TAction a2) {
if(a1 != null && !a1.equals(a2))//throw new IllegalArgumentException();
nextAction.put(a1, a2);
}
public void removeTask(Task t){
TAction pick = new TAction(new Pickup(t), t);
TAction deliver = new TAction(new Delivery(t), t);
nextAction.remove(pick);
nextAction.remove(deliver);
}
}
|
package com.example.magdam.handshake;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.media.MediaPlayer;
import android.os.AsyncTask;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.lang.Exception;
import java.net.SocketException;
import java.net.UnknownHostException;
public class UDPSender extends AsyncTask<String, Integer, String> {
private static final String MUSIC = "music";
int UDP_SERVER_PORT=11111;
String nadawca;
String odbiorca;
String ip;
boolean listen;
String NAD_PREF="Nadawca";
String ODB_PREF="Odbiorca";
Context c;
int from =Color.BLUE;
MainActivity view;
MediaPlayer mp;
int progress=0;
int length=0;
JSONObject w;
public UDPSender(boolean l, JSONObject wiadomosc, Context context){
c=context;
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(context);
ip=SP.getString("IP","127.0.0.1");
SharedPreferences settings = context.getSharedPreferences(this.ODB_PREF, 0);
String odbiorca = settings.getString(this.ODB_PREF, "");
SharedPreferences nadawcaP = context.getSharedPreferences(this.NAD_PREF, 0);
String nadawca = nadawcaP.getString(this.NAD_PREF, "");
listen=l;
w=wiadomosc;
try {
w.put("nadawca", nadawca);
w.put("adresat", odbiorca);
} catch (JSONException e) {
e.printStackTrace();
}
}
protected String doInBackground(String... messages) {
String udpMsg=w.toString();
runUdpClient(udpMsg);
return null;
}
public void setListen(boolean l){
listen=l;
}
private long setVibration(long r){
if(r>10){
return 10;
}
else{
return r;
}
}
public void runUdpClient(String udpMsg) {
DatagramSocket ds = null;
try {
ds = new DatagramSocket();
InetAddress serverAddr = InetAddress.getByName(ip);
DatagramPacket dp;
dp = new DatagramPacket(udpMsg.getBytes(), udpMsg.length(), serverAddr, UDP_SERVER_PORT);
ds.send(dp);
Log.d("UDP", "Send "+udpMsg);
byte[] buf = new byte[1024];
DatagramPacket packet = new DatagramPacket(buf, buf.length);
while(listen) {
Log.d("UDP","Waiting..");
ds.receive(packet);
String senderIP = packet.getAddress().getHostAddress();
String message = new String(packet.getData()).trim();
Log.d("UDP", "Got UDB from " + senderIP + ", message: " + message);
String[] values=message.replace("[", "").replace("]", "").split(",");
if(values.length>=2) {
try{
Long fv=Long.parseLong(values[0]);
Vibrations v = new Vibrations(10, setVibration(fv), c);
v.vibrate();
Log.d("UDP", "Got UDB from " + senderIP + ", message: " + message);
Integer color=Integer.parseInt(values[1]);
publishProgress(color);
} catch (Exception ex) {
Log.d("UDP", "Cannot parse "+ex.getMessage());
}
} else {
Log.w("UDP", "Got UDB from " + senderIP + ", message: " + message);
}
}
} catch (SocketException e) {
e.printStackTrace();
}catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (ds != null) {
ds.close();
}
}
}
private int ZERO=0;
@Override
public void onProgressUpdate(Integer... progress) {
this.length=this.length+1;
if(progress[0]==0){
ZERO=ZERO+1;
}
this.progress=this.progress+progress[0];
double color= (double)this.progress/(double)this.length;
Log.d("COLOR", ""+color+","+progress[0]+","+this.progress+","+this.length);
view.setColor(color);
view.startMusic(color);
view.stopMusic();
// ;
}
public void setBacgoud(MainActivity color) {
view = color;
}
@Override
protected void onPostExecute(String res) {
Log.d("UDP", "Postexecute "+res);
}
}
|
package com.tencent.mm.plugin.appbrand.widget.picker;
import android.content.Context;
import android.support.annotation.Keep;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.view.View.MeasureSpec;
import android.widget.NumberPicker;
import com.tencent.mm.bp.a;
import com.tencent.mm.plugin.appbrand.s.f;
import com.tencent.mm.plugin.appbrand.s.k;
import com.tencent.mm.ui.widget.picker.e;
public class AppBrandOptionsPicker extends NumberPicker implements e<String> {
private int HB;
private String[] gNb;
private int gNc;
private int gg;
@Keep
public AppBrandOptionsPicker(Context context) {
super(new ContextThemeWrapper(context, k.Widget_AppBrand_Picker));
e.a(this, getResources().getDrawable(f.appbrand_picker_divider));
e.c(this);
e.e(this);
f.a(this);
this.HB = a.fromDPToPix(context, 100);
this.gNc = a.fromDPToPix(context, 20);
}
public void setOptionsArray(String[] strArr) {
if (strArr != null) {
this.gNb = strArr;
setDisplayedValues(null);
setMinValue(0);
setMaxValue(Math.max(strArr.length - 1, 0));
if (strArr.length <= 0) {
strArr = null;
}
super.setDisplayedValues(strArr);
}
}
public final void setExtraPadding(int i) {
this.gNc = Math.max(i, 0);
}
public final void setMinWidth(int i) {
this.HB = i;
}
public final void setMaxWidth(int i) {
this.gg = i;
}
@Deprecated
public void setDisplayedValues(String[] strArr) {
super.setDisplayedValues(strArr);
}
protected void onMeasure(int i, int i2) {
if (MeasureSpec.getMode(i) == Integer.MIN_VALUE || MeasureSpec.getMode(i) == 1073741824) {
this.gg = MeasureSpec.getSize(i);
}
super.onMeasure(MeasureSpec.makeMeasureSpec(0, 0), i2);
if (getMeasuredWidth() > this.HB || (this.gg > 0 && this.HB > this.gg)) {
int measuredWidth = getMeasuredWidth() + (this.gNc * 2);
if (this.gg > 0 && this.gg <= measuredWidth) {
measuredWidth = this.gg;
}
setMeasuredDimension(measuredWidth, getMeasuredHeight());
return;
}
setMeasuredDimension(this.HB, getMeasuredHeight());
}
protected void onAttachedToWindow() {
super.onAttachedToWindow();
e.d(this);
}
/* renamed from: aqr */
public final String aqq() {
return (this.gNb == null || this.gNb.length <= 0) ? "" : this.gNb[getValue()];
}
public View getView() {
return this;
}
public final void a(d dVar) {
}
public final void aqo() {
}
public final void b(d dVar) {
}
public final void aqp() {
}
}
|
package com.smxknife.dubbo.provider.xml.service.impl;
import com.smxknife.dubbo.provider.xml.service.SpiService;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.Adaptive;
/**
* @author smxknife
* 2019/12/12
*/
@Adaptive
public class OtherSpiService implements SpiService {
@Override
public void echo(URL url) {
System.out.println("other spi service");
}
}
|
package common;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import org.bson.types.ObjectId;
import org.glassfish.jersey.linking.InjectLink;
import org.glassfish.jersey.linking.InjectLinks;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.IndexOptions;
import org.mongodb.morphia.annotations.Indexed;
import resources.MarksResource;
import resources.StudentsResource;
import resources.SubjectsResource;
import javax.ws.rs.core.Link;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@AllArgsConstructor
@Entity
@XmlRootElement(name = "student")
@XmlAccessorType(XmlAccessType.FIELD)
public class Student
{
@InjectLinks({
@InjectLink(resource = StudentsResource.class, rel = "self", style = InjectLink.Style.ABSOLUTE),
@InjectLink(resource = SubjectsResource.class, rel = "subjects", style = InjectLink.Style.ABSOLUTE),
@InjectLink(resource = MarksResource.class, rel = "marks", style = InjectLink.Style.ABSOLUTE),
})
@XmlElement(name = "links")
@XmlElementWrapper(name = "links")
@XmlJavaTypeAdapter(Link.JaxbAdapter.class)
List<Link> links;
@Id
@XmlTransient
private ObjectId id;
public ObjectId getId()
{
return id;
}
public void setId(ObjectId id)
{
this.id = id;
}
public List<Link> getLinks()
{
return links;
}
public void setLinks(List<Link> links)
{
this.links = links;
}
@Indexed(options = @IndexOptions(unique = true))
private int index;
private String name;
private String surname;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "CEST")
private Date birthDate;
@JsonIgnore
@XmlTransient
private List<Mark> marks;
public Student()
{
this.marks = new ArrayList<>();
}
public Student(String name, String surname, Date birthDate)
{
this();
this.name = name;
this.surname = surname;
this.birthDate = birthDate;
}
public int getIndex()
{
return index;
}
public void setIndex(int index)
{
this.index = index;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getSurname()
{
return surname;
}
public void setSurname(String surname)
{
this.surname = surname;
}
public Date getBirthDate()
{
return birthDate;
}
public void setBirthDate(Date birthDate)
{
this.birthDate = birthDate;
}
public List<Mark> getMarks()
{
return marks;
}
public void setMarks(List<Mark> marks)
{
this.marks = marks;
}
public void addMark(Mark mark)
{
this.marks.add(mark);
}
public void remove(Mark mark)
{
this.marks.remove(mark);
}
}
|
package com.jadn.cc.test;
import dk.au.cs.thor.robotium2espresso.Solo;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.ListView;
import com.jadn.cc.ui.CarCast;
public class DeleteListenedToTest extends ActivityInstrumentationTestCase2<CarCast> {
private Solo solo;
public DeleteListenedToTest() {
super(CarCast.class);
}
@Override
public void setUp() throws Exception {
super.setUp(); // CQA
solo = new Solo(getInstrumentation(), getActivity());
UtilTest.closeSplash(solo); // CQA
}
@Override
public void tearDown() throws Exception {
solo.finishOpenedActivities();
super.tearDown(); // CQA
}
/**
* CQA: The statement solo.waitForText(" COMPLETED ", 1, 10 * 1000)
* fails if no WIFI is enabled, because a dialog is opened when clicking
* "Start Downloads", and no download is started until confirmation has
* been given.
*/
public void testDeleteListenedTo() throws Exception {
solo.sendKey(Solo.MENU);
solo.clickOnText("Settings");
solo.clickOnText("Max downloads");
solo.clickOnText("2");
solo.goBack();
solo.sendKey(Solo.MENU);
Thread.sleep(500);
solo.clickOnText("Subscriptions");
solo.sendKey(Solo.MENU);
solo.clickOnText("Delete All");
solo.waitForDialogToOpen(3000);
solo.clickOnButton("Delete");
solo.waitForDialogToClose(3000);
assertEquals(0, solo.getCurrentViews(ListView.class).get(0).getAdapter()
.getCount());
// add in fakefeed cast
solo.sendKey(Solo.MENU);
solo.clickOnText("Add");
solo.enterText(0, "cs.au.dk/~cqa/Android/Car-Cast/podcast.xml"); // CQA: jadn.com/cctest/testsub.xml didn't exist
solo.enterText(1, "testing feed");
solo.clickOnButton("Save");
solo.goBack();
solo.sendKey(Solo.MENU);
solo.clickOnText("Podcasts");
solo.sendKey(Solo.MENU);
solo.clickOnText("Erase");
solo.clickOnButton("Erase");
solo.sendKey(Solo.MENU);
solo.clickOnText("Delete All Podcasts");
solo.clickOnText("Confirm");
assertTrue(solo.searchText("No podcasts loaded."));
solo.sendKey(Solo.MENU);
solo.clickOnText("Download Podcasts");
solo.clickOnText("Start Downloads");
// CQA START: Close "WIFI is not connected" dialog
if (solo.waitForText("WIFI is not connected")) {
solo.clickOnText("Sure, go ahead");
}
// CQA END
solo.sleep(10 * 1000); // CQA: The 10 * 1000 cannot be ignored in the following waitForText statement
solo.waitForText(" COMPLETED ", 1, 10 * 1000);
solo.goBack();
assertTrue(solo.searchText("1/2"));
solo.clickOnImageButton(1);
// let both mp3 files play.
Thread.sleep(10*1000);
solo.sendKey(Solo.MENU);
solo.clickOnText("Podcasts");
solo.sendKey(Solo.MENU);
solo.clickOnText("Delete Listened To");
solo.goBack();
assertTrue(solo.searchText("1/1"));
}
}
|
package android.com.provider.activities;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.com.provider.apiResponses.getCityListApi.CityList;
import android.com.provider.apiResponses.getServiceList.GetServiceList;
import android.com.provider.apiResponses.getStateListApi.GetStateList;
import android.com.provider.apiResponses.getStateListApi.Payload;
import android.com.provider.apiResponses.getZipCodeListApi.ZipCodeList;
import android.com.provider.apiResponses.signupApi.SignUp;
import android.com.provider.httpRetrofit.HttpModule;
import android.com.provider.rxUtils.AppConstant;
import android.com.provider15_nov_2018.R;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.provider.Settings;
import android.support.design.widget.TextInputLayout;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.iid.FirebaseInstanceId;
import com.mobsandgeeks.saripaar.ValidationError;
import com.mobsandgeeks.saripaar.Validator;
import com.mobsandgeeks.saripaar.annotation.Email;
import com.mobsandgeeks.saripaar.annotation.NotEmpty;
import com.mobsandgeeks.saripaar.annotation.Password;
import com.orhanobut.hawk.Hawk;
import com.sdsmdg.tastytoast.TastyToast;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import am.appwise.components.ni.NoInternetDialog;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Consumer;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
public class ActivitySignUp extends AppCompatActivity implements View.OnClickListener, Validator.ValidationListener {
private ImageView backArrowImage;
@NotEmpty(message = "Please enter the name")
public EditText edName;
@NotEmpty(message = "Please enter the address")
public EditText edAddress;
@NotEmpty
public EditText edPhoneNumber;
@NotEmpty
@Email(message = "Please enter the valid email")
public EditText edEmail;
@NotEmpty
@Password(message = "Please enter the valid password")
// , min = 6, scheme = Password.Scheme.ALPHA_NUMERIC_MIXED_CASE_SYMBOLS
public EditText edPassword;
@NotEmpty(message = "Please enter the city")
public EditText edCity;
@NotEmpty(message = "Please enter the zip code")
public EditText edZipCode;
private Spinner spinnerState, spinnerCity, spinnerZipCode, spinnerServices;
private TextView tvAlreadyMember;
private TextView SignUpBtn;
private Context context;
private Validator validator;
private ProgressDialog mProgressDialog;
private String android_DeviceID;
private String selectedValueFromStateSpinnerIds, selectedValuesFromCitySpinner, getSelectedValuesFromZipCodeSpinner;
private String selectedServicesId;
private ArrayList<String> stateIdListPos = new ArrayList<>();
private ArrayList<String> cityIdListPos = new ArrayList<>();
private ArrayList<String> zipcodeIdListPos = new ArrayList<>();
private ArrayList<String> serviceIdList = new ArrayList<>();
private CompositeDisposable compositeDisposable = new CompositeDisposable();
private NoInternetDialog noInternetDialog;
private AlertDialog alertDialog;
private AlertDialog.Builder alertDialogBuilder;
private TextView tvToastError, tvClose, tvToast;
private TextView tvYes;
private String selectedStateId = "";
private String selectedCityId = "";
private String mCountryHolder, mStateHolder, mCityHolder;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup_new);
context = this;
noInternetDialog = new NoInternetDialog.Builder(this).build();
Hawk.init(this).build();
findingIdsHere();
initializingValidationHere();
eventListener();
changingStatusBarColorHere();
spinnerOperationForState();
spinnerOperationForService();
}
private void spinnerOperationForService(){
HttpModule.provideRepositoryService().getServiceListAPI().enqueue(new Callback<GetServiceList>() {
@Override
public void onResponse(Call<GetServiceList> call, Response<GetServiceList> response) {
if (response.body() != null && response.body().getIsSuccess()) {
spinnerSetupForServicesGoesHere(response.body().getPayload());
} else {
// TastyToast.makeText(ActivitySignUp.this, response.body().getMessage(), TastyToast.LENGTH_SHORT, TastyToast.SUCCESS).show();
}
}
@Override
public void onFailure(Call<GetServiceList> call, Throwable t) {
TastyToast.makeText(ActivitySignUp.this, t.toString(), TastyToast.LENGTH_SHORT, TastyToast.SUCCESS).show();
System.out.println("ActivitySignUp.onFailure" + t);
}
});
}
private void spinnerSetupForServicesGoesHere(List<android.com.provider.apiResponses.getServiceList.Payload> payload) {
ArrayList<String> servicesMainList = new ArrayList<>();
servicesMainList.add("Select Services");
serviceIdList.add("0");
for (int x = 0; x < payload.size(); x++) {
servicesMainList.add(payload.get(x).getName());
serviceIdList.add(String.valueOf(payload.get(x).getId()));
}
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, servicesMainList);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerServices.setDropDownWidth(1000);
spinnerServices.setAdapter(dataAdapter);
spinnerItemSelectionForServices();
}
private void spinnerItemSelectionForServices() {
spinnerServices.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
selectedServicesId = serviceIdList.get(position);
// TastyToast.makeText(getApplicationContext(), "You selected " + selectedServicesId, TastyToast.LENGTH_SHORT, TastyToast.SUCCESS).show();
Hawk.put(AppConstant.SAVED_SERVICE_ID, selectedServicesId);
Hawk.put("SELECTED_SERVICE", selectedServicesId);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
TastyToast.makeText(ActivitySignUp.this, parent + "", TastyToast.LENGTH_SHORT, TastyToast.SUCCESS).show();
}
});
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
private void initializingValidationHere() {
validator = new Validator(this);
validator.setValidationListener(this);
}
private void spinnerOperationForState() {
compositeDisposable.add(HttpModule.provideRepositoryService().getStateListAPI()
.subscribeOn(io.reactivex.schedulers.Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<GetStateList>() {
@Override
public void accept(GetStateList getStateList) throws Exception {
if (getStateList.getIsSuccess()) {
spinnerSetupGoesHere(getStateList.getPayload());
} else {
TastyToast.makeText(ActivitySignUp.this, getStateList.getMessage(), TastyToast.LENGTH_SHORT, TastyToast.ERROR).show();
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
System.out.println("ActivitySignUp.accept " + throwable);
TastyToast.makeText(ActivitySignUp.this, String.valueOf(throwable), TastyToast.LENGTH_SHORT, TastyToast.ERROR).show();
compositeDisposable.dispose();
}
}
));
}
@Override
protected void onDestroy() {
super.onDestroy();
compositeDisposable.dispose();
noInternetDialog.onDestroy();
compositeDisposable.dispose();
}
private void spinnerSetupGoesHere(List<Payload> payload) {
// stateArraylist.add("Select State");
//// stateIdListPos.add("0");
Payload[] array = new Payload[payload.size()];
payload.toArray(array);
// String compareValue = spinnerState.getSelectedItem().toString();
SpinAdapter spinAdapter = new SpinAdapter(ActivitySignUp.this, android.R.layout.simple_spinner_item, array);
spinAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerState.setDropDownWidth(1000);
spinnerState.setAdapter(spinAdapter);
spinnerItemSelectionForState(spinAdapter);
}
private void spinnerItemSelectionForState(final SpinAdapter spinAdapter) {
spinnerState.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Payload payload = spinAdapter.getItem(position);
selectedValueFromStateSpinnerIds = String.valueOf(payload.getId());
Hawk.put("SELECTED_SATATE", payload.getId());
spinnerOperationForCities(payload.getId());
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
TastyToast.makeText(ActivitySignUp.this, parent + "", TastyToast.LENGTH_SHORT, TastyToast.SUCCESS).show();
}
});
}
private void spinnerOperationForCities(int selectedValueFromSpinnerIds) {
compositeDisposable.add(HttpModule.provideRepositoryService().getCitiesAPI(String.valueOf(selectedValueFromSpinnerIds)).
subscribeOn(io.reactivex.schedulers.Schedulers.computation()).
observeOn(AndroidSchedulers.mainThread()).
subscribe(new Consumer<CityList>() {
@Override
public void accept(CityList cityList) throws Exception {
if (cityList != null && cityList.getIsSuccess()) {
spinnerSetupForCities(cityList.getPayload());
} else {
// TastyToast.makeText(ActivitySignUp.this, cityList.getMessage(), TastyToast.LENGTH_SHORT, TastyToast.ERROR).show();
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
System.out.println("ActivitySignUp.accept " + throwable.toString());
}
}));
}
// todo for spinner setup of cities
private void spinnerSetupForCities(List<Payload> payload) {
Payload[] array = new Payload[payload.size()];
payload.toArray(array);
// String compareValue = spinnerState.getSelectedItem().toString();
SpinAdapter spinAdapter = new SpinAdapter(ActivitySignUp.this, android.R.layout.simple_spinner_item, array);
spinAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerCity.setDropDownWidth(1000);
spinnerCity.setAdapter(spinAdapter);
spinnerItemSelectionForState(spinAdapter);
spinnerItemSelectionForCity(spinAdapter);
}
private void spinnerItemSelectionForCity(final SpinAdapter spinAdapter) {
spinnerCity.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
Payload payload = spinAdapter.getItem(i);
selectedValuesFromCitySpinner = String.valueOf(payload.getId());
Hawk.put("SELECTED_CITY", payload.getId());
spinnerOperationForZipcode(payload.getId());
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
}
private void spinnerOperationForZipcode(int selectedValuesFromCitySpinner) {
compositeDisposable.add(HttpModule.provideRepositoryService().getZipCodeListAPI(String.valueOf(selectedValuesFromCitySpinner)).
subscribeOn(io.reactivex.schedulers.Schedulers.computation()).
observeOn(AndroidSchedulers.mainThread()).
subscribe(new Consumer<ZipCodeList>() {
@Override
public void accept(ZipCodeList zipCodeList) throws Exception {
if (zipCodeList != null && zipCodeList.getIsSuccess()) {
spinnerSetupForZipcode(zipCodeList);
} else {
// TastyToast.makeText(ActivitySignUp.this, zipCodeList.getMessage(), TastyToast.LENGTH_SHORT, TastyToast.ERROR).show();
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception{
System.out.println("ActivitySignUp.accept" + throwable.toString());
TastyToast.makeText(ActivitySignUp.this, throwable.toString(), TastyToast.LENGTH_SHORT, TastyToast.ERROR).show();
}
}));
}
//todo for spinner set up of zip code
private void spinnerSetupForZipcode(ZipCodeList zipCodeList) {
ArrayList<String> zipArrList = new ArrayList<>();
// zipArrList.add("Select zipcode");
// zipcodeIdListPos.add("0");
for (int y = 0; y < zipCodeList.getPayload().size(); y++) {
zipArrList.add(zipCodeList.getPayload().get(y).getZipcode());
zipcodeIdListPos.add(String.valueOf(zipCodeList.getPayload().get(y).getCityId()));
}
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, zipArrList);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerZipCode.setDropDownWidth(1000);
spinnerZipCode.setAdapter(dataAdapter);
spinnerItemSelectionForZipCode();
}
//todo for zip code
private void spinnerItemSelectionForZipCode() {
spinnerZipCode.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
getSelectedValuesFromZipCodeSpinner = zipcodeIdListPos.get(i);
Hawk.put("SELECTED_ZIPCODE", getSelectedValuesFromZipCodeSpinner);
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
}
private void changingStatusBarColorHere() {
getWindow().setStatusBarColor(ContextCompat.getColor(ActivitySignUp.this, R.color.statusBarColor));
}
private void eventListener() {
backArrowImage.setOnClickListener(this);
SignUpBtn.setOnClickListener(this);
tvAlreadyMember.setOnClickListener(this);
}
private void findingIdsHere() {
mProgressDialog = new ProgressDialog(this, R.style.AppTheme_Dark_Dialog);
backArrowImage = findViewById(R.id.backArrowImage);
edName = findViewById(R.id.edName);
edAddress = findViewById(R.id.edAddress);
edPhoneNumber = findViewById(R.id.edPhoneNumber);
edEmail = findViewById(R.id.edEmail);
edPassword = findViewById(R.id.edPassword);
edCity = findViewById(R.id.edCity);
edZipCode = findViewById(R.id.edZipCode);
SignUpBtn = findViewById(R.id.SignUpBtn);
tvAlreadyMember = findViewById(R.id.tvAlreadyMember);
spinnerState = findViewById(R.id.spinnerState);
spinnerCity = findViewById(R.id.spinnerCity);
spinnerZipCode = findViewById(R.id.spinnerZipCode);
spinnerServices = findViewById(R.id.spinnerServices);
TextInputLayout usernameTextObj = (TextInputLayout) findViewById(R.id.tilPass);
usernameTextObj.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/headingbrew.otf"));
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.backArrowImage:
finish();
break;
case R.id.tvAlreadyMember:
Intent intent = new Intent(ActivitySignUp.this, ActivitySignIn.class);
startActivity(intent);
finish();
break;
case R.id.SignUpBtn:
validator.validate();
break;
}
}
private void loginProgressing() {
mProgressDialog.setMessage("Signing up..");
mProgressDialog.setCancelable(false);
mProgressDialog.setIndeterminate(true);
mProgressDialog.show();
}
private void callingActivity() {
Intent intent1 = new Intent(ActivitySignUp.this, ActivitySignIn.class);
intent1.putExtra("Uniqid", "ActivitySignUp");
startActivity(intent1);
finish();
}
@Override
public void onValidationSucceeded() {
if (TextUtils.isEmpty(selectedValueFromStateSpinnerIds)) {
Toast.makeText(ActivitySignUp.this, "State field is required", Toast.LENGTH_SHORT).show();
} else if (TextUtils.isEmpty(selectedValuesFromCitySpinner)) {
Toast.makeText(ActivitySignUp.this, "City field is required", Toast.LENGTH_SHORT).show();
} else if (TextUtils.isEmpty(getSelectedValuesFromZipCodeSpinner)) {
Toast.makeText(ActivitySignUp.this, "Zip code field is required", Toast.LENGTH_SHORT).show();
} else if (spinnerServices.getSelectedItem() == null) {
Toast.makeText(ActivitySignUp.this, " Service field is required", Toast.LENGTH_SHORT).show();
} else if (spinnerServices.getSelectedItemPosition() == 0 || spinnerServices.getSelectedItem().toString().isEmpty()) {
Toast.makeText(ActivitySignUp.this, " Service field is required", Toast.LENGTH_SHORT).show();
} else {
loginProgressing();
callingSignUpApiHere();
}
}
private void callingSignUpApiHere() {
try {
android_DeviceID = Settings.Secure.getString(ActivitySignUp.this.getContentResolver(), Settings.Secure.ANDROID_ID);
String tokenFromFirebase = FirebaseInstanceId.getInstance().getToken();
HttpModule.provideRepositoryService().signUpAPI(edName.getText().toString(), "Provider", edEmail.getText().toString(),
edPassword.getText().toString(), edPhoneNumber.getText().toString(), "United State",
selectedValueFromStateSpinnerIds, selectedValuesFromCitySpinner, getSelectedValuesFromZipCodeSpinner,
edAddress.getText().toString(), tokenFromFirebase, "A", "pr", selectedServicesId.equalsIgnoreCase("0") ? "" : selectedServicesId).enqueue(new Callback<SignUp>() {
@Override
public void onResponse(Call<SignUp> call, Response<SignUp> response) {
mProgressDialog.dismiss();
if (response.body() != null) {
if (response.body().getIsSuccess()) {
clearingTheEdittextHere();
String savedUserId = String.valueOf(response.body().getPayload().getUserId());
Hawk.put("savedUserId", savedUserId);
Hawk.put("emailId", edEmail.getText().toString());
savingEnteredValues();
showTheDialogMessageForOk(response.body().getMessage());
} else {
showTheDialogMessageForError(response.body().getMessage());
}
} else {
TastyToast.makeText(ActivitySignUp.this, "Something went wrong", TastyToast.LENGTH_SHORT, TastyToast.ERROR).show();
}
}
@Override
public void onFailure(Call<SignUp> call, Throwable t) {
System.out.println("ActivitySignUp.onFailure " + t.getMessage());
Toast.makeText(ActivitySignUp.this, t.toString(), Toast.LENGTH_SHORT).show();
mProgressDialog.dismiss();
}
});
} catch (Exception e) {
e.printStackTrace();
mProgressDialog.dismiss();
}
}
// MARK: DIALOG MESSAGE FOR ERROR
private void showTheDialogMessageForError(String message) {
LayoutInflater li = LayoutInflater.from(this);
View dialogView = li.inflate(R.layout.dialog_show_for_message_error, null);
findingIdsForError(dialogView, message);
alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setView(dialogView);
alertDialogBuilder
.setCancelable(false);
alertDialog = alertDialogBuilder.create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
alertDialog.show();
}
private void findingIdsForError(View dialogView, String message) {
tvToastError = dialogView.findViewById(R.id.tvToastError);
tvClose = dialogView.findViewById(R.id.tvClose);
tvToastError.setText(message);
tvClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alertDialog.dismiss();
}
});
}
// MARK: OK MESSAGE DIALOG
private void showTheDialogMessageForOk(String message) {
LayoutInflater li = LayoutInflater.from(this);
View dialogView = li.inflate(R.layout.dialog_show_for_message_ok, null);
findingDialogOkIds(dialogView, message);
alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setView(dialogView);
alertDialogBuilder
.setCancelable(false);
alertDialog = alertDialogBuilder.create();
Objects.requireNonNull(alertDialog.getWindow()).setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
alertDialog.show();
}
private void findingDialogOkIds(View dialogView, String message) {
tvToast = dialogView.findViewById(R.id.tvToast);
tvYes = dialogView.findViewById(R.id.tvYes);
tvYes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
callTheDashboardActivity();
alertDialog.dismiss();
}
});
tvToast.setText(message);
}
private void callTheDashboardActivity() {
Intent intent1 = new Intent(ActivitySignUp.this, ActivitySignIn.class);
// intent1.putExtra("Uniqid", "ActivitySignUp");
startActivity(intent1);
finish();
}
private void clearingTheEdittextHere() {
edName.setError(null);
edAddress.setError(null);
edPhoneNumber.setError(null);
edEmail.setError(null);
edPassword.setError(null);
edCity.setError(null);
edZipCode.setError(null);
}
private void savingEnteredValues() {
Hawk.put("NAME", edName.getText().toString());
Hawk.put("EMAIL", edEmail.getText().toString());
Hawk.put("PASSWORD", edPassword.getText().toString());
Hawk.put("PHONE_NUMBER", edPhoneNumber.getText().toString());
Hawk.put("ADDRESS", edAddress.getText().toString());
Hawk.put("STATE", spinnerState.getSelectedItem().toString());
Hawk.put("CITY", spinnerCity.getSelectedItem().toString());
Hawk.put("ZIPCODE", spinnerZipCode.getSelectedItem().toString());
Hawk.put("SERVICES", spinnerServices.getSelectedItem().toString());
}
@Override
public void onValidationFailed(List<ValidationError> errors) {
mProgressDialog.dismiss();
// Toast.makeText(this, errors + "", Toast.LENGTH_LONG).show();
for (ValidationError error : errors) {
View view = error.getView();
String message = error.getCollatedErrorMessage(this);
if (view instanceof EditText) { // Display error messages
((EditText) view).setError(message);
} else {
// Toast.makeText(ActivitySignUp.this, message, Toast.LENGTH_LONG).show();
}
}
}
// todo spinner adapter
public class SpinAdapter extends ArrayAdapter<Payload> {
// Your sent context
private Context context;
// Your custom values for the spinner (User)
private Payload[] values;
public SpinAdapter(Context context, int textViewResourceId,
Payload[] values) {
super(context, textViewResourceId, values);
this.context = context;
this.values = values;
}
@Override
public int getCount() {
return values.length;
}
@Override
public Payload getItem(int position) {
return values[position];
}
@Override
public long getItemId(int position) {
return position;
}
// And the "magic" goes here
// This is for the "passive" state of the spinner
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// I created a dynamic TextView here, but you can reference your own custom layout for each spinner item
TextView label = (TextView) super.getView(position, convertView, parent);
label.setTextColor(Color.BLACK);
// Then you can get the current item using the values array (Users array) and the current position
// You can NOW reference each method you has created in your bean object (User class)
label.setText(values[position].getName());
// And finally return your dynamic (or custom) view for each spinner item
return label;
}
// And here is when the "chooser" is popped up
// Normally is the same view, but you can customize it if you want
@Override
public View getDropDownView(int position, View convertView,
ViewGroup parent) {
TextView label = (TextView) super.getDropDownView(position, convertView, parent);
label.setTextColor(Color.BLACK);
label.setText(values[position].getName());
return label;
}
}
}
|
package napi.commands.node;
import napi.commands.exception.ArgumentParseException;
import napi.commands.ErrorMessages;
import napi.commands.parsed.CommandArguments;
import napi.commands.parsed.CommandSender;
public class NodeInteger extends CommandNode {
public NodeInteger(String key) {
super(key);
}
@Override
public Object parseValue(CommandSender sender, CommandArguments args) throws ArgumentParseException {
try {
return Integer.parseInt(args.next());
} catch (NumberFormatException e){
throw new ArgumentParseException("Cannot parse double from string")
.withMessage(sender.getManager().getMessages().getTypeErrInt());
}
}
}
|
package com.sdk4.boot.apiengine;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.google.common.collect.Maps;
import com.sdk4.boot.bo.LoginUser;
import com.sdk4.boot.exception.BaseError;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Map;
/**
* API 接口响应数据
*
* @author sh
*/
@NoArgsConstructor
@Data
public class ApiResponse {
/**
* 响应代码
*/
protected Integer code;
/**
* 响应消息
*/
protected String msg;
/**
* 请求ID
*/
protected String request_id;
/**
* 业务响应数据的集合,JSON格式字符串或者Map对象格式
*/
protected Object rsp_content;
/**
* rsp_content 返回数据临时存放
*/
@JSONField(serialize=false)
protected Map<String, Object> tempRspContentMap = Maps.newTreeMap();
/**
* 调用异常发生信息
*/
@JSONField(serialize=false)
protected Exception exception;
/**
* 当前用户
*/
@JSONField(serialize=false)
protected LoginUser loginUser;
public ApiResponse(int code, String msg) {
this.code = code;
this.msg = msg;
}
public ApiResponse(int code, String msg, Exception e) {
this.code = code;
this.msg = msg;
this.exception = e;
}
public ApiResponse(BaseError error) {
this.code = error.getCode();
this.msg = error.getMessage();
}
public ApiResponse(BaseError error, Exception e) {
this.code = error.getCode();
this.msg = error.getMessage();
this.exception = e;
}
public void put(String key, Object value) {
this.tempRspContentMap.put(key, value);
}
public String toJSONString() {
if (this.code == null) {
this.code = 0;
this.msg = ApiConstants.SUCCESS;
}
if (this.rsp_content == null && this.tempRspContentMap.size() > 0) {
this.rsp_content = this.tempRspContentMap;
}
return JSON.toJSONStringWithDateFormat(this, "yyyy-MM-dd HH:mm:ss");
}
}
|
package com.fabianlopez.mainscopetest.entities;
public class Client {
private Integer idClient;
private String comercial;
private String fiscal;
private String rfc;
private String address;
private String neighborhood;
private String postalCode;
private String city;
private String state;
private Integer status;
public Client() {
}
public Client(String comercial, String fiscal, String rfc, String address, String neighborhood,
String postalCode, String city, String state) {
super();
this.comercial = comercial;
this.fiscal = fiscal;
this.rfc = rfc;
this.address = address;
this.neighborhood = neighborhood;
this.postalCode = postalCode;
this.city = city;
this.state = state;
this.status = 1;
}
public Client(Integer idClient, String comercial, String fiscal, String rfc, String address, String neighborhood,
String postalCode, String city, String state) {
super();
this.idClient = idClient;
this.comercial = comercial;
this.fiscal = fiscal;
this.rfc = rfc;
this.address = address;
this.neighborhood = neighborhood;
this.postalCode = postalCode;
this.city = city;
this.state = state;
this.status = 1;
}
public Integer getId_client() {
return idClient;
}
public void setId_client(Integer id_client) {
this.idClient = id_client;
}
public String getComercial() {
return comercial;
}
public void setComercial(String comercial) {
this.comercial = comercial;
}
public String getFiscal() {
return fiscal;
}
public void setFiscal(String fiscal) {
this.fiscal = fiscal;
}
public String getRfc() {
return rfc;
}
public void setRfc(String rfc) {
this.rfc = rfc;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getNeighborhood() {
return neighborhood;
}
public void setNeighborhood(String neighborhood) {
this.neighborhood = neighborhood;
}
public String getPostalCode() {
return postalCode;
}
public void setPostalCode(String postalCode) {
this.postalCode = postalCode;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String toSqlString() {
return "null,"+"'"+this.comercial+"',"+"'"+this.fiscal+"',"+
"'"+this.rfc+"',"+"'"+this.address+"',"+"'"+this.neighborhood+"',"+
"'"+this.postalCode+"',"+"'"+this.city+"',"+"'"+this.state+"',"+
"'"+this.status+"'";
}
public String toUpdateSqlString() {
return "comercial='"+this.comercial+"',"+"fiscal='"+this.fiscal+"',"+
"rfc='"+this.rfc+"',"+"address='"+this.address+"',"+"neighborhood='"+this.neighborhood+"',"+
"postal_code='"+this.postalCode+"',"+"city='"+this.city+"',"+"state='"+this.state+"' WHERE id_client="+idClient;
}
}
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pasosServer.model;
import java.awt.Image;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import javax.imageio.ImageIO;
import javax.imageio.ImageReadParam;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author Juan Antonio
*/
@Entity
@Table(name = "PROTEGIDO")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Protegido.findAll", query = "SELECT p FROM Protegido p"),
@NamedQuery(name = "Protegido.findByIdProtegido", query = "SELECT p FROM Protegido p WHERE p.idProtegido = :idProtegido"),
@NamedQuery(name = "Protegido.findByNombre", query = "SELECT p FROM Protegido p WHERE p.nombre = :nombre"),
@NamedQuery(name = "Protegido.findByTelefonoMovil", query = "SELECT p FROM Protegido p WHERE p.telefonoMovil = :telefonoMovil"),
@NamedQuery(name = "Protegido.findByApellidos", query = "SELECT p FROM Protegido p WHERE p.apellidos = :apellidos"),
@NamedQuery(name = "Protegido.findByFechaNacimiento", query = "SELECT p FROM Protegido p WHERE p.fechaNacimiento = :fechaNacimiento"),
@NamedQuery(name = "Protegido.findByLongitud", query = "SELECT p FROM Protegido p WHERE p.longitud = :longitud"),
@NamedQuery(name = "Protegido.findByLatitud", query = "SELECT p FROM Protegido p WHERE p.latitud = :latitud"),
@NamedQuery(name = "Protegido.findByImei", query = "SELECT p FROM Protegido p WHERE p.imei = :imei")})
public class Protegido implements Serializable {
@Column(name = "FECHA_NACIMIENTO")
@Temporal(TemporalType.TIMESTAMP)
private Date fechaNacimiento;
@Lob
@Column(name = "FOTO")
private byte[] foto;
private static final long serialVersionUID = 1L;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Id
@Basic(optional = false)
@NotNull
@Column(name = "ID_PROTEGIDO")
private BigDecimal idProtegido;
@Size(max = 20)
@Column(name = "NOMBRE")
private String nombre;
@Column(name = "TELEFONO_MOVIL")
private BigInteger telefonoMovil;
@Size(max = 30)
@Column(name = "APELLIDOS")
private String apellidos;
@Column(name = "LONGITUD")
private BigInteger longitud;
@Column(name = "LATITUD")
private BigInteger latitud;
@Size(max = 18)
@Column(name = "IMEI")
private String imei;
@OneToMany(fetch= FetchType.EAGER ,cascade = CascadeType.ALL, mappedBy = "idProtegido")
private Collection<Maltratador> maltratadorCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idProtegido")
private Collection<Alarma> alarmaCollection;
@OneToMany(fetch= FetchType.EAGER,mappedBy = "idProtegido")
private Collection<Contacto> contactoCollection;
public Protegido() {
}
public void addMaltratador(Maltratador maltratador) {
if (maltratadorCollection == null) {
maltratadorCollection = new ArrayList<Maltratador>();
}
maltratador.setIdProtegido(this);
maltratadorCollection.add(maltratador);
}
public Protegido(BigDecimal idProtegido) {
this.idProtegido = idProtegido;
}
public BigDecimal getIdProtegido() {
return idProtegido;
}
public void setIdProtegido(BigDecimal idProtegido) {
this.idProtegido = idProtegido;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public BigInteger getTelefonoMovil() {
return telefonoMovil;
}
public void setTelefonoMovil(BigInteger telefonoMovil) {
this.telefonoMovil = telefonoMovil;
}
public String getApellidos() {
return apellidos;
}
public void setApellidos(String apellidos) {
this.apellidos = apellidos;
}
public Date getFechaNacimiento() {
return fechaNacimiento;
}
public void setFechaNacimiento(Date fechaNacimiento) {
this.fechaNacimiento = fechaNacimiento;
}
public BigInteger getLongitud() {
return longitud;
}
public void setLongitud(BigInteger longitud) {
this.longitud = longitud;
}
public BigInteger getLatitud() {
return latitud;
}
public void setLatitud(BigInteger latitud) {
this.latitud = latitud;
}
public String getImei() {
return imei;
}
public void setImei(String imei) {
this.imei = imei;
}
@XmlTransient
public Collection<Maltratador> getMaltratadorCollection() {
return maltratadorCollection;
}
public void setMaltratadorCollection(Collection<Maltratador> maltratadorCollection) {
this.maltratadorCollection = maltratadorCollection;
}
@XmlTransient
public Collection<Alarma> getAlarmaCollection() {
return alarmaCollection;
}
public void setAlarmaCollection(Collection<Alarma> alarmaCollection) {
this.alarmaCollection = alarmaCollection;
}
@XmlTransient
public Collection<Contacto> getContactoCollection() {
return contactoCollection;
}
public void setContactoCollection(Collection<Contacto> contactoCollection) {
this.contactoCollection = contactoCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (idProtegido != null ? idProtegido.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 Protegido)) {
return false;
}
Protegido other = (Protegido) object;
if ((this.idProtegido == null && other.idProtegido != null) || (this.idProtegido != null && !this.idProtegido.equals(other.idProtegido))) {
return false;
}
return true;
}
@Override
public String toString() {
return "pasosServer.model.Protegido[ idProtegido=" + idProtegido + " ]";
}
public Image getImage() throws IOException{
ByteArrayInputStream bis = new ByteArrayInputStream(this.foto);
Iterator readers = ImageIO.getImageReadersByFormatName("jpeg");
ImageReader reader = (ImageReader) readers.next();
Object source = bis; // File or InputStream
ImageInputStream iis = ImageIO.createImageInputStream(source);
reader.setInput(iis, true);
ImageReadParam param = reader.getDefaultReadParam();
/*if (isThumbnail) {
param.setSourceSubsampling(4, 4, 0, 0);
}*/
return reader.read(0, param);
}
public Serializable getFoto() {
return foto;
}
public void setFoto(byte[] foto) {
this.foto = foto;
}
}
|
/*
* Copyright 2010 sdp.com, Inc. All rights reserved.
* sdp.com PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
* creator : jiangyixin.stephen
* create time : 2013-2-25 下午5:21:13
*/
package tools.invoker.execution;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import tools.invoker.command.Command;
import tools.invoker.command.CommandDescriptor;
/**
* 功能描述:
*
* @author jiangyixin.stephen
* time : 2013-2-25 下午5:21:13
*/
public abstract class AbstExecutionStrategy implements ExecutionStrategy {
private Logger logger = LoggerFactory.getLogger(this.getClass());
protected boolean execCmd(CommandDescriptor desc) {
Command cmd = desc.getCmd();
try {
Object rt = cmd.execute();
desc.setResult(rt);
cmd.onReturn(rt);
return true;
} catch (Exception e) {
desc.setEx(e);
try {
return cmd.onError(e);
} catch (Exception ex) {
logger.warn("execute command[" + desc.getName() + "].onError() failed. ", ex);
return false;
}
}
}
}
|
package com.liun.example;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* @Description
* @Author Liun
* @Date 2019-08-09 11:00:02
*/
public class DownLoadServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setCharacterEncoding("utf-8");
// 获取要下载的文件名称
String filename = req.getParameter("filename");
// 下载文件的绝对路径
String path = getServletContext().getRealPath("file/"+filename);
System.out.println("path="+path);
InputStream inputStream = new FileInputStream(path);
resp.setHeader("Content-Disposition", "attachment;fileName="+filename);
// 流转换
OutputStream outputStream = resp.getOutputStream();
int len = 0;
byte[] b = new byte[1024];
while ((len = inputStream.read(b)) != 1) {
outputStream.write(b, 0, len);
}
outputStream.close();
inputStream.close();
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req,resp);
}
}
|
package leetcode.jan21.challenge;
import java.io.*;
import java.util.*;
class ListNode {
int val;
ListNode next;
ListNode() {
}
ListNode(int val) {
this.val = val;
}
ListNode(int val, ListNode next) {
this.val = val;
this.next = next;
}
}
public class D12AddTwoNumbers {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
int testCaseCount = Integer.parseInt(reader.readLine());
while (testCaseCount-- > 0) {
int[] arrL1 = Arrays.stream(reader.readLine().split("\\s")).mapToInt(Integer::parseInt).toArray();
int[] arrL2 = Arrays.stream(reader.readLine().split("\\s")).mapToInt(Integer::parseInt).toArray();
ListNode headL1 = prepareNodeList(arrL1);
ListNode headL2 = prepareNodeList(arrL2);
System.out.println("Completed");
ListNode headNode = addTwoNumbers(headL1, headL2);
while (headNode != null) {
System.out.print(headNode.val + " ");
headNode = headNode.next;
}
System.out.println();
}
}
private static ListNode prepareNodeList(int[] arrL) {
ListNode node = new ListNode(arrL[0]);
ListNode headTempNode = node;
for (int i = 1; i < arrL.length; i++) {
node.next = new ListNode(arrL[i]);
node = node.next;
}
return headTempNode;
}
private static ListNode addTwoNumbers(ListNode l1, ListNode l2) {
/*ListNode revL1 = reverseLinkedList(l1);
ListNode revL2 = reverseLinkedList(l2);*/
ListNode revL1 = l1;
ListNode revL2 = l2;
ListNode sumL = new ListNode();
ListNode headOfSum = sumL;
int carry = 0;
while (revL1 != null && revL2 != null) {
int i = revL1.val;
int j = revL2.val;
int t = i + j + carry;
carry = t / 10;
int s = t % 10;
sumL.next = new ListNode(s);
sumL = sumL.next;
revL1 = revL1.next;
revL2 = revL2.next;
}
while (revL1 != null) {
int i = revL1.val;
int t = i + carry;
carry = t / 10;
int s = t % 10;
sumL.next = new ListNode(s);
sumL = sumL.next;
revL1 = revL1.next;
}
while (revL2 != null) {
int j = revL2.val;
int t = j + carry;
carry = t / 10;
int s = t % 10;
sumL.next = new ListNode(s);
sumL = sumL.next;
revL2 = revL2.next;
}
if (carry != 0) {
sumL.next = new ListNode(carry);
}
//ListNode headOfSum = reverseLinkedList(tempHeadOfSum.next);
return headOfSum.next;
}
private static ListNode reverseLinkedList(ListNode node) {
Stack<Integer> nodeStack = new Stack<>();
ListNode revListNode;
ListNode headNode;
while (node != null) {
nodeStack.push(node.val);
node = node.next;
}
revListNode = new ListNode(nodeStack.pop());
headNode = revListNode;
while (!nodeStack.isEmpty()) {
revListNode.next = new ListNode(nodeStack.pop());
revListNode = revListNode.next;
}
return headNode;
}
}
|
package week8.day1;
public class JavaCoding {
public static void main(String[] args) {
String c = "";
String Companyname = "TestLeaf";
int a = Companyname.length();
for (int i = a - 1; i >= 0; i--) {
char b = Companyname.charAt(i);
c = c + b;
}
System.out.println(c);
if (Companyname.equalsIgnoreCase(c)) {
System.out.println("String is Palindrome");
} else {
System.out.println("String is not palindrome");
}
}
}
|
package com.huawei.cloudstorage.web.model;
import com.huawei.cloudstorage.constants.GlobalConstant;
public class UserInfoVO {
private Integer id;
/**
* uid全局使用
*/
private String userId;
/**
* 登录邮箱
*/
private String loginNameEmail;
/**
* 登录手机号
*/
private String loginNameMobile;
/**
* 登录邮箱
*/
private String isLoginNameEmail = GlobalConstant.F;
/**
* 登录手机号
*/
private String isLoginNameMobile = GlobalConstant.F;
/**
* 登录密码
*/
private String loginPassword;
/**
* 支付密码
*/
private String paymentPassword;
/**
* 花名
*/
private String nickName;
/**
* 真是姓名
*/
private String realName;
/**
* 证件类型
*/
private String certType;
/**
* 证件号码
*/
private String certNo;
/**
* 账户状态
*/
private String state;
/**
* 联系地址
*/
private String address;
/**
* 电话号码
*/
private String phone;
/**
* 手机号码
*/
private String mobileNo;
/**
* 邮箱
*/
private String email;
/**
* 出生日期
*/
private String birthdateStr;
/**
* 星座
*/
private String constellation;
/**
* 年龄
*/
private Short age;
/**
* 月收入
*/
private Integer income;
/**
* 身高体重CM
*/
private Short height;
/**
* 体重KG
*/
private Short weight;
/**
* 职业
*/
private String job;
/**
* 兴趣爱好
*/
private String interest;
/**
* 个人简介
*/
private String introduce;
/**
* 备注
*/
private String note;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
/**
* @return the state
*/
public String getState() {
return state;
}
/**
* @param state the state to set
*/
public void setState(String state) {
this.state = state;
}
public String getLoginNameEmail() {
return loginNameEmail;
}
public void setLoginNameEmail(String loginNameEmail) {
this.loginNameEmail = loginNameEmail == null ? null : loginNameEmail.trim();
}
public String getLoginNameMobile() {
return loginNameMobile;
}
public void setLoginNameMobile(String loginNameMobile) {
this.loginNameMobile = loginNameMobile == null ? null : loginNameMobile.trim();
}
public String getLoginPassword() {
return loginPassword;
}
public void setLoginPassword(String loginPassword) {
this.loginPassword = loginPassword == null ? null : loginPassword.trim();
}
public String getPaymentPassword() {
return paymentPassword;
}
public void setPaymentPassword(String paymentPassword) {
this.paymentPassword = paymentPassword == null ? null : paymentPassword.trim();
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName == null ? null : nickName.trim();
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName == null ? null : realName.trim();
}
public String getCertType() {
return certType;
}
public void setCertType(String certType) {
this.certType = certType == null ? null : certType.trim();
}
public String getCertNo() {
return certNo;
}
public void setCertNo(String certNo) {
this.certNo = certNo == null ? null : certNo.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getMobileNo() {
return mobileNo;
}
public void setMobileNo(String mobileNo) {
this.mobileNo = mobileNo == null ? null : mobileNo.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
/**
* @return the birthdateStr
*/
public String getBirthdateStr() {
return birthdateStr;
}
/**
* @param birthdateStr the birthdateStr to set
*/
public void setBirthdateStr(String birthdateStr) {
this.birthdateStr = birthdateStr;
}
public String getConstellation() {
return constellation;
}
public void setConstellation(String constellation) {
this.constellation = constellation == null ? null : constellation.trim();
}
public Short getAge() {
return age;
}
public void setAge(Short age) {
this.age = age;
}
public Integer getIncome() {
return income;
}
public void setIncome(Integer income) {
this.income = income;
}
public Short getHeight() {
return height;
}
public void setHeight(Short height) {
this.height = height;
}
public Short getWeight() {
return weight;
}
public void setWeight(Short weight) {
this.weight = weight;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job == null ? null : job.trim();
}
public String getInterest() {
return interest;
}
public void setInterest(String interest) {
this.interest = interest == null ? null : interest.trim();
}
public String getIntroduce() {
return introduce;
}
public void setIntroduce(String introduce) {
this.introduce = introduce == null ? null : introduce.trim();
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note == null ? null : note.trim();
}
/**
* @return the isLoginNameEmail
*/
public String getIsLoginNameEmail() {
return isLoginNameEmail;
}
/**
* @param isLoginNameEmail the isLoginNameEmail to set
*/
public void setIsLoginNameEmail(String isLoginNameEmail) {
this.isLoginNameEmail = isLoginNameEmail;
}
/**
* @return the isLoginNameMobile
*/
public String getIsLoginNameMobile() {
return isLoginNameMobile;
}
/**
* @param isLoginNameMobile the isLoginNameMobile to set
*/
public void setIsLoginNameMobile(String isLoginNameMobile) {
this.isLoginNameMobile = isLoginNameMobile;
}
}
|
package com.hallauniv.halla;
/************
* 커스텀 클래스 import
************/
import java.util.ArrayList;
import java.util.Calendar;
import com.hallauniv.dialog.ChatDialog;
import com.hallauniv.helper.MessageHelper;
import com.hallauniv.helper.Share;
import com.hallauniv.helper.TypeHelper;
import com.hallauniv.indicator.IconPagerAdapter;
import com.hallauniv.indicator.TabPageIndicator;
/***************
* 안드로이드 클래스 import
***************/
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Parcelable;
//import android.os.StrictMode;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageButton;
import android.widget.TextView;
public class MainActivity extends Activity {
private TypeHelper define=TypeHelper.getInstance();
private MessageHelper m_msg=MessageHelper.getInstance();
private Integer[] mItnId=define.getmItnId();
private Integer[] mLayoutId=define.getmLayoutId();
private Integer[] mIconId=define.getIconId();
private static String[] m_Title=TypeHelper.getmViewStr();
private static String[] m_SubTitle=TypeHelper.getmsubTitle();
/*
* 임의로 선언해둔 매번 사용하는 것들의 변수(#define mTrue 1 대용)
*/
private static int mTrue=TypeHelper.getmTrue();
private static int mFalse=TypeHelper.getmFalse();
private static int mViewIndex=0;
private static Integer mLength; //뷰 갯수
private boolean isAnimated; //애니메이션 효과 사용 여부
private Object m_obj;
// private boolean DevelopMode=true;
/*
* ViewFlipper GestureDetector등 레이아웃의 제어에 필요한 변수들
*/
// private TabPageIndicator mPageMark; //현재 몇 페이지 인지 나타내는 뷰
private static ViewPager mPager;
private HallaPagerAdapter mPagerAdapter;
private LayoutInflater mInflater;
private View mView;
public ArrayList<View> m_View=new ArrayList<View>();
private static MainActivity m_this;
/*
* 메인 레이아웃에 포함된 타이틀,이전,다음버튼의 변수
*/
private static TextView mTextView;
private static TextView mSubTextView;
private ImageButton mItn_prev;
private ImageButton mItn_next;
private ImageButton mItn_share;
private ImageButton mChatbtn;
//private boolean DevelopMode=true;
/**
* MSG_TIMER_EXPIRED : 백키를 눌렀을경우 일정시간후 발동하여 mIsBackKeyPressed를 다시 false로..(msg.what)
* BACKKEY_TIMEOUT: 백키를 한번 누른후 몇초안에 눌러야 하는지...(기본값 2초)
* MILLIS_IN_SEC: 1초 1000/1 포맷
*/
private static final int MSG_TIMER_EXPIRED = 1;
private static final int BACKKEY_TIMEOUT = 2;
private static final int MILLIS_IN_SEC = 1000;
private boolean mIsBackKeyPressed = false;
private long mCurrTimeInMillis = 0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Typeface face=Typeface.createFromAsset(getAssets(),
"fonts/SFGothic.ttf");
/**
* 개발자 모드
*/
/* if (DevelopMode) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork()
.penaltyLog()
.build());
}*/
/**
* 커스텀 타이틀바
*/
requestWindowFeature(Window.FEATURE_NO_TITLE); //타이틀바를 제거합니다.
//requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activity_main);
//getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.header);
mTextView = (TextView)findViewById(R.id.Title);
mSubTextView = (TextView)findViewById(R.id.subTitle);
mTextView.setTypeface(face);
mSubTextView.setTypeface(face);
/**
* 현재 액티비티의 Context를 담는다.
*/
m_this=this;
/**
* 현재 뷰의 정보를 초기화 한다.
*/
int size=mLayoutId.length;
for(int i=0; i<size; i++)
m_View.add(i, null);
/**
* View Pager에 어댑터를 등록한다.
*/
mPagerAdapter=(HallaPagerAdapter)new HallaPagerAdapter(GetContext());
mLength=m_View.size();
//InitView();
InitPref();
}
//백키 2번 입력시 앱종료
@SuppressLint("HandlerLeak")
public void onBackPressed() { // 백키가 눌렸다면?
if (mIsBackKeyPressed == false) { // 한번도 안 눌렸다면
mIsBackKeyPressed = true; // 한번 누른 상태로 변경
mCurrTimeInMillis = Calendar.getInstance().getTimeInMillis(); // 현재시간 넣음
m_msg.makeToast(this, "종료를 원하시면 다시 한번 \"Back key\"를 눌러 주시기 바랍니다.",500);
startTimer(); // 시간 재기 시작
} else {
mIsBackKeyPressed = false; // 백키가 한번 눌린상태면
if (Calendar.getInstance().getTimeInMillis() <= (mCurrTimeInMillis + (BACKKEY_TIMEOUT * MILLIS_IN_SEC))) {
finish(); // 정해놓은 시간 내라면 현재 액티비티 종료
}
}
}
private void startTimer() {
mTimerHandler.sendEmptyMessageDelayed(MSG_TIMER_EXPIRED,
BACKKEY_TIMEOUT * MILLIS_IN_SEC);
}
private Handler mTimerHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) { // 일정시간내에 두번 누르지 않으면 한번도 안 누른 상태로 초기화
case MSG_TIMER_EXPIRED: {
mIsBackKeyPressed = false;
}
break;
}
}
};
//브로드캐스트 이벤트 리시버
public class ViewReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
int pos=intent.getIntExtra("view", 0);
mPager.setCurrentItem(pos);
GetContext().unregisterReceiver(this);
}
}
public View GetView(int idx){
return m_View.get(idx);
}
public void InitPref()
{
mPager=(ViewPager)findViewById(R.id.vp_main);
mPager.getContext();
mPager.setAdapter(mPagerAdapter);//PagerAdapter로 설정
//mPageMark = (TabPageIndicator)findViewById(R.id.page_mark); //하단의 현재 페이지 나타내는 뷰
//mPageMark.setViewPager(mPager);
mPager.setOnPageChangeListener(new OnPageChangeListener() { //아이템이 변경되면, gallery나 listview의 onItemSelectedListener와 비슷
//아이템이 선택이 되었으면
@Override
public void onPageSelected(int position) {
mTextView.setText(m_Title[position]);
mSubTextView.setText(m_SubTitle[position]);
}
@Override
public void onPageScrolled(int position, float positionOffest, int positionOffsetPixels) {}
@Override
public void onPageScrollStateChanged(int state) {
}
});
mItn_prev=(ImageButton)findViewById(mItnId[0]);
mItn_prev.setOnClickListener(new OnClickListener() {
public void onClick(View v){
ViewControl(mFalse);
}
});
mItn_next=(ImageButton)findViewById(mItnId[1]);
mItn_next.setOnClickListener(new OnClickListener() {
public void onClick(View v){
ViewControl(mTrue);
}
});
mItn_share=(ImageButton)findViewById(R.id.itn_share);
mItn_share.setOnClickListener(new OnClickListener() {
public void onClick(View v){
Share s=new Share(GetContext(),getWindow().getDecorView());
s.Send();
}
});
mChatbtn=(ImageButton)findViewById(R.id.itn_chat);
mChatbtn.setOnClickListener(new OnClickListener() {
public void onClick(View v){
ViewReceiver r=new ViewReceiver();
IntentFilter filter=new IntentFilter();
Intent intent = new Intent(GetContext(), ChatDialog.class);
filter.addAction("Chat");
registerReceiver(r, filter);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
});
isAnimated = true; //기본적으로 애니메이션 사용.
}
public static ProgressDialog ShowProgress(String title,String msg)
{
return ProgressDialog.show(GetContext(), title, msg);
}
public static MainActivity GetContext(){
return m_this;
}
public static void SetPager(int id,boolean flag){
mPager.setCurrentItem(id, flag);
int idx=mPager.getCurrentItem();
mTextView.setText(m_Title[idx]);
mSubTextView.setText(m_SubTitle[idx]);
}
//Pager 아답터 구현
private class HallaPagerAdapter extends PagerAdapter implements IconPagerAdapter{
Context mContext;
public HallaPagerAdapter( Context con) {
super();
mContext=con;
mInflater = LayoutInflater.from(mContext);
}
@Override public int getCount() {
return m_View.size();
}
/*public String getPageTitle(int position){
return mViewStr[position];
}*/
//뷰페이저에서 사용할 뷰객체 생성/등록
@Override
public Object instantiateItem(View pager, int position) {
mView = null;
if(m_View.get(position) == null){
mView = (View)mInflater.inflate(mLayoutId[position], null);
switch(position){
case 0:
m_obj = (m0Launcher)new m0Launcher(mView,mContext);
((m0Launcher) m_obj).Init();
break;
case 1:
m_obj = (m1Food)new m1Food(mView,mContext);
((m1Food) m_obj).Init();
break;
case 2:
m_obj = (m2Bus)new m2Bus(mView,mContext);
((m2Bus) m_obj).Init();
break;
case 3:
m_obj=(m3TimeTable) new m3TimeTable(mView,mContext);
((m3TimeTable) m_obj).init();
break;
case 4:
m_obj=(m4Town) new m4Town(mView,mContext);
((m4Town) m_obj).init();
break;
/*case 4:
m_obj=(m5Haksa) new m5Haksa(mView,mContext);
((m5Haksa) m_obj).Init();
break;*/
}
m_View.set(position,mView);
}else{
mView=m_View.get(position);
}
((ViewPager)pager).addView(mView, 0); //뷰 페이저에 추가
return mView;
}
//뷰 객체 삭제.
@Override public void destroyItem(View pager, int position, Object view) {
((ViewPager)pager).removeView((View)view);
}
// instantiateItem메소드에서 생성한 객체를 이용할 것인지
@Override public boolean isViewFromObject(View view, Object obj) { return view == obj; }
@Override public void finishUpdate(View arg0) {}
@Override public void restoreState(Parcelable arg0, ClassLoader arg1) {}
@Override public Parcelable saveState() { return null; }
@Override public void startUpdate(View arg0) {}
@Override
public int getIconResId(int index) {
// TODO Auto-generated method stub
return mIconId[index];
}
}
/*
* View의 인덱스를 컨트롤 해서 뷰를 제거하고 다음 뷰를 초기화 시켜주는 메소드
* Flag 1 다음뷰 0:이전뷰 가 있다.
* 각각 0이하가 되거나 mViewId의 길이보다 커질경우 mViewId의 길이로초기화 하거나 0으로 초기화 해준다.
*/
public void ViewControl(int flag)
{
mViewIndex = mPager.getCurrentItem();
int index=0;
switch(flag){
case -1: //mTrue,mFalse가 아닌 가비지 값인 경우
return;
case 0: //mFalse일때....
index=(mViewIndex == 0)?mLength:mViewIndex-1;
break;
default: //mTrue일때...
index=(mViewIndex == mLength-1)?0:mViewIndex+1;
break;
}
SetPager(index, isAnimated);
}
}
|
package com.epam.bd;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.apache.hadoop.mrunit.mapreduce.*;
import java.util.Arrays;
import static org.junit.Assert.*;
public class MapReduceTest {
MapDriver<LongWritable, Text, LongWritable, ImpressionEntry> mapDriver;
ReduceDriver<LongWritable, ImpressionEntry, Text, IntWritable> reduceDriver;
MapReduceDriver<LongWritable, Text, LongWritable, ImpressionEntry, Text, IntWritable> mapReduceDriver;
String line1 = "445ed8056d8279f5419dc74dbc1a71bc\t20131019125009566\t1\tD11DNV9De8M\tMozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; KB974488)\t27.38.216.*\t216\t219\t3\t7ed515fe566938ee6cfbb6ebb7ea4995\t4e613a7394f0f4c998904fc932d7a15c\tnull\tSports_F_Upright\t300\t250\tNa\tNa\t10\t7323\t294\t11\tnull\t2259\t13800,10059,10684,10075,10083,13042,10102,10024,10006,10111,11944,13403,10133,10063,10116,10125\n";
String line2 = "b5d859a10a3a5588204f8b8e35ead2f\t20131019131808811\t1\tD12FlHCie6g\tMozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)\t113.67.164.*\t216\t219\t3\tdd4270481b753dde29898e27c7c03920\t7d327804a2476a668c633b7fb857fddb\tnull\tEnt_F_Width1\t1000\t90\tNa\tNa\t70\t7336\t100\t255\tnull\t2259\t10048,10057,10067,10059,13496,10077,10093,10075,13042,10102,10006,10024,10148,10031,13776,10111,10127,10063,10116\n";
String line3 = "34381416d77d8c572a98f03e6cc8b84d\t20131019173100595\t1\tD1EMul2gcUr\tMozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\t183.51.230.*\t216\t216\t2\tc80deeed1b57eaed72ec51235e21bf89\t1b3f1adf943b9c7b44dcedd76f5a654d\tnull\t4186967039\t728\t90\tFirstView\tNa\t5\t7330\t201\t139\tnull\t2259\t10057,10059,10076,10093,10075,10118,10083,10074,10006,10024,10148,11423,10110,10131,10063,10125\n";
String line4 = "b6b39e23dcf1857e9b6a67989853af48\t20131019131719059\t1\tD54JF8CAFMn\tMozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\t183.44.82.*\t216\t216\t3\tdd4270481b753dde29898e27c7c03920\t14d61cc01a4101179a8c540fa68305d1\tnull\tEnt_F_Width1\t1000\t90\tNa\tNa\t70\t7336\t294\t70\tnull\t2259\t10006,13403,10063,10116\n";
String line5 = "8f13a6c667e94c733937b72fc318c6ac\t20131019164600959\t1\tD54NVED4Gkx\tMozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\t113.81.120.*\t216\t216\t2\t6719df73b092f3cf8084106111dc1053\tadbfb6b14c1992f14439a4abfb703fef\tnull\t3641599401\t300\t250\tNa\tNa\t4\t7323\t277\t11\tnull\t2259\t10006,13403,10115,10063\n";
String line6 = "ab551c27a0f1021e312c471554e2b12\t20131019040200623\t1\tD5QEL_0K6Gv\tMozilla/5.0 (Windows NT 5.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1\t211.148.89.*\t216\t210\t2\t36b1c4d8658af5440ad6657a0fa74c0a\t27c11a39f54d02357a1d92f047faa5f4\tnull\t443702222\t728\t90\tOtherView\tNa\t5\t7330\t277\t44\tnull\t2259\t13800,10059,10077,10006,13866,10111,10131,10115,10063\n";
String line7 = "fad1673c20362f6f244adca4234ecd7f\t20131019125401029\t1\tD5SAHG1PbFK\tMozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; youxihe.1748)\t183.4.178.*\t216\t210\t1\tf46fd165e29be3996347d1f4357ceaf5\t805f53d277437b89ba45f76164308dc7\tnull\tmm_13181159_1847728_9696846\t950\t90\tFirstView\tNa\t0\t7333\t294\t228\tnull\t2259\t10048,10057,10059,10075,10093,10083,13042,10006,10024,10110,10031,10131,10052,13403,10063,10116,10125\n";
String DUMMY_AGENT = "dummy-agent";
@Before
public void setUp() {
ImpressionMapper mapper = new ImpressionMapper();
mapDriver = new MapDriver<LongWritable, Text, LongWritable, ImpressionEntry>();
mapDriver.setMapper(mapper);
ImpressionReducer reducer = new ImpressionReducer();
reduceDriver = new ReduceDriver<LongWritable, ImpressionEntry, Text, IntWritable>();
reduceDriver.setReducer(reducer);
mapReduceDriver = MapReduceDriver.newMapReduceDriver(mapper, reducer);
}
@Test
public void testMapper() throws Exception {
mapDriver.withInput(new LongWritable(), new Text(line1));
mapDriver.withInput(new LongWritable(), new Text(line2));
mapDriver.withInput(new LongWritable(), new Text(line3));
mapDriver.withInput(new LongWritable(), new Text(line4));
mapDriver.withInput(new LongWritable(), new Text(line5));
mapDriver.withOutput(new LongWritable(219), new ImpressionEntry(219, 294, 1,
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; KB974488)"));
mapDriver.withOutput(new LongWritable(219), new ImpressionEntry(219, 100, 1,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)"));
mapDriver.withOutput(new LongWritable(216), new ImpressionEntry(216, 201, 1,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"));
mapDriver.withOutput(new LongWritable(216), new ImpressionEntry(216, 294, 1,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"));
mapDriver.withOutput(new LongWritable(216), new ImpressionEntry(216, 277, 1,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"));
mapDriver.runTest();
}
@Test
public void testReducer() throws Exception {
reduceDriver.withInput(new LongWritable(10), Arrays.asList(
new ImpressionEntry(10, 200,1, DUMMY_AGENT),
new ImpressionEntry(10, 250,1, DUMMY_AGENT),
new ImpressionEntry(10,300,1, DUMMY_AGENT),
new ImpressionEntry(10,350,1, DUMMY_AGENT),
new ImpressionEntry(10,500,1, DUMMY_AGENT)));
reduceDriver.withInput(new LongWritable(20), Arrays.asList(
new ImpressionEntry(20,50,1, DUMMY_AGENT),
new ImpressionEntry(20,250,1, DUMMY_AGENT),
new ImpressionEntry(20,500,1, DUMMY_AGENT)));
reduceDriver.withInput(new LongWritable(30), Arrays.asList(
new ImpressionEntry(30,100,1, DUMMY_AGENT),
new ImpressionEntry(30,500,1, DUMMY_AGENT)));
reduceDriver.withOutput(new Text("zhangjiakou"), new IntWritable(3));
reduceDriver.withOutput(new Text("jincheng"), new IntWritable(1));
reduceDriver.withOutput(new Text("wuhai"), new IntWritable(1));
reduceDriver.runTest();
}
@Test
public void testMapReduce() throws Exception {
mapReduceDriver.withInput(new LongWritable(), new Text(line1));
mapReduceDriver.withInput(new LongWritable(), new Text(line2));
mapReduceDriver.withInput(new LongWritable(), new Text(line3));
mapReduceDriver.withInput(new LongWritable(), new Text(line4));
mapReduceDriver.withInput(new LongWritable(), new Text(line5));
mapReduceDriver.withInput(new LongWritable(), new Text(line6));
mapReduceDriver.withInput(new LongWritable(), new Text(line7));
mapReduceDriver.withOutput(new Text("yiyang"), new IntWritable(2));
mapReduceDriver.withOutput(new Text("missing(216)"), new IntWritable(2));
mapReduceDriver.withOutput(new Text("shenzhen"), new IntWritable(1));
mapReduceDriver.runTest();
}
}
|
package com.ebupt.portal.canyon.common.shiro;
import org.apache.shiro.authz.Permission;
import org.apache.shiro.authz.permission.WildcardPermission;
import org.apache.shiro.util.CollectionUtils;
import org.apache.shiro.util.StringUtils;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* 权限比较器
*
* @author chy
* @date 2019-03-14 11:27
*/
public class EbWildcardPermission implements Permission, Serializable {
/**
* 权限通配符
*/
private static final String WILDCARD_TOKEN = "*";
/**
* 权限分隔符 GET:user/delete
*/
private static final String PART_DIVIDER_TOKEN = ":";
/**
* 子权限分隔符
*/
private static final String SUBPART_DIVIDER_TOKEN = "/";
/**
* 大小写是否敏感
*/
private static final boolean DEFAULT_CASE_SENSITIVE = true;
/**
* 权限集合长度
*/
private static final int PART_LENGTH = 2;
/**
* 该用户拥有的权限集合
*/
private List<List<String>> parts;
EbWildcardPermission(String wildcardString) {
this(wildcardString, DEFAULT_CASE_SENSITIVE);
}
private EbWildcardPermission(String wildcardString, boolean caseSensitive) {
setParts(wildcardString, caseSensitive);
}
private void setParts(String wildcardString, boolean caseSensitive) {
wildcardString = StringUtils.clean(wildcardString);
if (wildcardString == null || wildcardString.isEmpty()) {
throw new IllegalArgumentException("Wildcard string cannot be null or empty. Make sure permission strings are properly formatted.");
}
if (!caseSensitive) {
wildcardString = wildcardString.toLowerCase();
}
List<String> parts = CollectionUtils.asList(wildcardString.split(PART_DIVIDER_TOKEN));
this.parts = new ArrayList<>();
for (String part : parts) {
List<String> subparts = CollectionUtils.asList(part.split(SUBPART_DIVIDER_TOKEN));
if (subparts.isEmpty()) {
throw new IllegalArgumentException("Wildcard string cannot contain parts with only dividers. Make sure permission strings are properly formatted.");
}
this.parts.add(subparts);
}
if (this.parts.isEmpty()) {
throw new IllegalArgumentException("Wildcard string cannot contain only dividers. Make sure permission strings are properly formatted.");
}
}
private List<List<String>> getParts() {
return this.parts;
}
@Override
public boolean implies(Permission p) {
if (!(p instanceof EbWildcardPermission)) {
return false;
}
// 获取访问所需权限
EbWildcardPermission wp = (EbWildcardPermission) p;
List<List<String>> otherParts = wp.getParts();
// 获取用户已具有权限
List<List<String>> parts = this.getParts();
// 权限格式不一致,鉴权失败
if (otherParts.size() != parts.size() || parts.size() != PART_LENGTH) {
return false;
}
// 判断请求方式是否一致
List<String> otherMethods = otherParts.get(0);
List<String> methods = parts.get(0);
if (otherMethods.size() == 1 && methods.size() == 1 && otherMethods.get(0).equals(methods.get(0))) {
List<String> otherUrls = otherParts.get(1);
List<String> urls = parts.get(1);
// 请求url校验
if (otherUrls.size() == urls.size()) {
for (int i = 0; i < otherUrls.size(); i++) {
String otherUrl = otherUrls.get(i);
String url = urls.get(i);
if (!WILDCARD_TOKEN.equals(url) && !url.equals(otherUrl)) {
return false;
}
}
return true;
}
}
return false;
}
@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
for (List<String> part : parts) {
if (buffer.length() > 0) {
buffer.append(PART_DIVIDER_TOKEN);
}
Iterator<String> partIt = part.iterator();
while(partIt.hasNext()) {
buffer.append(partIt.next());
if (partIt.hasNext()) {
buffer.append(SUBPART_DIVIDER_TOKEN);
}
}
}
return buffer.toString();
}
@Override
public boolean equals(Object o) {
if (o instanceof WildcardPermission) {
EbWildcardPermission wp = (EbWildcardPermission) o;
return parts.equals(wp.parts);
}
return false;
}
@Override
public int hashCode() {
return parts.hashCode();
}
}
|
package com.tencent.mm.plugin.recharge.model;
import com.tencent.mm.ab.b;
import com.tencent.mm.ab.b.a;
import com.tencent.mm.ab.e;
import com.tencent.mm.ab.l;
import com.tencent.mm.network.k;
import com.tencent.mm.network.q;
import com.tencent.mm.plugin.wallet_core.model.mall.c;
import com.tencent.mm.protocal.c.aev;
import com.tencent.mm.protocal.c.aew;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import java.util.List;
import org.json.JSONObject;
public final class d extends l implements k {
public b diG;
private e diJ;
public String eNQ;
public int moF;
public MallRechargeProduct moI = null;
public List<MallRechargeProduct> moJ = null;
public String moK;
public String moy;
public String moz = null;
public d(int i, String str, String str2, String str3, String str4, String str5) {
this.moy = str;
this.moF = i;
this.eNQ = str5;
this.moK = str2;
a aVar = new a();
aVar.dIG = new aev();
aVar.dIH = new aew();
aVar.uri = "/cgi-bin/micromsg-bin/getlatestpayproductinfo";
aVar.dIF = 497;
aVar.dII = 229;
aVar.dIJ = 1000000229;
this.diG = aVar.KT();
aev aev = (aev) this.diG.dID.dIL;
aev.rDg = str;
aev.rDh = str3;
aev.rIL = str2;
aev.rDi = str4;
aev.rwj = c.bPK().Pe(str);
x.d("MicroMsg.NetSceneGetLatestPayProductInfo", String.format("funcId:%s, appId:%s, productId:%s, remark:%s", new Object[]{str, str3, str2, str4}));
}
public final void a(int i, int i2, int i3, String str, q qVar, byte[] bArr) {
x.d("MicroMsg.NetSceneGetLatestPayProductInfo", "errCode " + i3 + ", errMsg " + str);
aew aew = (aew) ((b) qVar).dIE.dIL;
x.d("MicroMsg.NetSceneGetLatestPayProductInfo", "resp.OurterRemark " + aew.rDl);
String str2 = aew.rDl;
this.moz = "";
if (!bi.oW(str2)) {
String[] split = str2.split("&");
if (split != null && split.length > 0) {
Object obj = 1;
for (String split2 : split) {
String[] split3 = split2.split("=");
if (split3.length == 2) {
if (obj == null) {
this.moz += " ";
} else {
obj = null;
}
this.moz += split3[1];
}
}
}
}
if (!bi.oW(aew.rIN)) {
try {
this.moJ = b.a(this.moy, new JSONObject(aew.rIN).optJSONArray("product_info"));
} catch (Throwable e) {
x.printErrStackTrace("MicroMsg.NetSceneGetLatestPayProductInfo", e, "", new Object[0]);
}
}
if (i2 == 0 && i3 == 0) {
str2 = aew.rIM;
x.d("MicroMsg.NetSceneGetLatestPayProductInfo", "resp.Product " + str2);
if (!bi.oW(str2)) {
try {
this.moI = b.d(this.moy, new JSONObject(str2));
this.moI.moz = this.moz;
} catch (Throwable e2) {
x.printErrStackTrace("MicroMsg.NetSceneGetLatestPayProductInfo", e2, "", new Object[0]);
}
}
}
x.d("MicroMsg.NetSceneGetLatestPayProductInfo", String.format("OutErrCode : %d ,OutErrMsg : %s , WxErrCode : %d , WxErrMsg : %s", new Object[]{Integer.valueOf(aew.rDj), aew.rDk, Integer.valueOf(aew.rDm), aew.rDn}));
if (i3 == 0) {
if (aew.rDm != 0) {
i3 = aew.rDm;
} else {
i3 = aew.rDj;
}
}
if (bi.oW(str)) {
if (bi.oW(aew.rDn)) {
str = aew.rDk;
} else {
str = aew.rDn;
}
}
this.diJ.a(i2, i3, str, this);
}
public final int getType() {
return 497;
}
public final int a(com.tencent.mm.network.e eVar, e eVar2) {
this.diJ = eVar2;
return a(eVar, this.diG, this);
}
}
|
package com.darkania.darkers.comandos;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.darkania.darkers.extras.Permisos;
import net.md_5.bungee.api.ChatColor;
public class Tppos implements CommandExecutor{
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
if (cmd.getName().equalsIgnoreCase("tppos") && sender instanceof Player){
Player p = (Player) sender;
if (Permisos.tiene(p, "Darkers.staff")){
if (args.length == 3){
Location targetPos = new Location(p.getWorld(), Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
p.teleport(targetPos);
p.sendMessage(ChatColor.DARK_AQUA+"Teletransportado...");
return true;
}
if (args.length > 3){
p.sendMessage(ChatColor.RED+"Uso: /tppos [x y z]");
return true;
}
if (args.length <= 2){
p.sendMessage(ChatColor.RED+"Uso: /tppos [x y z]");
return true;
}
}
if (!Permisos.tiene(p, "Darkers.staff")){
ChatColor.translateAlternateColorCodes('&', Bukkit.getPluginManager().getPlugin("Darkers").getConfig().getString("General.SinPermisos"));
return true;
}
}
if (!(sender instanceof Player)){
sender.sendMessage(ChatColor.GREEN+"[Darkers] "+ChatColor.RED+"No utilizable desde la consola");
return true;
}
return false;
}
}
|
package com.example.healthmanage.ui.activity.temperature.response;
import java.io.Serializable;
import java.util.List;
public class PrescriptionResponse implements Serializable {
/**
* requestId : null
* errorLog : null
* status : 0
* message : 成功
* data : [{"modelName":"中暑","modelType":null,"drugId":null,"id":null,"drugList":[{"id":18,"name":"名称","number":22,"unit":"药品单位","useMode":"服用方式","useTime":"2021-05-07 08:00:00","useFrequency":"服用频率","healthConsultId":null},{"id":19,"name":"名称","number":22,"unit":"药品单位","useMode":"服用方式","useTime":"2021-05-07 08:00:00","useFrequency":"服用频率","healthConsultId":null}]}]
*/
private Object requestId;
private Object errorLog;
private int status;
private String message;
/**
* modelName : 中暑
* modelType : null
* drugId : null
* id : null
* drugList : [{"id":18,"name":"名称","number":22,"unit":"药品单位","useMode":"服用方式","useTime":"2021-05-07 08:00:00","useFrequency":"服用频率","healthConsultId":null},{"id":19,"name":"名称","number":22,"unit":"药品单位","useMode":"服用方式","useTime":"2021-05-07 08:00:00","useFrequency":"服用频率","healthConsultId":null}]
*/
private List<DataBean> data;
public Object getRequestId() {
return requestId;
}
public void setRequestId(Object requestId) {
this.requestId = requestId;
}
public Object getErrorLog() {
return errorLog;
}
public void setErrorLog(Object errorLog) {
this.errorLog = errorLog;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class DataBean implements Serializable{
private String modelName;
private int modelType;
private int drugId;
private int id;
/**
* id : 18
* name : 名称
* number : 22
* unit : 药品单位
* useMode : 服用方式
* useTime : 2021-05-07 08:00:00
* useFrequency : 服用频率
* healthConsultId : null
*/
private List<DrugListBean> drugList;
private boolean isSelect;
public boolean isSelect() {
return isSelect;
}
public void setSelect(boolean select) {
isSelect = select;
}
public String getModelName() {
return modelName;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
public int getModelType() {
return modelType;
}
public void setModelType(int modelType) {
this.modelType = modelType;
}
public int getDrugId() {
return drugId;
}
public void setDrugId(int drugId) {
this.drugId = drugId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public List<DrugListBean> getDrugList() {
return drugList;
}
public void setDrugList(List<DrugListBean> drugList) {
this.drugList = drugList;
}
public static class DrugListBean implements Serializable{
private int id;
private String name;
private int number;
private String unit;
private String useMode;
private String useTime;
private String useFrequency;
private int healthConsultId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getUseMode() {
return useMode;
}
public void setUseMode(String useMode) {
this.useMode = useMode;
}
public String getUseTime() {
return useTime;
}
public void setUseTime(String useTime) {
this.useTime = useTime;
}
public String getUseFrequency() {
return useFrequency;
}
public void setUseFrequency(String useFrequency) {
this.useFrequency = useFrequency;
}
public int getHealthConsultId() {
return healthConsultId;
}
public void setHealthConsultId(int healthConsultId) {
this.healthConsultId = healthConsultId;
}
}
}
}
|
package sample.Root.RootUserWindow;
public class User {
private String idColumn;
private String usernameColumn;
private String roleColumn;
private String accessColumn;
public String getAccessColumn() {
return accessColumn;
}
public void setAccessColumn(String accessColumn) {
this.accessColumn = accessColumn;
}
public User(String id, String username, String role, String access) {
this.idColumn=id;
this.usernameColumn=username;
this.roleColumn=role;
this.accessColumn=access;
}
public String getIdColumn() {
return idColumn;
}
public void setIdColumn(String idColumn) {
this.idColumn = idColumn;
}
public String getUsernameColumn() {
return usernameColumn;
}
public void setUsernameColumn(String usernameColumn) {
this.usernameColumn = usernameColumn;
}
public String getRoleColumn() {
return roleColumn;
}
public void setRoleColumn(String roleColumn) {
this.roleColumn = roleColumn;
}
}
|
package com.itesm.classes;
import com.vaadin.data.util.sqlcontainer.SQLContainer;
import java.util.ArrayList;
public class Categorias {
SQLContainer categoriasData;
public Categorias(){
com.itesm.DAO.Categorias data = new com.itesm.DAO.Categorias();
categoriasData = data.getContainer();
}
public SQLContainer getCategoriasData() {
return categoriasData;
}
public void setCategoriasData(SQLContainer categoriasData) {
this.categoriasData = categoriasData;
}
}
|
package htw_berlin.de.totoro_client;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import htw_berlin.de.totoro_client.API.AuthorizedTotoroService;
import htw_berlin.de.totoro_client.API.TotoroService;
import htw_berlin.de.totoro_client.Model.Match;
import htw_berlin.de.totoro_client.Model.Tournament;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class TournamentActivity extends AppCompatActivity {
Tournament tournament;
List<Match> matches = new ArrayList<>();
List<String> matchesStringArray = new ArrayList<>();
ListView matchesView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tournament);
Intent intent = getIntent();
matchesView = (ListView) findViewById(R.id.matchesView);
String t_id = intent.getStringExtra("ITEM_ID");
TotoroService totoroService = new AuthorizedTotoroService();
final Call<List<Match>> matchesOfTournamentCall = totoroService.getMatches(Integer.parseInt(t_id));
matchesOfTournamentCall.enqueue(new Callback<List<Match>>() {
@Override
public void onResponse(Call<List<Match>> matchesOfTournamentCall, Response<List<Match>> response) {
matches = response.body();
for (Match match : matches) {
matchesStringArray.add(match.toString());
}
}
@Override
public void onFailure(Call<List<Match>> call, Throwable t) {
Toast.makeText(TournamentActivity.this, t.getMessage(), Toast.LENGTH_SHORT).show();
}
});
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.list_matches, matchesStringArray);
matchesView.setAdapter(adapter);
matchesView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
final Intent intent = new Intent(TournamentActivity.this, ViewSetsActivity.class);
intent.putExtra("TOURNAMENT_ID", "" + matches.get(position).getTournament_id());
intent.putExtra("MATCH_ID", "" + matches.get(position).getId());
startActivity(intent);
}
});
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* Hybris ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with the
* terms of the license agreement you entered into with SAP Hybris.
*/
package com.cnk.travelogix.operations.order.converters.populator;
import de.hybris.platform.commercefacades.order.converters.populator.OrderPopulator;
import de.hybris.platform.commercefacades.order.data.OrderData;
import de.hybris.platform.core.model.order.OrderModel;
import org.springframework.util.Assert;
/**
* This populator is used for populate new added field of Order
*
* @author C5244543 (Shivraj)
*/
public class TravelogixOrderPopulator extends OrderPopulator
{
private GroupCompanyPopulator groupCompanyPopulator;
@Override
public void populate(final OrderModel source, final OrderData target)
{
Assert.notNull(source, "Parameter source cannot be null.");
Assert.notNull(target, "Parameter target cannot be null.");
super.populate(source, target);
// target.setIsTimeLimitBooking(source.getIsTimeLimitBooking());
groupCompanyPopulator.populate(source, target);
if (null != source)
{
if (null != source.getSalesApplication())
{
target.setPointOfSale(source.getSalesApplication().getCode());
}
if (null != source.getPaymentStatus())
{
target.setPaymentStatus(source.getPaymentStatus().getCode());
}
}
}
/**
* @return the groupCompanyPopulator
*/
public GroupCompanyPopulator getGroupCompanyPopulator()
{
return groupCompanyPopulator;
}
/**
* @param groupCompanyPopulator
* the groupCompanyPopulator to set
*/
public void setGroupCompanyPopulator(final GroupCompanyPopulator groupCompanyPopulator)
{
this.groupCompanyPopulator = groupCompanyPopulator;
}
}
|
package com.zhouyi.business.core.model.provincecomprehensive.pojo;
import com.zhouyi.business.core.model.LedenCollectGoods;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Author: first
* @Date: 下午3:07 2019/11/4
* @Description: 随身物品省宗对接类
**/
@Data
public class StandardGoods extends LedenCollectGoods {
private List<ImagesInfo> imagesInfos;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ImagesInfo{
private String image;
private String remark;
public ImagesInfo(String image) {
this.image = image;
}
}
}
|
package com.lanltn.android_core_helper.helper.cache;
import android.content.Context;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
class CacheFileManager {
private Context mContext;
private String mFileName;
private static final String empty = "";
CacheFileManager(Context context, String fileName) {
mContext = context;
mFileName = fileName;
}
synchronized void saveCacheFile(String content) {
String filename = mFileName;
FileOutputStream outputStream;
try {
outputStream = mContext.openFileOutput(filename, Context.MODE_PRIVATE);
outputStream.write(content.getBytes());
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
synchronized void clearCache() {
String filename = mFileName;
FileOutputStream outputStream;
try {
outputStream = mContext.openFileOutput(filename, Context.MODE_PRIVATE);
outputStream.write(new byte[0]);
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
synchronized String getCacheData() {
try {
FileInputStream fis = mContext.openFileInput(mFileName);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader bufferedReader = new BufferedReader(isr);
StringBuilder sb = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
sb.append(line);
}
return sb.toString();
} catch (Exception e) {
e.printStackTrace();
}
return empty;
}
}
|
package com.supconit.kqfx.web.fxzf.search.controllers;
import com.supconit.kqfx.web.fxzf.search.entities.*;
import com.supconit.kqfx.web.fxzf.search.services.VehicleInfoService;
import com.supconit.kqfx.web.util.*;
import hc.base.domains.AjaxMessage;
import hc.base.domains.Pageable;
import hc.base.domains.Pagination;
import hc.business.dic.services.DataDictionaryService;
import hc.mvc.annotations.FormBean;
import hc.safety.manager.SafetyManager;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jodd.util.StringUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.util.Region;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON;
import com.supconit.honeycomb.business.authorization.entities.Role;
import com.supconit.honeycomb.business.authorization.entities.User;
import com.supconit.honeycomb.business.authorization.services.RoleService;
import com.supconit.honeycomb.business.organization.services.PersonService;
import com.supconit.kqfx.web.analysis.entities.JgZcd;
import com.supconit.kqfx.web.analysis.services.JgZcdService;
import com.supconit.kqfx.web.fxzf.avro.redis.WriteRedisService;
import com.supconit.kqfx.web.fxzf.search.services.FxzfSearchService;
import com.supconit.kqfx.web.fxzf.search.services.IllegalTrailService;
import com.supconit.kqfx.web.fxzf.search.services.ZczTreeService;
import com.supconit.kqfx.web.fxzf.warn.entities.Config;
import com.supconit.kqfx.web.fxzf.warn.entities.WarnHistory;
import com.supconit.kqfx.web.fxzf.warn.services.ConfigService;
import com.supconit.kqfx.web.fxzf.warn.services.WarnHistoryService;
import com.supconit.kqfx.web.list.entities.BlackList;
import com.supconit.kqfx.web.list.services.BlackListService;
import com.supconit.kqfx.web.xtgl.entities.ExtPerson;
import com.supconit.kqfx.web.xtgl.services.SystemLogService;
/**
* 过车实时查询
*
* @author gaoshuo
*
*/
@SuppressWarnings("deprecation")
@RequestMapping("/fxzf/search")
@Controller("taizhou_offsite_enforcement_searchFxzf_controller")
public class FxzfSearchController {
private static final String MODULE_CODE = "FXZFDATA_SEARCH";
@Autowired
private FxzfSearchService fxzfSearchService;
@Autowired
private DataDictionaryService dataDictionaryService;
@Autowired
private SystemLogService systemLogService;
@Resource
private HttpServletRequest request;
@Autowired
private SafetyManager safetyManager;
@Autowired
private RoleService roleService;
@Autowired
private JgZcdService jgZcdService;
@Autowired
private PersonService personService;
@Autowired
private WriteRedisService writeRedisService;
@Autowired
private IllegalTrailService illegalTrailService;
@Autowired
private BlackListService blackListService;
@Autowired
private ConfigService configService;
@Autowired
private WarnHistoryService warnHistoryService;
@Autowired
private ZczTreeService zczTreeService;
@Autowired
private VehicleInfoService vehicleInfoService;
@Value("${refresh.time}")
private String refreshTime;
private transient static final Logger logger = LoggerFactory.getLogger(FxzfSearchController.class);
/**
* 创建Fxzf实体类
*
* @return
*/
@ModelAttribute("fxzf")
private Fxzf getFxzf() {
Fxzf fxzf = new Fxzf();
return fxzf;
}
@RequestMapping(value = "list", method = RequestMethod.GET)
public String display(ModelMap map, @ModelAttribute("fxzf") Fxzf fxzfInfo, HttpServletRequest request) {
this.systemLogService.log(MODULE_CODE, OperateType.query.getCode(), "过车信息列表", request.getRemoteAddr());
String ip = request.getLocalAddr();
logger.info("请求服务器的IP地址:" + ip);
map.put("ip", ip);
String imageServer = (String) request.getSession().getAttribute("imageServer");
map.put("imageServerAddr", imageServer);
map.put("refreshTime", refreshTime);
return "/fxzf/search/list";
}
@ResponseBody
@RequestMapping(value = "list", method = RequestMethod.POST)
public Pagination<Fxzf> list(Pagination<Fxzf> pager, @FormBean(value = "condition", modelCode = "fxzf") Fxzf condition) {
try {
if (pager.getPageNo() < 1 || pager.getPageSize() < 1 || pager.getPageSize() > Pagination.MAX_PAGE_SIZE)
return pager;
// 是否选中只看超限,若选中说明是选择全部违法信息
if (condition.getOverLoadFlag() != null && (!condition.getOverLoadFlag().equals(""))) {
condition.setOverStatus(condition.getOverLoadFlag());
}
condition = editFxzf(condition);
fxzfSearchService.findByPager(pager, condition);
HashMap<String, String> stationMap = DictionaryUtil.dictionary("DETECTIONSTATION", dataDictionaryService);
HashMap<String, String> overLoadMap = DictionaryUtil.dictionary("OVERLOADSTATUS", dataDictionaryService);
HashMap<String, String> punishMap = DictionaryUtil.dictionary("OVERLOADPUNISH", dataDictionaryService);
for (Fxzf fxzf : pager) {
fxzf.setDetectStationFlag(fxzf.getDetectStation());
fxzf.setDetectStation(stationMap.get(fxzf.getDetectStation()));
fxzf.setOverStatus(overLoadMap.get(String.valueOf(fxzf.getOverLoadStatus())));
fxzf.setOverPunish(punishMap.get(String.valueOf(fxzf.getOverLoadPunish())));
fxzf.setOverLoadPercent(StakeUtil.round(fxzf.getOverLoadPercent() * 100,2));
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return pager;
}
@ResponseBody
@RequestMapping(value = "listDetail", method = RequestMethod.POST)
public Pagination<Fxzf> listDatail(Pagination<Fxzf> pager, @FormBean(value = "condition", modelCode = "fxzf") Fxzf condition) {
try {
if (pager.getPageNo() < 1 || pager.getPageSize() < 1 || pager.getPageSize() > Pagination.MAX_PAGE_SIZE)
return pager;
// 是否选中只看超限,若选中说明是选择全部违法信息
if (condition.getOverLoadFlag() != null && (!condition.getOverLoadFlag().equals(""))) {
condition.setOverStatus(condition.getOverLoadFlag());
}
condition = editFxzf(condition);
fxzfSearchService.findByPagerDetail(pager, condition);
HashMap<String, String> stationMap = DictionaryUtil.dictionary("DETECTIONSTATION", dataDictionaryService);
HashMap<String, String> overLoadMap = DictionaryUtil.dictionary("OVERLOADSTATUS", dataDictionaryService);
HashMap<String, String> punishMap = DictionaryUtil.dictionary("OVERLOADPUNISH", dataDictionaryService);
for (Fxzf fxzf : pager) {
fxzf.setDetectStationFlag(fxzf.getDetectStation());
fxzf.setDetectStation(stationMap.get(fxzf.getDetectStation()));
fxzf.setOverStatus(overLoadMap.get(String.valueOf(fxzf.getOverLoadStatus())));
fxzf.setOverPunish(punishMap.get(String.valueOf(fxzf.getOverLoadPunish())));
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return pager;
}
@ResponseBody
@RequestMapping(value = "change", method = RequestMethod.POST)
public AjaxMessage changeLicense(@RequestParam String license, @RequestParam String oldlicense, @RequestParam String id, @RequestParam String color) {
try {
logger.info("****修改前的车牌号:" + oldlicense + "****");
// //更新过车信息表中的数据
Fxzf fxzf = fxzfSearchService.getById(id);
fxzf.setLicense(license);
/************************************************************************
* \ ************************对新的车牌号流程的控制************************ \
* **********************************************************************/
// 判断是否为白名单,1为白名单 返回true说明存在否则不存在
logger.info(fxzf.getLicense() + "判断是否为白名单");
if (!writeRedisService.RedisExistsList(fxzf.getLicense(), fxzf.getLicenseColor(), 1)) {
logger.info(fxzf.getLicense() + "判断是否为黑名单");
// 判断是否为白名单,0为黑名单 返回true说明存在否则不存在
if (!writeRedisService.RedisExistsList(fxzf.getLicense(), fxzf.getLicenseColor(), 0)) {
logger.info(fxzf.getLicense() + "判断是否超限");
// 判断是否超限,overLoadStatus >0 表示超限
if (fxzf.getOverLoadStatus() > 0) {
logger.info(fxzf.getLicense() + "同步至车辆轨迹表");
this.illegalTrailService.syncIllegalTrail(fxzf.getLicense(), fxzf.getLicenseColor());
logger.info(fxzf.getLicense() + "判断是否已经符合黑名单,如果符合则更新黑名单并同步至redis中");
if (this.illegalTrailService.IsAccordBlackList(fxzf.getLicense(), fxzf.getLicenseColor())) {
this.blackListService.syncBlackList(fxzf.getLicense(), fxzf.getLicenseColor());
}
}
} else {
// 如果是黑名单
logger.info(fxzf.getLicense() + "判断是否超限");
// 判断是否超限,overLoadStatus >0 表示超限
if (fxzf.getOverLoadStatus() > 0) {
logger.info(fxzf.getLicense() + "同步数据至车辆轨迹表");
this.illegalTrailService.syncIllegalTrail(fxzf.getLicense(), fxzf.getLicenseColor());
logger.info(fxzf.getLicense() + "更新黑名单");
this.blackListService.syncBlackList(fxzf.getLicense(), fxzf.getLicenseColor());
}
}
// 判断是否超限,告警
if (fxzf.getWarnFlag() == 1) {
// 将告警信息中对应的FXZF_ID的车牌号修改
WarnHistory warn = new WarnHistory();
warn.setFxzfId(fxzf.getId());
warn.setLicense(fxzf.getLicense());
warnHistoryService.update(warn);
}
// 更新过车轨迹表中的信息
fxzfSearchService.update(fxzf);
} else {
// 如果是白名单删除该记录
fxzfSearchService.deleteById(fxzf.getId());
}
/************************************************************************
* \ ************************对旧的车牌号流程的控制************************ \
* **********************************************************************/
fxzf.setLicense(oldlicense);
// 判断是否为空车牌,如果为空车牌不做任何操作
if (!StringUtil.isEmpty(fxzf.getLicense())) {
// 判断是否为黑名单
if (!writeRedisService.RedisExistsList(fxzf.getLicense(), fxzf.getLicenseColor(), 0)) {
// 不是黑名单,判断是否超限
if (fxzf.getOverLoadStatus() > 0) {
// 过车轨迹中该车牌和车牌颜色对应的记录OVERLOAD是否为零
IllegalTrail illegal = illegalTrailService.findByLicenseAndColor(fxzf.getLicense(), fxzf.getLicenseColor());
if (illegal.getOverLoadTimes() == 1) {
// 从过车轨迹中删除该条记录
illegalTrailService.deleteById(illegal.getId());
} else {
// 将过车轨迹的违章次数减1,,同时跟新最后一次违章时间
illegal.setOverLoadTimes(illegal.getOverLoadTimes() - 1);
illegalTrailService.update(illegal);
}
}
} else {
// 是黑名单信息,判断是否为手动添加的黑名单
BlackList black = new BlackList();
if (fxzf.getOverLoadStatus() > 0) {
// 过车轨迹中该车牌和车牌颜色对应的记录OVERLOAD是否为零
IllegalTrail illegal = illegalTrailService.findByLicenseAndColor(fxzf.getLicense(), fxzf.getLicenseColor());
if (illegal.getOverLoadTimes() == 1) {
// 从过车轨迹中删除该条记录
illegalTrailService.deleteById(illegal.getId());
} else {
// 将过车轨迹的违章次数减1,,同时跟新最后一次违章时间
illegal.setOverLoadTimes(illegal.getOverLoadTimes() - 1);
illegalTrailService.update(illegal);
}
// 同步黑名单信息,是否人工添加(0为自动添加,1为人工添加)
black.setLicense(fxzf.getLicense());
black.setPlateColor(fxzf.getLicenseColor());
black = blackListService.findByPlateAndColor(black);
if (black.getAddByOperatorFlag() == 1) {
// 人工添加
black.setOverloadTimes(black.getOverloadTimes() - 1);
blackListService.update(black);
} else {
// 自动添加
// 判断黑名单次数是否超过黑名单阈值
Config config = configService.getByCode(SysConstants.BLACK_LIST_OVERLOADS);
if ((black.getOverloadTimes() - 1) > config.getValue()) {
// 当减"1" > 黑名单阈值的时候,更改该名单阈值的大小
black.setOverloadTimes(black.getOverloadTimes() - 1);
blackListService.update(black);
} else {
// 当减"1" < 黑名单阈值的时候,更改该名单阈值的大小
blackListService.deleteById(black.getId());
// 删除redis中的黑名单
writeRedisService.DeleteListToRedis(black.getId(), black.getLicense(), black.getPlateColor(), 0);
}
}
}
}
}
return AjaxMessage.success(200);
} catch (Exception e) {
e.printStackTrace();
return AjaxMessage.success(1200);
}
}
/**
* 编辑FXZF
*
* @param condition
* @return
*/
public Fxzf editFxzf(Fxzf condition) {
if (condition.getDetectStation() != null && !(condition.getDetectStation().equals("null"))) {
condition.setDetects(condition.getDetectStation().split(","));
} else {
// 如果condition.detectStation为空根据治超站权限进行过滤
Boolean isAdmin = false;
Long jgid = null;
User user = (User) safetyManager.getAuthenticationInfo().getUser();
List<Role> rolelist = this.roleService.findAssigned(user.getId());
if (!CollectionUtils.isEmpty(rolelist)) {
for (Role role : rolelist) {
if ("ROLE_ADMIN".equals(role.getCode()))
isAdmin = true;
}
}
// 如果不是超级管理员,根据JGID设置对应的权限
if (!isAdmin) {
ExtPerson person = personService.getById(user.getPersonId());
jgid = null != person ? person.getJgbh() : null;
if (jgid == 133) {
condition.setDetectStation("1,2");
condition.setDetects(condition.getDetectStation().split(","));
} else if (jgid == 134) {
condition.setDetectStation("3,4,5");
condition.setDetects(condition.getDetectStation().split(","));
} else {
condition.setDetectStation(null);
}
} else {
condition.setDetectStation(null);
}
}
if (condition.getOverStatus() != null && !(condition.getOverStatus().equals("null"))) {
String status[] = condition.getOverStatus().split(",");
Integer[] data = new Integer[status.length];
for (int i = 0; i < status.length; i++) {
data[i] = Integer.valueOf(status[i]);
}
condition.setStatus(data);
} else {
condition.setOverStatus(null);
}
if (condition.getOverPunish() != null && !(condition.getOverPunish().equals("null"))) {
String punishs[] = condition.getOverPunish().split(",");
Integer[] data = new Integer[punishs.length];
for (int i = 0; i < punishs.length; i++) {
data[i] = Integer.valueOf(punishs[i]);
}
condition.setPunish(data);
} else {
condition.setOverPunish(null);
}
return condition;
}
@RequestMapping(value = "check", method = RequestMethod.GET)
public String check(ModelMap map, @ModelAttribute("fxzf") Fxzf fxzfInfo, String flag) {
fxzfInfo = fxzfSearchService.getById(fxzfInfo.getId());
map.put("condition", fxzfInfo);
map.put("flag", flag);
return "/fxzf/search/check";
}
/**
* 审核信息Fxzf
*/
@ResponseBody
@RequestMapping(value = "check", method = RequestMethod.POST)
public AjaxMessage checkFxzfMessage(@FormBean(value = "condition", modelCode = "fxzf") Fxzf condition) {
logger.info("--------------------信息审核--------------------");
try {
// 信息审核完成后更改信息
// HashMap<String, String> reasonMap =
// DictionaryUtil.dictionary("PUNISHREASON",dataDictionaryService);
// if(condition.getPunishReason()!=null){
// condition.setPunishReason(reasonMap.get(condition.getPunishReason()));
// }
this.systemLogService.log(MODULE_CODE, OperateType.check.getCode(), "过车信息列表", request.getRemoteAddr());
fxzfSearchService.checkFxzfMessage(condition);
if (condition.getPunishReason() != null) {
// 审核不通过返回不通过原因
HashMap<String, String> reasonMap = DictionaryUtil.dictionary("PUNISHREASON", dataDictionaryService);
return AjaxMessage.success(reasonMap.get(condition.getPunishReason()));
}
if (condition.getPunishId() != null) {
// 审核通过并且已经处罚
return AjaxMessage.success(condition.getPunishId());
}
return AjaxMessage.success(condition.getId());
} catch (Exception e) {
return AjaxMessage.error("操作失败");
}
}
@RequestMapping(value = "union", method = RequestMethod.GET)
public String union(ModelMap map, @ModelAttribute("fxzf") Fxzf fxzfInfo, String flag) {
fxzfInfo = fxzfSearchService.getById(fxzfInfo.getId());
map.put("condition", fxzfInfo);
map.put("flag", flag);
return "/fxzf/search/union";
}
/**
* 关联处罚信息Fxzf
*/
@ResponseBody
@RequestMapping(value = "union", method = RequestMethod.POST)
public AjaxMessage union(@FormBean(value = "condition", modelCode = "fxzf") Fxzf condition) {
logger.info("--------------------关联处罚信息--------------------");
try {
// 信息审核完成后更改信息
this.systemLogService.log(MODULE_CODE, OperateType.union.getCode(), "过车信息列表", request.getRemoteAddr());
condition.setOverLoadPunish(4);
fxzfSearchService.checkFxzfMessage(condition);
return AjaxMessage.success(condition.getPunishId() + ":" + condition.getId());
} catch (Exception e) {
return AjaxMessage.error("操作失败");
}
}
@RequestMapping(value = "view", method = RequestMethod.GET)
public String view(@RequestParam(required = true) String id, ModelMap model, HttpServletRequest request) {
//查询非现过车详情
Fxzf fxzf = this.fxzfSearchService.getById(id);
if (fxzf.getLength() == -1) {
fxzf.setLength(null);
}
if (fxzf.getWidth() == -1) {
fxzf.setWidth(null);
}
if (fxzf.getHeight() == -1) {
fxzf.setHeight(null);
}
model.put("fxzf", fxzf);
//图片信息
String imageServer = (String) request.getSession().getAttribute("imageServer");
model.put("imageServerAddr", imageServer);
return "/fxzf/search/view";
}
/**
* 获取违法程度
*
* @return
*/
@ResponseBody
@RequestMapping(value = "yhView", method = RequestMethod.POST)
public AjaxMessage yhView(String id) {
try {
//查询非现过车详情
Fxzf fxzf = this.fxzfSearchService.getById(id);
//根据过车车牌查询相关业户id
VehicleInfo vehicleInfo = this.vehicleInfoService.getByPlaneNo(fxzf.getLicense());
//根据业户id查询业户表
YhInfo yhInfo = new YhInfo();
if(vehicleInfo.getYhInfo() != null){
yhInfo = vehicleInfo.getYhInfo();
}
return AjaxMessage.success(yhInfo);
} catch (Exception e) {
return AjaxMessage.error("操作失败");
}
}
@RequestMapping(value = "zfws", method = RequestMethod.GET)
public String zfwh(@RequestParam(required = true) String id, ModelMap model) {
// Fxzf fxzf = this.fxzfSearchService.getById(id);
return "/fxzf/search/zfws";
}
/**
* 获取违法程度
*
* @return
*/
@ResponseBody
@RequestMapping(value = "overLoadStatus", method = RequestMethod.POST)
AjaxMessage getOverLoadStatus() {
try {
HashMap<String, String> stationMap = DictionaryUtil.dictionary("OVERLOADSTATUS", dataDictionaryService);
List<String> stationList = new ArrayList<String>();
for (String key : stationMap.keySet()) {
stationList.add(key + ":" + stationMap.get(key));
}
return AjaxMessage.success(stationList);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return null;
}
/**
* 获取治超站数据
*
* @return
*/
@ResponseBody
@RequestMapping(value = "detectionStation", method = RequestMethod.POST)
AjaxMessage getDetectionStation() {
ZczTree zczTree = zczTreeService.getById((long) 0);
List<ZczTree> zczTrees = zczTreeService.getAllNodes(zczTree);
for (ZczTree node : zczTrees) {
List<ZczTree> zczTreeNodes = zczTreeService.getAllNodes(node);
node.setZczList(zczTreeNodes);
}
zczTree.setZczList(zczTrees);
return AjaxMessage.success(JSON.toJSON(zczTree));
}
/**
* 根据权限获取查询治超站信息
*/
public List<String> getStations() {
HashMap<String, String> stationMap = DictionaryUtil.dictionary("DETECTIONSTATION", dataDictionaryService);
List<String> stationList = new ArrayList<String>();
Boolean isAdmin = false;
Long jgid = null;
// 根据人员来获取查询权限
User user = (User) safetyManager.getAuthenticationInfo().getUser();
List<Role> rolelist = this.roleService.findAssigned(user.getId());
if (!CollectionUtils.isEmpty(rolelist)) {
for (Role role : rolelist) {
if ("ROLE_ADMIN".equals(role.getCode()))
isAdmin = true;
}
}
if (!isAdmin) {
ExtPerson person = personService.getById(user.getPersonId());
jgid = null != person ? person.getJgbh() : null;
// 人员部分权限
// 根据权限设置查询的治超站范围
List<JgZcd> zcdList = jgZcdService.getByJgid(jgid);
for (JgZcd jgZcd : zcdList) {
stationList.add(jgZcd.getDeteStation() + ":" + stationMap.get(jgZcd.getDeteStation()));
}
} else {
// 超级管理员权限
// 所有的治超站权限
for (String key : stationMap.keySet()) {
stationList.add(key + ":" + stationMap.get(key));
}
}
return stationList;
}
/**
* 获取处罚结果
*
* @return
*/
@ResponseBody
@RequestMapping(value = "overLoadPunish", method = RequestMethod.POST)
AjaxMessage getOverLoadPunish() {
try {
HashMap<String, String> stationMap = DictionaryUtil.dictionary("OVERLOADPUNISH", dataDictionaryService);
List<String> stationList = new ArrayList<String>();
for (String key : stationMap.keySet()) {
stationList.add(key + ":" + stationMap.get(key));
}
return AjaxMessage.success(stationList);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return null;
}
/**
* 导出一页Excel
*
* @param request
* @param response
* @param pageNo
* @param condition
*/
@RequestMapping(value = "exportPage", method = RequestMethod.GET)
public void exportExcel(HttpServletRequest request, HttpServletResponse response, String pageNo, @FormBean(value = "condition", modelCode = "fxzf") Fxzf condition) {
logger.info("-------------------------导出本页excel列表---------------");
try {
this.systemLogService.log(MODULE_CODE, OperateType.export.getCode(), "过车信息列表导出当前页", request.getRemoteAddr());
condition = editFxzf(condition);
if (condition.getDetectStation() != null) {
if (condition.getDetectStation().equals("undefined")) {
condition.setDetectStation(null);
}
}
if (condition.getLicense() != null) {
condition.setLicense(java.net.URLDecoder.decode(condition.getLicense(), "utf-8"));
}
if (condition.getLicenseColor() != null) {
condition.setLicenseColor(java.net.URLDecoder.decode(condition.getLicenseColor(), "utf-8"));
}
Pagination<Fxzf> pager = new Pagination<Fxzf>();
pager.setPageNo(Integer.valueOf(pageNo));
pager.setPageSize(15);
Pageable<Fxzf> page = (Pagination<Fxzf>) fxzfSearchService.findByPager(pager, condition);
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
Date date = new Date();
String time = formatter.format(date);
String title = "过车记录查询_" + time + ".xls";
editExcel(page, response, title);
} catch (Exception e) {
e.printStackTrace();
logger.info("-------------------------导出本页excel列表失败---------------");
}
}
@RequestMapping(value = "exportAll", method = RequestMethod.GET)
public void exportAll(HttpServletRequest request, HttpServletResponse response, String total, @FormBean(value = "condition", modelCode = "fxzf") Fxzf condition) {
logger.info("-------------------------导出全部excel列表---------------");
try {
this.systemLogService.log(MODULE_CODE, OperateType.export.getCode(), "过车信息列表导出全部", request.getRemoteAddr());
if (condition.getLicense() != null) {
condition.setLicense(java.net.URLDecoder.decode(condition.getLicense(), "utf-8"));
}
if (condition.getLicenseColor() != null) {
condition.setLicenseColor(java.net.URLDecoder.decode(condition.getLicenseColor(), "utf-8"));
}
condition = editFxzf(condition);
if (condition.getDetectStation() != null) {
if (condition.getDetectStation().equals("undefined")) {
condition.setDetectStation(null);
}
}
Pagination<Fxzf> pager = new Pagination<Fxzf>();
pager.setPageNo(1);
pager.setPageSize(Integer.MAX_VALUE);
Pageable<Fxzf> page = (Pagination<Fxzf>) fxzfSearchService.findByPager(pager, condition);
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
Date date = new Date();
String time = formatter.format(date);
String title = "实时过车记录查询_" + time + ".xls";
editExcel(page, response, title);
} catch (Exception e) {
logger.info("-------------------------导出全部excel列表---------------");
}
}
HSSFCellStyle setHSSFCellStyle(HSSFCellStyle style) {
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
style.setBorderTop(HSSFCellStyle.BORDER_THIN);
return style;
}
void editExcel(Pageable<Fxzf> pager, HttpServletResponse response, String title) {
OutputStream out = null;
try {
response.setHeader("Content-Disposition", "attachment; filename=" + new String(title.getBytes("GB2312"), "iso8859-1"));
response.setContentType("application/msexcel;charset=UTF-8");
out = response.getOutputStream();
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet(UtilTool.toGBK("过车数据查询"));
HSSFRow top = sheet.createRow(0);
HSSFRow row = sheet.createRow(1);
HSSFCellStyle style1 = workbook.createCellStyle();
HSSFCellStyle style2 = workbook.createCellStyle();
HSSFCellStyle style3 = workbook.createCellStyle();
/**************************************** 字体font *********************/
HSSFFont font1 = workbook.createFont();
font1.setColor(HSSFColor.BLACK.index);
font1.setFontHeightInPoints((short) 10);
font1.setBoldweight((short) 24);
font1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
HSSFFont font2 = workbook.createFont();
font2.setColor(HSSFColor.BLACK.index);
font2.setFontHeightInPoints((short) 10);
font2.setBoldweight((short) 24);
style1.setFont(font1);
style1 = setHSSFCellStyle(style1);
style1.setFillBackgroundColor(HSSFColor.AQUA.index);
style1.setFillForegroundColor(HSSFColor.AQUA.index);
style1.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style2.setFont(font2);
style2 = setHSSFCellStyle(style2);
style3.setFont(font1);
style3 = setHSSFCellStyle(style3);
/** 字体居中 **/
style1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style2.setAlignment(HSSFCellStyle.ALIGN_CENTER);
style3.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 设置表头长度
for (int i = 0; i < 14; i++) {
HSSFCell cell = top.createCell(i);
cell.setCellStyle(style3);
}
// 设置表头长度
top.getSheet().addMergedRegion(new Region(0, (short) 0, 0, (short) 13));
HSSFCell celltop = top.createCell(0);
celltop.setCellValue("实时过车数据");
celltop.setCellStyle(style3);
HashMap<String, String> detectionMap = DictionaryUtil.dictionary("DETECTIONSTATION", dataDictionaryService);
HashMap<String, String> punishMap = DictionaryUtil.dictionary("OVERLOADPUNISH", dataDictionaryService);
HashMap<String, String> overLoadMap = DictionaryUtil.dictionary("OVERLOADSTATUS", dataDictionaryService);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String[] head = { "序号", "治超站位置", "方向", "过车时间", "车牌号", "车牌颜色", "轴数", "总重(吨)", "超限量(吨)", "违法程度", "超限率", "车道", "长宽高", "处罚结果" };
int i0 = 0, i1 = 0, i2 = 0, i3 = 0, i4 = 0, i5 = 0, i6 = 0, i7 = 0, i8 = 0, i9 = 0, i10 = 0, i11 = 0, i12 = 0, i13 = 0;
for (int i = 0; i < head.length; i++) {
HSSFCell cell = row.createCell(i);
cell.setCellValue(head[i]);
cell.setCellStyle(style1);
if (i == 0) {
i0 = head[i].length() * 256 + 256 * 10;
}
if (i == 1) {
i1 = head[i].length() * 256 + 256 * 20;
}
if (i == 2) {
i2 = head[i].length() * 256 + 256 * 10;
}
if (i == 3) {
i3 = head[i].length() * 256 + 256 * 10;
}
if (i == 4) {
i4 = head[i].length() * 256 + 256 * 10;
}
if (i == 5) {
i5 = head[i].length() * 256 + 256 * 10;
}
if (i == 6) {
i6 = head[i].length() * 256 + 256 * 10;
}
if (i == 7) {
i7 = head[i].length() * 256 + 256 * 10;
}
if (i == 8) {
i8 = head[i].length() * 256 + 256 * 10;
}
if (i == 9) {
i9 = head[i].length() * 256 + 256 * 10;
}
if (i == 10) {
i10 = head[i].length() * 256 + 256 * 10;
}
if (i == 11) {
i11 = head[i].length() * 256 + 256 * 10;
}
if (i == 12) {
i12 = head[i].length() * 256 + 256 * 10;
}
if (i == 13) {
i13 = head[i].length() * 256 + 256 * 10;
}
}
for (int i = 0; i < pager.size(); i++) {
row = sheet.createRow(i + 2);
// 序号
HSSFCell cell0 = row.createCell(0);
cell0.setCellValue(1 + i);
cell0.setCellStyle(style2);
if (String.valueOf(1 + i).length() * 256 >= i0) {
i0 = String.valueOf(1 + i).length() * 256 + 256 * 8;
}
// 治超站位置
HSSFCell cell1 = row.createCell(1);
cell1.setCellStyle(style1);
if (pager.get(i).getDetectStation() != null) {
cell1.setCellValue("永嘉治超站");
if (detectionMap.get(pager.get(i).getDetectStation()).length() * 156 >= i1) {
i1 = detectionMap.get(pager.get(i).getDetectStation()).length() * 156 + 156 * 30;
}
} else {
cell1.setCellValue("");
}
// 治超站方向
HSSFCell cell2 = row.createCell(2);
cell2.setCellStyle(style2);
if (pager.get(i).getDetectStation() != null) {
cell2.setCellValue(detectionMap.get(pager.get(i).getDetectStation()));
if (detectionMap.get(pager.get(i).getDetectStation()).length() * 256 >= i2) {
i2 = detectionMap.get(pager.get(i).getDetectStation()).length() * 256 + 256 * 20;
}
} else {
cell2.setCellValue("");
}
// // 过车时间
HSSFCell cell3 = row.createCell(3);
cell3.setCellStyle(style3);
if (pager.get(i).getCaptureTime() != null) {
cell3.setCellValue(format.format(pager.get(i).getCaptureTime()));
if (format.format(pager.get(i).getCaptureTime()).length() * 356 >= i3) {
i3 = format.format(pager.get(i).getCaptureTime()).length() * 356 + 356 * 10;
}
} else {
cell3.setCellValue("");
}
// // 车牌号
HSSFCell cell4 = row.createCell(4);
cell4.setCellStyle(style2);
if (pager.get(i).getLicense() != null) {
cell4.setCellValue(pager.get(i).getLicense());
if (pager.get(i).getLicense().length() * 256 >= i4) {
i4 = pager.get(i).getLicense().length() * 256 + 256 * 10;
}
} else {
cell4.setCellValue("");
}
// // 车牌颜色
HSSFCell cell5 = row.createCell(5);
cell5.setCellStyle(style2);
if (pager.get(i).getLicenseColor() != null) {
cell5.setCellValue(pager.get(i).getLicenseColor());
if (pager.get(i).getLicenseColor().length() * 256 >= i5) {
i5 = pager.get(i).getLicenseColor().length() * 256 + 256 * 8;
}
} else {
cell5.setCellValue("");
}
// // 轴数
HSSFCell cell6 = row.createCell(6);
cell6.setCellStyle(style2);
if (pager.get(i).getAxisCount() != null) {
cell6.setCellValue(pager.get(i).getAxisCount());
} else {
cell6.setCellValue("");
}
// // 总重
HSSFCell cell7 = row.createCell(7);
cell7.setCellStyle(style2);
if (pager.get(i).getWeight() != null) {
cell7.setCellValue(pager.get(i).getWeight());
} else {
cell7.setCellValue("");
}
// // 超限量(吨)
HSSFCell cell8 = row.createCell(8);
cell8.setCellStyle(style2);
if (pager.get(i).getOverLoad() != null) {
cell8.setCellValue(pager.get(i).getOverLoad());
} else {
cell8.setCellValue("");
}
// // 违法程度
HSSFCell cell9 = row.createCell(9);
cell9.setCellStyle(style2);
if (pager.get(i).getOverLoadPercent() != null) {
cell9.setCellValue(overLoadMap.get(String.valueOf(pager.get(i).getOverLoadStatus())));
} else {
cell9.setCellValue("");
}
// // 超限率
HSSFCell cell10 = row.createCell(10);
cell10.setCellStyle(style2);
if (pager.get(i).getOverLoadPercent() != null) {
cell10.setCellValue(pager.get(i).getOverLoadPercent());
} else {
cell10.setCellValue("");
}
// // 车道
HSSFCell cell11 = row.createCell(11);
cell11.setCellStyle(style2);
if (pager.get(i).getLane() != null) {
cell11.setCellValue(pager.get(i).getLane());
} else {
cell11.setCellValue("");
}
// // 长宽高
HSSFCell cell12 = row.createCell(12);
cell12.setCellStyle(style2);
if (pager.get(i).getOverLoadPunish() != null) {
String length = null;
if (pager.get(i).getLength() == null || String.valueOf(pager.get(i).getLength()).equals("null")) {
length = "";
} else {
length = String.valueOf(pager.get(i).getLength());
}
String width = null;
if (pager.get(i).getWidth() == null || String.valueOf(pager.get(i).getWidth()).equals("null")) {
width = "";
} else {
width = String.valueOf(pager.get(i).getWidth());
}
String height = null;
if (pager.get(i).getHeight() == null || String.valueOf(pager.get(i).getHeight()).equals("null")) {
height = "";
} else {
height = String.valueOf(pager.get(i).getHeight());
}
cell12.setCellValue(length + "*" + width + "*" + height);
if (punishMap.get(String.valueOf(pager.get(i).getOverLoadPunish())).length() * 256 >= i12) {
i12 = punishMap.get(String.valueOf(pager.get(i).getOverLoadPunish())).length() * 256 + 256 * 12;
}
} else {
cell12.setCellValue("");
}
// // 处罚结果
HSSFCell cell13 = row.createCell(13);
cell13.setCellStyle(style2);
if (pager.get(i).getOverLoadPunish() != null) {
cell13.setCellValue(punishMap.get(String.valueOf(pager.get(i).getOverLoadPunish())));
} else {
cell13.setCellValue("");
}
}
sheet.setColumnWidth(0, i0);
sheet.setColumnWidth(1, i1);
sheet.setColumnWidth(2, i2);
sheet.setColumnWidth(3, i3);
sheet.setColumnWidth(4, i4);
sheet.setColumnWidth(5, i5);
sheet.setColumnWidth(6, i6);
sheet.setColumnWidth(7, i7);
sheet.setColumnWidth(8, i8);
sheet.setColumnWidth(9, i9);
sheet.setColumnWidth(10, i10);
sheet.setColumnWidth(11, i11);
sheet.setColumnWidth(12, i12);
sheet.setColumnWidth(13, i13);
workbook.write(out);
out.flush();
out.close();
} catch (Exception e) {
logger.error("---------------数据导出失败--------");
e.printStackTrace();
}
}
}
|
package com.cg.project.castleglobalproject.search.comparators;
import com.cg.project.castleglobalproject.search.network.pojo.Restaurant;
import java.util.Comparator;
/**
* Created by sam on 7/9/17.
*/
public class RestaurantRatingComparator implements Comparator<Restaurant> {
@Override
public int compare(Restaurant o1, Restaurant o2) {
try {
float r1 = Float.parseFloat(o1.restaurant.user_rating.aggregate_rating);
float r2 = Float.parseFloat(o2.restaurant.user_rating.aggregate_rating);
if (r1 > r2)
return 1;
else if (r1 < r2)
return -1;
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.cmsfacades.rendering.visibility.impl;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.cms2.model.contents.components.AbstractCMSComponentModel;
import de.hybris.platform.cms2.model.restrictions.AbstractRestrictionModel;
import de.hybris.platform.cms2.servicelayer.data.RestrictionData;
import de.hybris.platform.cms2.servicelayer.services.CMSRestrictionService;
import de.hybris.platform.cmsfacades.rendering.RestrictionContextProvider;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.Arrays;
import java.util.Collections;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
@UnitTest
@RunWith(MockitoJUnitRunner.class)
public class CMSComponentRenderingVisibilityRuleTest
{
@InjectMocks
private CMSComponentRenderingVisibilityRule renderingVisibilityRule;
@Mock
private AbstractRestrictionModel restrictionModel;
@Mock
private AbstractCMSComponentModel component;
@Mock
private RestrictionContextProvider restrictionContextProvider;
@Mock
private RestrictionData restrictionData;
@Mock
private CMSRestrictionService cmsRestrictionService;
@Before
public void setUp()
{
when(cmsRestrictionService.evaluateCMSComponent(component, restrictionData)).thenReturn(true);
when(restrictionContextProvider.getRestrictionInContext()).thenReturn(restrictionData);
when(component.getRestrictions()).thenReturn(Arrays.asList(restrictionModel));
when(component.getVisible()).thenReturn(true);
}
@Test
public void shouldReturnFalseIfComponentIsInvisible()
{
// GIVEN
makeComponentInvisible(component);
// WHEN
boolean result = renderingVisibilityRule.isVisible(component);
// THEN
assertFalse(result);
}
@Test
public void shouldReturnFalseIfComponentIsRestricted()
{
// GIVEN
restrictComponent(component);
// WHEN
boolean result = renderingVisibilityRule.isVisible(component);
// THEN
assertFalse(result);
}
@Test
public void shouldReturnTrueIfComponentIsNotRestrictedAndIsVisible()
{
// GIVEN
removeRestrictionsFromComponent(component);
// WHEN
boolean result = renderingVisibilityRule.isVisible(component);
// THEN
assertTrue(result);
}
@Test
public void shouldReturnTrueIfVisiblityIsNullAndNoRestrictions()
{
// WHEN
makeComponentVisibilityNull(component);
// WHEN
boolean result = renderingVisibilityRule.isVisible(component);
// THEN
assertTrue(result);
}
@Test
public void shouldReturnTrueIfComponentIsVisibleAndNoApplicableRestrictions()
{
// WHEN
boolean result = renderingVisibilityRule.isVisible(component);
// THEN
assertTrue(result);
}
protected void restrictComponent(AbstractCMSComponentModel component)
{
when(cmsRestrictionService.evaluateCMSComponent(component, restrictionData)).thenReturn(false);
}
protected void makeComponentInvisible(AbstractCMSComponentModel component)
{
when(component.getVisible()).thenReturn(false);
}
protected void makeComponentVisibilityNull(AbstractCMSComponentModel component)
{
when(component.getVisible()).thenReturn(null);
}
protected void removeRestrictionsFromComponent(AbstractCMSComponentModel component)
{
when(component.getRestrictions()).thenReturn(Collections.emptyList());
}
}
|
package com.tencent.mm.plugin.fts;
import android.util.Log;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.fts.a.a.a;
import com.tencent.mm.plugin.fts.a.e;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.storage.aa;
import java.io.File;
class PluginFTS$b extends a {
final /* synthetic */ PluginFTS jpM;
private PluginFTS$b(PluginFTS pluginFTS) {
this.jpM = pluginFTS;
}
/* synthetic */ PluginFTS$b(PluginFTS pluginFTS, byte b) {
this(pluginFTS);
}
public final boolean execute() {
g.Ek();
if (2 != ((Integer) g.Ei().DT().get(aa.a.sXU, Integer.valueOf(0))).intValue()) {
d.aPR();
g.Ek();
g.Ei().DT().a(aa.a.sXU, Integer.valueOf(2));
}
g.Ek();
File file = new File(g.Ei().cachePath, "IndexMicroMsg.db");
if (file.exists()) {
file.delete();
}
try {
PluginFTS pluginFTS = this.jpM;
g.Ek();
PluginFTS.access$202(pluginFTS, new d(g.Ei().cachePath));
PluginFTS.access$600(this.jpM);
PluginFTS.access$700(this.jpM);
PluginFTS.access$800(this.jpM);
PluginFTS.access$900(this.jpM);
} catch (Throwable e) {
if (!PluginFTS.jpy) {
x.printErrStackTrace("MicroMsg.FTS.PluginFTS", e, "Index database corruption detected", new Object[0]);
e.qd(19);
PluginFTS.access$300(this.jpM);
PluginFTS.access$400(this.jpM);
PluginFTS.access$200(this.jpM).close();
d.aPR();
h.mEJ.c("FTS", "InitSearchTask: " + Log.getStackTraceString(e), null);
}
}
return true;
}
public final String getName() {
return "InitSearchTask";
}
}
|
package state;
public class Rapido extends Estado {
public Rapido() {
}
public float getDaņo(float daņoBase) {
return daņoBase;
}
public int getVelocidad(int velBase) {
return velBase*2;
}
public float recibirDaņo(float daņoBase) {
return daņoBase;
}
}
|
package com.geekbrains.server.entities;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.geekbrains.gwt.common.TaskDto;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
@NoArgsConstructor
@Entity
@Table(name = "tasks")
@Data
public class Task {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "s_task_id")
@SequenceGenerator(name = "s_task_id", sequenceName = "s_task_id", allocationSize = 1)
private Long id;
private String title;
private String description;
@ManyToOne
@JoinColumn(name = "owner",referencedColumnName="id")
@JsonManagedReference
private User owner;
@ManyToOne
@JoinColumn(name = "executor",referencedColumnName="id")
@JsonManagedReference
private User executor;
@Column(name = "status")
@Enumerated(javax.persistence.EnumType.STRING)
private TaskStatus status;
public Task(TaskDto taskDto){
this.title = taskDto.getTitle();
this.description = taskDto.getDescription();
this.executor = new User(taskDto.getExecutor());
this.owner = new User(taskDto.getOwner());
this.status = TaskStatus.CREATED;
}
public void setId(Long id) {
this.id = id;
}
public void setTitle(String title) {
this.title = title;
}
public void setOwner(User owner) {
this.owner = owner;
}
public void setExecutor(User executor) {
this.executor = executor;
}
public void setDescription(String description) {
this.description = description;
}
public Long getId() {
return id;
}
public User getOwner() {
return owner;
}
public User getExecutor() {
return executor;
}
public String getDescription() {
return description;
}
public TaskStatus getStatus() {
return status;
}
public void setStatus(TaskStatus status) {
this.status = status;
}
public String getTitle() {
return title;
}
@Override
public String toString() {
return "title: " + title + ", status: " + status + ", owner: " + owner + ", executor: " + executor;
}
@Override
public int hashCode() {
return id.hashCode() + title.hashCode();
}
//это нетбинс сгенерил, идею мне до сих пор не поставили=( на вид норм реализация по умолчанию
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Task other = (Task) obj;
if (this.id != other.id) {
return false;
}
return true;
}
}
|
package pers.pbyang.connection;
import pers.pbyang.connection.DatabaseConnection;
import pers.pbyang.connection.MySQLDatabaseConnection;
public class DatabaseConnectionFactory {
public static DatabaseConnection getDatabaseConnection() {
return new MySQLDatabaseConnection();
}
}
|
package Controlador;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import Vista.SeleccionFRM;
public class controladorSeleccion {
SeleccionFRM ventana;
public controladorSeleccion() {
ventana = new SeleccionFRM();
ventana.btnProfesor.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
ventana.setVisible(false);
controladorLobbyProfesor nuevaVentana = new controladorLobbyProfesor();
}
});
ventana.btnEstudiante.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
ventana.setVisible(false);
controladorCodigoPrueba ventanax = new controladorCodigoPrueba();
}
});
}
}
|
package com.machine.learning.house.explore;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jsoup.helper.StringUtil;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import com.machine.learning.explore.Explore;
import com.machine.learning.explore.web.WebExplore;
import com.machine.learning.house.bean.AnJuKeHoseEvt;
import com.machine.learning.storage.service.HouseService;
import net.sf.json.JSONObject;
public class ZYDCExplore extends WebExplore{
}
|
package com.mes.old.meta;
// Generated 2017-5-22 1:25:24 by Hibernate Tools 5.2.1.Final
import java.math.BigDecimal;
/**
* IWarebin generated by hbm2java
*/
public class IWarebin implements java.io.Serializable {
private IWarebinId id;
private String binname;
private BigDecimal maxbinqty;
private String binmanager;
private String bintype;
private String parentbinid;
private String binposition;
private String partNumber;
private Byte freezed;
private String deptid;
private String ipAddress;
private Byte binstate;
public IWarebin() {
}
public IWarebin(IWarebinId id) {
this.id = id;
}
public IWarebin(IWarebinId id, String binname, BigDecimal maxbinqty, String binmanager, String bintype,
String parentbinid, String binposition, String partNumber, Byte freezed, String deptid, String ipAddress,
Byte binstate) {
this.id = id;
this.binname = binname;
this.maxbinqty = maxbinqty;
this.binmanager = binmanager;
this.bintype = bintype;
this.parentbinid = parentbinid;
this.binposition = binposition;
this.partNumber = partNumber;
this.freezed = freezed;
this.deptid = deptid;
this.ipAddress = ipAddress;
this.binstate = binstate;
}
public IWarebinId getId() {
return this.id;
}
public void setId(IWarebinId id) {
this.id = id;
}
public String getBinname() {
return this.binname;
}
public void setBinname(String binname) {
this.binname = binname;
}
public BigDecimal getMaxbinqty() {
return this.maxbinqty;
}
public void setMaxbinqty(BigDecimal maxbinqty) {
this.maxbinqty = maxbinqty;
}
public String getBinmanager() {
return this.binmanager;
}
public void setBinmanager(String binmanager) {
this.binmanager = binmanager;
}
public String getBintype() {
return this.bintype;
}
public void setBintype(String bintype) {
this.bintype = bintype;
}
public String getParentbinid() {
return this.parentbinid;
}
public void setParentbinid(String parentbinid) {
this.parentbinid = parentbinid;
}
public String getBinposition() {
return this.binposition;
}
public void setBinposition(String binposition) {
this.binposition = binposition;
}
public String getPartNumber() {
return this.partNumber;
}
public void setPartNumber(String partNumber) {
this.partNumber = partNumber;
}
public Byte getFreezed() {
return this.freezed;
}
public void setFreezed(Byte freezed) {
this.freezed = freezed;
}
public String getDeptid() {
return this.deptid;
}
public void setDeptid(String deptid) {
this.deptid = deptid;
}
public String getIpAddress() {
return this.ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public Byte getBinstate() {
return this.binstate;
}
public void setBinstate(Byte binstate) {
this.binstate = binstate;
}
}
|
module de.unibonn.geoinfo.isochrones {
requires de.unibonn.geoinfo.ipeio;
requires de.unibonn.geoinfo.util;
requires de.unibonn.geoinfo.gisviewer;
requires java.desktop;
requires jts;
requires jump.core;
requires kd;
requires jdom;
}
|
package Kap1;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class LocalHost {
public static void main(String[] args) throws UnknownHostException {
InetAddress local = InetAddress.getLocalHost();
System.out.printf("Host name: %s\nIP Address: %s\n", local.getHostName(), local.getHostAddress());
}
}
|
package WebCrawle.Stage1.Stage1;
import javax.swing.*;
public class WebCrawler extends JFrame {
public WebCrawler() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300, 300);
setLocationRelativeTo(null);
JTextArea text = new JTextArea();
text.setName("TextArea");
text.setBounds(10,10, getWidth() - 35, getHeight() - 55);
add(text);
setLayout(null);
setVisible(true);
}
}
|
package entities.events;
import entities.person.Organizer;
import entities.locations.Location;
import services.Service;
import java.util.Objects;
public abstract class Event {
protected String date;
protected Hour start_time;
protected Hour end_time;
protected Organizer organizer;
protected Location location;
protected float ticket_price;
public Event() {} // Empty constructor
public Event(String date, Hour start_time, Hour end_time, Organizer organizer, Location location, float ticket_price) {
this.date = date;
this.start_time = start_time;
this.end_time = end_time;
this.organizer = organizer;
this.location = location;
this.ticket_price = ticket_price;
Service.all_events.add(this);
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public Hour getStart_time() {
return start_time;
}
public void setStart_time(Hour start_time) {
this.start_time = start_time;
}
public Hour getEnd_time() {
return end_time;
}
public void setEnd_time(Hour end_time) {
this.end_time = end_time;
}
public Organizer getOrganizer() {
return organizer;
}
public void setOrganizer(Organizer organizer) {
this.organizer = organizer;
}
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}
public float getTicket_price() {
return ticket_price;
}
public void setTicket_price(float ticket_price) {
this.ticket_price = ticket_price;
}
@Override
public String toString() {
return "Date = " + date + "; Start time = " + start_time + "; End time = " + end_time + "; Organizer: " + organizer.toString() + "; Location: " + location.toString() + "; Ticket price: " + ticket_price;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Event)) return false;
Event event = (Event) o;
return Float.compare(event.ticket_price, ticket_price) == 0 && Objects.equals(date, event.date) && Objects.equals(start_time, event.start_time) && Objects.equals(end_time, event.end_time) && Objects.equals(organizer, event.organizer) && Objects.equals(location, event.location);
}
@Override
public int hashCode() {
return Objects.hash(date, start_time, end_time, organizer, location, ticket_price);
}
public abstract String getName();
protected abstract float calcMaxProfit(); // Abstract method
protected abstract float calcEventDuration(); // Abstract method
protected abstract float calcEventProfit(); // Abstract method
}
|
/*
Copyright (C) 2009, Bioingenium Research Group
http://www.bioingenium.unal.edu.co
Author: Alexander Pinzon Fernandez
JNukak3D is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
JNukak3D is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with JNukak3D; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,
or see http://www.gnu.org/copyleft/gpl.html
*/
package edu.co.unal.bioing.jnukak3d.Dicom.ui;
import edu.co.unal.bioing.jnukak3d.Dicom.nkDicomNodeTree;
import edu.co.unal.bioing.jnukak3d.event.nkEvent;
import edu.co.unal.bioing.jnukak3d.event.nkEventListener;
import edu.co.unal.bioing.jnukak3d.event.nkEventGenerator;
import edu.co.unal.bioing.jnukak3d.nkDebug;
import edu.co.unal.bioing.jnukak3d.Dicom.io.nkDicomImport;
import javax.swing.JDialog;
import javax.swing.WindowConstants;
import jwf.Wizard;
import jwf.WizardListener;
import java.util.Vector;
import javax.swing.JFrame;
/**
*
* @author Alexander Pinzon Fernandez
*/
public class nkWizardDicomImport extends JDialog implements WizardListener, nkEventGenerator{
protected static final boolean DEBUG = nkDebug.DEBUG;
public nkWizardDicomImport(JFrame parent) {
super(parent);
Wizard nkw = new Wizard();
nkw.addWizardListener(this);
setTitle("jNukak3D: Dicom import");
this.setContentPane(nkw);
nkWizardPage1 page1 = new nkWizardPage1();
nkw.start(page1);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
pack();
setVisible(true);
}
/** Called when the wizard finishes.
* @param wizard the wizard that finished.
*/
public void wizardFinished(Wizard wizard) {
firenkMenuEvent(wizard);
dispose();
}
/** Called when the wizard is cancelled.
* @param wizard the wizard that was cancelled.
*/
public void wizardCancelled(Wizard wizard) {
dispose();
}
/** Called when a new panel has been displayed in the wizard.
* @param wizard the wizard that was updated
*/
public void wizardPanelChanged(Wizard wizard) {
if(DEBUG)
System.out.println("wizard new panel");
}
private Vector prv_nkEvent_listeners;
final synchronized public void addnkEventListener (nkEventListener pl) {
if( null == prv_nkEvent_listeners)
prv_nkEvent_listeners = new Vector();
if( null == pl || prv_nkEvent_listeners.contains( pl))
return;
prv_nkEvent_listeners.addElement( pl);
}
final synchronized public void removenkEventListener (nkEventListener pl) {
if( null != prv_nkEvent_listeners && null != pl)
prv_nkEvent_listeners.removeElement( pl);
}
public void firenkMenuEvent(Wizard wizard){
if( null == prv_nkEvent_listeners) return;
nkDicomNodeTree selectedNode;
selectedNode = ((nkDicomNodeTree)(wizard.getWizardContext().getAttribute("nkDicomNodeTreeSelected")));
nkDicomImport nkio;
nkio = ((nkDicomImport)(wizard.getWizardContext().getAttribute("nkDicomImport")));
if(nkio == null || selectedNode == null) return;
nkEvent e = new nkEvent(this);
e.setAttribute("nkDicomNodeTreeSelected", selectedNode);
e.setAttribute("nkDicomImportSelected", nkio);
for( int i= 0; i < prv_nkEvent_listeners.size(); ++i)
((nkEventListener)prv_nkEvent_listeners.elementAt( i)).nkEventInvoke(e);
}
}
|
import regAcadUtil.*;
import java.util.*;
//@ import org.jmlspecs.models.JMLEqualsEqualsPair;
//@ import org.jmlspecs.models.JMLEqualsToEqualsRelation;
//@ import org.jmlspecs.models.JMLEqualsToEqualsMap;
//@ import org.jmlspecs.models.JMLType;
//@ import org.jmlspecs.models.JMLInteger;
//@ import org.jmlspecs.models.JMLString;
public interface RegAcadInterface
{
//@ public model instance JMLEqualsToEqualsRelation cursadas;
//@ public model instance JMLEqualsToEqualsMap califs;
/*@ public instance invariant
@ (\forall JMLEqualsEqualsPair p
@ ; this.cursadas.has(p)
@ ; p.key instanceof JMLString && p.value instanceof JMLString);
@ public instance invariant
@ (\forall JMLEqualsEqualsPair p
@ ; this.califs.has(p)
@ ; p.key instanceof JMLEqualsEqualsPair &&
@ p.value instanceof JMLInteger);
@ public instance invariant
@ (\forall JMLString x
@ ; this.cursadas.domain().has(x)
@ ; Especificaciones.esCarne(x.toString()));
@ public instance invariant
@ (\forall JMLString x
@ ; this.cursadas.range().has(x)
@ ; Especificaciones.esCodigo(x.toString()));
@ public instance invariant
@ this.califs.domain().equals(this.cursadas);
@ public instance invariant
@ (\forall JMLInteger x
@ ; this.califs.range().has(x)
@ ; 1 <= x.intValue() && x.intValue() <= 20);
@*/
/*@ public normal_behavior
@ requires
@ Especificaciones.esCarne(e);
@ requires
@ Especificaciones.esCodigo(a);
@ requires
@ 1 <= c && c <= 20;
@ requires
@ !this.cursadas.has(new JMLEqualsEqualsPair(
@ new JMLString(e),
@ new JMLString(a))
@ );
@ ensures
@ this.califs.equals(\old(this.califs.extend(
@ new JMLEqualsEqualsPair(new JMLString(e),
@ new JMLString(a)), new JMLInteger(c)))
@ );
@ assignable cursadas, califs;
@ also public exceptional_behavior
@ requires
@ !Especificaciones.esCarne(e)
@ ||
@ !Especificaciones.esCodigo(a)
@ ||
@ !(1 <= c && c <= 20)
@ ||
@ this.cursadas.has(new JMLEqualsEqualsPair(
@ new JMLString(e),
@ new JMLString(a))
@ );
@ signals_only ExcepcionEstudianteInvalido,
@ ExcepcionAsignaturaInvalida,
@ ExcepcionCalificacionInvalida,
@ ExcepcionCalificacionYaRegistrada;
@ signals(ExcepcionEstudianteInvalido) !Especificaciones.esCarne(e);
@ signals(ExcepcionAsignaturaInvalida) !Especificaciones.esCodigo(a);
@ signals(ExcepcionCalificacionInvalida) !(1 <= c && c <= 20);
@ signals(ExcepcionCalificacionYaRegistrada)
@ Especificaciones.esCarne(e) && Especificaciones.esCodigo(a)
@ &&
@ (1 <= c && c <= 20)
@ &&
@ this.cursadas.has(new JMLEqualsEqualsPair(
@ new JMLString(e),
@ new JMLString(a))
@ );
@ assignable \nothing;
@*/
public void agregar(final String e, final String a, final int c)
throws ExcepcionEstudianteInvalido,
ExcepcionAsignaturaInvalida,
ExcepcionCalificacionInvalida,
ExcepcionCalificacionYaRegistrada;
/*@ public normal_behavior
@ requires
@ Especificaciones.esCarne(e);
@ requires
@ Especificaciones.esCodigo(a);
@ requires
@ this.cursadas.has(new JMLEqualsEqualsPair(
@ new JMLString(e),
@ new JMLString(a))
@ );
@ ensures
@ this.cursadas.equals(\old(this.cursadas.remove(
@ new JMLEqualsEqualsPair(new JMLString(e),
@ new JMLString(a))))
@ );
@ assignable cursadas, califs;
@ also public exceptional_behavior
@ requires
@ !Especificaciones.esCarne(e)
@ ||
@ !Especificaciones.esCodigo(a)
@ ||
@ !this.cursadas.has(new JMLEqualsEqualsPair(
@ new JMLString(e),
@ new JMLString(a))
@ );
@ signals_only ExcepcionEstudianteInvalido,
@ ExcepcionAsignaturaInvalida,
@ ExcepcionCursoNoRegistrado;
@ signals(ExcepcionEstudianteInvalido) !Especificaciones.esCarne(e);
@ signals(ExcepcionAsignaturaInvalida) !Especificaciones.esCodigo(a);
@ signals(ExcepcionCursoNoRegistrado)
@ Especificaciones.esCarne(e) && Especificaciones.esCodigo(a)
@ &&
@ !this.cursadas.has(new JMLEqualsEqualsPair(
@ new JMLString(e),
@ new JMLString(a))
@ );
@ assignable \nothing;
@*/
public void eliminar(final String e, final String a)
throws ExcepcionEstudianteInvalido,
ExcepcionAsignaturaInvalida,
ExcepcionCursoNoRegistrado;
/*@ public normal_behavior
@ requires
@ Especificaciones.esCarne(e);
@ requires
@ (\exists JMLEqualsEqualsPair p
@ ; this.cursadas.has(p)
@ ; p.key.equals(new JMLString(e)));
@ ensures
@ (* Esta escrita en pantalla la lista, ordenada por asignatura y
@ sin repeticiones, que contiene todos los pares del conjunto
@ de asignaturas cursadas por el estudiante de carnet e *);
@ assignable System.out.output;
@ also public exceptional_behavior
@ requires
@ !Especificaciones.esCarne(e)
@ ||
@ !(\exists JMLEqualsEqualsPair p
@ ; this.cursadas.has(p)
@ ; p.key.equals(new JMLString(e)));
@ signals_only ExcepcionEstudianteInvalido,
@ ExcepcionEstudianteNoRegistrado;
@ signals(ExcepcionEstudianteInvalido) !Especificaciones.esCarne(e);
@ signals(ExcepcionEstudianteNoRegistrado)
@ Especificaciones.esCarne(e)
@ &&
@ !(\exists JMLEqualsEqualsPair p
@ ; this.cursadas.has(p)
@ ; p.key.equals(new JMLString(e)));
@ assignable \nothing;
@*/
public void ListarAsignaturasPorEstudiante(final String e)
throws ExcepcionEstudianteInvalido,
ExcepcionEstudianteNoRegistrado;
/*@ public normal_behavior
@ requires
@ Especificaciones.esCodigo(a);
@ requires
@ (\exists JMLEqualsEqualsPair p
@ ; this.cursadas.has(p)
@ ; p.value.equals(new JMLString(a)));
@ ensures
@ (* Esta escrita en pantalla la lista, ordenada por carne y sin
@ repeticiones, que contiene todos los pares del conjunto de
@ estudiantes que han cursado la asignatura cuyo codigo es a *);
@ assignable System.out.output;
@ also public exceptional_behavior
@ requires
@ !Especificaciones.esCodigo(a)
@ ||
@ !(\exists JMLEqualsEqualsPair p
@ ; this.cursadas.has(p)
@ ; p.value.equals(new JMLString(a)));
@ signals_only ExcepcionAsignaturaInvalida,
@ ExcepcionAsignaturaNoRegistrada;
@ signals(ExcepcionAsignaturaInvalida) !Especificaciones.esCodigo(a);
@ signals(ExcepcionAsignaturaNoRegistrada)
@ Especificaciones.esCodigo(a)
@ &&
@ !(\exists JMLEqualsEqualsPair p
@ ; this.cursadas.has(p)
@ ; p.value.equals(new JMLString(a)));
@ assignable \nothing;
@*/
public void ListarEstudiantesPorAsignatura(final String a)
throws ExcepcionAsignaturaInvalida,
ExcepcionAsignaturaNoRegistrada;
/*@ public normal_behavior
@ requires true;
@ ensures
@ (* iteradorAsignaturaEstudiante contiene la secuencia ordenada por
@ estudiante/asignatura y sin repeticiones, formada por todas las
@ tripletas del conjunto*);
@ assignable \nothing;
@*/
public Iterator iteradorEstudianteAsignatura();
/*@ public normal_behavior
@ requires true;
@ ensures
@ (* iteradorAsignaturaEstudiante contiene la secuencia ordenada por
@ asignatura/estudiante y sin repeticiones, formada por todas las
@ tripletas del conjunto*);
@ assignable \nothing;
@*/
public Iterator iteradorAsignaturaEstudiante();
}
|
package com.wannajob.core.models;
public class UserNotification {
public void setId(int id) {
// TODO Auto-generated method stub
}
public void setEmail(String email) {
// TODO Auto-generated method stub
}
public void setPhoneNo(Object phoneNo) {
// TODO Auto-generated method stub
}
public void setStatus(String userNotificationStatus) {
// TODO Auto-generated method stub
}
public void setMsgParams(String[] msgParams) {
// TODO Auto-generated method stub
}
public void setWebMsgParams(String[] webmsgParams) {
// TODO Auto-generated method stub
}
}
|
package Project3;
public interface Human {
public void breadth();
}
|
package tkhub.project.kesbewa.databinding;
import tkhub.project.kesbewa.R;
import tkhub.project.kesbewa.BR;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.view.View;
@SuppressWarnings("unchecked")
public class ListviewOrdersBindingImpl extends ListviewOrdersBinding {
@Nullable
private static final androidx.databinding.ViewDataBinding.IncludedLayouts sIncludes;
@Nullable
private static final android.util.SparseIntArray sViewsWithIds;
static {
sIncludes = null;
sViewsWithIds = new android.util.SparseIntArray();
sViewsWithIds.put(R.id.appCompatTextView3, 20);
sViewsWithIds.put(R.id.appCompatTextView4, 21);
sViewsWithIds.put(R.id.appCompatTextView6, 22);
sViewsWithIds.put(R.id.appCompatTextView8, 23);
sViewsWithIds.put(R.id.appCompatTextView66, 24);
sViewsWithIds.put(R.id.view_1, 25);
sViewsWithIds.put(R.id.constraintLayout9, 26);
sViewsWithIds.put(R.id.guideline_1, 27);
sViewsWithIds.put(R.id.guideline_2, 28);
sViewsWithIds.put(R.id.guideline_3, 29);
sViewsWithIds.put(R.id.imageView2, 30);
}
// views
@NonNull
private final androidx.appcompat.widget.AppCompatTextView mboundView1;
@NonNull
private final androidx.appcompat.widget.AppCompatTextView mboundView13;
@NonNull
private final android.view.View mboundView14;
@NonNull
private final androidx.appcompat.widget.AppCompatTextView mboundView16;
@NonNull
private final android.view.View mboundView17;
@NonNull
private final android.widget.RelativeLayout mboundView18;
@NonNull
private final androidx.appcompat.widget.AppCompatTextView mboundView19;
// variables
// values
// listeners
// Inverse Binding Event Handlers
public ListviewOrdersBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
this(bindingComponent, root, mapBindings(bindingComponent, root, 31, sIncludes, sViewsWithIds));
}
private ListviewOrdersBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
super(bindingComponent, root, 0
, (androidx.appcompat.widget.AppCompatTextView) bindings[8]
, (androidx.appcompat.widget.AppCompatTextView) bindings[6]
, (androidx.appcompat.widget.AppCompatTextView) bindings[7]
, (androidx.appcompat.widget.AppCompatTextView) bindings[20]
, (androidx.appcompat.widget.AppCompatTextView) bindings[21]
, (androidx.appcompat.widget.AppCompatTextView) bindings[2]
, (androidx.appcompat.widget.AppCompatTextView) bindings[22]
, (androidx.appcompat.widget.AppCompatTextView) bindings[24]
, (androidx.appcompat.widget.AppCompatTextView) bindings[3]
, (androidx.appcompat.widget.AppCompatTextView) bindings[5]
, (androidx.appcompat.widget.AppCompatTextView) bindings[23]
, (androidx.appcompat.widget.AppCompatTextView) bindings[4]
, (androidx.cardview.widget.CardView) bindings[0]
, (androidx.constraintlayout.widget.ConstraintLayout) bindings[26]
, (androidx.constraintlayout.widget.Guideline) bindings[27]
, (androidx.constraintlayout.widget.Guideline) bindings[28]
, (androidx.constraintlayout.widget.Guideline) bindings[29]
, (androidx.appcompat.widget.AppCompatImageView) bindings[30]
, (android.widget.ImageView) bindings[10]
, (androidx.appcompat.widget.AppCompatImageView) bindings[15]
, (androidx.appcompat.widget.AppCompatImageView) bindings[11]
, (androidx.appcompat.widget.AppCompatImageView) bindings[12]
, (androidx.recyclerview.widget.RecyclerView) bindings[9]
, (android.view.View) bindings[25]
);
this.appCompatTextView10.setTag(null);
this.appCompatTextView15.setTag(null);
this.appCompatTextView155.setTag(null);
this.appCompatTextView5.setTag(null);
this.appCompatTextView7.setTag(null);
this.appCompatTextView77.setTag(null);
this.appCompatTextView9.setTag(null);
this.cardViewDealerToVisits.setTag(null);
this.imageViewCurrentConfirm.setTag(null);
this.imageViewCurrentDeliverd.setTag(null);
this.imageViewCurrentPacking.setTag(null);
this.imageViewCurrentTransit.setTag(null);
this.mboundView1 = (androidx.appcompat.widget.AppCompatTextView) bindings[1];
this.mboundView1.setTag(null);
this.mboundView13 = (androidx.appcompat.widget.AppCompatTextView) bindings[13];
this.mboundView13.setTag(null);
this.mboundView14 = (android.view.View) bindings[14];
this.mboundView14.setTag(null);
this.mboundView16 = (androidx.appcompat.widget.AppCompatTextView) bindings[16];
this.mboundView16.setTag(null);
this.mboundView17 = (android.view.View) bindings[17];
this.mboundView17.setTag(null);
this.mboundView18 = (android.widget.RelativeLayout) bindings[18];
this.mboundView18.setTag(null);
this.mboundView19 = (androidx.appcompat.widget.AppCompatTextView) bindings[19];
this.mboundView19.setTag(null);
this.recyclerViewOrderItems.setTag(null);
setRootTag(root);
// listeners
invalidateAll();
}
@Override
public void invalidateAll() {
synchronized(this) {
mDirtyFlags = 0x4L;
}
requestRebind();
}
@Override
public boolean hasPendingBindings() {
synchronized(this) {
if (mDirtyFlags != 0) {
return true;
}
}
return false;
}
@Override
public boolean setVariable(int variableId, @Nullable Object variable) {
boolean variableSet = true;
if (BR.orderitems == variableId) {
setOrderitems((tkhub.project.kesbewa.data.model.OrderRespons) variable);
}
else if (BR.clickListener == variableId) {
setClickListener((android.view.View.OnClickListener) variable);
}
else {
variableSet = false;
}
return variableSet;
}
public void setOrderitems(@Nullable tkhub.project.kesbewa.data.model.OrderRespons Orderitems) {
this.mOrderitems = Orderitems;
synchronized(this) {
mDirtyFlags |= 0x1L;
}
notifyPropertyChanged(BR.orderitems);
super.requestRebind();
}
public void setClickListener(@Nullable android.view.View.OnClickListener ClickListener) {
this.mClickListener = ClickListener;
synchronized(this) {
mDirtyFlags |= 0x2L;
}
notifyPropertyChanged(BR.clickListener);
super.requestRebind();
}
@Override
protected boolean onFieldChange(int localFieldId, Object object, int fieldId) {
switch (localFieldId) {
}
return false;
}
@Override
protected void executeBindings() {
long dirtyFlags = 0;
synchronized(this) {
dirtyFlags = mDirtyFlags;
mDirtyFlags = 0;
}
java.lang.String javaLangStringPayWithOrderitemsOrderPaymentType = null;
java.lang.String stringValueOfOrderitemsOrderTotalPrice = null;
java.lang.String stringValueOfOrderitemsOrderStatusNote = null;
java.util.List<tkhub.project.kesbewa.data.model.CartItem> orderitemsItemlist = null;
java.lang.String stringValueOfOrderitemsOrderTotalPriceJavaLangStringRS = null;
int orderitemsOrderTotalQty = 0;
java.lang.String stringValueOfOrderitemsOrderTotalQty = null;
java.lang.String orderitemsOrderPaymentType = null;
int orderitemsOrderStatusCode = 0;
tkhub.project.kesbewa.data.model.OrderRespons orderitems = mOrderitems;
android.view.View.OnClickListener clickListener = mClickListener;
java.lang.String orderitemsOrderCode = null;
java.lang.String orderitemsOrderDispatchType = null;
double orderitemsOrderTotalPrice = 0.0;
java.lang.String orderitemsOrderStatusNote = null;
long orderitemsOrderDate = 0;
if ((dirtyFlags & 0x5L) != 0) {
if (orderitems != null) {
// read orderitems.itemlist
orderitemsItemlist = orderitems.getItemlist();
// read orderitems.order_total_qty
orderitemsOrderTotalQty = orderitems.getOrder_total_qty();
// read orderitems.order_payment_type
orderitemsOrderPaymentType = orderitems.getOrder_payment_type();
// read orderitems.order_status_code
orderitemsOrderStatusCode = orderitems.getOrder_status_code();
// read orderitems.order_code
orderitemsOrderCode = orderitems.getOrder_code();
// read orderitems.order_dispatch_type
orderitemsOrderDispatchType = orderitems.getOrder_dispatch_type();
// read orderitems.order_total_price
orderitemsOrderTotalPrice = orderitems.getOrder_total_price();
// read orderitems.order_status_note
orderitemsOrderStatusNote = orderitems.getOrder_status_note();
// read orderitems.order_date
orderitemsOrderDate = orderitems.getOrder_date();
}
// read String.valueOf(orderitems.order_total_qty)
stringValueOfOrderitemsOrderTotalQty = java.lang.String.valueOf(orderitemsOrderTotalQty);
// read ("Pay with ") + (orderitems.order_payment_type)
javaLangStringPayWithOrderitemsOrderPaymentType = ("Pay with ") + (orderitemsOrderPaymentType);
// read String.valueOf(orderitems.order_total_price)
stringValueOfOrderitemsOrderTotalPrice = java.lang.String.valueOf(orderitemsOrderTotalPrice);
// read String.valueOf(orderitems.order_status_note)
stringValueOfOrderitemsOrderStatusNote = java.lang.String.valueOf(orderitemsOrderStatusNote);
// read (String.valueOf(orderitems.order_total_price)) + (" RS")
stringValueOfOrderitemsOrderTotalPriceJavaLangStringRS = (stringValueOfOrderitemsOrderTotalPrice) + (" RS");
}
if ((dirtyFlags & 0x6L) != 0) {
}
// batch finished
if ((dirtyFlags & 0x5L) != 0) {
// api target 1
androidx.databinding.adapters.TextViewBindingAdapter.setText(this.appCompatTextView10, javaLangStringPayWithOrderitemsOrderPaymentType);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setOrderDispatchDate(this.appCompatTextView15, orderitemsOrderDispatchType);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setOrderDispatchType(this.appCompatTextView155, orderitems);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setTimeStampToString(this.appCompatTextView5, orderitemsOrderDate);
androidx.databinding.adapters.TextViewBindingAdapter.setText(this.appCompatTextView7, stringValueOfOrderitemsOrderTotalQty);
androidx.databinding.adapters.TextViewBindingAdapter.setText(this.appCompatTextView77, orderitemsOrderDispatchType);
androidx.databinding.adapters.TextViewBindingAdapter.setText(this.appCompatTextView9, stringValueOfOrderitemsOrderTotalPriceJavaLangStringRS);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setStatusToConfirm(this.imageViewCurrentConfirm, orderitemsOrderStatusCode);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setStatusToDelivered(this.imageViewCurrentDeliverd, orderitems);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setStatusToPacking(this.imageViewCurrentPacking, orderitemsOrderStatusCode);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setStatusToTransit(this.imageViewCurrentTransit, orderitems);
androidx.databinding.adapters.TextViewBindingAdapter.setText(this.mboundView1, orderitemsOrderCode);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setTextToTransit(this.mboundView13, orderitems);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setDeliveredView(this.mboundView14, orderitems);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setTextToDelivered(this.mboundView16, orderitems);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setDeliveredView(this.mboundView17, orderitems);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setRejectStatus(this.mboundView18, orderitemsOrderStatusCode);
androidx.databinding.adapters.TextViewBindingAdapter.setText(this.mboundView19, stringValueOfOrderitemsOrderStatusNote);
tkhub.project.kesbewa.ui.adapters.CustomBindingAdapter.setCurrentItems(this.recyclerViewOrderItems, orderitemsItemlist);
}
if ((dirtyFlags & 0x6L) != 0) {
// api target 1
this.cardViewDealerToVisits.setOnClickListener(clickListener);
}
}
// Listener Stub Implementations
// callback impls
// dirty flag
private long mDirtyFlags = 0xffffffffffffffffL;
/* flag mapping
flag 0 (0x1L): orderitems
flag 1 (0x2L): clickListener
flag 2 (0x3L): null
flag mapping end*/
//end
}
|
package com.mybatis.plus.baseinfo.mapper;
import com.mybatis.plus.common.api.user.entity.SysRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 角色表 Mapper 接口
* </p>
*
* @author lishiwen
* @since 2019-04-13
*/
public interface SysRoleMapper extends BaseMapper<SysRole> {
}
|
package com.senseyun.openapi.SSRuntimeEasyJava;
public class ErrorCode {
//============================================================
// Module
//============================================================
public final static long MODE_H5_RUNTIME = 0x01; // H5 Module
public final static long MODE_IPC = 0x02; // IPC Module
public final static long MODE_SYSTEM = 0x04; // System Module
public final static long MODE_SS = 0x05; // Virbox License Service Module
public final static long MODE_NETAGENT = 0x11; // NetAgent Module
public final static long MODE_SSPROTECT = 0x12; // SSPROTECT Module
public final static long MODE_LM_API = 0x13; // LM Module(Runtime, D2C, Control)
public final static long MODE_LM_FIRM = 0x22; // LM Firmware Module
public final static long MODE_LM_SES = 0x23; // LM SES Module
public final static long MODE_LM_SERVICE = 0x24; // LM SERVICE Module
public final static long MODE_LIC_TRANS = 0x28; // License Transform Module
public final static long MODE_AUTH_SERVER = 0x29; // Auth Server Module
public final static long MODE_CLOUD = 0x30; // Cloud Module
public final static long MODE_SO = 0x51; // Slock Module
public final static long MODE_UM = 0x60; // User Manager Module
//============================================================
// General error
//============================================================
public final static long SS_OK = 0x00000000; // Success
public final static long SS_ERROR = 0x00000001; // Generic error
public final static long SS_ERROR_INVALID_PARAM = 0x00000002; // Illegal parameter
public final static long SS_ERROR_MEMORY_FAIELD = 0x00000003; // Memory error
public final static long SS_ERROR_INSUFFICIENT_BUFFER = 0x00000004; // Buffer is insufficient
public final static long SS_ERROR_NOT_FOUND = 0x00000005; // Can not find the object
public final static long SS_ERROR_EXISTED = 0x00000006; // Object already exists
public final static long SS_ERROR_DATA_BROKEN = 0x00000007; // Bad data
public final static long SS_ERROR_INVALID_HANDLE = 0x00000008; // Invalid handle
public final static long SS_ERROR_TIMEOUT = 0x00000009; // Operation time out
public final static long SS_ERROR_TARGET_NOT_IN_USE = 0x0000000A; // Object is not using
public final static long SS_ERROR_DATA_CONFLICT = 0X0000000B; // Incompatible data exist at the same time
public final static long SS_ERROR_INVALID_TYPE = 0x0000000C; // Invalid type
public final static long SS_ERROR_INVALID_LENGTH = 0x0000000D; // Invalid length
public final static long SS_ERROR_USER_MOD_CRASH = 0x0000000E; // User module conflict
public final static long SS_ERROR_SERVER_IS_LOCAL = 0x0000000F; // The License Service is local
public final static long SS_ERROR_UNSUPPORT = 0x00000010; // Unsupported operation
public final static long SS_ERROR_PORT_IN_USE = 0x00000011; // Port is occupied
public final static long SS_ERROR_NO_KEY = 0x00000013; // No secret key
public final static long SS_ERROR_SERVICE_TYPE_NOT_SUPPORT = 0x00000014; // Service type is surpporting the operation
public final static long SS_ERROR_MULTICAST_ADDR_IN_USE = 0x00000015; // Multicast address is occupied
public final static long SS_ERROR_MULTICAST_PORT_IN_USE = 0x00000016; // Multicast port is occupied
public final static long SS_ERROR_MOD_FAIL_LIBSTRING = 0x00000020; // Libstring error
public final static long SS_ERROR_NET_ERROR = 0x00000040; // Failed to connect to server
public final static long SS_ERROR_IPC_ERROR = 0x00000041; // IPC error
public final static long SS_ERROR_INVALID_SESSION = 0x00000042; // Conversation failed
public final static long SS_ERROR_GTR_MAX_SERVER_COUNT = 0x00000043; // The number of support services has reached an upper limit
public final static long SS_ERROR_MASTER_UNSUPPORT_PIN = 0x00000044; // The master lock doesn't support PIN. Please apply for relapement the master lock
public final static long SS_ERROR_MASTER_PIN_NOT_ACTIVE = 0x00000045; // The PIN is not activated. Please modify the initial PIN
public final static long SS_ERROR_MASTER_NO_SUCH_PIN = 0x00000046; // The PIN doesn't exist. Please check the whether PIN index is correct
public final static long SS_ERROR_MASTER_OUTDATED_VERSION = 0x00000047; // The master lock version is low and the new lock must be replaced
public final static long SS_ERROR_MASTER_PIN_WRONG = 0x00000048; // Error PIN
public final static long SS_ERROR_MASTER_PIN_BLOCKED = 0x00000049; // PIN is locked
//============================================================
// LM Module(0x13): (runtime, control, develop)
//============================================================
public final static long SS_ERROR_D2C_NO_PACKAGE = 0x13000000; // There is no signed content in D2C package
public final static long SS_ERROR_DEVELOPER_CERT_ALREADY_EXIST = 0x13000001; // Developer certificate already exists
public final static long SS_ERROR_PARSE_CERT = 0x13000003; // Parse certificate error
public final static long SS_ERROR_D2C_PACKAGE_TOO_LARGE = 0x13000004; // D2C package is too large
public final static long SS_ERROR_RESPONSE = 0x13000005; // Data response error
public final static long SS_ERROR_SEND_LM_REMOTE_REQUEST = 0x13000006; // Send LM remote request failed
public final static long SS_ERROR_RUNTIME_NOT_INITIALIZE = 0x13000007; // No call the init function of Runtime
public final static long SS_ERROR_BAD_CONNECT = 0x13000008; // Get connection failed
public final static long SS_ERROR_RUNTIME_VERSION = 0x13000009; // Version dose not match
public final static long SS_ERROR_LIC_NOT_FOUND = 0x13000020; // Can not find the license
public final static long SS_ERROR_AUTH_ACCEPT_FAILED = 0x13000021; // Authentication error
public final static long SS_ERROR_AUTH_HANDLE_FAILED = 0x13000022; // Authentication failed
public final static long SS_ERROR_DECODE_BUFFER = 0x13000023; // Decode error
public final static long SS_ERROR_USER_DATA_TOO_SMALL = 0x13000024; // User data field is small
public final static long SS_ERROR_INVALID_LM_REQUEST = 0x13000025; // Invalid LM request
public final static long SS_ERROR_INVALID_SHORTCODE = 0x13000026; // Invalid shortcode
public final static long SS_ERROR_INVALID_D2C_PACKAGE = 0x13000027; // D2C package is wrong
public final static long SS_ERROR_CLOUD_RESPONSE = 0x13000028; // Clout lock return data error
public final static long SS_ERROR_USER_DATA_TOO_LARGE = 0x13000029; // The data of write of read is too large
public final static long SS_ERROR_INVALID_MEMORY_ID = 0x1300002A; // Invalid Memory ID
public final static long SS_ERROR_INVALID_MEMORY_OFFSET = 0x1300002B; // Invalid Memory offset
public final static long SS_ERROR_INVALID_CLOUD_SERVER = 0x1300002C; // Invalid cloud lock servers
public final static long SS_ERROR_UNCALIBRATED_TIMESTAMP = 0x1300002D; // No calibrate the timestamp
public final static long SS_ERROR_GENERATE_GUID = 0x1300002F; // Build GUID error
public final static long SS_ERROR_NO_LOGGED_USER = 0x13000030; // No logged user
public final static long SS_ERROR_USER_AUTH_SERVER_NOT_RUNNING = 0x13000031; // User auth server not running
public final static long SS_ERROR_UNSUPPORTED_SNIPPET_CODE = 0x13000033; // Unsupported code snippet
public final static long SS_ERROR_INVALID_SNIPPET_CODE = 0x13000034; // Invalid code
public final static long SS_ERROR_EXECUTE_SNIPPET_CODE = 0x13000035; // Execute snippet code failed
public final static long SS_ERROR_SNIPPET_EXECUTE_LOGIN = 0x13000036; // Login snippet code server failed
public final static long SS_ERROR_LICENSE_MODULE_NOT_EXISTS = 0x13000037; // License module not exist
public final static long SS_ERROR_DEVELOPER_PASSWORD = 0x13000038; // Error API password
public final static long SS_ERROR_CALLBACK_VERSION = 0x13000039; // Error initialize version for callback
public final static long SS_ERROR_INFO_RELOGIN = 0x1300003A; // Please relogin.
public final static long SS_ERROR_LICENSE_VERIFY = 0x1300003B; // License data verify failed
public final static long SS_ERROR_REFRESH_TOKEN_TIMEOUT = 0x1300003C; // Refresh token timeout
public final static long SS_ERROR_TOKEN_VERIFY_FAIL = 0x1300003D; // Token validation failed
public final static long SS_ERROR_GET_TOKEN_FAIL = 0x1300003E; // Get token failed
public final static long SS_ERROR_NEED_WAIT = 0x13000044; // Inner error
public final static long SS_ERROR_LICENSE_NEED_TO_ACTIVATE = 0x13000051; // License need to activate online
public final static long SS_ERROR_DATA_NOT_END = 0x13000052; // Internal error, data is not finished
//============================================================
// IPC Module (0x02)
//============================================================
public final static long SS_ERROR_BAD_ADDR = 0x02000000; // Address error
public final static long SS_ERROR_BAD_NAME = 0x02000001; // Name error
public final static long SS_ERROR_IPC_FAILED = 0x02000002; // IPC receive and sent error
public final static long SS_ERROR_IPC_CONNECT_FAILED = 0x02000003; // Connect failed
public final static long SS_ERROR_IPC_AUTH_INITIALIZE = 0x02000004; // Auth failed
public final static long SS_ERROR_IPC_QUERY_STATE = 0x02000005; // Query SS state failed
public final static long SS_ERROR_SERVICE_NOT_RUNNING = 0x02000006; // SS is not running
public final static long SS_ERROR_IPC_DISCONNECT_FAILED = 0x02000007; // Disconnect failed
public final static long SS_ERROR_IPC_BUILD_SESSION_KEY = 0x02000008; // Session key negotiation failed
public final static long SS_ERROR_REQUEST_OUTPUT_BUFFER_TOO_LARGE = 0x02000009; // The buffer size is too large of requested
public final static long SS_ERROR_IPC_AUTH_ENCODE = 0x0200000A; // Auth encode error
public final static long SS_ERROR_IPC_AUTH_DECODE = 0x0200000B; // Auth decode error
public final static long SS_ERROR_IPC_INIT_FAILED = 0x0200000C; // IPC initialization failed, you can try to repair using the LSP repair tool
public final static long SS_ERROR_IPC_EXCHANGE_CERT = 0x0200000D; // Exchange certificate failed. Generally speaking, certificate upgrade compatibility error
//============================================================
// Net Agent Module (0x11)
//============================================================
//============================================================
// Security Module (0x12)
//============================================================
public final static long SS_ERROR_INIT_ANTIDEBUG = 0x12000005;
public final static long SS_ERROR_DEBUG_FOUNDED = 0x12000006;
//============================================================
// LM Service (0x24)
//============================================================
public final static long ERROR_LM_SVC_UNINTIALIZED = 0x24000001; // Uninitialize the service table item
public final static long ERROR_LM_SVC_INITIALIZING = 0x24000002; // Initializing the service table
public final static long ERROR_LM_SVC_INVALID_SESSION_INFO_SIZE = 0x24000003; // The size of input to session is wrong
public final static long ERROR_LM_SVC_KEEP_ALIVE_FAILED = 0x24000004; // Unknown reason of keep alive operation failure
public final static long ERROR_LM_SVC_LICENSE_NOT_FOUND = 0x24000005; // Can not find the specific license in the buffer
public final static long ERROR_LM_SVC_SESSION_ALREADY_LOGOUT = 0x24000006; // Session has quit
public final static long ERROR_LM_SVC_SESSION_ID_NOT_FOUND = 0x24000007; // Session id is not existent
public final static long ERROR_LM_SVC_DEBUGGED = 0x24000008; // Find be debugged
public final static long ERROR_LM_SVC_INVALID_DESCRIPTION = 0x24000009; // Invalid license describe information
public final static long ERROR_LM_SVC_HANDLE_NOT_FOUND = 0x2400000A; // Can not find the specific handle
public final static long ERROR_LM_SVC_CACHE_OVERFLOW = 0x2400000B; // Cache buffer is full
public final static long ERROR_LM_SVC_SESSION_OVERFLOW = 0x2400000C; // Session buffer is full
public final static long ERROR_LM_SVC_INVALID_SESSION = 0x2400000D; // Invalid session
public final static long ERROR_LM_SVC_SESSION_ALREADY_DELETED = 0x2400000E; // Session has been deleted
public final static long ERROR_LM_SVC_LICENCE_EXPIRED = 0x2400000F; // License is out of date
public final static long ERROR_LM_SVC_SESSION_TIME_OUT = 0x24000010; // Session time out
public final static long ERROR_LM_SVC_NOT_ENOUGH_BUFF = 0x24000011; // Buffer is not enough
public final static long ERROR_LM_SVC_DESC_NOT_FOUND = 0x24000012; // Can not find device handle
public final static long ERROR_LM_INVALID_PARAMETER = 0x24000013; // LM service parameter error
public final static long ERROR_LM_INVALID_LOCK_TYPE = 0x24000014; // Unsupported lock type
public final static long ERROR_LM_REMOTE_LOGIN_DENIED = 0x24000015; // License can not remote login
public final static long ERROR_LM_SVC_SESSION_INVALID_AUTHCODE = 0x24000016; // Session auth failed
public final static long ERROR_LM_SVC_ACCOUNT_NOT_BOUND = 0x24000017; // Unbound user
public final static long ERROR_LM_USER_NOT_EXISTS = 0x24000018; // Can not found account
//============================================================
// LM Native (0x21)
//============================================================
public final static long SS_ERROR_UNSUPPORTED_ALGORITHM = 0x21000000; // Unsupported algo type
public final static long SS_ERROR_INVAILD_HLC_HANDLE = 0x21000001; // Invalid HLC handle
public final static long SS_ERROR_HLC_CHECK = 0x21000002; // HLC check failed
public final static long SS_ERROR_LM_CHECK_READ = 0x21000003; // Read flag check failed
public final static long SS_ERROR_LM_CHECK_LICENSE = 0x21000004; // Output buffer license ID is not match
public final static long SS_ERROR_LM_CHECKSUM = 0x21000005; // Output buffer calibrate failed
public final static long SS_ERROR_HLC_BUFFER_LEN = 0x21000006; // HLC data encrypt is large than buffer
public final static long SS_ERROR_L2CWF_LEN = 0x21000007; // Invalid encrypt length
public final static long SS_ERROR_INVAILD_MAX_ENCRYPT_LENGTH = 0x21000008; // Invalid encrypt max length
public final static long SS_ERROR_INVAILD_ENUM_CRYPT_TYPE = 0x21000009; // Unsupported encryption type
public final static long SS_ERROR_NATIVE_INSUFFICIENT_BUFFER = 0x2100000A; // Buffer shortage
public final static long SS_ERROR_NATIVE_LIST_FILE_FAILED = 0x2100000B; // Enum files from dongle failed
public final static long SS_ERROR_INVALID_C2H_REQUEST = 0x2100000C; // Invalid request from cloud to dongle
//============================================================
// LM Firmware (0x22)
//============================================================
public final static long SS_ERROR_FIRM_INVALID_FILE_NAME = 0x22000001; // Invalid file name
public final static long SS_ERROR_FIRM_CHECK_BUFF_FAILED = 0x22000002; // Data check failed
public final static long SS_ERROR_FIRM_INVALID_BUFF_LEN = 0x22000003; // Input data length error
public final static long SS_ERROR_FIRM_INVALID_PARAM = 0x22000004; // Parameter error
public final static long SS_ERROR_FIRM_INVALID_SESSION_INFO = 0x22000005; // session infomation error
public final static long SS_ERROR_FIRM_INVALID_FILE_SIZE = 0x22000006; // Create file length is wrong
public final static long SS_ERROR_FIRM_WRITE_FILE_FAILED = 0x22000007; // Read file data error
public final static long SS_ERROR_FIRM_INVALID_LICENCE_HEADER = 0x22000008; // License information head is wrong
public final static long SS_ERROR_FIRM_INVALID_LICENCE_SIZE = 0x22000009; // License data is wrong
public final static long SS_ERROR_FIRM_INVALID_LICENCE_INDEX = 0x2200000A; // Exceed the max license number
public final static long SS_ERROR_FIRM_LIC_NOT_FOUND = 0x2200000B; // Can not find specific license
public final static long SS_ERROR_FIRM_MEM_STATUS_INVALID = 0x2200000C; // The data of memory state is not init
public final static long SS_ERROR_FIRM_INVALID_LIC_ID = 0x2200000D; // Invalid license ID
public final static long SS_ERROR_FIRM_LICENCE_ALL_DISABLED = 0x2200000E; // All licenses are disabled
public final static long SS_ERROR_FIRM_CUR_LICENCE_DISABLED = 0x2200000F; // Current license is disabled
public final static long SS_ERROR_FIRM_LICENCE_INVALID = 0x22000010; // Current license is not available
public final static long SS_ERROR_FIRM_LIC_STILL_UNAVALIABLE = 0x22000011; // License is not available
public final static long SS_ERROR_FIRM_LIC_TERMINATED = 0x22000012; // License expires
public final static long SS_ERROR_FIRM_LIC_RUNTIME_TIME_OUT = 0x22000013; // Running time use up
public final static long SS_ERROR_FIRM_LIC_COUNTER_IS_ZERO = 0x22000014; // Counter use up
public final static long SS_ERROR_FIRM_LIC_MAX_CONNECTION = 0x22000015; // Reach the limit concurrent number
public final static long SS_ERROR_FIRM_INVALID_LOGIN_COUNTER = 0x22000016; // Login number is wrong
public final static long SS_ERROR_FIRM_REACHED_MAX_SESSION = 0x22000017; // The maximum number of sessions has been reached within lock
public final static long SS_ERROR_FIRM_INVALID_TIME_INFO = 0x22000018; // Communication time information error
public final static long SS_ERROR_FIRM_SESSION_SIZE_DISMATCH = 0x22000019; // session size error
public final static long SS_ERROR_FIRM_NOT_ENOUGH_SHAREMEMORY = 0x2200001A; // There is not enough shared memory
public final static long SS_ERROR_FIRM_INVALID_OPCODE = 0x2200001B; // The operate code is available
public final static long SS_ERROR_FIRM_INVALID_DATA_LEN = 0x2200001C; // The length of data file is wrong
public final static long SS_ERROR_FIRM_DATA_FILE_NOT_FOUND = 0x2200001E; // Can not find the specific license data
public final static long SS_ERROR_FIRM_INVALID_PKG_TYPE = 0x2200001F; // The type of remote update package is wrong
public final static long SS_ERROR_FIRM_INVALID_TIME_STAMP = 0x22000020; // Timestamp is wrong in the update package
public final static long SS_ERROR_FIRM_INVALID_UPD_LIC_ID = 0x22000021; // The number of remote update license is wrong
public final static long SS_ERROR_FIRM_LIC_ALREADY_EXIST = 0x22000022; // The added license is already exists
public final static long SS_ERROR_FIRM_LICENCE_SIZE_LIMITTED = 0x22000023; // License number limits
public final static long SS_ERROR_FIRM_INVALID_DATA_FILE_OFFSET = 0x22000024; // Invalid offset of license data
public final static long SS_ERROR_FIRM_ZERO_INDEX_LIC_DESTROY = 0x22000025; // Bad No. 0 license
public final static long SS_ERROR_FIRM_LIC_ALREADY_DISABLED = 0x22000026; // License is disable
public final static long SS_ERROR_FIRM_INVALID_UPD_OPCODE = 0x22000027; // Invalid operate code of remote update
public final static long SS_ERROR_FIRM_LIC_ALREADY_ENABLED = 0x22000028; // License is enable
public final static long SS_ERROR_FIRM_INVALID_PKG_SIZE = 0x22000029; // The length of remote update package is wrong
public final static long SS_ERROR_FIRM_LIC_COUNT_RETURN = 0x2200002A; // Return the wrong license number
public final static long SS_ERROR_FIRM_INVALID_OPERATION = 0x2200002B; // Execute the wrong operate
public final static long SS_ERROR_FIRM_SESSION_ALREADY_LOGOUT = 0x2200002C; // Session logout
public final static long SS_ERROR_FIRM_EXCHANGE_KEY_TIMEOUT = 0x2200002D; // Exchange key time out
public final static long SS_ERROR_FIRM_INVALID_EXCHANGE_KEY_MAGIC = 0x2200002E; // The wrong key exchange magic number
public final static long SS_ERROR_FIRM_INVALID_AUTH_CODE = 0x2200002F; // Authentication data error
public final static long SS_ERROR_FIRM_CONVERT_INDEX_TO_FILE = 0x22000030; // Exchange lic number to file name failed
public final static long SS_ERROR_FIRM_INVALID_USER_DATA_TYPE = 0x22000031; // The type of user defined field is wrong
public final static long SS_ERROR_FIRM_INVALID_DATA_FILE_SIZE = 0x22000032; // User defined data field is too large
public final static long SS_ERROR_FIRM_INVALID_CCRNT_OPR_TYPE = 0x22000033; // Concurrent number operation type is wrong
public final static long SS_ERROR_FIRM_ALL_LIC_TERMINATED = 0x22000034; // All licensed time expires
public final static long SS_ERROR_FIRM_INVALID_CCRNT_VALUE = 0x22000035; // Concurrent number is wrong
public final static long SS_ERROR_FIRM_INVALID_UPD_FILE = 0x22000036; // Delete history file is not available
public final static long SS_ERROR_FIRM_UPD_RECORD_FULL = 0x22000037; // Update record to achieve maximum
public final static long SS_ERROR_FIRM_UPDATE_FAILED = 0x22000038; // Remote update failed
public final static long SS_ERROR_FIRM_LICENSE_BEING_WRITTING = 0x22000039; // License is writing
public final static long SS_ERROR_FIRM_INVALID_PKG_FIELD_TYPE = 0x2200003A; // Update package sub type is wrong
public final static long SS_ERROR_FIRM_LOAT_FSM_SALT = 0x2200003B; // Load salt file error
public final static long SS_ERROR_FIRM_DATA_LENGTH_ALIGNMENT = 0x2200003C; // The length of the encryption and decryption data is not aligned
public final static long SS_ERROR_FIRM_DATA_CRYPTION = 0x2200003D; // Encryption and decryption data is wrong
public final static long SS_ERROR_FIRM_SHORTCODE_UPDATE_NOT_SUPPORTED = 0x2200003E; // Unsupported short code update
public final static long SS_ERROR_FIRM_INVALID_SHORTCODE = 0x2200003F; // The short code is not available
public final static long SS_ERROR_FIRM_LIC_USR_DATA_NOT_EXIST = 0x22000040; // User defined data is not existent
public final static long SS_ERROR_FIRM_RCD_FILE_NOT_INITIALIZED = 0x22000041; // Delete history file is not initialized
public final static long SS_ERROR_FIRM_AUTH_FILE_NOT_FOUND = 0x22000042; // Can not find authentication file
public final static long SS_ERROR_FIRM_SESSION_OVERFLOW = 0x22000043; // Session num overflow
public final static long SS_ERROR_FIRM_TIME_OVERFLOW = 0x22000044; // Time information overflow
public final static long SS_ERROR_FIRM_REACH_FILE_LIS_END = 0x22000045; // Enum reach the last file
public final static long SS_ERROR_FIRM_ANTI_MECHANISM_ACTIVED = 0x22000046; // Punishment num active lock lm
public final static long SS_ERROR_FIRM_NO_BLOCK = 0x22000047; // Get block failed
public final static long SS_ERROR_FIRM_NOT_ENDED = 0x22000048; // Data transmit error
public final static long SS_ERROR_FIRM_LIC_ALREADY_ACTIVE = 0x22000049; // license already active
public final static long SS_ERROR_FIRM_FILE_NOT_FOUND = 0x22000050; // File not find
public final static long SS_ERROR_FIRM_UNKNOW_USER_DATA_TYPE = 0x22000051; // Unknown user data type
public final static long SS_ERROR_FIRM_INVALID_TF_CODE = 0x22000052; // Error transmit operation code
public final static long SS_ERROR_FIRM_UNMATCH_GUID = 0x22000053; // Mismatch GUID
public final static long SS_ERROR_FIRM_UNABLE_TRANSFER = 0x22000054; // License cann't transmit
public final static long SS_ERROR_FIRM_INVALID_TRANSCODE = 0x22000055; // Unrecognise random code
public final static long SS_ERROR_FIRM_ACCOUNT_NAME_NOT_FOUND = 0x22000056; // User not find
public final static long SS_ERROR_FIRM_ACCOUNT_ID_NOT_FOUND = 0x22000057; // User id not find
public final static long SS_ERROR_FIRM_INVALID_XKEY_STEP = 0x22000058; // Error kay exchange process
public final static long SS_ERROR_FIRM_INVLAID_DEVELOPER_ID = 0x22000059; // Invalid developer ID
public final static long SS_ERROR_FIRM_CA_TYPE = 0x2200005A; // CA type error
public final static long SS_ERROR_FIRM_LIC_TRANSFER_FAILURE = 0x2200005B; // license transmit failed
public final static long SS_ERROR_FIRM_TF_PACKAGE_VERSION = 0x2200005C; // Error package version
public final static long SS_ERROR_FIRM_BEYOND_PKG_ITEM_SIZE = 0x2200005D; // License number of update package is too large
public final static long SS_ERROR_FIRM_UNBOUND_ACCOUNT_INFO = 0x2200005E; // The account is not bound to User Lock
public final static long SS_ERROR_FIRM_DEVICE_LOCKED = 0x2200005F; // The User Lock is locked, please contact the vendor to unlock it
public final static long SS_ERROR_FIRM_INVALID_LOCK_PASSWORD = 0x22000060; // Locked password is incorrect, you may be the victim of pirated software
public final static long SS_ERROR_FIRM_NOT_EXCHANGE_KEY = 0x22000061; // No key exchange was preformed
public final static long SS_ERROR_FIRM_INVALID_SHORTCODE_SWAP_FILE = 0x22000062; // Invalid SLAC file in User Lock
public final static long SS_ERROR_FIRM_SHORTCODE_UPDATE_USER_DATA = 0x22000063; // Upgrade user data area error by SLAC
public final static long SS_ERROR_FIRM_CTRL_HMAC_VERSION = 0x22000064; // Incorrect D2C package signature version, please connect the vendor to update User Lock
public final static long SS_ERROR_FIRM_CTRL_HMAC_MAGIC = 0x22000065; // Incorrect D2C package data, please connect the vendor to solve it
public final static long SS_ERROR_FIRM_GEN_HWFP = 0x22001001; // Offline license can not bind
public final static long SS_ERROR_FIRM_WRONG_VERSION = 0x22001002; // Error protocol version
public final static long SS_ERROR_FIRM_INVALID_PACKAGE = 0x22001003; // Bad data
public final static long SS_ERROR_FIRM_UNSUPPORTED_PACKAGE = 0x22001004; // Unsupported data packets
public final static long SS_ERROR_FIRM_ILLEGAL_PACKAGE = 0x22001005; // Illegal data packets
public final static long SS_ERROR_FIRM_EXCEPTION = 0x22001006; // Inner error
public final static long SS_ERROR_FIRM_VERIFY_D2C = 0x22001007; // D2C verification failed
public final static long SS_ERROR_FIRM_HWFP_MISMATCHED = 0x22001008; // Mismatched binding packets
public final static long SS_ERROR_FIRM_LICDATA_ERROR = 0x22001009; // License data error
public final static long SS_ERROR_FIRM_DEVPCERTS_NOT_FOUND = 0X2200100A; // Can not found developer certificate
public final static long SS_ERROR_FIRM_WRONG_CERTS = 0x2200100B; // Error certificate
public final static long SS_ERROR_FIRM_VERIFY_DEVPSIGN = 0x2200100C; // Developer signature failed
public final static long SS_ERROR_FIRM_INVALID_VCLOCK = 0x2200100D; // Clock error
public final static long SS_ERROR_FIRM_SLOCK_CORRUPT = 0x2200100E; // Illegal license data
public final static long SS_ERROR_FIRM_FORMAT_SLOCK = 0x2200100F; // Format failed
public final static long SS_ERROR_FIRM_BAD_CONFIG = 0x22001010; // The configuration file does not exist or is corrupted
public final static long SS_ERROR_FIRM_BAD_OFFLINE_ADJUST_TIME = 0x22001011; // Invalid offline calibration time
//============================================================
// License Transform Module Module (0x28)
//============================================================
public final static long SS_ERROR_LIC_TRANS_NO_SN_DESC = 0x28000001; // Can not found device description
public final static long SS_ERROR_LIC_TRANS_INVALID_DATA = 0x28000002; // Error data
//============================================================
// Auth Server Module (0x29)
//============================================================
public final static long SS_ERROR_AUTH_SERVER_INVALID_TOKEN = 0x29000001; // Invalid access token
public final static long SS_ERROR_AUTH_SERVER_REFRESH_TOKEN = 0x29000002; // Refresh token failed
public final static long SS_ERROR_AUTH_SERVER_LOGIN_CANCELED = 0x29000003; // Registration cancellation
public final static long SS_ERROR_AUTH_SERVER_GET_ALL_USER_INFO_FAIL = 0x29000004; // Failed to obtain all user information
//============================================================
// Cloud Module (0x30)
//============================================================
public final static long SS_CLOUD_OK = 0x30000000; // Success
public final static long SS_ERROR_CLOUD_INVALID_PARAMETER = 0x30000001; // Parameter error
public final static long SS_ERROR_CLOUD_QUERY_UESR_INFO = 0x30000002; // Cann't find user information
public final static long SS_ERROR_CLOUD_INVALID_LICENSE_SESSION = 0x30000003; // License not login or timeout
public final static long SS_ERROR_CLOUD_DATA_EXPIRED = 0x30000004; // Data out of date
public final static long SS_ERROR_CLOUD_VERIFY_TIMESTAMP_SIGNATURE = 0x30000005; // Timestamp signature verify failed
public final static long SS_ERROR_CLOUD_AUTH_FAILED = 0x30000006; // p2p authentication failed
public final static long SS_ERROR_CLOUD_NOT_BOUND = 0x30000007; // Algorithm doesn't exist or unbind
public final static long SS_ERROR_CLOUD_EXECUTE_FAILED = 0x30000008; // Algorithm execute failed
public final static long SS_ERROR_CLOUD_INVALID_TOKEN = 0x30000010; // Illegae access token
public final static long SS_ERROR_CLOUD_LICENSE_ALREADY_LOGIN = 0x30000011; // LIcense Alreay Login
public final static long SS_ERROR_CLOUD_LICENSE_EXPIRED = 0x30000012; // LIcense Overtime
public final static long SS_ERROR_CLOUD_SESSION_KICKED = 0x30000013; // License session is kicked
public final static long SS_ERROR_CLOUD_INVALID_SESSSION = 0x30001002; // SessionId Losed
public final static long SS_ERROR_CLOUD_SESSION_TIMEOUT = 0x30001004; // Key Not Exist Or Timed Out
public final static long SS_ERROR_CLOUD_PARSE_PARAM = 0x30001007; // Incorrect Format.Parmeter Parse Error
public final static long SS_ERROR_CLOUD_LICENSE_LOGIN_SUCCESS = 0x31001000; // License login succeed
public final static long SS_ERROR_CLOUD_LICENSE_NOT_EXISTS = 0x31001001; // License not exist
public final static long SS_ERROR_CLOUD_LICENSE_NOT_ACTIVE = 0x31001002; // License not active
public final static long SS_ERROR_CLOUD_LICENSE_EXPIRED2 = 0x31001003; // License expired
public final static long SS_ERROR_CLOUD_LICENSE_COUNTER_IS_ZERO = 0x31001004; // License no usage count
public final static long SS_ERROR_CLOUD_LICENSE_RUNTIME_TIME_OUT = 0x31001005; // License no usage time
public final static long SS_ERROR_CLOUD_LICENSE_MAX_CONNECTION = 0x31001006; // License concurrent limit
public final static long SS_ERROR_CLOUD_LICENSE_LOCKED = 0x31001007; // License locked
public final static long SS_ERROR_CLOUD_LICENSE_DATA_NOT_EXISTS = 0x31001008; // No license data
public final static long SS_ERROR_CLOUD_LICENSE_STILL_UNAVAILABLE = 0x31001010; // License not to use time
public final static long SS_ERROR_CLOUD_ZERO_LICENSE_NOT_EXISTS = 0x31001011; // License 0 not exist
public final static long SS_ERROR_CLOUD_VERIFY_LICENSE = 0x31001012; // License verify failed
public final static long SS_ERROR_CLOUD_EXECUTE_FILE_NOT_EXISTS = 0x31002000; // Algorithm not exist
public final static long SS_ERROR_CLOUD_LICENSE_NOT_BOUND = 0x31003001; // Algorithm already bind
public final static long SS_ERROR_SO_REFUSE_ADJUST_TIME = 0x51004003; // Refuse adjust time
public final static long SS_ERROR_SO_BEFORE_START_TIME = 0x51004004; // License before start time
public final static long SS_ERROR_SO_EXPIRED = 0x51004005; // License expired
public final static long SS_ERROR_SO_LICENSE_BIND_ERROR = 0x51004006; // License bind error
public final static long SS_ERROR_SO_LICENSE_BIND_FULL = 0x51004007; // License bind machines is full
public final static long SS_ERROR_SO_LICENSE_UNBOUND = 0x51004008; // License already bound
public final static long SS_ERROR_SO_LICENSE_MAX_BIND_FULL = 0x51004009; // License maximum bind machines is full
public final static long SS_ERROR_SO_NOT_SUPPORTED_OFFLINE_BIND = 0x51004010; // The license does not support offline bind
public final static long SS_ERROR_SO_EXPIRED_C2D = 0x51004011; // The C2D packet generation time differ greatly from server time
public final static long SS_ERROR_SO_INVALID_C2D = 0x51004012; // Invalid C2D packet
public final static long SS_ERROR_LL_SERVER_INTERNAL_ERROR = 0x61000001; // Inner Service Error
public final static long SS_ERROR_LL_INVALID_PARAMETERS = 0x61000002; // Parameter error
public final static long SS_ERROR_LL_DEVICE_INFO_NOT_EXIST = 0x61000003; // The hardware lock Info can't be found
public final static long SS_ERROR_LL_DEVICE_LOSS_OR_LOCKED = 0x61000004; // The hardware lock has been lost or locked
public final static long SS_ERROR_LL_UNKOWN_ACTIVATION_MODE = 0x61001001; // Unknown activation state
public final static long SS_ERROR_LL_UNKOWN_DEVICE_STATE = 0x61001002; // Unknown lock type
public final static long SS_ERROR_LL_UNKOWN_D2C_USAGE = 0x61001003; // Unknown D2C type
public final static long SS_ERROR_LL_UNKOWN_D2C_WRITE_RESULT = 0x61001004; // Unknown upgrade result of D2C
public final static long SS_ERROR_LL_VERIFY_ERROR = 0x61001005; // Verify failed
public final static long SS_ERROR_LL_DATABASE_OPT_ERROR = 0x61001006; // Database operation failed
public final static long SS_ERROR_LL_NO_NEED_TO_ACTIVATE = 0x61001007; // The hardware lock needn't to be activated
public final static long SS_ERROR_LL_DEVICE_ALREADY_LOCKED = 0x61001008; // The hardware lock has been activated
public final static long SS_ERROR_LL_D2C_INFO_NOT_EXIST = 0x61001009; // D2C Info can't be found
public final static long SS_ERROR_LL_ILLEGAL_DEVICE_STATE = 0x6100100a; // Invalid hardware lock state
public final static long SS_ERROR_LL_CANNOT_BE_ACTIVATED = 0x6100100b; // The hardware lock can't be activated in the current state
public final static long SS_ERROR_LL_NOT_SUPPORTED_PROTOCOL_VERSION = 0x6100100c; // Unsupported protocols
//============================================================
// User Manager Module (0x60)
//============================================================
public final static long SS_UM_OK = 0x00000000; // Success
public final static long SS_UM_ERROR = 0x00000001; // Generic error
public final static long SS_ERROR_UM_PARAMETER_ERROR = 0x60000002; // Parameter error
public final static long SS_ERROR_UM_CAPTCHA_INVALID = 0x60000003; // Verify Code expired
public final static long SS_ERROR_UM_CAPTCHA_ERROR = 0x60000004; // Verify Code error
public final static long SS_ERROR_UM_CAPTCHA_IS_NULL = 0x60000005; // Please input verify code
public final static long SS_ERROR_UM_USER_NO_ACTIVE = 0x60000006; // User not activated
public final static long SS_ERROR_UM_RETRY_TOO_MORE = 0x60000007; // User operation is frequent, Please try again later
public final static long SS_ERROR_UM_USER_OR_PWD_ERROR = 0x60000008; // Error incorrect username or password
public final static long SS_ERROR_UM_OAUTH_CONFIG_ERROR = 0x60000009; // OAuth User center configuration error
public final static long SS_ERROR_UM_GRANT_TYPE_ERROR = 0x6000000A; // Unsupported authorization type
public final static long SS_ERROR_UM_SCOPE_INVALID = 0x6000000B; // Invalid scope
public final static long SS_ERROR_UM_SERVER_STOP = 0x6000000C; // Service stop
public final static long SS_ERROR_UM_IPC_TIMEOUT = 0x6000000D; // Operation timeout
public final static long SS_ERROR_UM_TRANS_ERROR = 0x6000000E; // Internal data transfer error
public final static long SS_ERROR_UM_CLOUD_INVALID_TOKEN = 0x6000000F; // Invalid Token
public final static long SS_ERROR_UM_ACCOUNT_HAVE_BEEN_LOGOUT = 0x60000010; // No user information for this guid
public final static long SS_ERROR_UM_NET_ERROR = 0x60000011; // Network error
public final static long SS_ERROR_UM_COULDNT_RESOLVE_HOST = 0x60000012; // Host unreachable
public final static long SS_ERROR_UM_MEMORY_ERROR = 0x60000013; // Internal memory error
public final static long SS_ERROR_UM_USERLIST_AND_AUTH_CFG_ERROR = 0x60000014; // Configuration file error
public final static long SS_ERROR_UM_NEED_RELOGON = 0x60000015; // Need relogon
public final static long SS_ERROR_UM_VERIFY_TOKEN_TIMEOUT = 0x60000016; // Verify token failed
public final static long SS_ERROR_UM_REFRESH_TOKEN_TIMEOUT = 0x60000017; // Refresh token failed
public final static long H5_ERROR_SUCCESS = 0;
// Macro
public static long MAKE_ERROR(long mode, long errcode){
return (long)(((mode) << 24) | (errcode));
}
public static long MAKE_COMMON_ERROR(long mode, long errcode){
return (long)(((mode) << 24) | (errcode));
}
public static long MAKE_H5_RUNTIME(long errorcode){
return (long)(((errorcode)==H5_ERROR_SUCCESS) ? 0 : (MAKE_COMMON_ERROR(MODE_H5_RUNTIME,(errorcode))));
}
public static long MAKE_NETAGENT(long errorcode){
return MAKE_COMMON_ERROR(MODE_NETAGENT,(errorcode));
}
public static long MAKE_SSPROTECT(long errorcode){
return MAKE_COMMON_ERROR(MODE_NETAGENT,(errorcode));
}
public static long MAKE_LM_FIRM_ERROR(long errorcode){
return MAKE_COMMON_ERROR(MODE_LM_FIRM,(errorcode));
}
public static long MAKE_LM_SES_ERROR(long errorcode){
return MAKE_COMMON_ERROR(MODE_LM_SES,(errorcode));
}
public static long GET_ERROR_MODULE(long errorcode){
return (long)((errorcode) >> 24);
}
}
|
package nl.themelvin.questlib.storage;
import java.util.HashMap;
import java.util.UUID;
import nl.themelvin.questlib.abstracts.*;
public class QuestStorable {
private UUID uuid;
private String identifier;
private String objectiveIdentifier;
private HashMap<String, Object> data;
public QuestStorable(UUID uuid, String identifier, String objectiveIdentifier, HashMap<String, Object> data) {
this.uuid = uuid;
this.identifier = identifier;
this.objectiveIdentifier = objectiveIdentifier;
this.data = data;
}
public QuestStorable() { }
/**
* Get the UUID of the player.
* @return The UUID of the player.
*/
public UUID getUuid() {
return uuid;
}
/**
* Set the UUID of the player.
* @param uuid The UUID of the player.
*/
public void setUuid(UUID uuid) {
this.uuid = uuid;
}
/**
* Get the identifier of the {@link Quest}.
* @return The string identifier.
*/
public String getIdentifier() {
return identifier;
}
/**
* Set the identifier of the {@link Quest}
* @param identifier The string identifier.
*/
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
/**
* Get the identifier of the {@link QuestObjective}
* @return The string identifier.
*/
public String getObjectiveIdentifier() {
return objectiveIdentifier;
}
/**
* Set the identifier of the {@link QuestObjective}
* @param objectiveIdentifier The string identifier.
*/
public void setObjectiveIdentifier(String objectiveIdentifier) {
this.objectiveIdentifier = objectiveIdentifier;
}
/**
* Get the data used by the {@link QuestObjective}
* @return The data used.
*/
public HashMap<String, Object> getData() {
return data;
}
/**
* Set the data used by the {@link QuestObjective}
* @param data The data used.
*/
public void setData(HashMap<String, Object> data) {
this.data = data;
}
}
|
package com.takshine.wxcrm.service;
import com.takshine.wxcrm.base.services.EntityService;
/**
* 考勤签到
*
*/
public interface WxSubscribeHisService extends EntityService{
/**
* 添加微信订阅记录
*/
public void addWxSubscribeHis(String openid, String subtype);
/**
* 查询微信订阅记录
*/
public boolean searchWxSubHisExits(String openid);
/**
* 取消关注的时候 发送手机短信
*/
public void cannelSubSendPhoneMsg(String openId);
}
|
package database;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;
/**
* Created by sooraj on 7/6/17.
*/
@RestController
@SpringBootApplication
public class Controller {
@Autowired
Repository repository;
public static void main(String[] args)
{
SpringApplication.run(Controller.class,args);
}
@RequestMapping(method = RequestMethod.POST,value = "/register")
@ResponseBody
public String register(String name,String email,String mob )
{
Data user;
user=new Data(name,email,mob);
repository.save(user);
String message="Successfully registered with id =";
return message+user.getId();
}
@RequestMapping(method = RequestMethod.POST,value = "/users/{id}")
@ResponseBody
public Data getUser(@PathVariable int id)
{
return repository.findOne(id);
}
}
|
package me.yamas.tools.commands;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.yamas.tools.commands.utils.Executor;
import me.yamas.tools.utils.Util;
public class ExcTppos implements Executor{
@Override
public void execute(CommandSender sender, String[] args) {
if(!(sender instanceof Player)){
Util.sendMessage(Bukkit.getConsoleSender(), "&4Blad: &cMusisz byc na serwerze aby wykonac ta komende!");
return;
}
if(!sender.hasPermission("yamastools.cmd.tppos")){
Util.sendMessage(sender, "&cNie masz uprawnien do uzycia tej komendy &8(&7yamastools.cmd.tppos&8)");
return;
}
Player p = (Player) sender;
if(args.length == 0){
Util.sendMessage(p, "&8» &7Poprawne uzycie: &4/tppos &8[&4gracz&8] [&4x&8] [&4y&8] [&4z&8]");
return;
} else {
if(args.length >= 4){
Player target = Bukkit.getPlayer(args[0]);
if(target == null){
Util.sendMessage(p, "&4Blad: &cPodany gracz jest offline!");
return;
}
int x;
int y;
int z;
try{
x = Integer.valueOf(args[1]);
y = Integer.valueOf(args[2]);
z = Integer.valueOf(args[3]);
} catch(NumberFormatException e){
Util.sendMessage(p, "&4Blad: &cKordynaty musza byc liczba!");
return;
}
target.teleport(new Location(target.getWorld(), x, y, z));
Util.sendMessage(target, "&8» &7Pomyslnie przetelportowales gracza: &4" + target.getName() + "&7 na kordynaty: x: &4" + x + " &7y: &4" + y + " &7z: &4" + z);
for(Player admin : Bukkit.getOnlinePlayers()){
if(admin.hasPermission("yamastools.socialspy")){
Util.sendMessage(admin, "&eAdmin: " + p.getName() + " przeteleportowal gracza: " + target.getName() + " na kordynaty: x: " + x +" y: " + y + " z: " + z);
}
}
}
}
}
}
|
package org.murinrad.android.musicmultiply.receiver.settings;
import android.content.Context;
import android.util.AttributeSet;
import org.murinrad.android.musicmultiply.IntEditTextPreference;
/**
* Created by Radovan Murin on 02.08.2015.
*/
public class ResetMillisPreference extends IntEditTextPreference {
public ResetMillisPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public ResetMillisPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ResetMillisPreference(Context context) {
super(context);
}
}
|
package io.beaniejoy.bootapiserver.network.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class EmployeeRequestDto {
private String employeeName;
private String employeeAddress;
private Long companyId;
}
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package filebird.client.connection;
/**
*
* @author Faraaz Malak
*/
public class Process extends Thread {
private Runnable target=null;
public Process(Runnable target,String name)
{
super(target,name);
this.target=target;
}
public Runnable getTarget()
{
return this.target;
}
@Override
public void run() {
target.run();
}
}
|
package my.application.pojo;
public class ExtendMacro extends BasicMacro {
private double glycemicCharge;
public ExtendMacro(){
}
public void setGlycemicCharge(double glycemicCharge) {
this.glycemicCharge = glycemicCharge;
}
public double getGlycemicCharge() {
return glycemicCharge;
}
}
|
/*
* 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 asighnment3;
import java.util.ArrayList;
/**
*
* @author Damian
*/
public class Passengers
{
private ArrayList <Passenger> passengers;
public Passengers(){
passengers = new ArrayList<>();
}
public void addPassenger (String PFName,String PLName, int PNumber){
passengers.add(new Passenger(PFName,PLName,PNumber));
System.out.println("passenger added");
}
}
|
package com.cg.javafillstack.collection.set;
import java.util.Collections;
import java.util.Iterator;
import java.util.TreeSet;
public class TestE {
public static void main(String[] args) {
TreeSet<Product> ts=new TreeSet<Product>();
Product p1=new Product(5, "Soap", 50 );
Product p2=new Product(1, "Towel", 60);
Product p3=new Product(2, "Shirt", 600);
Product p4=new Product(3, "Bottle", 30);
Collections.sort(ts);
Iterator<Product> it=ts.iterator();
while(it.hasNext())
{
Product p=it.next();
System.out.println(p.id);
System.out.println(p.name);
System.out.println(p.price);
}
}
}
|
package game.app.convert;
import org.springframework.core.convert.converter.Converter;
import game.app.dtos.response.StockResponse;
import game.app.entities.Stock;
public class StockToStockResponseConverter implements Converter<Stock,StockResponse>{
@Override
public StockResponse convert(Stock stock) {
StockResponse stockResponse = new StockResponse();
stockResponse.setCantidad(stock.getCantidad());
stockResponse.setGame(stock.getGame());
stockResponse.setShop(stock.getShop());
return stockResponse;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.