text
stringlengths
10
2.72M
package com.zmyaro.ltd; public class Ferrari extends ExplosiveEnemy { public Ferrari() { mMaxHealth = mHealth = 50; mSpeed = 4; mDamage = 3; mValue = 5; mWidth = mExplosionWidth = 70; mHeight = mExplosionHeight = 85; mHitboxX = 24; mHitboxY = 8; mHitboxWidth = 18; mHitboxHeight = 50; mBitmapName = "enemy_ferrari"; mLoopLength = 7; mTotalFrames = 23; mWavePadding = 80; } }
package DummyCore.Utils; import DummyCore.Core.Core; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; public class ColoredLightHandler extends Entity{ public ColoredLightHandler(World par1World) { super(par1World); setSize(0.4F,0.4F); this.noClip = true; this.ignoreFrustumCheck = true; } public ColoredLightHandler(World par1World, int par2) { this(par1World); } public ColoredLightHandler(World par1World, int par2, float par3) { this(par1World); } @Override protected void entityInit() { this.dataWatcher.addObject(12, 0); this.dataWatcher.addObject(13, 0.0F); } @Override protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { setColor(nbttagcompound.getInteger("color")); setColorSize(nbttagcompound.getFloat("colorSize")); } @Override protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setInteger("color", getRenderColor()); nbttagcompound.setFloat("colorSize", getRenderColorSize()); } private void setColor(int i) { if(!this.worldObj.isRemote) { this.dataWatcher.updateObject(12, i); } } private void setColorSize(float i) { if(!this.worldObj.isRemote) { this.dataWatcher.updateObject(13, i); } } public int getRenderColor() { return this.dataWatcher.getWatchableObjectInt(12); } public float getRenderColorSize() { return this.dataWatcher.getWatchableObjectFloat(13); } @Override public void moveEntity(double par1, double par3, double par5){} @SuppressWarnings("deprecation") @Override public void onUpdate() { this.posY = (int)this.posY; Block b = MiscUtils.getBlock(worldObj, (int)posX, (int)posY-1, (int)posZ); Block b1 = MiscUtils.getBlock(worldObj, (int)posX, (int)posY, (int)posZ); if((b == null && b1 == null) || (!Core.lightBlocks.contains(b) && !Core.lightBlocks.contains(b1))) { this.setDead(); } super.onUpdate(); } }
/** * WebSocket services, using Spring Websocket. */ package workstarter.web.websocket;
package com.ebupt.portal.canyon.system.entity; import com.ebupt.portal.canyon.common.util.TimeUtil; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; /** * 角色信息实体类 * * @author chy * @date 2019-03-08 14:23 */ @Entity @Table(name = "eb_role") @Setter @Getter @NoArgsConstructor public class Role { @Id @JsonIgnore @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; /** * 角色ID */ @Column(length = 50, nullable = false, unique = true) private String roleId; /** * 角色名称 */ @Column(length = 50, nullable = false) private String roleName; /** * 创建时间 */ @Column(length = 14, nullable = false) private String createTime; public Role(String roleId, String roleName) { this.roleId = roleId; this.roleName = roleName; this.createTime = TimeUtil.getCurrentTime14(); } }
package com.mybatis.controller; import com.mybatis.domain.redbag.RedBagPackDetailModel; import com.mybatis.domain.redbag.RedBagPackModel; import com.mybatis.service.redbag.RedBagPackDetailServiceI; import com.mybatis.service.redbag.RedBagPackServiceI; import com.mybatis.util.RandomCreateRedUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Random; /** * 红包相关 * * Created by yunkai on 2017/11/30. */ @RestController @RequestMapping("/redbag") public class RedBagController { private static Logger logger = LoggerFactory.getLogger(RedBagController.class); @Autowired private RedBagPackServiceI redBagPackService; @Autowired private RedBagPackDetailServiceI redBagPackDetailService; /** * 设置红包 * * @param money 红包总金额 * @param num 红包数 * @return */ @GetMapping(value = "/set") public String setRedBag(Double money, Integer num){ RedBagPackModel pack = new RedBagPackModel(); pack.setMoney(money); pack.setNum(num); pack.setUserId(1); redBagPackService.create(pack); return "set red bag ... "; } /** * 领红包 * * @param packId 红包Id * @return */ @GetMapping(value = "/pick/bag") public String pickBag(Integer packId){ Integer userId = new Random().nextInt(100); logger.info("userId = {}", userId); redBagPackDetailService.getBag(packId, userId); return "pick bag ... "; } }
package com.xaut.dao; public interface ProximityDao { public boolean Sample(String szImei, double x); }
package com.nmoumoulidis.opensensor.controller; import com.nmoumoulidis.opensensor.R; import com.nmoumoulidis.opensensor.restInterface.SensorStationRestRequestTask; import com.nmoumoulidis.opensensor.restInterface.requests.SensorStationSetLocationRequest; import com.nmoumoulidis.opensensor.view.AdminActivity; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.EditorInfo; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; /** * Button as well as textfield (EditText) listener for the * Admin activity {@link AdminActivity}. * @author Nikos Moumoulidis * */ public class AdminUIController implements OnClickListener, OnEditorActionListener { private AdminActivity mAdminActivity; public AdminUIController(AdminActivity adminActivity) { this.mAdminActivity = adminActivity; } @Override public void onClick(View v) { if(v == mAdminActivity.getmSignInButton()) { mAdminActivity.attemptLogin(); } else if(v == mAdminActivity.getmSetLocationButton()) { mAdminActivity.findLocation(); if(mAdminActivity.isLocationFound() == true && mAdminActivity.isLocationSet() == false) { // Fire up the REST request SensorStationSetLocationRequest request = new SensorStationSetLocationRequest(mAdminActivity.getLocation()); new SensorStationRestRequestTask(mAdminActivity).execute(request); } } else if(v == mAdminActivity.getmSignOutButton()) { mAdminActivity.hideLoginScreen(false); } } @Override public boolean onEditorAction(TextView v, int id, KeyEvent event) { if (id == R.id.login || id == EditorInfo.IME_NULL) { mAdminActivity.attemptLogin(); return true; } return false; } }
import java.util.*; public class CellPhoneService { public static void main(String [] args) { System.out.println("Enter maximum monthly call minutes>>> "); Scanner minsInput = new Scanner(System.in); int minsMax = minsInput.nextInt(); System.out.println("Enter maximum monthly text messages>>> "); Scanner textInput = new Scanner(System.in); int textMax = textInput.nextInt(); System.out.println("Enter maximum monthly data used>>> "); Scanner dataInput = new Scanner(System.in); int dataMax = dataInput.nextInt(); int minutes = getMaxMinutes(minsMax); int texts = getMaxText(textMax); int data = getMaxData(dataMax); String[] dataPlan; dataPlan = getDataPlan(minutes, texts, data); int planCost = Integer.parseInt(dataPlan[1]); System.out.println("Recommended data plan: " + dataPlan[0] + "\nPrice: $" + dataPlan[1]); } public static int getMaxMinutes(int minutes) { int minsIndicator = 0; if (minutes < 500){ minsIndicator = 0; }else if (minutes >= 500){ minsIndicator = 1; } return minsIndicator; } public static int getMaxText(int texts) { int textIndicator = 0; if (texts == 0){ textIndicator = 0; }else if (texts > 0){ textIndicator = 1; }else if (texts >= 100){ textIndicator = 2; } return textIndicator; } public static int getMaxData(int data) { int dataIndicator = 0; if (data == 0){ dataIndicator = 0; }else if (data > 0 && data < 2){ dataIndicator = 1; }else if (data > 2){ dataIndicator = 2; } return dataIndicator; } public static String[] getDataPlan(int minutes, int texts, int data) { String plan = null; String cost = null; if ((minutes == 0) && (texts == 0) && (data == 0)){ plan = "A"; cost = "49"; }else if ((minutes == 0) && (texts == 1) && (data == 0)){ plan = "B"; cost = "55"; }else if ((minutes == 1) && (texts == 1) && (data == 0)){ plan = "C"; cost = "61"; }else if ((minutes == 1) && (texts == 2) && (data == 0)){ plan = "D"; cost = "70"; }else if ((data == 1)){ plan = "E"; cost = "79"; }else if ((data == 2)){ plan = "F"; cost = "87"; } return new String[] {plan, cost}; } }
package com.example.server.controller; import com.example.server.entity.User; import com.example.server.payload.ApiResponse; import com.example.server.payload.SignIn; import com.example.server.payload.SignUp; import com.example.server.secret.CurrentUser; import com.example.server.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.UUID; @RestController @RequestMapping("/api/user") public class UserController { @Autowired UserService userService; @PostMapping("/register") public HttpEntity<ApiResponse> userAdd(@RequestBody SignUp userDto) { ApiResponse apiResponse = userService.register(userDto); return ResponseEntity.status(apiResponse.isSuccess() ? apiResponse.getMessage().equals("Saved") ? 201 : 202 : 409).body(apiResponse); } @PostMapping("/login") public HttpEntity<?> login(@RequestBody SignIn signIn) { return ResponseEntity.ok(userService.login(signIn)); } @PostMapping("/edit/{id}") public HttpEntity<ApiResponse> edit(@CurrentUser User user, @RequestBody SignUp userDto) { ApiResponse apiResponse = userService.edit(user,userDto); return ResponseEntity.status(apiResponse.isSuccess() ? apiResponse.getMessage().equals("Edit") ? 201 : 202 : 409).body(apiResponse); } @DeleteMapping("/delete/{id}") public HttpEntity<?> delete(@PathVariable UUID id){ ApiResponse apiResponse=userService.delete(id); return ResponseEntity.status(apiResponse.isSuccess() ? apiResponse.getMessage().equals("Delete") ? 201 : 202 : 409).body(apiResponse); } @GetMapping("/me") public HttpEntity<?> me(@CurrentUser User user){ return ResponseEntity.status(user!=null?200:409).body(user); } }
package lemmingsModele; import java.awt.Color; /** La classe Builder implante la comp�tence executer() propre � un * Builder. * @author Quentin Glinel-Mortreuil */ public class Builder implements Competence { /** Le Builder construit un escalier destructible de 12 marches dans la diagonale vers laquelle il marche. */ public void executer( Position positionInitiale, Map map, Lemming lemming) { // a ecrire } }
package com.g7s.ics.testcase.ListManagement; import com.g7s.ics.api.ListManagementApi; import com.g7s.ics.utils.FakerUtils; import io.qameta.allure.Description; import io.qameta.allure.Epic; import io.qameta.allure.Feature; import io.restassured.response.Response; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvFileSource; import org.slf4j.Logger; import java.util.HashMap; import java.util.ResourceBundle; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; /** * @Author: zhangwenping * @Description: * @Date: Create in 14:25 2020-07-28 * * */ @Epic("名单管理-测试用例") @Feature("客户名单管理") public class CustomerListTest { private static final Logger log = org.slf4j.LoggerFactory.getLogger(com.g7s.ics.testcase.ListManagement.CustomerListTest.class); ResourceBundle bundle =ResourceBundle.getBundle("Interface/ListInterface"); String createCustomerPaht = bundle.getString("createCustomerPaht"); String updateCustomerPaht = bundle.getString("updateCustomerPaht"); String detailCustomerPaht = bundle.getString("detailCustomerPaht"); String pagingCustomerPaht = bundle.getString("pagingCustomerPaht"); String name ="名称"+ FakerUtils.getTimeStamp(); @AfterAll public static void cleanForSQL(){ String sqlVehicle ="DELETE FROM ics_blacklist_vehicle WHERE create_username='zwp别名'"; String sqlCustomer ="DELETE FROM ics_blacklist_customer WHERE create_username='zwp别名'"; log.info("清理数据开始"); FakerUtils.cleanMysqlData(sqlVehicle); FakerUtils.cleanMysqlData(sqlCustomer); log.info("清理数据结束"); } //创建车辆名单 //@Test @Description("调用接口:/v1/blacklist/customer/create, 各创建一次创建客户名单: 1 正常,2灰 ,3黑 -- 相当于备注") @DisplayName("各创建一次创建客户名单: 1 正常,2灰 ,3黑") @CsvFileSource(resources = "/data/VechicleTypeId/Type.csv",numLinesToSkip = 2) @ParameterizedTest() public void createCustomerList(int typeList, String remarke){ HashMap<String,Object> data = new HashMap<String, Object>(); data.put("createUserId",123); data.put("createUsername","zwp别名"); data.put("name",name); //0 全部,1 正常 2 灰 3 黑 data.put("type",typeList); data.put("role",1);//1是投保人 Response createResponse = ListManagementApi.createCustomer(data,createCustomerPaht); assertEquals(name,createResponse.path("data.name")); } //同时修改状态 @Test @Description("调用接口:/v1/blacklist/customer/update,修改客户名单类型,从灰到黑") @DisplayName("修改客户名单类型,从灰到黑,断言是否是修改后的数据") public void updateCustomerList(){ HashMap<String,Object> data = new HashMap<String, Object>(); data.put("createUserId",123); data.put("createUsername","zwp别名"); data.put("name",name); //0 全部,1 正常 2 灰 3 黑 data.put("type",2); data.put("role",1);//1是投保人 Response createResponse = ListManagementApi.createCustomer(data,createCustomerPaht); String blacklistId = createResponse.then().extract().path("data.blacklistId"); HashMap<String,Object> updateData = new HashMap<String, Object>(); updateData.put("blacklistId",blacklistId); updateData.put("updateUserId",123); updateData.put("updateUsername","zwp别名"); updateData.put("name",name); //0 全部,1 正常 2 灰 3 黑 updateData.put("type",3); updateData.put("role",1);//1是投保人 Response updateResponse = ListManagementApi.updateCustomer(updateData,updateCustomerPaht); assertAll( ()->assertEquals(updateData.get("name"),updateResponse.path("data.name")), ()->assertEquals(updateData.get("type"),updateResponse.path("data.type")) ); } //单个数据查询 @Test @Description("调用接口:/v1/blacklist/customer/detail,新增一个客户并查询出详细信息") @DisplayName("新增一个客户并查询出详细信息") public void detailCustomer(){ HashMap<String,Object> data = new HashMap<String, Object>(); data.put("createUserId",123); data.put("createUsername","zwp别名"); data.put("name",name); //0 全部,1 正常 2 灰 3 黑 data.put("type",2); data.put("role",1);//1是投保人 Response createResponse = ListManagementApi.createCustomer(data,createCustomerPaht); String blacklistId = createResponse.then().extract().path("data.blacklistId"); HashMap<String,Object> detailData = new HashMap<String, Object>(); detailData.put("blacklistId",blacklistId); Response detailResponse = ListManagementApi.detailCustomer(detailData,detailCustomerPaht); assertEquals(detailData.get("blacklistId"),detailResponse.path("data.blacklistId")); } // 列表页面数据查询 //@Test @Description("调用接口:/v1/blacklist/customer/paging,分别查询各种类型") @DisplayName("查询第1页到数据,和指定到给灰名单,并断言当前页数和列表数据到状态是灰名单") @CsvFileSource(resources = "/data/VechicleTypeId/Type.csv",numLinesToSkip = 2) @ParameterizedTest() public void pagingCustomer(int typeList,String remarke){ HashMap<String,Object> pageDate = new HashMap<String, Object>(); pageDate.put("current",1); pageDate.put("pageSize",10); //pageDate.put("plateNo",""); //0 全部,1 正常 2 灰 3 黑 pageDate.put("type",typeList); //pageDate.put("vin",vin); Response pagingResponse = ListManagementApi.pagingCustomer(pageDate,pagingCustomerPaht); assertAll( ()->assertEquals(pageDate.get("type"),pagingResponse.path("data.records.type[0]")), ()->assertEquals(pageDate.get("current"),pagingResponse.path("data.current")), ()->assertEquals(pageDate.get("pageSize"),pagingResponse.path("data.size")) ); } @Test @Description("调用接口:/v1/blacklist/customer/paging,查询所有的客户数据") @DisplayName("验证所有数据的查询,每页20条数据") public void pagingAllCustomer(){ HashMap<String,Object> pageDate = new HashMap<String, Object>(); pageDate.put("current",1); pageDate.put("pageSize",20); //0 全部,1 正常 2 灰 3 黑 pageDate.put("type",0); Response pagingResponse = ListManagementApi.pagingCustomer(pageDate,pagingCustomerPaht); assertAll( //()->assertEquals(pageDate.get("type"),pagingResponse.path("data.records.type[0]")), ()->assertEquals(pageDate.get("current"),pagingResponse.path("data.current")), ()->assertEquals(pageDate.get("pageSize"),pagingResponse.path("data.size")) ); } }
package br.com.rd.rdevs.funcionarios.model; public abstract class Secretaria extends Funcionario{ public Secretaria(String nome, String cpf, double salario) { super(nome, cpf, salario); } public Secretaria(String nome, String cpf, double salario, String login, int senha) { super(nome, cpf, salario, login, senha); } }
public class Order { private Household household; private Milk milk; private int month; public Order(Household household, Milk milk, int month) { this.household = household; this.milk = milk; this.month = month; } public Household getHousehold() { return household; } public void setHousehold(Household household) { this.household = household; } public Milk getMilk() { return milk; } public void setMilk(Milk milk) { this.milk = milk; } public int getMonth() { return month; } public void setMonth(int month) { this.month = month; } }
package com.recko.assignment.recko; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ReckoApplication { public static void main(String[] args) { SpringApplication.run(ReckoApplication.class, args); } }
package com.gikk.util; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; /** * This class handles scheduling of tasks that should be executed one or more * times sometime in the future.<br><br> * * This class uses a ScheduledThreadPoolExecutor to execute the different tasks. * That has the consequence that a thread might be running for a while after the * program tells the Scheduler to terminate. <b>This is normal and may take up * to 60 seconds.</b> * After 60 seconds the Scheduler force-terminates all remaining tasks.<br><br> * * Schedulers are created via the {@link SchedulerBuilder#build()} method. * * @author Gikkman * */ public class Scheduler { //*********************************************************************************************** // VARIABLES //*********************************************************************************************** private final Thread shutdownThread; private final ScheduledThreadPoolExecutor executor; private boolean disposed = false; //*********************************************************************************************** // CONSTRUCTOR //*********************************************************************************************** Scheduler(SchedulerBuilder builder) { shutdownThread = createShutdownThread(); ThreadFactory threadFactory = new GikkThreadFactory.Builder() .setThreadsPrefix(builder.threadsPrefix) .setThreadsDaemon(builder.daemonThreads) .build(); executor = new ScheduledThreadPoolExecutor(builder.capacity, threadFactory); } //*********************************************************************************************** // PUBLIC //*********************************************************************************************** /** * Gets the {@link ScheduledThreadPoolExecutor}'s thread pool size. See * {@link ScheduledThreadPoolExecutor#getPoolSize()} * * @return The ScheduledThreadPoolExecutor's thread pool size */ public long getCapacity() { return executor.getCorePoolSize(); } /** * Gets the approximate number of scheduled tasks. The number is * approximate, since the number might change during computation.<br> * The number is computed by fetching the queue from * {@link ScheduledThreadPoolExecutor} and retrieving its size * * @return The approximate number of scheduled tasks. */ public long getScheduledQueueSize() { return executor.getQueue().size(); } /** * Gets the approximate number of completed tasks. The number is * approximate, since the number might change during computation.<br> * See {@link ScheduledThreadPoolExecutor#getCompletedTaskCount()} * * @return The approximate number of completed tasks */ public long getCompletedTaskCount() { return executor.getCompletedTaskCount(); } /** * Check the status of the Scheduler. If it has been disposed, no more * {@code Tasks} will be executed. To dispose of the Scheduler, call * {@link #terminate()} * * @return {@code True} if the Scheduler has been disposed (or is in the * process of disposing). */ public boolean isDisposed() { return disposed; } /** * Returns the approximate number of threads that are actively executing * tasks. * * @return The approximate number of tasks executing at the moment */ public long getActiveCount() { return executor.getActiveCount(); } /** * Schedules a Task to be executed once every {@code periodMillis}. The * Task's {@code onUpdate()} will be called the first time after * initDelayMillis. If any execution of the task encounters an exception, * subsequent executions are suppressed. Otherwise, the task will only * terminate via cancellation or termination of the executor. <br> * If any execution of this task takes longer than its period, then * subsequent executions may start late, but will not concurrently execute * * @param initDelayMillis How many milliseconds we wait until we start * trying to execute this task * @param periodMillis How many milliseconds we wait until we start trying * to execute this task from the previous time it executed * @param task The task to the executed repeatedly * @return A {@code ScheduledFuture}, which may be used to interact with the * scheduled task (say for canceling or interruption) */ public ScheduledFuture<?> scheduleRepeatedTask(int initDelayMillis, int periodMillis, Runnable task) { return executor.scheduleAtFixedRate(task, initDelayMillis, periodMillis, TimeUnit.MILLISECONDS); } /** * Postpones a OneTimeTask for delayMillis. After the assigned delay, the * task will be performed as soon as possible. The task might have to wait * for longer, if no threads are availible after the stated delay.<br> * The task will be executed only once, and then removed from the scheduler. * Results from the task may be recovered from the {@code ScheduledFuture} * object after completion. * * @param delayMillis How many milliseconds we wait until we start trying to * execute this task * @param task The task to be executed * @return A {@code ScheduledFuture}, which may be used to interact with the * scheduled task (say for canceling or interruption) */ public ScheduledFuture<?> scheduleDelayedTask(int delayMillis, Runnable task) { return executor.schedule(task, delayMillis, TimeUnit.MILLISECONDS); } /** * Tells the scheduler to perform a certain task as soon as possible. This * might be immediately (if there are threads availible) or sometime in the * future. There are no guarantees for when the task will be performed, just * as soon as possible. * * @param task The task that should be performed * @return A {@code ScheduledFuture}, which may be used to interact with the * scheduled task (say for canceling or interruption) */ public ScheduledFuture<?> executeTask(Runnable task) { return executor.schedule(task, 0, TimeUnit.MILLISECONDS); } //*********************************************************************************************** // TERMINATION //*********************************************************************************************** /** * This method will create a new thread, that will try to shut down * execution of all tasks.<br><br> * * First, the Thread will initiates an orderly shutdown in which previously * submitted tasks are executed, but no new tasks will be accepted. * Submitted in this case means that the task has begun execution. The * thread will then allow up to 60 seconds for Tasks to complete.<br> * After waiting for 60 seconds, the Thread will attempt to stop all * actively executing tasks and halt the process of waiting tasks.<br><br> * * The created thread is not a daemon thread, so if it is not possible to * halt execution of all tasks, the new thread might never finish. Thus, it * is important that created tasks can be halted. * */ public void terminate() { synchronized (this) { if (disposed == true) { return; } disposed = true; } shutdownThread.start(); } //*********************************************************************************************** // PRIVATE //*********************************************************************************************** private Thread createShutdownThread() { Thread thread = new Thread(new Runnable() { @Override public void run() { try { System.out.println(); System.out.println("\tThere are currently " + executor.getQueue().size() + " task scheduled.\n" + "\tThere are currently " + executor.getActiveCount() + " tasks executing.\n" + "\tAttempting shutdown. Please allow up to a minute..."); executor.shutdown(); if (executor.awaitTermination(60, TimeUnit.SECONDS)) { System.out.println("\tShutdown completed"); return; } System.out.println("\tThere are still " + executor.getActiveCount() + " tasks executing.\n" + "\tForcing shutdown..."); executor.shutdownNow(); System.out.println("\tForce shutdown successful"); } catch (Exception e) { e.printStackTrace(); } } }); thread.setDaemon(false); return thread; } }
package com.crivano.swaggerservlet.dependency; import java.util.concurrent.Callable; import com.crivano.swaggerservlet.test.TestResult; public abstract class TestableDependency extends DependencySupport implements Callable<TestResult> { public TestableDependency() { super(); } public TestableDependency(String category, String service, boolean partial, long msMin, long msMax) { super(category, service, partial, msMin, msMax); } public abstract boolean test() throws Exception; @Override public TestResult call() throws Exception { long time = System.currentTimeMillis(); TestResult tr = new TestResult(); try { tr.ok = test(); } catch (Exception ex) { tr.exception = ex; } tr.miliseconds = System.currentTimeMillis() - time; return tr; } @Override public boolean isTestable() { return true; } }
package network.codex.codexjavarpcprovider.implementations; import com.google.gson.Gson; import org.jetbrains.annotations.NotNull; import java.util.Locale; import okhttp3.OkHttpClient; import okhttp3.RequestBody; import okhttp3.ResponseBody; import okhttp3.logging.HttpLoggingInterceptor; import okhttp3.logging.HttpLoggingInterceptor.Level; import network.codex.codexjava.error.rpcProvider.GetBlockRpcError; import network.codex.codexjava.error.rpcProvider.GetInfoRpcError; import network.codex.codexjava.error.rpcProvider.GetRawAbiRpcError; import network.codex.codexjava.error.rpcProvider.GetRequiredKeysRpcError; import network.codex.codexjava.error.rpcProvider.PushTransactionRpcError; import network.codex.codexjava.error.rpcProvider.RpcProviderError; import network.codex.codexjava.interfaces.IRPCProvider; import network.codex.codexjava.models.rpcProvider.request.GetBlockRequest; import network.codex.codexjava.models.rpcProvider.request.GetRawAbiRequest; import network.codex.codexjava.models.rpcProvider.request.GetRequiredKeysRequest; import network.codex.codexjava.models.rpcProvider.request.PushTransactionRequest; import network.codex.codexjava.models.rpcProvider.response.GetBlockResponse; import network.codex.codexjava.models.rpcProvider.response.GetInfoResponse; import network.codex.codexjava.models.rpcProvider.response.GetRawAbiResponse; import network.codex.codexjava.models.rpcProvider.response.GetRequiredKeysResponse; import network.codex.codexjava.models.rpcProvider.response.PushTransactionResponse; import network.codex.codexjava.models.rpcProvider.response.RPCResponseError; import network.codex.codexjavarpcprovider.BuildConfig; import network.codex.codexjavarpcprovider.error.CodexJavaRpcErrorConstants; import network.codex.codexjavarpcprovider.error.CodexJavaRpcProviderCallError; import network.codex.codexjavarpcprovider.error.CodexJavaRpcProviderInitializerError; import retrofit2.Call; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; /** * Simple implementation of an RPC provider for communicating with the blockchain. * The calls are implemented synchronously. It is assumed that the developer will * wrap them in asynchronous semantics such as AsyncTask in normal use... */ public class CodexJavaRpcProviderImpl implements IRPCProvider { @NotNull private String baseURL; @NotNull private Retrofit retrofit; @NotNull private ICodexJavaRpcProviderApi rpcProviderApi; /** * Construct a new RPC provider instance given the base URL to use for building requests. * @param baseURL Base URL to use for building requests. * @throws CodexJavaRpcProviderInitializerError thrown if the base URL passed in is null. */ public CodexJavaRpcProviderImpl(@NotNull String baseURL) throws CodexJavaRpcProviderInitializerError { this(baseURL, false); } /** * Construct a new RPC provider instance given the base URL to use for building requests. * @param baseURL Base URL to use for building requests. * @param enableDebug Enable Network Log at {@link Level#BODY} level * @throws CodexJavaRpcProviderInitializerError thrown if the base URL passed in is null. */ public CodexJavaRpcProviderImpl(@NotNull String baseURL, boolean enableDebug) throws CodexJavaRpcProviderInitializerError { if(baseURL == null || baseURL.isEmpty()) { throw new CodexJavaRpcProviderInitializerError(CodexJavaRpcErrorConstants.RPC_PROVIDER_BASE_URL_EMPTY); } this.baseURL = baseURL; OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); if (enableDebug) { HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(); httpLoggingInterceptor.setLevel(Level.BODY); httpClient.addInterceptor(httpLoggingInterceptor); } this.retrofit = new Retrofit.Builder() .baseUrl(this.baseURL) .addConverterFactory(GsonConverterFactory.create()) .client(httpClient.build()) .build(); this.rpcProviderApi = this.retrofit.create(ICodexJavaRpcProviderApi.class); } /** * Process a retrofit call, setting arguments, checking responses and decoding responses and errors * as necessary. * @param call Retrofit call to execute. * @param <O> Response type to use for decoding. * @return Response type given in signature. * @throws Exception Can throw CodexJavaRpcProviderCallError for RPC provider specific * processing errors or Java IO or network errors from Retrofit. */ @NotNull private <O> O processCall(Call<O> call) throws Exception { Response<O> response = call.execute(); if (!response.isSuccessful()) { String additionalErrInfo = CodexJavaRpcErrorConstants.RPC_PROVIDER_NO_FURTHER_ERROR_INFO; RPCResponseError rpcResponseError = null; if (response.errorBody() != null) { Gson gson = new Gson(); rpcResponseError = gson.fromJson(response.errorBody().charStream(), RPCResponseError.class); if (rpcResponseError == null) { additionalErrInfo = response.errorBody().string(); } else { additionalErrInfo = CodexJavaRpcErrorConstants.RPC_PROVIDER_SEE_FURTHER_ERROR_INFO; } } String msg = String.format(Locale.getDefault(), CodexJavaRpcErrorConstants.RPC_PROVIDER_BAD_STATUS_CODE_RETURNED, response.code(), response.message(), additionalErrInfo); throw new CodexJavaRpcProviderCallError(msg, rpcResponseError); } if (response.body() == null) { throw new CodexJavaRpcProviderCallError(CodexJavaRpcErrorConstants.RPC_PROVIDER_EMPTY_RESPONSE_RETURNED); } return response.body(); } /** * Issue a getInfo() call to the blockchain and process the response. * @return GetInfoResponse on successful return. * @throws GetInfoRpcError Thrown if any errors occur calling or processing the request. */ @Override public @NotNull GetInfoResponse getInfo() throws GetInfoRpcError { try { Call<GetInfoResponse> syncCall = this.rpcProviderApi.getInfo(); return processCall(syncCall); } catch (Exception ex) { throw new GetInfoRpcError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GETTING_CHAIN_INFO, ex); } } /** * Issue a getBlock() call to the blockchain and process the response. * @param getBlockRequest Info about a specific block. * @return GetBlockRsponse on successful return. * @throws GetBlockRpcError Thrown if any errors occur calling or processing the request. */ @Override public @NotNull GetBlockResponse getBlock(GetBlockRequest getBlockRequest) throws GetBlockRpcError { try { Call<GetBlockResponse> syncCall = this.rpcProviderApi.getBlock(getBlockRequest); return processCall(syncCall); } catch (Exception ex) { throw new GetBlockRpcError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GETTING_BLOCK_INFO, ex); } } /** * Issue a getRawAbi() request to the blockchain and process the response. * @param getRawAbiRequest Info about a specific smart contract. * @return GetRawAbiResponse on successful return. * @throws GetRawAbiRpcError Thrown if any errors occur calling or processing the request. */ @Override public @NotNull GetRawAbiResponse getRawAbi(GetRawAbiRequest getRawAbiRequest) throws GetRawAbiRpcError { try { Call<GetRawAbiResponse> syncCall = this.rpcProviderApi.getRawAbi(getRawAbiRequest); return processCall(syncCall); } catch (Exception ex) { throw new GetRawAbiRpcError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GETTING_RAW_ABI, ex); } } /** * Issue a getRequiredKeys() request to the blockchain and process the response. * @param getRequiredKeysRequest Info to get required keys * @return GetRequiredKeysResponse on successful return. * @throws GetRequiredKeysRpcError Thrown if any errors occur calling or processing the request. */ @Override public @NotNull GetRequiredKeysResponse getRequiredKeys( GetRequiredKeysRequest getRequiredKeysRequest) throws GetRequiredKeysRpcError { try { Call<GetRequiredKeysResponse> syncCall = this.rpcProviderApi.getRequiredKeys(getRequiredKeysRequest); return processCall(syncCall); } catch (Exception ex) { throw new GetRequiredKeysRpcError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GETTING_REQUIRED_KEYS, ex); } } /** * Push a given transaction to the blockchain and process the response. * @param pushTransactionRequest the transaction to push with signatures. * @return PushTransactionResponse on successful return. * @throws PushTransactionRpcError Thrown if any errors occur calling or processing the request. */ @Override public @NotNull PushTransactionResponse pushTransaction( PushTransactionRequest pushTransactionRequest) throws PushTransactionRpcError { try { Call<PushTransactionResponse> syncCall = this.rpcProviderApi.pushTransaction(pushTransactionRequest); return processCall(syncCall); } catch (Exception ex) { throw new PushTransactionRpcError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_PUSHING_TRANSACTION, ex); } } /** * Issue a get_account call to the blockchain and process the response. * @param requestBody request body of get_account API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getAccount(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getAccount(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_ACCOUNT, ex); } } /** * Issue a pushTransactions() call to the blockchain and process the response. * @param requestBody request body of push_transactions API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String pushTransactions(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.pushTransactions(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_PUSHING_TRANSACTIONS, ex); } } /** * Issue a getBlockHeaderState() call to the blockchain and process the response. * @param requestBody request body of get_block_header_state API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getBlockHeaderState(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getBlockHeaderState(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_BLOCK_HEADER_STATE, ex); } } /** * Issue a getAbi() call to the blockchain and process the response. * @param requestBody request body of get_abi API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getAbi(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getAbi(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_ABI, ex); } } /** * Issue a getCurrencyBalance call to the blockchain and process the response. * @param requestBody request body of get_currency_balance API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getCurrencyBalance(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getCurrencyBalance(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_CURRENT_BALANCE, ex); } } /** * Issue a getCurrencyStats() call to the blockchain and process the response. * @param requestBody request body of get_currency_stats API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getCurrencyStats(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getCurrencyStats(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_CURRENT_STATS, ex); } } /** * Issue a getProducers() call to the blockchain and process the response. * @param requestBody request body of get_producers API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getProducers(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getProducers(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_PRODUCERS, ex); } } /** * Issue a getRawCodeAndAbi() call to the blockchain and process the response. * @param requestBody request body of get_raw_code_and_abi API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getRawCodeAndAbi(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getRawCodeAndAbi(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_RAW_CODE_AND_ABI, ex); } } /** * Issue a getTableByScope() call to the blockchain and process the response. * @param requestBody request body of get_table_by_scope API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getTableByScope(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getTableByScope(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_TABLE_BY_SCOPE, ex); } } /** * Issue a getTableRows() call to the blockchain and process the response. * @param requestBody request body of get_table_rows API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getTableRows(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getTableRows(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_TABLE_ROWS, ex); } } /** * Issue a getCode() call to the blockchain and process the response. * @param requestBody request body of get_code API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getCode(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getCode(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_CODE, ex); } } /** * Issue a getActions() call to the blockchain and process the response. * @param requestBody request body of get_actions API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getActions(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getActions(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_ACTION, ex); } } /** * Issue a getTransaction() call to the blockchain and process the response. * @param requestBody request body of get_transaction API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getTransaction(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getTransaction(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_TRANSACTION, ex); } } /** * Issue a getKeyAccounts() call to the blockchain and process the response. * @param requestBody request body of get_key_accounts API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getKeyAccounts(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getKeyAccounts(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_KEY_ACCOUNTS, ex); } } /** * Issue a getControlledAccounts() call to the blockchain and process the response. * @param requestBody request body of get_controlled_accounts API * @return String content of ResponseBody on successful return. * @throws RpcProviderError Thrown if any errors occur calling or processing the request. */ public @NotNull String getControlledAccounts(RequestBody requestBody) throws RpcProviderError { try { Call<ResponseBody> syncCall = this.rpcProviderApi.getControlledAccounts(requestBody); try(ResponseBody responseBody = processCall(syncCall)) { return responseBody.string(); } } catch (Exception ex) { throw new RpcProviderError(CodexJavaRpcErrorConstants.RPC_PROVIDER_ERROR_GET_CONTROLLED_ACCOUNTS, ex); } } }
package com.demo.modules.sys.dao; import com.demo.modules.sys.entity.SysOrgEntity; import org.apache.ibatis.annotations.Mapper; /** * 组织架构 * * @author Centling Techonlogies * @email xxx@demo.com * @url www.demo.com * @date 2017年8月17日 上午11:26:05 */ @Mapper public interface SysOrgMapper extends BaseMapper<SysOrgEntity> { int countOrgChildren(Long parentId); }
package com.example.paula.recipeasy; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.os.Bundle; import android.support.v4.view.MenuItemCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.ShareActionProvider; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; import android.widget.Toast; import com.example.paula.recipeasy.database.LoginLab; import com.example.paula.recipeasy.database.RecipeIngredientLab; import com.example.paula.recipeasy.database.RecipeLab; import com.example.paula.recipeasy.database.RecipeUserLab; import com.example.paula.recipeasy.models.Login; import com.example.paula.recipeasy.models.Recipe; import com.example.paula.recipeasy.models.RecipeIngredient; import java.util.List; import java.util.UUID; public class RecipeDetail extends AppCompatActivity { private static final String EXTRA_RECIPE_ID = "recipe_id"; private static final String EXTRA_LOGIN_ID = "login_id"; private Recipe mRecipe; private Login mLogin; private UUID loginId; private ShareActionProvider mShareActionProvider; public static Intent newIntent(Context packageContext, UUID recipeId, UUID loginId){ Intent intent = new Intent(packageContext, RecipeDetail.class); intent.putExtra(EXTRA_RECIPE_ID, recipeId); intent.putExtra(EXTRA_LOGIN_ID, loginId); return intent; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_recipe); UUID recipeId = (UUID) getIntent().getSerializableExtra(EXTRA_RECIPE_ID); loginId = (UUID) getIntent().getSerializableExtra(EXTRA_LOGIN_ID); if(recipeId != null) { mRecipe = RecipeLab.get(getApplicationContext()).getRecipe(recipeId); } if(loginId != null) { mLogin = LoginLab.get(getApplicationContext()).getLogin(loginId); } if(mRecipe != null) { TextView mRecipeName = findViewById(R.id.recipe_title); TextView mDuration = findViewById(R.id.duration); TextView mPortions = findViewById(R.id.portion); ImageView mRecipeImg = findViewById(R.id.recipe_img); TableLayout mTableIngredients = findViewById(R.id.details_table_ingredients_name); TextView mInstructions = findViewById(R.id.instructions); LinearLayout mReviewStars = findViewById(R.id.review_stars); mRecipeName.setText(mRecipe.getName()); mDuration.setText(mRecipe.getDuration() + " min"); mPortions.setText(mRecipe.getPortions() + " prt"); byte[] foodImg = mRecipe.getPhoto(); Bitmap bitmap = BitmapFactory.decodeByteArray(foodImg, 0, foodImg.length); mRecipeImg.setImageBitmap(ImageAndSizeUtils.resize(bitmap, getResources())); List<RecipeIngredient> recipeIngr = RecipeLab.get(getApplicationContext()).getIngredientsQttMeasure(mRecipe.getId()); for (int index = 0; index < recipeIngr.size(); index++) { TableRow row = new TableRow(getApplicationContext()); row.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); TextView text = new TextView(getApplicationContext()); text.setText(recipeIngr.get(index).getName()); text.setLayoutParams(new TableRow.LayoutParams(ImageAndSizeUtils.getWidth(150, getResources()), TableRow.LayoutParams.WRAP_CONTENT)); text.setTextColor(Color.DKGRAY); TextView qtt = new TextView(getApplicationContext()); qtt.setText(recipeIngr.get(index).getQtt() + " " + recipeIngr.get(index).getMeasure()); qtt.setLayoutParams(new TableRow.LayoutParams(ImageAndSizeUtils.getWidth(70, getResources()), TableRow.LayoutParams.WRAP_CONTENT)); qtt.setTextColor(Color.DKGRAY); row.addView(text); row.addView(qtt); mTableIngredients.addView(row); } mInstructions.setText(mRecipe.getInstruction()); } } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.fragment_recipe, menu); // Share button MenuItem item = menu.findItem(R.id.menu_item_share); mShareActionProvider = (ShareActionProvider)MenuItemCompat.getActionProvider(item); //create the sharing intent Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = "here goes your share content body"; sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Share Subject"); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); //then set the sharingIntent mShareActionProvider.setShareIntent(sharingIntent); return true; } @Override public boolean onPrepareOptionsMenu(Menu menu) { boolean hasRecipe = RecipeUserLab.get(getApplicationContext()).getUserRecipe(mRecipe.getId(), mLogin.getId()); MenuItem menuItem; if(hasRecipe) { menuItem = menu.findItem(R.id.save_recipe); menuItem.setVisible(false); }else{ menuItem = menu.findItem(R.id.remove_recipe); menuItem.setVisible(false); } return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case R.id.delete_recipe: RecipeLab.get(getApplicationContext()).deleteRecipe(mRecipe.getId()); RecipeIngredientLab.get(getApplicationContext()).deleteRecipeIngre(mRecipe.getId()); Toast.makeText(getApplicationContext(), "Recipe deleted!", Toast.LENGTH_SHORT).show(); Intent intent = RecipePagerActivity.newIntent(getApplicationContext(), loginId); startActivity(intent); return true; case R.id.search_recipe: Intent searchIntent = SearchRecipeActivity.newIntent(getApplicationContext(), loginId); startActivity(searchIntent); return true; case R.id.save_recipe: RecipeUserLab.get(getApplicationContext()).addRecipe(mRecipe.getId(), mLogin.getId()); Toast.makeText(getApplicationContext(), "Recipe saved!", Toast.LENGTH_SHORT).show(); return true; case R.id.remove_recipe: RecipeUserLab.get(getApplicationContext()).removeRecipe(mRecipe.getId(), mLogin.getId()); Toast.makeText(getApplicationContext(), "Recipe removed!", Toast.LENGTH_SHORT).show(); return true; case R.id.home: Intent homeIntent = RecipePagerActivity.newIntent(getApplicationContext(), loginId); startActivity(homeIntent); return true; default: return super.onOptionsItemSelected(item); } } }
package com.snab.tachkit.allForm; import com.snab.tachkit.ClassesJson.JsonResponse; import com.snab.tachkit.ClassesJson.OptionsFieldFromServer; import com.snab.tachkit.ClassesJson.TiresModel; import com.snab.tachkit.additional.GetFromSeverData; import com.snab.tachkit.additional.ParamOfField; import com.snab.tachkit.databaseRealm.InitRealm; import com.snab.tachkit.globalOptions.ItemPages; import com.snab.tachkit.globalOptions.SharedPreferencesCustom; import android.view.View; import android.view.ViewGroup; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.snab.tachkit.R; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import com.snab.tachkit.globalOptions.fieldOptions; import com.snab.tachkit.globalOptions.Global; import com.snab.tachkit.actionBar.ActivityWithActionBarBack; /** * Created by Ringo on 28.01.2015. * Родительский фрагмент для всех форм, где есть поля ввода */ public abstract class FormFragment extends ParentFormFragment{ public int typeAdvertThis; public OptionsFieldFromServer optionsFieldFromServer; // Сменяет категорию. Категория передается как параметр name private void changeCategory(String name) { Global.setWentTo((new ArrayList(Arrays.asList(getActivity().getResources().getStringArray(R.array.type_car)))).indexOf(name) + 1); SharedPreferencesCustom.setSearchStr(getActivity(), Global.generationStrSearch(getActivity())); initTask(); ((ActivityWithActionBarBack) getActivity()).restoreActionBar(); } private boolean isMarkField(ParamOfField paramOfField) { String fieldName = paramOfField.name; return fieldName.equals("marka") || fieldName.equals("car_firm") || fieldName.equals("firm"); } private boolean hasModelField() { int nextFieldIndex = selectedField + 1; String nextFieldName = fields.get(nextFieldIndex).name; return nextFieldName.equals("model") || nextFieldName.equals("car_model"); } // Возвращает id для загрузки моделей private int getModelTypeOffer(ParamOfField modelField) { int selectedMenuIndex = fields.get(0).result.get(0).id; // id выбранной категории int carsMenuIndex = fields.get(0).variable.get(0).id; // id легковых авто int type; if(typeAdvertThis == ItemPages.SPARES_PAGE) { type = carsMenuIndex; } else { boolean disksOrTires = typeAdvertThis > ItemPages.SPARES_PAGE; boolean hasCarPrefix = modelField.name.equals("car_model"); boolean carModelInDisksOrTires = disksOrTires && hasCarPrefix; // Если поле является маркой АВТО в ДИСКАХ или ШИНАХ if(carModelInDisksOrTires) { type = carsMenuIndex; } else { if(disksOrTires) { type = SharedPreferencesCustom.getTiresOrDisks(getActivity()); } else { type = selectedMenuIndex; } } } return type; } /** * @param paramOfField - информация о строке формы * @param value - то, что выбрали в диалоговом окне. Это нужно запихать в форму и обработать. */ public void setDataDifferent(ParamOfField paramOfField, ParamOfField.VariableStructure value){ // Вызов коллбэка на изменение значения ParamOfField.OnValueChangeListener onValueChangeListener = paramOfField.getOnValueChangeListener(); if(onValueChangeListener != null) { onValueChangeListener.onValueChange(paramOfField.result.get(0)); } if (selectedField == 0) { // если меняется категория в самой форме changeCategory(value.name); } else { // если выбрали марку, и следующее поле является моделью, нужно их загрузить if(isMarkField(paramOfField) && hasModelField()) { ParamOfField modelField = fields.get(selectedField + 1); modelField.setResult(null); modelField.variable.clear(); int result = paramOfField.result.get(0).id; GetFromSeverData.setModel(getModelTypeOffer(modelField), result, getActivity(), modelField.variable); // Очистка поля с модификацией ParamOfField modificationField = fields.get(selectedField + 3); if (modificationField.name.equals("modif")) { modificationField.setResult(null); modificationField.variable.clear(); } } if(paramOfField.name.equals("marka") && fields.get(selectedField + 2).name.equals("modif")){ fields.get(selectedField + 2).setResult(null); fields.get(selectedField + 2).variable.clear(); } if(paramOfField.name.equals("modif")){ new loadModificationParams(typeAdvertThis, paramOfField.result.get(0).id, fields).execute(); } if(paramOfField.name.equals("model") && typeAdvertThis == ItemPages.TIRES_PAGE && SharedPreferencesCustom.getTiresOrDisks(getActivity()) == Global.idTires){ loadModelOptionsForTires(fields.get(selectedField - 1).result.get(0).id, value.id); } if(paramOfField.name.equals("tires_or_disks")) { changeCategory(fields.get(0).result.get(0).name); } } } /** * установка заголовков полей * @param atr */ public void setTitleFields(ArrayList<ParamOfField> atr){ for(int i = 0; i < atr.size(); i++){ String name = atr.get(i).name; if(optionsFieldFromServer.statusField(name)){ atr.get(i).setTitle(optionsFieldFromServer.getTitle(name)); } } } public void setPhotoSelectedField() { this.selectedField = fields.size() - 2; } /** * забивает результат в поле * @param fields - список полей * @param i - номер поля * @param data */ public void setResult(ArrayList<ParamOfField> fields, int i, HashMap<String, String> data) { ParamOfField paramOfField = fields.get(i); String name = paramOfField.name; String value = data.get(name); if(value == null) { return; } switch(paramOfField.type) { case fieldOptions.TWO_INPUT_INLINE: paramOfField.setResult(new ArrayList(Arrays.asList( new ParamOfField.VariableStructure[]{new ParamOfField.VariableStructure(0, data.get("show_street")), new ParamOfField.VariableStructure(0, data.get("show_house"))}) )); break; case fieldOptions.INPUT_TEXT: String s = value; if (name.equals("phone1") && s.startsWith("+7")){ s = s.substring(2, s.length()); } paramOfField.setResult(new ArrayList(Arrays.asList(new ParamOfField.VariableStructure(0, s)))); /** * если год выбран и есть модиффикации, то загружаем список */ int index = indexField("modif", fields); if(index > -1) { ParamOfField modifField = fields.get(index); if (name.equals("year") && modifOptions(fields)) { modifField.variable.clear(); GetFromSeverData.setModificationSync( typeAdvertThis, fields.get(indexField("model", fields)).result.get(0).id, s, getActivity(), modifField.variable ); } } break; case fieldOptions.SPARE_LOCATION_RADIOGROUP: String[] sides = value.split(","); paramOfField.result = new ArrayList<>(); for(int j = 0; j < sides.length; j++){ ParamOfField.VariableStructure result = new ParamOfField.VariableStructure(0, sides[j]); paramOfField.result.add(result); } break; default: if(value.equals("run") || value.equals("new")){ if(value.equals("run")) { paramOfField.setResult(new ArrayList(Arrays.asList(paramOfField.variable.get(0)))); }else{ paramOfField.setResult(new ArrayList(Arrays.asList(paramOfField.variable.get(1)))); } }else { Integer id = Integer.valueOf(value); if (name.equals("city")) { GetFromSeverData.getRegion(id, getActivity(), paramOfField); } else { for (int j = 0; j < paramOfField.variable.size(); j++) { ParamOfField.VariableStructure variable = paramOfField.variable.get(j); if (variable.id == id) { paramOfField.setResult(new ArrayList(Arrays.asList(new ParamOfField.VariableStructure(id, variable.name)))); ParamOfField markaField = fields.get(i + 1); if (name.equals("marka") || name.equals("car_firm") || name.equals("firm")) { markaField.variable.clear(); int idMenu; if(fields.get(0).result.get(0).id > ItemPages.SPARES_PAGE) { idMenu = SharedPreferencesCustom.getTiresOrDisks(getActivity()) == Global.idTires ? Global.idTires : Global.idDisks; }else{ idMenu = fields.get(0).result.get(0).id; } GetFromSeverData.setModelSync( idMenu, paramOfField.result.get(0).id, getActivity(), markaField.variable ); } break; } } } } break; } } @Override public void requestBefore(ParentFormFragment.initForm task) { task.url = Global.getHttp() + "api/offer/field?app_key=" + Global.appKey + "&ad_type=" + fields.get(0).result.get(0).id; task.requestDo(); } @Override public void doInBackground(ParentFormFragment.initForm task) { task.initRequest(); } @Override public void initJson(ParentFormFragment.initForm task, String str) { task.writeDataBase(str); optionsFieldFromServer = new Gson().fromJson(str, OptionsFieldFromServer.class); } @Override public void onPostExecute() { if(fields.get(fields.size()-1).type != fieldOptions.BTN_SBM){ initBtnBlock(); } } /** * очиска всех полей формы (пока необъодимо только для поиска) */ public void sendToServerClear(){} /** * загрузка параметров для выбранной модиффикации */ public class loadModificationParams extends GetFromSeverData.loadWithProgressDialog { private JsonResponse<ArrayList<HashMap<String, String>>> modificationFromServer; ArrayList<ParamOfField> _fields; public loadModificationParams(int typeAdvert, int modifId, ArrayList<ParamOfField> _fields){ super(getActivity()); this._fields = _fields; url = Global.getHttp() + "api/get/modif_" + Global.getAlias(typeAdvert, getActivity()) + "?app_key=" + Global.appKey + "&id=" + modifId + "&full=1"; } @Override protected String doInBackground(Void... params) { request(); return null; } @Override public void initJson(String str) { writeDataBase(str); modificationFromServer = new Gson().fromJson(str, new TypeToken<JsonResponse<ArrayList<HashMap<String, String>>>>() {}.getType()); } public void postExecuteDo(){ HashMap<String, String> modif = modificationFromServer.getData().get(0); for(int i = 0; i < _fields.size(); i++){ if(modif.get(_fields.get(i).name) != null){ setResult(_fields, i, modif); } } formItemAdapter.notifyDataSetChanged(); } } public void initBtnBlock(){ ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) containerForm .getLayoutParams(); marginLayoutParams.setMargins(0, 0, 0, (int)(58 * getResources().getDisplayMetrics().density)); view.findViewById(R.id.btn_right_submit).setBackgroundResource(Global.getMenuOptionsColorButton(getActivity(), 1)); view.findViewById(R.id.btn_block).setVisibility(View.VISIBLE); view.findViewById(R.id.btn_left_event).setOnClickListener(this); view.findViewById(R.id.btn_right_submit).setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.btn_right_submit: if(formItemAdapter.mandatoryCheck()) { sendToServer(); } break; case R.id.btn_left_event: clearField(); sendToServerClear(); break; } } /** * очищаем все заполненные поля */ public void clearField(){ for(int i = 2 ; i < fields.size(); i++){ fields.get(i).setResult(null); } formItemAdapter.notifyDataSetChanged(); } public void loadModification(){ ParamOfField modifField = fields.get(4); if(modifOptions(fields)) { modifField.setResult(null); modifField.variable.clear(); GetFromSeverData.setModification( typeAdvertThis, fields.get(indexField("model", fields)).result.get(0).id, fields.get(indexField("year", fields)).result.get(0).name, getActivity(), modifField.variable ); formItemAdapter.notifyDataSetChanged(); } } public Boolean modifOptions(ArrayList<ParamOfField> fields){ if(indexField("modif", fields) > -1) { if (fields.get(indexField("marka", fields)).result != null && fields.get(indexField("model", fields)).result != null && fields.get(indexField("year", fields)).result != null) { return true; } else { return false; } }else{ return false; } } public void loadModelOptionsForTires(int idMarka, int idModel){ TiresModel tiresModel = InitRealm.getModelOptions(getActivity(), idMarka, idModel); for(int i = 0; i < fields.size(); i++) { ParamOfField paramOfField = fields.get(i); if(paramOfField.name != null) { if (paramOfField.name.equals("diameter")) { if (!tiresModel.getDiameter().contains(" ")) { paramOfField.setResult(new ArrayList(Arrays.asList(new ParamOfField.VariableStructure(0, tiresModel.getDiameter())))); } } if (paramOfField.name.equals("section_width")) { if (!tiresModel.getWidth().contains(" ")) { paramOfField.setResult(new ArrayList(Arrays.asList(new ParamOfField.VariableStructure(0, tiresModel.getWidth())))); } } if (paramOfField.name.equals("section_height")) { if (!tiresModel.getHeight().contains(" ")) { paramOfField.setResult(new ArrayList(Arrays.asList(new ParamOfField.VariableStructure(0, tiresModel.getHeight())))); } } if (paramOfField.name.equals("season")) { if (tiresModel.getSeason() != null) { for (int j = 0; j < paramOfField.variable.size(); j++) { ParamOfField.VariableStructure variableStructure = paramOfField.variable.get(j); if (tiresModel.getSeason().equals(variableStructure.enumId)) { paramOfField.setResult(new ArrayList(Arrays.asList(variableStructure))); break; } } } } } } formItemAdapter.notifyDataSetChanged(); } }
package com.hb.rssai.presenter; import com.hb.rssai.constants.Constant; import com.hb.rssai.view.iView.IMessageView; import java.util.HashMap; import java.util.Map; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; /** * Created by Administrator on 2017/8/18. */ public class MessagePresenter extends BasePresenter<IMessageView> { private IMessageView iMessageView; public MessagePresenter(IMessageView iMessageView) { this.iMessageView = iMessageView; } public void getList() { messageApi.list(getParams()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(resMessageList -> iMessageView.setListResult(resMessageList), iMessageView::loadError); } public Map<String, String> getParams() { Map<String, String> map = new HashMap<>(); String userId = iMessageView.getUserId(); int pagNum = iMessageView.getPageNum(); String jsonParams = "{\"userId\":\"" + userId + "\",\"page\":\"" + pagNum + "\",\"size\":\"" + Constant.PAGE_SIZE + "\"}"; map.put(Constant.KEY_JSON_PARAMS, jsonParams); System.out.println(map); return map; } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.javanile.me.chess.engines; import java.util.Vector; /** * * @author cicciodarkast */ public class Moves { private Vector moves; public Moves() { moves = new Vector(); } public void add(char p,Square from, Square to) { moves.addElement(new Move(p, from, to)); } public void add(Move m) { moves.addElement(m); } public Move at(int index) { return (Move)moves.elementAt(index); } public int size() { return moves.size(); } public void move(Move move) { moves.addElement(move); } public Move last() { return (Move)moves.lastElement(); } public void undo() { moves.removeElementAt(moves.size()-1); } public String toString() { String output = ""; for(int i=0;i<moves.size();i++) { output+=((Move)moves.elementAt(i)).toString()+" "; } return output; } }
package com.cnk.travelogix.custom.zif.erp.ws.opportunity; import java.math.BigDecimal; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar; /** * <p>Java class for ZifTerpOppHeader complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ZifTerpOppHeader"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="Uniqid" type="{urn:sap-com:document:sap:rfc:functions}char20"/> * &lt;element name="CrmtMode" type="{urn:sap-com:document:sap:rfc:functions}char1"/> * &lt;element name="CrmOppId" type="{urn:sap-com:document:sap:rfc:functions}char10"/> * &lt;element name="TerpOppId" type="{urn:sap-com:document:sap:rfc:functions}char10"/> * &lt;element name="Trntyp" type="{urn:sap-com:document:sap:rfc:functions}char4"/> * &lt;element name="SalesOrg" type="{urn:sap-com:document:sap:rfc:functions}char14"/> * &lt;element name="DistChannel" type="{urn:sap-com:document:sap:rfc:functions}char2"/> * &lt;element name="Division" type="{urn:sap-com:document:sap:rfc:functions}char2"/> * &lt;element name="SalesOff" type="{urn:sap-com:document:sap:rfc:functions}char4"/> * &lt;element name="SalesGrp" type="{urn:sap-com:document:sap:rfc:functions}char3"/> * &lt;element name="CurrPhase" type="{urn:sap-com:document:sap:rfc:functions}char3"/> * &lt;element name="Status" type="{urn:sap-com:document:sap:rfc:functions}char5"/> * &lt;element name="Type" type="{urn:sap-com:document:sap:rfc:functions}char4"/> * &lt;element name="Source" type="{urn:sap-com:document:sap:rfc:functions}char3"/> * &lt;element name="Importance" type="{urn:sap-com:document:sap:rfc:functions}char1"/> * &lt;element name="PhaseSince" type="{urn:sap-com:document:sap:rfc:functions}date10"/> * &lt;element name="StatusSince" type="{urn:sap-com:document:sap:rfc:functions}date10"/> * &lt;element name="ExpRevenue" type="{urn:sap-com:document:sap:rfc:functions}curr15.2"/> * &lt;element name="ObjectId3" type="{urn:sap-com:document:sap:rfc:functions}char132"/> * &lt;element name="Startdate" type="{urn:sap-com:document:sap:rfc:functions}date10"/> * &lt;element name="ExpectEnd" type="{urn:sap-com:document:sap:rfc:functions}date10"/> * &lt;element name="QuoteUrl" type="{urn:sap-com:document:sap:rfc:functions}string"/> * &lt;element name="PreferredModeCommunication" type="{urn:sap-com:document:sap:rfc:functions}char15"/> * &lt;element name="PreferredTime" type="{urn:sap-com:document:sap:rfc:functions}char15"/> * &lt;element name="ContactDate" type="{urn:sap-com:document:sap:rfc:functions}date10"/> * &lt;element name="ContactTime" type="{urn:sap-com:document:sap:rfc:functions}time"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ZifTerpOppHeader", propOrder = { "uniqid", "crmtMode", "crmOppId", "terpOppId", "trntyp", "salesOrg", "distChannel", "division", "salesOff", "salesGrp", "currPhase", "status", "type", "source", "importance", "phaseSince", "statusSince", "expRevenue", "objectId3", "startdate", "expectEnd", "quoteUrl", "preferredModeCommunication", "preferredTime", "contactDate", "contactTime" }) public class ZifTerpOppHeader { @XmlElement(name = "Uniqid", required = true) protected String uniqid; @XmlElement(name = "CrmtMode", required = true) protected String crmtMode; @XmlElement(name = "CrmOppId", required = true) protected String crmOppId; @XmlElement(name = "TerpOppId", required = true) protected String terpOppId; @XmlElement(name = "Trntyp", required = true) protected String trntyp; @XmlElement(name = "SalesOrg", required = true) protected String salesOrg; @XmlElement(name = "DistChannel", required = true) protected String distChannel; @XmlElement(name = "Division", required = true) protected String division; @XmlElement(name = "SalesOff", required = true) protected String salesOff; @XmlElement(name = "SalesGrp", required = true) protected String salesGrp; @XmlElement(name = "CurrPhase", required = true) protected String currPhase; @XmlElement(name = "Status", required = true) protected String status; @XmlElement(name = "Type", required = true) protected String type; @XmlElement(name = "Source", required = true) protected String source; @XmlElement(name = "Importance", required = true) protected String importance; @XmlElement(name = "PhaseSince", required = true) protected String phaseSince; @XmlElement(name = "StatusSince", required = true) protected String statusSince; @XmlElement(name = "ExpRevenue", required = true) protected BigDecimal expRevenue; @XmlElement(name = "ObjectId3", required = true) protected String objectId3; @XmlElement(name = "Startdate", required = true) protected String startdate; @XmlElement(name = "ExpectEnd", required = true) protected String expectEnd; @XmlElement(name = "QuoteUrl", required = true) protected String quoteUrl; @XmlElement(name = "PreferredModeCommunication", required = true) protected String preferredModeCommunication; @XmlElement(name = "PreferredTime", required = true) protected String preferredTime; @XmlElement(name = "ContactDate", required = true) protected String contactDate; @XmlElement(name = "ContactTime", required = true) @XmlSchemaType(name = "time") protected XMLGregorianCalendar contactTime; /** * Gets the value of the uniqid property. * * @return * possible object is * {@link String } * */ public String getUniqid() { return uniqid; } /** * Sets the value of the uniqid property. * * @param value * allowed object is * {@link String } * */ public void setUniqid(String value) { this.uniqid = value; } /** * Gets the value of the crmtMode property. * * @return * possible object is * {@link String } * */ public String getCrmtMode() { return crmtMode; } /** * Sets the value of the crmtMode property. * * @param value * allowed object is * {@link String } * */ public void setCrmtMode(String value) { this.crmtMode = value; } /** * Gets the value of the crmOppId property. * * @return * possible object is * {@link String } * */ public String getCrmOppId() { return crmOppId; } /** * Sets the value of the crmOppId property. * * @param value * allowed object is * {@link String } * */ public void setCrmOppId(String value) { this.crmOppId = value; } /** * Gets the value of the terpOppId property. * * @return * possible object is * {@link String } * */ public String getTerpOppId() { return terpOppId; } /** * Sets the value of the terpOppId property. * * @param value * allowed object is * {@link String } * */ public void setTerpOppId(String value) { this.terpOppId = value; } /** * Gets the value of the trntyp property. * * @return * possible object is * {@link String } * */ public String getTrntyp() { return trntyp; } /** * Sets the value of the trntyp property. * * @param value * allowed object is * {@link String } * */ public void setTrntyp(String value) { this.trntyp = value; } /** * Gets the value of the salesOrg property. * * @return * possible object is * {@link String } * */ public String getSalesOrg() { return salesOrg; } /** * Sets the value of the salesOrg property. * * @param value * allowed object is * {@link String } * */ public void setSalesOrg(String value) { this.salesOrg = value; } /** * Gets the value of the distChannel property. * * @return * possible object is * {@link String } * */ public String getDistChannel() { return distChannel; } /** * Sets the value of the distChannel property. * * @param value * allowed object is * {@link String } * */ public void setDistChannel(String value) { this.distChannel = value; } /** * Gets the value of the division property. * * @return * possible object is * {@link String } * */ public String getDivision() { return division; } /** * Sets the value of the division property. * * @param value * allowed object is * {@link String } * */ public void setDivision(String value) { this.division = value; } /** * Gets the value of the salesOff property. * * @return * possible object is * {@link String } * */ public String getSalesOff() { return salesOff; } /** * Sets the value of the salesOff property. * * @param value * allowed object is * {@link String } * */ public void setSalesOff(String value) { this.salesOff = value; } /** * Gets the value of the salesGrp property. * * @return * possible object is * {@link String } * */ public String getSalesGrp() { return salesGrp; } /** * Sets the value of the salesGrp property. * * @param value * allowed object is * {@link String } * */ public void setSalesGrp(String value) { this.salesGrp = value; } /** * Gets the value of the currPhase property. * * @return * possible object is * {@link String } * */ public String getCurrPhase() { return currPhase; } /** * Sets the value of the currPhase property. * * @param value * allowed object is * {@link String } * */ public void setCurrPhase(String value) { this.currPhase = value; } /** * Gets the value of the status property. * * @return * possible object is * {@link String } * */ public String getStatus() { return status; } /** * Sets the value of the status property. * * @param value * allowed object is * {@link String } * */ public void setStatus(String value) { this.status = value; } /** * Gets the value of the type property. * * @return * possible object is * {@link String } * */ public String getType() { return type; } /** * Sets the value of the type property. * * @param value * allowed object is * {@link String } * */ public void setType(String value) { this.type = value; } /** * Gets the value of the source property. * * @return * possible object is * {@link String } * */ public String getSource() { return source; } /** * Sets the value of the source property. * * @param value * allowed object is * {@link String } * */ public void setSource(String value) { this.source = value; } /** * Gets the value of the importance property. * * @return * possible object is * {@link String } * */ public String getImportance() { return importance; } /** * Sets the value of the importance property. * * @param value * allowed object is * {@link String } * */ public void setImportance(String value) { this.importance = value; } /** * Gets the value of the phaseSince property. * * @return * possible object is * {@link String } * */ public String getPhaseSince() { return phaseSince; } /** * Sets the value of the phaseSince property. * * @param value * allowed object is * {@link String } * */ public void setPhaseSince(String value) { this.phaseSince = value; } /** * Gets the value of the statusSince property. * * @return * possible object is * {@link String } * */ public String getStatusSince() { return statusSince; } /** * Sets the value of the statusSince property. * * @param value * allowed object is * {@link String } * */ public void setStatusSince(String value) { this.statusSince = value; } /** * Gets the value of the expRevenue property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getExpRevenue() { return expRevenue; } /** * Sets the value of the expRevenue property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setExpRevenue(BigDecimal value) { this.expRevenue = value; } /** * Gets the value of the objectId3 property. * * @return * possible object is * {@link String } * */ public String getObjectId3() { return objectId3; } /** * Sets the value of the objectId3 property. * * @param value * allowed object is * {@link String } * */ public void setObjectId3(String value) { this.objectId3 = value; } /** * Gets the value of the startdate property. * * @return * possible object is * {@link String } * */ public String getStartdate() { return startdate; } /** * Sets the value of the startdate property. * * @param value * allowed object is * {@link String } * */ public void setStartdate(String value) { this.startdate = value; } /** * Gets the value of the expectEnd property. * * @return * possible object is * {@link String } * */ public String getExpectEnd() { return expectEnd; } /** * Sets the value of the expectEnd property. * * @param value * allowed object is * {@link String } * */ public void setExpectEnd(String value) { this.expectEnd = value; } /** * Gets the value of the quoteUrl property. * * @return * possible object is * {@link String } * */ public String getQuoteUrl() { return quoteUrl; } /** * Sets the value of the quoteUrl property. * * @param value * allowed object is * {@link String } * */ public void setQuoteUrl(String value) { this.quoteUrl = value; } /** * Gets the value of the preferredModeCommunication property. * * @return * possible object is * {@link String } * */ public String getPreferredModeCommunication() { return preferredModeCommunication; } /** * Sets the value of the preferredModeCommunication property. * * @param value * allowed object is * {@link String } * */ public void setPreferredModeCommunication(String value) { this.preferredModeCommunication = value; } /** * Gets the value of the preferredTime property. * * @return * possible object is * {@link String } * */ public String getPreferredTime() { return preferredTime; } /** * Sets the value of the preferredTime property. * * @param value * allowed object is * {@link String } * */ public void setPreferredTime(String value) { this.preferredTime = value; } /** * Gets the value of the contactDate property. * * @return * possible object is * {@link String } * */ public String getContactDate() { return contactDate; } /** * Sets the value of the contactDate property. * * @param value * allowed object is * {@link String } * */ public void setContactDate(String value) { this.contactDate = value; } /** * Gets the value of the contactTime property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getContactTime() { return contactTime; } /** * Sets the value of the contactTime property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setContactTime(XMLGregorianCalendar value) { this.contactTime = value; } }
package stepdefinitions; import static org.assertj.core.api.Assertions.assertThat; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import pages.HomePage; import runner.FeatureFileRunner; public class HomeScreenSteps { private HomePage homePage = new HomePage(FeatureFileRunner.getDriver()); @Given("the application is launched") public void the_application_is_launched() { homePage.acceptCookies(); assertThat(homePage.isHomeScreenlaunched()).isTrue(); } @Then("the title of the page is") public void the_title_of_the_page_is() { String actual = homePage.getTitle(); String expected = "Home | The National Lottery"; assertThat(actual).isEqualTo(expected); } @Then("the Open Account option is present") public void the_Open_Account_option_is_present() { assertThat(homePage.isHomeScreenlaunched()).isTrue(); } @When("the User navigate to Open Account screen") public void the_User_navigate_to_SignIn_screen() { homePage.navigateToSignUpPage(); } }
package com.javasongkb.changgou.model; import java.io.Serializable; import java.util.Date; public class OrderLog implements Serializable { private String id; private String operater; private Date operateTime; private Long orderId; private String orderStatus; private String payStatus; private String consignStatus; private String remarks; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getOperater() { return operater; } public void setOperater(String operater) { this.operater = operater; } public Date getOperateTime() { return operateTime; } public void setOperateTime(Date operateTime) { this.operateTime = operateTime; } public Long getOrderId() { return orderId; } public void setOrderId(Long orderId) { this.orderId = orderId; } public String getOrderStatus() { return orderStatus; } public void setOrderStatus(String orderStatus) { this.orderStatus = orderStatus; } public String getPayStatus() { return payStatus; } public void setPayStatus(String payStatus) { this.payStatus = payStatus; } public String getConsignStatus() { return consignStatus; } public void setConsignStatus(String consignStatus) { this.consignStatus = consignStatus; } public String getRemarks() { return remarks; } public void setRemarks(String remarks) { this.remarks = remarks; } }
package com.yougou.dto.output; import java.util.Collections; import java.util.List; public class ReturnQualityQueryOutputDto extends PageableOutputDto { private static final long serialVersionUID = 4093477387725751250L; /** 页数据 **/ private List<ReturnQA> items = Collections.emptyList(); public ReturnQualityQueryOutputDto() { super(); } public ReturnQualityQueryOutputDto(int page_index, int page_size, int total_count) { super(page_index, page_size, total_count); } public void setItems(List<ReturnQA> items) { this.items = items; } @Override public List<ReturnQA> getItems() { return this.items; } }
package com.selenium.PageobjectModel; import java.util.concurrent.TimeUnit; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; public class PageLoad { WebDriver driver; @BeforeGroups public void setUp() { System.setProperty("webdriver.gecko.driver", "E:\\jar-libraries\\geckodriver-v0.19.0-win64\\geckodriver.exe"); driver = new FirefoxDriver(); driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.manage().window().maximize(); driver.manage().deleteAllCookies(); } @AfterSuite public void rearDown() { //driver.quit(); } @Test public void waitForPageLoaded() { driver.get("https://www.amazon.in/"); /*ExpectedCondition<Boolean> expectation = new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver driver) { return ((JavascriptExecutor) driver) .executeScript("return document.readyState").toString() .equals("complete"); } }; try { Thread.sleep(1000); WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(expectation); } catch (Throwable error) { Assert.fail("Timeout waiting for Page Load Request to complete."); }*/ } }
package File; import Block.Block; import Controller.BlockManagerController; import Controller.DefaultBlockManagerControllerImpl; import Exception.BlockException.*; import Exception.FileException.*; import Exception.IDException.IDNullInFilenameException; import Id.*; import Manager.*; import Utils.IOUtils; import Utils.Properties; import java.io.IOException; public class DefaultFileImpl implements File { Id<File> id; FileManager fileManager; FileMeta fileMeta; long curr; final static int MOVE_CURR = 0; final static int MOVE_HEAD = 1; final static int MOVE_TAIL = 2; public DefaultFileImpl(Id<File> id, FileManager fileManager, FileMeta fileMeta) { this.id = id; this.fileManager = fileManager; this.fileMeta = fileMeta; this.curr = 0; } public DefaultFileImpl(FileManager fileManager, Id<File> id) { this.id = id; this.fileManager = fileManager; this.fileMeta = new DefaultFileMetaImpl(this.fileManager, this.id); this.curr = 0; } @Override public long size() throws IOException { return fileMeta.getFileSize(); } @Override public void setSize(long newSize) throws FileWriteFailException, IllegalCursorException, IOException, SetFileSizeFailException, MD5Exception, BlockCheckSumException, IllegalDropBlocksException { if (newSize < 0) { throw new SetFileSizeFailException("[SetFileSizeFailException] new size cannot be under zero. "); } long oldSize = fileMeta.getFileSize(); if (newSize > oldSize) { byte[] newData = new byte[(int) (newSize - oldSize)]; write(newData); } else if (newSize < oldSize) { long newBlockIndex = newSize / Properties.BLOCK_SIZE; byte[] data = fileMeta.readBlock((int) newBlockIndex); int leftSize = (int) (newSize % Properties.BLOCK_SIZE); byte[] newData = new byte[leftSize]; System.arraycopy(data, 0, newData, 0, leftSize); fileMeta.dropBlocks((int) newBlockIndex, fileMeta.getBlockNum() - 1); move(newSize, MOVE_HEAD); write(newData); fileMeta.setFileSize(newSize); } } @Override public Id getFileId() { return this.id; } @Override public FileManager getFileManager() { return this.fileManager; } @Override public byte[] read(int length) throws IOException, OverReadingFileException, IllegalCursorException, BlockCheckSumException, MD5Exception { long fileSize = fileMeta.getFileSize(); if (length > fileSize - curr) { throw new OverReadingFileException("[OverReadingFileException] Reading more bytes than file's length. "); } byte[] result = fileMeta.readFile(length, this.curr); move(length, MOVE_CURR); return result; } @Override public void write(byte[] b) throws IOException, IllegalCursorException, FileWriteFailException { long currentBlock = curr / Properties.BLOCK_SIZE; long row = currentBlock + 2; for (int i = 0; i < b.length; i = i + Properties.BLOCK_SIZE) { byte[] chunk; if (i + Properties.BLOCK_SIZE >= b.length) {// 最后一个 Logic Block,文件内容不足一整块 chunk = new byte[b.length - i]; System.arraycopy(b, i, chunk, 0, b.length - i); } else { chunk = new byte[Properties.BLOCK_SIZE]; System.arraycopy(b, i, chunk, 0, Properties.BLOCK_SIZE); } BlockManagerController blockManagerController = DefaultBlockManagerControllerImpl.getInstance(); Block[] blocks = new Block[Properties.DUPLICATED_BLOCK_NUMBER]; for (int j = 0; j < Properties.DUPLICATED_BLOCK_NUMBER; j++) { try { blocks[j] = blockManagerController.assignBlock(chunk); } catch (BlockConstructFailException | MD5Exception | BlockManagerFullException e) { throw new FileWriteFailException("[FileWriteFailException] write file failed. " + e.getMessage()); } } fileMeta.addBlock(blocks, row++); } fileMeta.setFileSize(fileMeta.getFileSize() + b.length); move(b.length, MOVE_CURR); } @Override public long move(long offset, int where) throws IllegalCursorException, IOException { switch (where) { case MOVE_CURR: if (curr + offset > size() || curr + offset < 0) { throw new IllegalCursorException("illegal cursor move"); } curr += offset; break; case MOVE_HEAD: if (offset > size() || offset < 0) { throw new IllegalCursorException("illegal cursor move"); } curr = offset; break; case MOVE_TAIL: if (offset > 0 || (size() + offset) < 0) { throw new IllegalCursorException("illegal cursor move"); } curr = size() + offset; break; default: throw new IllegalCursorException("illegal cursor move, MOVE_CURR = 0; MOVE_HEAD = 1; MOVE_TAIL = 2;"); } return this.curr; } @Override public void close() { } @Override public long pos() { return curr; } public static File recoverFile(java.io.File file, FileManager fileManager) throws IOException, BlockNullException, IDNullInFilenameException, RecoverFileFailException, RecoverBlockFailException { int indexId = 0; try { indexId = IOUtils.getIntInFileName(file.getName()); } catch (IDNullInFilenameException e) { throw new RecoverFileFailException("[RecoverFileFailException] corrupted file. "); } Id<File> id = IdImplFactory.getIdWithIndex(File.class, indexId); byte[] data = Utils.IOUtils.readByteArrayFromFile(file, file.length()); String[] lines = new String(data).split("\n"); long fileSize = Long.parseLong(lines[0]); FileMeta fileMeta = DefaultFileMetaImpl.recoverFileMeta(lines, id, fileSize, fileManager); return new DefaultFileImpl(id, fileManager, fileMeta); } }
package again_again; import java.util.*; public class Class24_CountUntill { public static void main (String [] args){ Scanner scan = new Scanner (System.in); System.out.println("Enter number to count until"); int numberToStop =scan.nextInt(); int start =1; while (start <= numberToStop){ System.out.print(start+ " "); start ++; } } }
package exception.user.test; class User{ public void go() throws ArithmeticException{ //스캐너로 i, j 에 해당하는 값을 받아들인다고 가정... int i=10; int j=0; System.out.println("1. Scanner로 입력받는 j값이 0이면 안되는데...."); //j값이 0이면 예외를 고의적으로 발생시켜서 더이상 진행되지 않도록 처리.. if(j==0) throw new ArithmeticException(); //아랫부분 어딘가에서 i/j j가 분모가 되는 연산이 진행된다고 가정... } } public class UserExceptionTest1 { public static void main(String[] args) { User user = new User(); try { user.go(); System.out.println("2. 폭탄이 이곳으로 날라왔습니다.."); }catch(ArithmeticException e) { System.out.println("3. 폭탄 처리 성공 ^^"); } System.out.println("4. 프로그램 정상 종료"); } }
package com.ssgl.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.ssgl.bean.Page; import com.ssgl.bean.Result; import com.ssgl.bean.StudentStatus; import com.ssgl.bean.StudentStatusExample; import com.ssgl.mapper.StudentStatusMapper; import com.ssgl.service.StateService; import com.ssgl.util.Util; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; import java.util.List; @Service public class StateServiceImpl implements StateService { @Autowired public StudentStatusMapper statusMapper; @Override public Result addStatus(StudentStatus studentStatus) throws Exception { studentStatus.setId(Util.makeId()); statusMapper.insert(studentStatus); return new Result("ok","添加成功"); } @Override public Page<StudentStatus> selectStatesPage(Integer currentPage, Integer pageSize, HttpServletRequest request) throws Exception { PageHelper.startPage(currentPage,pageSize); String sid = request.getParameter("sid") == null ? "":request.getParameter("sid"); String name = request.getParameter("name") == null ? "":request.getParameter("name"); StudentStatusExample example = new StudentStatusExample(); if(sid.length()>0){ example.createCriteria().andSidEqualTo(sid); } if(name.length()>0){ example.createCriteria().andNameEqualTo(name); } List<StudentStatus> list = statusMapper.selectByExample(example); if(null!=list&&list.size()>0){ PageInfo<StudentStatus> info = new PageInfo<StudentStatus>(list); Page<StudentStatus> page = new Page<>(); page.setList(info.getList()); page.setTotalRecord((int) info.getTotal()); return page; } return null; } }
/** * LoginPanel.java * * Skarpetis Dimitris 2016, all rights reserved. */ package dskarpetis.elibrary.ui.authentication; import org.apache.wicket.Component; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.form.AjaxButton; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.PasswordTextField; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.panel.FeedbackPanel; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.IModel; import dskarpetis.elibrary.init.InjecDetachableModel; import dskarpetis.elibrary.service.user.UserService; import dskarpetis.elibrary.service.user.UserServiceException; import dskarpetis.elibrary.ui.ElibrarySession; import dskarpetis.elibrary.ui.InjectorDetachableModel; import dskarpetis.elibrary.ui.search.SearchPage; /** * Class that defines the LoginPanel * * @author dskarpetis */ public class LoginPanel extends Panel { private static final long serialVersionUID = 1L; // Define String KEYS for the component declaration <span wicket:id="KEY"> // to HTML file private static final String FORM_KEY = "login"; private static final String USERNAME_KEY = "username"; private static final String PASSWORD_KEY = "password"; private static final String FEEDBACK_KEY = "feedback"; private static final String SUBMIT_KEY = "submit"; private static final String SIGNUP_KEY = "signup"; private final FeedbackPanel feedbackPanel; private final IModel<UserService> serviceModel = new InjecDetachableModel<UserService>(UserService.class, new InjectorDetachableModel()); /** * @param id * @param formModel */ public LoginPanel(final String id, final IModel<UserLoginData> formModel) { super(id, formModel); // Form component final Form<UserLoginData> form = new Form<UserLoginData>(FORM_KEY); // add form component to the parent panel component add(form); // bind UserLoginData class properties with form component form.setDefaultModel(formModel); // TextField component for username html field final TextField<String> username = (TextField<String>) new TextField<String>(USERNAME_KEY).setRequired(true); // TextField component for password html field final PasswordTextField password = (PasswordTextField) new PasswordTextField(PASSWORD_KEY).setRequired(true); // Define a link for SignupPage SignupLink signupLink = new SignupLink(SIGNUP_KEY); // FeedbackPanel component that displays error messages feedbackPanel = new FeedbackPanel(FEEDBACK_KEY); feedbackPanel.setOutputMarkupId(true); // add components to form queue(username, password, signupLink, feedbackPanel); // create and add Button component to form AjaxButton loginButton = new LoginAjaxButton(SUBMIT_KEY); queue(loginButton); } /** * */ public void login() { UserLoginData userLoginData = (UserLoginData) getDefaultModelObject(); try { // Store User in ElibrarySession page ElibrarySession.get().login(userLoginData, serviceModel); // if user is valid redirect to SearchPage setResponsePage(SearchPage.class); } catch (UserServiceException e) { // if username is invalid, displays the appropriate message if (!e.userExists()) { error(getString("UsernameExistsValidator")); } // if password is invalid, displays the appropriate message if (!e.isValidPassword()) { error(getString("PasswordExistsValidator")); } } catch (Exception exception) { // This should never happen throw new WicketRuntimeException("Login failed! Make sure that the credentials are correct and UserService is running.", exception); } } /** * Helper method to access a Components {@link LoginPanel} parent. * * @param component * The component to get the parent panel from * @return The {@link LoginPanel} instance. */ public static LoginPanel get(final Component component) { Component p = component.getParent(); if (p instanceof LoginPanel) { return (LoginPanel) p; } else if (p != null) { return get(p); } else { throw new IllegalArgumentException(String.format("Component doesn't belong to a CustomerDataPanel instance")); } } /** * Update the feedback modal in an AJAX request by adding it to the * {@link AjaxRequestTarget}. * * @param target * The {@link AjaxRequestTarget} of the current AJAX request. */ public void updateFeedback(final AjaxRequestTarget target) { target.add(feedbackPanel); } }
package com.numix.calculator; public class EquationFormatter { public static final char PLACEHOLDER = '\u200B'; public static final char POWER = '^'; public static final char PLUS = '+'; public static final char MINUS = '\u2212'; public static final char MUL = '\u00d7'; public static final char DIV = '\u00f7'; public static final char EQUAL = '='; public static final char LEFT_PAREN = '('; public static final char RIGHT_PAREN = ')'; public String appendParenthesis(String input) { final StringBuilder formattedInput = new StringBuilder(input); int unclosedParen = 0; for(int i = 0; i < formattedInput.length(); i++) { if(formattedInput.charAt(i) == LEFT_PAREN) unclosedParen++; else if(formattedInput.charAt(i) == RIGHT_PAREN) unclosedParen--; } for(int i = 0; i < unclosedParen; i++) { formattedInput.append(RIGHT_PAREN); } return formattedInput.toString(); } public String insertSupscripts(String input) { final StringBuilder formattedInput = new StringBuilder(); int sub_open = 0; int sub_closed = 0; int paren_open = 0; int paren_closed = 0; for(int i = 0; i < input.length(); i++) { char c = input.charAt(i); if(c == POWER) { formattedInput.append("<sup>"); if(sub_open == 0) formattedInput.append("<small>"); sub_open++; if(i + 1 == input.length()) { formattedInput.append(c); if(sub_closed == 0) formattedInput.append("</small>"); formattedInput.append("</sup>"); sub_closed++; } else { formattedInput.append(PLACEHOLDER); } continue; } if(sub_open > sub_closed) { if(paren_open == paren_closed) { // Decide when to break the <sup> started by ^ if(c == PLUS // 2^3+1 || (c == MINUS && input.charAt(i - 1) != POWER) // 2^3-1 || c == MUL // 2^3*1 || c == DIV // 2^3/1 || c == EQUAL // X^3=1 || (c == LEFT_PAREN && (Character.isDigit(input.charAt(i - 1)) || input.charAt(i - 1) == RIGHT_PAREN)) // 2^3(1) // or // 2^(3-1)(0) || (Character.isDigit(c) && input.charAt(i - 1) == RIGHT_PAREN) // 2^(3)1 || (!Character.isDigit(c) && Character.isDigit(input.charAt(i - 1))) && c != '.') { // 2^3log(1) while(sub_open > sub_closed) { if(sub_closed == 0) formattedInput.append("</small>"); formattedInput.append("</sup>"); sub_closed++; } sub_open = 0; sub_closed = 0; paren_open = 0; paren_closed = 0; if(c == LEFT_PAREN) { paren_open--; } else if(c == RIGHT_PAREN) { paren_closed--; } } } if(c == LEFT_PAREN) { paren_open++; } else if(c == RIGHT_PAREN) { paren_closed++; } } formattedInput.append(c); } while(sub_open > sub_closed) { if(sub_closed == 0) formattedInput.append("</small>"); formattedInput.append("</sup>"); sub_closed++; } return formattedInput.toString(); } }
package com.tencent.mm.pluginsdk; import java.util.HashMap; public final class b { public static final class b { public static final HashMap<Integer, Integer> qxY; static { HashMap hashMap = new HashMap(); qxY = hashMap; hashMap.put(Integer.valueOf(22), Integer.valueOf(64)); qxY.put(Integer.valueOf(9), Integer.valueOf(64)); qxY.put(Integer.valueOf(3), Integer.valueOf(64)); qxY.put(Integer.valueOf(23), Integer.valueOf(64)); qxY.put(Integer.valueOf(25), Integer.valueOf(64)); qxY.put(Integer.valueOf(13), Integer.valueOf(64)); qxY.put(Integer.valueOf(29), Integer.valueOf(256)); qxY.put(Integer.valueOf(34), Integer.valueOf(512)); qxY.put(Integer.valueOf(6), Integer.valueOf(512)); qxY.put(Integer.valueOf(35), Integer.valueOf(1024)); qxY.put(Integer.valueOf(36), Integer.valueOf(4096)); qxY.put(Integer.valueOf(37), Integer.valueOf(32768)); qxY.put(Integer.valueOf(38), Integer.valueOf(32768)); qxY.put(Integer.valueOf(42), Integer.valueOf(131072)); qxY.put(Integer.valueOf(40), Integer.valueOf(65536)); qxY.put(Integer.valueOf(41), Integer.valueOf(65536)); qxY.put(Integer.valueOf(46), Integer.valueOf(262144)); qxY.put(Integer.valueOf(48), Integer.valueOf(524288)); } } }
package com.guozaiss.news.APIService; import com.guozaiss.news.APIService.impl.DataServiceImpl; import com.guozaiss.news.Constants; import java.io.IOException; import java.util.concurrent.TimeUnit; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import okhttp3.ResponseBody; import retrofit2.Retrofit; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; import timber.log.Timber; /** * Created by bruce on 16/4/22. */ public class HttpHelper { public static final String END_POINT = Constants.topBase; public static void initialize() { Interceptor interceptor = new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = chain.request() .newBuilder() // .addHeader("deviceId", (String) SPUtils.get(AppConfigs.SP_KEY_DEVICE_ID, "")) // .addHeader("token", (String) SPUtils.get(AppConfigs.SP_KEY_USER_TOKEN, "")) .build(); long t1 = System.nanoTime(); Timber.d("Sending request %s on %s%n%s", request.url(), chain.connection(), request.headers()); Response response = chain.proceed(request); long t2 = System.nanoTime(); Timber.d("Received response for %s in %.1fms%n%s", response.request().url(), (t2 - t1) / 1e6d, response.headers()); final String responseString = new String(response.body().bytes()); //打印返回JSON结果 Timber.d("returnJson %s", responseString); return response.newBuilder() .body(ResponseBody.create(response.body().contentType(), responseString)) .build(); } }; OkHttpClient client = new OkHttpClient.Builder() .addNetworkInterceptor(interceptor) .retryOnConnectionFailure(true) .connectTimeout(15, TimeUnit.SECONDS) .build(); Retrofit retrofit = new Retrofit.Builder() .baseUrl(END_POINT) .client(client) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .build(); DataServiceImpl.dataService = retrofit.create(DataService.class); } }
package design_method.适配器.对象适配器; public class Client { public static void main(String[] args) { Phone phone=new Phone(); phone.charging(new VolatageAdapter(new Voltage220V())); } }
package com.socialbooks.jra.repository; import com.socialbooks.jra.domain.Livro; import org.springframework.data.jpa.repository.JpaRepository; public interface LivrosRepository extends JpaRepository<Livro, Long> { }
package com.jonathan.user.Services; public class UserRequest { private final String name; private final String lastName; private final String email; private final String password; public UserRequest(String name, String lastName, String email, String password) { this.name = name; this.lastName = lastName; this.email = email; this.password = password; } public String getName() { return name; } public String getLastName() { return lastName; } public String getEmail() { return email; } public String getPassword() { return password; } @Override public String toString() { return "UserRequest{" + "name='" + name + '\'' + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + ", password='" + password + '\'' + '}'; } }
package com.tienganhchoem.model; public class AnswerModel extends AbstractModel<AnswerModel> { private String title; private String thumbnail; private String shortDescription; private String content; private boolean isTrue; private String linkMp3; private String questionId; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getThumbnail() { return thumbnail; } public void setThumbnail(String thumbnail) { this.thumbnail = thumbnail; } public String getShortDescription() { return shortDescription; } public void setShortDescription(String shortDescription) { this.shortDescription = shortDescription; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public boolean isTrue() { return isTrue; } public void setTrue(boolean aTrue) { isTrue = aTrue; } public String getLinkMp3() { return linkMp3; } public void setLinkMp3(String linkMp3) { this.linkMp3 = linkMp3; } public String getQuestionId() { return questionId; } public void setQuestionId(String questionId) { this.questionId = questionId; } }
package com.tencent.mm.plugin.webview.model; import com.tencent.mm.ab.b.a; import com.tencent.mm.ab.e; import com.tencent.mm.ab.l; import com.tencent.mm.network.k; import com.tencent.mm.network.q; import com.tencent.mm.plugin.webview.ui.tools.jsapi.c.b; import com.tencent.mm.protocal.c.aoc; import com.tencent.mm.protocal.c.aop; import com.tencent.mm.protocal.c.aoq; import com.tencent.mm.protocal.c.apd; import com.tencent.mm.sdk.platformtools.x; import java.util.LinkedList; public final class p extends l implements k, b { public final com.tencent.mm.ab.b diG; private e doG; private final int pRn; public aoc pRo; public p(aoc aoc, String str, String str2, String str3, String str4, String str5, String str6, String str7, com.tencent.mm.bk.b bVar, int i, LinkedList<apd> linkedList, int i2) { x.i("MicroMsg.webview.NetSceneJSAPISetAuth", "NetSceneJSAPISetAuth doScene url[%s], appid[%s], jsapiName[%s], [%s], [%s], [%s], [%s], [%s]", new Object[]{str, str2, str3, str4, str5, str6, str7, Integer.valueOf(i)}); this.pRo = aoc; this.pRn = i2; a aVar = new a(); aVar.dIG = new aop(); aVar.dIH = new aoq(); aVar.uri = "/cgi-bin/mmbiz-bin/jsapi-setauth"; aVar.dIF = 1096; aVar.dII = 0; aVar.dIJ = 0; this.diG = aVar.KT(); aop aop = (aop) this.diG.dID.dIL; aop.url = str; aop.bPS = str2; aop.rQC = str3; aop.bJT = str4; aop.rQE = str5; aop.signature = str6; aop.rQF = str7; aop.rQH = i; aop.rQG = bVar; aop.rQL = linkedList; } public final void a(int i, int i2, int i3, String str, q qVar, byte[] bArr) { x.i("MicroMsg.webview.NetSceneJSAPISetAuth", "errType = %d, errCode = %d, errMsg = %s", new Object[]{Integer.valueOf(i2), Integer.valueOf(i3), str}); this.doG.a(i2, i3, str, this); } public final int getType() { return 1096; } public final int a(com.tencent.mm.network.e eVar, e eVar2) { x.i("MicroMsg.webview.NetSceneJSAPISetAuth", "doScene"); this.doG = eVar2; return a(eVar, this.diG, this); } public final int bUa() { return this.pRn; } }
package me.bemind.fingerprinthelper; import android.content.Context; import android.os.Build; /** * Created by angelomoroni on 06/02/17. */ public class FingerPrintHelperBuilder { public static IFingerPrintUiHelper getFingerPrintUIHelper(Context context, AuthenticationCallback authenticationCallback){ IFingerPrintUiHelper fingerPrintUIHelper; if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { fingerPrintUIHelper = new FingerPrintUIHelper(context, authenticationCallback); }else { fingerPrintUIHelper = new OldFingerPrntUIHelper(); } return fingerPrintUIHelper; } }
/* * Copyright (C) 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. * * Author: David Yonge-Mallo */ package com.example.android.inputmethod.persian; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Bundle; import android.preference.PreferenceActivity; public class Preferences extends PreferenceActivity implements OnSharedPreferenceChangeListener { public static final String KEY_SELECT_SUGGESTION_CHECKBOX_PREFERENCE = "select_suggestion_checkbox_preference"; public static final String KEY_GROUP_VARIANTS_CHECKBOX_PREFERENCE = "group_variants_checkbox_preference"; public static final String KEY_USE_REDUCED_KEYS_CHECKBOX_PREFERENCE = "use_reduced_keys_checkbox_preference"; public static final String KEY_PREFER_FULLSCREEN_CHECKBOX_PREFERENCE = "prefer_fullscreen_checkbox_preference"; public static final String KEY_SHOW_REDUNDANT_KEYBOARD_CHECKBOX_PREFERENCE = "show_redundant_keyboard_checkbox_preference"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Load the preferences from an XML resource addPreferencesFromResource(R.xml.preferences); } @Override protected void onResume() { super.onResume(); // Set up a listener whenever a key changes getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); } @Override protected void onPause() { super.onPause(); // Unregister the listener whenever a key changes getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); } public void onSharedPreferenceChanged(final SharedPreferences sharedPrefs, final String key) { if (key.equals(KEY_SELECT_SUGGESTION_CHECKBOX_PREFERENCE)) { } else if (key.equals(KEY_GROUP_VARIANTS_CHECKBOX_PREFERENCE)) { } else if (key.equals(KEY_USE_REDUCED_KEYS_CHECKBOX_PREFERENCE)) { } else if (key.equals(KEY_PREFER_FULLSCREEN_CHECKBOX_PREFERENCE)) { } else if (key.equals(KEY_SHOW_REDUNDANT_KEYBOARD_CHECKBOX_PREFERENCE)) { } } }
package tom.graphic.DataView; import java.io.PrintStream; import javax.infobus.ArrayAccess; import javax.infobus.DataItemAddedEvent; import javax.infobus.DataItemChangeEvent; import javax.infobus.DataItemChangeListener; import javax.infobus.DataItemChangeManager; import javax.infobus.DataItemDeletedEvent; import javax.infobus.DataItemRevokedEvent; import javax.infobus.DataItemValueChangedEvent; import javax.infobus.ImmediateAccess; import javax.infobus.RowsetCursorMovedEvent; // Referenced classes of package tom.graphic.DataView: // Array public class IBArray extends Array implements DataItemChangeListener { Object theDataItem; public void dataItemAdded(DataItemAddedEvent evt) { System.out.println("Data item addedd" + evt); } public void dataItemDeleted(DataItemDeletedEvent evt) { System.out.println("Data item addedd" + evt); } public void dataItemRevoked(DataItemRevokedEvent evt) { System.out.println("Data item revoked" + evt); } public void dataItemValueChanged(DataItemValueChangedEvent evt) { System.out.println("Data item value changed" + evt.getChangedItem()); dataItemAvailable(theDataItem, evt.getChangedItem()); } public void rowsetCursorMoved(RowsetCursorMovedEvent evt) { System.out.println("rowset cursor moved" + evt); } public void dataItemAvailable(Object inDataItem, Object objectChanged) { if (inDataItem instanceof ArrayAccess) { int level = 0; ArrayAccess aa = (ArrayAccess)inDataItem; int coords[] = aa.getDimensions(); System.out.println(level + "ArrayAccess.getDimensions()->=" + coords.length); for (int i = 0; i < coords.length; i++) System.out.println(level + "dim[" + i + "]=" + coords[i]); try { if (coords.length == 1) { int xCoord[] = new int[1]; dimI(coords[0]); dimJ(1); for (int x = 0; x < coords[0]; x++) { xCoord[0] = x; Object subitem = aa.getItemByCoordinates(xCoord); } } else if (coords.length == 2) { int xyCoord[] = new int[2]; dimI(coords[0]); dimJ(coords[1]); for (int x = 0; x < coords[0]; x++) { for (int y = 0; y < coords[1]; y++) { xyCoord[0] = x; xyCoord[1] = y; Object subitem = aa.getItemByCoordinates(xyCoord); ImmediateAccess ia = (ImmediateAccess)subitem; Object obj = ia.getValueAsObject(); if (obj instanceof Float) { float f = ((Float)obj).floatValue(); System.out.println(" ij:" + x + " " + y + " " + f); setIJ(x, y, f); } else if (obj instanceof Double) { float f = ((Double)obj).floatValue(); System.out.println(" ij:" + x + " " + y + " " + f); setIJ(x, y, f); } } } } else if (coords.length == 3) { int xyzCoord[] = new int[3]; if (coords[2] == 0) { int z = 0; for (int x = 0; x < coords[0]; x++) { for (int y = 0; y < coords[1]; y++) { xyzCoord[0] = x; xyzCoord[1] = y; xyzCoord[2] = z; Object subitem = aa.getItemByCoordinates(xyzCoord); ImmediateAccess ia = (ImmediateAccess)subitem; } } } else { for (int x = 0; x < coords[0]; x++) { for (int y = 0; y < coords[1]; y++) { for (int z = 0; z < coords[2]; z++) { xyzCoord[0] = x; xyzCoord[1] = y; xyzCoord[2] = z; Object subitem = aa.getItemByCoordinates(xyzCoord); } } } } } else { System.out.println((level + coords.length) + " dimensional array not supported"); } } catch (Exception _ex) { } } if ((inDataItem instanceof DataItemChangeManager) && theDataItem == null) ((DataItemChangeManager)inDataItem).addDataItemChangeListener(this); theDataItem = inDataItem; } }
package SearchComboBox; import DAO.ProveedorDAO; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.stage.Stage; import model.Proveedor; /** * * @author Carmelo Marin Abrego */ public class SearchComboBoxApp extends Application { @Override public void start(Stage primaryStage) { StackPane root = new StackPane(); root.getChildren().add(createSearchComboBox()); Scene scene = new Scene(root, 300, 250); primaryStage.setTitle("JavaFX - SearchComboBox"); primaryStage.setScene(scene); primaryStage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } private Node createSearchComboBox() { ProveedorDAO pDAO = new ProveedorDAO(); ObservableList<Proveedor> items = pDAO.getProveedores(); SearchComboBox<Proveedor> cbx = new SearchComboBox<>(); cbx.setItems(items); cbx.setFilter((item, text) -> item.getNombreprovee().contains(text)); cbx.getSelectionModel().selectedItemProperty().addListener((p, o, n) -> System.out.println("ComboBox Item: " + n)); cbx.setPrefWidth(250.0); cbx.getSelectionModel().select(5); Button btn = new Button("Select index 10"); btn.setOnAction(a -> System.out.println(cbx.getSelectionModel().getSelectedItem().getIdproveedor())); VBox box = new VBox(10.0); box.getChildren().addAll(cbx, btn); box.setAlignment(Pos.CENTER); return box; } }
public class LettoreMultimediale { public static void main(String[] args){ final int DIM=10; ElementoMultimediale[] lettore = new ElementoMultimediale[DIM]; lettore[0] = new Immagine("i1", Estensioni.EstensioniImmagine.JPG); lettore[1] = new Immagine("i2", Estensioni.EstensioniImmagine.PNG); lettore[2] = new Immagine("i3", Estensioni.EstensioniImmagine.TIFF); lettore[3] = new RegistrazioneAudio("r1", Estensioni.EstensioniAudio.WAV); lettore[4] = new RegistrazioneAudio("r2", Estensioni.EstensioniAudio.MP3); lettore[5] = new RegistrazioneAudio("r3", Estensioni.EstensioniAudio.MIDI); lettore[6] = new Filmato("f1", Estensioni.EstensioniFilmato.AVI); lettore[7] = new Filmato("f2", Estensioni.EstensioniFilmato.FLV); lettore[8] = new Filmato("f3", Estensioni.EstensioniFilmato.MP4); lettore[9] = new Filmato("f4", Estensioni.EstensioniFilmato.WEBM); for (int i = 0; i < DIM ; i++){ lettore[i].esegui(); } } }
package gdut.ff.gecco; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import com.geccocrawler.gecco.annotation.PipelineName; import com.geccocrawler.gecco.pipeline.Pipeline; import gdut.ff.utils.Constant; import gdut.ff.utils.NodeUtil; /** * * @author liuffei * @date 2017-01-31 */ @PipelineName("csdnPipeline") public class CsdnPipeline implements Pipeline<CsdnBeanList> { @Autowired private Constant constant; @Override public void process(CsdnBeanList beanList) { List<CsdnBean> blogs = beanList.getBeanList(); if(null != blogs && blogs.size() > 0) { constant.csdnNodes.addAll(NodeUtil.transFromList(blogs)); for(int i = 0;i < blogs.size();i++) { System.out.println("url :"+blogs.get(i).getUrl()+" -> title:"+blogs.get(i).getTitle() +" -> classification:"+blogs.get(i).getClassification()); } } } }
package com.example.pritam.androiddrinkshop.Database.Local; import android.arch.persistence.room.Database; import android.arch.persistence.room.Room; import android.arch.persistence.room.RoomDatabase; import android.content.Context; import com.example.pritam.androiddrinkshop.Database.ModelDB.Cart; import com.example.pritam.androiddrinkshop.Database.ModelDB.Favourite; @Database(entities = {Cart.class, Favourite.class}, version = 1) public abstract class PRITAMRoomDatabase extends RoomDatabase { public abstract CartDAO cartDAO(); public abstract FavouriteDAO favouriteDAO(); private static PRITAMRoomDatabase instance; public static PRITAMRoomDatabase getInstance(Context context) { if (instance == null) instance = Room.databaseBuilder(context, PRITAMRoomDatabase.class, "PRITAM_DrinkShopDB") .allowMainThreadQueries() .build(); return instance; } }
package com.example.demo.service; import com.diboot.core.service.BaseService; import com.example.demo.entity.User; /** * 用户表相关Service * @author Elvis * @version 1.0.0 * @date 2019-11-30 * Copyright © Elvis.com */ public interface UserService extends BaseService<User> { }
package com.xiruan.demand.entity.automation; import javax.persistence.*; /** * Created by chen on 2015/7/23. */ @Entity @Table(name = "HIPI_JOB_RUN") @SequenceGenerator(name = "job_run_seq", sequenceName = "HIPI_JOB_RUN_SEQ") public class HIPIJobRun { private Integer ID; private String STATUS; private String PROCESS_STATUS_ID; private Integer JOB_ID; private Integer JOB_RUN_ID; private String JOB_NAME; private Integer DEMAND_RUN_ID; private String IS_CYCLICITY; private String PLAN_START_TIME; private String PLAN_END_TIME; private String START_TIME; private String END_TIME; private String JUSER; private String JROLE; private String JCATEGORY; private String OBJECT_TYPE_ID; private String CHG_TIME; private String CHG_ID; private String CHG_TASK_ID; private String JDESCRIPTION; private String JSOURCE; private String RESULT_ID; private String PARAM_VALUES; private String IPMENUS; private String RUNINDEX; private Integer PROCESS; private Long nextFireTime; private String TEMPLATE_NAME; @Id @GeneratedValue(generator = "job_run_seq") public Integer getID() { return ID; } public void setID(Integer ID) { this.ID = ID; } public Integer getJOB_ID() { return JOB_ID; } public void setJOB_ID(Integer JOB_ID) { this.JOB_ID = JOB_ID; } public String getSTATUS() { return STATUS; } public void setSTATUS(String STATUS) { this.STATUS = STATUS; } public String getPROCESS_STATUS_ID() { return PROCESS_STATUS_ID; } public void setPROCESS_STATUS_ID(String PROCESS_STATUS_ID) { this.PROCESS_STATUS_ID = PROCESS_STATUS_ID; } public Integer getJOB_RUN_ID() { return JOB_RUN_ID; } public void setJOB_RUN_ID(Integer JOB_RUN_ID) { this.JOB_RUN_ID = JOB_RUN_ID; } public String getJOB_NAME() { return JOB_NAME; } public void setJOB_NAME(String JOB_NAME) { this.JOB_NAME = JOB_NAME; } public Integer getDEMAND_RUN_ID() { return DEMAND_RUN_ID; } public void setDEMAND_RUN_ID(Integer DEMAND_RUN_ID) { this.DEMAND_RUN_ID = DEMAND_RUN_ID; } public String getIS_CYCLICITY() { return IS_CYCLICITY; } public void setIS_CYCLICITY(String IS_CYCLICITY) { this.IS_CYCLICITY = IS_CYCLICITY; } public String getPLAN_START_TIME() { return PLAN_START_TIME; } public void setPLAN_START_TIME(String PLAN_START_TIME) { this.PLAN_START_TIME = PLAN_START_TIME; } public String getPLAN_END_TIME() { return PLAN_END_TIME; } public void setPLAN_END_TIME(String PLAN_END_TIME) { this.PLAN_END_TIME = PLAN_END_TIME; } public String getSTART_TIME() { return START_TIME; } public void setSTART_TIME(String START_TIME) { this.START_TIME = START_TIME; } public String getEND_TIME() { return END_TIME; } public void setEND_TIME(String END_TIME) { this.END_TIME = END_TIME; } public String getJUSER() { return JUSER; } public void setJUSER(String JUSER) { this.JUSER = JUSER; } public String getJROLE() { return JROLE; } public void setJROLE(String JROLE) { this.JROLE = JROLE; } public String getJCATEGORY() { return JCATEGORY; } public void setJCATEGORY(String JCATEGORY) { this.JCATEGORY = JCATEGORY; } public String getOBJECT_TYPE_ID() { return OBJECT_TYPE_ID; } public void setOBJECT_TYPE_ID(String OBJECT_TYPE_ID) { this.OBJECT_TYPE_ID = OBJECT_TYPE_ID; } public String getCHG_TIME() { return CHG_TIME; } public void setCHG_TIME(String CHG_TIME) { this.CHG_TIME = CHG_TIME; } public String getCHG_ID() { return CHG_ID; } public void setCHG_ID(String CHG_ID) { this.CHG_ID = CHG_ID; } public String getCHG_TASK_ID() { return CHG_TASK_ID; } public void setCHG_TASK_ID(String CHG_TASK_ID) { this.CHG_TASK_ID = CHG_TASK_ID; } public String getJDESCRIPTION() { return JDESCRIPTION; } public void setJDESCRIPTION(String JDESCRIPTION) { this.JDESCRIPTION = JDESCRIPTION; } public String getJSOURCE() { return JSOURCE; } public void setJSOURCE(String JSOURCE) { this.JSOURCE = JSOURCE; } public String getRESULT_ID() { return RESULT_ID; } public void setRESULT_ID(String RESULT_ID) { this.RESULT_ID = RESULT_ID; } public String getPARAM_VALUES() { return PARAM_VALUES; } public void setPARAM_VALUES(String PARAM_VALUES) { this.PARAM_VALUES = PARAM_VALUES; } @Column(length = 50000) public String getIPMENUS() { return IPMENUS; } public void setIPMENUS(String IPMENUS) { this.IPMENUS = IPMENUS; } public String getRUNINDEX() { return RUNINDEX; } public void setRUNINDEX(String RUNINDEX) { this.RUNINDEX = RUNINDEX; } public Integer getPROCESS() { return PROCESS; } public void setPROCESS(Integer PROCESS) { this.PROCESS = PROCESS; } public Long getNextFireTime() { return nextFireTime; } public void setNextFireTime(Long nextFireTime) { this.nextFireTime = nextFireTime; } public String getTEMPLATE_NAME() { return TEMPLATE_NAME; } public void setTEMPLATE_NAME(String TEMPLATE_NAME) { this.TEMPLATE_NAME = TEMPLATE_NAME; } }
package com.tencent.mm.plugin.setting.ui.setting; import com.tencent.mm.g.a.ny; import com.tencent.mm.model.bd.a; class SettingsChattingUI$3 implements a { final /* synthetic */ SettingsChattingUI mSa; SettingsChattingUI$3(SettingsChattingUI settingsChattingUI) { this.mSa = settingsChattingUI; } public final boolean Ip() { return SettingsChattingUI.c(this.mSa); } public final void Io() { if (SettingsChattingUI.a(this.mSa) != null) { SettingsChattingUI.a(this.mSa).dismiss(); SettingsChattingUI.a(this.mSa, null); } com.tencent.mm.sdk.b.a.sFg.m(new ny()); } }
package com.uzeal.db.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class DAO<T extends DTO> { private FieldStructure<T> fields; private String tableName; private String createStatement; private String insertStatemenet; private String updateStatement; private String deleteByIdStatement; private String selectByIdStatement; private String selectAllStatement; DAO(FieldStructure<T> fields, String tableName, String createStatement, String insertStatemenet, String updateStatement, String deleteByIdStatement, String selectByIdStatement, String selectAllStatement) { super(); this.fields = fields; this.tableName = tableName; this.createStatement = createStatement; this.insertStatemenet = insertStatemenet; this.updateStatement = updateStatement; this.deleteByIdStatement = deleteByIdStatement; this.selectByIdStatement = selectByIdStatement; this.selectAllStatement = selectAllStatement; } public void createTable(Connection connection) throws SQLException { try(PreparedStatement ps = connection.prepareStatement(createStatement)) { ps.execute(); } } public void insert(Connection connection, T dto) throws Exception { try(PreparedStatement ps = connection.prepareStatement(insertStatemenet)) { fields.setInsertFields(ps, dto); ps.execute(); } } public void update(Connection connection, T dto) throws Exception { try(PreparedStatement ps = connection.prepareStatement(updateStatement)) { fields.setUpdateFields(ps, dto); ps.execute(); } } public void delete(Connection connection, T dto) throws Exception { try(PreparedStatement ps = connection.prepareStatement(deleteByIdStatement)) { fields.setIdFields(ps, dto); ps.execute(); } } public List<T> selectAll(Connection connection) throws Exception { List<T> dto = new ArrayList<T>(); try(PreparedStatement ps = connection.prepareStatement(selectAllStatement)) { try(ResultSet rs = ps.executeQuery()) { while(rs.next()) { T obj = fields.buildDTO(rs); dto.add(obj); } } } return dto; } public List<T> selectById(Connection connection, T input) throws Exception { List<T> dto = new ArrayList<T>(); try(PreparedStatement ps = connection.prepareStatement(selectByIdStatement)) { fields.setIdFields(ps, input); try(ResultSet rs = ps.executeQuery()) { while(rs.next()) { T obj = fields.buildDTO(rs); dto.add(obj); } } } return dto; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("DAO [tableName=").append(tableName).append(", createStatement=").append(createStatement) .append(", insertStatemenet=").append(insertStatemenet).append(", updateStatement=") .append(updateStatement).append(", deleteByIdStatement=").append(deleteByIdStatement) .append(", selectByIdStatement=").append(selectByIdStatement).append(", selectAllStatement=") .append(selectAllStatement).append("]"); return builder.toString(); } }
package com.gtfs.action; import java.io.Serializable; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import com.gtfs.bean.LicAddressDtls; import com.gtfs.bean.LicInsuredAddressMapping; import com.gtfs.bean.LicInsuredBankDtls; import com.gtfs.bean.LicNomineeDtls; import com.gtfs.bean.LicOblApplicationMst; import com.gtfs.bean.LicPrintRcptDtls; import com.gtfs.bean.LicProofMst; import com.gtfs.bean.PrintRcptMst; import com.gtfs.bean.RbiBankDtls; import com.gtfs.bean.StateMst; import com.gtfs.service.interfaces.LicInsuredAddressMappingService; import com.gtfs.service.interfaces.LicNomineeDtlsService; import com.gtfs.service.interfaces.LicOblApplicationMstService; import com.gtfs.service.interfaces.LicPrintRcptDtlsService; import com.gtfs.service.interfaces.LicProofMstService; import com.gtfs.service.interfaces.PrintRcptMstService; import com.gtfs.service.interfaces.RbiBankDtlsService; import com.gtfs.service.interfaces.StateMstService; import com.gtfs.util.Age; import com.gtfs.util.AgeCalculation; import com.gtfs.util.BankValidation; @Component @Scope("session") public class LicSecondaryDataEntryAction implements Serializable{ private Logger log = Logger.getLogger(LicSecondaryDataEntryAction.class); @Autowired private LicOblApplicationMstService licOblApplicationMstService; @Autowired private StateMstService stateMstService; @Autowired private RbiBankDtlsService rbiBankDtlsService; @Autowired private LoginAction loginAction; @Autowired private LicProofMstService licProofMstService; @Autowired private PrintRcptMstService printRcptMstService; @Autowired private LicInsuredAddressMappingService licInsuredAddressMappingService; @Autowired private LicPrintRcptDtlsService licPrintRcptDtlsService; @Autowired private LicNomineeDtlsService licNomineeDtlsService; private Date applicationDate; private String applicationNo; private Boolean renderedDetailForm; private Boolean renderedListPanel; private Boolean renderedsearchPanel; private Boolean requiredApointee; private Boolean insuredNomineeAddressSameFlag; private Boolean requiredHusband; private Boolean requiredAccountNo; // private List<LicProofMst> ageProofList = new ArrayList<LicProofMst>(); private List<LicProofMst> addrProofList = new ArrayList<LicProofMst>(); private List<LicProofMst> identityProofList = new ArrayList<LicProofMst>(); private List<LicProofMst> incomeProofList = new ArrayList<LicProofMst>(); private List<StateMst> stateMsts = new ArrayList<StateMst>(); private List<String> prefixs = new ArrayList<String>(); private List<LicOblApplicationMst> licOblApplicationMstList = new ArrayList<LicOblApplicationMst>(); // temp variable private LicOblApplicationMst licOblApplicationMst; private LicAddressDtls licAddressDtls; private LicNomineeDtls licNomineeDtls; private LicPrintRcptDtls licPrintRcptDtls; @PostConstruct public void findAllActiveStateMSt(){ // ageProofList.clear(); addrProofList.clear(); identityProofList.clear(); incomeProofList.clear(); List<LicProofMst> list = licProofMstService.findAll(); for(LicProofMst obj : list){ if(obj.getProofFlag().equals("AD")){ addrProofList.add(obj); // }else if(obj.getProofFlag().equals("AG")){ // ageProofList.add(obj); }else if(obj.getProofFlag().equals("ID")){ identityProofList.add(obj); }else if(obj.getProofFlag().equals("IN")){ incomeProofList.add(obj); } } stateMsts = stateMstService.findAllActiveStateMSt(); } public void refresh(){ Date now = new Date(); licOblApplicationMstList.clear(); licOblApplicationMst = new LicOblApplicationMst(); licAddressDtls = new LicAddressDtls(); licAddressDtls.setCreatedBy(loginAction.getUserList().get(0).getUserid()); licAddressDtls.setModifiedBy(loginAction.getUserList().get(0).getUserid()); licAddressDtls.setCreatedDate(now); licAddressDtls.setModifiedDate(now); licAddressDtls.setDeleteFlag("N"); licNomineeDtls = new LicNomineeDtls(); licNomineeDtls.setCreatedBy(loginAction.getUserList().get(0).getUserid()); licNomineeDtls.setModifiedBy(loginAction.getUserList().get(0).getUserid()); licNomineeDtls.setCreatedDate(now); licNomineeDtls.setModifiedDate(now); licNomineeDtls.setDeleteFlag("N"); requiredHusband = false; requiredAccountNo = false; renderedDetailForm = false; renderedListPanel = false; renderedsearchPanel = true; requiredApointee = false; insuredNomineeAddressSameFlag = false; licPrintRcptDtls = new LicPrintRcptDtls(); } public String onLoad(){ refresh(); applicationDate = null; applicationNo = null; return "/licBranchActivity/licSecondaryDataEntry.xhtml"; } public void maritalStatusChangeListener(){ if(licOblApplicationMst.getLicInsuredDtls().getMaritalStatus() != null){ if(licOblApplicationMst.getLicInsuredDtls().getMaritalStatus().equals("Married") && !(licOblApplicationMst.getLicInsuredDtls().getSalutation().equals("Mr."))){ requiredHusband = true; }else{ requiredHusband = false; } }else{ requiredHusband = false; } } public void insuredNomineeAddressSameFlagListener(){ try{ String special = ""; if(insuredNomineeAddressSameFlag == true){ if(licAddressDtls.getAddress1() != null){ special = " || "; }else{ licAddressDtls.setAddress1(" "); } if(licAddressDtls.getAddress2() != null){ special = " || "; }else{ licAddressDtls.setAddress2(" "); } licNomineeDtls.setNomineeAddress(licAddressDtls.getAddress1() + " " + special + " " + licAddressDtls.getAddress2()); }else{ licNomineeDtls.setNomineeAddress(null); } }catch(Exception e){ log.info("Error : ", e); } } public void searchByIfscCode(){ try{ List<RbiBankDtls> list = rbiBankDtlsService.findRbiBankDtlsByIfscCode(licOblApplicationMst.getLicInsuredBankDtls().getIfsCode()); if(!(list == null || list.size() == 0 || list.contains(null))){ licOblApplicationMst.getLicInsuredBankDtls().setBankName(list.get(0).getBankName()); licOblApplicationMst.getLicInsuredBankDtls().setBankBranch(list.get(0).getBranchName()); licOblApplicationMst.getLicInsuredBankDtls().setMicrCode(list.get(0).getMicrCode()); requiredAccountNo = true; }else{ requiredAccountNo = false; licOblApplicationMst.getLicInsuredBankDtls().setAcctNo(null); licOblApplicationMst.getLicInsuredBankDtls().setBankName(null); licOblApplicationMst.getLicInsuredBankDtls().setBankBranch(null); licOblApplicationMst.getLicInsuredBankDtls().setMicrCode(null); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error : ", "IFSC Code Not Valid")); return; } }catch(Exception e){ log.info("LicSecondaryDataEntryAction process Error : ", e); } } public void validateApointee(){ try{ Date now = new Date(); int age = now.getYear() - licNomineeDtls.getNomineeDob().getYear(); if(age < 18){ requiredApointee = true; }else{ requiredApointee = false; } }catch(Exception e){ log.info("Error : ", e); } } public void search(){ try{ requiredAccountNo = false; if(applicationDate != null){ licOblApplicationMstList = licOblApplicationMstService.findApplicationForSecondaryDataEntryByDate(applicationDate, loginAction.getUserList().get(0).getBranchMst()); renderedListPanel = true; }else if(applicationNo != null && !applicationNo.equals("")){ licOblApplicationMstList = licOblApplicationMstService.findApplicationForSecondaryDataEntryByApplicationNo(applicationNo, loginAction.getUserList().get(0).getBranchMst()); renderedListPanel = true; }else{ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage (FacesMessage.SEVERITY_ERROR,"Error :", "Please Enter Date or Application Number")); renderedListPanel = false; return; } }catch(Exception e){ log.info("LicSecondaryDataEntryAction search Error : ", e); } } public void editDetail(LicOblApplicationMst licOblApplicationMst){ try{ Date now = new Date(); this.licOblApplicationMst = licOblApplicationMst; prefixs = printRcptMstService.findPrintRcptPrefixByBranchParentTieupCoId(loginAction.getUserList().get(0).getBranchMst().getBranchId(), licOblApplicationMst.getLicProductValueMst().getTieupCompyMst().getTieCompyId(), 3l); List<LicNomineeDtls> nomineeList = licNomineeDtlsService.findNomineeDtlsByApplication(this.licOblApplicationMst); List<LicInsuredAddressMapping> addressList = licInsuredAddressMappingService.findAddressDtlsByInsuredDtls(licOblApplicationMst.getLicInsuredDtls()); if(addressList == null || addressList.size() == 0){ licAddressDtls = new LicAddressDtls(); licAddressDtls.setCreatedBy(loginAction.getUserList().get(0).getUserid()); licAddressDtls.setModifiedBy(loginAction.getUserList().get(0).getUserid()); licAddressDtls.setCreatedDate(now); licAddressDtls.setModifiedDate(now); licAddressDtls.setDeleteFlag("N"); }else{ licAddressDtls = addressList.get(0).getLicAddressDtls(); licAddressDtls.setId(null); } if(nomineeList == null || nomineeList.size() == 0){ licNomineeDtls = new LicNomineeDtls(); licNomineeDtls.setCreatedBy(loginAction.getUserList().get(0).getUserid()); licNomineeDtls.setModifiedBy(loginAction.getUserList().get(0).getUserid()); licNomineeDtls.setCreatedDate(now); licNomineeDtls.setModifiedDate(now); licNomineeDtls.setDeleteFlag("N"); licNomineeDtls.setLicOblApplicationMst(this.licOblApplicationMst); }else{ licNomineeDtls = nomineeList.get(0); licNomineeDtls.setId(null); } if(this.licOblApplicationMst.getSecondaryEntryFlag().equals("Y")){ this.licPrintRcptDtls = licPrintRcptDtlsService.findLicPrintRcptDtlsByApplication(this.licOblApplicationMst).get(0); }else{ licPrintRcptDtls.setCreatedBy(loginAction.getUserList().get(0).getUserid()); licPrintRcptDtls.setModifiedBy(loginAction.getUserList().get(0).getUserid()); licPrintRcptDtls.setCreatedDate(now); licPrintRcptDtls.setModifiedDate(now); licPrintRcptDtls.setDeleteFlag("N"); } if(licOblApplicationMst.getLicInsuredBankDtls() == null){ LicInsuredBankDtls licInsuredBankDtls = new LicInsuredBankDtls(); licInsuredBankDtls.setCreatedBy(loginAction.getUserList().get(0).getUserid()); licInsuredBankDtls.setModifiedBy(loginAction.getUserList().get(0).getUserid()); licInsuredBankDtls.setDeleteFlag("N"); licInsuredBankDtls.setCreatedDate(now); licInsuredBankDtls.setModifiedDate(now); this.licOblApplicationMst.setLicInsuredBankDtls(licInsuredBankDtls); licInsuredBankDtls.setLicOblApplicationMst(this.licOblApplicationMst); } if(licOblApplicationMst.getSecondaryEntryFlag().equals("Y")){ validateApointee(); maritalStatusChangeListener(); } if(licOblApplicationMst.getLicInsuredBankDtls().getIfsCode() != null){ requiredAccountNo = true; } renderedDetailForm = true; renderedListPanel = false; renderedsearchPanel = false; }catch(Exception e){ log.info("LicSecondaryDataEntryAction editDetail Error : ", e); } } public void process(){ try{ Date now = new Date(); //print receipt work start if(!(licOblApplicationMst.getSecondaryEntryFlag().equals("Y"))){ // check for secondary entry flag Boolean successFlag = false; List<PrintRcptMst> printRcptMsts = printRcptMstService.findPrintRcptMstByPrefixBranchIdTieupCoIdParentCoId(licPrintRcptDtls.getPrefix(), loginAction.getUserList().get(0).getBranchMst().getBranchId(), licOblApplicationMst.getLicProductValueMst().getTieupCompyMst().getTieCompyId(), 3l); if(printRcptMsts == null || printRcptMsts.size() == 0 || printRcptMsts.contains(null)){ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Save UnSuccessful: ", "Master Data not Saved")); return; } for(PrintRcptMst printRcptMst : printRcptMsts){ if(printRcptMst.getReceiptFrom() <= licPrintRcptDtls.getReceiptNo() && printRcptMst.getReceiptTo() >= licPrintRcptDtls.getReceiptNo()){ List<Long> list = licPrintRcptDtlsService.findAllLicPrintRcptDtlsByPrintRcptMst(printRcptMst); if(!(list == null || list.size() == 0 || list.contains(null))){ if(list.contains(licPrintRcptDtls.getReceiptNo())){ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error : ", "Receipt No. Already Used.")); return; } } successFlag = true; licPrintRcptDtls.setTableId(licOblApplicationMst.getId()); licPrintRcptDtls.setTableName("LIC_OBL_APPLICATION_MST"); licPrintRcptDtls.setProcessName("OBL"); licPrintRcptDtls.setPrintRcptMst(printRcptMst); break; /*if(list == null || list.size() == 0 || list.contains(null)){ if(printRcptMst.getReceiptFrom().equals(licPrintRcptDtls.getReceiptNo())){ successFlag = true; licPrintRcptDtls.setTableId(licOblApplicationMst.getId()); licPrintRcptDtls.setTableName("LIC_OBL_APPLICATION_MST"); licPrintRcptDtls.setProcessName("OBL"); licPrintRcptDtls.setPrintRcptMst(printRcptMst); break; }else{ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error : ", "Enter Receipt No. Not In Order")); return; } }else{ if(licPrintRcptDtls.getReceiptNo().equals((list.get(0) + 1))){ successFlag = true; licPrintRcptDtls.setTableId(licOblApplicationMst.getId()); licPrintRcptDtls.setTableName("LIC_OBL_APPLICATION_MST"); licPrintRcptDtls.setProcessName("OBL"); licPrintRcptDtls.setPrintRcptMst(printRcptMst); break; }else{ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error : ", "Enter Receipt No. Not In Order")); return; } }*/ } } if(successFlag == false){ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error : ", "Your Receipt No. Has Not Been Allocated To Your Branch")); return; } //print receipt work end } List<LicNomineeDtls> nomineeList = licNomineeDtlsService.findNomineeDtlsByApplication(this.licOblApplicationMst); List<LicInsuredAddressMapping> addressList = licInsuredAddressMappingService.findAddressDtlsByInsuredDtls(licOblApplicationMst.getLicInsuredDtls()); if(nomineeList == null || nomineeList.size()==0){ nomineeList = new ArrayList<LicNomineeDtls>(); nomineeList.add(licNomineeDtls); this.licOblApplicationMst.setLicNomineeDtlses(nomineeList); }else{ for(LicNomineeDtls obj:nomineeList){ obj.setDeleteFlag("Y"); } nomineeList.add(licNomineeDtls); this.licOblApplicationMst.setLicNomineeDtlses(nomineeList); } if(addressList == null || addressList.size() == 0){ addressList = new ArrayList<LicInsuredAddressMapping>(); LicInsuredAddressMapping licInsuredAddressMapping=new LicInsuredAddressMapping(); licInsuredAddressMapping.setLicAddressDtls(licAddressDtls); licInsuredAddressMapping.setLicInsuredDtls(this.licOblApplicationMst.getLicInsuredDtls()); licInsuredAddressMapping.setAddressType("I"); licInsuredAddressMapping.setCreatedBy(loginAction.getUserList().get(0).getUserid()); licInsuredAddressMapping.setModifiedBy(loginAction.getUserList().get(0).getUserid()); licInsuredAddressMapping.setCreatedDate(now); licInsuredAddressMapping.setModifiedDate(now); licInsuredAddressMapping.setDeleteFlag("N"); addressList.add(licInsuredAddressMapping); licAddressDtls.setLicInsuredAddressMappings(addressList); this.licOblApplicationMst.getLicInsuredDtls().setLicInsuredAddressMappings(addressList); }else{ for(LicInsuredAddressMapping obj : addressList){ obj.getLicAddressDtls().setDeleteFlag("Y"); obj.setDeleteFlag("Y"); } LicInsuredAddressMapping licInsuredAddressMapping = new LicInsuredAddressMapping(); licInsuredAddressMapping.setLicAddressDtls(licAddressDtls); licInsuredAddressMapping.setLicInsuredDtls(licOblApplicationMst.getLicInsuredDtls()); licInsuredAddressMapping.setAddressType("I"); licInsuredAddressMapping.setCreatedBy(loginAction.getUserList().get(0).getUserid()); licInsuredAddressMapping.setModifiedBy(loginAction.getUserList().get(0).getUserid()); licInsuredAddressMapping.setCreatedDate(now); licInsuredAddressMapping.setModifiedDate(now); licInsuredAddressMapping.setDeleteFlag("N"); addressList.add(licInsuredAddressMapping); licAddressDtls.setLicInsuredAddressMappings(addressList); this.licOblApplicationMst.getLicInsuredDtls().setLicInsuredAddressMappings(addressList); } if(!(licOblApplicationMst.getLicInsuredBankDtls().getAcctNo() == null || licOblApplicationMst.getLicInsuredBankDtls().getAcctNo().equals(""))){ Boolean accountValidation = BankValidation.bankAccountValidation(licOblApplicationMst.getLicInsuredBankDtls().getBankName(), licOblApplicationMst.getLicInsuredBankDtls().getAcctNo()); if(accountValidation == false){ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error : ", "Account Number Not Valid")); return; } } licOblApplicationMst.setSecondaryEntryFlag("Y"); Boolean status = licOblApplicationMstService.insertDataForSecondaryDataEntry(licOblApplicationMst,licPrintRcptDtls); if (status) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Save Successful : ", "Data Saved Successfully")); renderedDetailForm = false; renderedsearchPanel = true; refresh(); search(); } else { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Save UnSuccessful : ", "Data Not Saved")); } }catch(Exception e){ log.info("LicSecondaryDataEntryAction process Error : ", e); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error Occured : ", "Please Try Again")); } } /* GETTER SETTER */ public List<LicOblApplicationMst> getLicOblApplicationMstList() { return licOblApplicationMstList; } public void setLicOblApplicationMstList( List<LicOblApplicationMst> licOblApplicationMstList) { this.licOblApplicationMstList = licOblApplicationMstList; } public String getApplicationNo() { return applicationNo; } public void setApplicationNo(String applicationNo) { this.applicationNo = applicationNo; } public Date getApplicationDate() { return applicationDate; } public void setApplicationDate(Date applicationDate) { this.applicationDate = applicationDate; } public LicOblApplicationMst getLicOblApplicationMst() { return licOblApplicationMst; } public void setLicOblApplicationMst(LicOblApplicationMst licOblApplicationMst) { this.licOblApplicationMst = licOblApplicationMst; } public LicAddressDtls getLicAddressDtls() { return licAddressDtls; } public void setLicAddressDtls(LicAddressDtls licAddressDtls) { this.licAddressDtls = licAddressDtls; } public LicNomineeDtls getLicNomineeDtls() { return licNomineeDtls; } public void setLicNomineeDtls(LicNomineeDtls licNomineeDtls) { this.licNomineeDtls = licNomineeDtls; } public Boolean getRenderedDetailForm() { return renderedDetailForm; } public void setRenderedDetailForm(Boolean renderedDetailForm) { this.renderedDetailForm = renderedDetailForm; } public Boolean getRenderedListPanel() { return renderedListPanel; } public void setRenderedListPanel(Boolean renderedListPanel) { this.renderedListPanel = renderedListPanel; } public Boolean getRenderedsearchPanel() { return renderedsearchPanel; } public void setRenderedsearchPanel(Boolean renderedsearchPanel) { this.renderedsearchPanel = renderedsearchPanel; } // public List<LicProofMst> getAgeProofList() { // return ageProofList; // } // // public void setAgeProofList(List<LicProofMst> ageProofList) { // this.ageProofList = ageProofList; // } public List<LicProofMst> getAddrProofList() { return addrProofList; } public void setAddrProofList(List<LicProofMst> addrProofList) { this.addrProofList = addrProofList; } public List<LicProofMst> getIdentityProofList() { return identityProofList; } public void setIdentityProofList(List<LicProofMst> identityProofList) { this.identityProofList = identityProofList; } public List<LicProofMst> getIncomeProofList() { return incomeProofList; } public void setIncomeProofList(List<LicProofMst> incomeProofList) { this.incomeProofList = incomeProofList; } public List<StateMst> getStateMsts() { return stateMsts; } public void setStateMsts(List<StateMst> stateMsts) { this.stateMsts = stateMsts; } public LicPrintRcptDtls getLicPrintRcptDtls() { return licPrintRcptDtls; } public void setLicPrintRcptDtls(LicPrintRcptDtls licPrintRcptDtls) { this.licPrintRcptDtls = licPrintRcptDtls; } public List<String> getPrefixs() { return prefixs; } public void setPrefixs(List<String> prefixs) { this.prefixs = prefixs; } public Boolean getRequiredApointee() { return requiredApointee; } public void setRequiredApointee(Boolean requiredApointee) { this.requiredApointee = requiredApointee; } public Boolean getInsuredNomineeAddressSameFlag() { return insuredNomineeAddressSameFlag; } public void setInsuredNomineeAddressSameFlag( Boolean insuredNomineeAddressSameFlag) { this.insuredNomineeAddressSameFlag = insuredNomineeAddressSameFlag; } public Boolean getRequiredHusband() { return requiredHusband; } public void setRequiredHusband(Boolean requiredHusband) { this.requiredHusband = requiredHusband; } public Boolean getRequiredAccountNo() { return requiredAccountNo; } public void setRequiredAccountNo(Boolean requiredAccountNo) { this.requiredAccountNo = requiredAccountNo; } }
package com.aummn.suburb.service; import com.aummn.suburb.entity.Suburb; import com.aummn.suburb.exception.SuburbExistsException; import com.aummn.suburb.exception.SuburbNotFoundException; import com.aummn.suburb.repo.SuburbRepository; import com.aummn.suburb.resource.dto.request.SuburbWebRequest; import com.aummn.suburb.service.dto.request.SuburbServiceRequest; import com.aummn.suburb.service.dto.response.SuburbServiceResponse; import org.junit.Before; import org.junit.Test; import org.mockito.InOrder; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; public class SuburbServiceImplTest { @Mock private SuburbRepository suburbRepository; @InjectMocks private SuburbServiceImpl suburbService; @Before public void setUp() throws Exception { MockitoAnnotations.openMocks(this); } @Test public void givenANewSuburb_wehnAddSuburb_thenReturnSingleOfAddedSuburbId() { when(suburbRepository.findByNameAndPostcodeIgnoreCase(anyString(), anyString())) .thenReturn(Optional.empty()); when(suburbRepository.save(any(Suburb.class))) .thenReturn(new Suburb(1L, "Southbank", "3006")); suburbService.addSuburb(new SuburbServiceRequest("Southbank", "3006")) .test() .assertComplete() .assertNoErrors() .assertValue(1L) .awaitTerminalEvent(); InOrder inOrder = inOrder(suburbRepository); inOrder.verify(suburbRepository, times(1)).findByNameAndPostcodeIgnoreCase(anyString(), anyString()); inOrder.verify(suburbRepository, times(1)).save(any(Suburb.class)); } @Test public void givenAnExistingSuburb_whenAddSuburb_andWithSamePostcode_thenThrowSuburbExistsException() { when(suburbRepository.findByNameAndPostcodeIgnoreCase(anyString(), anyString())) .thenReturn(Optional.of(new Suburb(1L, "Southbank", "3006"))); suburbService.addSuburb(new SuburbServiceRequest("Southbank", "3006")) .test() .assertNotComplete() .assertError(SuburbExistsException.class) .awaitTerminalEvent(); InOrder inOrder = inOrder(suburbRepository); inOrder.verify(suburbRepository, times(1)).findByNameAndPostcodeIgnoreCase(anyString(), anyString()); inOrder.verify(suburbRepository, never()).save(any(Suburb.class)); } @Test public void givenAPostcode_whenGetSuburbDetailByPostcode_SuburbNotFound_thenThrowSuburbNotFoundException() { when(suburbRepository.findByPostcode(anyString())) .thenReturn(Collections.emptyList()); suburbService.getSuburbDetailByPostcode("3006") .test() .assertNotComplete() .assertError(SuburbNotFoundException.class) .awaitTerminalEvent(); verify(suburbRepository, times(1)).findByPostcode(anyString()); } @Test public void givenAPostcode_whenGetSuburbDetailByPostcode_SuburbFound_thenReturnSuburbs() { Suburb s1 = new Suburb(1L, "Southbank", "3006"); Suburb s2 = new Suburb(2L, "Melbourne", "3000"); Suburb s3 = new Suburb(3L, "Carlton", "3001"); List<Suburb> suburbs = Arrays.asList(s1, s2, s3); SuburbServiceResponse s1dto = new SuburbServiceResponse(1L, "Southbank", "3006"); SuburbServiceResponse s2dto = new SuburbServiceResponse(2L, "Melbourne", "3000"); SuburbServiceResponse s3dto = new SuburbServiceResponse(3L, "Carlton", "3001"); List<SuburbServiceResponse> dtos = Arrays.asList(s1dto, s2dto, s3dto); when(suburbRepository.findByPostcode(anyString())) .thenReturn(suburbs); suburbService.getSuburbDetailByPostcode("3006") .test() .assertComplete() .assertNoErrors() .assertValues(dtos) .awaitTerminalEvent(); verify(suburbRepository, times(1)).findByPostcode(anyString()); } @Test public void givenASuburbName_whenGetSuburbDetailByName_SuburbNotFound_thenThrowSuburbNotFoundException() { when(suburbRepository.findByNameIgnoreCase(anyString())) .thenReturn(Collections.emptyList()); suburbService.getSuburbDetailByName("Southbank") .test() .assertNotComplete() .assertError(SuburbNotFoundException.class) .awaitTerminalEvent(); verify(suburbRepository, times(1)).findByNameIgnoreCase(anyString()); } @Test public void givenASuburbName_whenGetSuburbDetailByName_SuburbFound_thenReturnSuburbs() { Suburb s1 = new Suburb(1L, "Southbank", "3006"); Suburb s2 = new Suburb(2L, "Melbourne", "3000"); Suburb s3 = new Suburb(3L, "Carlton", "3001"); List<Suburb> suburbs = Arrays.asList(s1, s2, s3); SuburbServiceResponse s1dto = new SuburbServiceResponse(1L, "Southbank", "3006"); SuburbServiceResponse s2dto = new SuburbServiceResponse(2L, "Melbourne", "3000"); SuburbServiceResponse s3dto = new SuburbServiceResponse(3L, "Carlton", "3001"); List<SuburbServiceResponse> dtos = Arrays.asList(s1dto, s2dto, s3dto); when(suburbRepository.findByNameIgnoreCase(anyString())) .thenReturn(suburbs); suburbService.getSuburbDetailByName("Carlton") .test() .assertComplete() .assertNoErrors() .assertValues(dtos) .awaitTerminalEvent(); verify(suburbRepository, times(1)).findByNameIgnoreCase(anyString()); } @Test public void givenASuburbId_whenGetSuburbById_SuburbNotFound_thenThrowSuburbNotFoundException() { when(suburbRepository.findById(anyLong())) .thenReturn(Optional.empty()); suburbService.getSuburbById(1L) .test() .assertNotComplete() .assertError(SuburbNotFoundException.class) .awaitTerminalEvent(); verify(suburbRepository, times(1)).findById(anyLong()); } @Test public void givenASuburbId_whenGetSuburbById_SuburbFound_thenReturnSuburb() { Suburb s1 = new Suburb(1L, "Southbank", "3006"); SuburbServiceResponse s1dto = new SuburbServiceResponse(1L, "Southbank", "3006"); when(suburbRepository.findById(anyLong())) .thenReturn(Optional.of(s1)); suburbService.getSuburbById(1L) .test() .assertComplete() .assertNoErrors() .assertValue(s1dto) .awaitTerminalEvent(); verify(suburbRepository, times(1)).findById(anyLong()); } }
package com.dyny.gms.db.dao; import com.dyny.gms.db.pojo.Users; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @Deprecated @Mapper public interface UsersMapper { public Users getByNameAndPass(@Param("username") String username, @Param("password") String password); public int add(Users users); public int updatePass(@Param("password") String password, @Param("username") String userName); }
package com.seu.care.customer.model; import java.util.Date; public class CustomerIn { private Integer id; private Date createTime; private Integer createBy; private String customerName; private Integer customerAge; private Integer customerSex; private String idcard; private String elderType; private Date checkinDate; private String contactTel; private Integer bedId; private String psychosomaticState; private String attention; private Date birthday; private String height; private String maritalStatus; private String weight; private String bloodType; private String filepath; private Bed bed; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Integer getCreateBy() { return createBy; } public void setCreateBy(Integer createBy) { this.createBy = createBy; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName == null ? null : customerName.trim(); } public Integer getCustomerAge() { return customerAge; } public void setCustomerAge(Integer customerAge) { this.customerAge = customerAge; } public Integer getCustomerSex() { return customerSex; } public void setCustomerSex(Integer customerSex) { this.customerSex = customerSex; } public String getIdcard() { return idcard; } public void setIdcard(String idcard) { this.idcard = idcard == null ? null : idcard.trim(); } public String getElderType() { return elderType; } public void setElderType(String elderType) { this.elderType = elderType == null ? null : elderType.trim(); } public Date getCheckinDate() { return checkinDate; } public void setCheckinDate(Date checkinDate) { this.checkinDate = checkinDate; } public String getContactTel() { return contactTel; } public void setContactTel(String contactTel) { this.contactTel = contactTel == null ? null : contactTel.trim(); } public Integer getBedId() { return bedId; } public void setBedId(Integer bedId) { this.bedId = bedId; } public String getPsychosomaticState() { return psychosomaticState; } public void setPsychosomaticState(String psychosomaticState) { this.psychosomaticState = psychosomaticState == null ? null : psychosomaticState.trim(); } public String getAttention() { return attention; } public void setAttention(String attention) { this.attention = attention == null ? null : attention.trim(); } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height == null ? null : height.trim(); } public String getMaritalStatus() { return maritalStatus; } public void setMaritalStatus(String maritalStatus) { this.maritalStatus = maritalStatus == null ? null : maritalStatus.trim(); } public String getWeight() { return weight; } public void setWeight(String weight) { this.weight = weight == null ? null : weight.trim(); } public String getBloodType() { return bloodType; } public void setBloodType(String bloodType) { this.bloodType = bloodType == null ? null : bloodType.trim(); } public String getFilepath() { return filepath; } public void setFilepath(String filepath) { this.filepath = filepath == null ? null : filepath.trim(); } public Bed getBed() { return bed; } public void setBed(Bed bed) { this.bed = bed; } }
package com.xiaoxiao.tiny.frontline.controller; import com.xiaoxiao.pojo.XiaoxiaoLeaveMessage; import com.xiaoxiao.tiny.frontline.service.FrontlineTinyLeaveMessageService; import com.xiaoxiao.utils.Result; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.transaction.support.ResourceHolderSupport; import org.springframework.web.bind.annotation.*; /** * _ooOoo_ * o8888888o * 88" . "88 * (| -_- |) * O\ = /O * ____/`---'\____ * .' \\| |// `. * / \\||| : |||// \ * / _||||| -:- |||||- \ * | | \\\ - /// | | * | \_| ''\---/'' | | * \ .-\__ `-` ___/-. / * ___`. .' /--.--\ `. . __ * ."" '< `.___\_<|>_/___.' >'"". * | | : `- \`.;`\ _ /`;.`/ - ` : | | * \ \ `-. \_ __\ /__ _/ .-` / / * ======`-.____`-.___\_____/___.-`____.-'====== * `=---=' * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * 佛祖保佑 永无BUG * 佛曰: * 写字楼里写字间,写字间里程序员; * 程序人员写程序,又拿程序换酒钱。 * 酒醒只在网上坐,酒醉还来网下眠; * 酒醉酒醒日复日,网上网下年复年。 * 但愿老死电脑间,不愿鞠躬老板前; * 奔驰宝马贵者趣,公交自行程序员。 * 别人笑我忒疯癫,我笑自己命太贱; * 不见满街漂亮妹,哪个归得程序员? * * @project_name:xiaoxiao_final_blogs * @date:2019/12/19:14:54 * @author:shinelon * @Describe: */ @RestController @RequestMapping(value = "/frontline/tiny/leave/message") @CrossOrigin(origins = "*",maxAge = 3600) public class FrontlineTinyLeaveMessageController { @Autowired private FrontlineTinyLeaveMessageService frontlineTinyLeaveMessageService; @ApiOperation(value = "获取留言插入的信息",response = Result.class,notes = "获取留言插入的信息") @PostMapping(value = "/insert") public Result insert(@RequestBody XiaoxiaoLeaveMessage leaveMessage){ return this.frontlineTinyLeaveMessageService.insert(leaveMessage); } @ApiOperation(value = "分页查询留言",response = Result.class,notes = "分页查询留言") @PostMapping(value = "/findAllLeaveMessage") public Result findAllLeaveMessage(@RequestParam(name = "page",defaultValue = "1")Integer page, @RequestParam(name = "rows",defaultValue = "10")Integer rows){ return this.frontlineTinyLeaveMessageService.findAllLeaveMessage(page,rows); } @ApiOperation(value = "获取留言的个数",response = Result.class,notes = "获取留言的个数") @PostMapping(value = "/getLeaveMessageSum") public Result getLeaveMessageSum(){ return this.frontlineTinyLeaveMessageService.getLeaveMessageSum(); } }
/** * */ package pl.zezulka.game.rockpaperscissors.dao.impl; import java.util.Map; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; import org.springframework.stereotype.Repository; import pl.zezulka.game.rockpaperscissors.dao.IGameRepository; import pl.zezulka.game.rockpaperscissors.model.Game; /** * @author ania * */ @Repository public class GameRepository implements IGameRepository { private final AtomicLong counter = new AtomicLong(); private final Map<Long, Game> result = new ConcurrentHashMap<>(); @Override public Game save(Game game) { game.setId(counter.incrementAndGet()); result.put(game.getId(), game); return game; } @Override public Optional<Game> findById(Long id) { return Optional.ofNullable(result.get(id)); } }
package com.example.iutassistant.Acitivities; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.Spinner; import android.widget.TextView; import com.example.iutassistant.NewActivities.New_HomePage_Student_Activity; import com.example.iutassistant.R; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.time.Year; import java.util.ArrayList; import java.util.List; public class SectionCreation extends AppCompatActivity { Spinner secId,batchId; AutoCompleteTextView prog; Button join; TextView warningText; String secName,progName,batch,secID,checkStatus=" "; SharedPreferences sp; //sp is going to be used to keep users logged in DatabaseReference progDb,joinActionDb; String sid,secValue; int dataCheck=0; private String uid= FirebaseAuth.getInstance().getCurrentUser().getUid(); String ref="University/IUT"; final private String FCM_API = "https://fcm.googleapis.com/fcm/send"; final private String serverKey = "key=" + "AAAA_9tBebo:APA91bHMWuBlfbUe58s7YBPCLX5S_DvvifAg9c3Pzz6orpxjegc8dfzsYGcOGR5rZ5PPYZ5WQCc1MjimyiOojEWfh6S50as3MvpiHSRh-4mPV-ZXluz8nyvd_WT2Im08CN0T8OTd6SO5"; final private String contentType = "application/json"; final String TAG = "NOTIFICATION TAG"; String NOTIFICATION_TITLE="Request Accepted"; String NOTIFICATION_MESSAGE="You have become a member of"; String TOPIC="/topics/userABC"; @RequiresApi(api = Build.VERSION_CODES.O) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_section_creation); warningText=findViewById(R.id.warning); fetchSid(); addProg(); addBatch(); addSecID(); join(); dataCheck=0; // FirebaseMessaging.getInstance().subscribeToTopic(uid); //OldNotiFication.createNotificationChannel(this); } void addSecID(){ secId = (Spinner) findViewById(R.id.secId); List<String> list = new ArrayList<String>(); list.add("1"); list.add("2"); list.add("3"); list.add("4"); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); secId.setAdapter(dataAdapter); } @RequiresApi(api = Build.VERSION_CODES.O) void addBatch(){ batchId=(Spinner) findViewById(R.id.batch); int year= Year.now().getValue(); year=year-2000; year=year-1; String fstYear=Integer.toString(year); year=year-1; String sndYear=Integer.toString(year); year=year-1; String trdYear=Integer.toString(year); year=year-1; String fthYear=Integer.toString(year); List<String> list = new ArrayList<String>(); list.add(fstYear); list.add(sndYear); list.add(trdYear); list.add(fthYear); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); batchId.setAdapter(dataAdapter); } void addProg(){ prog=(AutoCompleteTextView) findViewById(R.id.prog); progDb= FirebaseDatabase.getInstance().getReference("University/IUT"); final List<String> list = new ArrayList<String>(); list.add(""); progDb.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { list.clear(); for(DataSnapshot deptSnapshot : dataSnapshot.child("PROG").getChildren()){ String deptKey = deptSnapshot.getKey(); list.add(deptKey); } } @Override public void onCancelled(DatabaseError databaseError) { } }); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list); // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); prog.setThreshold(1); prog.setAdapter(dataAdapter); } void join(){ join=findViewById(R.id.join); join.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { progName=prog.getText().toString().trim(); progName=progName.toUpperCase(); secID=secId.getSelectedItem().toString().trim(); batch=batchId.getSelectedItem().toString().trim(); secName=progName+""+batch+" "+secID; // Notification notification=new Notification(uid,"Request from notification","Abar geche Alhumdulillah",LogIn.contextLogin); // notification.setNotification(); //started /*TOPIC = "/topics/"+uid; //topic must match with what the receiver subscribed to NOTIFICATION_TITLE = "Checking"; NOTIFICATION_MESSAGE = "Request Sent Alhumdulillah "; JSONObject notification = new JSONObject(); JSONObject notifcationBody = new JSONObject(); System.out.println("j son object er vitor achi"); try { notifcationBody.put("title", NOTIFICATION_TITLE); notifcationBody.put("message", NOTIFICATION_MESSAGE); notification.put("to", TOPIC); notification.put("data", notifcationBody); System.out.println("try er vitor achi"); } catch (JSONException e) { Log.e(TAG, "onCreate: " + e.getMessage() ); } System.out.println("sned notir upor er vitor achi"); sendNotification(notification); //end*/ FirebaseDatabase.getInstance().getReference(ref).child("SECTION").child(secName).addValueEventListener(new ValueEventListener() { {System.out.println("EKHANE DEKHIO fn TW KI KAHINI **********" + secValue);} @RequiresApi(api = Build.VERSION_CODES.N) @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if(dataSnapshot.exists()) { //secValue = String.valueOf(dataSnapshot.child(secName).getValue()); System.out.println("EKHANE DEKHIO TW KI KAHINI **********" + secValue); if(dataCheck!=3){ dataCheck=1; setInfo();} System.out.println("EKHANE DEKHIO porer TW KI KAHINI **********" + secValue); } else if(dataCheck!=3) setInfo(); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } }); } String fetchSid(){ FirebaseDatabase.getInstance().getReference(ref).child("Students").child(uid).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if (dataSnapshot.exists()) { sid= String.valueOf(dataSnapshot.child("id").getValue()); System.out.println("age"+sid); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); checkStatus(); return sid; } @RequiresApi(api = Build.VERSION_CODES.N) void setInfo(){ System.out.println("EKHANE DEKHIO setInfo TW KI KAHINI **********" + secValue); if(dataCheck==1){ System.out.println("EKHANE DEKHIO else TW KI KAHINI **********" + dataCheck); joinActionDb=FirebaseDatabase.getInstance().getReference(ref).child("REQUEST").child(secName); joinActionDb.child(sid).child("id").setValue(uid); joinActionDb.child(sid).child("STATUS").setValue("REQUESTED"); FirebaseDatabase.getInstance().getReference("University/IUT").child("Students").child(uid).child("sec").setValue("REQUESTED"); dataCheck=3; } else{ System.out.println("EKHANE DEKHIO IF TW KI KAHINI **********" + dataCheck); System.out.println(sid+"ashena keno"); FirebaseDatabase.getInstance().getReference(ref).child("PROG").child(progName).setValue(progName); FirebaseDatabase.getInstance().getReference(ref).child("SECTION").child(secName).setValue(secName); FirebaseDatabase.getInstance().getReference(ref).child("StudentsInSection").child(secName).child(sid).setValue(uid); FirebaseDatabase.getInstance().getReference(ref).child("Students").child(uid).child("sec").setValue(secName); FirebaseDatabase.getInstance().getReference(ref).child("REQUEST").child(secName).child(sid).child("STATUS").setValue("ACCEPTED"); dataCheck=3; } // mytime.scheduleAtFixedRate(task,60,60); // if(checkStatus().equals("ACCEPTED")){ // startActivity(new Intent(getApplicationContext(), home_page_student.class)); // } } /* private void sendNotification(JSONObject notification) { JsonObjectRequest jsonObjectRequest=new JsonObjectRequest(FCM_API, notification, new com.android.volley.Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { } }, new com.android.volley.Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(SectionCreation.this, "Request error", Toast.LENGTH_LONG).show(); Log.i(TAG, "onErrorResponse: Didn't work"); } }) { @Override public Map<String, String> getHeaders () throws AuthFailureError { Map<String, String> params = new HashMap<>(); params.put("Authorization", serverKey); params.put("Content-Type", contentType); return params; } }; System.out.println("Single ton er vitor achi"); MySingleton.getInstance(getApplicationContext()).addToRequestQueue(jsonObjectRequest); }*/ String checkStatus(){ System.out.println(secName+" secu2 "+secID); FirebaseDatabase.getInstance().getReference(ref).child("Students").child(uid).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if(dataSnapshot.exists()){ System.out.println("ki ki hoi kisu tw hoi"); checkStatus=String.valueOf(dataSnapshot.child("sec").getValue()); if(checkStatus.equals("PENDING")) { warningText.setText("You are not a member of any section yet"); } else if(checkStatus.equals("REQUESTED")){ warningText.setText("Your request is pending"); } else if(checkStatus.equals("REJECTED")){ warningText.setText("Your request is rejected"); //Intent intent = new Intent(SectionCreation.this, home_page_student.class); // Notification.setNotification("Your section request is rejected "+secName,intent,SectionCreation.this); // setNotification("Your section request is rejected "+secName,intent); } else { if(checkStatus.equals(secName)) { System.out.println("If er vitor achi"); //Intent intent = new Intent(SectionCreation.this, home_page_stude.class); //Notification.setNotification("You have become a member of "+secName,intent,SectionCreation.this); System.out.println("send notir niche er vitor achi"); // setNotification("You became a member of "+secName,intent); } startActivity(new Intent(getApplicationContext(), New_HomePage_Student_Activity.class)); finish(); } } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); return checkStatus; } /* public void setNotification(String statement,Intent intent){ OldNotiFication.showNotification(SectionCreation.this.getApplicationContext(), intent, 1, "Request", statement); TOPIC = "/topics/userABC"; //topic must match with what the receiver subscribed to NOTIFICATION_TITLE = sid; NOTIFICATION_MESSAGE = "You have become a member of "+secName; JSONObject notification = new JSONObject(); JSONObject notifcationBody = new JSONObject(); System.out.println("j son object er vitor achi"); try { notifcationBody.put("title", NOTIFICATION_TITLE); notifcationBody.put("message", NOTIFICATION_MESSAGE); notification.put("to", TOPIC); notification.put("data", notifcationBody); System.out.println("try er vitor achi"); } catch (JSONException e) { Log.e(TAG, "onCreate: " + e.getMessage() ); } System.out.println("sned notir upor er vitor achi"); sendNotification(notification); }*/ }
package com.technology.share.domain.view; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.technology.share.domain.BaseEntity; import com.technology.share.domain.Permission; import lombok.Data; import java.util.List; @TableName(value = "v_role",resultMap = "vRoleResultMap") @Data public class VRole extends BaseEntity { /**角色名称*/ private String roleName; /**权限树*/ @TableField(exist = false) private List<Permission> permissionTree; }
package descriptionfiles; import global.FileOps; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.HashMap; import java.util.LinkedList; /** * Contains a set of description files and delivers global key access to all descriptions. The descriptions are * loaded on demand. * * @author Andreas Fender */ public class DescriptionFiles { private HashMap<String, DescriptionFile> descFiles; private HashMap<String, DescSection> sections; private HashMap<String, Description> textVariables; public DescriptionFiles() { descFiles = new HashMap<>(32); sections = new HashMap<>(64); textVariables = new HashMap<>(); } private void addSection(String sectionName, DescSection section) { String secNameUpper = sectionName.toUpperCase(); if (!sections.containsKey(secNameUpper)) { sections.put(secNameUpper, section); } } void addToSection(String section, Description desc) { DescSection target = getSection(section); if (target == null) target = new DescSection(section); LinkedList<Description> list = target.getDescriptions(); if (!list.contains(desc)) list.add(desc); addSection(section, target); } public DescSection getSection(String section) { return sections.get(section.trim().toUpperCase()); } public boolean loadDirectory(String directory, boolean recursive) throws HelpFileException, IOException { LinkedList<File> files = FileOps.listFiles(directory, recursive, false, new String[]{".xml"}); if (files == null) return false; for (File file : files) { getDescFile(file); } return true; } public DescriptionFile getDescFile(File file) throws HelpFileException, IOException { if (file == null) return null; DescriptionFile result; String filename = file.getAbsolutePath(); result = descFiles.get(filename); if (result != null) return result; if (!file.exists()) throw new FileNotFoundException(filename); result = new DescriptionFile(filename, this); descFiles.put(filename, result); return result; } public Description getDesc(String key) { key = key.toUpperCase(); for (DescriptionFile descFile : descFiles.values()) { Description desc = descFile.getDescription(key); if (desc != null) return desc; } return null; } public HashMap<String, Description> getTextVariables() { return this.textVariables; } }
package com.tencent.mm.plugin.card.ui; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.os.Vibrator; import android.support.v7.app.ActionBarActivity; import android.text.TextUtils; import android.view.KeyEvent; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.tencent.mm.ab.e; import com.tencent.mm.g.a.pf; import com.tencent.mm.kernel.g; import com.tencent.mm.model.q; import com.tencent.mm.modelgeo.c; import com.tencent.mm.plugin.appbrand.s$l; import com.tencent.mm.plugin.card.b.c.a; import com.tencent.mm.plugin.card.b.d; import com.tencent.mm.plugin.card.b.f; import com.tencent.mm.plugin.card.b.i; import com.tencent.mm.plugin.card.b.j; import com.tencent.mm.plugin.card.base.b; import com.tencent.mm.plugin.card.d.k; import com.tencent.mm.plugin.card.d.l; import com.tencent.mm.plugin.card.model.CardInfo; import com.tencent.mm.plugin.card.model.aa; import com.tencent.mm.plugin.card.model.af; import com.tencent.mm.plugin.card.model.am; import com.tencent.mm.plugin.card.model.o; import com.tencent.mm.plugin.card.model.r; import com.tencent.mm.plugin.card.model.t; import com.tencent.mm.plugin.card.model.v; import com.tencent.mm.plugin.card.sharecard.model.ShareCardInfo; import com.tencent.mm.plugin.card.sharecard.ui.CardConsumeSuccessUI; import com.tencent.mm.plugin.card.ui.e.1; import com.tencent.mm.plugin.card.ui.e.5; import com.tencent.mm.plugin.card.ui.j.2; import com.tencent.mm.plugin.card.ui.j.3; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.protocal.c.bmv; import com.tencent.mm.protocal.c.bnk; import com.tencent.mm.protocal.c.bqs; import com.tencent.mm.protocal.c.kx; import com.tencent.mm.protocal.c.la; import com.tencent.mm.protocal.c.lg; import com.tencent.mm.sdk.platformtools.ad; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.sdk.platformtools.aw; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.base.MMVerticalTextView; import com.tencent.mm.ui.base.p; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.LinkedList; import org.json.JSONArray; import org.json.JSONObject; public class CardDetailUI extends CardDetailBaseUI implements e, a, d.a, j.a, aw.a { private final String TAG = "MicroMsg.CardDetailUI"; private float cXm = -85.0f; private float cXn = -1000.0f; private com.tencent.mm.modelgeo.a.a cXs = new 1(this); private c dMm; private String dxx = ""; private p fUo = null; private boolean hAj = false; e hBC; private String hBD = ""; private String hBE = ""; private String hBF = ""; private boolean hBG = false; private boolean hBH = false; private boolean hBI = false; private String hBJ = ""; private e.a hBK; private boolean hBL = false; private boolean hBM = true; private boolean hBN = false; private boolean hBO = false; private String hBP = ""; private i hBQ = new i(); private int hBg = 0; private String hBh = ""; private String hBi = ""; private String hBj = ""; private Vibrator hni; private int hop = 3; private String htC = ""; private b htQ; private ArrayList<la> htW; private String huQ = ""; private boolean hvg = false; private int hza = -1; private boolean hzn = false; ag mHandler = new ag(); private long mStartTime = 0; static /* synthetic */ void i(CardDetailUI cardDetailUI) { int i; cardDetailUI.dO(true); bmv bmv = new bmv(); if (cardDetailUI.hop == 3) { bmv.cac = cardDetailUI.htC; i = 1; } else { bmv.huU = cardDetailUI.htC; i = 0; } bmv.cad = cardDetailUI.hBF; bmv.qZO = cardDetailUI.hBh; bmv.qZN = cardDetailUI.hBi; bmv.qZP = cardDetailUI.hBg; LinkedList linkedList = new LinkedList(); linkedList.add(bmv); bnk f = l.f(cardDetailUI.hBC.hzB, cardDetailUI.hBC.hzE, cardDetailUI.hBC.hzF); bqs bqs = new bqs(); bqs.soQ = cardDetailUI.dxx; bqs.hwj = cardDetailUI.hBJ; x.i("MicroMsg.CardDetailUI", "ShareCardItem upload templateId:%s", new Object[]{cardDetailUI.dxx}); g.Eh().dpP.a(new com.tencent.mm.plugin.card.sharecard.model.g(i, linkedList, cardDetailUI.htQ.awm().rnD, cardDetailUI.hBj, f, cardDetailUI.hop, bqs), 0); } static /* synthetic */ void j(CardDetailUI cardDetailUI) { LinkedList linkedList = new LinkedList(); linkedList.add(cardDetailUI.htC); cardDetailUI.dO(true); g.Eh().dpP.a(new r(linkedList), 0); } static /* synthetic */ void k(CardDetailUI cardDetailUI) { cardDetailUI.dO(true); String awr = (cardDetailUI.hop == 6 || TextUtils.isEmpty(cardDetailUI.htQ.awr())) ? cardDetailUI.htC : cardDetailUI.htQ.awr(); int ayE = cardDetailUI.hBC.ayE(); bqs bqs = new bqs(); bqs.soQ = cardDetailUI.dxx; bqs.hwj = cardDetailUI.hBJ; x.i("MicroMsg.CardDetailUI", "AcceptItemInfo templateId:%s", new Object[]{cardDetailUI.dxx}); g.Eh().dpP.a(new o(awr, cardDetailUI.hop, cardDetailUI.hBD, cardDetailUI.hBF, cardDetailUI.hBh, cardDetailUI.hBi, cardDetailUI.hBg, ayE, bqs), 0); } protected final int getLayoutId() { return com.tencent.mm.plugin.card.a.e.card_detail_ui; } public void onCreate(Bundle bundle) { super.onCreate(bundle); this.mStartTime = System.currentTimeMillis(); ayh(); d axt = am.axt(); ActionBarActivity actionBarActivity = this.mController.tml; g.Eh().dpP.a(910, axt); am.axp().a(axt); com.tencent.mm.plugin.card.b.b axh = am.axh(); if (axh.htB == null) { axh.htB = new ArrayList(); } if (axt != null) { axh.htB.add(new WeakReference(axt)); } axt.Wv = new WeakReference(actionBarActivity); am.axt().a(this); am.axu().a(this); com.tencent.mm.plugin.card.b.c axv = am.axv(); g.Eh().dpP.a(577, axv); axv.htD.clear(); axv.htE = 0; am.axv().a(this); initView(); } protected void onResume() { super.onResume(); ayh(); if (this.dMm != null) { this.dMm.a(this.cXs, true); } this.hBC.bPd = false; aw.a(this, this); am.axt().a(this, true); if ((this.hBG || this.hBH) && this.htQ.avS()) { if (this.htQ.awf()) { am.axu().aX(this.htC, 2); Boolean bool = (Boolean) am.axt().htP.get(this.htC); boolean z = bool != null && bool.booleanValue(); if (!z || TextUtils.isEmpty(am.axt().htS)) { x.i("MicroMsg.CardDetailUI", "onResume, not need launch succ ui or jsonRet is empty!"); } else { x.i("MicroMsg.CardDetailUI", "onResume, do launch succ UI!"); xe(am.axt().htS); } this.hBC.hCa.d(com.tencent.mm.plugin.card.d.c.hIz); } else { am.axu().aX(this.htC, 1); com.tencent.mm.plugin.card.ui.view.g gVar = this.hBC.hCa; if (gVar != null) { gVar.d(com.tencent.mm.plugin.card.d.c.hIz); } } } if (this.hBQ.huc) { this.hBQ.start(); } } protected void onPause() { ayi(); super.onPause(); this.hBC.bPd = true; am.axt().a(this, false); aw.a(this, null); i iVar = this.hBQ; if (iVar.awQ()) { x.i("MicroMsg.CardLbsOrBluetooth", "stop"); if (iVar.huk != null) { iVar.huk.awT(); } iVar.awO(); g.Eh().dpP.b(2574, iVar); } } public final void aou() { com.tencent.mm.plugin.card.ui.view.g gVar = this.hBC.hCa; if (gVar != null) { gVar.azM(); } } protected void onDestroy() { am.axt().c(this); ayi(); am.axt().b(this); am.axt().release(); am.axu().b(this); am.axv().b(this); am.axv().release(); e eVar = this.hBC; f fVar = eVar.hCo; fVar.htQ = null; fVar.htU.clear(); eVar.hCo = null; j jVar = eVar.hCm; l.x(jVar.hGf); for (int size = jVar.hGm.size() - 1; size >= 0; size--) { l.x((Bitmap) jVar.hGm.remove(size)); } jVar.hGm.clear(); if (jVar.eZB.isShowing()) { jVar.eZB.dismiss(); } jVar.eZB = null; jVar.ayT(); jVar.fcq = null; jVar.htQ = null; eVar.hCm = null; if (eVar.hBZ != null) { eVar.hBZ.release(); } eVar.hBT.geJ = null; com.tencent.mm.sdk.b.a.sFg.c(eVar.hCx); eVar.hBV.destroy(); eVar.hBY.destroy(); eVar.hBX.destroy(); eVar.hCk.destroy(); if (eVar.hCl != null) { eVar.hCl.destroy(); } if (eVar.hCd != null) { eVar.hCd.destroy(); } if (eVar.hCc != null) { eVar.hCc.destroy(); } if (eVar.hCe != null) { eVar.hCe.destroy(); } if (eVar.hCf != null) { eVar.hCf.destroy(); } if (eVar.hCg != null) { eVar.hCg.destroy(); } if (eVar.hCh != null) { eVar.hCh.destroy(); } if (eVar.hCi != null) { eVar.hCi.destroy(); } if (eVar.hCj != null) { eVar.hCj.destroy(); } if (eVar.hCa != null) { eVar.hCa.destroy(); } eVar.hBU = null; com.tencent.mm.plugin.card.b.g axy = am.axy(); if (axy.htB != null && eVar != null) { for (int i = 0; i < axy.htB.size(); i++) { WeakReference weakReference = (WeakReference) axy.htB.get(i); if (weakReference != null) { com.tencent.mm.plugin.card.b.g.a aVar = (com.tencent.mm.plugin.card.b.g.a) weakReference.get(); if (aVar != null && aVar.equals(eVar)) { axy.htB.remove(weakReference); break; } } } } am.axy().release(); this.hni.cancel(); avL(); long currentTimeMillis = System.currentTimeMillis() - this.mStartTime; if (this.htQ != null) { h.mEJ.h(13219, new Object[]{"CardDetailView", Integer.valueOf(this.hop), this.htQ.awr(), this.htQ.awq(), Long.valueOf(currentTimeMillis)}); } else { h.mEJ.h(13219, new Object[]{"CardDetailView", Integer.valueOf(this.hop), this.htC, this.htC, Long.valueOf(currentTimeMillis)}); } if ((this.hBG || this.hBH) && this.htQ != null && this.htQ.avS()) { if (this.htQ.awf()) { am.axu().aX(this.htC, 2); } else { am.axu().aX(this.htC, 1); } } i iVar = this.hBQ; x.i("MicroMsg.CardLbsOrBluetooth", "uninit"); if (iVar.huk != null) { i.a aVar2 = iVar.huk; if (aVar2.fKZ == null) { x.e("MicroMsg.CardLbsOrBluetooth", "bluetoothStateListener null, return"); } else { ad.getContext().unregisterReceiver(aVar2.fKZ); aVar2.fKZ = null; } iVar.huk = null; } iVar.awO(); iVar.hup = null; iVar.hub = null; super.onDestroy(); } private void ayh() { g.Eh().dpP.a(645, this); g.Eh().dpP.a(651, this); g.Eh().dpP.a(563, this); g.Eh().dpP.a(652, this); g.Eh().dpP.a(560, this); g.Eh().dpP.a(699, this); g.Eh().dpP.a(902, this); g.Eh().dpP.a(904, this); g.Eh().dpP.a(1163, this); } private void ayi() { g.Eh().dpP.b(645, this); g.Eh().dpP.b(651, this); g.Eh().dpP.b(563, this); g.Eh().dpP.b(652, this); g.Eh().dpP.b(560, this); g.Eh().dpP.b(699, this); g.Eh().dpP.b(902, this); g.Eh().dpP.b(904, this); g.Eh().dpP.b(1163, this); } protected final void initView() { boolean z; setBackBtn(new 2(this)); this.hni = (Vibrator) getSystemService("vibrator"); if (this.hBC == null) { this.hBC = new e(this, this.mController.contentView); e eVar = this.hBC; eVar.hCm = new j(eVar.hBT); j jVar = eVar.hCm; jVar.hyW = jVar.fcq.getWindow().getAttributes().screenBrightness; if (jVar.eZB == null) { View inflate = View.inflate(jVar.fcq, com.tencent.mm.plugin.card.a.e.card_popup_window, null); jVar.eZD = inflate.findViewById(com.tencent.mm.plugin.card.a.d.popupwd_qrcode_layout); jVar.eZC = (ImageView) inflate.findViewById(com.tencent.mm.plugin.card.a.d.popupwd_qrcode_iv); jVar.hGg = (TextView) inflate.findViewById(com.tencent.mm.plugin.card.a.d.popupwd_qrcode_tv); jVar.hGh = (TextView) inflate.findViewById(com.tencent.mm.plugin.card.a.d.popupwd_qrcode_tips_tv); jVar.hGi = inflate.findViewById(com.tencent.mm.plugin.card.a.d.popupwd_barcode_layout); jVar.hGj = (ImageView) inflate.findViewById(com.tencent.mm.plugin.card.a.d.popupwd_barcode_iv); jVar.hGk = (MMVerticalTextView) inflate.findViewById(com.tencent.mm.plugin.card.a.d.vertical_barcode_text); jVar.hGl = (MMVerticalTextView) inflate.findViewById(com.tencent.mm.plugin.card.a.d.vertical_barcode_tips_text); inflate.setOnClickListener(new 2(jVar)); jVar.eZB = new com.tencent.mm.ui.base.o(inflate, -1, -1, true); jVar.eZB.update(); jVar.eZB.setBackgroundDrawable(new ColorDrawable(16777215)); jVar.eZB.setOnDismissListener(new 3(jVar)); } eVar.hCo = new f(eVar.hBT); eVar.hBT.geJ = eVar; com.tencent.mm.sdk.b.a.sFg.b(eVar.hCx); eVar = this.hBC; if (eVar.hBV == null) { eVar.hBV = new com.tencent.mm.plugin.card.ui.view.x(); eVar.hBV.a(eVar); } if (eVar.hBX == null) { eVar.hBX = new com.tencent.mm.plugin.card.ui.view.o(); eVar.hBX.a(eVar); } if (eVar.hBY == null) { eVar.hBY = new com.tencent.mm.plugin.card.ui.view.a(); eVar.hBY.a(eVar); } eVar.CU = (ListView) eVar.findViewById(com.tencent.mm.plugin.card.a.d.cell_list); eVar.hCb = new m(eVar.hBT.mController.tml); eVar.hCb.hGS = eVar.eZF; eVar.CU.setAdapter(eVar.hCb); eVar.hCb.notifyDataSetChanged(); eVar.CU.setOnItemClickListener(new 1(eVar)); x.i("MicroMsg.CardDetailUIContoller", "initMenu"); eVar.hBT.hBw.setOnClickListener(new 5(eVar)); eVar.bo = (LinearLayout) eVar.findViewById(com.tencent.mm.plugin.card.a.d.header_view); eVar.hCk = new com.tencent.mm.plugin.card.ui.view.d(); eVar.hCk.a(eVar); eVar.hCm.htQ = eVar.htQ; } int intExtra = getIntent().getIntExtra("key_from_scene", -1); x.i("MicroMsg.CardDetailUI", "scene:%d", new Object[]{Integer.valueOf(intExtra)}); String stringExtra; com.tencent.mm.plugin.card.model.d xQ; if (intExtra == 2 || intExtra == 6 || intExtra == 5) { this.hop = intExtra; stringExtra = getIntent().getStringExtra("key_card_app_msg"); xQ = com.tencent.mm.plugin.card.d.g.xQ(stringExtra); if (xQ != null) { this.htC = xQ.cac; this.hBD = xQ.hwf; this.hBF = xQ.cad; int i = xQ.hwi; x.i("MicroMsg.CardDetailUI", "scene is " + intExtra + ", isRecommend is " + i); if (i == 1 && intExtra == 2) { this.hop = 23; } this.hBJ = xQ.hwj; x.i("MicroMsg.CardDetailUI", "recommend_card_id is " + this.hBJ); } this.hBE = com.tencent.mm.plugin.card.d.g.xR(stringExtra); } else if (l.oa(intExtra) || intExtra == 0 || intExtra == 1 || intExtra == 3 || intExtra == 4 || intExtra == 9 || intExtra == 12 || intExtra == 15 || intExtra == 17 || intExtra == 21) { this.hop = intExtra; this.htC = getIntent().getStringExtra("key_card_id"); this.hBF = getIntent().getStringExtra("key_card_ext"); this.hvg = getIntent().getBooleanExtra("key_is_share_card", false); this.hBg = getIntent().getIntExtra("key_stastic_scene", 0); this.hBj = getIntent().getStringExtra("key_consumed_card_id"); if (intExtra == 7 || intExtra == 16) { this.hBh = getIntent().getStringExtra("src_username"); this.hBi = getIntent().getStringExtra("js_url"); this.dxx = getIntent().getStringExtra("key_template_id"); } else if (this.hvg && intExtra == 3) { this.huQ = getIntent().getStringExtra("key_card_tp_id"); this.htC = com.tencent.mm.plugin.card.sharecard.a.b.cd(this.htC, this.huQ); } else if (intExtra == 8) { this.hBL = getIntent().getBooleanExtra("key_is_sms_add_card", false); } } else if (intExtra == 50 || intExtra == 27) { this.hop = getIntent().getIntExtra("key_previous_scene", 50); if (!(this.hop == 26 || this.hop == 27)) { this.hop = 3; } this.dxx = getIntent().getStringExtra("key_template_id"); if (this.hop == 27) { b bVar = (b) getIntent().getParcelableExtra("key_card_info"); if (bVar != null) { this.htQ = bVar; this.htC = this.htQ.awq(); ayj(); aym(); if (this.htQ.awg()) { am.axv().xc(this.htQ.awq()); } axM(); } ayk(); l.azQ(); } else { LinkedList bb = k.bb(getIntent().getStringExtra("card_list"), this.hop); if (bb == null || bb.size() == 0) { x.e("MicroMsg.CardDetailUI", "initData tempList size is empty"); dS(true); } else { dO(true); this.htC = ((lg) bb.get(0)).huU; intExtra = getIntent().getIntExtra("key_previous_scene", 51); bqs bqs = new bqs(); bqs.soQ = this.dxx; x.i("MicroMsg.CardDetailUI", "doBatchGetCardItemByTpInfo templateId:%s", new Object[]{this.dxx}); g.Eh().dpP.a(new t(bb, bqs, intExtra), 0); } ayj(); } this.hBC.a(this.htQ, this.hBK, this.htW); this.hBC.hCu = new 3(this); x.i("MicroMsg.CardDetailUI", "checkPermission checkLocation[%b]", new Object[]{Boolean.valueOf(com.tencent.mm.pluginsdk.permission.a.a(this, "android.permission.ACCESS_COARSE_LOCATION", 69, null, null))}); this.hAj = z; if (!this.hAj) { this.dMm = c.OB(); avJ(); } } else if (intExtra == 51) { if (getIntent().getIntExtra("key_previous_scene", 51) == 26) { this.hop = 26; } else { this.hop = 3; } this.htC = getIntent().getStringExtra("key_card_id"); this.htQ = am.axn().hts; if (this.htQ == null) { this.htQ = am.axi().xm(this.htC); } ayj(); if (this.htQ == null) { x.e("MicroMsg.CardDetailUI", "initData, mCardId is null from scene == ConstantsProtocal.MM_CARD_ITEM_FROM_SCENE_VIEW_UI"); dS(true); } else { aym(); axM(); ayk(); if (this.htQ.awg()) { am.axv().xc(this.htQ.awq()); } } this.hBC.a(this.htQ, this.hBK, this.htW); this.hBC.hCu = new 3(this); x.i("MicroMsg.CardDetailUI", "checkPermission checkLocation[%b]", new Object[]{Boolean.valueOf(com.tencent.mm.pluginsdk.permission.a.a(this, "android.permission.ACCESS_COARSE_LOCATION", 69, null, null))}); this.hAj = z; if (!this.hAj) { this.dMm = c.OB(); avJ(); } } else if (intExtra == 26) { this.hop = intExtra; this.htC = getIntent().getStringExtra("key_card_id"); this.hBF = getIntent().getStringExtra("key_card_ext"); } else { this.hop = intExtra; stringExtra = getIntent().getStringExtra("key_card_app_msg"); xQ = com.tencent.mm.plugin.card.d.g.xQ(stringExtra); if (xQ != null) { this.htC = xQ.cac; this.hBD = xQ.hwf; this.hBF = xQ.cad; } this.hBE = com.tencent.mm.plugin.card.d.g.xR(stringExtra); } ayj(); if (TextUtils.isEmpty(this.htC)) { x.e("MicroMsg.CardDetailUI", "initData, mCardId is null"); dS(true); } else { if (intExtra == 2 || intExtra == 6 || ((intExtra == 4 && !this.hvg) || intExtra == 5 || intExtra == 17 || intExtra == 21 || intExtra == 23)) { z = true; } else if (intExtra == 15) { Object value = am.axn().getValue("key_accept_card_info"); if (value == null || !(value instanceof CardInfo)) { z = true; } else { this.htQ = (CardInfo) value; z = false; } } else if (this.hvg) { this.htQ = am.axq().xC(this.htC); z = false; } else { this.htQ = am.axi().xm(this.htC); z = false; } if (z || this.htQ == null) { x.i("MicroMsg.CardDetailUI", "initData fail, isNeedDoNetScene1 is true or no cardinfo with cardId = " + this.htC + " isShareCard is " + this.hvg); dO(true); if (this.hvg) { ayn(); } else { ayl(); } } else { x.d("MicroMsg.CardDetailUI", "initData(), cardId = " + this.htC); la awp = this.htQ.awp(); if (awp != null) { this.htW = new ArrayList(); this.htW.add(awp); } axM(); if (this.htQ.awg()) { am.axv().xc(this.htQ.awq()); } if (this.hvg) { this.hBM = true; z = true; } else { if (((long) ((int) (System.currentTimeMillis() / 1000))) - this.htQ.awt() >= 86400) { this.hBM = true; z = true; } else if (this.htQ.awd()) { this.hBM = true; z = true; } } if (z) { x.i("MicroMsg.CardDetailUI", "initData fail, isNeedDoNetScene2 is true or no cardinfo with cardId = " + this.htC + " isShareCard is " + this.hvg); if (this.hvg) { ayn(); } else { ayl(); } } else { aym(); } ayk(); } } this.hBC.a(this.htQ, this.hBK, this.htW); this.hBC.hCu = new 3(this); x.i("MicroMsg.CardDetailUI", "checkPermission checkLocation[%b]", new Object[]{Boolean.valueOf(com.tencent.mm.pluginsdk.permission.a.a(this, "android.permission.ACCESS_COARSE_LOCATION", 69, null, null))}); this.hAj = z; if (!this.hAj) { this.dMm = c.OB(); avJ(); } } private void ayj() { this.hza = this.hop; this.hBK = new e.a(); this.hBK.hop = this.hop; this.hBK.hza = this.hza; this.hBK.htC = this.htC; this.hBK.hBD = this.hBD; this.hBK.hBF = this.hBF; this.hBK.hBE = this.hBE; this.hBK.hBh = this.hBh; this.hBK.hBi = this.hBi; this.hBK.hvg = this.hvg; this.hBK.hCB = getIntent().getIntExtra("key_from_appbrand_type", 0); } private void ayk() { int i = 1; if (!this.hBN && this.htQ != null) { this.hBN = true; h hVar; Object[] objArr; if (this.hvg) { hVar = h.mEJ; objArr = new Object[9]; objArr[0] = "ShareCardDetailUI"; objArr[1] = Integer.valueOf(this.htQ.awm().huV); objArr[2] = this.htQ.awr(); objArr[3] = this.htQ.awq(); objArr[4] = Integer.valueOf(0); objArr[5] = Integer.valueOf(this.hza); objArr[6] = this.hBD; if (!this.htQ.awk()) { i = 0; } objArr[7] = Integer.valueOf(i); objArr[8] = ""; hVar.h(11324, objArr); return; } hVar = h.mEJ; objArr = new Object[9]; objArr[0] = "CardDetailView"; objArr[1] = Integer.valueOf(this.htQ.awm().huV); objArr[2] = this.htQ.awr(); objArr[3] = this.htQ.awq(); objArr[4] = Integer.valueOf(0); objArr[5] = Integer.valueOf(this.hza); objArr[6] = this.hBD; if (!this.htQ.awk()) { i = 0; } objArr[7] = Integer.valueOf(i); objArr[8] = ""; hVar.h(11324, objArr); } } private void axM() { this.hBK.hop = this.hop; this.hBK.hza = this.hza; this.hBK.htC = this.htC; this.hBC.a(this.htQ, this.hBK, this.htW); this.hBC.axM(); am.axt().htQ = this.htQ; } public final void a(int i, int i2, String str, com.tencent.mm.ab.l lVar) { x.i("MicroMsg.CardDetailUI", "onSceneEnd, errType = " + i + " errCode = " + i2); int i3; if (i == 0 && i2 == 0) { dO(false); b bVar; CardInfo cardInfo; Object obj; int i4; String str2; Integer num; Intent intent; ShareCardInfo xC; if (lVar instanceof aa) { Object obj2 = ((aa) lVar).hwU; if (TextUtils.isEmpty(obj2)) { x.e("MicroMsg.CardDetailUI", "onSceneEnd, NetSceneGetCardItemInfo return json is null"); return; } bVar = this.htQ; cardInfo = new CardInfo(); com.tencent.mm.plugin.card.d.f.a(cardInfo, obj2); if (!TextUtils.isEmpty(cardInfo.awq())) { this.htC = cardInfo.awq(); } else if (TextUtils.isEmpty(cardInfo.awq()) && !this.htC.equals(cardInfo.awr())) { x.e("MicroMsg.CardDetailUI", "mCardId:%s, mCardTpId:%s is different, error", new Object[]{this.htC, cardInfo.awr()}); return; } this.htQ = cardInfo; aym(); if (this.hop == 3) { if (bVar != null) { ((CardInfo) this.htQ).field_stickyAnnouncement = ((CardInfo) bVar).field_stickyAnnouncement; ((CardInfo) this.htQ).field_stickyEndTime = ((CardInfo) bVar).field_stickyEndTime; ((CardInfo) this.htQ).field_stickyIndex = ((CardInfo) bVar).field_stickyIndex; ((CardInfo) this.htQ).field_label_wording = ((CardInfo) bVar).field_label_wording; this.htQ.a(bVar.awp()); } if (this.hBM) { l.j(this.htQ); } else { x.e("MicroMsg.CardDetailUI", "onSceneEnd(), NetSceneGetCardItemInfo updateDataToDB is false"); } } axM(); ayk(); if (this.htQ.awg()) { am.axv().xc(this.htQ.awq()); } this.hBQ.a(this, this.htC, this.htQ, this.cXm, this.cXn); return; } else if (lVar instanceof o) { if (this.hza == 26) { dO(false); } obj = ((o) lVar).hwU; i4 = ((o) lVar).hwV; str2 = ((o) lVar).hwW; if (i4 != 0) { b(i2, str, i4, str2); } else { com.tencent.mm.ui.base.h.bA(this, getResources().getString(com.tencent.mm.plugin.card.a.g.card_add_card_pack)); } if (TextUtils.isEmpty(obj)) { x.e("MicroMsg.CardDetailUI", "onSceneEnd, NetSceneAcceptCardItem return json is null"); return; } this.hop = 3; if (this.htQ == null) { this.htQ = new CardInfo(); } com.tencent.mm.plugin.card.d.f.a((CardInfo) this.htQ, obj); if (!TextUtils.isEmpty(this.htQ.awq())) { this.htC = this.htQ.awq(); } if (this.hBC.ayE() == 1) { e eVar = this.hBC; if (eVar.hCo != null) { f fVar = eVar.hCo; if (fVar.htV != null) { fVar.htV.hvj = false; } } } if (this.hza != 26) { aym(); axM(); } l.azQ(); b bVar2 = this.htQ; if (bVar2.avT()) { num = (Integer) g.Ei().DT().get(com.tencent.mm.storage.aa.a.sQf, Integer.valueOf(0)); if (num == null || num.intValue() != 1) { g.Ei().DT().a(com.tencent.mm.storage.aa.a.sQf, Integer.valueOf(1)); } this.hBP = this.htQ.aww(); if (this.hza != 7 || this.hza == 16) { intent = new Intent(); intent.putExtra("key_code", this.hBP); setResult(-1, intent); nT(-1); } else if (!this.hBL && this.hza == 8) { dS(true); } else if (this.hza == 26 && i4 == 0) { dS(true); } if (this.htQ.awg()) { am.axv().xc(this.htQ.awq()); } this.hBQ.a(this, this.htC, this.htQ, this.cXm, this.cXn); return; } num = (Integer) g.Ei().DT().get(282884, null); if (num == null || num.intValue() != 1) { g.Ei().DT().set(282884, Integer.valueOf(1)); } this.hBP = this.htQ.aww(); if (this.hza != 7) { } intent = new Intent(); intent.putExtra("key_code", this.hBP); setResult(-1, intent); nT(-1); if (this.htQ.awg()) { am.axv().xc(this.htQ.awq()); } this.hBQ.a(this, this.htC, this.htQ, this.cXm, this.cXn); return; if (l.azT()) { com.tencent.mm.plugin.card.d.d.c(this, com.tencent.mm.plugin.card.a.e.card_show_accepted_tips_for_share, com.tencent.mm.plugin.card.a.g.card_accepted_title_for_share, bVar2.awm().hwg); } else { com.tencent.mm.plugin.card.d.d.c(this, com.tencent.mm.plugin.card.a.e.card_show_accepted_tips, com.tencent.mm.plugin.card.a.g.card_accepted_title, bVar2.awm().hwg); } this.hBP = this.htQ.aww(); if (this.hza != 7) { } intent = new Intent(); intent.putExtra("key_code", this.hBP); setResult(-1, intent); nT(-1); if (this.htQ.awg()) { am.axv().xc(this.htQ.awq()); } this.hBQ.a(this, this.htC, this.htQ, this.cXm, this.cXn); return; } else if (lVar instanceof v) { this.htW = ((v) lVar).hxd; if (this.htQ != null && this.htW != null && this.htW.size() > 0) { this.htQ.a((la) this.htW.get(0)); axM(); if (this.htQ.avS()) { ShareCardInfo xC2 = am.axq().xC(this.htC); if (xC2 != null) { xC2.a((la) this.htW.get(0)); am.axq().c(xC2, new String[]{this.htC}); return; } return; } cardInfo = am.axi().xm(this.htC); if (cardInfo != null) { cardInfo.a((la) this.htW.get(0)); am.axi().c(cardInfo, new String[]{this.htC}); return; } return; } else if (this.htQ != null && this.htW == null) { this.htQ.a(null); axM(); if (this.htQ.avS()) { xC = am.axq().xC(this.htC); if (xC != null) { xC.a(null); am.axq().c(xC, new String[]{this.htC}); return; } return; } CardInfo xm = am.axi().xm(this.htC); if (xm != null) { xm.a(null); am.axi().c(xm, new String[]{this.htC}); return; } return; } else { return; } } else if (lVar instanceof af) { i3 = ((af) lVar).hwV; str2 = ((af) lVar).hwW; if (i3 == 10000) { if (TextUtils.isEmpty(str2)) { str2 = getString(com.tencent.mm.plugin.card.a.g.card_gift_failed_tips); } com.tencent.mm.plugin.card.d.d.b(this, str2); return; } this.hBF = ((af) lVar).cad; dR(true); kx awn = this.htQ.awn(); awn.status = 3; this.htQ.a(awn); l.j(this.htQ); axM(); if (this.hza == 3) { dS(true); return; } else if (this.hza == 15) { com.tencent.mm.sdk.b.a.sFg.m(new pf()); return; } else { return; } } else if (lVar instanceof r) { com.tencent.mm.ui.base.h.bA(this, getResources().getString(com.tencent.mm.plugin.card.a.g.card_delete_success_tips)); am.axh(); com.tencent.mm.plugin.card.b.b.nG(4); dS(true); return; } else if (lVar instanceof t) { LinkedList linkedList = ((t) lVar).hxb; if (linkedList != null && linkedList.size() > 0) { b bVar3 = (b) linkedList.get(0); if (bVar3 == null || this.htC.equals(bVar3.awr())) { this.htQ = bVar3; if (this.htQ != null) { this.htC = this.htQ.awq(); aym(); if (this.htQ.awg()) { am.axv().xc(this.htQ.awq()); } } if (this.hop == 26) { this.hop = 3; } axM(); } else { x.e("MicroMsg.CardDetailUI", "mCardId:%s, mCardTpId:%s is different, error", new Object[]{this.htC, bVar3.awr()}); return; } } ayk(); l.azQ(); return; } else if (lVar instanceof com.tencent.mm.plugin.card.sharecard.model.g) { obj = ((com.tencent.mm.plugin.card.sharecard.model.g) lVar).hwU; i4 = ((com.tencent.mm.plugin.card.sharecard.model.g) lVar).hwV; str2 = ((com.tencent.mm.plugin.card.sharecard.model.g) lVar).hwW; if (i4 != 0) { if (TextUtils.isEmpty(str2)) { str2 = getString(com.tencent.mm.plugin.card.a.g.card_accept_fail_tips); } com.tencent.mm.plugin.card.d.d.b(this, str2); x.e("MicroMsg.CardDetailUI", "NetSceneShareCardItem onSceneEnd, accept card error, ret_msg:%s", new Object[]{str2}); return; } com.tencent.mm.ui.base.h.bA(this, getResources().getString(com.tencent.mm.plugin.card.a.g.card_accept_success_tips)); if (TextUtils.isEmpty(obj)) { x.e("MicroMsg.CardDetailUI", "NetSceneShareCardItem onSceneEnd, json is null"); return; } this.hop = 3; if (this.htQ == null) { this.htQ = new ShareCardInfo(); } else if (this.htQ instanceof CardInfo) { this.htQ = new ShareCardInfo(); } com.tencent.mm.plugin.card.d.f.a((ShareCardInfo) this.htQ, obj); xC = (ShareCardInfo) this.htQ; if (TextUtils.isEmpty(obj)) { x.e("MicroMsg.CardInfoParser", "parserShareCardItemEncryptCodeForSingle jsonContent is null"); } else { try { JSONArray optJSONArray = new JSONObject(obj).optJSONArray("card_list"); if (optJSONArray != null) { xC.huZ = optJSONArray.optJSONObject(0).optString("encrypt_code"); x.i("MicroMsg.CardInfoParser", "encrypt_code:" + xC.huZ); } } catch (Throwable e) { x.printErrStackTrace("MicroMsg.CardInfoParser", e, "", new Object[0]); x.e("MicroMsg.CardInfoParser", e.getMessage()); } } if (!TextUtils.isEmpty(this.htQ.awq())) { this.htC = this.htQ.awq(); } if (TextUtils.isEmpty(this.htQ.aws())) { ((ShareCardInfo) this.htQ).field_from_username = q.GF(); } l.a((ShareCardInfo) this.htQ); aym(); axM(); l.azS(); am.axp().auM(); this.hBP = this.htQ.aww(); if (this.hza == 7 || this.hza == 16) { intent = new Intent(); intent.putExtra("key_code", this.hBP); setResult(-1, intent); nT(-1); } else if (!this.hBL && this.hza == 8) { dS(true); } num = (Integer) g.Ei().DT().get(com.tencent.mm.storage.aa.a.sQd, Integer.valueOf(0)); if (num == null || num.intValue() != 1) { g.Ei().DT().a(com.tencent.mm.storage.aa.a.sQd, Integer.valueOf(1)); com.tencent.mm.plugin.card.d.d.c(this, com.tencent.mm.plugin.card.a.e.card_show_share_card_tips, com.tencent.mm.plugin.card.a.g.card_share_card_tips_title, ""); } if (this.htQ.awg()) { am.axv().xc(this.htQ.awq()); return; } return; } else if (lVar instanceof com.tencent.mm.plugin.card.sharecard.model.c) { obj = ((com.tencent.mm.plugin.card.sharecard.model.c) lVar).hwU; if (TextUtils.isEmpty(obj)) { x.e("MicroMsg.CardDetailUI", "onSceneEnd, NetSceneGetShareCard json is null"); return; } bVar = this.htQ; this.htQ = new ShareCardInfo(); xC = (ShareCardInfo) this.htQ; if (TextUtils.isEmpty(obj)) { x.e("MicroMsg.CardInfoParser", "parserShareCardItemJson jsonContent is null"); } else { try { com.tencent.mm.plugin.card.d.f.a(xC, new JSONObject(obj)); } catch (Throwable e2) { x.printErrStackTrace("MicroMsg.CardInfoParser", e2, "", new Object[0]); } } if (bVar != null) { if (!TextUtils.isEmpty(bVar.aws())) { ((ShareCardInfo) this.htQ).field_from_username = ((ShareCardInfo) bVar).field_from_username; } ((ShareCardInfo) this.htQ).field_app_id = ((ShareCardInfo) bVar).field_app_id; ((ShareCardInfo) this.htQ).field_consumer = ((ShareCardInfo) bVar).field_consumer; ((ShareCardInfo) this.htQ).field_share_time = ((ShareCardInfo) bVar).field_share_time; ((ShareCardInfo) this.htQ).field_updateTime = ((ShareCardInfo) bVar).field_updateTime; ((ShareCardInfo) this.htQ).field_begin_time = ((ShareCardInfo) bVar).field_begin_time; ((ShareCardInfo) this.htQ).field_end_time = ((ShareCardInfo) bVar).field_end_time; ((ShareCardInfo) this.htQ).field_block_mask = ((ShareCardInfo) bVar).field_block_mask; this.htQ.a(bVar.awp()); ((ShareCardInfo) this.htQ).field_categoryType = ((ShareCardInfo) bVar).field_categoryType; ((ShareCardInfo) this.htQ).field_itemIndex = ((ShareCardInfo) bVar).field_itemIndex; if (((ShareCardInfo) bVar).field_status != ((ShareCardInfo) this.htQ).field_status) { x.i("MicroMsg.CardDetailUI", "getsharecared return, the status is " + ((ShareCardInfo) this.htQ).field_status); com.tencent.mm.plugin.card.sharecard.a.b.a(this, this.htQ); } } if (!TextUtils.isEmpty(this.htQ.awq())) { this.htC = this.htQ.awq(); } axM(); aym(); ayk(); if (this.hop == 3) { if (this.hBM) { l.j(this.htQ); } else { x.e("MicroMsg.CardDetailUI", "onSceneEnd() sharecard updateDataToDB is false"); } } if (this.htQ.awg()) { am.axv().xc(this.htQ.awq()); return; } return; } else if (!(lVar instanceof com.tencent.mm.plugin.card.sharecard.model.a)) { return; } else { if (((com.tencent.mm.plugin.card.sharecard.model.a) lVar).hwV != 0) { com.tencent.mm.plugin.card.d.d.b(this, getString(com.tencent.mm.plugin.card.a.g.card_delete_fail_tips)); return; } x.i("MicroMsg.CardDetailUI", "delete share card, card id is " + this.htQ.awq()); com.tencent.mm.plugin.card.sharecard.a.b.a(this, this.htQ); com.tencent.mm.ui.base.h.bA(this, getResources().getString(com.tencent.mm.plugin.card.a.g.card_delete_success_tips)); am.axp().axD(); dS(true); return; } } CharSequence charSequence; x.e("MicroMsg.CardDetailUI", "onSceneEnd, errType = " + i + " errCode = " + i2 + " cmd:" + lVar.getType()); dO(false); Object charSequence2; if (lVar instanceof af) { dR(false); i3 = ((af) lVar).hwV; charSequence2 = ((af) lVar).hwW; if (i3 == 10000) { if (TextUtils.isEmpty(charSequence2)) { charSequence2 = getString(com.tencent.mm.plugin.card.a.g.card_gift_failed_tips); } } charSequence2 = str; } else if (lVar instanceof o) { nT(0); b(i2, str, ((o) lVar).hwV, ((o) lVar).hwW); return; } else { if (lVar instanceof v) { return; } charSequence2 = str; } if (TextUtils.isEmpty(charSequence2)) { charSequence2 = getString(com.tencent.mm.plugin.card.a.g.card_wallet_unknown_err); } Toast.makeText(this.mController.tml, charSequence2, 0).show(); } private void b(int i, String str, int i2, String str2) { x.e("MicroMsg.CardDetailUI", "handleAcceptError, errCode = " + i + " errMsg = " + str + " ret_code:" + i2 + " ret_msg:" + str2); if (i2 == 10000) { if (TextUtils.isEmpty(str2)) { str2 = getString(com.tencent.mm.plugin.card.a.g.card_accept_late); } this.htQ.awn().status = 4; axM(); } else if (i2 == 10001) { if (TextUtils.isEmpty(str2)) { str2 = getString(com.tencent.mm.plugin.card.a.g.card_accept_time_out); } this.htQ.awn().status = 5; axM(); } else if (i2 == 10002) { if (TextUtils.isEmpty(str2)) { str2 = getString(com.tencent.mm.plugin.card.a.g.card_no_stock); } } else if (TextUtils.isEmpty(str2)) { str2 = getString(com.tencent.mm.plugin.card.a.g.card_accept_fail); } com.tencent.mm.plugin.card.d.d.b(this, str2); } private void dO(boolean z) { if (z) { this.fUo = p.b(this, getString(com.tencent.mm.plugin.card.a.g.loading_tips), true, 0, null); } else if (this.fUo != null && this.fUo.isShowing()) { this.fUo.dismiss(); this.fUo = null; } } private void dR(boolean z) { if (z) { l.ck(this.hBC.hCq, this.hBC.hCp); } } private void ayl() { bqs bqs = new bqs(); bqs.soQ = this.dxx; bqs.hwj = this.hBJ; x.i("MicroMsg.CardDetailUI", "GetCardItemInfo templateId:%s", new Object[]{this.dxx}); g.Eh().dpP.a(new aa(this.htC, this.hop, this.hBD, this.hBF, this.hBh, this.hBi, this.hBg, this.hBj, bqs), 0); } private void aym() { String awr; if (!TextUtils.isEmpty(this.htQ.awr())) { awr = this.htQ.awr(); } else if (TextUtils.isEmpty(this.htC)) { x.e("MicroMsg.CardDetailUI", "doNetSceneCardShopLBS card id is null, return"); return; } else { awr = this.htC; } if (this.htQ != null && this.htQ.awm().rnK == 1) { float f = this.cXm; float f2 = this.cXn; if (f == -85.0f || f2 == -1000.0f) { f = am.axo().cXm; f2 = am.axo().cXn; } g.Eh().dpP.a(new v(awr, f2, f, this.htQ.awq()), 0); } else if (this.htQ == null || this.htQ.awm().rnK <= 1) { if (this.htQ != null) { this.htQ.a(null); axM(); if (this.htQ.avS()) { ShareCardInfo xC = am.axq().xC(this.htC); if (xC != null) { xC.a(null); am.axq().c(xC, new String[]{this.htC}); return; } return; } CardInfo xm = am.axi().xm(this.htC); if (xm != null) { xm.a(null); am.axi().c(xm, new String[]{this.htC}); } } } else if (this.cXm != -85.0f && this.cXn != -1000.0f) { this.hBO = false; g.Eh().dpP.a(new v(awr, this.cXn, this.cXm, this.htQ.awq()), 0); } else if (!this.hBO) { this.hBO = true; if (this.hAj) { avJ(); } } } private void ayn() { g.Eh().dpP.a(new com.tencent.mm.plugin.card.sharecard.model.c(this.htC), 0); } public boolean onKeyDown(int i, KeyEvent keyEvent) { if (i == 4) { x.e("MicroMsg.CardDetailUI", "onKeyDown finishUI"); dS(false); } return super.onKeyDown(i, keyEvent); } private void dS(boolean z) { if ((this.hza == 7 || this.hza == 8 || this.hza == 16 || this.hza == 26) && this.hop == 3) { Intent intent = new Intent(); intent.putExtra("key_code", this.hBP); setResult(-1, intent); if (z) { finish(); } } else if ((this.hza == 7 && this.hop == 7) || ((this.hza == 16 && this.hop == 16) || ((this.hza == 8 && this.hop == 8) || (this.hza == 26 && this.hop == 26)))) { setResult(0); if (z) { finish(); } } else if (z) { finish(); } } private void nT(int i) { if (this.hza == 7 || this.hza == 16) { LinkedList linkedList = new LinkedList(); com.tencent.mm.plugin.card.model.e eVar = new com.tencent.mm.plugin.card.model.e(); eVar.huU = this.htQ.awr(); eVar.cad = this.hBF; eVar.code = this.hBP; linkedList.add(eVar); com.tencent.mm.g.a.b bVar = new com.tencent.mm.g.a.b(); bVar.bFZ.bjW = i; if (i == -1) { bVar.bFZ.bGa = com.tencent.mm.plugin.card.d.h.a(linkedList, true, this.hza); } else { bVar.bFZ.bGa = com.tencent.mm.plugin.card.d.h.a(linkedList, false, this.hza); } com.tencent.mm.sdk.b.a.sFg.m(bVar); return; } x.i("MicroMsg.CardDetailUI", "mPreviousScene != ConstantsProtocal.MM_CARD_ITEM_FROM_SCENE_JSAPI and mPreviousScene != ConstantsProtocal.MM_CARD_ITEM_FROM_SCENE_NEARBY_PEOPLE_JSAPI ,don't push accept event"); } private void avJ() { if (this.dMm == null) { this.dMm = c.OB(); } this.dMm.a(this.cXs, true); } private void avL() { if (this.dMm != null) { this.dMm.c(this.cXs); } } private void axV() { this.dMm = c.OB(); avJ(); } public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) { x.i("MicroMsg.CardDetailUI", "summerper onRequestPermissionsResult requestCode[%d],grantResults[%d] tid[%d]", new Object[]{Integer.valueOf(i), Integer.valueOf(iArr[0]), Long.valueOf(Thread.currentThread().getId())}); switch (i) { case s$l.AppCompatTheme_listPreferredItemHeight /*69*/: if (iArr[0] == 0) { x.i("MicroMsg.CardDetailUI", "onMPermissionGranted LocationPermissionGranted " + this.hAj); if (!this.hAj) { this.hAj = true; axV(); return; } return; } com.tencent.mm.ui.base.h.a(this, getString(com.tencent.mm.plugin.card.a.g.permission_location_request_again_msg), getString(com.tencent.mm.plugin.card.a.g.permission_tips_title), getString(com.tencent.mm.plugin.card.a.g.jump_to_settings), getString(com.tencent.mm.plugin.card.a.g.confirm_dialog_cancel), false, new OnClickListener() { public final void onClick(DialogInterface dialogInterface, int i) { CardDetailUI.this.startActivity(new Intent("android.settings.MANAGE_APPLICATIONS_SETTINGS")); } }, null); return; default: return; } } private synchronized void xd(String str) { if (this.hzn) { x.e("MicroMsg.CardDetailUI", "has start CardConsumeSuccessUI!"); } else { x.i("MicroMsg.CardDetailUI", "startConsumedSuccUI() "); this.hzn = true; Intent intent = new Intent(this, CardConsumeSuccessUI.class); intent.putExtra("KEY_CARD_ID", this.htQ.awq()); intent.putExtra("KEY_CARD_CONSUMED_JSON", str); intent.putExtra("KEY_CARD_COLOR", this.htQ.awm().dxh); intent.putExtra("key_stastic_scene", this.hop); intent.putExtra("key_from_scene", 0); startActivity(intent); } } public final void f(b bVar) { if (bVar == null) { x.e("MicroMsg.CardDetailUI", "cardInfo is empty, not to do onDataChange"); } else if (this.htQ == null || !this.htQ.awq().equals(bVar.awq())) { x.e("MicroMsg.CardDetailUI", "is not the same card, not to do onDataChange"); } else if (this.hBC.ayF()) { x.i("MicroMsg.CardDetailUI", "onDataChange"); this.htQ = bVar; this.htC = this.htQ.awq(); if (this.htQ.awg() && am.axv().isEmpty()) { am.axv().xc(this.htQ.awq()); } axM(); } else { x.e("MicroMsg.CardDetailUI", "because the card is not accept, not to do onDataChange"); } } public final void awJ() { x.i("MicroMsg.CardDetailUI", "onVibrate"); this.hni.vibrate(300); } public final void awK() { x.i("MicroMsg.CardDetailUI", "onFinishUI"); } public final void xe(final String str) { if (this.hBC.ayF()) { x.i("MicroMsg.CardDetailUI", "onStartConsumedSuccUI"); this.mHandler.post(new Runnable() { public final void run() { CardDetailUI.this.xd(str); } }); return; } x.e("MicroMsg.CardDetailUI", "because the card is not accept, not to do onStartConsumedSuccUI"); } public final void b(String str, j.b bVar) { if (TextUtils.isEmpty(str) || str.equals(this.htC)) { dO(false); x.i("MicroMsg.CardDetailUI", "onMarkSuccess()"); x.i("MicroMsg.CardDetailUI", "markSucc:" + bVar.huI + " markCardId: " + bVar.huJ); this.hBH = false; if (bVar.huI != 1) { this.hBG = false; com.tencent.mm.plugin.card.d.d.b(this, getString(com.tencent.mm.plugin.card.a.g.card_mark_used)); return; } else if (TextUtils.isEmpty(bVar.huJ) || this.htQ.awq().equals(bVar.huJ)) { x.i("MicroMsg.CardDetailUI", "markCardId is same as now id!"); this.hBG = true; a(bVar); return; } else { x.i("MicroMsg.CardDetailUI", "markCardId is diff as now id!"); if (this.htQ.avS()) { ShareCardInfo xC = am.axq().xC(bVar.huJ); if (xC != null) { this.htQ = xC; this.htC = bVar.huJ; axM(); am.axt().d(this.htQ); x.i("MicroMsg.CardDetailUI", "update the mCardInfo"); this.hBG = true; a(bVar); return; } x.e("MicroMsg.CardDetailUI", "The mark card id not exist the card info in DB!, mark failed!"); com.tencent.mm.plugin.card.d.d.b(this, getString(com.tencent.mm.plugin.card.a.g.card_mark_failed_tips)); this.hBG = false; return; } return; } } x.e("MicroMsg.CardDetailUI", "onMarkSuccess(), the mark card id is diff from current id!"); } public final void bZ(String str, String str2) { if (TextUtils.isEmpty(str) || str.equals(this.htC)) { x.i("MicroMsg.CardDetailUI", "onMarkFail()"); this.hBG = false; this.hBH = false; dO(false); if (TextUtils.isEmpty(str2)) { str2 = getString(com.tencent.mm.plugin.card.a.g.card_mark_failed_tips); } com.tencent.mm.plugin.card.d.d.b(this, str2); return; } x.e("MicroMsg.CardDetailUI", "onMarkFail(), the mark card id is diff from current id!"); } public final void xh(String str) { if (TextUtils.isEmpty(str) || str.equals(this.htC)) { this.hBG = false; } else { x.e("MicroMsg.CardDetailUI", "onUnmarkSuccess(), the mark card id is diff from current id!"); } } private void a(j.b bVar) { if (this.hBC.bPd) { x.i("MicroMsg.CardDetailUI", "UI is pause, not to jumpMarkUI()"); return; } x.i("MicroMsg.CardDetailUI", "jumpMarkUI()"); this.hBC.a(this.hBI, bVar, true); } public final void awE() { x.i("MicroMsg.CardDetailUI", "code change"); if (this.hBC.hCa instanceof com.tencent.mm.plugin.card.ui.view.q) { ((com.tencent.mm.plugin.card.ui.view.q) this.hBC.hCa).hGn = am.axv().getCode(); this.hBC.axM(); } } public final void xb(String str) { if (!TextUtils.isEmpty(str)) { com.tencent.mm.plugin.card.d.d.a(this, str, true); } } public final void onSuccess() { if (this.hBC.hCa instanceof com.tencent.mm.plugin.card.ui.view.q) { ((com.tencent.mm.plugin.card.ui.view.q) this.hBC.hCa).hGn = am.axv().getCode(); this.hBC.axM(); } x.i("MicroMsg.CardDetailUI", "code get success"); } }
package com.ps.repository; import org.springframework.data.repository.CrudRepository; import com.ps.entity.Application; /** * The Interface ApplicationRepository. */ public interface ApplicationRepository extends CrudRepository<Application, Integer> { }
package mygroup; public class Interrupted { public static void main(String[] args) throws InterruptedException { Thread sleepThread = new Thread(() -> { try { while (true) { Thread.sleep(10000); } } catch (InterruptedException e) { System.out.println("---------------"); e.printStackTrace(); Thread.currentThread().interrupt(); } }); Thread busyThread = new Thread(() -> {while (true) { /* do sth */}}); busyThread.setDaemon(true); busyThread.start(); sleepThread.start(); Thread.sleep(5000); sleepThread.interrupt(); busyThread.interrupt(); System.out.println("SleepThread : " + sleepThread.isInterrupted()); // false : 被中断以后interrupted状态复位 System.out.println("BusyThread : " + busyThread.isInterrupted() ); // true : 接受中断信号,但是不响应中断 Thread.sleep(2000); } }
package practice7; public class Result { public static void main(String[] args) { Person p1 = new Person("홍길동"); System.out.println(p1.Result(new Person("홍길동"))); System.out.println(p1.Result(new Person("최명태"))); } }
public class Sixteen { public static void main(String[] args) { double customers = 15000; double buyTwo = .18; double citrusFlavor = .58; double outComeBuyTwo; double outComeCitrustFlavor; outComeBuyTwo = customers * buyTwo; outComeCitrustFlavor = customers * citrusFlavor; System.out.printf("%6.0f people buys two or more drinks every week. \n", outComeBuyTwo); System.out.printf("%6.0f people prefer citrus flavored energy drinks. \n", outComeCitrustFlavor); } }
package algo_basic.day3; import java.util.ArrayList; import java.util.List; public class SubSetTest { private static char[] arr = {'A','B','C'}; public static void main(String[] args) { System.out.println("부분집합의 개수: " + (1<<arr.length)); for (int i = 0; i < (1<<arr.length); i++) { //System.out.println(i +": " + Integer.toBinaryString(i)); //tobinaryString 이진수 string출력 List<Character> subset = new ArrayList<>(); for (int j = 0; j < arr.length; j++) { if((i & (1<<j))>0) { // 해당 i비트를 해당하는 상황이다 subset.add(arr[j]); } } System.out.println(subset); } } }
package com.pybeta.ui.widget; import android.app.Dialog; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; import com.pybeta.daymatter.R; public class SyncDialog extends Dialog implements android.view.View.OnClickListener{ private LinearLayout mBackupSdcard = null; private LinearLayout mBackupGoogle = null; private LinearLayout mRestoreSdcard = null; private LinearLayout mRestoreGoogle = null; private ISyncDialogListener mListener = null; public SyncDialog(Context context, int theme) { super(context, theme); // TODO Auto-generated constructor stub } @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.sync_dialog); mBackupSdcard = (LinearLayout)this.findViewById(R.id.backup_sdcard); mBackupGoogle = (LinearLayout)this.findViewById(R.id.backup_googledrive); mRestoreSdcard = (LinearLayout)this.findViewById(R.id.restore_sdcard); mRestoreGoogle = (LinearLayout)this.findViewById(R.id.restore_googledrive); mBackupSdcard.setOnClickListener(this); mBackupGoogle.setOnClickListener(this); mRestoreSdcard.setOnClickListener(this); mRestoreGoogle.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub if(v == mBackupSdcard){ mListener.backupSdcard(); }else if(v == mBackupGoogle){ mListener.backupGoogle(); }else if(v == mRestoreSdcard){ mListener.restoreSdcard(); }else if(v == mRestoreGoogle){ mListener.restoreGoogle(); } } public void setListener(ISyncDialogListener listener){ this.mListener = listener; } public interface ISyncDialogListener{ void backupSdcard(); void backupGoogle(); void restoreSdcard(); void restoreGoogle(); } }
package biz.burli.trump; import android.content.Intent; import android.graphics.Color; import android.os.Build; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.fujiyuu75.sequent.Sequent; import pl.droidsonroids.gif.GifTextView; public class Splash extends AppCompatActivity { /* start activity, splash screen with logo ... */ GifTextView gif; RelativeLayout xy; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); TextView title = (TextView) findViewById(R.id.trump_text); gif = (GifTextView) findViewById(R.id.gifTextView); xy = (RelativeLayout) findViewById(R.id.text); if (Build.VERSION.SDK_INT >= 21) { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); } // fadein: Sequent .origin(xy) .duration(300) // option. .start(); changeStatusBarColor(); new Handler().postDelayed(new Runnable() { @Override public void run() { gif.setVisibility(View.VISIBLE); } }, 2*1000); new Handler().postDelayed(new Runnable() { @Override public void run() { startActivity(new Intent(Splash.this, MainActivity.class)); finish(); } }, 6*1000); } private void changeStatusBarColor() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(Color.TRANSPARENT); } } }
package com.kprojekt.alonespace.activities.andengine; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import org.andengine.engine.camera.ZoomCamera; import org.andengine.engine.options.EngineOptions; import org.andengine.engine.options.ScreenOrientation; import org.andengine.entity.scene.Scene; import org.andengine.entity.scene.background.Background; import org.andengine.entity.scene.menu.MenuScene; import org.andengine.entity.scene.menu.MenuScene.IOnMenuItemClickListener; import org.andengine.entity.scene.menu.item.IMenuItem; import org.andengine.entity.scene.menu.item.TextMenuItem; import org.andengine.entity.scene.menu.item.decorator.ScaleMenuItemDecorator; import org.andengine.extension.physics.box2d.PhysicsConnector; import org.andengine.extension.physics.box2d.PhysicsFactory; import org.andengine.extension.physics.box2d.PhysicsWorld; import org.andengine.opengl.font.FontFactory; import org.andengine.opengl.texture.ITexture; import org.andengine.opengl.texture.TextureOptions; import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas; import org.andengine.opengl.texture.bitmap.BitmapTexture; import org.andengine.opengl.texture.region.TextureRegion; import org.andengine.opengl.texture.region.TextureRegionFactory; import org.andengine.opengl.vbo.VertexBufferObjectManager; import org.andengine.ui.activity.SimpleBaseGameActivity; import org.andengine.util.adt.io.in.IInputStreamOpener; import org.andengine.util.adt.list.SmartList; import org.andengine.util.debug.Debug; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.view.KeyEvent; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.Body; import com.badlogic.gdx.physics.box2d.BodyDef.BodyType; import com.kprojekt.alonespace.activities.android.ShipPartsActivity; import com.kprojekt.alonespace.data.Core; import com.kprojekt.alonespace.data.minigame.AsteroidsManager; import com.kprojekt.alonespace.data.minigame.ShipSprite; import com.kprojekt.alonespace.data.minigame.StarsLayer; import com.kprojekt.alonespace.data.model.ShipPart; /** * @author Krzysiek Bobnis */ public class MinigameActivity extends SimpleBaseGameActivity { public static ScreenOrientation orientation = ScreenOrientation.PORTRAIT_SENSOR; private ZoomCamera camera; private TextureRegion shipTextureRegion; private Body shipBody; private ShipSprite ship; private PhysicsWorld mPhysicsWorld; private Scene scene; private boolean menuOn; private ArrayList<TextureRegion> starRegions; private SmartList<TextureRegion> asteroidRegions; private SmartList<TextureRegion> iconsRegion; @Override protected void onCreate( final Bundle pSavedInstanceState ) { super.onCreate( pSavedInstanceState ); } @Override public EngineOptions onCreateEngineOptions() { this.camera = new ZoomCamera( 0, 0, Core.metersToPixels( Core.widthInMeters ), Core.metersToPixels( Core.heightInMeters ) ); return new EngineOptions( Core.fullScreen, Core.orientation, Core.ratioResPolicy, camera ); } @Override public void onCreateResources() { try { BitmapTexture shipTexture = new BitmapTexture( this.getTextureManager(), new IInputStreamOpener() { @Override public InputStream open() throws IOException { return getAssets().open( "gfx/ship.png" ); } } ); shipTexture.load(); this.shipTextureRegion = TextureRegionFactory.extractFromTexture( shipTexture ); BitmapTexture starTexture = new BitmapTexture( this.getTextureManager(), new IInputStreamOpener() { @Override public InputStream open() throws IOException { return getAssets().open( "gfx/stars/star2.png" ); } } ); starTexture.load(); SmartList<TextureRegion> starRegions = new SmartList<TextureRegion>(); starRegions.add( TextureRegionFactory.extractFromTexture( starTexture ) ); starTexture = new BitmapTexture( this.getTextureManager(), new IInputStreamOpener() { @Override public InputStream open() throws IOException { return getAssets().open( "gfx/stars/star.png" ); } } ); starTexture.load(); starRegions.add( TextureRegionFactory.extractFromTexture( starTexture ) ); starTexture = new BitmapTexture( this.getTextureManager(), new IInputStreamOpener() { @Override public InputStream open() throws IOException { return getAssets().open( "gfx/stars/star3.png" ); } } ); starTexture.load(); starRegions.add( TextureRegionFactory.extractFromTexture( starTexture ) ); BitmapTexture asterTexture = new BitmapTexture( this.getTextureManager(), new IInputStreamOpener() { @Override public InputStream open() throws IOException { return getAssets().open( "gfx/stars/asteroid.png" ); } } ); asterTexture.load(); SmartList<TextureRegion> asterRegions = new SmartList<TextureRegion>(); asterRegions.add( TextureRegionFactory.extractFromTexture( asterTexture ) ); asterTexture = new BitmapTexture( this.getTextureManager(), new IInputStreamOpener() { @Override public InputStream open() throws IOException { return getAssets().open( "gfx/stars/asteroid2.png" ); } } ); asterTexture.load(); asterRegions.add( TextureRegionFactory.extractFromTexture( asterTexture ) ); asterTexture = new BitmapTexture( this.getTextureManager(), new IInputStreamOpener() { @Override public InputStream open() throws IOException { return getAssets().open( "gfx/stars/asteroid3.png" ); } } ); asterTexture.load(); asterRegions.add( TextureRegionFactory.extractFromTexture( asterTexture ) ); BitmapTexture iconTexture = new BitmapTexture( this.getTextureManager(), new IInputStreamOpener() { @Override public InputStream open() throws IOException { return getAssets().open( "gfx/icons/oil.png" ); } } ); iconTexture.load(); SmartList<TextureRegion> iconRegions = new SmartList<TextureRegion>(); iconRegions.add( TextureRegionFactory.extractFromTexture( iconTexture ) ); for( final ShipPart part : Core.model.getAllParts() ) { BitmapTexture shipPartRegion = new BitmapTexture( this.getTextureManager(), new IInputStreamOpener() { @Override public InputStream open() throws IOException { return getAssets().open( part.getImgPath() ); //"gfx/icons/oil.png" ); } } ); shipPartRegion.load(); part.setTextureImg( TextureRegionFactory.extractFromTexture( shipPartRegion ) ); } final ITexture droidFontTexture = new BitmapTextureAtlas( this.getTextureManager(), 512, 512, TextureOptions.BILINEAR ); FontFactory.setAssetBasePath( "font/" ); Core.font = FontFactory.createFromAsset( this.getFontManager(), droidFontTexture, this.getAssets(), "courier.ttf", 80f, true, Color.WHITE ); Core.font.load(); this.starRegions = starRegions; this.iconsRegion = iconRegions; this.asteroidRegions = asterRegions; } catch( IOException e ) { Debug.e( e ); } } @Override public Scene onCreateScene() { Scene scene = new Scene(); scene.setBackground( new Background( org.andengine.util.color.Color.BLACK ) ); VertexBufferObjectManager manager = this.getVertexBufferObjectManager(); int sectorW = (int)(this.camera.getWidth() * 2 / 3f); int sectorH = (int)(this.camera.getHeight() * 2 / 3f); scene.attachChild( new StarsLayer( camera, 0.5f, 15, org.andengine.util.color.Color.WHITE, sectorW, sectorH, manager, this.starRegions ) ); scene.attachChild( new StarsLayer( camera, 0.65f, 20, org.andengine.util.color.Color.WHITE, sectorW, sectorH, manager, this.starRegions ) ); scene.attachChild( new StarsLayer( camera, 0.7f, 50, org.andengine.util.color.Color.WHITE, sectorW, sectorH, manager, this.starRegions ) ); this.mPhysicsWorld = new PhysicsWorld( new Vector2( 0, 0 ), false ); ship = new ShipSprite( 0, 0, this.shipTextureRegion, this.getVertexBufferObjectManager(), this.camera, Core.loggedProfile.getShip() ); shipBody = PhysicsFactory.createBoxBody( mPhysicsWorld, ship, BodyType.DynamicBody, PhysicsFactory.createFixtureDef( 15f, 0.1f, 0.9f ) ); ship.addBody( shipBody ); AsteroidsManager asteroidsManager = new AsteroidsManager( camera, 10, this.mPhysicsWorld, manager, this.asteroidRegions, this.iconsRegion, scene ); scene.attachChild( asteroidsManager ); this.camera.setChaseEntity( ship ); scene.attachChild( ship ); mPhysicsWorld.registerPhysicsConnector( new PhysicsConnector( ship, shipBody, true, true ) ); scene.registerUpdateHandler( mPhysicsWorld ); scene.registerUpdateHandler( ship ); scene.registerTouchArea( ship ); scene.setOnSceneTouchListener( ship ); this.scene = scene; return scene; } @Override public boolean onKeyDown( int keyCode, KeyEvent event ) { switch( keyCode ) { case KeyEvent.KEYCODE_MENU: { this.toggleMenu(); break; } case KeyEvent.KEYCODE_BACK: { if( this.menuOn ) { Core.db.saveProfiles(); finish(); } else { this.toggleMenu(); } break; } } return true; } private void toggleMenu() { this.menuOn = !this.menuOn; this.scene.setIgnoreUpdate( this.menuOn ); if( this.menuOn ) { this.scene.setChildScene( buildMenu() ); } else this.scene.clearChildScene(); } private MenuScene buildMenu() { final MenuScene menuScene = new MenuScene( this.camera ); int offset = 150; IMenuItem textMenuItem = new TextMenuItem( 0, Core.font, Core.locale.get( "str.game.resume" ), this.getVertexBufferObjectManager() ); int xOffset = 400; textMenuItem.setX( xOffset ); textMenuItem.setY( offset ); final IMenuItem resumeMenuItem = new ScaleMenuItemDecorator( textMenuItem, 1.5f, 1 ); menuScene.addMenuItem( resumeMenuItem ); IMenuItem textMenuItem2 = new TextMenuItem( 1, Core.font, Core.locale.get( "str.game.shipParts" ), this.getVertexBufferObjectManager() ); textMenuItem2.setX( xOffset ); textMenuItem2.setY( textMenuItem.getHeight() + offset ); final IMenuItem showShipMenuItem = new ScaleMenuItemDecorator( textMenuItem2, 1.5f, 1 ); menuScene.addMenuItem( showShipMenuItem ); IMenuItem playerMenuItem = new TextMenuItem( 2, Core.font, Core.locale.get( "str.game.returnToMenu" ), this.getVertexBufferObjectManager() ); playerMenuItem.setX( xOffset ); playerMenuItem.setY( textMenuItem.getHeight() * 2 + offset ); final IMenuItem player2MenuItem = new ScaleMenuItemDecorator( playerMenuItem, 1.5f, 1 ); menuScene.addMenuItem( player2MenuItem ); menuScene.setBackgroundEnabled( false ); menuScene.setOnMenuItemClickListener( new IOnMenuItemClickListener() { @Override public boolean onMenuItemClicked( MenuScene pMenuScene, IMenuItem pMenuItem, float pMenuItemLocalX, float pMenuItemLocalY ) { if( pMenuItem == resumeMenuItem ) { MinigameActivity.this.toggleMenu(); } if( pMenuItem == showShipMenuItem ) { Intent shipPartsActivity = new Intent( MinigameActivity.this, ShipPartsActivity.class ); MinigameActivity.this.startActivityForResult( shipPartsActivity, RESULT_CANCELED ); } if( pMenuItem == player2MenuItem ) { MinigameActivity.this.finish(); } return false; } } ); return menuScene; } }
/* 1: */ package com.kaldin.company.register.action; /* 2: */ /* 3: */ import com.kaldin.company.register.dao.impl.CompanyImplementor; /* 4: */ import com.kaldin.company.register.dto.CompanyDTO; /* 5: */ import com.kaldin.company.register.form.CompanyForm; /* 6: */ import javax.servlet.http.HttpServletRequest; /* 7: */ import javax.servlet.http.HttpServletResponse; /* 8: */ import javax.servlet.http.HttpSession; /* 9: */ import org.apache.struts.action.Action; /* 10: */ import org.apache.struts.action.ActionForm; /* 11: */ import org.apache.struts.action.ActionForward; /* 12: */ import org.apache.struts.action.ActionMapping; /* 13: */ /* 14: */ public class UserProfileRequiredAction /* 15: */ extends Action /* 16: */ { /* 17: */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) /* 18: */ throws Exception /* 19: */ { /* 20:21 */ String result = "error"; /* 21:22 */ CompanyForm cform = (CompanyForm)form; /* 22: */ /* 23:24 */ CompanyDTO compdto = new CompanyDTO(); /* 24:25 */ compdto.setIsProfile(cform.getIsprofile()); /* 25:26 */ int companyid = ((Integer)request.getSession().getAttribute("CompanyId")).intValue(); /* 26: */ /* 27:28 */ CompanyImplementor comimpl = new CompanyImplementor(); /* 28:30 */ if (comimpl.update(companyid, compdto)) /* 29: */ { /* 30:32 */ result = "success"; /* 31:33 */ request.setAttribute("msg", "User Profile Required settings updated successfully."); /* 32: */ } /* 33: */ else /* 34: */ { /* 35:35 */ request.setAttribute("msg", "User Profile Required settings updation failed."); /* 36: */ } /* 37:39 */ return mapping.findForward(result); /* 38: */ } /* 39: */ } /* Location: C:\Java Work\Workspace\Kaldin\WebContent\WEB-INF\classes\com\kaldin\kaldin_java.zip * Qualified Name: kaldin.company.register.action.UserProfileRequiredAction * JD-Core Version: 0.7.0.1 */
package com.jiw.dudu.entities; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import java.util.Date; /** * @Description Customer * @Author pangh * @Date 2022年08月10日 * @Version v1.0.0 */ @Data @AllArgsConstructor @NoArgsConstructor public class Customer { @Id @GeneratedValue(generator = "JDBC") private Integer id; private String cname; private Integer age; private String phone; private Byte sex; private Date birth; public Customer(Integer id, String cname) { this.id = id; this.cname = cname; } }
package task27; import common.Utils; import java.util.List; /** * @author Igor */ public class Main27 { private static final int N = 1_000; public static void main(String[] args) { List<Integer> primes = Utils.sievePrimes(N); int maxLength = 0, aResult = 0, bResult = 0; for (Integer b : primes) { for (int a = -N + 1; a < N; a++) { int value = quadraticValue(a, b, 1); int length = 1; int n = 2; while (value > 0 && value % 2 != 0 && Utils.isPrime(value)) { length++; value = quadraticValue(a, b, n++); } if (maxLength < length) { maxLength = length; aResult = a; bResult = b; } } } System.out.println((long) (aResult * bResult)); } private static int quadraticValue(int a, int b, int n) { return n * n + a * n + b; } }
package com.example.admin.expandlelist; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ExpandableListAdapter; import android.widget.ExpandableListView; public class MainActivity extends AppCompatActivity { ExpandableListView expandableListView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); addControl(); addEvent(); } public void addControl(){ expandableListView= (ExpandableListView) findViewById(R.id.expanded); } public void addEvent(){ expandleAdapter adapter= new expandleAdapter(MainActivity.this); expandableListView.setAdapter(adapter); } }
package com.tencent.mm.protocal.c; import com.tencent.mm.bk.a; public final class asw extends a { public String bIQ; public int bMF; public String bssid; public int jie; public int rVe; public String rVf; public String ssid; protected final int a(int i, Object... objArr) { int h; if (i == 0) { f.a.a.c.a aVar = (f.a.a.c.a) objArr[0]; if (this.ssid != null) { aVar.g(1, this.ssid); } if (this.bssid != null) { aVar.g(2, this.bssid); } aVar.fT(3, this.bMF); aVar.fT(4, this.rVe); if (this.rVf != null) { aVar.g(5, this.rVf); } if (this.bIQ != null) { aVar.g(6, this.bIQ); } aVar.fT(7, this.jie); return 0; } else if (i == 1) { if (this.ssid != null) { h = f.a.a.b.b.a.h(1, this.ssid) + 0; } else { h = 0; } if (this.bssid != null) { h += f.a.a.b.b.a.h(2, this.bssid); } h = (h + f.a.a.a.fQ(3, this.bMF)) + f.a.a.a.fQ(4, this.rVe); if (this.rVf != null) { h += f.a.a.b.b.a.h(5, this.rVf); } if (this.bIQ != null) { h += f.a.a.b.b.a.h(6, this.bIQ); } return h + f.a.a.a.fQ(7, this.jie); } else if (i == 2) { f.a.a.a.a aVar2 = new f.a.a.a.a((byte[]) objArr[0], unknownTagHandler); for (h = a.a(aVar2); h > 0; h = a.a(aVar2)) { if (!super.a(aVar2, this, h)) { aVar2.cJS(); } } return 0; } else if (i != 3) { return -1; } else { f.a.a.a.a aVar3 = (f.a.a.a.a) objArr[0]; asw asw = (asw) objArr[1]; switch (((Integer) objArr[2]).intValue()) { case 1: asw.ssid = aVar3.vHC.readString(); return 0; case 2: asw.bssid = aVar3.vHC.readString(); return 0; case 3: asw.bMF = aVar3.vHC.rY(); return 0; case 4: asw.rVe = aVar3.vHC.rY(); return 0; case 5: asw.rVf = aVar3.vHC.readString(); return 0; case 6: asw.bIQ = aVar3.vHC.readString(); return 0; case 7: asw.jie = aVar3.vHC.rY(); return 0; default: return -1; } } } }
package com.allisonmcentire.buildingtradesandroid; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.TextView; /** * Created by allisonmcentire on 1/7/18. */ public class UserPostsViewHolder extends RecyclerView.ViewHolder { // public TextView pdfLink; public TextView titleTextView; public UserPostsViewHolder(View itemView) { super(itemView); // pdfLink = itemView.findViewById(R.id.post_link); titleTextView = itemView.findViewById(R.id.user_post_title); } public void bindToPost(UserInformation userPosts, View.OnClickListener starClickListener) { titleTextView.setText(userPosts.name + "\n" + userPosts.locationNotes); // pdfLink.setText(resource.field_document_file); } }
public static void main(String[] args) { // TODO code application logic here' Scanner s = new Scanner(System.in); // DECLARE NATIN YUNG SCANNER NA OBJECT PARA MAKA INPUT TAYO SA CONSOLE int budget = 40000; // INITIALIZE YUNG BUDGET, IN THIS CASE 40K DIBA? int amount; // LAGAYAN NG AMOUNT NATIN YUNG ETATYPE SA CONSOLE while(budget > 0){ // POINT A KUNG ANG BUDGET AY DI 0 OR MORE THAN 0 PATULOY LNG ANG PAG RUN NG WHILE LOOP DI ITO LALAGPAS NG POINT B BABAIK LANG ITO NG POINT C System.out.print("Enter Amount: "); // POINT C amount = s.nextInt(); // PASOK NATIN ANG ETATYPE NATIN SA CONSOLE SA AMOUNT NA INTEGER VARIABLE // FAIL SAFE ANG CODE NA ITO if(amount < budget){ budget = budget - amount; System.out.println("Current Balance is "+ budget); // SAKA LNG TO MAG RURUN IF YUNG AMOUNT NA ETATYPE SA CONSOLE DI LAGPAS SA CURRENT BUDGET. }else{ System.out.println("Amount Entered Exceeded Budget"); // MAG RURUN TO KUNG LAGPAS SA BUDGET ANG AMOUNT NA ETATYPE SA CONSOLE } // KASI PAG WALA ANG FAIL SAFE NA TO PAG YUNG ETATYPE NATIN SA CONSOLE NA AMOUNT LAGPAS NA SA BUDGET MAGIGING NEGATIVE YUNG BUDGET NATIN KUNG SAKALI. } // POINT B // END NG LOOP DI PUPUNTA ANG PROGRAM DITO UNLESS ANG BUDGET AY 0 KASI NGA while(budget > 0) SEE POINT A }
package com.example.illuminate_me; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.media.MediaPlayer; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; public class logoScreen extends AppCompatActivity { private MediaPlayer instruction , nohi , hi ; SharedPreferences prefs = null; Editor editor; private ImageView imageView; private static int count =0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); prefs = getSharedPreferences("com.example.illuminate_me", MODE_PRIVATE); //to remove top bar requestWindowFeature(Window.FEATURE_NO_TITLE); //to make it cover the entire screen getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); //this is part of the onCreate method setContentView(R.layout.activity_logo_screen); // to hide the action bar //getSupportActionBar().hide(); //To Start Hi for the first time open if (count <1){ hi = MediaPlayer.create(logoScreen.this, R.raw.hi); hi.start(); count++; } //To repeat Instruction imageView = findViewById(R.id.imageView); imageView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { nohi = MediaPlayer.create(logoScreen.this, R.raw.nohi); nohi.start(); return false; } }); //To not go back to this screen logoLauncher logo = new logoLauncher(); logo.start(); }// end onCreate //To start instruction for the first time use @Override protected void onResume() { super.onResume(); if (prefs.getBoolean("firstrun", true)) { //You can perform anything over here. This will call only first time instruction = MediaPlayer.create(logoScreen.this, R.raw.instruction1); instruction.start(); editor = prefs.edit(); editor.putBoolean("firstrun", false); editor.commit(); } } // this class purpose is to make the logo screen appears for a number of seconds before showing the main screen private class logoLauncher extends Thread { public void run (){ try { // to make the logo appear for 3 seconds sleep(3000); } catch (InterruptedException e){ e.printStackTrace(); } // to move from this activity to the main activity (main screen) Intent intent = new Intent (logoScreen.this, MainActivity.class); startActivity(intent); // to not go back to this screen logoScreen.this.finish(); }// end run method } // end private class }
/** * Javassonne * http://code.google.com/p/javassonne/ * * @author [Add Name Here] * @date Mar 25, 2009 * * Copyright 2009 Javassonne Team * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ package org.javassonne.networking.impl; public class CachedClient implements RemoteClient { private String name_; private String uri_; public CachedClient(RemoteClient client) { name_ = client.getName(); uri_ = client.getURI(); } public String getName() { return name_; } public String getURI() { return uri_; } public void receiveNotificationFromHost(final String serializedNotification) { ThreadPool.execute(new Runnable() { public void run() { RemoteClient me = ClientResolver.attemptToResolveClient(uri_); if (me == null) return; me.receiveNotificationFromHost(serializedNotification); } }); } public void addClientACK() { ThreadPool.execute(new Runnable() { public void run() { RemoteClient me = ClientResolver.attemptToResolveClient(uri_); if (me == null) return; me.addClientACK(); } }); } public void addClientNAK() { ThreadPool.execute(new Runnable() { public void run() { RemoteClient me = ClientResolver.attemptToResolveClient(uri_); if (me == null) return; me.addClientNAK(); } }); } }
package com.licyun.vo; /** * Created by 李呈云 * Description: * 2016/10/10. */ public class MessageJsonBean { private String name; private String ip; private String date; private String message; private String imgUrl; public MessageJsonBean(String name, String ip, String date, String message, String imgUrl) { this.name = name; this.ip = ip; this.date = date; this.message = message; this.imgUrl = imgUrl; } public String getImgUrl() { return imgUrl; } public void setImgUrl(String imgUrl) { this.imgUrl = imgUrl; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
package com.igitras.codegen.common.next; /** * Created by mason on 1/5/15. */ public class ResolveState { }
package me.zeus.MoarSoundz; import org.bukkit.Sound; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; public class BowEvent implements Listener { // ============================================================================ private final Main plugin; public BowEvent(final Main pl) { plugin = pl; } // ============================================================================ @EventHandler public void onPVP(final EntityDamageByEntityEvent e) { final Entity damager = e.getDamager(); final Entity victim = e.getEntity(); if (damager instanceof Arrow) { final Arrow arrow = (Arrow) damager; if (arrow.getShooter() instanceof Player && victim instanceof Player) { if (plugin.getConfig().getBoolean("SOUNDS.PVP.BOW.ENABLED") == true) { ((Player) ((Projectile) damager).getShooter()).playSound(damager.getLocation(), Sound.ORB_PICKUP, 1.0F, 1.0F); } } } } // ============================================================================ }
package com.dragon.logging.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Log { String value() default ""; /** * 有些参数入request无法序列化,支持排除 */ String[] excludes() default { "request", "response" }; }
package com.example.healthmanage.ui.fragment.healthcare; import com.example.healthmanage.base.BaseViewModel; public class HealthCareViewModel extends BaseViewModel { }
package com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.AdLandingPageComponent.component; import com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.AdLandingPageComponent.component.ae.1; class ae$1$2 implements Runnable { final /* synthetic */ String dJG; final /* synthetic */ 1 nGr; ae$1$2(1 1, String str) { this.nGr = 1; this.dJG = str; } public final void run() { this.nGr.nGn.MY(this.dJG); } }
package piglet; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Collection; import java.util.Iterator; public class Type extends Object { private String name; private String fname; private LinkedHashMap<String, FieldInfo> fields; private LinkedHashMap<String, Method> methods; public Type(String name) throws Exception { this.name = name; fname = null; fields = new LinkedHashMap<String, FieldInfo>(); methods = new LinkedHashMap<String, Method>(); } public Type(String name, String fname) throws Exception { this.name = name; this.fname = fname; fields = new LinkedHashMap<String, FieldInfo>(); methods = new LinkedHashMap<String, Method>(); } public String getName() { return name; } public String getFatherName() { return fname; } public String getVTableName() { return "VT_" + name; } public int getVTableSize() { return methods.size()*4; } public int getSize() throws Exception { return (fields.size()+1)*4; } public Method getMethod(String signature) throws Exception { return methods.get(signature); } public Collection<Method> getMethods() throws Exception { return methods.values(); } public FieldInfo getFieldInfo(String name) throws Exception { return fields.get(name); } public void addField(String type, String name) throws Exception { int offset = (fields.size() + 1) * 4; fields.put(name, new FieldInfo(type, offset)); } public void addMethod(Method method) throws Exception { int offset = methods.size() * 4; method.setVtableOffset(offset); methods.put(method.getSignature(), method); } // WARNING: error if used with field `father`. It must use the // type object that gets as arguement. // public void addFatherFields(Type father) throws Exception { for(String key : father.fields.keySet()) { if(fields.containsKey(key) == false) { this.addField(father.fields.get(key).type, key); } } } public void addFatherMethods(Type father) throws Exception { LinkedHashMap<String, Method> temp = (LinkedHashMap<String, Method>)methods.clone(); methods.clear(); for(String key : father.methods.keySet()) { Method fmethod = father.methods.get(key); if(temp.containsKey(key) == true) { Method method = temp.get(key); method.setVtableOffset(fmethod.getOffset()); methods.put(key, method); temp.remove(key); } else { methods.put(key, fmethod); } } Iterator<Method> it = temp.values().iterator(); while(it.hasNext() == true) { addMethod(it.next()); } } }
package com.example.demo.data_transfer_objects; import com.example.demo.enums.TransacaoEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @Builder @AllArgsConstructor @NoArgsConstructor public class PagamentoDTO { private Long valor; private Long numeroDoCartao; private TransacaoEnum transacao; }
/* * Copyright 2013 Cloudera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kitesdk.data.filesystem; import static org.kitesdk.data.filesystem.MultiLevelIterator.logger; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TestMultiLevelIterator { public static final Logger logger = LoggerFactory.getLogger(TestMultiLevelIterator.class); public static class RecursiveMapIterator extends MultiLevelIterator<String> { private final Map<String, Map> map; public RecursiveMapIterator(int level, Map<String, Map> map) { super(level); this.map = map; } @Override @SuppressWarnings("unchecked") public Iterable<String> getLevel(List<String> current) { Map<String, Map> currentLevel = map; try { for (String key : current) { currentLevel = currentLevel.get(key); } } catch (Exception ex) { // Should be NPE or ClassCastException logger.debug("Returning empty set for {}", current); return Sets.newHashSet(); } logger.debug("Returning {} for {}", currentLevel.keySet(), current); return currentLevel.keySet(); } } private static Map<String, Map<String, Map<String, String>>> l1; @BeforeClass public static void setup() { Map<String, String> l3_1 = Maps.newHashMap(); l3_1.put("l3_1_1", "one"); l3_1.put("l3_1_2", "two"); Map<String, String> l3_2 = Maps.newHashMap(); Map<String, Map<String, String>> l2_1 = Maps.newHashMap(); l2_1.put("l2_1_1", l3_1); l2_1.put("l2_1_2", l3_2); Map<String, Map<String, String>> l2_2 = Maps.newHashMap(); Map<String, String> l3_3 = Maps.newHashMap(); l3_3.put("l3_3_1", "1"); l3_3.put("l3_3_2", "2"); Map<String, Map<String, String>> l2_3 = Maps.newHashMap(); l2_3.put("l2_3_1", l3_3); l1 = Maps.newHashMap(); l1.put("l1_1", l2_1); l1.put("l1_2", l2_2); l1.put("l1_3", l2_3); } @Test( expected=IllegalArgumentException.class ) @SuppressWarnings("unchecked") public void testDepth0() { Iterator<List<String>> d0 = new RecursiveMapIterator(0, (Map) l1); } @Test @SuppressWarnings("unchecked") public void testDepth1() { Iterator<List<String>> d1 = new RecursiveMapIterator(1, (Map) l1); Set<List<String>> expected = Sets.newHashSet( (List<String>) Lists.newArrayList("l1_1"), (List<String>) Lists.newArrayList("l1_2"), (List<String>) Lists.newArrayList("l1_3")); Assert.assertEquals(expected, Sets.newHashSet(d1)); } @Test @SuppressWarnings("unchecked") public void testDepth2() { Iterator<List<String>> d2 = new RecursiveMapIterator(2, (Map) l1); Set<List<String>> expected = Sets.newHashSet( (List<String>) Lists.newArrayList("l1_1", "l2_1_1"), (List<String>) Lists.newArrayList("l1_1", "l2_1_2"), (List<String>) Lists.newArrayList("l1_3", "l2_3_1")); Assert.assertEquals(expected, Sets.newHashSet(d2)); } @Test @SuppressWarnings("unchecked") public void testDepth3() { Iterator<List<String>> d3 = new RecursiveMapIterator(3, (Map) l1); Set<List<String>> expected = Sets.newHashSet( (List<String>) Lists.newArrayList("l1_1", "l2_1_1", "l3_1_1"), (List<String>) Lists.newArrayList("l1_1", "l2_1_1", "l3_1_2"), (List<String>) Lists.newArrayList("l1_3", "l2_3_1", "l3_3_1"), (List<String>) Lists.newArrayList("l1_3", "l2_3_1", "l3_3_2")); Assert.assertEquals(expected, Sets.newHashSet(d3)); } @Test @SuppressWarnings("unchecked") public void testDepth4() { // at depth 4, there are only String values Iterator<List<String>> d4 = new RecursiveMapIterator(4, (Map) l1); Set<List<String>> expected = Sets.newHashSet(); Assert.assertEquals(expected, Sets.newHashSet(d4)); } @Test @SuppressWarnings("unchecked") public void testDepth5() { // there is nothing at depth 5 Iterator<List<String>> d5 = new RecursiveMapIterator(5, (Map) l1); Set<List<String>> expected = Sets.newHashSet(); Assert.assertEquals(expected, Sets.newHashSet(d5)); } }
package model; /** * 2-Dimensional real valued Vector. */ public class Vector { // ***** FIELDS ***** public double x, y; /** * Constructs a new Vector. * @param x X part of the vector * @param y Y part of the vector */ public Vector(double x, double y) { this.x = x; this.y = y; } // ***** MAIN METHODS ***** /** * Returns the absolute value (the length) of the vector * @return */ public double abs() { return Math.sqrt(x * x + y * y); } /** * Returns the distance between two vectors (interpreted as points) squared(!). * @param first The first vector * @param second The second vector * @return */ public static double distSqr(Vector first, Vector second) { Vector delta = plus(first, times(second, -1)); return delta.x*delta.x + delta.y*delta.y; } /** * Calculates the dot product of two vectors. * @param one First vector * @param two Second vector * @return */ public static double dotP(Vector one, Vector two) { return one.x * two.x + one.y * two.y; } // ***** CALCULATION ***** /** * Adds vector to this instance. * @param v Vector to be added. */ public void add(Vector v) { this.x += v.x; this.y += v.y; } /** * Multiplies this vector by a scalar. * @param c The scalar. */ public void mult(double c) { this.x *= c; this.y *= c; } // ***** STATIC METHODS ***** /** * Adds two vectors. * @return */ public static Vector plus(Vector v1, Vector v2) { return new Vector(v1.x + v2.x, v1.y + v2.y); } /** * Scales one vector. * @param v The scalar * @return */ public static Vector times(Vector v, double c) { return new Vector(c * v.x, c * v.y); } }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package algorithm; /** * * @author aziza */ public class Dijisktra { static int V=5; public static void printSolution(int dist[], int n) { int src = 0; for (int i = 0; i < V; i++) { if (i == 4) { System.out.print("Distance from first vertex " + src + " to last -> " + (i + 1) + " is = " + dist[i]); }}} public static void shortest(int graph[][], int src) { int dist[] = new int[V]; Boolean sptSet[] = new Boolean[V]; for (int i = 0; i < V; i++) { dist[i] = Integer.MAX_VALUE; sptSet[i] = false; } dist[src] = 0; for (int count = 0; count < V-1; count++){ int min = Integer.MAX_VALUE, min_index=-1; for (int v = 0; v < V; v++) if (sptSet[v] == false && dist[v] <= min) { min = dist[v]; min_index = v; } int u =min_index; sptSet[u] = true; for (int v = 0; v < V; v++) if (!sptSet[v] && graph[u][v]!=0 && dist[u] != Integer.MAX_VALUE && dist[u]+graph[u][v] < dist[v]){ dist[v] = dist[u] + graph[u][v];} } printSolution(dist, V); } public static void main (String[] args) { int graph[][] = new int[][]{{0, 4, 0, 0, 0}, {4, 0, 8, 0, 0}, {0, 8, 0, 7, 0}, {0, 0, 7, 0, 9}, {0, 0, 0, 9, 0}}; shortest(graph, 0); } }
package com.qtrj.simpleframework.util; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; public class PropertiesUtil { private static Logger log = Logger.getLogger(Logger.class); private static Properties p = new Properties(); public static void main(String[] args) throws IOException {} public static void init(String configPath) { Properties p1 = new Properties(); InputStream is = PropertiesUtil.class.getResourceAsStream(configPath); try { p1.load(is); p.putAll(p1); } catch (IOException ex) { log.error(ex); } finally { if (is != null) { try { is.close(); } catch (IOException ex) { log.error(ex); } is = null; } } } public static void initExtiact(String extiactConfigPath) { Properties p1 = new Properties(); InputStream is = null; try { is = new FileInputStream(new File(extiactConfigPath)); p1.load(is); p.putAll(p1); } catch (IOException ex) { log.error(ex); } finally { if (is != null) { try { is.close(); } catch (IOException ex) { log.error(ex); } is = null; } } } public static String getProperties(String key) { String result = null; if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(p.getProperty(key))) result = p.getProperty(key).trim(); return result; } public static Integer getNumber(String key) { if (StringUtils.isBlank(key) || StringUtils.isBlank(getProperties(key))) return Integer.valueOf(0); return Integer.valueOf(Integer.parseInt(getProperties(key))); } public static boolean getBoolean(String key) { boolean result = false; if (StringUtils.isBlank(key) || StringUtils.isBlank(getProperties(key))) { result = false; } else { result = Boolean.parseBoolean(getProperties(key)); } return result; } }
package com.wentongwang.mysports.views.fragment.home; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import com.wentongwang.mysports.R; import com.wangwentong.sports_api.model.SportsFirstClass; import com.wangwentong.sports_api.model.SportsSecondClass; import com.wentongwang.mysports.views.viewholder.HomeSportsItemViewHolder; import com.wentongwang.mysports.views.viewholder.HomeSportsTypeViewHolder; import java.util.ArrayList; import java.util.List; /** * 可展开列表的适配器FR * Created by Wentong WANG on 2016/11/3. */ public class HomeExpandableListAdapter extends BaseExpandableListAdapter { private List<SportsFirstClass> sportTypes; private Context mContext; public HomeExpandableListAdapter(Context mContext) { this.mContext = mContext; this.sportTypes = new ArrayList<>(); } public void setSports(List<SportsFirstClass> sportTypes) { this.sportTypes = sportTypes; notifyDataSetChanged(); } /** * 条目数量 * @return */ @Override public int getGroupCount() { return sportTypes != null ? sportTypes.size() : 0; } /** * 每条目里有几项内容 * @param groupPosition * @return */ @Override public int getChildrenCount(int groupPosition) { return sportTypes.get(groupPosition).getSports()!= null ? sportTypes.get(groupPosition).getSports().size() : 0; } /** * 获取条目 * * @param groupPosition * @return */ @Override public Object getGroup(int groupPosition) { return sportTypes.get(groupPosition); } /** * 获取某个条目中的某项 * * @param groupPosition * @param childPosition * @return */ @Override public Object getChild(int groupPosition, int childPosition) { return sportTypes.get(groupPosition).getSports().get(childPosition); } @Override public long getGroupId(int groupPosition) { return groupPosition; } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public boolean hasStableIds() { return true; } /** * 返回条目布局 * * @param groupPosition * @param isExpanded * @param convertView * @param parent * @return */ @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { HomeSportsTypeViewHolder holder; if (convertView == null) { convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_home_sports_first_class, parent, false); holder = new HomeSportsTypeViewHolder(convertView); convertView.setTag(holder); } else { holder = (HomeSportsTypeViewHolder) convertView.getTag(); } holder.setItem(sportTypes.get(groupPosition)); return convertView; } /** * 返回条目中每一项的布局 * * @param groupPosition * @param childPosition * @param isLastChild * @param convertView * @param parent * @return */ @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { HomeSportsItemViewHolder holder = null; if (convertView == null) { convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_home_sports_second_class, parent, false); holder = new HomeSportsItemViewHolder(convertView); convertView.setTag(holder); } else { holder = (HomeSportsItemViewHolder) convertView.getTag(); } SportsSecondClass item = sportTypes.get(groupPosition).getSports().get(childPosition); holder.setItem(item); return convertView; } @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } }
package ca.sheridancollege.chatroom; import java.io.Serializable; public class Message implements Serializable { private static final long serialVersionUID = 1L; static final int SHOWUSER = 0, CHATMESSAGE = 1, QUIT = 2; private int type; private String message; // constructor Message(int type, String message){ this.type = type; this.message = message; } // getters int getType() { return type; } String getMessage() { return message; } }
package ro.halic.catalin.mvptutorial.main.presenter; import android.app.Activity; import ro.halic.catalin.mvptutorial.main.MainMVP; /** * Created by baumdev on 02/01/2017. */ public class MainPresenter { /** * Store the activity received in the constructor */ private Activity activity; /** * The view */ private MainMVP.RequiredViewOps view; public MainPresenter(Activity activity, MainMVP.RequiredViewOps viewOps) { this.activity = activity; this.view = viewOps; view.setup(); } }
package biz.mydailyhoroscope; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.graphics.Typeface; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.ScrollView; import android.widget.TextView; import com.google.gson.Gson; import java.util.Calendar; public class HoroscopeFragment extends Fragment { private SharedPreferences prefs; private Editor editor; private FragmentActivity fa; private LinearLayout linearLayout; private TextView horoscopeTitle; private TextView horoscopeText; private ProgressBar progressBar; private ScrollView scrollView; private ImageView refreshButton; private Horoscope fragmentHoroscope; private int phoneLangInt; private int birthDay; private int birthMonth; private int daysminus; private Calendar cal; private java.text.DateFormat dateFormat; private Gson gson = new Gson(); private static final String KEY_CONTENT = "HoroscopeFragment:Content"; public static HoroscopeFragment newInstance(String content, int day_offset) { HoroscopeFragment fragment = new HoroscopeFragment(); // Übergebene Parameter ins Bundle Objekt eintragen Bundle args = new Bundle(); args.putInt("day_offset", day_offset); fragment.setArguments(args); StringBuilder builder = new StringBuilder(); for (int i = 0; i < 20; i++) { builder.append(content).append(" "); } builder.deleteCharAt(builder.length() - 1); fragment.mContent = builder.toString(); return fragment; } private String mContent = "???"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_CONTENT)) { mContent = savedInstanceState.getString(KEY_CONTENT); } } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(KEY_CONTENT, mContent); } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { fa = super.getActivity(); prefs = fa.getSharedPreferences(Helpers.PREFERENCES_FILE, 0); editor = prefs.edit(); getFragmentRelevantData(); linearLayout = (LinearLayout) inflater.inflate(R.layout.fragment_horoscope, container, false); horoscopeTitle = linearLayout.findViewById(R.id.horoscope_title); horoscopeText = linearLayout.findViewById(R.id.horoscope_text); Typeface robotoTypefaceThin = Typeface.createFromAsset(fa.getAssets(), "Roboto-Thin.ttf"); horoscopeTitle.setTypeface(robotoTypefaceThin); horoscopeText.setTypeface(robotoTypefaceThin); scrollView = linearLayout.findViewById(R.id.scroll_view); scrollView.setVisibility(View.INVISIBLE); progressBar = linearLayout.findViewById(R.id.progress_bar); progressBar.setVisibility(View.VISIBLE); refreshButton = linearLayout.findViewById(R.id.refresh_button); // Birthdate is set if ((birthDay != -1) && (birthMonth != -1)) { new HoroscopeGetterTask().execute(cal); } return linearLayout; } private void getFragmentRelevantData() { Bundle bundle = getArguments(); try { daysminus = bundle.getInt("day_offset"); } catch (Exception e) { daysminus = 0; } cal = Calendar.getInstance(); cal.add(Calendar.DAY_OF_MONTH, daysminus); dateFormat = android.text.format.DateFormat.getDateFormat(fa.getApplicationContext()); phoneLangInt = Helpers.phoneLanguageInt(prefs.getString(Helpers.PREFERENCES_LANGUAGE, Helpers.PHONE_LANGUAGE)); birthDay = prefs.getInt(Helpers.PREFERENCES_BIRTH_DAY, -1); birthMonth = prefs.getInt(Helpers.PREFERENCES_BIRTH_MONTH, -1); } private void updateView(Horoscope newHoroscope) { try { if (daysminus == 0) { horoscopeTitle.setText(getString(R.string.todays_horoscope) + ":"); } else if (daysminus == -1) { horoscopeTitle.setText(getString(R.string.yesterdays_horoscope) + ":"); } else { horoscopeTitle.setText(getString(R.string.other_horoscope) + " " + dateFormat.format(cal.getTime()) + ":"); } horoscopeText.refreshDrawableState(); horoscopeText.forceLayout(); horoscopeText.invalidate(); horoscopeText.setText(newHoroscope.getHoroscope()); horoscopeText.setGravity(Gravity.LEFT); refreshButton.setVisibility(View.GONE); } catch (NullPointerException ne) { horoscopeText.setText(R.string.err_no_horoscope); horoscopeText.setGravity(Gravity.CENTER); refreshButton.setVisibility(View.VISIBLE); refreshButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { refreshButton.setVisibility(View.INVISIBLE); // Birthdate is set if ((birthDay != -1) && (birthMonth != -1)) { new HoroscopeGetterTask().execute(cal); } } }); } } private class HoroscopeGetterTask extends AsyncTask<Calendar, Void, Void> { @Override protected Void doInBackground(Calendar... calendarDate) { Log.d("HoroscopeGetterTask", "Birthday: " + birthDay + " / Month: " + birthMonth); fragmentHoroscope = WebAccess.getHoroscope(birthDay, birthMonth, calendarDate[0], phoneLangInt); editor.putString("horoscope" + daysminus, gson.toJson(fragmentHoroscope)); editor.commit(); return null; } @Override protected void onProgressUpdate(Void... progress) { } @Override protected void onPostExecute(Void result) { scrollView.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); updateView(fragmentHoroscope); } } }
import java.util.*; import java.io.*; public class commonchar{ public static void main(String args[]){ Set<Character> s1=new TreeSet<Character>(); Set<Character> s2=new TreeSet<Character>(); Scanner sc= new Scanner(System.in); String a=sc.nextLine(); String b=sc.nextLine(); for(int i=0;i<a.length();i++){ s1.add(a.charAt(i)); } for(int i=0;i<b.length();i++){ s2.add(b.charAt(i)); } s1.retainAll(s2); int n=s1.size(); System.out.println("n"+n); } }
package com.example.android.musicplayerapp; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class LibraryActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_library); TextView artist = (TextView) findViewById (R.id.artist); TextView album = (TextView) findViewById (R.id.album); TextView song = (TextView) findViewById (R.id.song); // Set a click listener on that View artist.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Create a new intent to open the {@link ArtistsActivity} Intent artistIntent = new Intent(LibraryActivity.this, ArtistsActivity.class); // Start the new activity startActivity(artistIntent); } }); // Set a click listener on that View album.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Create a new intent to open the {@link AlbumsActivity} Intent albumIntent = new Intent(LibraryActivity.this, AlbumsActivity.class); // Start the new activity startActivity(albumIntent); } }); // Set a click listener on that View song.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Create a new intent to open the {@link SongsActivity} Intent songIntent = new Intent(LibraryActivity.this, SongsActivity.class); // Start the new activity startActivity(songIntent); } }); TextView buy = (Button) findViewById (R.id.Buy_button); // Set a click listener on that View buy.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast toast = Toast.makeText(getApplicationContext(),"Open Android Pay", Toast.LENGTH_SHORT); toast.show(); } }); } }
package com.company.linkedlist; import java.util.Iterator; import java.util.LinkedList; public class IterateListReverse { public static void main(String[] args) { LinkedList list = new LinkedList<>(); list.add(1); list.add(4); list.add(55); list.add(3); list.add(76); list.add(43); Iterator iterator = list.descendingIterator(); while (iterator.hasNext()) { System.out.print(iterator.next()+" "); } } }
package helloworld; public class PrintHello { public static void main(String[] args) { System.out.print("hello world"); System.out.println("hello world"); System.out.print("hello world"); for (int i = 0 ;i < args.length;i++) { System.out.println(args[i]); } } }
package AdbUtilPkg; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.TimerTask; import javax.swing.JTextArea; import javax.swing.JTextField; public class AdbUtil_Analysis { public static void resultAnalysis(FileHandler resultFile, JTextArea component, String filePath) { List<String> resultList = null; String resultText; try { resultList = resultFile.readFile(filePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if (resultList != null){ resultText = ""; for (int i = 0; i < resultList.size(); i++) { resultText += resultList.get(i); if (resultList.get(i).length() > 0) resultText += "\n"; } if (resultText.length() > 1) { component.setText(resultText); component.setFocusable(true); } } } public static int resultAnalysisRealTime(int nLastReadLine, FileHandler resultFile, JTextArea component, String filePath) { List<String> resultList = null; String resultText; int readlinenum = nLastReadLine; int i; try { resultList = resultFile.readFile(filePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if (resultList != null){ resultText = ""; if (nLastReadLine > 0) { for (i = readlinenum; i < resultList.size(); i++) { resultText = resultList.get(i); component.append(resultText); if (resultList.get(i).length() > 0) { component.append("\n"); component.append(getCurrentLogTime()); component.append(" "); } } component.repaint(); } else { component.setText(""); for (i = 0; i < resultList.size(); i++) { resultText = resultList.get(i); component.append(resultText); if (resultList.get(i).length() > 0) component.append("\n"); } component.repaint(); } if (readlinenum < resultList.size()) readlinenum = i; else ;//System.out.print("error!"); //error or pending component.setFocusable(true); } return readlinenum; } private static String getCurrentLogTime() { String timeStr; Date now = new Date(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); timeStr = format.format(now); return timeStr; } } class DelayAnalysis extends TimerTask { String[] CmdsList; AdbUtil_Execute mDelayExe; String mClassName; JTextField mTrace = null; public DelayAnalysis(String[] cmds, AdbUtil_Execute mE, String clsName, JTextField trace){ CmdsList = cmds; mDelayExe = mE; mClassName = clsName; mTrace = trace; } public void run() { if (CmdsList == null) { if (mClassName.equals("AdbUtil_ShellCommands")) AdbUtil_ShellCommands.resultAnalysis(); else if (mClassName.equals("AdbUtil_Profiling")) AdbUtil_Profiling.resultAnalysis(); else if (mClassName.equals("AdbUtil_ANR")) AdbUtil_ANR.resultAnalysis(); else { if (AdbUtil_Main_Layout.DEBUG_MODE_ON == true) { if (mTrace != null) mTrace.setText("CmdsList == null"); } } } else { try { mDelayExe.runProcessSimple(CmdsList); if (AdbUtil_Main_Layout.DEBUG_MODE_ON == true) { if (mTrace != null) mTrace.setText("going..."); } } catch (IOException e) { e.printStackTrace(); if (AdbUtil_Main_Layout.DEBUG_MODE_ON == true) { if (mTrace != null) mTrace.setText(e.getMessage()); } } catch (InterruptedException e) { e.printStackTrace(); if (AdbUtil_Main_Layout.DEBUG_MODE_ON == true) { if (mTrace != null) mTrace.setText(e.getMessage()); } } finally { if (mClassName.equals("AdbUtil_ShellCommands")) AdbUtil_ShellCommands.resultAnalysis(); else if (mClassName.equals("AdbUtil_Profiling")) AdbUtil_Profiling.resultAnalysis(); else if (mClassName.equals("AdbUtil_ANR")) AdbUtil_ANR.resultAnalysis(); else { if (AdbUtil_Main_Layout.DEBUG_MODE_ON == true) { if (mTrace != null) mTrace.setText("going...2"); } } } } } }
package com.rofour.baseball.controller.store; import com.rofour.baseball.common.JsonUtils; import com.rofour.baseball.common.RandomHelper; import com.rofour.baseball.controller.base.BaseController; import com.rofour.baseball.controller.model.DataGrid; import com.rofour.baseball.controller.model.ResultInfo; import com.rofour.baseball.controller.model.store.BusinessChannelInfo; import com.rofour.baseball.dao.user.bean.UserManagerLoginBean; import com.rofour.baseball.service.store.BusinessChlService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * @ClassName: BusinessChlController * @Description: 商户渠道控制层 * @author ZhangLei * @date 2016年8月31日 下午5:12:35 */ @Controller @RequestMapping(value = "/business/chl") public class BusinessChlController extends BaseController { private static final Logger LOG = LoggerFactory.getLogger(BusinessChlController.class); @Resource(name="businessChlService") private BusinessChlService businessChlService; /** * @Description: 查询所有非系统商户渠道 * @param request * @param response * @param businessChannelInfo */ @RequestMapping(value = "/queryAll") @ResponseBody public void selectAllStoreChannel(HttpServletRequest request, HttpServletResponse response, BusinessChannelInfo businessChannelInfo) { DataGrid<BusinessChannelInfo> grid=new DataGrid<BusinessChannelInfo>(); try { if (StringUtils.isEmpty(businessChannelInfo.getSort())) { businessChannelInfo.setSort("createDate"); } LOG.error(JsonUtils.translateToJson(businessChannelInfo)); List<BusinessChannelInfo> list = businessChlService.selectAllBusinessChl(businessChannelInfo); grid.setRows(list); grid.setTotal(businessChlService.selectAllBusinessChlTotal(businessChannelInfo)); } catch (Exception e) { LOG.error(e.getMessage(),e); } writeJson(grid, response); } /** * @Description: 增加商户渠道 * @param businessChannelInfo * @param request * @return */ @RequestMapping(value = "/addBussinessChl",method=RequestMethod.POST) @ResponseBody public ResultInfo<BusinessChannelInfo> addBussinessChl(BusinessChannelInfo businessChannelInfo, HttpServletRequest request) { try { UserManagerLoginBean userInfo= (UserManagerLoginBean) request.getSession().getAttribute("user"); businessChannelInfo.setCreateUser(userInfo.getUserManagerId()); return businessChlService.addBussinessChl(businessChannelInfo); } catch (Exception e) { LOG.error(e.getMessage(),e); return new ResultInfo<BusinessChannelInfo>(-1,"1060","增加商户渠道出错"); } } /** * @Description: 逻辑删除商户渠道 * @param channelId * @param request * @return */ @RequestMapping(value = "/delBussinessChl",method=RequestMethod.POST) @ResponseBody public ResultInfo<BusinessChannelInfo> delBussinessChl(Long channelId, HttpServletRequest request) { try { return businessChlService.delBussinessChl(channelId); } catch (Exception e) { LOG.error(e.getMessage(),e); return new ResultInfo<BusinessChannelInfo>(-1,"1060","删除商户渠道出错"); } } /** * @Description: 禁用商户渠道 * @param channelId * @param request * @return */ @RequestMapping(value = "/cancleBussinessChl",method=RequestMethod.POST) @ResponseBody public ResultInfo<BusinessChannelInfo> cancleBussinessChl(Long channelId, HttpServletRequest request) { try { return businessChlService.cancleBussinessChl(channelId); } catch (Exception e) { LOG.error(e.getMessage(),e); return new ResultInfo<BusinessChannelInfo>(-1,"1060","禁用商户渠道出错"); } } /** * @Description: 启用商户渠道 * @param channelId * @param request * @return */ @RequestMapping(value = "/enabledBussinessChl",method=RequestMethod.POST) @ResponseBody public ResultInfo<BusinessChannelInfo> enabledBussinessChl(Long channelId, HttpServletRequest request) { try { return businessChlService.enabledBussinessChl(channelId); } catch (Exception e) { LOG.error(e.getMessage(),e); return new ResultInfo<BusinessChannelInfo>(-1,"1060","启用商户渠道出错"); } } /** * @Description: 验证商户渠道是否存在 * @param channelCode * @param response */ @RequestMapping(value = "/ifExistChannelCode") @ResponseBody public void ifExistChannelCode(String channelCode, HttpServletResponse response) { ResultInfo resultInfo=null; try { resultInfo=businessChlService.ifExistChannelCode(channelCode); } catch (Exception e) { LOG.error(e.getMessage(),e); } writeJson(resultInfo, response); } /** * @Description: 获取6位商户渠道编码 * @param response */ @RequestMapping(value = "/getRandomChlCode") @ResponseBody public void getRandomChlCode(HttpServletResponse response) { String channelCodeStr=null; try { channelCodeStr= RandomHelper.generateString(6); while (businessChlService.ifExistChannelCode(channelCodeStr).getSuccess()!=0){ channelCodeStr=RandomHelper.generateString(6); } } catch (Exception e) { LOG.error(e.getMessage(),e); } writeJson(channelCodeStr, response); } }