text
stringlengths
10
2.72M
/* * 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. */ /** * * @author talita */ public class GameValidations { // -------------------- gameArrayValidation -------------------- // //variables private String[] gameWords = {"algorithm", "application", "backup", "bit", "buffer", "bandwidth", "broadband", "bug", "binary", "browser", "bus", "cache", "command", "computer", "cookie", "compiler", "cyberspace", "compress", "configure", "database", "digital", "data", "debug", "desktop", "disk", "domain", "decompress", "development", "download", "dynamic", "email", "encryption", "firewall", "flowchart", "file", "folder", "graphics", "hyperlink", "host", "hardware", "icon", "inbox", "internet", "kernel", "keyword", "keyboard", "laptop", "login", "logic", "malware", "motherboard", "mouse", "mainframe", "memory", "monitor", "multimedia", "network", "node", "offline", "online", "path", "process", "protocol", "password", "phishing", "platform", "program", "portal", "privacy", "programmer", "queue", "resolution", "root", "restore", "router", "reboot", "runtime", "screen", "security", "shell", "snapshot", "spam", "screenshot", "server", "script", "software", "spreadsheet", "storage", "syntax", "table", "template", "thread", "terminal", "username", "virtual", "virus", "web", "website", "window", "wireless", "aa", "ee", "ii","oo", "uu"}; private boolean found = false; private int index = 0; private String playerWord; //setter method placeholder for the user input public void setPlayerWord(String playerWord){ this.playerWord = playerWord; } //method to check if the user word provided are included in the Array public void gameArrayValidation() { for (int i = 0; i < gameWords.length; i++) { if (playerWord.equals(gameWords[i])) { index = i; found = true; break; } } if(found){ // found = true System.out.println(playerWord +" was found in game Dictionary!"); } else { System.out.println("But "+ playerWord +" was not found in game Dictionary!"); } } // return the boolean true if the word was found or false if is not found public boolean getFound(){ return found; } // -------------------- checkStringMatch ------------------------ // // variables private int count = 0; private String randomString; private String userInput; public void setRandomString(String randomString){ this.randomString = randomString; } public void setUserInput(String userInput){ this.userInput = userInput; } public void checkStringMatch(String randomString, String userInput) { for (int x = 0; x < userInput.length(); x++) { for (int y = 0; y < randomString.length(); y++) { if (userInput.charAt(x) == randomString.charAt(y)) { count++; break; } } } } public boolean getCount(){ return count == userInput.length(); } //------------------------- countTheVowels --------------------------// // variables private int countA = 0; private int countE = 0; private int countI = 0; private int countO = 0; private int countU = 0; private String theWord; // setter method to placehold a String public void setTheWord(String theWord) { this.theWord = theWord; } // method to count the vowels public void countTheVowels() { for (int i=0 ; i<theWord.length(); i++) { char vowel = theWord.charAt(i); if (vowel == 'a'){ countA ++; } else if (vowel == 'e') { countE ++; } else if (vowel == 'i') { countI ++; } else if (vowel == 'o') { countO ++; } else if (vowel == 'u') { countU ++; } } } // getter methods to return the count of each vowel public int getCountA(){ return countA; } public int getCountE(){ return countE; } public int getCountI(){ return countI; } public int getCountO(){ return countO; } public int getCountU(){ return countU; } }
package com.samy.study.dto.com.samy.study.service; import com.samy.study.dto.Address; import com.samy.study.dto.UserDetails; import com.samy.study.dto.Vehicle; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import java.util.Date; /** * Created by arthanarisamya on 20/10/16. */ public class UserDetailsService { public static void main(String args[]){ SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); Session session = sessionFactory.openSession(); session.getTransaction().begin(); UserDetails userDetails = createUserDetails(); Vehicle vehicle = createVehicleDetails("Bike"); // vehicle.setUserDetail(userDetails); Vehicle vehicle2 = createVehicleDetails("Jeep"); // vehicle2.setUserDetail(userDetails); userDetails.getVehicles().add(vehicle); userDetails.getVehicles().add(vehicle2); session.persist(userDetails); // session.save(vehicle); // session.save(vehicle2); session.getTransaction().commit(); session.close(); // Reading the value from DB // session = sessionFactory.openSession(); userDetails = null; // Initializing to null // userDetails = session.get(UserDetails.class, 1504); // session.close(); sessionFactory.close(); System.out.println("Done......."); } public static UserDetails createUserDetails(){ UserDetails userDetails = new UserDetails(); userDetails.setUserId(1504); userDetails.setUserName("Samy A"); userDetails.setDesignation("Designation"); userDetails.setJoinedDate(new Date()); // userDetails.setVehicle(createVehicleDetails()); return userDetails; } public static Vehicle createVehicleDetails(String vehicleName) { Vehicle vehicle = new Vehicle(); vehicle.setVehicleName(vehicleName); return vehicle; } }
package com.smartwerkz.bytecode.vm.methods; import com.smartwerkz.bytecode.classfile.Classfile; import com.smartwerkz.bytecode.primitives.JavaClassReference; import com.smartwerkz.bytecode.vm.Frame; import com.smartwerkz.bytecode.vm.LocalVariables; import com.smartwerkz.bytecode.vm.OperandStack; import com.smartwerkz.bytecode.vm.RuntimeDataArea; public class ClassGetSuperclass implements NativeMethod { @Override public void execute(RuntimeDataArea rda, Frame frame, OperandStack operandStack) { LocalVariables localVariables = frame.getLocalVariables(); JavaClassReference clazz = (JavaClassReference) localVariables.getLocalVariable(0); String clazzName = clazz.getClassFile().getSuperClassName(); if (clazzName == null) { operandStack.push(rda.vm().objects().nullReference()); } else { Classfile loadClass = rda.loadClass(frame.getVirtualThread(), clazzName); operandStack.push(loadClass.getAsJavaClassReference()); } } }
package com.company.View; import com.company.manager.ManagerJuego; import com.company.manager.ManagerUsuarios; import java.util.Scanner; public class PantallaPrincipal { public void mostrar(ManagerJuego managerJuego , ManagerUsuarios managerUsuarios) { while(true) { System.out.println("VideoGapp"); System.out.println("a) Ultimos videojuegos añadidos"); System.out.println("b) Valoracion de videojuegos"); System.out.println("c) Buscar "); System.out.println("d) Mis favoritos"); System.out.println("e) Añadir videojuego"); System.out.println("f) Listar juegos"); System.out.println("g) Salir cuenta"); System.out.println("h) Salir del programa"); Scanner scanner = new Scanner(System.in); String opcion = scanner.nextLine(); if ("a".equals(opcion) || "A".equals(opcion) ) { PantallaUltimos pantallaUltimos = new PantallaUltimos(); pantallaUltimos.mostrar(managerJuego,managerUsuarios); } else if ("b".equals(opcion)|| "B".equals(opcion)) { PantallaValorados pantallaValorados = new PantallaValorados(); pantallaValorados.mostrar(managerJuego,managerUsuarios); } else if ("c".equals(opcion)|| "C".equals(opcion)) { PantallaBuscar pantallaBuscar = new PantallaBuscar(); pantallaBuscar.mostrar(managerJuego, managerUsuarios); } else if ("d".equals(opcion)|| "D".equals(opcion)) { PantallaFavoritos pantallaFavoritos = new PantallaFavoritos(); pantallaFavoritos.mostrar(managerJuego, managerUsuarios); } else if ("e".equals(opcion)|| "E".equals(opcion)) { PantallaCrearJuego pantallaCrearJuego = new PantallaCrearJuego(); pantallaCrearJuego.mostrar(managerJuego, managerUsuarios); } else if ("f".equals(opcion)|| "F".equals(opcion)) { PantallaListarJuego pantallaListarJuego =new PantallaListarJuego(); pantallaListarJuego.mostrar(managerJuego,managerUsuarios); } else if ("g".equals(opcion)|| "G".equals(opcion)) { PantallaMenuAcceso pantallaMenuAcceso = new PantallaMenuAcceso(); pantallaMenuAcceso.mostrar(managerJuego, managerUsuarios); } else if ("h".equals(opcion)|| "H".equals(opcion)) { return; }else{ System.out.println("Error opcion no valida"); PantallaPrincipal pantallaPrincipal = new PantallaPrincipal(); pantallaPrincipal.mostrar(managerJuego, managerUsuarios); } } } }
package com.shopguide; import java.util.Arrays; import java.util.List; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; import com.android.volley.toolbox.ImageLoader; public class ShopItemsActivity extends Activity { private ListView listView; private ListAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_shop_items); listView = (ListView) findViewById(R.id.list); adapter = new ListAdapter(this, Arrays.asList("Item 1","Item 2","Item 3")); listView.setAdapter(adapter); // changing action bar color getActionBar().setBackgroundDrawable( new ColorDrawable(Color.parseColor("#1b1b1b"))); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Intent intent = new Intent(getApplicationContext(), ShopListActivity.class); startActivity(intent); } }); adapter.notifyDataSetChanged(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.shop_items, menu); return true; } class ListAdapter extends BaseAdapter { private Activity activity; private LayoutInflater inflater; private List<String> data; ImageLoader imageLoader = AppController.getInstance().getImageLoader(); public ListAdapter(Activity activity, List<String> items) { this.activity = activity; this.data = items; } @Override public int getCount() { return data.size(); } @Override public Object getItem(int location) { return data.get(location); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (inflater == null) inflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (convertView == null) convertView = inflater.inflate(R.layout.items_list_item, null); TextView itemName = (TextView) convertView.findViewById(R.id.itemName); itemName.setText(data.get(position)); return convertView; } } @Override public void onBackPressed() { Log.d("Shop Items Activity", "onBackPressed Called"); Intent setIntent = new Intent(getApplicationContext(),MainActivity.class); startActivity(setIntent); } }
package com.project.mcl.comfort_prediction_things_client.Sensor; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.util.Log; import com.google.android.things.contrib.driver.bmx280.Bmx280SensorDriver; import java.io.IOException; public class BME280Sensor { private static final String TAG = BME280Sensor.class.getSimpleName(); private Context context; private String pin; private Bmx280SensorDriver bmx280SensorDriver; private SensorManager sensorManager; private float temperature; private int temperatureCount; private float pressure; private int pressureCount; private float humidity; private int humidityCount; private int sensingTerm; private SensorCallback sensorCallback; public BME280Sensor(Context context, String pin) { this.context = context; this.pin = pin; humidityCount = 0; pressureCount = 0; temperatureCount = 0; } private SensorEventListener temperatureSensorEventListener = new SensorEventListener() { @Override public void onSensorChanged(SensorEvent event) { temperature = event.values[0]; temperatureCount = temperatureCount % sensingTerm; if (temperatureCount == 0) { sensorCallback.changeTemperature(temperature); } temperatureCount++; } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { Log.i(TAG, "temperature sensor accuracy changed: " + accuracy); } }; private SensorEventListener pressureSensorEventListener = new SensorEventListener() { @Override public void onSensorChanged(SensorEvent event) { pressure = event.values[0]; pressureCount = pressureCount % sensingTerm; if (pressureCount == 0) { sensorCallback.changePressure(pressure); } pressureCount++; } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { Log.i(TAG, "pressure sensor accuracy changed: " + accuracy); } }; private SensorEventListener humiditySensorEventListener = new SensorEventListener() { @Override public void onSensorChanged(SensorEvent event) { humidity = event.values[0]; if (humidity > 50) { humidity = 0.8f * humidity - 0.2f * 50; } else { humidity = 0.2f * 50 - 0.8f * humidity; } humidityCount = humidityCount % sensingTerm; if (humidityCount == 0) { sensorCallback.changeHumidity(humidity); } humidityCount++; } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { Log.i(TAG, "humidity sensor accuracy changed: " + accuracy); } }; private SensorManager.DynamicSensorCallback dynamicSensorCallback = new SensorManager.DynamicSensorCallback() { @Override public void onDynamicSensorConnected(Sensor sensor) { if (sensor.getType() == Sensor.TYPE_AMBIENT_TEMPERATURE) { Log.i(TAG, "TYPE_AMBIENT_TEMPERATURE connected"); System.out.println(sensor.toString()); sensorManager.registerListener(temperatureSensorEventListener, sensor, SensorManager.SENSOR_DELAY_NORMAL); } else if (sensor.getType() == Sensor.TYPE_PRESSURE) { Log.i(TAG, "TYPE_PRESSURE connected"); System.out.println(sensor.toString()); sensorManager.registerListener(pressureSensorEventListener, sensor, SensorManager.SENSOR_DELAY_NORMAL); } else if (sensor.getType() == Sensor.TYPE_RELATIVE_HUMIDITY) { Log.i(TAG, "TYPE_RELATIVE_HUMIDITY connected"); System.out.println(sensor.toString()); sensorManager.registerListener(humiditySensorEventListener, sensor, SensorManager.SENSOR_DELAY_NORMAL); } } }; public void register(SensorCallback sensorCallback, int sensingTerm) { this.sensorCallback = sensorCallback; this.sensingTerm = sensingTerm; sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); sensorManager.registerDynamicSensorCallback(dynamicSensorCallback); try { bmx280SensorDriver = new Bmx280SensorDriver(pin); bmx280SensorDriver.registerTemperatureSensor(); bmx280SensorDriver.registerPressureSensor(); bmx280SensorDriver.registerHumiditySensor(); } catch (IOException e) { e.printStackTrace(); } } public void unregister() { sensorManager.unregisterDynamicSensorCallback(dynamicSensorCallback); sensorManager.unregisterListener(pressureSensorEventListener); sensorManager.unregisterListener(temperatureSensorEventListener); sensorManager.unregisterListener(humiditySensorEventListener); if (bmx280SensorDriver != null) { bmx280SensorDriver.unregisterTemperatureSensor(); bmx280SensorDriver.unregisterPressureSensor(); bmx280SensorDriver.registerHumiditySensor(); try { bmx280SensorDriver.close(); } catch (IOException e) { e.printStackTrace(); } finally { bmx280SensorDriver = null; } } } public float getTemperature() { return temperature; } public float getPressure() { return pressure; } public float getHumidity() { return humidity; } }
package com.brainmentors.customers; public class Consumer { public static void main(String[] args) { //IProducer p = new FasterProducer(); // Upcasting IProducer p = Factory.getObject(); p.first(); //p.second(999); } }
package com.example.prefecture.domain.model.prefecture; import lombok.AllArgsConstructor; import lombok.Data; @Data @AllArgsConstructor public class Prefecture { private final String code; private final String name; }
/* * created 24.02.2006 * * Copyright 2009, ByteRefinery * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * $Id: SVGDiagramExporter.java 472 2006-08-21 14:44:02Z cse $ */ package com.byterefinery.rmbench.export.diagram; import java.io.OutputStream; import java.io.OutputStreamWriter; import org.apache.batik.svggen.SVGGraphics2DIOException; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg.export.GraphicsSVG; import com.byterefinery.rmbench.export.ExportPlugin; import com.byterefinery.rmbench.external.export.AbstractDiagramExporter; /** * an exporter that will create a SVG file from a diagram * * @author cse */ public class SVGDiagramExporter extends AbstractDiagramExporter { protected void doExport(OutputStream out, IFigure figure) { Rectangle bounds = getBounds(figure); GraphicsSVG graphics = GraphicsSVG.getInstance(bounds.getTranslated(bounds.getLocation().negate())); graphics.translate(bounds.getLocation().negate()); figure.paint(graphics); OutputStreamWriter writer = new OutputStreamWriter(out); try { graphics.getSVGGraphics2D().stream(writer); } catch (SVGGraphics2DIOException e) { ExportPlugin.logError(e); } finally { graphics = null; } } }
package com.mobilephone.foodpai.activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import com.mobilephone.foodpai.R; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import cn.bmob.v3.BmobUser; import cn.sharesdk.framework.Platform; import cn.sharesdk.framework.ShareSDK; import cn.sharesdk.sina.weibo.SinaWeibo; import cn.sharesdk.tencent.qq.QQ; import cn.sharesdk.wechat.friends.Wechat; public class SetingActivity extends AppCompatActivity { private static final String TAG = "SetingActivity-test"; @BindView(R.id.ivBack) ImageView ivBack; @BindView(R.id.ivI) ImageView ivI; @BindView(R.id.tvCache) TextView tvCache; @BindView(R.id.rlCache) RelativeLayout rlCache; @BindView(R.id.rlSuggest) RelativeLayout rlSuggest; @BindView(R.id.rlScore) RelativeLayout rlScore; @BindView(R.id.rlShare) RelativeLayout rlShare; private Button btnClearUser; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_seting); ButterKnife.bind(this); initClearUserClick(); // getCurrentUser(); } private void getCurrentUser() { BmobUser currentUser = BmobUser.getCurrentUser(); if (currentUser != null) { btnClearUser.setVisibility(View.VISIBLE); } else { btnClearUser.setVisibility(View.GONE); } } @Override protected void onResume() { super.onResume(); getCurrentUser(); } private void initClearUserClick() { btnClearUser = ((Button) findViewById(R.id.btnClearUser)); btnClearUser.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { BmobUser.logOut(); //撤销qq授权 Platform qq = ShareSDK.getPlatform(QQ.NAME); if (qq.isAuthValid()) { qq.removeAccount(true); } //撤销微信授权 Platform wechat = ShareSDK.getPlatform(Wechat.NAME); if (wechat.isAuthValid()) { wechat.removeAccount(true); } //撤销新浪微博授权 Platform weibo = ShareSDK.getPlatform(SinaWeibo.NAME); if (weibo.isAuthValid()) { weibo.removeAccount(true); } getCurrentUser(); finish(); } }); } @OnClick(R.id.ivBack) public void onInBackClick(View view) { finish(); } }
package com.tencent.mm.plugin.honey_pay.ui; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.text.SpannableStringBuilder; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import com.tencent.mm.ab.l; import com.tencent.mm.plugin.honey_pay.a.j; import com.tencent.mm.plugin.honey_pay.model.c; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.plugin.wallet_core.model.Bankcard; import com.tencent.mm.plugin.wallet_core.model.ag; import com.tencent.mm.plugin.wallet_core.model.o; import com.tencent.mm.plugin.wallet_core.ui.f; import com.tencent.mm.plugin.wallet_core.ui.m; import com.tencent.mm.plugin.wxpay.a$f; import com.tencent.mm.plugin.wxpay.a$g; import com.tencent.mm.plugin.wxpay.a.i; import com.tencent.mm.pluginsdk.ui.a.b; import com.tencent.mm.protocal.c.amo; import com.tencent.mm.protocal.c.aze; import com.tencent.mm.protocal.c.bao; import com.tencent.mm.protocal.c.bdi; import com.tencent.mm.protocal.c.btd; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.widget.MMSwitchBtn; import com.tencent.mm.ui.widget.MMSwitchBtn.a; import com.tencent.mm.wallet_core.c.v; import com.tencent.mm.wallet_core.ui.WalletTextView; import com.tencent.mm.wallet_core.ui.e; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class HoneyPayCardManagerUI extends HoneyPayBaseUI { private int fdx; private ImageView hVP; private ViewGroup imf; private ViewGroup kkA; private ViewGroup kkB; private TextView kkC; private MMSwitchBtn kkD; private LinearLayout kkE; private TextView kkF; private TextView kkG; private TextView kkH; private View kkI; private View kkJ; private a kkK; private List<aze> kkL = new ArrayList(); private Bankcard kkM; private bao kkN; private bao kkO; private long kkP; private long kkQ; private boolean kkR; private String kkS; private String kkc; private btd kkd; private TextView kkg; private TextView kki; private TextView kkj; private TextView kkk; private TextView kkl; private WalletTextView kkw; private ListView kkz; static /* synthetic */ void e(HoneyPayCardManagerUI honeyPayCardManagerUI) { x.i(honeyPayCardManagerUI.TAG, "do modify pay way"); j jVar = new j(honeyPayCardManagerUI.kkN, honeyPayCardManagerUI.kkc); jVar.m(honeyPayCardManagerUI); honeyPayCardManagerUI.a(jVar, false, false); } static /* synthetic */ void f(HoneyPayCardManagerUI honeyPayCardManagerUI) { x.i(honeyPayCardManagerUI.TAG, "show select payway dialog"); List<Bankcard> jl = o.bOW().jl(true); List arrayList = new ArrayList(); for (Bankcard bankcard : jl) { if (bankcard.bOw()) { x.i(honeyPayCardManagerUI.TAG, "remove honey card %s", new Object[]{bankcard.field_bindSerial}); } else { arrayList.add(bankcard); } } f.a(honeyPayCardManagerUI, arrayList, honeyPayCardManagerUI.kkM, honeyPayCardManagerUI.getString(i.honey_pay_manager_select_first_payway_text), honeyPayCardManagerUI.getString(i.honey_pay_manager_select_first_payway_desc_text), new 6(honeyPayCardManagerUI, arrayList)); h.mEJ.h(15191, new Object[]{Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0)}); } static /* synthetic */ void h(HoneyPayCardManagerUI honeyPayCardManagerUI) { x.i(honeyPayCardManagerUI.TAG, "go to quata ui"); Intent intent = new Intent(honeyPayCardManagerUI, HoneyPayModifyQuotaUI.class); intent.putExtra("key_max_credit_line", honeyPayCardManagerUI.kkP); intent.putExtra("key_min_credit_line", honeyPayCardManagerUI.kkQ); intent.putExtra("key_card_no", honeyPayCardManagerUI.kkc); honeyPayCardManagerUI.startActivityForResult(intent, 1); h.mEJ.h(15191, new Object[]{Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(0)}); } public void onCreate(Bundle bundle) { super.onCreate(bundle); jr(2876); jr(2742); jr(2941); this.kkc = getIntent().getStringExtra("key_card_no"); this.fdx = getIntent().getIntExtra("key_scene", 0); this.kkR = getIntent().getBooleanExtra("key_is_create", false); this.kkS = getIntent().getStringExtra("key_card_type"); initView(); x.d(this.TAG, "cardtype: %s", new Object[]{this.kkS}); setMMTitle(i.honey_pay_main_title); if (this.fdx == 1) { bdi bdi = new bdi(); try { bdi.aG(getIntent().getByteArrayExtra("key_qry_response")); a(bdi); return; } catch (Throwable e) { x.printErrStackTrace(this.TAG, e, "", new Object[0]); aWg(); return; } } aWg(); } protected final void initView() { this.imf = (ViewGroup) LayoutInflater.from(this).inflate(a$g.honey_pay_card_setting_header_layout, null); this.kkD = (MMSwitchBtn) this.imf.findViewById(a$f.hpcs_notify_sb); this.kkE = (LinearLayout) this.imf.findViewById(a$f.hpcs_payway_layout); this.kkG = (TextView) this.imf.findViewById(a$f.hpcs_payway_tv); this.hVP = (ImageView) this.imf.findViewById(a$f.hpcs_avatar_iv); this.kkw = (WalletTextView) this.imf.findViewById(a$f.hpcs_quota_tv); this.kkF = (TextView) this.imf.findViewById(a$f.hpcs_user_name_tv); this.kkC = (TextView) this.imf.findViewById(a$f.hpcs_modify_quota_tv); this.kkg = (TextView) this.imf.findViewById(a$f.hpcs_state_tv); this.kkH = (TextView) this.imf.findViewById(a$f.hpcs_state_desc_tv); this.kki = (TextView) this.imf.findViewById(a$f.hpcs_first_date_title_tv); this.kkk = (TextView) this.imf.findViewById(a$f.hpcs_first_date_tv); this.kkj = (TextView) this.imf.findViewById(a$f.hpcs_second_date_title_tv); this.kkl = (TextView) this.imf.findViewById(a$f.hpcs_second_date_tv); this.kkI = this.imf.findViewById(a$f.hpcs_bottom_logo_iv); this.kkw.setPrefix(v.cDm()); this.kkD.setSwitchListener(new a() { public final void cf(boolean z) { int i = 1; x.d(HoneyPayCardManagerUI.this.TAG, "check %s", new Object[]{Boolean.valueOf(z)}); HoneyPayCardManagerUI honeyPayCardManagerUI = HoneyPayCardManagerUI.this; if (!z) { i = 0; } HoneyPayCardManagerUI.a(honeyPayCardManagerUI, i); } }); this.kkE.setOnClickListener(new 4(this)); Object string = getString(i.honey_pay_max_quota_monthly); CharSequence spannableStringBuilder = new SpannableStringBuilder(string); spannableStringBuilder.append(getString(i.honey_pay_max_quota_monthly_modify)); spannableStringBuilder.setSpan(new m(new 5(this)), string.length(), spannableStringBuilder.length(), 18); this.kkC.setClickable(true); this.kkC.setOnTouchListener(new com.tencent.mm.pluginsdk.ui.d.m(this)); this.kkC.setText(spannableStringBuilder); this.kkA = (ViewGroup) LayoutInflater.from(this).inflate(a$g.honey_pay_card_setting_footer_layout, null); this.kkJ = findViewById(a$f.hpcs_block_view); this.kkz = (ListView) findViewById(a$f.hpcs_lv); this.kkz.addHeaderView(this.imf); this.kkz.addFooterView(this.kkA, null, false); this.kkK = new a(this, (byte) 0); this.kkz.setAdapter(this.kkK); this.kkz.setOnItemClickListener(new OnItemClickListener() { public final void onItemClick(AdapterView<?> adapterView, View view, int i, long j) { aze aze = (aze) adapterView.getAdapter().getItem(i); if (aze != null && !bi.oW(aze.url)) { x.i(HoneyPayCardManagerUI.this.TAG, "click item: %s, %s", new Object[]{Integer.valueOf(i), Long.valueOf(aze.sbV)}); e.l(HoneyPayCardManagerUI.this.mController.tml, aze.url, false); h.mEJ.h(15191, new Object[]{Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(0)}); } } }); } public void onDestroy() { super.onDestroy(); js(2876); js(2742); js(2941); } public final boolean d(int i, int i2, String str, l lVar) { if (lVar instanceof com.tencent.mm.plugin.honey_pay.a.l) { com.tencent.mm.plugin.honey_pay.a.l lVar2 = (com.tencent.mm.plugin.honey_pay.a.l) lVar; lVar2.a(new 10(this, lVar2)).b(new 9(this)).c(new 8(this)); } else if (lVar instanceof com.tencent.mm.plugin.honey_pay.a.i) { com.tencent.mm.plugin.honey_pay.a.i iVar = (com.tencent.mm.plugin.honey_pay.a.i) lVar; iVar.a(new 13(this)).b(new 12(this, iVar)).c(new 11(this, iVar)); } else if (lVar instanceof j) { ((j) lVar).a(new 2(this)).b(new 15(this)).c(new 14(this)); } return true; } protected void onActivityResult(int i, int i2, Intent intent) { if (i == 1) { if (i2 == -1 && intent.getBooleanExtra("key_modify_create_line_succ", false)) { this.kkw.setText(c.dK(intent.getLongExtra("key_credit_line", 0))); setResult(-1); } } else if (i == 2 && i2 == -1) { this.mController.removeAllOptionMenu(); setResult(-1); finish(); } super.onActivityResult(i, i2, intent); } protected final int getLayoutId() { return a$g.honey_pay_card_setting_ui; } private void aWg() { x.i(this.TAG, "do qry detail"); com.tencent.mm.plugin.honey_pay.a.l lVar = new com.tencent.mm.plugin.honey_pay.a.l(this.kkc); lVar.m(this); a(lVar, true, false); } private void a(bdi bdi) { this.kkd = bdi.rHg; this.kkL.clear(); this.kkK.notifyDataSetChanged(); if (bdi.ruX != null) { setMMTitle(bdi.ruX.hwg); this.kkP = bdi.rrY; this.kkQ = bdi.rrX; if (bdi.ruX.rPo != null) { this.kkM = adW(bdi.ruX.rPo.scY); this.kkN = bdi.ruX.rPo; } amo amo = bdi.ruX; this.kkF.setText(com.tencent.mm.pluginsdk.ui.d.j.a(this, e.dy(amo.rrW, 6) + getString(i.honey_pay_max_quota_monthly), this.kkF.getTextSize())); b.a(this.hVP, amo.rrW, 0.06f, false); this.kkw.setText(c.dK(amo.ruW)); this.kkD.setCheck(amo.peW != 0); aWh(); int i = bdi.ruX.state; x.i(this.TAG, "detail state: %s", new Object[]{Integer.valueOf(i)}); x.d(this.TAG, "state title: %s", new Object[]{bdi.ruX.rPr}); if (bi.oW(bdi.ruX.rPr)) { this.kkg.setVisibility(8); } else { this.kkg.setText(bdi.ruX.rPr); this.kkg.setVisibility(0); } if (bi.oW(bdi.ruX.rPn)) { this.kkH.setVisibility(8); } else { this.kkH.setText(bdi.ruX.rPn); this.kkH.setVisibility(0); } if (i == 1) { this.kkg.setTextColor(Color.parseColor("#FA9D3B")); this.kkw.setTextColor(Color.parseColor("#B2B2B2")); findViewById(a$f.hpcs_date_layout).setVisibility(8); this.kkz.removeFooterView(this.kkA); this.kkA.setVisibility(8); this.kkI.setVisibility(8); if (this.kkR) { this.kkB = (ViewGroup) LayoutInflater.from(this).inflate(a$g.honey_pay_card_setting_footer_finish_layout, null); ((Button) this.kkB.findViewById(a$f.hpcs_finish_btn)).setOnClickListener(new 7(this)); this.kkz.addFooterView(this.kkB); showHomeBtn(false); enableBackMenu(false); setMMTitle(""); } } else if (i == 2) { if (!(bdi.qYU == null || bdi.qYU.isEmpty())) { this.kkL = bdi.qYU; this.kkK.notifyDataSetChanged(); this.kkz.removeFooterView(this.kkA); this.kkA.setVisibility(8); findViewById(a$f.hpcs_root_view).setBackgroundResource(com.tencent.mm.plugin.wxpay.a.c.honey_pay_grey_bg_1); } this.kkC.setVisibility(0); this.kkw.setVisibility(0); this.kkI.setVisibility(0); findViewById(a$f.hpcs_date_layout).setVisibility(8); } else if (i == 3) { findViewById(a$f.hpcs_date_layout).setVisibility(0); this.kki.setText(i.honey_pay_create_date_title_text); this.kkj.setText(i.honey_pay_return_date_title_text); this.kkk.setText(c.dL((long) bdi.ruX.create_time)); this.kkl.setText(c.dL((long) bdi.ruX.huK)); this.kkz.removeFooterView(this.kkA); this.kkA.setVisibility(8); this.kkI.setVisibility(8); findViewById(a$f.hpcs_setting_layout).setVisibility(8); } else if (i == 4) { this.kkC.setVisibility(8); findViewById(a$f.hpcs_date_layout).setVisibility(0); this.kki.setText(i.honey_pay_release_date_title_text); this.kkk.setText(c.dL((long) bdi.ruX.rPp)); findViewById(a$f.hpcs_second_date_layout).setVisibility(8); this.kkz.removeFooterView(this.kkA); this.kkA.setVisibility(8); this.kkI.setVisibility(8); findViewById(a$f.hpcs_setting_layout).setVisibility(8); findViewById(a$f.hpcs_root_view).setBackgroundResource(com.tencent.mm.plugin.wxpay.a.c.white); } else { x.d(this.TAG, "unknown state: %s", new Object[]{Integer.valueOf(i)}); } } this.kkJ.setVisibility(8); c.a(this, bdi.rPi, this.kkc, 2, this.kkd); } private static Bankcard adW(String str) { Bankcard bankcard; Bankcard bankcard2; ag bOW = o.bOW(); if (bOW.pcZ != null) { Iterator it = bOW.pcZ.iterator(); while (it.hasNext()) { bankcard = (Bankcard) it.next(); if (bankcard.field_bindSerial.equals(str)) { bankcard2 = bankcard; break; } } } bankcard2 = null; if (bankcard2 == null) { bankcard = o.bOW().prG; if (bankcard != null && bankcard.field_bindSerial.equals(str)) { return bankcard; } } return bankcard2; } private void aWh() { if (this.kkN != null) { this.kkG.setText(this.kkN.scW); if (bi.oW(this.kkN.scX)) { this.kkG.setTextColor(getResources().getColor(com.tencent.mm.plugin.wxpay.a.c.normal_text_color)); return; } else { this.kkG.setTextColor(Color.parseColor(this.kkN.scX)); return; } } x.i(this.TAG, "reset payway view for null"); this.kkG.setText(""); this.kkG.setTextColor(getResources().getColor(com.tencent.mm.plugin.wxpay.a.c.normal_text_color)); } }
package HealthMonitorMng.controller; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import HealthMonitorMng.hbm.base.QuestionFormula; import HealthMonitorMng.model.AjaxJson; import HealthMonitorMng.model.ChartJson; import HealthMonitorMng.model.DataGrid; import HealthMonitorMng.model.DataGridJson; import HealthMonitorMng.model.DepartmentModel; import HealthMonitorMng.model.SportsCondition; import HealthMonitorMng.service.QuestionFormulaServiceI; import HealthMonitorMng.service.background.DepartmentServiceI; import HealthMonitorMng.util.CustomDateEditor; /** * @ClassName: DepartmentController * @Description: 公式控制器 * @author DingMingliang * @date 2015年3月11日 */ @Controller @RequestMapping("/admin/questionFormulaController") public class QuestionFormulaController extends BaseController { /** * Logger for this class */ private static final Logger logger = Logger .getLogger(QuestionFormulaController.class); private QuestionFormulaServiceI questionFormulaService; /** * questionFormulaService * * @return the questionFormulaService * @since CodingExample Ver 1.0 */ public QuestionFormulaServiceI getQuestionFormulaService() { return questionFormulaService; } /** * questionFormulaService * * @param questionFormulaService * the questionFormulaService to set * @since CodingExample Ver 1.0 */ @Autowired public void setQuestionFormulaService( QuestionFormulaServiceI questionFormulaService) { this.questionFormulaService = questionFormulaService; } /** * index:后台功能页面跳转到首页 仅在后台easy-ui中做跳转使用 * * @param @return 返回jsp地址 * @return String DOM对象 * @throws * @since CodingExample Ver 1.1 */ @RequestMapping(params = "index") public String index() { return "admin/questionFormula/index"; } /** * datagrid:后台面板 * * @param @param dg * @param @param questionFormula * @param @return 设定文件 * @return DataGridJson DOM对象 * @throws * @since CodingExample Ver 1.1 */ @RequestMapping(params = "datagrid") @ResponseBody public DataGridJson datagrid(DataGrid dg, QuestionFormula questionFormula) { return questionFormulaService.datagrid(dg, questionFormula); } /** * add: 添加 * * @param @param request * @param @param questionFormula * @param @return 设定文件 * @return AjaxJson DOM对象 * @throws * @since CodingExample Ver 1.1 */ @RequestMapping(params = "add") @ResponseBody public AjaxJson add(HttpServletRequest request, QuestionFormula questionFormula) { AjaxJson j = new AjaxJson(); try { questionFormulaService.add(questionFormula); j.setSuccess(true); j.setMsg("添加成功!"); } catch (Exception e) { j.setMsg("添加失败!"); } return j; } /** * edit:编辑 * * @param @param request * @param @param questionFormula * @param @return 设定文件 * @return AjaxJson DOM对象 * @throws * @since CodingExample Ver 1.1 */ @RequestMapping(params = "edit") @ResponseBody public AjaxJson edit(HttpServletRequest request, QuestionFormula questionFormula) { AjaxJson j = new AjaxJson(); try { questionFormulaService.edit(questionFormula); j.setSuccess(true); j.setMsg("编辑成功!"); } catch (Exception e) { j.setMsg("编辑失败!"); } return j; } @InitBinder public void initBinder(ServletRequestDataBinder binder) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); binder.registerCustomEditor(Date.class, new CustomDateEditor( dateFormat, true)); } }
package com.fixit.rest.responses.data; import com.fixit.synchronization.SynchronizationResult; import java.util.Iterator; import java.util.List; /** * Created by Kostyantin on 3/27/2017. */ public class SynchronizationResponseData { private List<SynchronizationResult> synchronizationResults; public SynchronizationResponseData() { } public SynchronizationResponseData(List<SynchronizationResult> synchronizationResults) { this.synchronizationResults = synchronizationResults; } public List<SynchronizationResult> getSynchronizationResults() { return synchronizationResults; } public void setSynchronizationResults(List<SynchronizationResult> synchronizationResults) { this.synchronizationResults = synchronizationResults; } public String getDescription() { StringBuilder sb = new StringBuilder(); int resultCount = synchronizationResults.size(); if(resultCount > 0) { for(int i = 0; i < resultCount; i++) { SynchronizationResult result = synchronizationResults.get(i); SynchronizationResult.Result[] results = result.getResults(); sb.append(result.getName()).append("[").append(results != null ? results.length : 0).append("]"); if (!result.isSupported()) { sb.append("(UNSUPPORTED)"); } if(i - 1 < resultCount) { sb.append("; "); } } } else { sb.append("NA"); } return sb.toString(); } @Override public String toString() { return "SynchronizationResponseData{" + "synchronizationResults=" + synchronizationResults + '}'; } }
package com.cnk.travelogix.suppliers.events; import com.cnk.travelogix.suppliers.model.SendFileStatusProcessModel; import de.hybris.platform.commerceservices.event.AbstractSiteEventListener; import de.hybris.platform.processengine.BusinessProcessService; import de.hybris.platform.servicelayer.i18n.CommonI18NService; import de.hybris.platform.servicelayer.model.ModelService; import de.hybris.platform.servicelayer.user.UserService; import de.hybris.platform.site.BaseSiteService; import de.hybris.platform.store.services.BaseStoreService; /* * The listener interface for receiving CheckFileStatusEvent events. The class * that is interested in processing a CheckFileStatusEvent event implements this * interface, and the object created with that class is registered with a * component using the component's <code>add CheckFileStatusEventListener * <code> method. When the CheckFileStatusEvent event occurs, that object's * appropriate method is invoked. * * @author I323673 */ public class CheckFileStatusEventListener extends AbstractSiteEventListener<CheckFileStatusEvent> { /** The Constant CREATE_NOVEDAD_EMAIL_PROCESS. */ private static final String SEND_FILE_STATUS_PROCESS = "sendFileStatusProcess"; /** The business process service. */ private BusinessProcessService businessProcessService; /** The base site service. */ private BaseSiteService baseSiteService; /** The base store service. */ private BaseStoreService baseStoreService; /** The common i18 n service. */ private CommonI18NService commonI18NService; /** The model service. */ private ModelService modelService; /** The user service. */ private UserService userService; /** * (non-Javadoc) * * @see de.hybris.platform.commerceservices.event.AbstractSiteEventListener# * onSiteEvent(de.hybris.platform.servicelayer. * event.events.AbstractEvent) */ @Override protected void onSiteEvent(final CheckFileStatusEvent checkFileStatusEvent) { final SendFileStatusProcessModel sendFileStatusProcessModel = getBusinessProcessService().createProcess( SEND_FILE_STATUS_PROCESS + "-" + System.currentTimeMillis() + "-" + Math.random(), SEND_FILE_STATUS_PROCESS); sendFileStatusProcessModel.setEmail(checkFileStatusEvent.getEmailId()); sendFileStatusProcessModel.setSite(baseSiteService.getCurrentBaseSite()); sendFileStatusProcessModel.setStore(getBaseStoreService().getCurrentBaseStore()); sendFileStatusProcessModel.setLanguage(getCommonI18NService().getCurrentLanguage()); getModelService().save(sendFileStatusProcessModel); getBusinessProcessService().startProcess(sendFileStatusProcessModel); } /** * (non-Javadoc) * * @see de.hybris.platform.commerceservices.event.AbstractSiteEventListener# * shouldHandleEvent(de.hybris.platform. * servicelayer.event.events.AbstractEvent) */ @Override protected boolean shouldHandleEvent(final CheckFileStatusEvent arg0) { return true; } /** * Gets the business process service. * * @return the business process service */ public BusinessProcessService getBusinessProcessService() { return businessProcessService; } /** * Sets the business process service. * * @param businessProcessService * the new business process service */ public void setBusinessProcessService(BusinessProcessService businessProcessService) { this.businessProcessService = businessProcessService; } /** * Gets the base site service. * * @return the base site service */ public BaseSiteService getBaseSiteService() { return baseSiteService; } /** * Sets the base site service. * * @param baseSiteService * the new base site service */ public void setBaseSiteService(BaseSiteService baseSiteService) { this.baseSiteService = baseSiteService; } /** * Gets the base store service. * * @return the base store service */ public BaseStoreService getBaseStoreService() { return baseStoreService; } /** * Sets the base store service. * * @param baseStoreService * the new base store service */ public void setBaseStoreService(BaseStoreService baseStoreService) { this.baseStoreService = baseStoreService; } /** * Gets the common i18 n service. * * @return the common i18 n service */ public CommonI18NService getCommonI18NService() { return commonI18NService; } /** * Sets the common i18 n service. * * @param commonI18NService * the new common i18 n service */ public void setCommonI18NService(CommonI18NService commonI18NService) { this.commonI18NService = commonI18NService; } /** * Gets the model service. * * @return the model service */ public ModelService getModelService() { return modelService; } /** * Sets the model service. * * @param modelService * the new model service */ public void setModelService(ModelService modelService) { this.modelService = modelService; } /** * Gets the user service. * * @return the user service */ public UserService getUserService() { return userService; } /** * Sets the user service. * * @param userService * the new user service */ public void setUserService(UserService userService) { this.userService = userService; } }
package edu.monash.mymonashmate.client; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.HashMap; import java.util.Map; import org.apache.http.HttpException; import org.apache.http.HttpResponse; import android.os.AsyncTask; public class BackgroundWorker extends AsyncTask<Object, String, Object> { private static final String URL_CODE = "UTF-8"; private String baseURL = "http://10.0.2.2:8080"; private PostExecuteListener postExecuteListener; public BackgroundWorker(PostExecuteListener postListener){ postExecuteListener = postListener; } /* Parameters 0: URI 1: method 2: Accept 3: Content-Type 4: Header 5: Content */ @Override protected Object doInBackground(Object... params) { try { String uri = params[0].toString(); String method = params[1].toString(); URL url = new URL(baseURL + uri); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod(method); // Accept if (params.length > 2) { conn.setRequestProperty("Accept", params[2].toString()); } // Content-Type if (params.length > 3) { conn.setRequestProperty("Content-Type", params[3].toString()); } // Header if (params.length > 4 && null != params[4] && params[4] instanceof HashMap<?, ?>) { HashMap<String, String> header = (HashMap<String, String>) params[4]; for (Map.Entry<String, String> entry : header.entrySet()) { conn.setRequestProperty(entry.getKey(), URLEncoder.encode(entry.getValue(), URL_CODE)); } } // Content if (params.length > 5 && null != params[5]) { conn.setDoOutput(true); OutputStream out = conn.getOutputStream(); out.write(params[5].toString().getBytes()); out.flush(); } // use HTTP_ACCEPTED to indicate RESTful exception if (conn.getResponseCode() == HttpURLConnection.HTTP_ACCEPTED) { throw new UnsupportedOperationException(getResponseContent(conn)); } // allow return void. if (conn.getResponseCode() == HttpURLConnection.HTTP_NO_CONTENT){ return ""; } // handle other exceptions if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) { throw new Exception(conn.getResponseMessage() + "(" + conn.getResponseCode() + ")"); } // Acquire response content return getResponseContent(conn); } catch (Exception e) { return e; } } private String getResponseContent(HttpURLConnection conn) throws Exception{ BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); StringBuilder sb = new StringBuilder(); String line; while ((line=reader.readLine()) != null) { sb.append(line); } return sb.toString(); } @Override protected void onPostExecute(Object result) { if(null != postExecuteListener){ postExecuteListener.OnPostExecute(result); } } public interface PostExecuteListener{ public void OnPostExecute(Object result); } }
package com.nefee.prawn.web.dto.request; import lombok.*; @Getter @Setter @Builder @NoArgsConstructor @AllArgsConstructor @ToString public class BiSRequest { private String pawnstring; private Integer wowSpecId; private Integer numberT20Pieces; }
/* * Write a program to input a list of ten arrays as list1, list2...list10 * and sort them in an increasing order */ import java.util.Scanner; import java.util.Arrays; public class TodaysExample { /** Main method */ public static void main(String[] args) { int[] array = createArray(); sortArray(array); } private static void sortArray(int[] array) { Arrays.sort(array); System.out.println("After sorting the array is " ); } private static int[] createArray() { Scanner input = new Scanner(System.in); System.out.println("Please enter ten numbers of comma seperated : "); String list1 = input.nextLine(); String[] array = list1.split(","); int[] array1 = new int[array.length]; for (int i = 0; 0 < array.length; i++) { array1[i] = Integer.parseInt(array[i]); } return array1; } }
package com.tencent.mm.protocal; import com.tencent.mm.protocal.c.g; public class c$ia extends g { public c$ia() { super("setNavigationBarColor", "setNavigationBarColor", 182, false); } }
package sisgelar.controller; /* * 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. */ import java.util.List; import sisgelar.dao.OrdemServicoDao; import sisgelar.model.OrdemServico; /** * * @author Kaike Leite */ public abstract class OrdemServicoController { public static boolean cadastrar(OrdemServico p){ OrdemServicoDao dao = new OrdemServicoDao(); return dao.inserir(p); } public static boolean remover(OrdemServico p){ return new OrdemServicoDao().excluir(p); } public static List<OrdemServico> pesquisar(String t) { OrdemServicoDao dao = new OrdemServicoDao(); List<OrdemServico> pessoas = dao.buscar(t); return pessoas; } public static List<OrdemServico> pesquisar(int t) { OrdemServicoDao dao = new OrdemServicoDao(); List<OrdemServico> pessoas = dao.buscar(t); return pessoas; } public static boolean modificar(OrdemServico p) { OrdemServicoDao dao = new OrdemServicoDao(); return dao.alterar(p); } }
package com.tencent.mm.plugin.pwdgroup.ui; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.tencent.mm.R; class a$a { TextView eGX; ImageView gwj; final /* synthetic */ a maB; public a$a(a aVar, View view) { this.maB = aVar; this.gwj = (ImageView) view.findViewById(R.h.facing_icon); this.eGX = (TextView) view.findViewById(R.h.facing_title); } }
package com.designpattern.behaviorpattern.command; /** * 厨师 */ public class Chef implements Execute{ public void cooking(){ System.out.println("厨师烹饪ing"); } @Override public void execute() { cooking(); } }
package com.netease.qa.demo.controller; import com.netease.qa.demo.bean.DemoInstanceBean; import com.netease.qa.demo.constant.ProjectContant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class InstanceController { @Autowired DemoInstanceBean demoInstanceBean; @RequestMapping(value = "/instance" , produces = "text/plain;charset=UTF-8") String showVersion(){ return "The instance name is: " + demoInstanceBean.getInstanceName() + " and the instance owner is: " + demoInstanceBean.getInstanceOwner(); } }
package service; import javax.servlet.http.HttpServletRequest; import com.oreilly.servlet.MultipartRequest; import com.oreilly.servlet.multipart.DefaultFileRenamePolicy; public class FileService { public void fileUpload(HttpServletRequest request) { // 파일을 저장할 경로 만들기 // 현재 프로젝트의 WebContent/images 디렉토리에 저장 // 절대 경로 만들기 // 서블릿이 2.5버전이면 request.getRealPath("/images"); String uploadPath = request.getServletContext().getRealPath("/images"); System.out.println(uploadPath); // 파일 업로드 try { // 첫번째 매개변수는 HttpServletRequest 객체 // 두번째 매개변수는 파일이 저장될 위치 // 세번째 매개변수는 파일의 최대 크기 // 네번째 매개변수는 인코딩 방식 // 다섯번째 매개변수는 동일한 이름의 파일이 업로드 될 때 이름 지정 방식 MultipartRequest multi = new MultipartRequest(request, uploadPath, 1024*1024*10, "utf-8", new DefaultFileRenamePolicy()); }catch(Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }
/** * */ package com.goodhealth.design.demo.MemorandumPattern; /** * @author 24663 * @date 2018年10月27日 * @Description */ public class Memento { private int day; private int price; /** * @param day * @param price */ public Memento(int day, int price) { super(); this.day = day; this.price = price; } /** * @return the day */ public int getDay() { return day; } /** * @param day the day to set */ public void setDay(int day) { this.day = day; } /** * @return the price */ public int getPrice() { return price; } /** * @param price the price to set */ public void setPrice(int price) { this.price = price; } }
package com.tencent.mm.plugin.emoji.ui.v2; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.WindowManager; import android.view.WindowManager.LayoutParams; import android.widget.ListAdapter; import android.widget.ListView; import com.tencent.mm.R; import com.tencent.mm.pluginsdk.ui.emoji.PopEmojiView; import com.tencent.mm.sdk.platformtools.ag; public class PreViewListGridView extends ListView { private int OT; private WindowManager inU; private boolean isd = true; private LayoutParams isj; private int isk; private int isl; private int ism; private boolean isn; private volatile int iso = -1; private String isp; private PopEmojiView isq; private d isr; private ag mHandler = new ag(); public PreViewListGridView(Context context, AttributeSet attributeSet) { super(context, attributeSet); init(context); } public PreViewListGridView(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); init(context); } private void init(Context context) { this.isq = new PopEmojiView(getContext()); this.isk = context.getResources().getDimensionPixelSize(R.f.emoji_preview_image_size); this.inU = (WindowManager) context.getSystemService("window"); this.isj = new LayoutParams(-1, -1, 2, 8, 1); this.isj.width = this.isk; this.isj.height = this.isk; this.isj.gravity = 17; this.OT = getResources().getConfiguration().orientation; if (this.OT == 2) { this.isl = this.inU.getDefaultDisplay().getHeight(); this.ism = this.inU.getDefaultDisplay().getWidth(); return; } this.isl = this.inU.getDefaultDisplay().getWidth(); this.ism = this.inU.getDefaultDisplay().getHeight(); } public void setAdapter(ListAdapter listAdapter) { super.setAdapter(listAdapter); this.isr = (d) listAdapter; } public boolean onInterceptTouchEvent(MotionEvent motionEvent) { switch (motionEvent.getAction()) { case 1: case 3: if (this.isn) { aGu(); return true; } break; } return super.onInterceptTouchEvent(motionEvent); } public final void aGu() { if (this.isn) { this.inU.removeView(this.isq); this.isn = false; } this.isp = ""; } public void setEnablePreView(boolean z) { this.isd = z; } }
package edunova; public class DomacaZadaca { //polako svakodnevno na ovim mrežnim mjestima vježbati zadatke i čitati //http://www.znanje.org/knjige/computer/Java/ib01/88_quiz/quiz_java5abc1_0.php //https://www.hackerrank.com/domains/java //https://www.w3resource.com/java-exercises/basic/index.php //https://codingbat.com/java //https://www.codecademy.com/learn/learn-java }
package pt.pagamigo.ws.client; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.ObjectOutputStream; import java.net.PasswordAuthentication; import java.net.UnknownHostException; import java.security.KeyFactory; import java.security.PublicKey; import java.security.spec.X509EncodedKeySpec; import java.util.*; import javax.crypto.Cipher; import javax.naming.NamingException; import javax.xml.registry.BulkResponse; import javax.xml.registry.BusinessQueryManager; import javax.xml.registry.Connection; import javax.xml.registry.ConnectionFactory; import javax.xml.registry.FindQualifier; import javax.xml.registry.JAXRException; import javax.xml.registry.RegistryService; import javax.xml.registry.infomodel.Organization; import javax.xml.registry.infomodel.Service; import javax.xml.registry.infomodel.ServiceBinding; import javax.xml.ws.*; import static javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY; import pt.pagamigo.ws.ClienteInexistente; import pt.pagamigo.ws.MontanteInvalido; import pt.pagamigo.ws.MovimentoType; import pt.pagamigo.ws.PagAmigoPortType; import pt.pagamigo.ws.PagAmigoService; import pt.pagamigo.ws.SaldoInsuficiente; import pt.pagamigo.ws.client.*; import security.CertificateAuthorityInterface; import security.CertificateAuthorityService; public class PagAmigoClient { static CertificateAuthorityInterface ca; public static void main(String[] args) throws Exception { PagAmigoService service = new PagAmigoService(); PagAmigoPortType port = service.getPagAmigoPort(); CertificateAuthorityService service2 = new CertificateAuthorityService(); ca = service2.getCertificateAuthorityPort(); String endpointAddress = null; String organizationName = "SONET"; System.out.println(" "); System.out.println("###############SEARCH IN UDDI##############"); System.out.println("Searching For " + organizationName +" In UDDI Name Server(...)"); // get endpoint address try { String uddiURL = "http://localhost:8081"; ConnectionFactory connFactory = ConnectionFactory.newInstance(); // configure Connection Factory using properties Properties props = new Properties(); // Location of connection configuration file (should be // available at WEB-INF/classes on the .war file) props.setProperty("scout.juddi.client.config.file", "uddi.xml"); // search URL of UDDI registry props.setProperty("javax.xml.registry.queryManagerURL", uddiURL + "/juddiv3/services/inquiry"); // publication URL of UDDI registry props.setProperty("javax.xml.registry.lifeCycleManagerURL", uddiURL + "/juddiv3/services/publish"); // security manager URL of UDDI registry props.setProperty("javax.xml.registry.securityManagerURL", uddiURL + "/juddiv3/services/security"); // version of UDDI registry props.setProperty("scout.proxy.uddiVersion", "3.0"); // transport protocol used for communication with UDDI registry props.setProperty("scout.proxy.transportClass", "org.apache.juddi.v3.client.transport.JAXWSTransport"); connFactory.setProperties(props); Connection connection = connFactory.createConnection(); PasswordAuthentication passwdAuth = new PasswordAuthentication("username", "password".toCharArray()); Set<PasswordAuthentication> creds = new HashSet<PasswordAuthentication>(); creds.add(passwdAuth); connection.setCredentials(creds); RegistryService rs = connection.getRegistryService(); BusinessQueryManager businessQueryManager = rs.getBusinessQueryManager(); // ////////////////////////////////////////////////////// // Search for registered organization // ////////////////////////////////////////////////////// Organization org = null; Collection<String> findQualifiers = new ArrayList<String>(); findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC); Collection<String> namePatterns = new ArrayList<String>(); namePatterns.add(organizationName); namePatterns.add("%0%"); // Perform search BulkResponse r = businessQueryManager.findOrganizations(findQualifiers, namePatterns, null, null, null, null); @SuppressWarnings("unchecked") Collection<Organization> orgs = r.getCollection(); @SuppressWarnings("unchecked") Collection<Service> servs; @SuppressWarnings("unchecked") Collection<ServiceBinding> binds; for (Organization o : orgs) { servs = o.getServices(); System.out.println("[ORG:"+ o.getName().getValue() +" ]"); for (Service s : servs) { System.out.println("\t[SER:"+ s.getName().getValue() +" ]"); } } for (Organization o : orgs) { if (o.getName().getValue().equals(organizationName)) { servs = o.getServices(); for (Service s : servs) { if (s.getName().getValue().equals("PagAmigo")) { binds = s.getServiceBindings(); for (ServiceBinding b : binds) { if(endpointAddress==null) endpointAddress = b.getAccessURI(); } } } } } } catch (JAXRException e) { System.out.println("UDDI Error contacting Registry!"); System.out.println("################################################"); } if(endpointAddress==null){ System.out.println(organizationName +" Not Found! Aborting (...)"); System.out.println("################################################"); return; }else{ System.out.println(organizationName +" Found! Setting Endpoint To Target Server (...)"); System.out.println("################################################"); } BindingProvider bindingProvider = (BindingProvider) port; Map<String, Object> requestContext = bindingProvider.getRequestContext(); // set endpoint address System.out.println(" "); System.out.println("###############SETTING ENDPOINT################"); System.out.println("Changing endpoint address from:"); System.out.println(requestContext.get(ENDPOINT_ADDRESS_PROPERTY)); System.out.println("to:"); System.out.println(endpointAddress); System.out.println(); requestContext.put(ENDPOINT_ADDRESS_PROPERTY, endpointAddress); System.out.println("################################################"); // TEST TRANSACTIONS testEfectuarPagamento(port); // TEST TRANSACTIONS HISTORY LISTING //testListTransactions(port); } private static void testEfectuarPagamento(PagAmigoPortType port) throws Exception{ System.out.println(" "); System.out.println("################TESTING PAYMENT################"); try { System.out.print("Saldo do Balelas: "); System.out.println(port.consultarSaldo("Balelas")); } catch (ClienteInexistente e) { System.out.println(e.getLocalizedMessage()); } try { System.out.print("Saldo do Alice: "); System.out.println(port.consultarSaldo("alice")); } catch (ClienteInexistente e) { System.out.println(e.getLocalizedMessage()); } try { System.out.print("Saldo do ist: "); System.out.println(port.consultarSaldo("ist")); } catch (ClienteInexistente e) { System.out.println(e.getLocalizedMessage()); } try { System.out.println("Transfer:Alice->ist [10] "); Object o = port.efectuarPagamento("alice", "ist", 10, "Doacao Caridosa."); } catch (ClienteInexistente e) { System.out.println(e.toString()); } catch (MontanteInvalido e) { System.out.println(e.toString()); } catch (SaldoInsuficiente e) { System.out.println(e.toString()); } try { System.out.print("Saldo do Alice: "); System.out.println(port.consultarSaldo("alice")); } catch (ClienteInexistente e) { System.out.println(e.toString()); } try { System.out.print("Saldo do ist: "); System.out.println(port.consultarSaldo("ist")); } catch (ClienteInexistente e) { System.out.println(e.toString()); } try { System.out.println("Transfer:ist->zeninguem [10] "); Object o = port.efectuarPagamento("ist", "zeninguem", 10, "Conta Offshore. shh"); } catch (ClienteInexistente e) { System.out.println(e.toString()); } catch (MontanteInvalido e) { System.out.println(e.toString()); } catch (SaldoInsuficiente e) { System.out.println(e.toString()); } try { System.out.print("Transfer:ist->zeninguem [10] "); System.out.println(port.efectuarPagamento("ist", "zeninguem", 10, "Conta Offshore. shh")); } catch (ClienteInexistente e) { System.out.println(e.toString()); } catch (MontanteInvalido e) { System.out.println(e.toString()); } catch (SaldoInsuficiente e) { System.out.println(e.toString()); } try { System.out.print("Transfer:Carlos->zeninguem [-50]" ); System.out.println(port.efectuarPagamento("carlos", "zeninguem", -50, "Engano!")); } catch (ClienteInexistente e) { System.out.println(e.toString()); } catch (MontanteInvalido e) { System.out.println(e.toString()); } catch (SaldoInsuficiente e) { System.out.println(e.toString()); } try { System.out.print("Transfer:Balelas->Bruno [15]"); System.out.println(port.efectuarPagamento("Balelas", "bruno", 15, "eu nao existo")); } catch (ClienteInexistente e) { System.out.println(e.toString()); } catch (MontanteInvalido e) { System.out.println(e.toString()); } catch (SaldoInsuficiente e) { System.out.println(e.toString()); } try { System.out.print("Transfer:Bruno->Balelas [10]"); System.out.println(port.efectuarPagamento("bruno", "Balelas", 10, "ele nao existe")); } catch (ClienteInexistente e) { System.out.println(e.toString()); } catch (MontanteInvalido e) { System.out.println(e.toString()); } catch (SaldoInsuficiente e) { System.out.println(e.toString()); } System.out.println("################################################"); } private static void testListTransactions(PagAmigoPortType port) { System.out.println(" "); System.out.println("################TESTING LISTING################"); System.out.println("===================================="); System.out.println("-----------Alice Movimentos---------"); System.out.println("===================================="); try { listAllTransactions(port.consultarMovimentos("alice")); } catch (ClienteInexistente e) { System.out.println(e.toString()); } System.out.println("===================================="); System.out.println("--------zeninguem Movimentos--------"); System.out.println("===================================="); try { listAllTransactions(port.consultarMovimentos("zeninguem")); } catch (ClienteInexistente e) { System.out.println(e.toString()); } System.out.println("===================================="); System.out.println("-----------ist Movimentos-----------"); System.out.println("===================================="); try { listAllTransactions(port.consultarMovimentos("ist")); } catch (ClienteInexistente e) { System.out.println(e.toString()); } System.out.println("################################################"); } private static void listAllTransactions(List<MovimentoType> movs) { if (movs.size() == 0) { System.out.println("------------------------------------"); System.out.println("-----Sem Movimentos Registados------"); System.out.println("------------------------------------"); } else { for (MovimentoType m : movs) { System.out.println("------------------------------------"); System.out.println("Data:" + m.getDataHora().toGregorianCalendar().getTime().toString()); if (m.getMontante() < 0) System.out.println("Montante:" + m.getMontante()); else System.out.println("Montante:+" + m.getMontante()); System.out.println("Descricao:" + m.getDescritivo()); System.out.println("------------------------------------"); } } } public static String decrypt(byte[] encrypted) throws Exception{ Object o = ca.getPAPublicKey(); byte[] pubEncoded = (byte[]) o; X509EncodedKeySpec pubSpec = new X509EncodedKeySpec(pubEncoded); KeyFactory keyFacPub = KeyFactory.getInstance("RSA"); PublicKey pub = keyFacPub.generatePublic(pubSpec); Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipher.init(Cipher.DECRYPT_MODE, pub); byte[] newPlainBytes = cipher.doFinal(encrypted); String newPlainText = new String(newPlainBytes, "UTF-8"); return newPlainText; } private static byte[] readFile(String path) throws FileNotFoundException, IOException { FileInputStream fis = new FileInputStream(path); byte[] content = new byte[fis.available()]; fis.read(content); fis.close(); return content; } public static void printComprovativo(String comprovativo){ String datahora, ordenante, beneficiario, montante, descritivo; String[] split = comprovativo.split(","); datahora = split[0].substring(split[0].lastIndexOf("=")+1); ordenante = split[1].substring(split[1].lastIndexOf("=")+1); beneficiario = split[2].substring(split[2].lastIndexOf("=")+1); montante = split[3].substring(split[3].lastIndexOf("=")+1); descritivo = split[4].substring(split[4].lastIndexOf("=")+1, split[4].lastIndexOf("]")-1); System.out.println("Data e hora: " + datahora); System.out.println("Ordenante: " + ordenante); System.out.println("Beneficiario: " + beneficiario); System.out.println("Montante: " + montante); System.out.println("Descritivo: " + descritivo); } }
package com.shafear.notes.mvp.model.load; import com.shafear.notes.global.G; import com.shafear.notes.myutils.IOUtils; import com.shafear.notes.xnotes.XNote; import com.shafear.notes.xnotes.XNotes; import java.util.ArrayList; /** * Created by shafe_000 on 2015-02-09. */ public class MNotesLoad { public XNotes loadNotesData() { ArrayList<XNote> notesList = new ArrayList<>(); try { String notes[] = getFileContentInStrings("notes"); addNotesFromFileFormatStrings(notesList, notes); } catch (Exception e) { e.printStackTrace(); } return new XNotes(notesList); } private void addNotesFromFileFormatStrings(ArrayList<XNote> notesList, String[] notes) { DataLoadFlags dlf = new DataLoadFlags(); String title = ""; String content = ""; for(int j=0; j < notes.length; j++){ if(notes[j].contains("</TITLE>")) { if(title.length() > 0) title = title.substring(0, title.length()-1); dlf.TITLE_FLAG = false; } if(dlf.TITLE_FLAG){ title += notes[j] + "\n"; } if(notes[j].contains("</CONTENT>")) { if(content.length() > 0) content = content.substring(0, content.length()-1); dlf.CONTENT_FLAG = false; } if(dlf.CONTENT_FLAG){ content += notes[j] + "\n"; } if(notes[j].contains("<TITLE>")) {dlf.TITLE_FLAG = true;} if(notes[j].contains("<CONTENT>")) {dlf.CONTENT_FLAG = true;} if(notes[j].contains("<NOTE>")) dlf.NOTE_FLAG = true; if(notes[j].contains("</NOTE>")) {dlf.NOTE_FLAG = false; dlf.wasLastNoteFlagTrue = true;}; if((dlf.NOTE_FLAG == false)&&(dlf.wasLastNoteFlagTrue)){ notesList.add(new XNote(title, content)); title = ""; content = ""; dlf.wasLastNoteFlagTrue = false; dlf.noteCounter++; } } } private String[] getFileContentInStrings(String fileName) throws Exception { String readString = IOUtils.getStringFromFile(G.ACTIVITY.getFilesDir() + "/" + fileName); return readString.split("\n"); } }
package com.harvard.demo; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row; import org.apache.spark.sql.SaveMode; import org.apache.spark.sql.SparkSession; import static org.apache.spark.sql.functions.*; public class MovieRatingsAnalysis { public static void main(String[] args) { SparkSession spark = SparkSession .builder() .appName("Movies Dataset Analysis") .master("local[*]") .config("spark.files","D:\\secure-connect-democassandra.zip") .config("spark.cassandra.connection.config.cloud.path","secure-connect-democassandra.zip") .getOrCreate(); Dataset<Row> ratings = spark .read() .option("header", "true") .option("inferSchema", "true") .csv("data/ml-latest-small/ratings.csv") .select("movieId", "rating") .groupBy("movieId") .agg(count("rating").as("ratings_count"), avg("rating").as("ratings_avg")); spark .read() .option("header", "true") .option("inferSchema", "true") .csv("data/ml-latest-small/movies.csv") .join(ratings, "movieId") .select("movieId", "title", "ratings_count", "ratings_avg") .filter("ratings_count > 250") .filter("ratings_avg > 4") .withColumnRenamed("movieId","movie_id") .sort(col("ratings_avg").desc()) .write() .format("org.apache.spark.sql.cassandra") .option("keyspace", "spark") .option("table", "movies_analytics") .option("spark.cassandra.auth.username", "YGwOypFXOSvYUrhzmFJyIKIF") .option("spark.cassandra.auth.password", "+duG7c6Iky_SWS2-1kGwxBn4Y7.d2BBuEsSdicpDfWLiW7_lfLZOezo2cJi2RN1dQZ2dZY3zp_SlgcJ-vnEzjggqm7FlnOkCaquUpfhAgXK1h9NASZLrp41x,p7YjGQp") .mode(SaveMode.Append) .save(); } }
package com.kingdee.lightapp.web.rest; import javax.servlet.http.HttpServletRequest; import net.sf.json.JSONObject; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.kingdee.lightapp.authority.AuthorityType; import com.kingdee.lightapp.authority.FireAuthority; import com.kingdee.lightapp.authority.ResultTypeEnum; import com.kingdee.lightapp.common.contexts.Context; import com.kingdee.lightapp.domain.UserNetwork; import com.kingdee.lightapp.service.pubacc.PubaccService; import com.kingdee.lightapp.web.APIResponeJson; @Controller @RequestMapping(value = "/rest/pubacc") public class PubaccRest extends BaseRest { @Autowired private PubaccService pubaccService; @FireAuthority(resultType = ResultTypeEnum.json, authorityTypes = AuthorityType.LAPP) @RequestMapping(value = { "/push/full/msg.json" }, method = RequestMethod.POST) @ResponseBody public String pushFullMsg(HttpServletRequest request, @RequestParam(defaultValue = "") String title, @RequestParam(defaultValue = "") String message) throws Exception { APIResponeJson apiResponeJson = APIResponeJson.getInstance(); Context context = (Context) request.getSession() .getAttribute("CONTEXT"); if (!StringUtils.isBlank(message) && context != null) { UserNetwork usernetwork=context.getUserNetwork(); if(usernetwork!=null){ String eId=usernetwork.getEid(); title=usernetwork.getUsername()+"对你sayhi:"; boolean bool=pubaccService.sendPubaccMsgByEid(eId, message,title); if(bool){ apiResponeJson.setSuccess(true); apiResponeJson.setCode(200); apiResponeJson.setMsg("sendSuccess"); } } }else{ apiResponeJson.setSuccess(false); apiResponeJson.setCode(5000); apiResponeJson.setMsg("message不能为空"); } return JSONObject.fromObject(apiResponeJson).toString(); } }
package java2.businesslogic.announcementediting; public interface AnnouncementEditingService { AnnouncementEditingResponse edit(AnnouncementEditingRequest request); }
package br.senac.tads4.lojinha.managedbean; import br.senac.tads4.lojinha.entidade.ProdutoQuantidade; import br.senac.tads4.lojinha.entidade.Produto; import br.senac.tads4.lojinha.entidade.Usuario; import br.senac.tads4.lojinha.service.ProdutoService; import br.senac.tads4.lojinha.service.fakeimpl.ProdutoServiceFakeImpl; import br.senac.tads4.lojinha.util.Mensagem; import javax.inject.Named; import javax.enterprise.context.SessionScoped; import java.io.Serializable; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import javax.faces.context.FacesContext; import javax.faces.context.Flash; /** * * @author fernando.tsuda */ @Named @SessionScoped public class CompraBean implements Serializable { private Set<ProdutoQuantidade> listaProdutos = new LinkedHashSet<ProdutoQuantidade>(); private Usuario usuario = null; public CompraBean() { } public String adicionarProduto(long idProduto, int quantidade) { ProdutoService service = new ProdutoServiceFakeImpl(); Produto p = service.obter(idProduto); ProdutoQuantidade pq = null; for (ProdutoQuantidade item : listaProdutos) { if (item.getProduto().equals(p)) { pq = item; break; } } if (pq == null) { pq = new ProdutoQuantidade(p, quantidade); listaProdutos.add(pq); } else { pq.setQuantidade(pq.getQuantidade() + quantidade); } // Montar mensagem a ser apresentada para usuario Flash mensagem = FacesContext.getCurrentInstance().getExternalContext().getFlash(); mensagem.put("mensagem", new Mensagem("Produto " + p.getNome() + " adicionado com sucesso", "success")); // Redirecionar para lista de produtos return "lista.xhtml?faces-redirect=true"; } public int getQuantidadeItens() { return listaProdutos.size(); } public Set<ProdutoQuantidade> getListaProdutos() { return listaProdutos; } public void setListaProdutos(Set<ProdutoQuantidade> listaProdutos) { this.listaProdutos = listaProdutos; } public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } }
package com.conglomerate.dev.controllers; import com.conglomerate.dev.models.User; import com.conglomerate.dev.repositories.UserRepository; import com.conglomerate.dev.services.UserService; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SpringBootTest @AutoConfigureMockMvc @RunWith(SpringRunner.class) public class UserControllerTests { @Autowired private MockMvc mockMvc; @MockBean private UserService userService; @MockBean private UserRepository userRepository; private List<User> dummyUsers = Arrays.asList( User.builder() .id(1) .userName("lukelavin") .email("llavin@purdue.edu") .passwordHash("no thank you") .calendarLink(null) .profilePic(null) .build(), User.builder() .id(2) .userName("lukelavin") .email("llavin@purdue.edu") .passwordHash("no thank you") .calendarLink(null) .profilePic(null) .build() ); @Test public void getAllUsers() throws Exception { // given Mockito.when(userService.getAllUsers()).thenReturn(dummyUsers); // when + then mockMvc.perform(get("/users")) .andExpect(status().isOk()) .andExpect(content().json(new ObjectMapper().writeValueAsString(dummyUsers))); // make sure that the /users returns the proper representation of the findAllUsers } }
package com.aiyonghui.widget.ElasticRecyclerView; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.aiyonghui.widget.ElasticRecyclerView.EAdapter.EViewHolder; import com.aiyonghui.widget.R; import java.util.List; /** * User: lgd(1973140289@qq.com) * Date: 2017-03-26 * Function: */ public class EAdapter extends RecyclerView.Adapter<EViewHolder> { private List<String> mData = MockData.DATA; @Override public EViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.e_item, parent, false); return new EViewHolder(view); } @Override public void onBindViewHolder(EViewHolder holder, int position) { holder.textView.setText(mData.get(position)); } @Override public int getItemCount() { return mData.size(); } static class EViewHolder extends RecyclerView.ViewHolder { TextView textView; EViewHolder(View itemView) { super(itemView); textView = (TextView) itemView.findViewById(R.id.e_textView); } } }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 org.apache.webbeans.test.profields; import java.util.ArrayList; import java.util.Collection; import jakarta.enterprise.inject.spi.Bean; import org.junit.Assert; import org.apache.webbeans.test.AbstractUnitTest; import org.apache.webbeans.test.profields.beans.stringproducer.StringProducerBean; import org.apache.webbeans.test.profields.innerClass.InnerClassInjectStringProducer; import org.apache.webbeans.test.profields.innerClass.InnerClassInjectStringProducer.Xsimple; import org.junit.Test; public class InnerClassInjectStringProducerTest extends AbstractUnitTest { public InnerClassInjectStringProducerTest() { } @Test @SuppressWarnings("unchecked") public void testInnerClassProducerInjection() { Collection<String> beanXmls = new ArrayList<String>(); Collection<Class<?>> beanClasses = new ArrayList<Class<?>>(); beanClasses.add(StringProducerBean.class); beanClasses.add(InnerClassInjectStringProducer.class); beanClasses.add(Xsimple.class); startContainer(beanClasses, beanXmls); Bean<Xsimple> bean = (Bean<Xsimple>) getBeanManager().getBeans("Xsimple").iterator().next(); Xsimple simple = (Xsimple) getBeanManager().getReference(bean, Xsimple.class, getBeanManager().createCreationalContext(bean)); Assert.assertNotNull(simple.getInner()); shutDownContainer(); } }
package com.example.android_version_viewer.ui.detail; public interface DetailView { void showDetails(String details); void setFavoriteStatus(boolean isFavourite); }
package com.example.kafka.springbootkafkaproducerexample; import com.example.kafka.CarDto; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.stereotype.Service; @Service public class Producer { private static final Logger logger = LoggerFactory.getLogger(Producer.class); private static final String TOPIC_1 = "users"; private static final String TOPIC_2 = "cars"; private KafkaTemplate <String, String> kafkaTemplate1; private KafkaTemplate <String, CarDto> kafkaTemplate2; public Producer(KafkaTemplate<String, String> kafkaTemplate1, KafkaTemplate<String, CarDto> kafkaTemplate2) { this.kafkaTemplate1 = kafkaTemplate1; this.kafkaTemplate2 = kafkaTemplate2; } public void sendMessage(String message){ logger.info(String.format("$$ -> Producing message --> %s",message)); this.kafkaTemplate1.send(TOPIC_1, message); } public void sendCar(CarDto car) { logger.info(String.format("$$ -> Producing Car --> %s", car.toString())); this.kafkaTemplate2.send(TOPIC_2, car); } }
package mum.lesson8List.prob1Comparator; import java.util.Comparator; public class NameComparator implements Comparator<Marketing>{ @Override public int compare(Marketing o1, Marketing o2) { Marketing m1 = (Marketing)o1; Marketing m2 = (Marketing)o2; return m1.employeename.compareTo(m2.employeename); } }
package cn.yansui.module.main.view; import cn.yansui.domain.util.JFXBaseUtil; import cn.yansui.constant.VenusConstant; import com.jfoenix.controls.JFXDecorator; import de.felixroske.jfxsupport.AbstractFxmlView; import de.felixroske.jfxsupport.FXMLView; import de.felixroske.jfxsupport.GUIState; import javafx.scene.Parent; import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Scope; /** * @Description 主界面视图类 * @Author maogen.ymg * @Date 2020/3/9 21:56 */ @Scope("prototype") @Lazy @FXMLView(value = "/fxml/Main.fxml") public class MainView extends AbstractFxmlView { @Override public Parent getView() { // 解决@Autowired注入问题等,以及Cannot set style once stage has been set visible问题 JFXDecorator decorator; decorator = JFXBaseUtil.getDecorator(GUIState.getStage(), VenusConstant.MAIN_TITLE, VenusConstant.ICON_URL, super.getView(), true); return decorator; } }
package org.demo; import org.tool.MathTool; public class Expression { int operatorNum;//符号数 int range;//分数的范围以及分母的范围 private Fraction[] num; private String[] operator; //构造函数 public Expression(Fraction[] num,String[] operator) { this.num=num; this.operator=operator; this.operatorNum=operator.length; } //构造函数,根据符号数的不同构建相应的表达式 public Expression(int range,int operatorNum) { this.range = range; this.operatorNum=operatorNum+1; if(1==this.operatorNum) { num=new Fraction[2]; operator=new String[1]; num[0]= MathTool.getRandomFraction(range,range); operator[0]=MathTool.getRandomOperator(); num[1]= MathTool.getRandomFraction(range,range); //避免计算过程中出现负数 if("-"==operator[0]) { if(num[0].less(num[1])) { Fraction temp=num[0]; num[0]=num[1]; num[1]=temp; } } } else if(2==this.operatorNum) { num=new Fraction[3]; operator=new String[2]; num[0]= MathTool.getRandomFraction(range,range); operator[0]=MathTool.getRandomOperator(); num[1]= MathTool.getRandomFraction(range,range); operator[1]=MathTool.getRandomOperator(); num[2]= MathTool.getRandomFraction(range,range); // //避免计算过程中出现负数 // if (("-"==operator[0])&& ("+" == operator[1] || "-" == operator[1])) { // while(num[0].less(num[1])) { // num[0]=MathTool.getRandomFraction(range, range); // } // } // // //避免计算过程中出现负数 // if ("-" == operator[0] && ("×" == operator[1] || "÷" == operator[1])) { // while (num[0].less(MathTool.calculator(num[1],operator[1],num[2]))) { // num[0] = MathTool.getRandomFraction(range, range); // } // } // // if ("-" == operator[1]) { // while (num[2].less(MathTool.calculator(num[0],operator[0],num[1]))) { // num[2] = MathTool.getRandomFraction(range, range); // } // } } else if(3==this.operatorNum) { num=new Fraction[4]; operator=new String[3]; num[0]= MathTool.getRandomFraction(range,range); operator[0]=MathTool.getRandomOperator(); num[1]= MathTool.getRandomFraction(range,range); operator[1]=MathTool.getRandomOperator(); num[2]= MathTool.getRandomFraction(range,range); operator[2]=MathTool.getRandomOperator(); num[3]= MathTool.getRandomFraction(range,range); } } //以字符串的形式返回题目 public String getExercise() { if ((1==this.operatorNum)) { return num[0].toMixedNumber()+" "+operator[0]+" "+num[1].toMixedNumber()+" "+"="; } else if(2==this.operatorNum) { return num[0].toMixedNumber()+" "+operator[0]+" "+num[1].toMixedNumber()+" "+operator[1]+" "+num[2].toMixedNumber()+" "+"="; } else { return num[0].toMixedNumber()+" "+operator[0]+" "+num[1].toMixedNumber()+" "+operator[1]+" "+num[2].toMixedNumber()+" " +operator[2]+" "+num[3].toMixedNumber()+" "+"="; } } //计算表达式的结果并返回 public Fraction getResult() { if ((1 == this.operatorNum)) {//一个符号运算 return MathTool.calculator(num[0], operator[0], num[1]); } else if (2 == this.operatorNum) {//两个符号运算 Fraction temp; //不按顺序计算的式子单独处理 if (operator[1] == "×" || operator[1] == "÷") { temp = MathTool.calculator(num[1], operator[1], num[2]); return MathTool.calculator(num[0], operator[0], temp); } else { temp = MathTool.calculator(num[0], operator[0], num[1]); return MathTool.calculator(temp, operator[1], num[2]); } } else {//三个符号运算 Fraction temp1; Fraction temp2; //不按顺序计算的式子单独处理 if ((operator[0] == "×" || operator[0] == "÷") && (operator[1] == "+" || operator[1] == "-") && (operator[2] == "×" || operator[2] == "÷")) { temp1 = MathTool.calculator(num[0], operator[0], num[1]); temp2 = MathTool.calculator(num[2], operator[2], num[3]); return MathTool.calculator(temp1, operator[1], temp2); } else if ((operator[0] == "+" || operator[0] == "-") && (operator[1] == "+" || operator[1] == "-") && (operator[2] == "×" || operator[2] == "÷")) { temp1 = MathTool.calculator(num[0], operator[0], num[1]); temp2 = MathTool.calculator(num[2], operator[2], num[3]); return MathTool.calculator(temp1, operator[1], temp2); } else if ((operator[0] == "+" || operator[0] == "-") && (operator[1] == "×" || operator[1] == "÷") && (operator[2] == "×" || operator[2] == "÷")) { temp1 = MathTool.calculator(num[1], operator[1], num[2]); temp2 = MathTool.calculator(temp1, operator[2], num[3]); return MathTool.calculator(num[0], operator[0], temp2); } else if ((operator[0] == "+" || operator[0] == "-") && (operator[1] == "×" || operator[1] == "÷") && (operator[2] == "+" || operator[2] == "-")) { temp1 = MathTool.calculator(num[1], operator[1], num[2]); temp2 = MathTool.calculator(num[0], operator[0], temp1); return MathTool.calculator(temp2, operator[2], num[3]); } else { temp1 = MathTool.calculator(num[0], operator[0], num[1]); temp2 = MathTool.calculator(temp1, operator[1], num[2]); return MathTool.calculator(temp2, operator[2], num[3]); } } } }
package com.hly.o2o.service; import java.io.InputStream; import java.util.List; import com.hly.o2o.dto.ImageHolder; import com.hly.o2o.dto.ProductExecution; import com.hly.o2o.entity.Product; import com.hly.o2o.exceptions.ProductOperationException; public interface ProductService { /** * * 添加商品信息以及图片处理 * * @param product * @param thumbnial * 缩略图 * @param productImgList * 详情图 * @return * @throws ProductOperationException */ ProductExecution addProduct(Product product, ImageHolder thumbnial, List<ImageHolder> productImgList) throws ProductOperationException; /** * 通过商品ID查询唯一商品 * * @param productId * @return */ Product getProductById(long productId); /** * 修改商品详情以及图片处理 * * @param product * 商品 * @param thumbnail * 商品缩略图文件流 * @param productImageHolderList * 商品详情图文件流 * @return */ ProductExecution modifyProduct(Product product, ImageHolder thumbnail, List<ImageHolder> productImageHolderList); /** * 查询商品列表并分页,可输入的条件:名字(模糊查询),商品状态,店铺ID,商品类别 * * @param productCondition * @param pageIndex * 那一页的数据 * @param pageSize * 一页有多少数据 * @return */ ProductExecution getProductList(Product productCondition, int pageIndex, int pageSize); /** * 删除商品 * @param productId * @param shopId * @return * @throws ProductOperationException */ ProductExecution deleteProduct(Long productId, Long shopId) throws ProductOperationException; }
package com.kunsoftware.entity; public class HeadIconTitle { private Integer id; private String name; private String sex; private String member; private String enable; private String type; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getMember() { return member; } public void setMember(String member) { this.member = member; } public String getEnable() { return enable; } public void setEnable(String enable) { this.enable = enable; } public String getType() { return type; } public void setType(String type) { this.type = type; } }
/** * Package for calculate task. * * @author Timofey Klykov * @version $Id$ * @since 05.2019 */ package ru.job4j.calculate;
package com.walkerwang.algorithm; import java.util.ArrayList; import java.util.Scanner; public class Class1 { /*public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ans = 0, x; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ x = sc.nextInt(); ans += x; } } System.out.println(ans); }*/ public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int val; ArrayList<Integer> list = new ArrayList<>(); for(int i = 0; i < n; i++){ val = in.nextInt(); list.add(val); } list.add(list.get(0)); System.out.println(list); int max = 0; for(int i = 0; i < list.size()-1; i++) { int a = list.get(i) - list.get(i+1); a = a > 0 ? a : -a; if (a > max) { max = a; } } System.out.println(max); } }
public class NumberOfStpesToReduceANumberToZero_1342 { public static int numberOfSteps (int num) { int steps = 0; while (num != 0) { if (num % 2 == 0) { num /= 2; } else { num--; } steps++; } return steps; } public static void main(String[] args) { System.out.println(numberOfSteps(5)); } }
package com.xiex.btopendoor; import android.content.Context; import android.media.MediaPlayer; import java.io.IOException; /** * Created by baby on 2016/12/14. * <p> * 宜步出行,天天速达 */ public class MediaPlayerHelp { public static MediaPlayer mediaPlayer; public static void play1(Context context, int id) { // if (mediaPlayer == null) { // mediaPlayer = new MediaPlayer(); // } mediaPlayer.reset();//恢复到未初始化的状态 mediaPlayer = MediaPlayer.create(context, id);//读取音频 try { mediaPlayer.prepare(); //准备 } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } mediaPlayer.start(); //播放 } public static void play(Context context, int id) { if (mediaPlayer == null) { mediaPlayer = new MediaPlayer(); } mediaPlayer.reset();//恢复到未初始化的状态 mediaPlayer = MediaPlayer.create(context, id); try { if (mediaPlayer.isPlaying()) { mediaPlayer.stop(); mediaPlayer.release(); mediaPlayer = MediaPlayer.create(context, id); } mediaPlayer.start(); } catch (IllegalStateException e) { e.printStackTrace(); } } }
package com.semantyca.nb.core.dataengine.jpa.model.embedded; import javax.persistence.Column; import javax.persistence.Embeddable; import java.util.Date; @Embeddable public class Reader { @Column(name = "was_read") private boolean wasRead; @Column(name = "reading_time") private Date readingTime; @Column(nullable = false, name = "user_id") private Long user; public Long getUser() { return user; } public void setUser(Long reader) { this.user = reader; } public boolean isWasRead() { return wasRead; } public void setWasRead(boolean wasRead) { if (wasRead != this.wasRead) { if (wasRead) { readingTime = new Date(); this.wasRead = true; } else { readingTime = null; this.wasRead = false; } } } public Date getReadingTime() { return readingTime; } }
package com.dahua.design.structural.bridge; public abstract class AbstractSale { private String price; private String way; public AbstractSale(String price, String way) { this.price = price; this.way = way; } public String getSale(){ return "渠道: " + way + " 售价: " + price; } }
package com.tencent.mm.model.c; import com.tencent.mm.storage.a; import com.tencent.mm.storage.c; import java.util.LinkedList; import java.util.List; public class a$a { public List<c> dEw = new LinkedList(); public List<a> dEx = new LinkedList(); }
public class RectangleTester{ // Mode = 1 print perimeter, mode = 2 print area; public void printRectangle(boolean mode, Rectangle rectangle){ if(mode){ System.out.println("Perimeter " + rectangle.getPerimeter()); }else{ System.out.println("Areas " + rectangle.getArea()); } } public static void main(String[] args){ Rectangle rectangle = new Rectangle(10,20); RectangleTester tester = new RectangleTester(); tester.printRectangle(true, rectangle); tester.printRectangle(false, rectangle); } }
package de.jmda.gen.java; import static de.jmda.core.mproc.ProcessingUtilities.asDeclaredType; import static de.jmda.core.mproc.ProcessingUtilities.isPrimitiveKind; import static de.jmda.core.util.StringUtil.sb; import static de.jmda.gen.java.naming.ImportManagerProvider.getImportManager; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.lang.model.element.TypeElement; import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeMirror; import org.apache.commons.lang.StringUtils; import de.jmda.gen.java.naming.ImportManagerProvider; public abstract class JavaGeneratorUtils { public static String asDeclaration(TypeMirror typeMirror) { if (isPrimitiveKind(typeMirror)) { return typeMirror.toString(); } DeclaredType declaredType = asDeclaredType(typeMirror); if (declaredType == null) { // typeMirror for void? return typeMirror.toString(); } List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments(); if (typeArguments.size() == 0) { return getImportManager().useType(typeMirror.toString()); } StringBuffer result = sb(outerTypeAsString(typeMirror) + "<"); Collection<String> typeArgumentsAsDeclarations = new ArrayList<>(); for (TypeMirror argumentTypeMirror : typeArguments) { typeArgumentsAsDeclarations.add(asDeclaration(argumentTypeMirror)); } result.append(StringUtils.join(typeArgumentsAsDeclarations, ",")); return result.append(">").toString(); } public static String asDeclaration(TypeElement type) { return asDeclaration(type.asType()); } /** * @param typeMirror * @return <code>"List"</code> for typeMirror representing * <code>java.util.List<E></code>, * <code>java.util.List</code> will be handled by import manager. */ public static String outerTypeAsString(TypeMirror typeMirror) { if (isPrimitiveKind(typeMirror)) { return typeMirror.toString(); } String typeMirrorString = typeMirror.toString(); int index = typeMirrorString.indexOf('<'); if (index > -1) { return ImportManagerProvider.getImportManager() .useType(typeMirrorString.substring(0, index)); } return ImportManagerProvider.getImportManager().useType(typeMirrorString); } /** * @param typeMirror * @return <code>"package.Type"</code> for typeMirror representing * <code>java.util.List<package.Type></code>, * <code>package.Type</code> will be handled by import manager. */ public static String innerTypeAsString(TypeMirror typeMirror) { if (isPrimitiveKind(typeMirror)) { return typeMirror.toString(); } String typeMirrorString = typeMirror.toString(); int indexLeft = typeMirrorString.indexOf('<'); int indexRight = typeMirrorString.indexOf('>'); if (indexLeft > -1) { return ImportManagerProvider.getImportManager() .useType(typeMirrorString.substring(indexLeft + 1, indexRight)); } return ImportManagerProvider.getImportManager().useType(typeMirrorString); } }
package Lab03.Zad5; public class Main { public static void main(String[] args) { Exchange exchange = new Exchange(); exchange.addCompany("Intel", 1000); exchange.addCompany("nVidia", 2000); Client client1 = new Client("Jan Kowalski",2500,exchange); Client client2 = new Client("Joanna Nowak", 3000, exchange); client1.Buy("Intel", 5); client2.Buy("nVidia", 3); } }
package com.jackie.classbook.dao; import com.jackie.classbook.entity.Teacher; import java.util.List; /** * Created with IntelliJ IDEA. * Description: * * @author xujj * @date 2018/6/26 */ public interface TeacherDao { int insert(Teacher teacher); List<Teacher> queryTeachers(Teacher teacher); Teacher queryById(Long id); int update(Teacher teacher); Teacher queryByMobile(Long mobile); Teacher queryByEmail(String email); List<Teacher> queryByIdList(List<Long> idList); }
package com.example.demo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.hateoas.config.EnableHypermediaSupport; import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType; @SpringBootApplication //@EnableHypermediaSupport(type=HypermediaType.HAL_FORMS) public class SpringHateoasApplication implements CommandLineRunner { @Autowired OrderRepository repository; public static void main(String[] args) { SpringApplication.run(SpringHateoasApplication.class, args); } @Override public void run(String... args) throws Exception { repository.save(new Order("Red Velvet")); repository.save(new Order("Mocha")); } }
package com.gmail.ivanytskyy.vitaliy.controller.editor; import java.beans.PropertyEditorSupport; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.gmail.ivanytskyy.vitaliy.model.Subject; import com.gmail.ivanytskyy.vitaliy.service.SubjectService; /* * Editor for the conversion between a Subject object and his id (as the String). * @author Vitaliy Ivanytskyy */ @Component public class CustomSubjectEditor extends PropertyEditorSupport{ @Autowired private SubjectService subjectService; // Converts a String to a Subject (when submitting form) @Override public void setAsText(String text){ Subject subject = this.subjectService.findById(Long.parseLong(text)); this.setValue(subject); } }
package com.hb.rssai.view.subscription; import android.os.Bundle; import android.support.design.widget.AppBarLayout; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.ActionBar; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.TypedValue; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import com.hb.rssai.R; import com.hb.rssai.adapter.OfflineListAdapter; import com.hb.rssai.base.BaseActivity; import com.hb.rssai.contract.OfflineListContract; import com.hb.rssai.presenter.OfflineListPresenter; import com.hb.rssai.util.CommonHandler; import com.hb.rssai.util.T; import com.hb.rssai.view.widget.MyDecoration; import com.rss.bean.Information; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import static com.google.common.base.Preconditions.checkNotNull; public class OfflineListActivity extends BaseActivity<OfflineListContract.View, OfflineListPresenter> implements OfflineListContract.View { public static final String KEY_LINK = "key_link"; public static final String KEY_NAME = "key_name"; public static final String KEY_SUBSCRIBE_ID = "key_subscribe_id"; public static final String KEY_IS_TAG = "key_is_tag"; public static final String KEY_IMG="key_img"; OfflineListContract.Presenter mPresenter; @BindView(R.id.sys_tv_title) TextView mSysTvTitle; @BindView(R.id.sys_toolbar) Toolbar mSysToolbar; @BindView(R.id.app_bar_layout) AppBarLayout mAppBarLayout; @BindView(R.id.oal_ll) LinearLayout mOalLl; @BindView(R.id.llf_btn_re_try) Button mLlfBtnReTry; @BindView(R.id.oal_recycler_view) RecyclerView mOalRecyclerView; @BindView(R.id.oal_swipe_layout) SwipeRefreshLayout mOalSwipeLayout; @BindView(R.id.llRootView) LinearLayout mLlRootView; @BindView(R.id.include_no_data) LinearLayout include_no_data; @BindView(R.id.include_load_fail) LinearLayout include_load_fail; private LinearLayoutManager manager; private String link; private String name; private OfflineListAdapter adapter; private List<Information> infoList = new ArrayList<>(); private String subscribeId; private boolean isTag=false; private String img; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); loadData(); } private void loadData() { if (!TextUtils.isEmpty(link)) { mOalSwipeLayout.setRefreshing(true); mPresenter.getList(link,subscribeId,isTag,img); } } @Override protected void initIntent() { super.initIntent(); Bundle bundle = getIntent().getExtras(); if (null != bundle) { link = bundle.getString(KEY_LINK, ""); subscribeId = bundle.getString(KEY_SUBSCRIBE_ID, ""); name = bundle.getString(KEY_NAME, ""); isTag = bundle.getBoolean(KEY_IS_TAG, false); img = bundle.getString(KEY_IMG, ""); if (!TextUtils.isEmpty(name)) { mSysTvTitle.setText(name); } } } @Override protected int providerContentViewId() { return R.layout.activity_offline_list; } @Override protected void setAppTitle() { mSysToolbar.setTitle(""); setSupportActionBar(mSysToolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true);//设置ActionBar一个返回箭头,主界面没有,次级界面有 actionBar.setDisplayShowTitleEnabled(false); } mSysTvTitle.setText(getResources().getString(R.string.str_offline_list_title)); } @Override protected OfflineListPresenter createPresenter() { return new OfflineListPresenter(this); } @Override protected void initView() { manager = new LinearLayoutManager(this); mOalRecyclerView.setLayoutManager(manager); mOalRecyclerView.setHasFixedSize(true); mOalRecyclerView.addItemDecoration(new MyDecoration(this, LinearLayoutManager.VERTICAL)); mOalSwipeLayout.setColorSchemeResources(R.color.refresh_progress_1, R.color.refresh_progress_2, R.color.refresh_progress_3); mOalSwipeLayout.setProgressViewOffset(true, 0, (int) TypedValue .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics())); mLlfBtnReTry.setOnClickListener(v -> loadData()); //设置上下拉刷新 mOalSwipeLayout.setOnRefreshListener(() -> loadData()); } @Override public void setPresenter(OfflineListContract.Presenter presenter) { mPresenter = checkNotNull(presenter); } @Override public void showFail(Throwable throwable) { CommonHandler.actionThrowable(throwable); } @Override public void showList(List<Information> list) { runOnUiThread(() -> { if (infoList != null && infoList.size() > 0) { infoList.clear(); } mOalLl.setVisibility(View.GONE); include_no_data.setVisibility(View.GONE); include_load_fail.setVisibility(View.GONE); mOalRecyclerView.setVisibility(View.VISIBLE); infoList.addAll(list); if (adapter == null) { adapter = new OfflineListAdapter(OfflineListActivity.this, infoList); mOalRecyclerView.setAdapter(adapter); adapter.notifyDataSetChanged(); } else { adapter.init();//更新一下是否显示图片首选项 adapter.notifyDataSetChanged(); } //通知更新 mOalSwipeLayout.setRefreshing(false); }); } @Override public void showError() { runOnUiThread(() -> { mOalSwipeLayout.setRefreshing(false); mOalLl.setVisibility(View.GONE); mOalRecyclerView.setVisibility(View.GONE); include_no_data.setVisibility(View.GONE); include_load_fail.setVisibility(View.VISIBLE); }); } @Override public void showNoData() { runOnUiThread(() -> { mOalSwipeLayout.setRefreshing(false); mOalLl.setVisibility(View.GONE); mOalRecyclerView.setVisibility(View.GONE); include_no_data.setVisibility(View.VISIBLE); include_load_fail.setVisibility(View.GONE); T.ShowToast(this, "暂无更多数据"); }); } }
package de.jmda.core.mproc.task; import java.io.IOException; public abstract class TaskRunner { public static void run(AbstractTypeElementsTask... tasks) throws IOException { TaskRunnerTypeElements.run(tasks); } public static void run(AbstractAnnotatedElementsTask... tasks) throws IOException { TaskRunnerAnnotations.run(tasks); } }
package org.zaproxy.zap.extension.sequence; import java.awt.Component; import java.awt.event.ActionEvent; import org.apache.log4j.Logger; import org.parosproxy.paros.control.Control; import org.parosproxy.paros.extension.ExtensionPopupMenuItem; import org.zaproxy.zap.extension.script.ExtensionScript; import org.zaproxy.zap.extension.script.ScriptNode; import org.zaproxy.zap.extension.script.ScriptType; import org.zaproxy.zap.extension.script.ScriptWrapper; import org.zaproxy.zap.extension.script.SequenceScript; public class SequencePopupMenuItem extends ExtensionPopupMenuItem { private static final long serialVersionUID = 1L; private ExtensionScript extScript = null; public static final Logger logger = Logger.getLogger(SequencePopupMenuItem.class); private ExtensionSequence extension = null; public SequencePopupMenuItem(ExtensionSequence extension) { super(); this.extension = extension; initialize(); } private void initialize() { // TODO: Add i18n key for this string. this.setText("Active scan sequence"); this.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { ScriptWrapper wrapper = (ScriptWrapper)getExtScript().getScriptUI().getSelectedNode().getUserObject(); SequenceScript scr = getExtScript().getInterface(wrapper, SequenceScript.class); extension.setDirectScanScript(wrapper); scr.scanSequence(); } catch(Exception ex) { logger.info("An exception occurred while starting an active scan for a sequence script: " + ex.getMessage(), ex); } } }); } private ExtensionScript getExtScript() { if(extScript == null) { extScript = (ExtensionScript) Control.getSingleton().getExtensionLoader().getExtension(ExtensionScript.class); } return extScript; } @Override public boolean isEnableForComponent(Component invoker) { if(isScriptTree(invoker)) { ScriptNode node = this.getExtScript().getScriptUI().getSelectedNode(); if(node != null) { if(node.isTemplate()) { return false; } ScriptType type = node.getType(); if(type != null) { if(type.getName().equals(ExtensionSequence.TYPE_SEQUENCE)) { Object obj = node.getUserObject(); if(obj != null) { if(obj instanceof ScriptWrapper) { return ((ScriptWrapper) obj).getEngine() != null; } } } } } } return false; } public boolean isScriptTree(Component component) { return this.getExtScript().getScriptUI() != null && component != null && this.getExtScript().getScriptUI().getTreeName() .equals(component.getName()); } }
package de.adesso.gitstalker.core.requests; import de.adesso.gitstalker.core.enums.RequestType; import de.adesso.gitstalker.core.objects.Query; /** * This is the request used for requesting the organization validation. */ public class OrganizationValidationRequest { private final int estimatedQueryCost = 1; private String query; private String organizationName; private RequestType requestType; public OrganizationValidationRequest(String organizationName) { this.organizationName = organizationName; /** * GraphQL Request for the organization validation. * Requesting the amount of members, repositories and teams in the organization. Request will fail if the organization is invalid. * Requests the current rate limit of the token at the API. */ this.query = "query {\n" + "organization(login:\"" + organizationName + "\") {\n" + "name\n" + "members(first: 1) {\n" + "totalCount\n" + "}\n" + "repositories(first: 1) {\n" + "totalCount\n" + "}\n" + "teams(first: 1) {\n" + "totalCount\n" + "}\n" + "}\n" + "rateLimit {\n" + "cost\n" + "remaining\n" + "resetAt\n" + "}\n" + "}"; this.requestType = RequestType.ORGANIZATION_VALIDATION; } /** * Generates the query for the organizationValidation request. * @return Generated query for the request type. */ public Query generateQuery() { return new Query(this.organizationName, this.query, this.requestType, this.estimatedQueryCost); } }
/* * LumaQQ - Java QQ Client * * Copyright (C) 2004 luma <stubma@163.com> * * This program 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. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package edu.tsinghua.lumaqq.qq.packets.out; import java.nio.ByteBuffer; import edu.tsinghua.lumaqq.qq.QQ; import edu.tsinghua.lumaqq.qq.beans.QQUser; import edu.tsinghua.lumaqq.qq.packets.BasicOutPacket; import edu.tsinghua.lumaqq.qq.packets.PacketParseException; /** * <pre> * 群操作包的基类,其包含了一些群操作包的公共字段,比如子命令类型 * </pre> * * @author luma */ public class ClusterCommandPacket extends BasicOutPacket { protected byte subCommand; protected int clusterId; /** 字体属性 */ protected static final byte NONE = 0x00; protected static final byte BOLD = 0x20; protected static final byte ITALIC = 0x40; protected static final byte UNDERLINE = (byte)0x80; /** * 构造函数 */ public ClusterCommandPacket(QQUser user) { super(QQ.QQ_CMD_CLUSTER_CMD, true, user); } /** * @param buf * @param length * @throws PacketParseException */ public ClusterCommandPacket(ByteBuffer buf, int length, QQUser user) throws PacketParseException { super(buf, length, user); } /* (non-Javadoc) * @see edu.tsinghua.lumaqq.qq.packets.OutPacket#parseBody(java.nio.ByteBuffer) */ @Override protected void parseBody(ByteBuffer buf) throws PacketParseException { subCommand = buf.get(); } /* (non-Javadoc) * @see edu.tsinghua.lumaqq.qq.packets.BasicOutPacket#getPacketName() */ @Override public String getPacketName() { switch(subCommand) { case QQ.QQ_CLUSTER_CMD_ACTIVATE_CLUSTER: return "Cluster Activate Packet"; case QQ.QQ_CLUSTER_CMD_MODIFY_MEMBER: return "Cluster Modify Member Packet"; case QQ.QQ_CLUSTER_CMD_CREATE_CLUSTER: return "Cluster Create Packet"; case QQ.QQ_CLUSTER_CMD_EXIT_CLUSTER: return "Cluster Exit Packet"; case QQ.QQ_CLUSTER_CMD_GET_CLUSTER_INFO: return "Cluster Get Info Packet"; case QQ.QQ_CLUSTER_CMD_GET_MEMBER_INFO: return "Cluster Get Member Info Packet"; case QQ.QQ_CLUSTER_CMD_GET_ONLINE_MEMBER: return "Cluster Get Online Member Packet"; case QQ.QQ_CLUSTER_CMD_JOIN_CLUSTER: return "Cluster Join Packet"; case QQ.QQ_CLUSTER_CMD_JOIN_CLUSTER_AUTH: return "Cluster Auth Packet"; case QQ.QQ_CLUSTER_CMD_MODIFY_CLUSTER_INFO: return "Cluster Modify Info Packet"; case QQ.QQ_CLUSTER_CMD_SEARCH_CLUSTER: return "Cluster Search Packet"; case QQ.QQ_CLUSTER_CMD_SEND_IM_EX: return "Cluster Send IM Ex Packet"; case QQ.QQ_CLUSTER_CMD_MODIFY_TEMP_MEMBER: return "Cluster Modify Temp Cluster Member Packet"; case QQ.QQ_CLUSTER_CMD_GET_TEMP_INFO: return "Cluster Get Temp Cluster Info Packet"; case QQ.QQ_CLUSTER_CMD_ACTIVATE_TEMP: return "Cluster Activate Temp Cluster Packet"; case QQ.QQ_CLUSTER_CMD_EXIT_TEMP: return "Cluster Exit Temp Cluster Packet"; case QQ.QQ_CLUSTER_CMD_CREATE_TEMP: return "Cluster Create Temp Cluster Packet"; default: return "Unknown Cluster Command Packet"; } } /** * @return Returns the subCommand. */ public byte getSubCommand() { return subCommand; } /** * @param subCommand The subCommand to set. */ public void setSubCommand(byte subCommand) { this.subCommand = subCommand; } /** * @return Returns the clusterId. */ public int getClusterId() { return clusterId; } /** * @param clusterId The clusterId to set. */ public void setClusterId(int clusterId) { this.clusterId = clusterId; } /* (non-Javadoc) * @see edu.tsinghua.lumaqq.qq.packets.Packet#putBody(java.nio.ByteBuffer) */ @Override protected void putBody(ByteBuffer buf) { } }
package com.yinghai.a24divine_user.module.shop.shopcar.mvp; import com.example.fansonlib.base.BaseModel; import com.example.fansonlib.http.HttpResponseCallback; import com.example.fansonlib.http.HttpUtils; import com.example.fansonlib.utils.SharePreferenceHelper; import com.yinghai.a24divine_user.bean.ShopCarBean; import com.yinghai.a24divine_user.constant.ConHttp; import com.yinghai.a24divine_user.constant.ConResultCode; import com.yinghai.a24divine_user.constant.ConstantPreference; import com.yinghai.a24divine_user.utils.ValidateAPITokenUtil; import java.util.HashMap; import java.util.Map; /** * @author Created by:fanson * Created on:2017/11/13 15:37 * Description:购物车的M层 */ public class ShopCarModel extends BaseModel implements ContractShopCar.IShopCarModel{ private IShopCarCallback mCallback; private final int mPageSize = 10; @Override public void getShopCarSuccess(int page,IShopCarCallback callback) { mCallback = callback; String time = String.valueOf(System.currentTimeMillis()); Map<String,Object> maps = new HashMap<>(5); maps.put("userId", SharePreferenceHelper.getInt(ConstantPreference.I_USER_ID,0)); maps.put("page",page); maps.put("pageSize",mPageSize); maps.put("apiSendTime",time); maps.put("apiToken", ValidateAPITokenUtil.ctreatTokenStringByTimeString(time)); HttpUtils.getHttpUtils().post(ConHttp.GET_SHOP_CAR,maps, new HttpResponseCallback<ShopCarBean>() { @Override public void onSuccess(ShopCarBean bean) { if (mCallback ==null){ return; } switch (bean.getCode()) { case ConResultCode.SUCCESS: mCallback.onShopCarSuccess(bean); break; default: mCallback.handlerResultCode(bean.getCode()); break; } } @Override public void onFailure(String errorMsg) { if (mCallback!=null){ mCallback.onShopCarFailure(errorMsg); } } }); } @Override public void onDestroy() { super.onDestroy(); mCallback = null; } }
package com.example.karenli.budgetingapp.db; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.util.Log; import com.example.karenli.budgetingapp.models.Receipt; import java.util.ArrayList; import java.util.List; import static android.content.ContentValues.TAG; /** * Created by karenli on 10/23/17. */ public class QueryFromDBImpl extends DatabaseHelper implements IQueryFromDB { private static QueryFromDBImpl sInstance; public static synchronized QueryFromDBImpl getInstance(Context context) { // Use the application context, which will ensure that you // don't accidentally leak an Activity's context. // See this article for more information: http://bit.ly/6LRzfx if (sInstance == null) { sInstance = new QueryFromDBImpl(context.getApplicationContext()); } return sInstance; } public QueryFromDBImpl(Context context) { super(context); } @Override public List<Receipt> getReceipts(int month, int year) { List<Receipt> receipts = new ArrayList<>(); // SELECT * FROM POSTS // LEFT OUTER JOIN USERS // ON POSTS.KEY_POST_USER_ID_FK = USERS.KEY_USER_ID String POSTS_SELECT_QUERY = String.format("SELECT * FROM %s WHERE %s = %d AND %s = %d", TABLE_RECEIPTS, KEY_RECEIPTS_MONTH, month, KEY_RECEIPTS_YEAR, year); // "getReadableDatabase()" and "getWriteableDatabase()" return the same object (except under low // disk space scenarios) SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.rawQuery(POSTS_SELECT_QUERY, null); try { if (cursor.moveToFirst()) { do { Receipt newReceipt = new Receipt(); newReceipt.setMyName(cursor.getString(cursor.getColumnIndex(KEY_RECEIPTS_NAME))); newReceipt.setMyDescription(cursor.getString(cursor.getColumnIndex(KEY_RECEIPTS_DESCR))); newReceipt.setMyImgPath(cursor.getString(cursor.getColumnIndex(KEY_RECEIPTS_IMGPATH))); newReceipt.setMyMonth(cursor.getInt(cursor.getColumnIndex(KEY_RECEIPTS_MONTH))); newReceipt.setMyYear(cursor.getInt(cursor.getColumnIndex(KEY_RECEIPTS_YEAR))); newReceipt.setMyTotal(cursor.getInt(cursor.getColumnIndex(KEY_RECEIPTS_TOTAL))); receipts.add(newReceipt); } while(cursor.moveToNext()); } } catch (Exception e) { Log.d(TAG, "Error while trying to get posts from database"); } finally { if (cursor != null && !cursor.isClosed()) { cursor.close(); } } return receipts; } }
package com.library.bexam.entity; import com.library.bexam.form.NodeBookForm; import com.library.bexam.form.VersionForm; import java.util.List; /** * 教材册别实体 * @author caoqian * @date 20181219 */ public class TextBookEntity { private int textBookId; private String textBookName; private int versionId; private String versionName; private VersionForm versionEntity; private List<NodeBookForm> nodeBookEntityList; private String createTime; public TextBookEntity() { } public TextBookEntity(int textBookId, String textBookName, int versionId, String versionName, String createTime) { this.textBookId = textBookId; this.textBookName = textBookName; this.versionId = versionId; this.versionName = versionName; this.createTime = createTime; } public int getTextBookId() { return textBookId; } public void setTextBookId(int textBookId) { this.textBookId = textBookId; } public String getTextBookName() { return textBookName; } public void setTextBookName(String textBookName) { this.textBookName = textBookName; } public int getVersionId() { return versionId; } public void setVersionId(int versionId) { this.versionId = versionId; } public String getVersionName() { return versionName; } public void setVersionName(String versionName) { this.versionName = versionName; } public VersionForm getVersionEntity() { return versionEntity; } public void setVersionEntity(VersionForm versionEntity) { this.versionEntity = versionEntity; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public List<NodeBookForm> getNodeBookEntityList() { return nodeBookEntityList; } public void setNodeBookEntityList(List<NodeBookForm> nodeBookEntityList) { this.nodeBookEntityList = nodeBookEntityList; } }
package com.noteshare.course.article.model; import java.util.Date; import com.noteshare.common.utils.DateUtil; public class Article { private Integer id; private Integer courseid; private Integer authorid; private String authorname; private String articletitle; private Integer prearticleid; private Integer nextarticleid; private Integer sortcode; private String publish; private Integer reading; private Integer good; private Integer bad; private Integer discuss; private Integer complain; private Date createtime; private Date modifytime; private String content; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getCourseid() { return courseid; } public void setCourseid(Integer courseid) { this.courseid = courseid; } public Integer getAuthorid() { return authorid; } public void setAuthorid(Integer authorid) { this.authorid = authorid; } public String getAuthorname() { return authorname; } public void setAuthorname(String authorname) { this.authorname = authorname; } public String getArticletitle() { return articletitle; } public void setArticletitle(String articletitle) { this.articletitle = articletitle == null ? null : articletitle.trim(); } public Integer getPrearticleid() { return prearticleid; } public void setPrearticleid(Integer prearticleid) { this.prearticleid = prearticleid; } public Integer getNextarticleid() { return nextarticleid; } public void setNextarticleid(Integer nextarticleid) { this.nextarticleid = nextarticleid; } public Integer getSortcode() { return sortcode; } public void setSortcode(Integer sortcode) { this.sortcode = sortcode; } public String getPublish() { return publish; } public void setPublish(String publish) { this.publish = publish == null ? null : publish.trim(); } public Integer getReading() { return reading; } public void setReading(Integer reading) { this.reading = reading; } public Integer getGood() { return good; } public void setGood(Integer good) { this.good = good; } public Integer getBad() { return bad; } public void setBad(Integer bad) { this.bad = bad; } public Integer getDiscuss() { return discuss; } public void setDiscuss(Integer discuss) { this.discuss = discuss; } public Integer getComplain() { return complain; } public void setComplain(Integer complain) { this.complain = complain; } public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public Date getModifytime() { return modifytime; } public void setModifytime(Date modifytime) { this.modifytime = modifytime; } public String getContent() { return content; } public void setContent(String content) { this.content = content == null ? null : content.trim(); } /** * @Title: getCreateTimeMMDD2 * @Description: 获取时间格式为月/日格式的创建时间 * @return String * @author xingchen */ public String getCreatetimeMMDD2() { return DateUtil.getMMDD2(this.getCreatetime()); } /** * @Title: getModifytimeMMDD2 * @Description: 获取时间格式为月/日格式的创建时间 * @return String * @author xingchen */ public String getModifytimeMMDD2() { return DateUtil.getMMDD2(this.getModifytime()); } /** * @Title: getYYYYMMDD * @Description: 获取评论时间格式为年/月/日 * @return String * @author xingchen * @date 2016-04-09 * @throws */ public String getCreatetimeYYYYMMDD() { return DateUtil.getYYYYMMDD(this.getCreatetime()); } }
package DP; public class longestascendingarray { public int longest(int [] array){ if(array == null || array.length == 0){ return 0; } int [] num = new int[array.length]; num[0] = 1; int result = 1; for(int i = 1; i < array.length; i++) { if(array[i] > array[i-1]){ num[i] = Math.max(num[i-1] + 1, 1); result = Math.max(result, num[i]); } else{ num[i] = 1; } } return result; } public static void main (String [] args){ longestascendingarray s = new longestascendingarray(); int [] array = {1,2,3,2,3,4,5,1}; System.out.print(s.longest(array)); } }
package com.blackdragon2447.AAM.gui.dialog.advCom; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.util.concurrent.TimeUnit; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; import javax.swing.border.EmptyBorder; import com.blackdragon2447.AAM.Reference; import com.blackdragon2447.AAM.gui.AAMGui; import com.blackdragon2447.AAM.util.RconHandler; import net.kronos.rkon.core.ex.AuthenticationException; public class ListUnclaimedReturnDialog extends JFrame { static final long serialVersionUID = -7969913714004038511L; private JPanel contentPane; JTextArea ResponseLabel; RefreshThread refreshThread = new RefreshThread(); Thread thread = new Thread(refreshThread); /** * the method for opening the gui */ public static void createGui() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { ListUnclaimedReturnDialog frame = new ListUnclaimedReturnDialog(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * the constructor: build the gui */ public ListUnclaimedReturnDialog() { try { UIManager.setLookAndFeel(AAMGui.getLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setBounds(100, 100, 500, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); GridBagLayout gbl_contentPane = new GridBagLayout(); gbl_contentPane.columnWidths = new int[]{0, 0, 0, 0}; gbl_contentPane.rowHeights = new int[]{0, 0, 0, 0}; gbl_contentPane.columnWeights = new double[]{0.0, 1.0, 0.0, Double.MIN_VALUE}; gbl_contentPane.rowWeights = new double[]{0.0, 1.0, 0.0, Double.MIN_VALUE}; contentPane.setLayout(gbl_contentPane); String result = null; if(!Reference.MultipleServer) { try { result = RconHandler.command("ListUnclaimedDinos"); } catch (Exception e1) { if(e1 instanceof AuthenticationException) result = "failed to outheticate"; else if (Reference.Password == null) { JOptionPane.showInternalMessageDialog(contentPane, "not logged on", "", JOptionPane.ERROR_MESSAGE); } else { result = "an unkown error occured"; e1.printStackTrace(); } } } else { try { result = RconHandler.MultipleCommand("ListUnclaimedDinos"); } catch (Exception e1) { if(e1 instanceof AuthenticationException) result = "failed to autheticate"; else if (Reference.Password == null) { JOptionPane.showInternalMessageDialog(contentPane, "not logged on", "", JOptionPane.ERROR_MESSAGE); } else { result = "an unkown error occured"; e1.printStackTrace(); } } } if(result.contains("no response")) JOptionPane.showInternalMessageDialog(contentPane, "server recived, assuming it exectued!"); ResponseLabel = new JTextArea(result); ResponseLabel.setEditable(false); GridBagConstraints gbc_ResponseLabel = new GridBagConstraints(); gbc_ResponseLabel.insets = new Insets(0, 0, 5, 5); gbc_ResponseLabel.gridx = 1; gbc_ResponseLabel.gridy = 1; contentPane.add(ResponseLabel, gbc_ResponseLabel); setBounds(getBounds().x, getBounds().y, getBounds().width, 20 * ResponseLabel.getLineCount()); thread.start(); addWindowListener(new WindowListener() { @Override public void windowOpened(WindowEvent e) {} @Override public void windowIconified(WindowEvent e) {} @Override public void windowDeiconified(WindowEvent e) {} @Override public void windowDeactivated(WindowEvent e) {} @Override public void windowClosing(WindowEvent e) { refreshThread.stop(); } @Override public void windowClosed(WindowEvent e) {} @Override public void windowActivated(WindowEvent e) {} }); } class RefreshThread implements Runnable{ Thread RefreshThead; private volatile boolean exit = false; public RefreshThread() {} @Override public void run() { while(!exit) { String result = null; if(!Reference.MultipleServer) { try { result = RconHandler.command("ListUnclaimedDinos"); } catch (Exception e1) { if(e1 instanceof AuthenticationException) result = "failed to outheticate"; else if (Reference.Password == null) { JOptionPane.showInternalMessageDialog(contentPane, "not logged on", "", JOptionPane.ERROR_MESSAGE); } else { result = "an unkown error occured"; e1.printStackTrace(); } } } else { try { result = RconHandler.MultipleCommand("ListUnclaimedDinos"); } catch (Exception e1) { if(e1 instanceof AuthenticationException) result = "failed to autheticate"; else if (Reference.Password == null) { JOptionPane.showInternalMessageDialog(contentPane, "not logged on", "", JOptionPane.ERROR_MESSAGE); } else { result = "an unkown error occured"; e1.printStackTrace(); } } } if(result.contains("no response")) JOptionPane.showInternalMessageDialog(contentPane, "server recived, assuming it exectued!"); try { TimeUnit.SECONDS.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } ResponseLabel.setText(result); setBounds(getBounds().x, getBounds().y, getBounds().width, 20 * ResponseLabel.getLineCount()); } } public void stop() { exit = true; } } }
package com.fc.activity.kdg; import java.util.Map; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.WindowManager; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.fc.R; import com.fc.activity.FrameActivity; import com.fc.activity.main.MainActivity; import com.fc.cache.DataCache; import com.fc.cache.ServiceReportCache; /** * 快递柜-近期工单查询-数据展示 * @author zdkj * */ public class JqgdcxShowKdg extends FrameActivity { private Button confirm,cancel; private String flag,zbh,type="1",msgStr,ddh,lxdh; private ImageView iv_telphone; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 默认焦点不进入输入框,避免显示输入法 getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); appendMainBody(R.layout.activity_kdg_jqgdcxshow); initVariable(); initView(); initListeners(); } @Override protected void initVariable() { confirm = (Button) findViewById(R.id.include_botto).findViewById( R.id.confirm); cancel = (Button) findViewById(R.id.include_botto).findViewById( R.id.cancel); confirm.setText("确定"); cancel.setText("取消"); iv_telphone = (ImageView) findViewById(R.id.iv_telphone); } @Override protected void initView() { title.setText(DataCache.getinition().getTitle()); Map<String, Object> itemmap = ServiceReportCache.getObjectdata().get(ServiceReportCache.getIndex()); zbh = itemmap.get("zbh").toString(); ddh = itemmap.get("ddh").toString(); lxdh = itemmap.get("lxdh").toString(); ((TextView) findViewById(R.id.tv_1)).setText(zbh); ((TextView) findViewById(R.id.tv_2)).setText(itemmap.get("axdh").toString()); ((TextView) findViewById(R.id.tv_3)).setText(itemmap.get("sx").toString()); ((TextView) findViewById(R.id.tv_4)).setText(itemmap.get("qy").toString()); ((TextView) findViewById(R.id.tv_5)).setText(itemmap.get("xqmc").toString()); ((TextView) findViewById(R.id.tv_6)).setText(itemmap.get("xxdz").toString()); ((TextView) findViewById(R.id.tv_7)).setText(itemmap.get("ddh_mc").toString()); ((TextView) findViewById(R.id.tv_8)).setText(itemmap.get("bzsj").toString()); ((TextView) findViewById(R.id.tv_9)).setText(itemmap.get("yqsx").toString()); ((TextView) findViewById(R.id.tv_10)).setText(itemmap.get("lxdh").toString()); ((TextView) findViewById(R.id.tv_11)).setText(itemmap.get("dygdh1_mc").toString()); ((TextView) findViewById(R.id.tv_12)).setText(itemmap.get("dygdh2_mc").toString()); ((TextView) findViewById(R.id.tv_13)).setText(itemmap.get("kzzf6").toString()); ((TextView) findViewById(R.id.tv_14)).setText(itemmap.get("kzzf7").toString()); ((TextView) findViewById(R.id.tv_15)).setText(itemmap.get("kzzf8").toString()); ((TextView) findViewById(R.id.tv_16)).setText(itemmap.get("gzxx").toString()); ((TextView) findViewById(R.id.tv_17)).setText(itemmap.get("kzsz1").toString()); ((TextView) findViewById(R.id.tv_18)).setText(itemmap.get("bz").toString()); ((TextView) findViewById(R.id.tv_jddz)).setText(itemmap.get("jddz").toString()); if("1".equals(ddh)){ findViewById(R.id.ll_1).setVisibility(View.VISIBLE); } if("3".equals(ddh)){ findViewById(R.id.ll_2).setVisibility(View.VISIBLE); } } @Override protected void initListeners() { // OnClickListener backonClickListener = new OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.bt_topback: onBackPressed(); break; case R.id.cancel: onBackPressed(); break; case R.id.confirm: onBackPressed(); break; default: break; } } }; topBack.setOnClickListener(backonClickListener); cancel.setOnClickListener(backonClickListener); confirm.setOnClickListener(backonClickListener); iv_telphone.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if ("".equals(lxdh)) { toastShowMessage("请选择联系电话!"); return; } Call(lxdh); } }); } @Override protected void getWebService(String s) { } // // @Override // public void onBackPressed() { // super.onBackPressed(); // finish(); // } }
package com.noteshare.wechat.services; import javax.servlet.http.HttpServletRequest; /** * @ClassName : WechatService * @Description : 核心服务类 * @author : xingchen * @date : 2016年6月13日 下午10:22:08 */ public interface WechatService { /** * @Title : processRequest * @Description : 处理微信发来的请求 * @return : String * @author : xingchen * @date : 2016年6月13日 下午10:22:36 * @throws */ public String processRequest(HttpServletRequest request); }
package com.midashnt.taekwondo.util; import org.springframework.context.ApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.util.FileCopyUtils; import java.io.IOException; import java.nio.charset.StandardCharsets; public class MidasHnTSystemUtil { public static String getResourceFile(String filePath) { try { ClassPathResource resourceFile = new ClassPathResource(filePath); return new String(FileCopyUtils.copyToByteArray(resourceFile.getInputStream()), StandardCharsets.UTF_8); } catch (IOException e) { e.printStackTrace(); } return null; } public static Object getBean(Class<?> classType) { ApplicationContext applicationContext = ApplicationContextProvider.getContext(); return applicationContext.getBean(classType); } }
package controller; import java.io.IOException; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import dao.EmployeeDAO; import dao.PersonalDAO; import dao.RoleDAO; import dao.UserDAO; import model.Employee; import model.Personal; import model.Role; import model.User; import utils.AuthUtil; import utils.DefineUtil; import utils.RandomPasswordUtils; import utils.SendGmailUtil; import utils.SendMail; import utils.StringUtil; public class UserAddController extends HttpServlet { private static final long serialVersionUID = 1L; int check_send=0; public UserAddController() { super(); // TODO Auto-generated constructor stub } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(!AuthUtil.checkLogin(request, response)) { response.sendRedirect(request.getContextPath()+"/login"); return; } RoleDAO roleDAO = new RoleDAO(); List<Role> roleList = roleDAO.roleList(); request.setAttribute("roleList", roleList); RequestDispatcher rd = request.getRequestDispatcher("/views/public/user/add.jsp"); rd.forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { UserDAO userDAO = new UserDAO(); String username = request.getParameter("username"); String fullname = request.getParameter("fullname"); String email = request.getParameter("email"); int role_id = Integer.parseInt(request.getParameter("role") ); String pass = RandomPasswordUtils.randomAlphaNumeric(6); String password = StringUtil.md5(pass); User user= new User(0, username, password, email, fullname, new Role(role_id, "")); User checkTrungUser = userDAO.checkTrung(username); if(checkTrungUser!=null) { User userTrung = new User(0, username, "", email, fullname, new Role(role_id, "")); request.setAttribute("userTrung", userTrung); RequestDispatcher rd = request.getRequestDispatcher("/views/public/user/add.jsp"); rd.forward(request, response); }else { int addItem = userDAO.addItem(user); if(addItem>0) { String sub ="Successfully Sigup account Human And Payroll Management"; String msg ="Your account is:" + "\n Username: "+username+"" + "\n Password: "+pass; SendGmailUtil.sendGmail(email, sub, msg); response.sendRedirect(request.getContextPath()+"/user?msg=success" ); return; } } } }
package cz.root.rohlik.jpa.repository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import cz.root.rohlik.entity.Order; import java.util.List; public interface OrderRepository extends CrudRepository<Order, Long> { @Query(value = "select * from ORDER_TABLE a where a.status = 'REGISTER'", nativeQuery = true) List<Order> getAllOrderWithStatusRegister(); }
public class TestPunkt { public static void main(String[] args) { Zbior<Punkt> z1=new Zbior<Punkt>(); Zbior<Punkt> z2=new Zbior<Punkt>(); Zbior<Punkt> z3=new Zbior<Punkt>(); Punkt p1=new Punkt(3,7); Punkt p2=new Punkt(2,5); Punkt p3=new Punkt(1,4); Punkt p4=new Punkt(8,5); Punkt p5=new Punkt(4,3); Punkt p6=new Punkt(3,5); z1.dopisz(p1); z1.dopisz(p2); z1.dopisz(p3); z2.dopisz(p2); z2.dopisz(p3); z2.dopisz(p4); z3.dopisz(p4); z3.dopisz(p5); z3.dopisz(p6); // wyświetlenie zbiorów z1.toString(); z1.wyswietl("Zbior 1: "); System.out.println(""); z2.toString(); z2.wyswietl("Zbior 2: "); System.out.println(""); z3.toString(); z3.wyswietl("Zbior 3: "); System.out.println(""); Zbior<Punkt> zb=new Zbior<Punkt>(); // suma zb=z1.suma(z2); zb.wyswietl("Suma zbiorow 1 i 2"); System.out.println(""); zb=z1.suma(z2).suma(z3); zb.wyswietl("Suma zbiorow 1, 2 i 3"); System.out.println(""); // różnica zb=z2.roznica(z1); zb.wyswietl("Roznica zbiorow 2 i 1"); System.out.println(""); zb=z1.roznica(z3); zb.wyswietl("Roznica zbiorow 1 i 3"); System.out.println(""); // przekrój zb = z1.przekroj(z2); zb.wyswietl("Przekrój zbiorow 1 i 2: "); System.out.println(""); zb = z2.przekroj(z3); zb.wyswietl("Przekrój zbiorow 2 i 3: "); System.out.println(""); // różnica symetryczna zb=z1.roznica_symetryczna(z2); zb.wyswietl("Roznica symetryczna zbiorow: 1 i 2"); } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int z[]=new int[n]; for(int i=0;i<n;i++) { z[i]=sc.nextInt(); } int m=n+1-k; int sol=(m*(m+1))/2; System.out.println(sol); } }
package com.yeahbunny.stranger.server.controller; import com.yeahbunny.stranger.server.services.PhotoService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.inject.Inject; import javax.servlet.http.HttpServletResponse; @Controller @RequestMapping(value = "/photo") public class PhotoController { private static final Logger LOG = LoggerFactory.getLogger(PhotoController.class); @Inject private PhotoService photoService; @RequestMapping(value = "/{fileName:.+}", method = RequestMethod.GET, produces = MediaType.IMAGE_JPEG_VALUE) @ResponseBody public byte[] getImage(@PathVariable String fileName) { LOG.debug("Load photo: {}", fileName); return photoService.load(fileName); } }
package com; import org.eclipse.paho.client.mqttv3.MqttClientPersistence; import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence; import java.util.HashMap; public class Diff { public static void main(String[] args) throws MqttException{ String s1 = "{\"type\": \"message_typing\",\"requestId\": \"requestid\",\"clientMutationId\": \"mutationid\",\"chatRoomId\": \"roomid\",\"conversationId\": \"conversationid\"}"; String s2 = "{\"type\": \"type_2\",\"requestId\": \"1\",\"clientMutationId\": \"2\",\"chatRoomId\": \"dev/test\",\"conversationId\": \"aa2344ceDsea1\"}"; HashMap<Integer,String> cache = new HashMap<>(); cache.put(0,s1); String message= CompressionTools.diffEncode(cache.get(0),s2); String ipaddress="localhost"; String topic="dev/test"; MqttClientPersistence persistence = new MqttDefaultFilePersistence(); MqttCompressionClient client = new MqttCompressionClient("tcp://"+ipaddress+":1883", "IBM-17726",persistence,1); MqttMessage payload = new MqttMessage(); payload.setPayload(message.getBytes()); try{ client.connect(); client.publish(topic, payload); System.out.println(payload); client.disconnect(); } catch(Exception e){ System.out.println(e); } System.out.println("Message published"); System.exit(0); } }
package Management.HumanResources.test; import Management.HumanResources.DepartmentCommand.AuditSalaryTableCommand; import Management.HumanResources.FinancialSystem.DataAccessObject.SalaryDaoImpl; import Management.HumanResources.FinancialSystem.FinancialDepartment; import Management.HumanResources.FinancialSystem.Permission; import Management.HumanResources.Manager.TestingManager; import Management.HumanResources.Staff.Accountant; import Management.HumanResources.Staff.Auditor; import Management.HumanResources.Staff.Worker; import Management.HumanResources.TeamLeader.TestingTeamLeader; import Management.QualityTesting.QualityAssuranceDepartment; import Presentation.Protocol.IOManager; import java.io.IOException; /** * FinancialDepartmentTest类的测试类 * * @author 陈垲昕 * @since 2021/10/24 3:18 下午 */ public class FinancialDepartmentTest { public static void main(String[] args) throws IOException { // 获取QualityAssurance部门的实例 QualityAssuranceDepartment qualityTestingDepartment = QualityAssuranceDepartment.getInstance(); // 获取FinancialDepartment部门的实例 FinancialDepartment financialDepartment = FinancialDepartment.getInstance(); // 创建该部门的经理 TestingManager testingManager = new TestingManager(); // 创建该部门的一个组长 TestingTeamLeader testingTeamLeader1 = new TestingTeamLeader(); // 创建该部门的一个员工 Worker testingWorker = new Worker(); //创建经济部门的审计员等 Auditor auditor1=new Auditor("怀特菲尔德", 201.0); Auditor auditor2=new Auditor("哈梅特",100.0); if(auditor1 instanceof Permission){ financialDepartment.register(auditor1,true); } else{ IOManager.getInstance().errorMassage( "没有权限访问财务系统,访问已被拒绝", "沒有權限訪問財務系統,訪問已被拒絕", "The access to financial system is rejected" ); } // 创建一个会计 Accountant accountant = new Accountant(); accountant.setName("Trisbox"); // if(accountant instanceof Permission) { // accountant.accessFinancialSystem(); // } else { // IOManager.getInstance().errorMassage( // accountant.getName()+ "没有权限访问财务系统,访问已被拒绝", // accountant.getName()+"沒有權限訪問財務系統,訪問已被拒絕", // accountant.getName()+"The access to financial system is rejected" // ); // } // if(auditor2 instanceof Permission){ // financialDepartment.register(auditor2,true); // } else{ // IOManager.getInstance().errorMassage( // "没有权限访问财务系统,访问已被拒绝", // "沒有權限訪問財務系統,訪問已被拒絕", // "The access to financial system is rejected" // ); // } // //创建经济部门的审计员等 // Auditor auditor1=new Auditor("怀特菲尔德", 201.0); // Auditor auditor2=new Auditor("哈梅特",100.0); // financialDepartment.register(accountant testingManager.setName("Bear"); testingTeamLeader1.setName("Joe"); testingTeamLeader1.setLeader(testingManager); testingWorker.setName("Eoj"); testingWorker.setLeader(testingTeamLeader1); // if(testingWorker instanceof Permission){ // testingWorker.stealMoney(); // } else{ // IOManager.getInstance().errorMassage( // testingWorker.getName()+ "没有权限访问财务系统,访问已被拒绝", // testingWorker.getName()+"沒有權限訪問財務系統,訪問已被拒絕", // testingWorker.getName()+"The access to financial system is rejected" // ); // } // financialDepartment.register(testingWorker); // 分别将其注册到该部门 qualityTestingDepartment.register(testingManager,true); qualityTestingDepartment.register(testingTeamLeader1,true); qualityTestingDepartment.register(testingWorker,true); //审计命令,指定经济部门下的一个审计员 AuditSalaryTableCommand auditReportCommand = new AuditSalaryTableCommand(auditor1); //命令模式,执行命令 financialDepartment.setCurrentCommand(auditReportCommand); //获取SalaryDaoImpl单例 SalaryDaoImpl salaryDaoImpl= SalaryDaoImpl.getInstance(); financialDepartment.giveCommand(); // 理论输出: 无需审计 //写入QualityTestingDepartment salaryDaoImpl.saveSalary(qualityTestingDepartment); salaryDaoImpl.saveSalary(financialDepartment); // salaryDaoImpl.closeFile(); financialDepartment.giveCommand(); //理论输出: 审计 financialDepartment.giveCommand(); //理论输出: 无需审计 financialDepartment.viewAuditHistoryList(); } }
package org.sbbs.base.service.impl; public class GeneralmanagerImpl { }
package com.cskaoyan.mapper; import com.cskaoyan.bean.DeviceType; import org.apache.ibatis.annotations.Param; import java.util.List; /** * @Author: zero * @Date: 2019/5/18 15:49 * @Version 1.0 */ public interface DeviceTypeMapper { List<DeviceType> getDeviceTypeList(@Param("rows") int rows, @Param("offset") int offset); List<DeviceType> getDeviceTypeById(@Param("deviceTypeId") String searchValue, @Param("rows") int rows, @Param("offset") int offset); List<DeviceType> getDeviceTypeByName(@Param("deviceTypeName") String searchValue,@Param("rows") int rows, @Param("offset") int offset); DeviceType[] getDeviceTypes(); DeviceType selectDeviceTypeById(@Param("deviceTypeId") String deviceTypeId); int updateDeviceType(@Param("updateDeviceTypeBean") DeviceType deviceType); void insertDeviceType(@Param("insertDeviceTypeBean") DeviceType deviceType); void deleteDeviceType(@Param("ids") String[] ids); int queryTotalDeviceType(); }
package com.xkzhangsan.time.calendar; import com.xkzhangsan.time.LunarDate; import com.xkzhangsan.time.calculator.DateTimeCalculatorUtil; import com.xkzhangsan.time.converter.DateTimeConverterUtil; import com.xkzhangsan.time.formatter.DateTimeFormatterUtil; import com.xkzhangsan.time.holiday.Holiday; import java.io.Serializable; import java.time.LocalDateTime; import java.util.Date; import java.util.Map; /** * 日 * * @author xkzhangsan */ public class DayWrapper implements Serializable { private static final long serialVersionUID = 5710793952115910594L; /** * date */ private Date date; /** * java8 localDateTime 丰富方法可以使用 */ private LocalDateTime localDateTime; /** * 日期 yyyy-MM-dd */ private String dateStr; /** * 天,当月第几天 */ private int day; /** * 星期,数字,1-7 */ private int week; /** * 星期,中文简写,比如星期一为一 */ private String weekCnShort; /** * 星期,中文全称,比如星期一 */ private String weekCnLong; /** * 星期,英文简写,比如星期一为Mon */ private String weekEnShort; /** * 星期,英文简写大写,比如星期一为MON */ private String weekEnShortUpper; /** * 星期,英文全称,比如星期一为Monday */ private String weekEnLong; /** * 公历节日 */ private String localHoliday; /** * 农历 */ private LunarDate lunarDate; /** * 农历节日 */ private String chineseHoliday; /** * 农历日期 */ private String lunarDateStr; /** * 农历天,比如初一 */ private String lunarDay; /** * 二十四节气 */ private String solarTerm; /** * 日期类型,0休息日,1其他为工作日 */ private int dateType; /** * 扩展信息 */ private Object obj; /** * 创建DayWrapper * * @param localDateTime LocalDateTime */ public DayWrapper(LocalDateTime localDateTime) { this(localDateTime, false); } /** * 创建DayWrapper * * @param localDateTime LocalDateTime * @param includeLunarDate * 是否包含农历 */ public DayWrapper(LocalDateTime localDateTime, boolean includeLunarDate) { this(localDateTime, includeLunarDate, false, null, null); } /** * 创建DayWrapper * * @param localDateTime LocalDateTime * @param includeLunarDate * 是否包含农历 * @param includeHoliday * 是否包含节日 * @param localHolidayMap * 自定义公历节日信息localHolidayMap 自定义公历节日数据,特殊节日如,"母亲节", "5-W-2-7" * 5表示5月,W表示星期,2表示第二个星期,7表示星期的第7天,为null时,使用默认数据 LocalHolidayEnum * @param chineseHolidayMap * 自定义农历节日信息,特殊节日如除夕 用CHUXI表示,为null时,使用默认数据 ChineseHolidayEnum */ public DayWrapper(LocalDateTime localDateTime, boolean includeLunarDate, boolean includeHoliday, Map<String, String> localHolidayMap, Map<String, String> chineseHolidayMap) { this(localDateTime, null, includeLunarDate, includeHoliday, localHolidayMap, chineseHolidayMap); } public DayWrapper(LocalDateTime localDateTime, Object obj, boolean includeLunarDate, boolean includeHoliday, Map<String, String> localHolidayMap, Map<String, String> chineseHolidayMap) { super(); this.localDateTime = localDateTime; this.date = DateTimeConverterUtil.toDate(localDateTime); this.dateStr = DateTimeFormatterUtil.formatToDateStr(localDateTime); this.day = localDateTime.getDayOfMonth(); // week this.week = localDateTime.getDayOfWeek().getValue(); this.weekCnShort = DateTimeCalculatorUtil.getDayOfWeekCnShort(localDateTime); this.weekCnLong = DateTimeCalculatorUtil.getDayOfWeekCn(localDateTime); this.weekEnShort = DateTimeCalculatorUtil.getDayOfWeekEnShort(localDateTime); this.weekEnShortUpper = DateTimeCalculatorUtil.getDayOfWeekEnShortUpper(localDateTime); this.weekEnLong = DateTimeCalculatorUtil.getDayOfWeekEnLong(localDateTime); this.obj = obj; // LunarDate if (includeLunarDate) { this.lunarDate = LunarDate.from(localDateTime); this.lunarDateStr = lunarDate.getlDateCn(); this.lunarDay = lunarDate.getlDayCn(); this.solarTerm = lunarDate.getSolarTerm(); } // Holiday if (includeHoliday) { this.localHoliday = Holiday.getLocalHoliday(localDateTime, localHolidayMap); if (includeLunarDate) { this.chineseHoliday = Holiday.getChineseHoliday(localDateTime, chineseHolidayMap); } } // 工作日 this.dateType = DateTimeCalculatorUtil.isWorkDay(localDateTime)?1:0; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public LocalDateTime getLocalDateTime() { return localDateTime; } public void setLocalDateTime(LocalDateTime localDateTime) { this.localDateTime = localDateTime; } public Object getObj() { return obj; } public void setObj(Object obj) { this.obj = obj; } public String getDateStr() { return dateStr; } public void setDateStr(String dateStr) { this.dateStr = dateStr; } public int getDay() { return day; } public void setDay(int day) { this.day = day; } public String getWeekCnShort() { return weekCnShort; } public void setWeekCnShort(String weekCnShort) { this.weekCnShort = weekCnShort; } public String getWeekEnShort() { return weekEnShort; } public void setWeekEnShort(String weekEnShort) { this.weekEnShort = weekEnShort; } public String getWeekEnShortUpper() { return weekEnShortUpper; } public void setWeekEnShortUpper(String weekEnShortUpper) { this.weekEnShortUpper = weekEnShortUpper; } public String getWeekCnLong() { return weekCnLong; } public void setWeekCnLong(String weekCnLong) { this.weekCnLong = weekCnLong; } public String getWeekEnLong() { return weekEnLong; } public void setWeekEnLong(String weekEnLong) { this.weekEnLong = weekEnLong; } public LunarDate getLunarDate() { return lunarDate; } public void setLunarDate(LunarDate lunarDate) { this.lunarDate = lunarDate; } public String getLocalHoliday() { return localHoliday; } public void setLocalHoliday(String localHoliday) { this.localHoliday = localHoliday; } public String getChineseHoliday() { return chineseHoliday; } public void setChineseHoliday(String chineseHoliday) { this.chineseHoliday = chineseHoliday; } public String getSolarTerm() { return solarTerm; } public void setSolarTerm(String solarTerm) { this.solarTerm = solarTerm; } public String getLunarDateStr() { return lunarDateStr; } public void setLunarDateStr(String lunarDateStr) { this.lunarDateStr = lunarDateStr; } public int getWeek() { return week; } public void setWeek(int week) { this.week = week; } public int getDateType() { return dateType; } public void setDateType(int dateType) { this.dateType = dateType; } public String getLunarDay() { return lunarDay; } public void setLunarDay(String lunarDay) { this.lunarDay = lunarDay; } }
package rs.pupin.custompolyline2; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ListView; import java.lang.annotation.Target; /** * A simple {@link Fragment} subclass. */ public class DrawingFragment extends Fragment implements View.OnClickListener { static interface DrawingListener { void okButtonClicked(); void showShapesButtonClicked(); void finishedButtonClicked(); } private DrawingListener listener; public DrawingFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_drawing, container, false); Button okButton = (Button) v.findViewById(R.id.ok); Button showShapesButton = (Button) v.findViewById(R.id.showShapes); Button finishedButton = (Button) v.findViewById(R.id.finished); okButton.setOnClickListener(this); showShapesButton.setOnClickListener(this); finishedButton.setOnClickListener(this); return v; } @Override public void onClick(View v) { if (listener != null) { switch (v.getId()) { case R.id.ok: listener.okButtonClicked(); break; case R.id.showShapes: listener.showShapesButtonClicked(); break; case R.id.finished: listener.finishedButtonClicked(); break; default: break; } } } @TargetApi(23) @Override public void onAttach(Context context) { super.onAttach(context); Activity a; if (context instanceof Activity) { a = (Activity) context; this.listener = (DrawingListener) a; } } /* * Deprecated on API 23 * Use onAttachToContext instead */ @SuppressWarnings("deprecation") @Override public void onAttach(Activity activity) { super.onAttach(activity); if (Build.VERSION.SDK_INT < 23) { this.listener = (DrawingListener) activity; } } }
package com.rbkmoney.adapter.atol.service.atol.constant; import lombok.Getter; import lombok.RequiredArgsConstructor; import java.util.HashMap; import java.util.Map; /** * Устанавливает номер налога в ККТ */ @Getter @RequiredArgsConstructor public enum Tax { NONE("none", "без НДС"), VAT0("vat0", "НДС по ставке 0%"), VAT10("vat10", "НДС чека по ставке 10%"), VAT18("vat18", "НДС чека по ставке 18%"), VAT110("vat110", "НДС чека по расчетной ставке 10/110"), VAT118("vat118", "НДС чека по расчетной ставке 18/118"), VAT20("vat20", "НДС чека по ставке 20%"), VAT120("vat120", "НДС чека по расчетной ставке 20/120"), ; private final String code; private final String message; private static final Map<String, Tax> TAX_MAP = new HashMap<>(); static { for (Tax value : Tax.values()) { TAX_MAP.put(value.name(), value); } } public static Tax fromString(String value) { Tax tax = TAX_MAP.get(value); if (tax == null) { throw new IllegalArgumentException("No matching for [" + value + "]"); } return tax; } }
package com.nosuchteam.mapper; import com.nosuchteam.bean.Product; import com.nosuchteam.bean.ProductExample; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.List; public interface ProductMapper { long countByExample(ProductExample example); int deleteByExample(ProductExample example); int deleteByPrimaryKey(String productId); int insert(Product record); int insertSelective(Product record); List<Product> selectByExample(ProductExample example); Product selectByPrimaryKey(String productId); int updateByExampleSelective(@Param("record") Product record, @Param("example") ProductExample example); int updateByExample(@Param("record") Product record, @Param("example") ProductExample example); int updateByPrimaryKeySelective(Product record); int updateByPrimaryKey(Product record); List<Product> findAllProduct(); List<Product> findProductList(@Param("limit") int limit, @Param("offset") int offset); @Select("select count(*) from `product`;") int findTotalProduct(); }
package com.tencent.mm.plugin.luckymoney.b; import com.tencent.mm.bk.a; public final class ai extends a { public String content; public int ddp; public String iconUrl; public int kRD; public int kRE; public String name; public String type; protected final int a(int i, Object... objArr) { int fQ; if (i == 0) { f.a.a.c.a aVar = (f.a.a.c.a) objArr[0]; aVar.fT(1, this.ddp); if (this.name != null) { aVar.g(2, this.name); } if (this.type != null) { aVar.g(3, this.type); } if (this.content != null) { aVar.g(4, this.content); } aVar.fT(5, this.kRD); if (this.iconUrl != null) { aVar.g(6, this.iconUrl); } aVar.fT(7, this.kRE); return 0; } else if (i == 1) { fQ = f.a.a.a.fQ(1, this.ddp) + 0; if (this.name != null) { fQ += f.a.a.b.b.a.h(2, this.name); } if (this.type != null) { fQ += f.a.a.b.b.a.h(3, this.type); } if (this.content != null) { fQ += f.a.a.b.b.a.h(4, this.content); } fQ += f.a.a.a.fQ(5, this.kRD); if (this.iconUrl != null) { fQ += f.a.a.b.b.a.h(6, this.iconUrl); } return fQ + f.a.a.a.fQ(7, this.kRE); } else if (i == 2) { f.a.a.a.a aVar2 = new f.a.a.a.a((byte[]) objArr[0], unknownTagHandler); for (fQ = a.a(aVar2); fQ > 0; fQ = a.a(aVar2)) { if (!super.a(aVar2, this, fQ)) { aVar2.cJS(); } } return 0; } else if (i != 3) { return -1; } else { f.a.a.a.a aVar3 = (f.a.a.a.a) objArr[0]; ai aiVar = (ai) objArr[1]; switch (((Integer) objArr[2]).intValue()) { case 1: aiVar.ddp = aVar3.vHC.rY(); return 0; case 2: aiVar.name = aVar3.vHC.readString(); return 0; case 3: aiVar.type = aVar3.vHC.readString(); return 0; case 4: aiVar.content = aVar3.vHC.readString(); return 0; case 5: aiVar.kRD = aVar3.vHC.rY(); return 0; case 6: aiVar.iconUrl = aVar3.vHC.readString(); return 0; case 7: aiVar.kRE = aVar3.vHC.rY(); return 0; default: return -1; } } } }
package fnu.web.model; import java.sql.Timestamp; import fnu.common.BaseInfo; /** * <p>Title : TC_MvnoEntity - ValueObject class for table [TC_MVNO].</p> * <p>Description : </p> * <p>Copyright : Copyright (c) 2013 F&U Co. Ltd,.</p> * <table border=1> * <tr><th>field name(db)</th><th>type</th><th>comment</th></tr> * <tr><td>mvno_co_cd</td><td>String</td><td> MVNO사업자코드 </td></tr> * <tr><td>mvno_co_nm</td><td>String</td><td> 사업자명 </td></tr> * <tr><td>email_addr</td><td>String</td><td> 발신자e-mail </td></tr> * <tr><td>email_addr_ret</td><td>String</td><td> 반송e-mail </td></tr> * <tr><td>img_path1</td><td>String</td><td> 이미지경로1 </td></tr> * <tr><td>img_link1</td><td>String</td><td> 이미지링크1 </td></tr> * <tr><td>img_path2</td><td>String</td><td> 이미지경로2 </td></tr> * <tr><td>img_link2</td><td>String</td><td> 이미지링크2 </td></tr> * <tr><td>img_path3</td><td>String</td><td> 이미지경로3 </td></tr> * <tr><td>img_link3</td><td>String</td><td> 이미지링크4 </td></tr> * <tr><td>img_path4</td><td>String</td><td> 이미지경로5 </td></tr> * <tr><td>img_link4</td><td>String</td><td> 이미지링크5 </td></tr> * <tr><td>img_path5</td><td>String</td><td> 이미지경로5 </td></tr> * <tr><td>img_link5</td><td>String</td><td> 이미지링크5 </td></tr> * <tr><td>cr_dtm</td><td>Date</td><td> 최초입력일시 </td></tr> * </table> * * @author jgj * @date : 2013.03.04 */ public class TC_MVNO extends BaseInfo { /** mvno_co_cd (MVNO사업자코드) */ private String mvno_co_cd; /** mvno_co_nm (사업자명) */ //@NotNull(message="mvno_co_nm is not allowed Null ") private String mvno_co_nm; /** email_addr (발신자e-mail) */ //@NotNull(message="email_addr is not allowed Null ") private String email_addr; /** email_addr_ret (반송e-mail) */ //@NotNull(message="email_addr_ret is not allowed Null ") private String email_addr_ret; /** img_path1 (이미지경로1) */ //@NotNull(message="img_path1 is not allowed Null ") private String img_path1; /** img_link1 (이미지링크1) */ //@NotNull(message="img_link1 is not allowed Null ") private String img_link1; /** img_path2 (이미지경로2) */ //@NotNull(message="img_path2 is not allowed Null ") private String img_path2; /** img_link2 (이미지링크2) */ //@NotNull(message="img_link2 is not allowed Null ") private String img_link2; /** img_path3 (이미지경로3) */ //@NotNull(message="img_path3 is not allowed Null ") private String img_path3; /** img_link3 (이미지링크3) */ //@NotNull(message="img_link3 is not allowed Null ") private String img_link3; /** img_path4 (이미지경로3) */ //@NotNull(message="img_path4 is not allowed Null ") private String img_path4; /** img_link4 (이미지링크3) */ //@NotNull(message="img_link4 is not allowed Null ") private String img_link4; /** img_path5 (이미지경로3) */ //@NotNull(message="img_path5 is not allowed Null ") private String img_path5; /** img_link5 (이미지링크3) */ //@NotNull(message="img_link5 is not allowed Null ") private String img_link5; /** cr_dtm (최초입력일시) */ //@NotNull(message="cr_dtm is not allowed Null ") private Timestamp cr_dtm; /** * mvno_co_cd (MVNO사업자코드) Getter * @return */ public String getMvno_co_cd() { return mvno_co_cd; } /** * mvno_co_cd (MVNO사업자코드) Setting * @param mvno_co_cd */ public void setMvno_co_cd(String mvno_co_cd) { this.mvno_co_cd = mvno_co_cd; } /** * mvno_co_nm (사업자명) Getter * @return */ public String getMvno_co_nm() { return mvno_co_nm; } /** * mvno_co_nm (사업자명) Setting * @param mvno_co_nm */ public void setMvno_co_nm(String mvno_co_nm) { this.mvno_co_nm = mvno_co_nm; } /** * email_addr (발신자e-mail) Getter * @return */ public String getEmail_addr() { return email_addr; } /** * email_addr (발신자e-mail) Setting * @param email_addr */ public void setEmail_addr(String email_addr) { this.email_addr = email_addr; } /** * email_addr_ret (반송e-mail) Getter * @return */ public String getEmail_addr_ret() { return email_addr_ret; } /** * email_addr_ret (반송e-mail) Setting * @param email_addr_ret */ public void setEmail_addr_ret(String email_addr_ret) { this.email_addr_ret = email_addr_ret; } /** * img_path1 (이미지경로1) Getter * @return */ public String getImg_path1() { return img_path1; } /** * img_path1 (이미지경로1) Setting * @param img_path1 */ public void setImg_path1(String img_path1) { this.img_path1 = img_path1; } /** * img_link1 (이미지링크1) Getter * @return */ public String getImg_link1() { return img_link1; } /** * img_link1 (이미지링크1) Setting * @param img_link1 */ public void setImg_link1(String img_link1) { this.img_link1 = img_link1; } /** * img_path2 (이미지경로2) Getter * @return */ public String getImg_path2() { return img_path2; } /** * img_path2 (이미지경로2) Setting * @param img_path2 */ public void setImg_path2(String img_path2) { this.img_path2 = img_path2; } /** * img_link2 (이미지링크2) Getter * @return */ public String getImg_link2() { return img_link2; } /** * img_link2 (이미지링크2) Setting * @param img_link2 */ public void setImg_link2(String img_link2) { this.img_link2 = img_link2; } /** * img_path3 (이미지경로3) Getter * @return */ public String getImg_path3() { return img_path3; } /** * img_path3 (이미지경로3) Setting * @param img_path3 */ public void setImg_path3(String img_path3) { this.img_path3 = img_path3; } /** * img_link3 (이미지링크3) Getter * @return */ public String getImg_link3() { return img_link3; } /** * img_link3 (이미지링크3) Setting * @param img_link3 */ public void setImg_link3(String img_link3) { this.img_link3 = img_link3; } /** * img_path4 (이미지경로3) Getter * @return */ public String getImg_path4() { return img_path4; } /** * img_path4 (이미지경로3) Setting * @param img_path4 */ public void setImg_path4(String img_path4) { this.img_path4 = img_path4; } /** * img_link4 (이미지링크3) Getter * @return */ public String getImg_link4() { return img_link4; } /** * img_link4 (이미지링크3) Setting * @param img_link4 */ public void setImg_link4(String img_link4) { this.img_link4 = img_link4; } /** * img_path5 (이미지경로3) Getter * @return */ public String getImg_path5() { return img_path5; } /** * img_path5 (이미지경로3) Setting * @param img_path5 */ public void setImg_path5(String img_path5) { this.img_path5 = img_path5; } /** * img_link5 (이미지링크3) Getter * @return */ public String getImg_link5() { return img_link5; } /** * img_link5 (이미지링크3) Setting * @param img_link5 */ public void setImg_link5(String img_link5) { this.img_link5 = img_link5; } /** * cr_dtm (최초입력일시) Getter * @return */ public Timestamp getCr_dtm() { return cr_dtm; } /** * cr_dtm (최초입력일시) Setting * @param cr_dtm */ public void setCr_dtm(Timestamp cr_dtm) { this.cr_dtm = cr_dtm; } }
package edu.calstatela.cs245.qiao.project; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.ResultSet; import java.sql.SQLException; import javax.swing.JButton; import javax.swing.JOptionPane; public class SMDFrame extends BaseFrame { public SMDFrame() { super(500, 450); setFillForm(); JButton jbtSearch = new JButton("Search by ID"); panel.add(jbtSearch); JButton jbtModify = new JButton("Modify"); panel.add(jbtModify); JButton jbtDelete = new JButton("Delete"); panel.add(jbtDelete); SearchListener searchListener = new SearchListener(); jbtSearch.addActionListener(searchListener); DeleteListener deleteListener = new DeleteListener(); jbtDelete.addActionListener(deleteListener); UpdateListener updateListener = new UpdateListener(); jbtModify.addActionListener(updateListener); } // ---------------------- SearchListener ---------------------------------------- class SearchListener implements ActionListener { private String id, lastName, sex, birthDate, hireDate, jobStatus, payType, salary, yearS; @Override public void actionPerformed(ActionEvent e) { id = jtfId.getText(); try { DBConnection.openConnection(); ResultSet rs = DBConnection.searchID(id); if (rs.next()) { lastName = rs.getString(2); sex = rs.getString(5); birthDate = rs.getString(4); hireDate = rs.getString(3); jobStatus = rs.getString(6); payType = rs.getString(7); salary = rs.getString(8); yearS = rs.getString(9); jtfLastName.setText(lastName); jtfBirthDate.setText(birthDate); jtfHireDate.setText(hireDate); jtfSalary.setText(salary); jtfYearS.setText(yearS); if(sex.equals("M")){ jcboSex.setSelectedIndex(0); }else{ jcboSex.setSelectedIndex(1); } jcboJobStatus.setSelectedItem(jobStatus); jcboPayType.setSelectedItem(payType); } else { if(id.equals("")){ JOptionPane.showMessageDialog(null, "Please enter Employee ID for search.", "Error", JOptionPane.ERROR_MESSAGE); }else{ JOptionPane.showMessageDialog(null, "Record does not exist.", "Error", JOptionPane.ERROR_MESSAGE); } } DBConnection.closeResultSet(); DBConnection.closeStatementConnection(); } catch (SQLException e1) { JOptionPane.showMessageDialog(null, e1, "Error", JOptionPane.ERROR_MESSAGE); } } } // ------------------------DeleteListener------------------------------------ class DeleteListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { String id = jtfId.getText(); try { DBConnection.openConnection(); ResultSet rs = DBConnection.searchID(id); if (rs.next()) { int reply = JOptionPane.showConfirmDialog(null, "Dou you want to delete the record?", "Delete Confirmation", JOptionPane.YES_NO_OPTION); if (reply == JOptionPane.YES_OPTION){ DBConnection.deleteRow(id); jtfId.setText(null); jtfLastName.setText(null); jcboSex.setSelectedIndex(0); jtfBirthDate.setText("yyyy/mm/dd"); jtfHireDate.setText("yyyy/mm/dd"); jcboJobStatus.setSelectedIndex(0); jcboPayType.setSelectedIndex(0); jtfSalary.setText(null); jtfYearS.setText(null); JOptionPane.showMessageDialog(null, "Record deleted.", "Delete", JOptionPane.INFORMATION_MESSAGE); } } else { if(id.equals("")){ JOptionPane.showMessageDialog(null, "Please enter Employee ID.", "Error", JOptionPane.ERROR_MESSAGE); }else{ JOptionPane.showMessageDialog(null, "Record does not exist.", "Error", JOptionPane.ERROR_MESSAGE); } } DBConnection.closeResultSet(); DBConnection.closeStatementConnection(); } catch (SQLException e1) { JOptionPane.showMessageDialog(null, e1, "Error", JOptionPane.ERROR_MESSAGE); } } } //-------------------------UpdateListener------------------------------------- class UpdateListener implements ActionListener { private String id, lastName, sex, birthDate, hireDate, jobStatus, payType, salary, yearS; @Override public void actionPerformed(ActionEvent e) { id = jtfId.getText(); lastName = jtfLastName.getText(); sex = (String) jcboSex.getSelectedItem(); birthDate = jtfBirthDate.getText(); hireDate = jtfHireDate.getText(); jobStatus = (String) jcboJobStatus.getSelectedItem(); payType = (String) jcboPayType.getSelectedItem(); salary = jtfSalary.getText(); yearS = jtfYearS.getText(); if(sex.equals("Male")){ sex = "M"; }else{ sex = "F"; } if(birthDate.equals("yyyy/mm/dd") || birthDate.equals("")){ birthDate = "1900/01/01"; } if(hireDate.equals("yyyy/mm/dd") || hireDate.equals("")){ hireDate = "1900/01/01"; } if(salary.equals("")){ salary = "-1"; } if(yearS.equals("")){ yearS = "-1"; } try { DBConnection.openConnection(); ResultSet rs = DBConnection.searchID(id); if (rs.next()) { int reply = JOptionPane.showConfirmDialog(null, "Dou you want to update the record?", "Update Confirmation", JOptionPane.YES_NO_OPTION); if (reply == JOptionPane.YES_OPTION){ DBConnection.updateRow(id, lastName, sex, birthDate, hireDate, jobStatus, payType, salary, yearS); JOptionPane.showMessageDialog(null, "Record updated.", "Update", JOptionPane.INFORMATION_MESSAGE); } } else { if(id.equals("")){ JOptionPane.showMessageDialog(null, "Please enter Employee ID.", "Error", JOptionPane.ERROR_MESSAGE); }else{ JOptionPane.showMessageDialog(null, "Record does not exist.", "Error", JOptionPane.ERROR_MESSAGE); } } DBConnection.closeResultSet(); DBConnection.closeStatementConnection(); } catch (SQLException e1) { JOptionPane.showMessageDialog(null, e1, "Error", JOptionPane.ERROR_MESSAGE); } } } }
/* * [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 com.hybris.backoffice.widgets.catalog; import static com.hybris.backoffice.widgets.catalog.CatalogSelectorController.MODEL_SELECTED_DATA; import static com.hybris.backoffice.widgets.catalog.CatalogSelectorController.OUT_SOCKET_SYNC_CATALOG_VERSION; import static org.fest.assertions.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import de.hybris.platform.catalog.model.CatalogModel; import de.hybris.platform.catalog.model.CatalogVersionModel; import java.util.Arrays; import java.util.Set; import org.fest.util.Collections; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Button; import org.zkoss.zul.DefaultTreeModel; import org.zkoss.zul.DefaultTreeNode; import org.zkoss.zul.Div; import org.zkoss.zul.Tree; import org.zkoss.zul.TreeNode; import org.zkoss.zul.Treechildren; import org.zkoss.zul.Treeitem; import com.google.common.collect.Lists; import com.hybris.cockpitng.core.events.CockpitEvent; import com.hybris.cockpitng.dataaccess.facades.object.ObjectCRUDHandler; import com.hybris.cockpitng.labels.LabelService; import com.hybris.cockpitng.model.ComponentModelPopulator; import com.hybris.cockpitng.testing.AbstractWidgetUnitTest; import com.hybris.cockpitng.testing.annotation.DeclaredGlobalCockpitEvent; import com.hybris.cockpitng.testing.annotation.ExtensibleWidget; import com.hybris.cockpitng.testing.annotation.SocketsAreJsonSerializable; import com.hybris.cockpitng.testing.util.CockpitTestUtil; @DeclaredGlobalCockpitEvent(eventName = ObjectCRUDHandler.OBJECTS_UPDATED_EVENT, scope = CockpitEvent.SESSION) @DeclaredGlobalCockpitEvent(eventName = ObjectCRUDHandler.OBJECT_CREATED_EVENT, scope = CockpitEvent.SESSION) @DeclaredGlobalCockpitEvent(eventName = ObjectCRUDHandler.OBJECTS_DELETED_EVENT, scope = CockpitEvent.SESSION) @ExtensibleWidget(level = ExtensibleWidget.ALL) @SocketsAreJsonSerializable(false) public class CatalogSelectorControllerTest extends AbstractWidgetUnitTest<CatalogSelectorController> { @Spy @InjectMocks private CatalogSelectorController controller; @Spy private Tree tree; @Mock private Button popupOpener; @Mock private LabelService labelService; @Mock private Treeitem treeitem_catalog_1; @Mock private CatalogModel catalog_1; @Mock private Treechildren treechildren_catalog_1; @Mock private Treeitem treeitem_catalogVersion_1_1; @Mock private CatalogVersionModel catalogVersion_1_1; @Mock private Treeitem treeitem_catalogVersion_1_2; @Mock private CatalogVersionModel catalogVersion_1_2; @Mock private Treeitem treeitem_catalog_2; @Mock private CatalogModel catalog_2; @Mock private Treeitem treeitem_catalogVersion_2_1; @Mock private Treeitem treeitem_catalogVersion_2_2; @Mock private Treeitem treeitem_all; @Mock private Treeitem treeitem_notSupported; private final Object notSupportedData = new Object(); @Override protected CatalogSelectorController getWidgetController() { return controller; } @Before public void setUp() { when(treeitem_catalog_1.getValue()).thenReturn(catalog_1); when(treeitem_catalog_1.getTreechildren()).thenReturn(treechildren_catalog_1); when(treechildren_catalog_1.getItems()).thenReturn(Arrays.asList(treeitem_catalogVersion_1_1, treeitem_catalogVersion_1_2)); when(treeitem_catalogVersion_1_1.getValue()).thenReturn(catalogVersion_1_1); when(treeitem_catalogVersion_1_1.getParentItem()).thenReturn(treeitem_catalog_1); when(treeitem_catalogVersion_1_2.getValue()).thenReturn(catalogVersion_1_2); when(treeitem_catalogVersion_1_2.getParentItem()).thenReturn(treeitem_catalog_1); final Treechildren treechildren_catalog_2 = mock(Treechildren.class); when(treeitem_catalog_2.getValue()).thenReturn(catalog_2); when(treeitem_catalog_2.getTreechildren()).thenReturn(treechildren_catalog_2); when(treechildren_catalog_2.getItems()).thenReturn(Arrays.asList(treeitem_catalogVersion_2_1, treeitem_catalogVersion_2_2)); final CatalogVersionModel catalogVersion_2_1 = mock(CatalogVersionModel.class); when(treeitem_catalogVersion_2_1.getValue()).thenReturn(catalogVersion_2_1); when(treeitem_catalogVersion_2_1.getParentItem()).thenReturn(treeitem_catalog_2); final CatalogVersionModel catalogVersion_2_2 = mock(CatalogVersionModel.class); when(treeitem_catalogVersion_2_2.getValue()).thenReturn(catalogVersion_2_2); when(treeitem_catalogVersion_2_2.getParentItem()).thenReturn(treeitem_catalog_2); when(treeitem_all.getValue()).thenReturn(null); when(tree.getItems()) .thenReturn(Collections.set(treeitem_catalog_1, treeitem_catalogVersion_1_1, treeitem_catalogVersion_1_2, treeitem_catalog_2, treeitem_catalogVersion_2_1, treeitem_catalogVersion_2_2, treeitem_all)); when(treeitem_notSupported.getValue()).thenReturn(notSupportedData); doNothing().when(tree).removeItemFromSelection(any(Treeitem.class)); doNothing().when(tree).addItemToSelection(any(Treeitem.class)); doNothing().when(tree).selectItem(any(Treeitem.class)); } @Test @Ignore public void testSyncOnCatalogVersionSyncBtn() { //given widgetSettings.put(CatalogSelectorController.SETTING_SHOW_CATALOG_VERSION_SYNC_BTN, Boolean.TRUE, Boolean.class); final TreeNode treeNodeCV1 = new DefaultTreeNode(catalogVersion_1_1); final TreeNode treeNodeCatalog = new DefaultTreeNode(catalog_1, Lists.newArrayList(treeNodeCV1)); final DefaultTreeModel model = new DefaultTreeModel(treeNodeCatalog); doNothing().when(controller).selectOnRender(any(), any()); final ComponentModelPopulator catalogTreeModelPopulator = mock(ComponentModelPopulator.class); controller.setCatalogTreeModelPopulator(catalogTreeModelPopulator); when(catalogTreeModelPopulator.createModel(any())).thenReturn(model); //when controller.initialize(new Div()); tree.onInitRender(); final Component btn = tree.query("." + CatalogSelectorController.SCLASS_YW_TREEROW_CATALOG_VERSION_SYNC_BTN); CockpitTestUtil.simulateEvent(btn, new Event(Events.ON_CLICK)); //then assertSocketOutput(OUT_SOCKET_SYNC_CATALOG_VERSION, catalogVersion_1_1); } @Test public void checkSelectionForAllItem() throws Exception { // when controller.renderItem(treeitem_all, null); // then verify(tree).selectItem(treeitem_all); final ArgumentCaptor<Set> selectedModels = ArgumentCaptor.forClass(Set.class); verify(widgetModel).setValue(eq(MODEL_SELECTED_DATA), selectedModels.capture()); assertThat(selectedModels.getValue()).isEmpty(); } @Test public void checkSelectCatalog() { // given when(tree.getSelectedItems()).thenReturn(Collections.set(treeitem_catalogVersion_1_1, treeitem_catalog_1)); when(widgetModel.getValue(MODEL_SELECTED_DATA, Set.class)).thenReturn(Collections.set(catalogVersion_1_1)); // when controller.renderItem(treeitem_catalog_1, catalog_1); // then verify(tree).addItemToSelection(treeitem_catalogVersion_1_1); verify(tree).addItemToSelection(treeitem_catalogVersion_1_2); final ArgumentCaptor<Set> selectedModels = ArgumentCaptor.forClass(Set.class); verify(widgetModel).setValue(eq(MODEL_SELECTED_DATA), selectedModels.capture()); assertThat(selectedModels.getValue()).containsOnly(catalog_1, catalogVersion_1_1, catalogVersion_1_2); } @Test public void checkDeselectCatalog() { // given when(tree.getSelectedItems()).thenReturn(Collections.set(treeitem_catalogVersion_1_1)); when(widgetModel.getValue(MODEL_SELECTED_DATA, Set.class)).thenReturn(Collections.set(catalog_1, catalogVersion_1_1)); // when controller.renderItem(treeitem_catalog_1, catalog_1); // then verify(tree).removeItemFromSelection(treeitem_catalogVersion_1_1); verify(tree).removeItemFromSelection(treeitem_catalogVersion_1_2); final ArgumentCaptor<Set> selectedModels = ArgumentCaptor.forClass(Set.class); verify(widgetModel).setValue(eq(MODEL_SELECTED_DATA), selectedModels.capture()); assertThat(selectedModels.getValue()).isEmpty(); } @Test public void checkSelectCatalogVersion() { // given when(tree.getSelectedItems()).thenReturn(Collections.set(treeitem_catalogVersion_1_1)); when(widgetModel.getValue(MODEL_SELECTED_DATA, Set.class)).thenReturn(Collections.set(catalog_2)); // when controller.renderItem(treeitem_catalogVersion_1_1, catalogVersion_1_1); // then final ArgumentCaptor<Set> selectedModels = ArgumentCaptor.forClass(Set.class); verify(widgetModel).setValue(eq(MODEL_SELECTED_DATA), selectedModels.capture()); assertThat(selectedModels.getValue()).containsOnly(catalog_2, catalogVersion_1_1); } @Test public void checkSelectCatalogVersionWhenAllChildrenSelected() { // given when(tree.getSelectedItems()).thenReturn(Collections.set(treeitem_catalogVersion_1_1, treeitem_catalogVersion_1_2)); when(widgetModel.getValue(MODEL_SELECTED_DATA, Set.class)).thenReturn(Collections.set(catalogVersion_1_1)); // when controller.renderItem(treeitem_catalogVersion_1_2, catalogVersion_1_2); // then verify(tree).addItemToSelection(treeitem_catalog_1); final ArgumentCaptor<Set> selectedModels = ArgumentCaptor.forClass(Set.class); verify(widgetModel).setValue(eq(MODEL_SELECTED_DATA), selectedModels.capture()); assertThat(selectedModels.getValue()).containsOnly(catalogVersion_1_1, catalogVersion_1_2, catalog_1); } @Test public void checkDeselectCatalogVersion() { // given when(tree.getSelectedItems()).thenReturn(Collections.set(treeitem_catalogVersion_1_1)); when(widgetModel.getValue(MODEL_SELECTED_DATA, Set.class)) .thenReturn(Collections.set(catalog_1, catalogVersion_1_1, catalogVersion_1_2)); // when controller.renderItem(treeitem_catalogVersion_1_2, catalogVersion_1_2); // then verify(tree).removeItemFromSelection(treeitem_catalog_1); final ArgumentCaptor<Set> selectedModels = ArgumentCaptor.forClass(Set.class); verify(widgetModel).setValue(eq(MODEL_SELECTED_DATA), selectedModels.capture()); assertThat(selectedModels.getValue()).containsOnly(catalogVersion_1_1); } @Test public void checkDeselectLastCatalogSelectsAllFilter() { // given when(tree.getSelectedItems()).thenReturn(Collections.set()); when(widgetModel.getValue(MODEL_SELECTED_DATA, Set.class)) .thenReturn(Collections.set(catalog_1, catalogVersion_1_1, catalogVersion_1_2)); // when controller.renderItem(treeitem_catalog_1, catalog_1); // then verify(tree).removeItemFromSelection(treeitem_catalogVersion_1_1); verify(tree).removeItemFromSelection(treeitem_catalogVersion_1_2); verify(tree).selectItem(treeitem_all); final ArgumentCaptor<Set> selectedModels = ArgumentCaptor.forClass(Set.class); verify(widgetModel).setValue(eq(MODEL_SELECTED_DATA), selectedModels.capture()); assertThat(selectedModels.getValue()).isEmpty(); } @Test public void checkDeselectLastCatalogVersionSelectsAllFilter() { // given when(tree.getSelectedItems()).thenReturn(Collections.set()); when(widgetModel.getValue(MODEL_SELECTED_DATA, Set.class)).thenReturn(Collections.set(catalogVersion_1_1)); // when controller.renderItem(treeitem_catalogVersion_1_1, catalogVersion_1_1); // then verify(tree).selectItem(treeitem_all); final ArgumentCaptor<Set> selectedModels = ArgumentCaptor.forClass(Set.class); verify(widgetModel).setValue(eq(MODEL_SELECTED_DATA), selectedModels.capture()); assertThat(selectedModels.getValue()).isEmpty(); } @Test public void checkSelectNotSupportedType() { // given when(tree.getSelectedItems()).thenReturn(Collections.set(treeitem_notSupported)); when(widgetModel.getValue(MODEL_SELECTED_DATA, Set.class)).thenReturn(Collections.set(catalog_2)); // when controller.renderItem(treeitem_notSupported, notSupportedData); // then verifyNoInteraction(); } @Test public void checkDeselectNotSupportedType() { // given when(tree.getSelectedItems()).thenReturn(Collections.set()); when(widgetModel.getValue(MODEL_SELECTED_DATA, Set.class)).thenReturn(Collections.set(catalog_2)); // when controller.renderItem(treeitem_notSupported, notSupportedData); // then verifyNoInteraction(); } private void verifyNoInteraction() { verify(tree, never()).addItemToSelection(any(Treeitem.class)); verify(tree, never()).selectItem(any(Treeitem.class)); verify(tree, never()).removeItemFromSelection(any(Treeitem.class)); verify(widgetModel, never()).setValue(any(String.class), any(Object.class)); } @Test public void checkSelectOnRenderForCatalog() { // given final Set<Object> selectedModels = Collections.set(catalog_1); // when controller.selectOnRender(treeitem_catalog_1, selectedModels); // then assertThat(selectedModels).containsOnly(catalog_1); verify(tree).addItemToSelection(treeitem_catalog_1); } @Test public void checkSelectOnRenderForCatalogVersion() { // given final Set<Object> selectedModels = Collections.set(catalog_1); // when controller.selectOnRender(treeitem_catalogVersion_1_2, selectedModels); // then assertThat(selectedModels).containsOnly(catalog_1, catalogVersion_1_2); verify(tree).addItemToSelection(treeitem_catalogVersion_1_2); } }
package com.hunw.java.lesson1.spells; import java.util.Random; import com.hunw.java.lesson1.characters.Character; public class Heal extends Spell { int minHeal = 1; int maxHeal = 5; public Heal() { // TODO Auto-generated constructor stub } public void use(Character target) { Random rand = new Random(); int toHeal = rand.nextInt(maxHeal - minHeal) + minHeal; target.increaseHits(toHeal); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Maryam Athar Khan // Lab 04 // Septemeber 18,2015 // This program is designed to pick a random card from the deck of cards to allow the magician to practice alone. // // define a class public class CardGenerator { // main method required of every Java program public static void main(String[] args) { // random card generator int card=(int)(Math.random()*52)+1; // Declare variables of card suit and card number String suitType=""; String numberType=""; // switch statements to get different cards int temp=(card/13)+1; if (card %13==0){ temp=(card/13); } switch (temp){ case 1: suitType="Diamonds"; break; case 2: suitType="Clubs"; break; case 3: suitType="Hearts"; break; case 4: suitType="Spades"; break; } int temp2=(card%13); if (card%13==0){ temp2=(card/13); } switch (temp2){ case 0: numberType="Kings"; break; case 1: numberType="Ace"; break; case 2: numberType="2"; break; case 3: numberType="3"; break; case 4: numberType="4"; break; case 5: numberType="5"; break; case 6: numberType="6"; break; case 7: numberType="7"; break; case 8: numberType="8"; break; case 9: numberType="9"; break; case 10: numberType="10"; break; case 11: numberType="Jack"; break; case 12: numberType="Queen"; break; } // print System.out.println("You picked " +numberType+ " of " +suitType+"."); }// end of main method }// end of class
execute(des,src,registers,memory) { int desBitSize = 128; int desHexSize = desBitSize / 4; String srcValue; // Check if SOURCE is either XMM or m128 if( src.isRegister() ) { srcValue = registers.get(src); } else if( src.isMemory() ) { srcValue = memory.read(src,desBitSize); } // Check if DESTINATION is either XMM or m128 if( des.isRegister() ) { registers.set(des, srcValue); } else if( des.isMemory() ) { memory.write(des, srcValue, desBitSize); } }
package com.mybatis.service.redbag; import com.mybatis.domain.redbag.RedBagPackModel; import org.springframework.transaction.annotation.Transactional; /** * Created by yunkai on 2017/11/30. */ public interface RedBagPackServiceI { /** * 生成发红包记录 * * @param pack */ public void create(RedBagPackModel pack); }
package edu.wayne.cs.severe.redress2.entity; /** * @author ojcchar * @version 1.0 * @created 28-Mar-2014 17:27:26 */ public class CodeObject { public CodeObject() { } }// end CodeObject
package servlets; import static constants.Constants.USER_UPLOADED_XML; //taken from: http://www.servletworld.com/servlet-tutorials/servlet3/multipartconfig-file-upload-example.html // and http://docs.oracle.com/javaee/6/tutorial/doc/glraq.html import com.google.gson.Gson; import com.magit.logic.exceptions.InvalidNameException; import com.magit.webLogic.users.UserAccount; import com.magit.webLogic.users.UserManager; import utils.ServletUtils; import utils.SessionUtils; import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.nio.charset.Charset; import java.util.Collection; import java.util.Scanner; import java.util.function.Consumer; @WebServlet("/upload") @MultipartConfig(fileSizeThreshold = 1024 * 1024, maxFileSize = 1024 * 1024 * 5, maxRequestSize = 1024 * 1024 * 5 * 5) public class FileUploadServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.sendRedirect("fileupload/form.html"); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); //PrintWriter out = response.getWriter(); Collection<Part> parts = request.getParts(); StringBuilder fileContent = new StringBuilder(); for (Part part : parts) { //to write the content of the file to a string fileContent.append(readFromInputStream(part.getInputStream())); } InputStream inputStream = new ByteArrayInputStream(fileContent.toString().getBytes(Charset.forName("UTF-8"))); // out.close(); String usernameFromSession = SessionUtils.getUsername(request); UserManager userManager = ServletUtils.getUserManager(getServletContext()); UserAccount account = userManager.getUsers().get(usernameFromSession); try { account.addRepository(inputStream, new Consumer<String>() { @Override public void accept(String s) { String exceptionMessage = s; try (PrintWriter out = response.getWriter()) { out.println(exceptionMessage); out.flush(); } catch (IOException e) { e.printStackTrace(); } } }); } catch (InvalidNameException e) { e.printStackTrace(); } //out.println(fileContent.toString()); } private String readFromInputStream(InputStream inputStream) { return new Scanner(inputStream).useDelimiter("\\Z").next(); } }
package ordo; import java.rmi.Remote; import java.rmi.RemoteException; import formats.Format.Type; import hdfs.daemon.FragmentDataI; import map.Mapper; public interface Daemon extends Remote { public void runMap (Mapper mapper, Type inputFormat, CallBack callback, FragmentDataI data) throws RemoteException; }
package org.jboss.perf.test.server.controller; import java.io.Serializable; import java.util.List; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.context.FacesContext; import org.jboss.perf.test.server.dao.ProjectDao; import org.jboss.perf.test.server.dao.TestSuiteRunDao; import org.jboss.perf.test.server.model.Project; import org.jboss.perf.test.server.model.TestSuiteRun; @ManagedBean @ViewScoped public class TestSuiteBean implements Serializable { private static final long serialVersionUID = 1L; @EJB private TestSuiteRunDao testSuiteRunDao; @EJB private ProjectDao projectDao; private long projectId; private Project project; @PostConstruct public void init() { FacesContext fc = FacesContext.getCurrentInstance(); projectId = Long.parseLong(fc.getExternalContext().getRequestParameterMap().get("projectid")); project = projectDao.getProjectById(projectId); } public long getProjectId() { return projectId; } public void setProjectId(long projectId) { this.projectId = projectId; } public Project getProject() { return project; } public List<TestSuiteRun> getTestSuiteRuns() { return testSuiteRunDao.getTestSuiteRunsByProjectIdByStartTimeDesc(projectId); } public void deleteTestSuiteRun(TestSuiteRun testSuiteRun) { testSuiteRunDao.remove(testSuiteRun); FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "TestSuite " + testSuiteRun.getTestSuite().getName() + " with all its data was deleted.", null); FacesContext.getCurrentInstance().addMessage("form:delete", msg); } }
package com.example.demo.controller; import com.example.demo.dto.TestModelDTO; import com.example.demo.service.TestService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; import java.io.IOException; @RestController public class TestController { @Autowired private TestService testService; @GetMapping(path="flux") public Flux<String> flux() { return Flux.just("string1", "string2", "string3"); } @GetMapping(path="mono") public Mono<TestModelDTO> mono() throws IOException { return Mono.fromCallable(() -> TestModelDTO.convert(testService.get())).subscribeOn(Schedulers.elastic()); } @GetMapping(path="/") public Mono<TestModelDTO> get() throws IOException { return testService.getMono(); } }
package classes; import java.sql.ResultSet; import java.sql.SQLException; public class CodePrestation { private String code; private String description; public CodePrestation(ResultSet rs) throws SQLException { code = rs.getString("code"); description = rs.getString("description"); } public String getCode() { return this.code; } public void setCode(String code) { this.code = code; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } }
package de.zarncke.lib.time; import org.joda.time.DateTime; public interface Clock { long getCurrentTimeMillis(); DateTime getCurrentDateTime(); }
package arrayVisitors.driver; import java.util.ArrayList; import arrayVisitors.adt.MyArray; import arrayVisitors.adt.MyArrayI; import arrayVisitors.adt.MyArrayList; import arrayVisitors.adt.MyArrayListI; import arrayVisitors.util.FileDisplayInterface; import arrayVisitors.util.MyLogger; import arrayVisitors.util.Results; import arrayVisitors.util.exception.EmptyFileException; import arrayVisitors.util.exception.SamePathAndNameException; import arrayVisitors.visitors.CommonIntsVisitor; import arrayVisitors.visitors.MissingIntsVisitor; import arrayVisitors.visitors.PathI; import arrayVisitors.visitors.PopulateMyArrayVisitor; import arrayVisitors.visitors.Visitor; public class Driver { private static final int REQUIRED_NUMBER_OF_CMDLINE_ARGS = 5; public static void main(String[] args) throws Exception { /* * As the build.xml specifies the arguments as input,output or metrics, in case * the argument value is not given java takes the default value specified in * build.xml. */ if ((args.length != 5) || (args[0].equals("${input1}")) || (args[1].equals("${input2}")) || (args[2].equals("${commonintsout}")) || (args[3].equals("${missingintsout}")) || (args[4].equals("${debug}"))) { System.err.printf("Error: Incorrect number of arguments. Program accepts %d arguments.", REQUIRED_NUMBER_OF_CMDLINE_ARGS); System.exit(0); } int length = 10; MyLogger ml = MyLogger.getInstance(); ml.setDebugValue(Integer.parseInt(args[4])); ml.writeMessage("Setting debug level " + args[4], MyLogger.DebugLevel.DRIVER); try { if (args[0].equals(args[1])) throw new SamePathAndNameException("Same path or name for input file"); if (args[2].equals(args[3])) throw new SamePathAndNameException("Same path or name for output file"); ml.writeMessage("Adding filepaths to arraylist", MyLogger.DebugLevel.DRIVER); ArrayList<String> filePaths = new ArrayList<String>(); filePaths.add(args[0]); filePaths.add(args[1]); ArrayList<MyArrayI> myArrayObjs = new ArrayList<MyArrayI>(); Visitor populateMyArrayVisiitorObj = new PopulateMyArrayVisitor(); for (String path : filePaths) { ml.writeMessage("Calling set() for populateMyArrayVisitor", MyLogger.DebugLevel.DRIVER); ((PathI) populateMyArrayVisiitorObj).set(path); ml.writeMessage("Adding new MyArray object to arraylist", MyLogger.DebugLevel.DRIVER); myArrayObjs.add(new MyArray(length)); ml.writeMessage("Calling accept", MyLogger.DebugLevel.DRIVER); myArrayObjs.get(myArrayObjs.size() - 1).accept(populateMyArrayVisiitorObj); } MyArrayListI arr_lst = new MyArrayList(myArrayObjs.size()); for (MyArrayI mArray : myArrayObjs) { ml.writeMessage("Calling add() in MyArrayListI", MyLogger.DebugLevel.DRIVER); arr_lst.add(mArray); } Results commonIntsResult = new Results(args[2]); CommonIntsVisitor commonIntsVisitorO = new CommonIntsVisitor(commonIntsResult); ml.writeMessage("Calling accept() in MyArrayListI", MyLogger.DebugLevel.DRIVER); arr_lst.accept(commonIntsVisitorO); FileDisplayInterface commonInts_fdi = commonIntsResult; ml.writeMessage("Calling WriteToFile()", MyLogger.DebugLevel.DRIVER); commonInts_fdi.writeToFile(); Results missingIntsResult = new Results(args[3]); MissingIntsVisitor missingIntsVisitorO = new MissingIntsVisitor(missingIntsResult); for (MyArrayI mArray : myArrayObjs) { ml.writeMessage("Calling accept() for MyArrayI", MyLogger.DebugLevel.DRIVER); mArray.accept(missingIntsVisitorO); } FileDisplayInterface missingInts_fdi = missingIntsResult; ml.writeMessage("Calling writeToFile()", MyLogger.DebugLevel.DRIVER); missingInts_fdi.writeToFile(); } catch (EmptyFileException | SamePathAndNameException e) { System.err.println(e.getMessage()); } } }
/* * [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.sapintegrations.facade; import com.cnk.travelogix.contract.provisioning.data.ContractOperationResponseData; import com.cnk.travelogix.contract.provisioning.data.MaintainChargingContractRequestData; import com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.ChargeableItemChargeRequestData; import com.cnk.travelogix.sapintegrations.chargeable.itemcharging.data.ChargeableItemChargeResponseData; import com.cnk.travelogix.sapintegrations.mappingtable.maintain.data.MaintainMappingTableRequestData; import com.cnk.travelogix.sapintegrations.mappingtable.maintain.data.MappingTableOperationResponseData; import com.cnk.travelogix.sapintegrations.subscribe.account.data.SubscriberAccountCancelRequest; import com.cnk.travelogix.sapintegrations.subscribe.account.data.SubscriberAccountMaintainData; import com.cnk.travelogix.sapintegrations.subscribe.account.data.SubscriberAccountOperationResponseData; /** * */ public interface CCServicesFacade { SubscriberAccountOperationResponseData subscribeAccMaintain(SubscriberAccountMaintainData request); MappingTableOperationResponseData createMappingTableMaintain(final MaintainMappingTableRequestData request); SubscriberAccountOperationResponseData canceSubscriberAccount(SubscriberAccountCancelRequest cancelRequestData); public ContractOperationResponseData contractProvisioning(final MaintainChargingContractRequestData request); public ChargeableItemChargeResponseData itemCharging(ChargeableItemChargeRequestData request); }
package com.wlc.ds.tree; import java.util.Stack; import org.junit.Assert; import org.junit.Test; public class BinaryTreeTest { public BinaryTree create() { TreeNode[] nodes = new TreeNode[9]; for (int i = 0; i < 9; i++) { nodes[i] = new TreeNode(i); } BinaryTree tree = new BinaryTree(); tree.root = nodes[0]; nodes[0].leftChild = nodes[1]; nodes[0].rightChild = nodes[2]; nodes[1].leftChild = nodes[3]; nodes[1].rightChild = nodes[4]; nodes[2].leftChild = nodes[5]; nodes[2].rightChild = nodes[6]; nodes[5].leftChild = nodes[7]; nodes[5].rightChild = nodes[8]; return tree; } public TreeNode creatTree(){ TreeNode root = new TreeNode(10); TreeNode n1 = new TreeNode(15); TreeNode n2 = new TreeNode(12); TreeNode n3 = new TreeNode(4); TreeNode n4 = new TreeNode(7); root.leftChild = n1; root.rightChild = n2; n1.leftChild = n3; n1.rightChild = n4; return root; } BinaryTree tree = create(); @Test public void testSize() { Assert.assertEquals(5, tree.size()); } @Test public void testHeight() { tree.preOrder(); tree.levelOrder(); Assert.assertEquals(3, tree.height()); } @Test public void testGetNodesNum() { Assert.assertEquals(2, tree.getNodesNum(3)); } @Test public void testGetLeafNum() { Assert.assertEquals(3, tree.getLeafNum()); } @Test public void testInOrder() { tree.inOrder(tree.root); } @Test public void testToDeLinkList() { TreeNode first = null, last = null; tree.toDeLinkList(tree.root, first, last); } @Test public void testIsAVL() { Assert.assertTrue(tree.isAVL(tree.root)); } @Test public void testgetSumPath() { Stack<TreeNode> s = new Stack<>(); //tree.getSumPath(tree.root, 0, 5, s); TreeNode root = creatTree(); tree.getSumPath(root, 0, 22, s); } @Test public void testIsCompleteTree(){ Assert.assertEquals(true, tree.isCompleteTree(tree.root)); } @Test public void testCreateMinBST(){ int[] arr = {1,2,3,4,5,6,7,8,9}; TreeNode root = BinaryTree.createMinBST(arr); tree.inOrder(root); } @Test public void testGetTreeWidth(){ System.out.println(BinaryTree.getTreeWidth(tree.root)); } }