blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
62a2e380efd8e0a1e5f938dae3c464e3253c8126
|
c72546de794316702061554ede7de4955e6d8021
|
/app/src/main/java/com/example/hp/matriseba/AccountActivity/SignupActivity.java
|
92f2b9e187b5e58171830445d3372868b7758661
|
[] |
no_license
|
JulhasRazu/MatriSeba
|
584128973e4e2b6fcb5f39a2391da60c3c3059a4
|
9987625599af4ef57b2594256fc8bd1e55c0abd4
|
refs/heads/master
| 2021-03-30T21:08:14.772282 | 2018-03-15T15:49:59 | 2018-03-15T15:49:59 | 124,892,038 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 393 |
java
|
package com.example.hp.matriseba.AccountActivity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.example.hp.matriseba.R;
public class SignupActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
}
}
|
[
"[email protected]"
] | |
ef0346def0c9565f53a72fb223e109bb7ffffe2f
|
bc5e6d9483c5b94878310a7c2a3e1dcb8d644202
|
/core/src/main/java/org/lineage/gameserver/network/clientpackets/RequestFriendList.java
|
f8eb1297f41b1e68944e519816ffaa24ff263487
|
[] |
no_license
|
finfan222/l2hf
|
17ecedb581c2f3f28d1b51229722082fa94560ae
|
bd3731afdac4791e19281790f47806fdcf6f11ae
|
refs/heads/master
| 2023-03-03T06:50:32.060299 | 2021-01-05T01:26:56 | 2021-01-05T01:26:56 | 326,816,095 | 0 | 0 | null | 2021-01-14T21:53:24 | 2021-01-04T21:50:23 |
Java
|
UTF-8
|
Java
| false | false | 2,382 |
java
|
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.lineage.gameserver.network.clientpackets;
import org.lineage.commons.network.PacketReader;
import org.lineage.gameserver.data.sql.impl.CharNameTable;
import org.lineage.gameserver.model.World;
import org.lineage.gameserver.model.actor.instance.PlayerInstance;
import org.lineage.gameserver.network.GameClient;
import org.lineage.gameserver.network.SystemMessageId;
import org.lineage.gameserver.network.serverpackets.SystemMessage;
/**
* @version $Revision: 1.3.4.3 $ $Date: 2005/03/27 15:29:30 $
*/
public class RequestFriendList implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
final PlayerInstance player = client.getPlayer();
if (player == null)
{
return;
}
SystemMessage sm;
// ======<Friend List>======
player.sendPacket(SystemMessageId.FRIENDS_LIST);
PlayerInstance friend = null;
for (int id : player.getFriendList())
{
// int friendId = rset.getInt("friendId");
final String friendName = CharNameTable.getInstance().getNameById(id);
if (friendName == null)
{
continue;
}
friend = World.getInstance().getPlayer(friendName);
if ((friend == null) || !friend.isOnline())
{
// (Currently: Offline)
sm = new SystemMessage(SystemMessageId.S1_CURRENTLY_OFFLINE);
sm.addString(friendName);
}
else
{
// (Currently: Online)
sm = new SystemMessage(SystemMessageId.S1_CURRENTLY_ONLINE);
sm.addString(friendName);
}
player.sendPacket(sm);
}
// =========================
player.sendPacket(SystemMessageId.EMPTY_3);
}
}
|
[
"[email protected]"
] | |
b7011b5b2baa14b81854cf9da2456b83afd21ade
|
552da6666774225176f17441d544496c77d31e67
|
/app/src/main/java/com/project/myapp/sharing/WebViewActivity.java
|
51afa30a9ee2aaccec1a152fcb15787f50626d79
|
[] |
no_license
|
attifmazhar/user_conenction
|
79959906b8707fef19e54c58996c251465416254
|
fc665aa119786e05146c96b851b77d5cfa8aa3f6
|
refs/heads/master
| 2022-10-15T03:42:30.416584 | 2019-02-27T07:26:57 | 2019-02-27T07:26:57 | 172,863,871 | 0 | 1 | null | 2022-10-03T05:58:13 | 2019-02-27T07:15:57 |
Java
|
UTF-8
|
Java
| false | false | 1,965 |
java
|
package com.project.myapp.sharing;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.project.myapp.Bl_Settings;
import com.project.myapp.R;
public class WebViewActivity extends Activity {
private WebView webView;
public static String EXTRA_URL = "extra_url";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview);
setTitle("Login");
final String url = this.getIntent().getStringExtra(EXTRA_URL);
if (null == url) {
Log.e("Twitter", "URL cannot be null");
finish();
}
webView = (WebView) findViewById(R.id.webView);
webView.setWebViewClient(new MyWebViewClient());
webView.loadUrl(url);
}
class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains(getResources().getString(R.string.twitter_callback))) {
Uri uri = Uri.parse(url);
/* Sending results back */
String verifier = uri.getQueryParameter(getString(R.string.twitter_oauth_verifier));
Intent resultIntent = new Intent();
resultIntent.putExtra(getString(R.string.twitter_oauth_verifier), verifier);
setResult(RESULT_OK, resultIntent);
/* closing webview */
finish();
return true;
}
return false;
}
}
@Override
public boolean onKeyDown(int keycode, KeyEvent e) {
switch (keycode) {
case KeyEvent.KEYCODE_MENU:
// doSomething();
// Toast.makeText(getApplicationContext(), "Menu Button Pressed",
// Toast.LENGTH_SHORT).show();
try {
Intent i = new Intent(this, Bl_Settings.class);
startActivity(i);
} catch (Exception dd) {
}
return true;
}
return super.onKeyDown(keycode, e);
}
}
|
[
"[email protected]"
] | |
ab45a20122787fc00feed66c2b3ca14d4cbf5562
|
ff008c3c43ec520da85ea6bbf98b1fb2e05fdbb8
|
/app/src/main/java/mooc/vandy/java4android/shapes/logic/Logic.java
|
69bde2340c164669834b59d07c558f9f563c5dc2
|
[] |
no_license
|
Cleanshooter/assign01
|
340fa2d741a0d24e15244cd7822ad2752fc0c732
|
aa18816d74e430f18b671d54d7f5167575dc864c
|
refs/heads/master
| 2020-09-17T06:33:51.034989 | 2019-12-02T19:05:55 | 2019-12-02T19:05:55 | 224,020,931 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,511 |
java
|
package mooc.vandy.java4android.shapes.logic;
import mooc.vandy.java4android.shapes.ui.OutputInterface;
/**
* This is where the logic of this App is centralized for this assignment.
* <p>
* The assignments are designed this way to simplify your early
* Android interactions. Designing the assignments this way allows
* you to first learn key 'Java' features without having to beforehand
* learn the complexities of Android.
*/
public class Logic
implements LogicInterface {
/**
* This is a String to be used in Logging (if/when you decide you
* need it for debugging).
*/
public static final String TAG =
Logic.class.getName();
/*
* This is the variable that stores our OutputInterface instance.
* <p>
* This is how we will interact with the User Interface [MainActivity.java].
* <p>
* It is called 'out' because it is where we 'out-put' our
* results. (It is also the 'in-put' from where we get values
* from, but it only needs 1 name, and 'out' is good enough)
*/
private OutputInterface mOut;
/**
* These are the numeric values that you will receive from the
* User Interface and use in your calculations.
*/
private static double mRadius = 0;
private static double mLength = 0;
private static double mWidth = 0;
private static double mHeight = 0;
/**
* This is the constructor of this class.
* <p>
* It assigns the passed in [MainActivity] instance
* (which implements [OutputInterface]) to 'out'
*/
public Logic(OutputInterface out) {
mOut = out;
}
/**
* This is the method that will (eventually) get called when the
* on-screen button labeled 'Process...' is pressed.
*/
@Override
public void process() {
// Get which calculation should be computed. Do not worry
// about the specifics of this right now.
Shapes shapeForCalculations = mOut.getShape();
// Store the values returned by the User Interface.
mLength = mOut.getLength();
mWidth = mOut.getWidth();
mHeight = mOut.getHeight();
mRadius = mOut.getRadius();
// Determine which calculation to process right now. Again,
// do not worry about the specifics of how this works for now.
switch (shapeForCalculations) {
case Box:
mOut.print("A "
+ mLength
+ " by "
+ mWidth
+ " by "
+ mHeight
+ " box has a volume of: ");
mOut.println(""
+ String.format("%.2f",
boxVolume(mLength, mWidth, mHeight)));
mOut.println("");
mOut.print("A "
+ mLength
+ " by "
+ mWidth
+ " by "
+ mHeight
+ " box has a surface area of: ");
mOut.println(""
+ String.format("%.2f",
boxSurfaceArea(mLength, mWidth, mHeight)));
mOut.println("");
// If you are paying attention, you will notice that
// there is no 'break;' here like there is in other
// places, meaning that if 'Box' was selected, it will
// run the two sets of print statements above and the
// two statements below until the 'break;' statement.
case Rectangle:
mOut.print("A "
+ mLength
+ " by "
+ mWidth
+ " rectangle has a perimeter of: ");
mOut.println("" + String.format("%.2f",
rectanglePerimeter(mLength, mWidth)));
mOut.println("");
mOut.print("A "
+ mLength
+ " by "
+ mWidth
+ " rectangle has area of: ");
mOut.println("" + String.format("%.2f", rectangleArea(mLength, mWidth)));
mOut.println("");
break;
case Sphere:
mOut.print("A sphere with radius " + mRadius + " has a volume of: ");
mOut.println("" + String.format("%.2f", sphereVolume(mRadius)));
mOut.println("");
mOut.print("A sphere with radius " + mRadius + " has surface area of: ");
mOut.println("" + String.format("%.2f", sphereSurfaceArea(mRadius)));
mOut.println("");
// Same here as with 'Box' above. If 'Sphere' is picked, it will run the
// two sets of print statements above and the two below until the 'break;'
case Circle:
mOut.print("A circle with radius " + mRadius + " has a perimeter of: ");
mOut.println("" + String.format("%.2f", circleCircumference(mRadius)));
mOut.println("");
mOut.print("A circle with radius " + mRadius + " has area of: ");
mOut.println("" + String.format("%.2f", circleArea(mRadius)));
mOut.println("");
break;
case Triangle:
mOut.print("A right triangle with base "
+ mLength
+ " and height "
+ mWidth + " has a perimeter of: ");
mOut.println(""
+ String.format("%.2f", rightTrianglePerimeter(mLength,
mWidth)));
mOut.println("");
mOut.print("A right triangle with base "
+ mLength
+ " and height "
+ mWidth
+ " has area of: ");
mOut.println(""
+ String.format("%.2f", rightTriangleArea(mLength,
mWidth)));
mOut.println("");
break;
default:
break;
}
}
// TODO -- add your code here
public static double boxVolume(double mLength, double mWidth, double mHeight) {
double volume = mLength * mWidth * mHeight;
return volume;
}
public static double boxSurfaceArea(double mLength, double mWidth, double mHeight) {
double area = (2 * (mHeight * mWidth)) + 2 * (mHeight * mLength) + 2 * (mWidth * mLength);
return area;
}
public static double rectanglePerimeter(double l, double w) {
return 2 * (l + w);
}
public static double rectangleArea(double l, double w) {
return l * w;
}
public static double sphereVolume(double r) {
return (4.0 / 3.0) * Math.PI * Math.pow(r, 3);
}
public static double sphereSurfaceArea(double r) {
return 4 * Math.PI * Math.pow(r, 2);
}
public static double circleCircumference(double r) {
return 2 * Math.PI * r;
}
public static double circleArea(double r) {
return Math.PI * r * r;
}
public static double rightTrianglePerimeter(double l, double w) {
return l + w + Math.sqrt(l * l + w * w);
}
public static double rightTriangleArea(double l, double w) {
return (l * w) / 2;
}
}
|
[
"[email protected]"
] | |
e8c4dcf216f563ba6da92c501a77f70dc62bb04b
|
8502e1e47522318bf3539d5ef057f124e2e75166
|
/1.4/src/org/apache/axis/utils/cache/MethodCache.java
|
1c4976c7ded9a2f99894ede8098301e358066810
|
[
"Apache-2.0"
] |
permissive
|
YellowfinBI/apache-axis
|
5833d3b86ab9fef3f3264c05592ef7ed66e6970a
|
e7640afc686fb3f48a211bc956e03820c345c4ba
|
refs/heads/master
| 2023-05-24T17:22:30.715882 | 2023-05-18T00:56:42 | 2023-05-18T00:56:42 | 78,585,682 | 0 | 1 | null | 2023-05-18T00:56:43 | 2017-01-10T23:56:51 |
Java
|
UTF-8
|
Java
| false | false | 7,424 |
java
|
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* 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.apache.axis.utils.cache;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.apache.axis.utils.ClassUtils;
/**
* A cache for methods.
* Used to get methods by their signature and stores them in a local
* cache for performance reasons.
* This class is a singleton - so use getInstance to get an instance of it.
*
* @author Davanum Srinivas <[email protected]>
* @author Sebastian Dietrich <[email protected]>
*/
public class MethodCache {
/**
* The only instance of this class
*/
transient private static MethodCache instance;
/**
* Cache for Methods
* In fact this is a map (with classes as keys) of a map (with method-names as keys)
*/
transient private static ThreadLocal cache;
/**
* The <i>private</i> constructor for this class.
* Use getInstance to get an instance (the only one).
*/
private MethodCache() {
cache = new ThreadLocal();
}
/**
* Gets the only instance of this class
* @return the only instance of this class
*/
public static MethodCache getInstance() {
if (instance == null) {
instance = new MethodCache();
}
return instance;
}
/**
* Returns the per thread hashmap (for method caching)
*/
private Map getMethodCache() {
Map map = (Map) cache.get();
if (map == null) {
map = new HashMap();
cache.set(map);
}
return map;
}
/**
* Class used as the key for the method cache table.
*
*/
static class MethodKey {
/** the name of the method in the cache */
private final String methodName;
/** the list of types accepted by the method as arguments */
private final Class[] parameterTypes;
/**
* Creates a new <code>MethodKey</code> instance.
*
* @param methodName a <code>String</code> value
* @param parameterTypes a <code>Class[]</code> value
*/
MethodKey(String methodName, Class[] parameterTypes) {
this.methodName = methodName;
this.parameterTypes = parameterTypes;
}
public boolean equals(Object other) {
MethodKey that = (MethodKey) other;
return this.methodName.equals(that.methodName)
&& Arrays.equals(this.parameterTypes,
that.parameterTypes);
}
public int hashCode() {
// allow overloaded methods to collide; we'll sort it out
// in equals(). Note that String's implementation of
// hashCode already caches its value, so there's no point
// in doing so here.
return methodName.hashCode();
}
}
/** used to track methods we've sought but not found in the past */
private static final Object NULL_OBJECT = new Object();
/**
* Returns the specified method - if any.
*
* @param clazz the class to get the method from
* @param methodName the name of the method
* @param parameterTypes the parameters of the method
* @return the found method
*
* @throws NoSuchMethodException if the method can't be found
*/
public Method getMethod(Class clazz,
String methodName,
Class[] parameterTypes)
throws NoSuchMethodException {
String className = clazz.getName();
Map cache = getMethodCache();
Method method = null;
Map methods = null;
// Strategy is as follows:
// construct a MethodKey to represent the name/arguments
// of a method's signature.
//
// use the name of the class to retrieve a map of that
// class' methods
//
// if a map exists, use the MethodKey to find the
// associated value object. if that object is a Method
// instance, return it. if that object is anything
// else, then it's a reference to our NULL_OBJECT
// instance, indicating that we've previously tried
// and failed to find a method meeting our requirements,
// so return null
//
// if the map of methods for the class doesn't exist,
// or if no value is associated with our key in that map,
// then we perform a reflection-based search for the method.
//
// if we find a method in that search, we store it in the
// map using the key; otherwise, we store a reference
// to NULL_OBJECT using the key.
// Check the cache first.
MethodKey key = new MethodKey(methodName, parameterTypes);
methods = (Map) cache.get(clazz);
if (methods != null) {
Object o = methods.get(key);
if (o != null) { // cache hit
if (o instanceof Method) { // good cache hit
return (Method) o;
} else { // bad cache hit
// we hit the NULL_OBJECT, so this is a search
// that previously failed; no point in doing
// it again as it is a worst case search
// through the entire classpath.
return null;
}
} else {
// cache miss: fall through to reflective search
}
} else {
// cache miss: fall through to reflective search
}
try {
method = clazz.getMethod(methodName, parameterTypes);
} catch (NoSuchMethodException e1) {
if (!clazz.isPrimitive() && !className.startsWith("java.") && !className.startsWith("javax.")) {
try {
Class helper = ClassUtils.forName(className + "_Helper");
method = helper.getMethod(methodName, parameterTypes);
} catch (ClassNotFoundException e2) {
}
}
}
// first time we've seen this class: set up its method cache
if (methods == null) {
methods = new HashMap();
cache.put(clazz, methods);
}
// when no method is found, cache the NULL_OBJECT
// so that we don't have to repeat worst-case searches
// every time.
if (null == method) {
methods.put(key, NULL_OBJECT);
} else {
methods.put(key, method);
}
return method;
}
}
|
[
"[email protected]"
] | |
af8d9e0e98d480a8f48e5d363e9ab8cddf5918ec
|
727ed2070e81542403f6d9d9bcbaf804f96a5de7
|
/src/main/java/com/lattory/lattoryLotoBackEnd/web/dao/TransferFundsDao.java
|
7fd00a183245ca62c519ab39f38239ab6b798e06
|
[] |
no_license
|
EanDalin0012/lottory-lotolte-backend
|
bc180bdc2607f1c9c393bec06baf2df274574b65
|
2e1036c8dd5ef9eb22ecfbb1b8ff68f31a70c76a
|
refs/heads/master
| 2023-07-27T19:24:51.375072 | 2021-09-12T08:36:19 | 2021-09-12T08:36:19 | 399,085,077 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 468 |
java
|
package com.lattory.lattoryLotoBackEnd.web.dao;
import com.lattory.lattoryLotoBackEnd.core.dto.JsonObject;
import com.lattory.lattoryLotoBackEnd.core.dto.JsonObjectArray;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TransferFundsDao {
JsonObjectArray inquiryHistoryTransferFundsByUser(JsonObject jsonObject);
int withdrawalTransferFunds(JsonObject jsonObject);
int depositTransferFunds(JsonObject jsonObject);
int count();
}
|
[
"[email protected]"
] | |
b93a1abfb64fe8c9137a17979849b8898faebf21
|
9fc1aba0a223a245d28fbe47c048d02014595acb
|
/apollo-demo/src/test/java/com/example/apollodemo/ApolloDemoApplicationTests.java
|
945d0bad691160c02095cec6d02ed45e32a2da80
|
[] |
no_license
|
jiang-anwei/study-v2
|
23394412f42e4707b0fc47f266e92cc4dfd025f5
|
4b19d2d61cbb639fd11c1503105e85d1b8fad52c
|
refs/heads/master
| 2022-12-03T05:32:58.915048 | 2020-07-10T06:24:20 | 2020-07-10T06:24:20 | 164,080,239 | 0 | 0 | null | 2022-11-21T22:37:13 | 2019-01-04T08:29:31 |
Java
|
UTF-8
|
Java
| false | false | 353 |
java
|
package com.example.apollodemo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApolloDemoApplicationTests {
@Test
public void contextLoads() {
}
}
|
[
"[email protected]"
] | |
68b06186a286ce115e661810938440c8674f8085
|
fb3ae2a897b3a52ef502cabc4000947d6d26e71b
|
/TvPal/src/main/java/is/gui/movies/RelatedMovieActivity.java
|
dcc77048b6976a727da7a94c08f821d46d7de5e6
|
[] |
no_license
|
thdg/TVpal
|
5276eac5698637fe3facad1824e3380def02fbb3
|
d02b15b0c181cd6930ed0bb044fe0db932806ae1
|
refs/heads/master
| 2021-01-13T01:55:44.028762 | 2014-02-09T00:22:40 | 2014-02-09T00:22:40 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,614 |
java
|
package is.gui.movies;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.GridView;
import android.widget.ProgressBar;
import java.util.List;
import is.gui.base.BaseActivity;
import is.contracts.datacontracts.trakt.TraktMovieDetailedData;
import is.handlers.adapters.TraktRelatedMoviesAdapter;
import is.parsers.trakt.TraktParser;
import is.tvpal.R;
public class RelatedMovieActivity extends BaseActivity
{
private GridView mGridView;
private ProgressBar mProgressBar;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_related_movies);
Initialize();
}
private void Initialize()
{
getActionBar().setDisplayHomeAsUpEnabled(true);
Intent intent = getIntent();
String imdbId = intent.getStringExtra(DetailedMovieActivity.EXTRA_MOVIEID);
mGridView = (GridView) findViewById(R.id.relatedMovies);
mProgressBar = (ProgressBar) findViewById(R.id.progressIndicator);
new GetRelatedMoviesWorker(this, imdbId).execute();
}
private class GetRelatedMoviesWorker extends AsyncTask<String, Void, List<TraktMovieDetailedData>>
{
private String imdbId;
private Context mContext;
public GetRelatedMoviesWorker(Context context, String imdbId)
{
this.imdbId = imdbId;
this.mContext = context;
}
@Override
protected List<TraktMovieDetailedData> doInBackground(String... strings)
{
try
{
return GetReleatedMovies();
}
catch (Exception ex)
{
Log.e(getClass().getName(), ex.getMessage());
}
return null;
}
@Override
protected void onPreExecute()
{
mProgressBar.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(List<TraktMovieDetailedData> movies)
{
if (movies == null || movies.size() != 0)
mGridView.setAdapter(new TraktRelatedMoviesAdapter(mContext, R.layout.listview_related_movie, movies));
mProgressBar.setVisibility(View.GONE);
}
private List<TraktMovieDetailedData> GetReleatedMovies()
{
TraktParser parser = new TraktParser();
return parser.GetReleatedMovies(imdbId);
}
}
}
|
[
"[email protected]"
] | |
9999f717d19b668ed7da54ff9495b0037513277a
|
b460b2f95173b2f7a5216316bb2e86f2bd53c608
|
/src/main/java/com/qy/dao/ChatsMapper.java
|
e46bb1128ad677cce7438e752ff7a9a893f464d1
|
[] |
no_license
|
ZiXingLY/socketinit
|
b4134367ae3545d3cc193130feeef4c733b60d59
|
bb1ec9046725fc540e7122a54ff95dd60889c34c
|
refs/heads/master
| 2020-03-19T09:12:46.770182 | 2018-06-06T03:51:49 | 2018-06-06T03:51:49 | 136,269,003 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 645 |
java
|
package com.qy.dao;
import com.qy.base.core.Mapper;
import com.qy.model.Chats;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface ChatsMapper extends Mapper<Chats> {
public List<Map> getUserChatsList(@Param("send_id") Integer send_id, @Param("target_id") Integer target_id);
public List<Map> getUserChatsGroupList(@Param("send_id") Integer member_id);
public List<Map> getUserGroup(@Param("send_id") Integer send_id, @Param("target_id") Integer target_id);
public void batchChangeChatsReadState(@Param("send_id") Integer send_id, @Param("target_id") Integer target_id);
}
|
[
"[email protected]"
] | |
4a8a4a03e3facace5da068e1df70cd032361c1af
|
197e68b9d67dde84f114415a8281bdfd4b9a2231
|
/pos_connector_micros/connector/src/main/java/com/connector/micros/porting/request/MicrosGetOpenChecks.java
|
28c28b67bd52fdef6c85441e13d9251ace806c92
|
[] |
no_license
|
RobertaBtt/micros_integration
|
62ef188b1771ee1da5c3f84514c24407c66327a5
|
5a0b53042e8be2c32821a5cf3caa5517046397b0
|
refs/heads/master
| 2020-12-09T20:25:01.845500 | 2020-01-12T21:47:24 | 2020-01-12T21:47:24 | 233,408,652 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 17,193 |
java
|
/**
* GetOpenChecksPorting.java
*/
package com.connector.micros.porting.request;
import com.micros_hosting.egateway.GetOpenChecks;
import org.apache.axis2.databinding.ADBException;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
/**
* GetOpenChecks bean class
*/
@SuppressWarnings({"unchecked",
"unused"
})
public class MicrosGetOpenChecks extends GetOpenChecks {
private static String namespaceUriServer;
private static String namespaceUri;
private static String targetEndPoint;
private QName MY_QNAME;
public QName getMY_QNAME() {
return MY_QNAME;
}
public MicrosGetOpenChecks(String namespaceUriServer, String namespaceUri, String targetEndPoint) {
//super();
this.namespaceUriServer = namespaceUriServer;
this.namespaceUri = namespaceUri;
this.targetEndPoint = targetEndPoint;
this.MY_QNAME = new QName(namespaceUriServer, "GetOpenChecks", "");
}
public void serialize(final QName parentQName, XMLStreamWriter xmlWriter, boolean serializeType)
throws XMLStreamException, ADBException {
String prefix = null;
String namespace = null;
prefix = parentQName.getPrefix();
namespace = "";
writeStartElement(prefix, namespace, parentQName.getLocalPart(),
xmlWriter);
if (serializeType) {
String namespacePrefix = registerPrefix(xmlWriter, namespaceUriServer);
if ((namespacePrefix != null) &&
(namespacePrefix.trim().length() > 0)) {
writeAttribute("xsi",
"http://www.w3.org/2001/XMLSchema-instance", "type",
namespacePrefix + ":GetOpenChecks", xmlWriter);
} else {
writeAttribute("xsi",
"http://www.w3.org/2001/XMLSchema-instance", "type",
"GetOpenChecks", xmlWriter);
}
}
if (localVendorCodeTracker) {
namespace = "";
writeStartElement(null, namespace, "vendorCode", xmlWriter);
if (localVendorCode == null) {
// write the nil attribute
throw new ADBException(
"vendorCode cannot be null!!");
} else {
xmlWriter.writeCharacters(localVendorCode);
}
xmlWriter.writeEndElement();
}
//namespace = namespaceUriServer;
namespace = "";
writeStartElement(null, namespace, "employeeObjectNum", xmlWriter);
if (localEmployeeObjectNum == Integer.MIN_VALUE) {
throw new ADBException(
"employeeObjectNum cannot be null!!");
} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
localEmployeeObjectNum));
}
xmlWriter.writeEndElement();
if (localOpenChecksTracker) {
if (localOpenChecks == null) {
throw new ADBException(
"openChecks cannot be null!!");
}
localOpenChecks.serialize(new QName(namespaceUriServer, "openChecks", ""),
xmlWriter);
}
xmlWriter.writeEndElement();
}
private static String generatePrefix(String namespace) {
if (namespace.equals(namespaceUriServer)) {
return "";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
/**
* Utility method to write an element start tag.
*/
private void writeStartElement(String prefix,
String namespace, String localPart,
XMLStreamWriter xmlWriter)
throws XMLStreamException {
String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(writerPrefix, localPart, namespace);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
}
xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}
/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(String prefix,
String namespace, String attName,
String attValue, XMLStreamWriter xmlWriter)
throws XMLStreamException {
String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeAttribute(writerPrefix, namespace, attName, attValue);
} else {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
xmlWriter.writeAttribute(prefix, namespace, attName, attValue);
}
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(String namespace,
String attName, String attValue,
XMLStreamWriter xmlWriter)
throws XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attValue);
} else {
xmlWriter.writeAttribute(registerPrefix(xmlWriter, namespace),
namespace, attName, attValue);
}
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(String namespace,
String attName, QName qname,
XMLStreamWriter xmlWriter)
throws XMLStreamException {
String attributeNamespace = qname.getNamespaceURI();
String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(attributePrefix, namespace, attName,
attributeValue);
}
}
/**
* method to handle Qnames
*/
private void writeQName(QName qname,
XMLStreamWriter xmlWriter)
throws XMLStreamException {
String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
xmlWriter.writeCharacters(prefix + ":" +
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
qname));
}
} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
qname));
}
}
private void writeQNames(QName[] qnames,
XMLStreamWriter xmlWriter)
throws XMLStreamException {
if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
StringBuffer stringToWrite = new StringBuffer();
String namespaceURI = null;
String prefix = null;
for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
stringToWrite.append(prefix).append(":")
.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}
}
/**
* Register a namespace prefix
*/
private String registerPrefix(
XMLStreamWriter xmlWriter, String namespace)
throws XMLStreamException {
String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
String uri = nsContext.getNamespaceURI(prefix);
if ((uri == null) || (uri.length() == 0)) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}
/**
* Factory class that keeps the parse method
*/
public static class Factory {
private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Factory.class);
/**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static GetOpenChecks parse(XMLStreamReader reader) throws Exception {
GetOpenChecks object = new GetOpenChecks();
int event;
QName currentQName = null;
String nillableValue = null;
String prefix = "";
String namespaceuri = "";
try {
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
currentQName = reader.getName();
if (reader.getAttributeValue(
"http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName != null) {
String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1) {
nsPrefix = fullTypeName.substring(0,
fullTypeName.indexOf(":"));
}
nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
String type = fullTypeName.substring(fullTypeName.indexOf(
":") + 1);
if (!"GetOpenChecks".equals(type)) {
//find namespace for the prefix
String nsUri = reader.getNamespaceContext()
.getNamespaceURI(nsPrefix);
return (MicrosGetOpenChecks) com.micros_hosting.egateway.ExtensionMapper.getTypeObject(nsUri,
type, reader);
}
}
}
// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector();
reader.next();
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isStartElement() &&
new QName(
namespaceUri, "vendorCode").equals(
reader.getName())) {
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"nil");
if ("true".equals(nillableValue) ||
"1".equals(nillableValue)) {
throw new ADBException(
"The element: " + "vendorCode" +
" cannot be null");
}
String content = reader.getElementText();
object.setVendorCode(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
content));
reader.next();
} // End of if for expected property start element
else {
}
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isStartElement() &&
new QName(namespaceUri,
"employeeObjectNum").equals(reader.getName())) {
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"nil");
if ("true".equals(nillableValue) ||
"1".equals(nillableValue)) {
throw new ADBException(
"The element: " + "employeeObjectNum" +
" cannot be null");
}
String content = reader.getElementText();
object.setEmployeeObjectNum(org.apache.axis2.databinding.utils.ConverterUtil.convertToInt(
content));
reader.next();
} // End of if for expected property start element
else {
// 1 - A start element we are not expecting indicates an invalid parameter was passed
throw new ADBException(
"Unexpected subelement " + reader.getName());
}
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isStartElement() &&
new QName(namespaceUri, "openChecks").equals(
reader.getName())) {
object.setOpenChecks(com.micros_hosting.egateway.SimphonyPosApi_OpenChecks.Factory.parse(
reader));
reader.next();
} // End of if for expected property start element
else {
}
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isStartElement()) {
// 2 - A start element we are not expecting indicates a trailing invalid property
throw new ADBException(
"Unexpected subelement " + reader.getName());
}
} catch (XMLStreamException e) {
throw new Exception(e);
}
return object;
}
} //end of factory class
}
|
[
"[email protected]"
] | |
40d459da55079185ccf958a65a1d09fb39295ace
|
37f714d973f6d2574777778b1e16699beacfbc55
|
/src/test/java/amazon/Proxies.java
|
d0ce4bad272985352c45ddcf4e8a42c6877dddfc
|
[] |
no_license
|
swathiannabathina/MyWork
|
fa172b75c501bdfd344544d8a7c6ff9128d5fefb
|
b37c98d144444aa4fb44f9c6bc0f81e97357d68e
|
refs/heads/master
| 2020-03-26T05:56:28.418250 | 2018-08-14T18:08:56 | 2018-08-14T18:08:56 | 144,581,785 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 236 |
java
|
package amazon;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Proxy;
public class Proxies {
public static Proxy extractProxy(Capabilities capabilities) {
return Proxy.extractFrom(capabilities);
}
}
|
[
"[email protected]"
] | |
9203aeaf3d2987e5391b8143009654c73d02c8bf
|
55dca62e858f1a44c2186774339823a301b48dc7
|
/code/my-app/functions/13/readChild_OptionGroup.java
|
482fba32c9aa09c6ed6ff3e3a4c809f3492180ae
|
[] |
no_license
|
jwiszowata/code_reaper
|
4fff256250299225879d1412eb1f70b136d7a174
|
17dde61138cec117047a6ebb412ee1972886f143
|
refs/heads/master
| 2022-12-15T14:46:30.640628 | 2022-02-10T14:02:45 | 2022-02-10T14:02:45 | 84,747,455 | 0 | 0 | null | 2022-12-07T23:48:18 | 2017-03-12T18:26:11 |
Java
|
UTF-8
|
Java
| false | false | 413 |
java
|
public void readChild(FreeColXMLReader xr) throws XMLStreamException {
String optionId = xr.readId();
Option option = getOption(optionId);
if (option == null) {
AbstractOption abstractOption = readOption(xr);
if (abstractOption != null) {
add(abstractOption);
abstractOption.setGroup(this.getId());
}
} else {
option.readFromXML(xr);
}
}
|
[
"[email protected]"
] | |
7a8fa528f676c0c0fabd0d4d240ae3c0a85d46d8
|
0777377904832f980fe627b611751c014de86808
|
/src/Service/Interfaces/Card.java
|
513446bb132f8a9c2f55929e53422c3952c22825
|
[] |
no_license
|
TurnOffTheLightz/UniversalOrganizer
|
e9c13d421ba0818e3324e46e759f9fb00d3f30bc
|
6562339b17af4240fc44359fed405bd1cc53517c
|
refs/heads/master
| 2020-07-14T06:00:47.964802 | 2019-09-11T15:21:55 | 2019-09-11T15:21:55 | 205,255,671 | 0 | 0 | null | 2019-10-01T17:14:47 | 2019-08-29T21:48:06 |
Java
|
UTF-8
|
Java
| false | false | 235 |
java
|
package Service.Interfaces;
public interface Card {
/*
classes that implement this interface mostly need following methods
*/
void initComponents();
void setContainerLayout();
void putContentTogether();
}
|
[
"[email protected]"
] | |
2819ab5b83437b1750ad30a4b495467dd55efa0c
|
b3143b62fbc869674392b3f536b1876af0b2611f
|
/jsf-registry-parent/jsf-registry-service/src/test/java/com/ipd/jsf/sqllite/test/domain/TestObj.java
|
d4571419252dcd6cbca0c2d3726a522c076ed0a3
|
[
"Apache-2.0"
] |
permissive
|
Mr-L7/jsf-core
|
6630b407caf9110906c005b2682d154da37d4bfd
|
90c8673b48ec5fd9349e4ef5ae3b214389a47f65
|
refs/heads/master
| 2020-03-18T23:26:17.617172 | 2017-12-14T05:52:55 | 2017-12-14T05:52:55 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,212 |
java
|
/**
* Copyright 2004-2048 .
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ipd.jsf.sqllite.test.domain;
public class TestObj {
private String name;
private String occupation;
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the occupation
*/
public String getOccupation() {
return occupation;
}
/**
* @param occupation the occupation to set
*/
public void setOccupation(String occupation) {
this.occupation = occupation;
}
}
|
[
"[email protected]"
] | |
c0a1ae79999c320a2f53fbcc2de2284d8488c1a8
|
830556b46e03f7fe18d2a4adbe5cdeb2d5153424
|
/src/main/java/natan/io/projeto1/service/UserService.java
|
091f34a1985ffc9e0ed112100944f25eae226b77
|
[] |
no_license
|
mauricio-grando/spring-projeto-2
|
4de5ff60adae4cc503f5bd23b2117a6de44cf7fb
|
3c9fc621a69eee40e7543c3aa1205fbff4416590
|
refs/heads/master
| 2020-04-09T06:51:35.578124 | 2018-12-03T04:08:05 | 2018-12-03T04:08:05 | 160,130,250 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 426 |
java
|
package natan.io.projeto1.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import natan.io.projeto1.entity.User;
import natan.io.projeto1.repository.UserRepository;
@Service
public class UserService {
@Autowired
UserRepository userRepository;
public List<User> findAll() {
return userRepository.findAll();
}
}
|
[
"[email protected]"
] | |
a04b7ab0eb50aa3720150c009b4bd96c0f56f0cc
|
5ad094b5d7df698e4b50574b7dc27d4d1ec74082
|
/app/src/main/java/com/sayeedul/instaclone/MainActivity.java
|
7e8e342f6bd5276be6a46ef8f44bf1033753e853
|
[] |
no_license
|
sayeedul/InstaClone
|
6138daaa04eac8c6433a52e9802064080bc50040
|
374c612b244be9cc6f9211acab06f2592646be0b
|
refs/heads/master
| 2020-03-23T17:18:51.575054 | 2018-07-22T11:08:47 | 2018-07-22T11:08:47 | 141,853,676 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,535 |
java
|
package com.sayeedul.instaclone;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.parse.LogInCallback;
import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseUser;
import com.parse.ParseInstallation;
import com.parse.SignUpCallback;
public class MainActivity extends AppCompatActivity {
Button login;
EditText user,pass;
String username,password;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Parse.initialize(this);
ParseInstallation.getCurrentInstallation().saveInBackground();
user = (EditText)findViewById(R.id.userET);
pass = (EditText)findViewById(R.id.passET);
login = (Button)findViewById(R.id.loginBTN);
username = user.getText().toString();
password = pass.getText().toString();
ParseUser currentUser = ParseUser.getCurrentUser();
if(currentUser!=null)
{
//Alreday signed in,,, SHOW USER LISTS...
Intent intent = new Intent(MainActivity.this,HomeActivity.class);
startActivity(intent);
}
else
{
Toast.makeText(this, "please Login.", Toast.LENGTH_SHORT).show();
}
}
public void click(View view)
{
ParseUser.logInInBackground(user.getText().toString().trim(), pass.getText().toString().trim(), new LogInCallback() {
@Override
public void done(ParseUser parseUser, ParseException e) {
if (parseUser != null || ParseUser.getCurrentUser() != null) {
alertDisplayer1("Sucessful Login", "Welcome back " + user.getText().toString().toUpperCase() + " !");
} else {
alertSignup();
}
}
});
}
private void alertDisplayer1(String title,String message){
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this)
.setTitle(title)
.setIcon(R.drawable.loginwelcome)
.setMessage(message)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
// don't forget to change the line below with the names of your Activities
Intent intent = new Intent(MainActivity.this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
});
AlertDialog ok = builder.create();
ok.show();
}
private void alertSignup()
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MainActivity.this);
alertDialogBuilder.setTitle("SIGN UP");
alertDialogBuilder.setMessage("User Doesn't Exist! Are You Sure To Signup With this Credential ? ");
alertDialogBuilder.setIcon(R.drawable.signup1);
alertDialogBuilder.setPositiveButton("YES,Proceed", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(MainActivity.this, "PLease Wait..... ", Toast.LENGTH_SHORT).show();
Intent i = new Intent(MainActivity.this,OtpActivity.class);
i.putExtra("USERNAME",user.getText().toString());
i.putExtra("PASSWORD",pass.getText().toString());
startActivity(i);
}
});
alertDialogBuilder.setNegativeButton("NO, Don't SignUp", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(MainActivity.this, "Staying On this Page.... ", Toast.LENGTH_SHORT).show();
dialog.cancel();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
}
|
[
"[email protected]"
] | |
4f401f3136f98632ca72fba16d79524e4a110b79
|
babd26f0f070af66d7ef803344c448feebd90cf2
|
/APS/src/main/java/br/com/aps/unip/model/Produto.java
|
f9d91547af2188d520cf9d3f17631d73885baafd
|
[] |
no_license
|
gabrielgonoring/aps
|
154584ee11f3cec42a845233193143773be31ec5
|
2c1bb923d974b4c2ce7cd7563fe6191ddfa00ed4
|
refs/heads/master
| 2020-05-24T23:00:02.610881 | 2019-05-19T17:57:45 | 2019-05-19T17:57:45 | 187,506,467 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,710 |
java
|
package br.com.aps.unip.model;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import br.com.aps.unip.exception.ValorInvalidoException;
@Entity
@Table(name="tb_produto")
public class Produto {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id_produto")
private Integer id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="id_tipo_produto")
private TipoProduto tipoProduto;
@Column(name="valor_produto")
private BigDecimal valor;
@Column(name="quantidade_estoque")
private Integer quantidade;
@Column(name="desc_produto")
private String descricao;
@Column(name="fg_ativo")
private Boolean ativo;
public Produto() {
}
public Produto(Integer id) {
setId(id);
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public TipoProduto getTipoProduto() {
return tipoProduto;
}
public void setTipoProduto(TipoProduto tipoProduto) {
if (tipoProduto==null)
throw new ValorInvalidoException("o tipo do produto não pode nem ser nulo");
this.tipoProduto = tipoProduto;
}
public BigDecimal getValor() {
return valor;
}
public void setValor(BigDecimal valor) {
String svalor = valor.toString();
if((svalor.indexOf(".")>5)||(svalor.length()-1 - svalor.indexOf(".")>2)||valor.doubleValue()<=0)
throw new ValorInvalidoException("O valor não pode ter 7 casa antes da vírgunla e nem mais de 2 casas decimais depois da vírgula e nem ser menor ou igual a zero");
this.valor = valor;
}
public Integer getQuantidade() {
return quantidade;
}
public void setQuantidade(Integer quantidade) {
if(quantidade==null||quantidade<0)
throw new ValorInvalidoException("a quantidade do produto não pode ser menor que 0 e nem ser vazia");
this.quantidade = quantidade;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
if (descricao==null||descricao.length()>60 || descricao.length()<=0)
throw new ValorInvalidoException("a descrição do produto não pode ter mais do que 60 caracteres e nem ser vazia");
this.descricao = descricao;
}
public Boolean getAtivo() {
return ativo;
}
public void setAtivo(Boolean ativo) {
if (ativo==null)
throw new ValorInvalidoException("o atruibuto ativo não pode nem ser nulo");
this.ativo = ativo;
}
}
|
[
"gabriel@DESKTOP-4EH48U2"
] |
gabriel@DESKTOP-4EH48U2
|
04331272d64c36fa4e3a3def7bd84542f295cec9
|
88acd9fedfe6f2accd8bf2968f3315e2057ace83
|
/CrudWebService/src/main/java/com/jaxb/person/package-info.java
|
71580ddffb36c16f21420b1d6febb423b55a35a7
|
[] |
no_license
|
Venkatesh-Azhagiri/SpringWsSoap
|
be7cc9b6aa4748736610500a17067665478e8193
|
d5e7b0ad1ca75204e37a139b5907d425b2369188
|
refs/heads/master
| 2021-06-01T08:26:59.007012 | 2016-07-26T17:09:08 | 2016-07-26T17:09:08 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 502 |
java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.07.04 at 08:09:24 PM IST
//
@javax.xml.bind.annotation.XmlSchema(namespace = "http://com/crud/person", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package com.jaxb.person;
|
[
"[email protected]"
] | |
8b1d4147c3a46254cf943db387b13ee387c9e294
|
89a58afb1a4c908f84383c33d8ca3efaf717fe78
|
/src/main/java/com/sy/model/Collectitems.java
|
24e22dc6b17f2dc37089bdc2a39ebfaf74d66b4d
|
[] |
no_license
|
JsonEye/YIMEM
|
c65a67582d380213ea9e036a44a8af41aabb73fe
|
c94cbc4b2d61aa905e88752c65db5c40ae8e3438
|
refs/heads/master
| 2022-12-28T06:56:47.012951 | 2020-10-04T19:19:03 | 2020-10-04T19:19:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,928 |
java
|
package com.sy.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
public class Collectitems {
private Integer id;
private Integer blogid;
private Integer uploadID;
private Integer askID;
private Integer forumID;
private Integer collectid;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai")
private Date createTime;
@Override
public String toString() {
return "Collectitems{" +
"id=" + id +
", blogid=" + blogid +
", uploadID=" + uploadID +
", askID=" + askID +
", forumID=" + forumID +
", collectid=" + collectid +
", createTime=" + createTime +
'}';
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getBlogid() {
return blogid;
}
public void setBlogid(Integer blogid) {
this.blogid = blogid;
}
public Integer getUploadID() {
return uploadID;
}
public void setUploadID(Integer uploadID) {
this.uploadID = uploadID;
}
public Integer getAskID() {
return askID;
}
public void setAskID(Integer askID) {
this.askID = askID;
}
public Integer getForumID() {
return forumID;
}
public void setForumID(Integer forumID) {
this.forumID = forumID;
}
public Integer getCollectid() {
return collectid;
}
public void setCollectid(Integer collectid) {
this.collectid = collectid;
}
}
|
[
"[email protected]"
] | |
3265c7d23420d6bab7bf168b169aafd2924d6157
|
dde473a73a9469b3d83d75fa4f11df654bdedb8b
|
/test/FirstJUnit.java
|
859988fb74982e8349f1d06a2b29acfb82134064
|
[] |
no_license
|
thiennguyenenv/selenium-test
|
da23ef357299c1219c266c2bb02b3c0a11d7fb85
|
c787c58dd894745caf31bbd4b471603759ca2693
|
refs/heads/master
| 2016-09-05T16:50:01.514576 | 2015-03-03T09:15:25 | 2015-03-03T09:15:25 | 31,645,360 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,724 |
java
|
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.internal.FindsById;
import org.openqa.selenium.internal.FindsByName;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.concurrent.TimeUnit;
/**
* Created by Thien (Theodore) on 3/2/2015.
*/
public class FirstJUnit {
private WebDriver selenium;
@Before
public void setup() {
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.startup.homepage", "http://book.theautomatedtester.co.uk/chapter4");
selenium = new FirefoxDriver(profile);
}
@Test
public void shouldCheckButtonOnChapter2Page() {
Chapter2 ch2 = new Chapter2(selenium).get();
Assert.assertTrue(ch2.isButtonPresent("but1"));
}
@Test
public void shouldCheckAnotherButtonOnChapter2Page(){
Chapter2 ch2 = loadHomePage().clickChapter2();
Assert.assertTrue(ch2.isButtonPresent("but1"));
}
@Test
public void testExample(){
selenium.get("http://book.theautomatedtester.co.uk/chapter2");
// implicit waiting
// selenium.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// explicit waiting, findElement will fire NoSuchElementException if not found, we can use findElements to get around.
WebElement element = new WebDriverWait(selenium, 10).until(new ExpectedCondition<WebElement>() {
@Override
public WebElement apply(WebDriver webDriver) {
return webDriver.findElement(By.xpath("//input[@name = 'verifybutton']"));
}
});
((FindsByName)selenium).findElementByName("verifybutton");
}
@Test
public void testExampleChap4(){
// selenium.get("http://book.theautomatedtester.co.uk/chapter4");
WebElement element = selenium.findElement((By.id("nextBid")));
element.sendKeys("100");
}
@After
public void teardown(){
selenium.quit();
}
private Chapter2 clickAndLoadChapter2() {
selenium.findElement(By.linkText("Chapter2")).click();
return PageFactory.initElements(selenium, Chapter2.class);
}
private HomePage loadHomePage() {
selenium.get("http://book.theautomatedtester.co.uk");
return new HomePage(selenium);
}
}
|
[
"[email protected]"
] | |
d0bef28d2da86d3c48f3ac72304f03c8bcbc868f
|
4950529eb402981192ba164bfd66fbe1d4349f83
|
/src/main/java/me/gammadelta/datagen/Recipes.java
|
b82b63b58fead76a823f2a3aa990ee9a46f35a5a
|
[
"MIT"
] |
permissive
|
gamma-delta/axiomatic_teleportation
|
e414ac3e20edf4822eb006880fc66648f7b0ee97
|
2b36228d715f6b8a8ed42be3e73bf8ecca3bbafc
|
refs/heads/master
| 2023-02-14T03:15:11.391334 | 2021-01-11T22:22:00 | 2021-01-11T22:22:00 | 328,769,108 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,073 |
java
|
package me.gammadelta.datagen;
import me.gammadelta.AxiomaticTeleportationMod;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.IFinishedRecipe;
import net.minecraft.data.RecipeProvider;
import net.minecraft.data.ShapedRecipeBuilder;
import net.minecraft.item.Items;
import net.minecraftforge.common.Tags;
import java.util.function.Consumer;
public class Recipes extends RecipeProvider {
public Recipes(DataGenerator generatorIn) {
super(generatorIn);
}
@Override
protected void registerRecipes(Consumer<IFinishedRecipe> consumer) {
ShapedRecipeBuilder.shapedRecipe(AxiomaticTeleportationMod.LABCOAT.get())
.key('O', Tags.Items.ENDER_PEARLS).key('C', Items.LEATHER_CHESTPLATE).key('P', Items.PISTON)
.key('D', Tags.Items.GEMS_DIAMOND).key('R', Tags.Items.DUSTS_REDSTONE)
.patternLine(" D ").patternLine("OCO").patternLine("PRP")
.addCriterion("has_pearl", hasItem(Items.ENDER_PEARL))
.build(consumer);
}
}
|
[
"[email protected]"
] | |
2a5d9a0cdf895eded816577e184e66d33ea03ec2
|
7d8e971388cac76b394414b494aed8ceb0983672
|
/src/main/java/uz/telegram/bots/orderbot/bot/handler/message/state/OrderPhoneNumState.java
|
bfb7746be917ac9b843f38aebfc324245440e064
|
[] |
no_license
|
naughtyDog7/order-bot
|
f685fc48ac720c863f39f7214b339aaefe8a7266
|
3d9de3761160aeb53342e877b4c064940a08bb49
|
refs/heads/master
| 2023-01-10T21:41:08.928223 | 2020-10-15T13:33:57 | 2020-10-15T13:33:57 | 288,638,170 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,437 |
java
|
package uz.telegram.bots.orderbot.bot.handler.message.state;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.telegram.telegrambots.bots.TelegramLongPollingBot;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import org.telegram.telegrambots.meta.api.objects.Contact;
import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import uz.telegram.bots.orderbot.bot.service.CategoryService;
import uz.telegram.bots.orderbot.bot.service.OrderService;
import uz.telegram.bots.orderbot.bot.service.ProductWithCountService;
import uz.telegram.bots.orderbot.bot.service.TelegramUserService;
import uz.telegram.bots.orderbot.bot.user.Category;
import uz.telegram.bots.orderbot.bot.user.Order;
import uz.telegram.bots.orderbot.bot.user.TelegramUser;
import uz.telegram.bots.orderbot.bot.util.KeyboardFactory;
import uz.telegram.bots.orderbot.bot.util.KeyboardUtil;
import uz.telegram.bots.orderbot.bot.util.LockFactory;
import uz.telegram.bots.orderbot.bot.util.ResourceBundleFactory;
import java.util.List;
import java.util.ResourceBundle;
import java.util.concurrent.locks.Lock;
import static uz.telegram.bots.orderbot.bot.handler.message.state.UserState.LOCATION_SENDING;
import static uz.telegram.bots.orderbot.bot.util.KeyboardFactory.KeyboardType.LOCATION_KEYBOARD;
import static uz.telegram.bots.orderbot.bot.util.KeyboardFactory.KeyboardType.PHONE_NUM_ENTER_KEYBOARD;
@Component
@Slf4j
class OrderPhoneNumState implements MessageState {
private final ResourceBundleFactory rbf;
private final TelegramUserService userService;
private final OrderService orderService;
private final CategoryService categoryService;
private final ProductWithCountService pwcService;
private final KeyboardFactory kf;
private final KeyboardUtil ku;
private final LockFactory lf;
private final BadRequestHandler badRequestHandler;
@Autowired
OrderPhoneNumState(ResourceBundleFactory rbf, TelegramUserService userService,
OrderService orderService, CategoryService categoryService,
ProductWithCountService pwcService, KeyboardFactory kf, KeyboardUtil ku,
LockFactory lf, BadRequestHandler badRequestHandler) {
this.rbf = rbf;
this.userService = userService;
this.orderService = orderService;
this.categoryService = categoryService;
this.pwcService = pwcService;
this.kf = kf;
this.ku = ku;
this.lf = lf;
this.badRequestHandler = badRequestHandler;
}
@Override
//can come as contact, back button, confirm button, and change button
public void handle(Update update, TelegramLongPollingBot bot, TelegramUser telegramUser) {
Message message = update.getMessage();
ResourceBundle rb = rbf.getMessagesBundle(telegramUser.getLangISO());
Lock lock = lf.getResourceLock();
try {
lock.lock();
Order order = orderService.findActive(telegramUser)
.orElseThrow(() -> new AssertionError("Order must be present at this point"));
if (message.hasText()) {
String messageText = message.getText();
handleMessageText(bot, telegramUser, rb, order, messageText);
} else if (message.hasContact()) {
handleContact(bot, telegramUser, message.getContact(), rb);
} else {
badRequestHandler.handleContactBadRequest(bot, telegramUser, rb);
}
} finally {
lock.unlock();
}
}
private void handleContact(TelegramLongPollingBot bot, TelegramUser telegramUser,
Contact contact, ResourceBundle rb) {
String phoneNum = contact.getPhoneNumber();
handleNewPhoneNum(bot, telegramUser, rb, phoneNum);
}
private void handleMessageText(TelegramLongPollingBot bot, TelegramUser telegramUser, ResourceBundle rb, Order order, String messageText) {
String btnBack = rb.getString("btn-back");
String btnConfirm = rb.getString("btn-confirm");
String btnChangeNum = rb.getString("btn-change-existing-phone-num");
String phoneNum = telegramUser.getPhoneNum();
if (messageText.equals(btnBack))
handleBack(bot, telegramUser, rb, order);
else if (phoneNum != null && messageText.equals(btnConfirm))
handleConfirmPhoneNum(bot, telegramUser, rb);
else if (phoneNum != null && messageText.equals(btnChangeNum))
handleChangePhoneNum(bot, telegramUser, rb);
else
handleNewPhoneNum(bot, telegramUser, rb, messageText);
}
private void handleBack(TelegramLongPollingBot bot, TelegramUser telegramUser, ResourceBundle rb, Order order) {
long orderId = order.getId();
List<Category> categories = categoryService.findNonEmptyByOrderId(orderId);
int basketNumItems = pwcService.getBasketItemsCount(orderId);
ToOrderMainHandler.builder()
.bot(bot)
.service(userService)
.rb(rb)
.telegramUser(telegramUser)
.ku(ku)
.kf(kf)
.categories(categories)
.build()
.handleToOrderMain(basketNumItems, ToOrderMainHandler.CallerPlace.OTHER);
}
private void handleConfirmPhoneNum(TelegramLongPollingBot bot, TelegramUser telegramUser, ResourceBundle rb) {
SendMessage phoneNumConfirmedMessage = new SendMessage()
.setChatId(telegramUser.getChatId())
.setText(rb.getString("phone-num-confirmed"));
try {
bot.execute(phoneNumConfirmedMessage);
toLocationChoosing(bot, telegramUser, rb);
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
private void toLocationChoosing(TelegramLongPollingBot bot, TelegramUser telegramUser, ResourceBundle rb) {
try {
sendLocationMessage(bot, telegramUser, rb);
telegramUser.setCurState(LOCATION_SENDING);
userService.save(telegramUser);
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
private void sendLocationMessage(TelegramLongPollingBot bot, TelegramUser telegramUser, ResourceBundle rb) throws TelegramApiException {
SendMessage locationRequestMessage = new SendMessage()
.setText(rb.getString("request-send-location"))
.setChatId(telegramUser.getChatId());
setLocationKeyboard(telegramUser, locationRequestMessage);
bot.execute(locationRequestMessage);
}
private void setLocationKeyboard(TelegramUser telegramUser, SendMessage locationRequestMessage) {
ReplyKeyboardMarkup keyboard = kf.getKeyboard(LOCATION_KEYBOARD, telegramUser.getLangISO());
locationRequestMessage.setReplyMarkup(ku.addBackButtonLast(keyboard, telegramUser.getLangISO())
.setResizeKeyboard(true));
}
private void handleChangePhoneNum(TelegramLongPollingBot bot, TelegramUser telegramUser, ResourceBundle rb) {
SendMessage phoneNumRequestMessage = new SendMessage()
.setChatId(telegramUser.getChatId())
.setText(rb.getString("press-to-send-contact"));
setPhoneKeyboard(telegramUser, phoneNumRequestMessage);
try {
bot.execute(phoneNumRequestMessage);
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
private void setPhoneKeyboard(TelegramUser telegramUser, SendMessage message) {
ReplyKeyboardMarkup keyboard = kf.getKeyboard(PHONE_NUM_ENTER_KEYBOARD, telegramUser.getLangISO());
message.setReplyMarkup(ku.addBackButtonLast(keyboard, telegramUser.getLangISO())
.setResizeKeyboard(true));
}
private void handleNewPhoneNum(TelegramLongPollingBot bot, TelegramUser telegramUser, ResourceBundle rb, String phoneNum) {
try {
userService.checkAndSetPhoneNum(telegramUser, phoneNum);
log.info("Phone num updated, telegram user " + telegramUser);
userService.save(telegramUser);
handlePhoneNumUpdated(bot, telegramUser, rb);
} catch (IllegalArgumentException e) {
badRequestHandler.handleBadPhoneNumber(bot, telegramUser, rb);
}
}
private void handlePhoneNumUpdated(TelegramLongPollingBot bot, TelegramUser telegramUser, ResourceBundle rb) {
try {
sendPhoneNumUpdatedMessage(bot, telegramUser, rb);
toLocationChoosing(bot, telegramUser, rb);
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
private void sendPhoneNumUpdatedMessage(TelegramLongPollingBot bot, TelegramUser telegramUser, ResourceBundle rb) throws TelegramApiException {
SendMessage phoneSetSuccessMessage = new SendMessage()
.setText(rb.getString("phone-set-success"))
.setChatId(telegramUser.getChatId());
bot.execute(phoneSetSuccessMessage);
}
}
|
[
"[email protected]"
] | |
5b27cba12b0cd84adef1862e6f8a4512020c657b
|
8cb61e4c6503ea9a33d9c45de43268c2791ce80f
|
/app/src/main/java/com/test/todo/todo/taskdetail/AddEditTaskContract.java
|
c6b6a9f8776697bc2a02cf913be272742c8bc5f7
|
[] |
no_license
|
erhiteshkumar/Todo
|
16c1fa6fb0dd12ce60c61d32d0b45f7d842d210d
|
89c3d73c7f6228c2f15df155409bfe5a7ab867ed
|
refs/heads/master
| 2021-08-14T18:05:12.576698 | 2017-11-16T11:45:19 | 2017-11-16T11:45:19 | 110,963,614 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 624 |
java
|
package com.test.todo.todo.taskdetail;
import com.test.todo.todo.BasePresenter;
import com.test.todo.todo.BaseView;
/**
* Created by hitesh on 16/11/17.
*/
public interface AddEditTaskContract {
interface View extends BaseView<Presenter> {
void showEmptyTaskError();
void showTasksList();
void setTitle(String title);
void setDescription(String description);
boolean isActive();
}
interface Presenter extends BasePresenter<View> {
void saveTask(String title, String description);
void populateTask();
boolean isDataMissing();
}
}
|
[
"[email protected]"
] | |
b9011b632f7c2cee96b2d5f19326016c329b21a5
|
882a1a28c4ec993c1752c5d3c36642fdda3d8fad
|
/src/test/java/com/microsoft/bingads/v12/api/test/entities/adgroup_remarketing_list_association/read/BulkAdGroupRemarketingListAssociationReadTests.java
|
8c8426731dcd5cf7a2964d0d039eb133fd525150
|
[
"MIT"
] |
permissive
|
BazaRoi/BingAds-Java-SDK
|
640545e3595ed4e80f5a1cd69bf23520754c4697
|
e30e5b73c01113d1c523304860180f24b37405c7
|
refs/heads/master
| 2020-07-26T08:11:14.446350 | 2019-09-10T03:25:30 | 2019-09-10T03:25:30 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 940 |
java
|
package com.microsoft.bingads.v12.api.test.entities.adgroup_remarketing_list_association.read;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
BulkAdGroupRemarketingListAssociationReadFromRowValuesIdTest.class,
BulkAdGroupRemarketingListAssociationReadFromRowValuesAdGroupIdTest.class,
BulkAdGroupRemarketingListAssociationReadFromRowValuesAdGroupNameTest.class,
BulkAdGroupRemarketingListAssociationReadFromRowValuesCampaignNameTest.class,
BulkAdGroupRemarketingListAssociationReadFromRowValuesBidAdjustmentTest.class,
BulkAdGroupRemarketingListAssociationReadFromRowValuesAudienceIdTest.class,
BulkAdGroupRemarketingListAssociationReadFromRowValuesAudienceTest.class,
BulkAdGroupRemarketingListAssociationReadFromRowValuesStatusTest.class
})
public class BulkAdGroupRemarketingListAssociationReadTests {
}
|
[
"[email protected]"
] | |
c875cb75089cf472679755733e07f29fa93ac910
|
fc13829346ff86183743bd80a3e2617d10c5eb00
|
/src/lab19/Employee.java
|
75be59c426de5f6814c9b278747d61f3495def33
|
[] |
no_license
|
DvandenBerge/ListPractice
|
797dd0d09a81c1e660dc42183b3441cac34d8393
|
70056f000619e41ed0dd53bca7cba7705f4cf490
|
refs/heads/master
| 2021-01-10T17:10:15.944024 | 2015-10-29T21:30:58 | 2015-10-29T21:30:58 | 45,210,706 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,697 |
java
|
package lab19;
import java.util.*;
public class Employee {
private String lastName;
private String firstName;
private String ssn;
public Employee(String lastName, String firstName, String ssn) {
this.lastName = lastName;
this.firstName = firstName;
this.ssn = ssn;
}
public String getSsn() {
return ssn;
}
public void setSsn(String ssn) {
this.ssn = ssn;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Override
public String toString() {
return lastName+", "+firstName+", ssn: " + ssn;
}
@Override
public int hashCode() {
int hash = 3;
hash = 29 * hash + Objects.hashCode(this.lastName);
hash = 29 * hash + Objects.hashCode(this.firstName);
hash = 29 * hash + Objects.hashCode(this.ssn);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Employee other = (Employee) obj;
if (!Objects.equals(this.lastName, other.lastName)) {
return false;
}
if (!Objects.equals(this.firstName, other.firstName)) {
return false;
}
if (!Objects.equals(this.ssn, other.ssn)) {
return false;
}
return true;
}
}
|
[
"[email protected]"
] | |
466d34d1dad11e13f203c60b2a09d285e194a83f
|
4dc6db7bc2c5d13524673d42c84168da521ebaf9
|
/app/src/main/java/com/duomizhibo/phonelive/ui/SplashActivity.java
|
940a941a78fc2ebfd5e9c4540d0ff8fbc0db79af
|
[] |
no_license
|
androidxiao/android
|
1708153d0fda654cf47e2aa889d275a4719ad911
|
a1e2ecdcfdc6e55bcfe2d8a0ca4570395d2f8cad
|
refs/heads/master
| 2020-03-17T17:32:25.056655 | 2018-05-30T15:30:09 | 2018-05-30T15:30:09 | 133,792,170 | 2 | 6 | null | 2018-05-29T14:26:21 | 2018-05-17T09:40:12 |
Java
|
UTF-8
|
Java
| false | false | 4,236 |
java
|
package com.duomizhibo.phonelive.ui;
import java.util.ArrayList;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import com.duomizhibo.phonelive.adapter.ViewPagerGuideAdapter;
import com.duomizhibo.phonelive.utils.SharedPreUtil;
import com.duomizhibo.phonelive.R;
/**
*
* @author
* @功能描述:引导页
*/
public class SplashActivity extends Activity implements OnClickListener,
OnPageChangeListener {
// 定义ViewPager对象
private ViewPager viewPager;
// 定义ViewPager适配器
private ViewPagerGuideAdapter vpAdapter;
// 定义一个ArrayList来存放View
private ArrayList<View> views;
// 引导图片资源
private static final int[] pics = { R.drawable.guide1, R.drawable.guide2,
R.drawable.guide3 };
// 底部小点的图片
private ImageView[] points;
// 记录当前选中位置
private int currentIndex;
private Handler mHandler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
initView();
initData();
}
/**
* 初始化组件
*/
private void initView() {
// 实例化ArrayList对象
views = new ArrayList<View>();
// 实例化ViewPager
viewPager = (ViewPager) findViewById(R.id.vp_splash);
// 实例化ViewPager适配器
vpAdapter = new ViewPagerGuideAdapter(views);
}
/**
* 初始化数据
*/
private void initData() {
// 定义一个布局并设置参数
LinearLayout.LayoutParams mParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
// 初始化引导图片列表
for (int i = 0; i < pics.length; i++) {
ImageView iv = new ImageView(this);
iv.setLayoutParams(mParams);
//防止图片不能填满屏幕
iv.setScaleType(ScaleType.FIT_XY);
//加载图片资源
iv.setImageResource(pics[i]);
views.add(iv);
}
// 设置数据
viewPager.setAdapter(vpAdapter);
// 设置监听
viewPager.addOnPageChangeListener(this);
mHandler = new Handler();
// 初始化底部小点
//initPoint();
}
/**
* 滑动状态改变时调用
*/
@Override
public void onPageScrollStateChanged(int arg0) {
Log.i("1",String.valueOf(arg0));
}
private int i = 0;
/**
* 当前页面滑动时调用
*/
@Override
public void onPageScrolled(final int arg0, float arg1, int arg2) {
if(arg0==pics.length-1){
if(i==0) {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
SharedPreUtil.put(getApplicationContext(), "IS_FIRST_USE", false);
Intent intent = new Intent(SplashActivity.this, LiveLoginSelectActivity.class);
startActivity(intent);
finish();
}
}, 1000);
i++;
}
}
}
/**
* 新的页面被选中时调用
*/
@Override
public void onPageSelected(int arg0) {
// 设置底部小点选中状态
//setCurDot(arg0);
}
@Override
public void onClick(View v) {
int position = (Integer) v.getTag();
setCurView(position);
//setCurDot(position);
}
/**
* 设置当前页面的位置
*/
private void setCurView(int position) {
if (position < 0 || position >= pics.length) {
return;
}
viewPager.setCurrentItem(position);
}
}
|
[
"[email protected]"
] | |
53f71658fe54ec80f045cc3b6e096e1f7e524eac
|
5eac88edbdb783a4f9e6ef57a6e3cd206784d8af
|
/major-ankit/src/main/java/com/example/entity/Like.java
|
ffdf3d1ab6dacb4306045cff973e4bf6a5f60501
|
[] |
no_license
|
anny734/java-major-project
|
60cfc9a4842db0acbd6f3d081d77fce11d57963d
|
9a6b5ebb87653bffaabcfb6b82223afdd9d11c6e
|
refs/heads/master
| 2023-03-14T06:19:07.416187 | 2021-02-28T14:19:06 | 2021-02-28T14:19:06 | 343,121,884 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 731 |
java
|
package com.example.entity;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name ="Likes")
public class Like {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int likeId;
@ManyToOne(targetEntity = Course.class,cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name="courseId", referencedColumnName = "courseId")
private Course course;
}
|
[
"[email protected]"
] | |
d243a5eff751c28ae165f571d146d357373c1ea6
|
50316daf00362d3c3aebac6afd9ca33098f65462
|
/myssenger-server/src/main/java/ufrn/br/myssenger_server/App.java
|
552f9efead645db2e90f5a8b191233e252cf8ff6
|
[] |
no_license
|
gilneyjr/myssenger
|
9460c2239f02d258bbaee11730d77f1463091cb2
|
d15df43fca69aa8894cf1babb5534c686a3dff22
|
refs/heads/master
| 2020-08-06T14:30:43.105267 | 2019-10-05T15:05:26 | 2019-10-05T15:05:26 | 213,006,646 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 187 |
java
|
package ufrn.br.myssenger_server;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
|
[
"[email protected]"
] | |
d3f5cb7b4c464cc000c209fe77107b397db7d862
|
21bcd1da03415fec0a4f3fa7287f250df1d14051
|
/sources/androidx/core/provider/FontRequest.java
|
7679ab2bc7141103433b368e85f44acab380a516
|
[] |
no_license
|
lestseeandtest/Delivery
|
9a5cc96bd6bd2316a535271ec9ca3865080c3ec8
|
bc3fae8f30804a2520e6699df92c2e6a4a0a7cfc
|
refs/heads/master
| 2022-04-24T12:14:22.396398 | 2020-04-25T21:50:29 | 2020-04-25T21:50:29 | 258,875,870 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,619 |
java
|
package androidx.core.provider;
import android.util.Base64;
import androidx.annotation.C0186e;
import androidx.annotation.C0193h0;
import androidx.annotation.C0195i0;
import androidx.annotation.C0207n0;
import androidx.annotation.C0207n0.C0208a;
import androidx.core.p033k.C0944i;
import java.util.List;
public final class FontRequest {
private final List<List<byte[]>> mCertificates;
private final int mCertificatesArray;
private final String mIdentifier;
private final String mProviderAuthority;
private final String mProviderPackage;
private final String mQuery;
public FontRequest(@C0193h0 String str, @C0193h0 String str2, @C0193h0 String str3, @C0193h0 List<List<byte[]>> list) {
this.mProviderAuthority = (String) C0944i.m5337a(str);
this.mProviderPackage = (String) C0944i.m5337a(str2);
this.mQuery = (String) C0944i.m5337a(str3);
this.mCertificates = (List) C0944i.m5337a(list);
this.mCertificatesArray = 0;
StringBuilder sb = new StringBuilder(this.mProviderAuthority);
String str4 = "-";
sb.append(str4);
sb.append(this.mProviderPackage);
sb.append(str4);
sb.append(this.mQuery);
this.mIdentifier = sb.toString();
}
@C0195i0
public List<List<byte[]>> getCertificates() {
return this.mCertificates;
}
@C0186e
public int getCertificatesArrayResId() {
return this.mCertificatesArray;
}
@C0207n0({C0208a.LIBRARY_GROUP_PREFIX})
public String getIdentifier() {
return this.mIdentifier;
}
@C0193h0
public String getProviderAuthority() {
return this.mProviderAuthority;
}
@C0193h0
public String getProviderPackage() {
return this.mProviderPackage;
}
@C0193h0
public String getQuery() {
return this.mQuery;
}
public String toString() {
StringBuilder sb = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
sb2.append("FontRequest {mProviderAuthority: ");
sb2.append(this.mProviderAuthority);
sb2.append(", mProviderPackage: ");
sb2.append(this.mProviderPackage);
sb2.append(", mQuery: ");
sb2.append(this.mQuery);
sb2.append(", mCertificates:");
sb.append(sb2.toString());
for (int i = 0; i < this.mCertificates.size(); i++) {
sb.append(" [");
List list = (List) this.mCertificates.get(i);
for (int i2 = 0; i2 < list.size(); i2++) {
sb.append(" \"");
sb.append(Base64.encodeToString((byte[]) list.get(i2), 0));
sb.append("\"");
}
sb.append(" ]");
}
sb.append("}");
StringBuilder sb3 = new StringBuilder();
sb3.append("mCertificatesArray: ");
sb3.append(this.mCertificatesArray);
sb.append(sb3.toString());
return sb.toString();
}
public FontRequest(@C0193h0 String str, @C0193h0 String str2, @C0193h0 String str3, @C0186e int i) {
this.mProviderAuthority = (String) C0944i.m5337a(str);
this.mProviderPackage = (String) C0944i.m5337a(str2);
this.mQuery = (String) C0944i.m5337a(str3);
this.mCertificates = null;
C0944i.m5339a(i != 0);
this.mCertificatesArray = i;
StringBuilder sb = new StringBuilder(this.mProviderAuthority);
String str4 = "-";
sb.append(str4);
sb.append(this.mProviderPackage);
sb.append(str4);
sb.append(this.mQuery);
this.mIdentifier = sb.toString();
}
}
|
[
"[email protected]"
] | |
fb2c6b8d812a7cee68ba207e72eb57e838581c7c
|
63f5693ec984bfeedce21a5c282e125c3f3969ce
|
/core/src/main/java/com/auth/framework/core/tokens/jwt/keys/provider/Provider.java
|
6fbdac128a471bb629afa8d39a42246a641367c6
|
[] |
no_license
|
ahumyck/spring-auth
|
6956d2de36136f9fd54df970a8afb3e8d0c27706
|
e61f3d8c795cc710a3455d0a70989a40b08a092a
|
refs/heads/master
| 2023-05-05T00:57:15.562723 | 2021-05-30T21:16:44 | 2021-05-30T21:16:44 | 361,809,619 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 192 |
java
|
package com.auth.framework.core.tokens.jwt.keys.provider;
import com.auth.framework.exceptions.ProviderException;
public interface Provider<T> {
T provide() throws ProviderException;
}
|
[
"[email protected]"
] | |
3fbb1caa5d2c58cfc1523a44e2869b760c357e26
|
1bc2322f2a165f498c339e85ff4dcb3c464bf546
|
/app/src/main/java/com/zmy/knowledge/main/activity/head/HeadActivity.java
|
74af83852a1a15ae87f7a80f924098688e0ae4ac
|
[] |
no_license
|
zmyqucai8/knowledge_demo
|
e97307e7295cab83d1183ed392c12eb19d564f5d
|
234fc9e9bacc1781835f6815615c546c27d78a63
|
refs/heads/master
| 2021-01-21T10:08:35.861668 | 2017-08-16T07:04:47 | 2017-08-16T07:04:47 | 91,679,872 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,611 |
java
|
/*
* Copyright 2017 GcsSloop
*
* 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.
*
* Last modified 2017-04-08 23:15:33
*
* GitHub: https://github.com/GcsSloop
* Website: http://www.gcssloop.com
* Weibo: http://weibo.com/GcsSloop
*/
package com.zmy.knowledge.main.activity.head;
import android.content.Intent;
import android.graphics.Color;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zmy.knowledge.R;
import com.zmy.knowledge.base.app.BaseActivity;
import com.zmy.knowledge.base.app.ViewHolder;
import com.zmy.knowledge.main.adapter.HeadAdapter;
import com.zmy.knowledge.utlis.AUtils;
import com.zmy.knowledge.view.WfViewRefreshFrameLayout;
import java.util.List;
import in.srain.cube.views.ptr.PtrDefaultHandler;
import in.srain.cube.views.ptr.PtrFrameLayout;
/**
* 侧滑菜单 加头部 recycleview
*/
public class HeadActivity extends BaseActivity {
RecyclerView recyclerView;
private WfViewRefreshFrameLayout mXdaRefreshView;
HeadAdapter mAdapter;
List<String> testData;
public void initData() {
testData = AUtils.getTestData(20);
mAdapter = new HeadAdapter(testData);
LinearLayoutManager manager = new LinearLayoutManager(this);
manager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(manager);
mAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
//添加头部
TextView head = new TextView(this);
head.setText("头部哦");
head.setPadding(50, 50, 50, 50);
head.setBackgroundColor(Color.RED); //
mAdapter.addHeaderView(head);
head.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AUtils.showToast("我是头部");
}
});
recyclerView.setAdapter(mAdapter);
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
AUtils.showToast(testData.get(position) + "\n position=" + position);
}
});
mXdaRefreshView.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
refreshData();
}
@Override
public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) {
return !recyclerView.canScrollVertically(-1);
}
});
}
private void refreshData() {
testData.clear();
testData = AUtils.getTestData(20);
mAdapter.setNewData(testData);
//刷新完成
mXdaRefreshView.refreshComplete();
}
@Override
protected int getLayoutId() {
return R.layout.activity_hean;
}
@Override
protected void initViews(ViewHolder holder, View root) {
// recyclerView = holder.get(R.id.recyclerView);
// mXdaRefreshView = holder.get(R.id.xda_refresh_view);
// initData();
findViewById(R.id.btn_list).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(HeadActivity.this, PullToZoomListActivity.class));
}
});
findViewById(R.id.btn_scroll).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(HeadActivity.this, PullToZoomScrollActivity.class));
}
});
findViewById(R.id.btn_recycler_view).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(HeadActivity.this, PullToZoomRecyclerActivity.class));
}
});
}
}
|
[
"[email protected]"
] | |
98c81955b2bbcc1c5e2d110a74d1b4e382dc8f5d
|
74b47b895b2f739612371f871c7f940502e7165b
|
/aws-java-sdk-cloudtrail/src/main/java/com/amazonaws/services/cloudtrail/model/transform/StartQueryResultJsonUnmarshaller.java
|
3c2f037f9536ebed81f4b9028d27c663535ea1a0
|
[
"Apache-2.0"
] |
permissive
|
baganda07/aws-sdk-java
|
fe1958ed679cd95b4c48f971393bf03eb5512799
|
f19bdb30177106b5d6394223a40a382b87adf742
|
refs/heads/master
| 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 |
Apache-2.0
| 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null |
UTF-8
|
Java
| false | false | 2,764 |
java
|
/*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.cloudtrail.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.cloudtrail.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* StartQueryResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class StartQueryResultJsonUnmarshaller implements Unmarshaller<StartQueryResult, JsonUnmarshallerContext> {
public StartQueryResult unmarshall(JsonUnmarshallerContext context) throws Exception {
StartQueryResult startQueryResult = new StartQueryResult();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return startQueryResult;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("QueryId", targetDepth)) {
context.nextToken();
startQueryResult.setQueryId(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return startQueryResult;
}
private static StartQueryResultJsonUnmarshaller instance;
public static StartQueryResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new StartQueryResultJsonUnmarshaller();
return instance;
}
}
|
[
""
] | |
2192ad90f10a7f7f6d5ba0486601105aad3fdd4b
|
c173fc0a3d23ffda1a23b87da425036a6b890260
|
/hrsaas/src/org/paradyne/bean/Asset/AssetEmployee.java
|
ca1952f2725e982f3627dc9f99b43dea54374896
|
[
"Apache-2.0"
] |
permissive
|
ThirdIInc/Third-I-Portal
|
a0e89e6f3140bc5e5d0fe320595d9b02d04d3124
|
f93f5867ba7a089c36b1fce3672344423412fa6e
|
refs/heads/master
| 2021-06-03T05:40:49.544767 | 2016-08-03T07:27:44 | 2016-08-03T07:27:44 | 62,725,738 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 25,055 |
java
|
package org.paradyne.bean.Asset;
import java.util.ArrayList;
import org.paradyne.lib.BeanBase;
public class AssetEmployee extends BeanBase {
private String referenceId="";
private String messageStr ="";
private String myPageRejected="";
private String srNoIterator ="";
private ArrayList approverList =null ;
private String myPageAssigned ="";
private String approverCommentsFlag="false";
private String assetId="";
private String source="";
private int applicationLevel=0;
private String appcomment="";
private String hiddenappCode="";
private String employeeToken="";
private String employeeName="";
private String employeeId="";
private String keepInformedEmpId="";
private String keepInformedEmpName="";
private String serialNo="";
private ArrayList keepInformedList;
private String checkRemove="";
private String keepInfoFlag="true";
private String empName;
private String empCode;
private String approverCode;
private String srNo;
private String invCode;
private String asstHdType;
private String invCode1;
private String asstHdType1;
private String code;
private ArrayList list;
private String asstCode;
private String assignDate;
private String returnDate;
private String comments;
private String asstCode1;
private String assignDate1;
private String returnDate1;
private String select;
private String assetCode;
private String checkFlag;
private String chkFlag;
private String chkCode="false";
private String empToken="";
private String tableLength="";
private String assetSubType;
private String subTypeCode;
private String assetAvailable;
private String assetRequired;
private String assetInvType ;
private String paraId;
private String appl_No;
private String assetSubTypeIterator;
private String subTypeCodeIterator;
private String assetRequiredIterator;
private String status;
private String hiddenStatus;
private String isSentBack="false";
private String isApprove="false";
private String isAssign="false";
private String partialAssign="false";
private String partialAssignIt="false";
private String assetInvTypeIterator="false";
private String commentFlag="false";
private String approverName ;
private String approvedDate ;
private String approveStatus ;
private String approverComment ;
private String assetUnit;
private String assetUnitIterator;
private String assignCommentsFlag="false";
private ArrayList apprList;
/*
*
* used for asset assignment
*
*/
private String hiddenCategoryCode;
private String hiddenSubTypeCode;
private ArrayList assignList;
private ArrayList otherWarehouseList;
private String rowId;
private String quantityAssigned;
private String returnFlagIterator;
private String applCode;
private String empWarehouse;
private String empWarehouseCode;
private String assignComments;
private String assetSubTypeIteratorAssigned;
private String subTypeCodeIteratorAssigned;
private String assetCodeAssigned;
private String asstHdTypeAssigned;
private String assetAssignedIterator;
private String assetUnassignedIterator;
private String assetUnitIteratorAssigned;
private ArrayList assignedAssetList;
private ArrayList unassignedAssetList;
//private String quantityAvailable;
/*
*
*used for Asset request form
*
*/
private String reqCategory;
private String reqCategoryCode ;
private String reqSubType;
private String ReqSubTypeCode;
private String warehouseCode;
private String warehouseName;
private String reqQuantityAvailable;
private String reqQuantityRequired;
private String inventoryCodeReq;
private String masterCodeReq;
private String availableReq;
private String requiredReq;
private String noData="false";
private ArrayList warehouseList;
private String assetAssignDate="";
/*
* used for AssetEmployeeList
*/
private String listType;//to show pending, approved, rejected
private String listLengthApproved="false";
private String listLengthRejected="false";
private String listLengthAssigned="false";
private ArrayList draftList;
private ArrayList submittedList;
private ArrayList returnedList;
private ArrayList approvedList;
private ArrayList rejectedList;
private ArrayList assignedList;
private String branch;
private String dept;
private String desig;
private String hiddencode;
private String hdeleteCode;
private String myPage;
private String totalRecords;
public String getReqCategory() {
return reqCategory;
}
public void setReqCategory(String reqCategory) {
this.reqCategory = reqCategory;
}
public String getReqCategoryCode() {
return reqCategoryCode;
}
public void setReqCategoryCode(String reqCategoryCode) {
this.reqCategoryCode = reqCategoryCode;
}
public String getReqSubType() {
return reqSubType;
}
public void setReqSubType(String reqSubType) {
this.reqSubType = reqSubType;
}
public String getReqSubTypeCode() {
return ReqSubTypeCode;
}
public void setReqSubTypeCode(String reqSubTypeCode) {
ReqSubTypeCode = reqSubTypeCode;
}
public String getWarehouseCode() {
return warehouseCode;
}
public void setWarehouseCode(String warehouseCode) {
this.warehouseCode = warehouseCode;
}
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public String getReqQuantityAvailable() {
return reqQuantityAvailable;
}
public void setReqQuantityAvailable(String reqQuantityAvailable) {
this.reqQuantityAvailable = reqQuantityAvailable;
}
public String getReqQuantityRequired() {
return reqQuantityRequired;
}
public void setReqQuantityRequired(String reqQuantityRequired) {
this.reqQuantityRequired = reqQuantityRequired;
}
public String getApplCode() {
return applCode;
}
public void setApplCode(String applCode) {
this.applCode = applCode;
}
public String getRowId() {
return rowId;
}
public void setRowId(String rowId) {
this.rowId = rowId;
}
public String getHiddenCategoryCode() {
return hiddenCategoryCode;
}
public void setHiddenCategoryCode(String hiddenCategoryCode) {
this.hiddenCategoryCode = hiddenCategoryCode;
}
public String getHiddenSubTypeCode() {
return hiddenSubTypeCode;
}
public void setHiddenSubTypeCode(String hiddenSubTypeCode) {
this.hiddenSubTypeCode = hiddenSubTypeCode;
}
public ArrayList getAssignList() {
return assignList;
}
public void setAssignList(ArrayList assignList) {
this.assignList = assignList;
}
public String getCommentFlag() {
return commentFlag;
}
public void setCommentFlag(String commentFlag) {
this.commentFlag = commentFlag;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getAssetSubTypeIterator() {
return assetSubTypeIterator;
}
public void setAssetSubTypeIterator(String assetSubTypeIterator) {
this.assetSubTypeIterator = assetSubTypeIterator;
}
public String getSubTypeCodeIterator() {
return subTypeCodeIterator;
}
public void setSubTypeCodeIterator(String subTypeCodeIterator) {
this.subTypeCodeIterator = subTypeCodeIterator;
}
public String getAssetRequiredIterator() {
return assetRequiredIterator;
}
public void setAssetRequiredIterator(String assetRequiredIterator) {
this.assetRequiredIterator = assetRequiredIterator;
}
public String getEmpToken() {
return empToken;
}
public void setEmpToken(String empToken) {
this.empToken = empToken;
}
public String getChkCode() {
return chkCode;
}
public void setChkCode(String chkCode) {
this.chkCode = chkCode;
}
public String getChkFlag() {
return chkFlag;
}
public void setChkFlag(String chkFlag) {
this.chkFlag = chkFlag;
}
public String getCheckFlag() {
return checkFlag;
}
public void setCheckFlag(String checkFlag) {
this.checkFlag = checkFlag;
}
public String getAssetCode() {
return assetCode;
}
public void setAssetCode(String assetCode) {
this.assetCode = assetCode;
}
public String getAssignDate() {
return assignDate;
}
public void setAssignDate(String assignDate) {
this.assignDate = assignDate;
}
public String getReturnDate() {
return returnDate;
}
public void setReturnDate(String returnDate) {
this.returnDate = returnDate;
}
public String getAsstCode() {
return asstCode;
}
public void setAsstCode(String asstCode) {
this.asstCode = asstCode;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public ArrayList getList() {
return list;
}
public void setList(ArrayList list) {
this.list = list;
}
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
public String getEmpCode() {
return empCode;
}
public void setEmpCode(String empCode) {
this.empCode = empCode;
}
public String getSrNo() {
return srNo;
}
public void setSrNo(String srNo) {
this.srNo = srNo;
}
public String getInvCode() {
return invCode;
}
public void setInvCode(String invCode) {
this.invCode = invCode;
}
public String getAsstHdType() {
return asstHdType;
}
public void setAsstHdType(String asstHdType) {
this.asstHdType = asstHdType;
}
public String getSelect() {
return select;
}
public void setSelect(String select) {
this.select = select;
}
public String getInvCode1() {
return invCode1;
}
public void setInvCode1(String invCode1) {
this.invCode1 = invCode1;
}
public String getAsstHdType1() {
return asstHdType1;
}
public void setAsstHdType1(String asstHdType1) {
this.asstHdType1 = asstHdType1;
}
public String getAsstCode1() {
return asstCode1;
}
public void setAsstCode1(String asstCode1) {
this.asstCode1 = asstCode1;
}
public String getAssignDate1() {
return assignDate1;
}
public void setAssignDate1(String assignDate1) {
this.assignDate1 = assignDate1;
}
public String getReturnDate1() {
return returnDate1;
}
public void setReturnDate1(String returnDate1) {
this.returnDate1 = returnDate1;
}
public String getTableLength() {
return tableLength;
}
public void setTableLength(String tableLength) {
this.tableLength = tableLength;
}
public String getAssetSubType() {
return assetSubType;
}
public void setAssetSubType(String assetSubType) {
this.assetSubType = assetSubType;
}
public String getAssetAvailable() {
return assetAvailable;
}
public void setAssetAvailable(String assetAvailable) {
this.assetAvailable = assetAvailable;
}
public String getAssetRequired() {
return assetRequired;
}
public void setAssetRequired(String assetRequired) {
this.assetRequired = assetRequired;
}
public String getSubTypeCode() {
return subTypeCode;
}
public void setSubTypeCode(String subTypeCode) {
this.subTypeCode = subTypeCode;
}
public String getIsApprove() {
return isApprove;
}
public void setIsApprove(String isApprove) {
this.isApprove = isApprove;
}
public String getApproverName() {
return approverName;
}
public void setApproverName(String approverName) {
this.approverName = approverName;
}
public String getApprovedDate() {
return approvedDate;
}
public void setApprovedDate(String approvedDate) {
this.approvedDate = approvedDate;
}
public String getApproveStatus() {
return approveStatus;
}
public void setApproveStatus(String approveStatus) {
this.approveStatus = approveStatus;
}
public String getApproverComment() {
return approverComment;
}
public void setApproverComment(String approverComment) {
this.approverComment = approverComment;
}
public ArrayList getApprList() {
return apprList;
}
public void setApprList(ArrayList apprList) {
this.apprList = apprList;
}
public String getAssetUnit() {
return assetUnit;
}
public void setAssetUnit(String assetUnit) {
this.assetUnit = assetUnit;
}
public String getQuantityAssigned() {
return quantityAssigned;
}
public void setQuantityAssigned(String quantityAssigned) {
this.quantityAssigned = quantityAssigned;
}
public String getReturnFlagIterator() {
return returnFlagIterator;
}
public void setReturnFlagIterator(String returnFlagIterator) {
this.returnFlagIterator = returnFlagIterator;
}
public ArrayList getWarehouseList() {
return warehouseList;
}
public void setWarehouseList(ArrayList warehouseList) {
this.warehouseList = warehouseList;
}
public String getInventoryCodeReq() {
return inventoryCodeReq;
}
public void setInventoryCodeReq(String inventoryCodeReq) {
this.inventoryCodeReq = inventoryCodeReq;
}
public String getMasterCodeReq() {
return masterCodeReq;
}
public void setMasterCodeReq(String masterCodeReq) {
this.masterCodeReq = masterCodeReq;
}
public String getAvailableReq() {
return availableReq;
}
public void setAvailableReq(String availableReq) {
this.availableReq = availableReq;
}
public String getRequiredReq() {
return requiredReq;
}
public void setRequiredReq(String requiredReq) {
this.requiredReq = requiredReq;
}
public String getParaId() {
return paraId;
}
public void setParaId(String paraId) {
this.paraId = paraId;
}
public String getNoData() {
return noData;
}
public void setNoData(String noData) {
this.noData = noData;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public String getApproverCode() {
return approverCode;
}
public void setApproverCode(String approverCode) {
this.approverCode = approverCode;
}
public String getEmpWarehouse() {
return empWarehouse;
}
public void setEmpWarehouse(String empWarehouse) {
this.empWarehouse = empWarehouse;
}
public String getEmpWarehouseCode() {
return empWarehouseCode;
}
public void setEmpWarehouseCode(String empWarehouseCode) {
this.empWarehouseCode = empWarehouseCode;
}
public ArrayList getOtherWarehouseList() {
return otherWarehouseList;
}
public void setOtherWarehouseList(ArrayList otherWarehouseList) {
this.otherWarehouseList = otherWarehouseList;
}
public String getAssetInvType() {
return assetInvType;
}
public void setAssetInvType(String assetInvType) {
this.assetInvType = assetInvType;
}
public String getAssignCommentsFlag() {
return assignCommentsFlag;
}
public void setAssignCommentsFlag(String assignCommentsFlag) {
this.assignCommentsFlag = assignCommentsFlag;
}
public String getAssignComments() {
return assignComments;
}
public void setAssignComments(String assignComments) {
this.assignComments = assignComments;
}
public String getAssetUnitIterator() {
return assetUnitIterator;
}
public void setAssetUnitIterator(String assetUnitIterator) {
this.assetUnitIterator = assetUnitIterator;
}
public String getIsAssign() {
return isAssign;
}
public void setIsAssign(String isAssign) {
this.isAssign = isAssign;
}
public String getPartialAssign() {
return partialAssign;
}
public void setPartialAssign(String partialAssign) {
this.partialAssign = partialAssign;
}
public String getHiddenStatus() {
return hiddenStatus;
}
public void setHiddenStatus(String hiddenStatus) {
this.hiddenStatus = hiddenStatus;
}
public String getPartialAssignIt() {
return partialAssignIt;
}
public void setPartialAssignIt(String partialAssignIt) {
this.partialAssignIt = partialAssignIt;
}
public String getAssetAssignedIterator() {
return assetAssignedIterator;
}
public void setAssetAssignedIterator(String assetAssignedIterator) {
this.assetAssignedIterator = assetAssignedIterator;
}
public String getAssetUnassignedIterator() {
return assetUnassignedIterator;
}
public void setAssetUnassignedIterator(String assetUnassignedIterator) {
this.assetUnassignedIterator = assetUnassignedIterator;
}
public ArrayList getAssignedAssetList() {
return assignedAssetList;
}
public void setAssignedAssetList(ArrayList assignedAssetList) {
this.assignedAssetList = assignedAssetList;
}
public ArrayList getUnassignedAssetList() {
return unassignedAssetList;
}
public void setUnassignedAssetList(ArrayList unassignedAssetList) {
this.unassignedAssetList = unassignedAssetList;
}
public String getAssetSubTypeIteratorAssigned() {
return assetSubTypeIteratorAssigned;
}
public void setAssetSubTypeIteratorAssigned(String assetSubTypeIteratorAssigned) {
this.assetSubTypeIteratorAssigned = assetSubTypeIteratorAssigned;
}
public String getSubTypeCodeIteratorAssigned() {
return subTypeCodeIteratorAssigned;
}
public void setSubTypeCodeIteratorAssigned(String subTypeCodeIteratorAssigned) {
this.subTypeCodeIteratorAssigned = subTypeCodeIteratorAssigned;
}
public String getAssetCodeAssigned() {
return assetCodeAssigned;
}
public void setAssetCodeAssigned(String assetCodeAssigned) {
this.assetCodeAssigned = assetCodeAssigned;
}
public String getAsstHdTypeAssigned() {
return asstHdTypeAssigned;
}
public void setAsstHdTypeAssigned(String asstHdTypeAssigned) {
this.asstHdTypeAssigned = asstHdTypeAssigned;
}
public String getAssetUnitIteratorAssigned() {
return assetUnitIteratorAssigned;
}
public void setAssetUnitIteratorAssigned(String assetUnitIteratorAssigned) {
this.assetUnitIteratorAssigned = assetUnitIteratorAssigned;
}
public String getAssetInvTypeIterator() {
return assetInvTypeIterator;
}
public void setAssetInvTypeIterator(String assetInvTypeIterator) {
this.assetInvTypeIterator = assetInvTypeIterator;
}
public String getAppl_No() {
return appl_No;
}
public void setAppl_No(String appl_No) {
this.appl_No = appl_No;
}
public String getListType() {
return listType;
}
public void setListType(String listType) {
this.listType = listType;
}
public String getListLengthApproved() {
return listLengthApproved;
}
public void setListLengthApproved(String listLengthApproved) {
this.listLengthApproved = listLengthApproved;
}
public String getListLengthRejected() {
return listLengthRejected;
}
public void setListLengthRejected(String listLengthRejected) {
this.listLengthRejected = listLengthRejected;
}
public ArrayList getDraftList() {
return draftList;
}
public void setDraftList(ArrayList draftList) {
this.draftList = draftList;
}
public ArrayList getSubmittedList() {
return submittedList;
}
public void setSubmittedList(ArrayList submittedList) {
this.submittedList = submittedList;
}
public ArrayList getReturnedList() {
return returnedList;
}
public void setReturnedList(ArrayList returnedList) {
this.returnedList = returnedList;
}
public ArrayList getApprovedList() {
return approvedList;
}
public void setApprovedList(ArrayList approvedList) {
this.approvedList = approvedList;
}
public ArrayList getRejectedList() {
return rejectedList;
}
public void setRejectedList(ArrayList rejectedList) {
this.rejectedList = rejectedList;
}
public String getHiddencode() {
return hiddencode;
}
public void setHiddencode(String hiddencode) {
this.hiddencode = hiddencode;
}
public String getHdeleteCode() {
return hdeleteCode;
}
public void setHdeleteCode(String hdeleteCode) {
this.hdeleteCode = hdeleteCode;
}
public String getMyPage() {
return myPage;
}
public void setMyPage(String myPage) {
this.myPage = myPage;
}
public String getIsSentBack() {
return isSentBack;
}
public void setIsSentBack(String isSentBack) {
this.isSentBack = isSentBack;
}
public String getTotalRecords() {
return totalRecords;
}
public void setTotalRecords(String totalRecords) {
this.totalRecords = totalRecords;
}
public String getBranch() {
return branch;
}
public void setBranch(String branch) {
this.branch = branch;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public String getDesig() {
return desig;
}
public void setDesig(String desig) {
this.desig = desig;
}
public String getListLengthAssigned() {
return listLengthAssigned;
}
public void setListLengthAssigned(String listLengthAssigned) {
this.listLengthAssigned = listLengthAssigned;
}
public ArrayList getAssignedList() {
return assignedList;
}
public void setAssignedList(ArrayList assignedList) {
this.assignedList = assignedList;
}
public String getAssetAssignDate() {
return assetAssignDate;
}
public void setAssetAssignDate(String assetAssignDate) {
this.assetAssignDate = assetAssignDate;
}
public String getMessageStr() {
return messageStr;
}
public void setMessageStr(String messageStr) {
this.messageStr = messageStr;
}
public String getAppcomment() {
return appcomment;
}
public void setAppcomment(String appcomment) {
this.appcomment = appcomment;
}
public String getApproverCommentsFlag() {
return approverCommentsFlag;
}
public void setApproverCommentsFlag(String approverCommentsFlag) {
this.approverCommentsFlag = approverCommentsFlag;
}
public String getHiddenappCode() {
return hiddenappCode;
}
public void setHiddenappCode(String hiddenappCode) {
this.hiddenappCode = hiddenappCode;
}
public int getApplicationLevel() {
return applicationLevel;
}
public void setApplicationLevel(int applicationLevel) {
this.applicationLevel = applicationLevel;
}
public String getEmployeeToken() {
return employeeToken;
}
public void setEmployeeToken(String employeeToken) {
this.employeeToken = employeeToken;
}
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public String getEmployeeId() {
return employeeId;
}
public void setEmployeeId(String employeeId) {
this.employeeId = employeeId;
}
public String getKeepInformedEmpId() {
return keepInformedEmpId;
}
public void setKeepInformedEmpId(String keepInformedEmpId) {
this.keepInformedEmpId = keepInformedEmpId;
}
public String getKeepInformedEmpName() {
return keepInformedEmpName;
}
public void setKeepInformedEmpName(String keepInformedEmpName) {
this.keepInformedEmpName = keepInformedEmpName;
}
public String getSerialNo() {
return serialNo;
}
public void setSerialNo(String serialNo) {
this.serialNo = serialNo;
}
public ArrayList getKeepInformedList() {
return keepInformedList;
}
public void setKeepInformedList(ArrayList keepInformedList) {
this.keepInformedList = keepInformedList;
}
public String getCheckRemove() {
return checkRemove;
}
public void setCheckRemove(String checkRemove) {
this.checkRemove = checkRemove;
}
public String getKeepInfoFlag() {
return keepInfoFlag;
}
public void setKeepInfoFlag(String keepInfoFlag) {
this.keepInfoFlag = keepInfoFlag;
}
public String getSrNoIterator() {
return srNoIterator;
}
public void setSrNoIterator(String srNoIterator) {
this.srNoIterator = srNoIterator;
}
public ArrayList getApproverList() {
return approverList;
}
public void setApproverList(ArrayList approverList) {
this.approverList = approverList;
}
public String getMyPageRejected() {
return myPageRejected;
}
public void setMyPageRejected(String myPageRejected) {
this.myPageRejected = myPageRejected;
}
public String getMyPageAssigned() {
return myPageAssigned;
}
public void setMyPageAssigned(String myPageAssigned) {
this.myPageAssigned = myPageAssigned;
}
public String getAssetId() {
return assetId;
}
public void setAssetId(String assetId) {
this.assetId = assetId;
}
public String getReferenceId() {
return referenceId;
}
public void setReferenceId(String referenceId) {
this.referenceId = referenceId;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
}
|
[
"Jigar.V@jigar_vasani.THIRDI.COM"
] |
Jigar.V@jigar_vasani.THIRDI.COM
|
72ef122794ebb9c160ae8bd05c76a31bb638db4e
|
1fa7200a80bea0f0355dae4c3b463f4da3eda7f3
|
/src/test/java/com/ryan/gateway/web/rest/ClientForwardControllerIT.java
|
3efa01a09fe9fdb56a5432f15b74ae98b948c372
|
[] |
no_license
|
Ryanvaziri/gateway
|
e7f3b95ac1532968ee19199b6dc8fa6c944a00b8
|
de9c0ef180b0eadbe4687c69d2847e5347fb679f
|
refs/heads/master
| 2022-12-22T02:40:38.224284 | 2019-12-17T18:02:35 | 2019-12-17T18:02:35 | 228,411,540 | 0 | 0 | null | 2019-12-16T15:05:54 | 2019-12-16T14:59:27 |
Java
|
UTF-8
|
Java
| false | false | 2,348 |
java
|
package com.ryan.gateway.web.rest;
import com.ryan.gateway.GatewayApp;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Integration tests for the {@link ClientForwardController} REST controller.
*/
@SpringBootTest(classes = GatewayApp.class)
public class ClientForwardControllerIT {
private MockMvc restMockMvc;
@BeforeEach
public void setup() {
ClientForwardController clientForwardController = new ClientForwardController();
this.restMockMvc = MockMvcBuilders
.standaloneSetup(clientForwardController, new TestController())
.build();
}
@Test
public void getBackendEndpoint() throws Exception {
restMockMvc.perform(get("/test"))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_PLAIN_VALUE))
.andExpect(content().string("test"));
}
@Test
public void getClientEndpoint() throws Exception {
ResultActions perform = restMockMvc.perform(get("/non-existant-mapping"));
perform
.andExpect(status().isOk())
.andExpect(forwardedUrl("/"));
}
@Test
public void getNestedClientEndpoint() throws Exception {
restMockMvc.perform(get("/admin/user-management"))
.andExpect(status().isOk())
.andExpect(forwardedUrl("/"));
}
@RestController
public static class TestController {
@RequestMapping(value = "/test")
public String test() {
return "test";
}
}
}
|
[
"[email protected]"
] | |
d71ab45bc4b464a0e9d4e1006fd164a58380231b
|
8db8905617af44f74db2cda7a09f34bafaff7f36
|
/src/cs455/hadoop/gigasort/GigaSortMapper.java
|
15bce24cf2940b6d21c39f8a909e74c95a82ff8b
|
[
"Apache-2.0"
] |
permissive
|
priyankpb/UNITED-STATES-CENSUS-DATA-ANALYSIS-USING-MAPREDUCE
|
3d147eda10243f9e3a336d75629655bdfc0b81db
|
bc14d6810ac53d2b78ba57e73589a284315c1e17
|
refs/heads/master
| 2021-01-01T06:51:22.962183 | 2017-07-17T22:50:32 | 2017-07-17T22:50:32 | 97,529,062 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 877 |
java
|
package cs455.hadoop.gigasort;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mapreduce.Mapper;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
/**
* Mapper: Reads line by line, split them into words. Emit <word, 1> pairs.
*/
public class GigaSortMapper extends Mapper<LongWritable, Text, LongWritable, NullWritable> {
NullWritable nw = NullWritable.get();
@Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
// tokenize into words.
StringTokenizer itr = new StringTokenizer(value.toString());
// emit word, count pairs.
while (itr.hasMoreTokens()) {
context.write(new LongWritable(Long.parseLong(itr.nextToken())), nw);
}
}
}
|
[
"[email protected]"
] | |
d08e38105d51354163f42610e6b7baa9dade0c59
|
83e81c25b1f74f88ed0f723afc5d3f83e7d05da8
|
/core/java/android/util/proto/ProtoOutputStream.java
|
7ca5f6d1832d86e520e2f4bb3be137a1d5de3828
|
[
"Apache-2.0",
"LicenseRef-scancode-unicode"
] |
permissive
|
Ankits-lab/frameworks_base
|
8a63f39a79965c87a84e80550926327dcafb40b7
|
150a9240e5a11cd5ebc9bb0832ce30e9c23f376a
|
refs/heads/main
| 2023-02-06T03:57:44.893590 | 2020-11-14T09:13:40 | 2020-11-14T09:13:40 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 95,907 |
java
|
/*
* Copyright (C) 2012 The Android Open Source Project
*
* 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 android.util.proto;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.util.Log;
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
/**
* Class to write to a protobuf stream.
*
* <p>
* This API is not as convenient or type safe as the standard protobuf
* classes. If possible, the best recommended library is to use protobuf lite.
* However, in environments (such as the Android platform itself), a
* more memory efficient version is necessary.
*
* <p>Each write method takes an ID code from the protoc generated classes
* and the value to write. To make a nested object, call {@link #start(long)}
* and then {@link #end(long)} when you are done.
*
* <p>The ID codes have type information embedded into them, so if you call
* the incorrect function you will get an {@link IllegalArgumentException}.
*
* <p>To retrieve the encoded protobuf stream, call {@link #getBytes()}.
*
* stream as the top-level objects are finished.
*
*/
/* IMPLEMENTATION NOTES
*
* Because protobuf has inner values, and they are length prefixed, and
* those sizes themselves are stored with a variable length encoding, it
* is impossible to know how big an object will be in a single pass.
*
* The traditional way is to copy the in-memory representation of an object
* into the generated proto Message objects, do a traversal of those to
* cache the size, and then write the size-prefixed buffers.
*
* We are trying to avoid too much generated code here, but this class still
* needs to have a somewhat sane API. We can't have the multiple passes be
* done by the calling code. In addition, we want to avoid the memory high
* water mark of duplicating all of the values into the traditional in-memory
* Message objects. We need to find another way.
*
* So what we do here is to let the calling code write the data into a
* byte[] (actually a collection of them wrapped in the EncodedBuffer class),
* but not do the varint encoding of the sub-message sizes. Then, we do a
* recursive traversal of the buffer itself, calculating the sizes (which are
* then knowable, although still not the actual sizes in the buffer because of
* possible further nesting). Then we do a third pass, compacting the
* buffer and varint encoding the sizes.
*
* This gets us a relatively small number of fixed-size allocations,
* which is less likely to cause memory fragmentation or churn the GC, and
* the same number of data copies as we would have gotten with setting it
* field-by-field in generated code, and no code bloat from generated code.
* The final data copy is also done with System.arraycopy, which will be
* more efficient, in general, than doing the individual fields twice (as in
* the traditional way).
*
* To accomplish the multiple passes, whenever we write a
* WIRE_TYPE_LENGTH_DELIMITED field, we write the size occupied in our
* buffer as a fixed 32 bit int (called childRawSize), not a variable length
* one. We reserve another 32 bit slot for the computed size (called
* childEncodedSize). If we know the size up front, as we do for strings
* and byte[], then we also put that into childEncodedSize, if we don't, we
* write the negative of childRawSize, as a sentinel that we need to
* compute it during the second pass and recursively compact it during the
* third pass.
*
* Unsigned size varints can be up to five bytes long, but we reserve eight
* bytes for overhead, so we know that when we compact the buffer, there
* will always be space for the encoded varint.
*
* When we can figure out the size ahead of time, we do, in order
* to save overhead with recalculating it, and with the later arraycopy.
*
* During the period between when the caller has called #start, but
* not yet called #end, we maintain a linked list of the tokens
* returned by #start, stored in those 8 bytes of size storage space.
* We use that linked list of tokens to ensure that the caller has
* correctly matched pairs of #start and #end calls, and issue
* errors if they are not matched.
*/
public final class ProtoOutputStream extends ProtoStream {
/**
* @hide
*/
public static final String TAG = "ProtoOutputStream";
/**
* Our buffer.
*/
private EncodedBuffer mBuffer;
/**
* Our stream. If there is one.
*/
private OutputStream mStream;
/**
* Current nesting depth of startObject calls.
*/
private int mDepth;
/**
* An ID given to objects and returned in the token from startObject
* and stored in the buffer until endObject is called, where the two
* are checked.
*
* <p>Starts at -1 and becomes more negative, so the values
* aren't likely to alias with the size it will be overwritten with,
* which tend to be small, and we will be more likely to catch when
* the caller of endObject uses a stale token that they didn't intend
* to (e.g. copy and paste error).
*/
private int mNextObjectId = -1;
/**
* The object token we are expecting in endObject.
*
* <p>If another call to startObject happens, this is written to that location, which gives
* us a stack, stored in the space for the as-yet unused size fields.
*/
private long mExpectedObjectToken;
/**
* Index in mBuffer that we should start copying from on the next
* pass of compaction.
*/
private int mCopyBegin;
/**
* Whether we've already compacted
*/
private boolean mCompacted;
/**
* Construct a {@link ProtoOutputStream} with the default chunk size.
*
* <p>This is for an in-memory proto. The caller should use {@link #getBytes()} for the result.
*/
public ProtoOutputStream() {
this(0);
}
/**
* Construct a {@link ProtoOutputStream with the given chunk size.
*
* <p>This is for an in-memory proto. The caller should use {@link #getBytes()} for the result.
*/
public ProtoOutputStream(int chunkSize) {
mBuffer = new EncodedBuffer(chunkSize);
}
/**
* Construct a {@link ProtoOutputStream} that sits on top of an {@link OutputStream}.
*
* <p>The {@link #flush()} method must be called when done writing
* to flush any remaining data, although data *may* be written at intermediate
* points within the writing as well.
*/
public ProtoOutputStream(@NonNull OutputStream stream) {
this();
mStream = stream;
}
/**
* Construct a {@link ProtoOutputStream} that sits on top of a {@link FileDescriptor}.
*
* <p>The {@link #flush()} method must be called when done writing
* to flush any remaining data, although data *may* be written at intermediate
* points within the writing as well.
*
* @hide
*/
public ProtoOutputStream(@NonNull FileDescriptor fd) {
this(new FileOutputStream(fd));
}
/**
* Returns the total size of the data that has been written, after full
* protobuf encoding has occurred.
*
* @return the uncompressed buffer size
*/
public int getRawSize() {
if (mCompacted) {
return getBytes().length;
} else {
return mBuffer.getSize();
}
}
/**
* Write a value for the given fieldId.
*
* <p>Will automatically convert for the following field types, and
* throw an exception for others: double, float, int32, int64, uint32, uint64,
* sint32, sint64, fixed32, fixed64, sfixed32, sfixed64, bool, enum.
*
* @param fieldId The field identifier constant from the generated class.
* @param val The value.
*/
public void write(long fieldId, double val) {
assertNotCompacted();
final int id = (int)fieldId;
switch ((int)((fieldId & (FIELD_TYPE_MASK | FIELD_COUNT_MASK)) >> FIELD_TYPE_SHIFT)) {
// double
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeDoubleImpl(id, (double)val);
break;
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedDoubleImpl(id, (double)val);
break;
// float
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFloatImpl(id, (float)val);
break;
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFloatImpl(id, (float)val);
break;
// int32
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedInt32Impl(id, (int)val);
break;
// int64
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedInt64Impl(id, (long)val);
break;
// uint32
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeUInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedUInt32Impl(id, (int)val);
break;
// uint64
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeUInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedUInt64Impl(id, (long)val);
break;
// sint32
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSInt32Impl(id, (int)val);
break;
// sint64
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSInt64Impl(id, (long)val);
break;
// fixed32
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFixed32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFixed32Impl(id, (int)val);
break;
// fixed64
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFixed64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFixed64Impl(id, (long)val);
break;
// sfixed32
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSFixed32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSFixed32Impl(id, (int)val);
break;
// sfixed64
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSFixed64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSFixed64Impl(id, (long)val);
break;
// bool
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeBoolImpl(id, val != 0);
break;
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedBoolImpl(id, val != 0);
break;
// enum
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeEnumImpl(id, (int)val);
break;
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedEnumImpl(id, (int)val);
break;
// string, bytes, object not allowed here.
default: {
throw new IllegalArgumentException("Attempt to call write(long, double) with "
+ getFieldIdString(fieldId));
}
}
}
/**
* Write a value for the given fieldId.
*
* <p>Will automatically convert for the following field types, and
* throw an exception for others: double, float, int32, int64, uint32, uint64,
* sint32, sint64, fixed32, fixed64, sfixed32, sfixed64, bool, enum.
*
* @param fieldId The field identifier constant from the generated class.
* @param val The value.
*/
public void write(long fieldId, float val) {
assertNotCompacted();
final int id = (int)fieldId;
switch ((int)((fieldId & (FIELD_TYPE_MASK | FIELD_COUNT_MASK)) >> FIELD_TYPE_SHIFT)) {
// double
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeDoubleImpl(id, (double)val);
break;
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedDoubleImpl(id, (double)val);
break;
// float
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFloatImpl(id, (float)val);
break;
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFloatImpl(id, (float)val);
break;
// int32
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedInt32Impl(id, (int)val);
break;
// int64
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedInt64Impl(id, (long)val);
break;
// uint32
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeUInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedUInt32Impl(id, (int)val);
break;
// uint64
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeUInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedUInt64Impl(id, (long)val);
break;
// sint32
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSInt32Impl(id, (int)val);
break;
// sint64
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSInt64Impl(id, (long)val);
break;
// fixed32
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFixed32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFixed32Impl(id, (int)val);
break;
// fixed64
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFixed64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFixed64Impl(id, (long)val);
break;
// sfixed32
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSFixed32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSFixed32Impl(id, (int)val);
break;
// sfixed64
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSFixed64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSFixed64Impl(id, (long)val);
break;
// bool
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeBoolImpl(id, val != 0);
break;
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedBoolImpl(id, val != 0);
break;
// enum
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeEnumImpl(id, (int)val);
break;
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedEnumImpl(id, (int)val);
break;
// string, bytes, object not allowed here.
default: {
throw new IllegalArgumentException("Attempt to call write(long, float) with "
+ getFieldIdString(fieldId));
}
}
}
/**
* Write a value for the given fieldId.
*
* <p>Will automatically convert for the following field types, and
* throw an exception for others: double, float, int32, int64, uint32, uint64,
* sint32, sint64, fixed32, fixed64, sfixed32, sfixed64, bool, enum.
*
* @param fieldId The field identifier constant from the generated class.
* @param val The value.
*/
public void write(long fieldId, int val) {
assertNotCompacted();
final int id = (int)fieldId;
switch ((int)((fieldId & (FIELD_TYPE_MASK | FIELD_COUNT_MASK)) >> FIELD_TYPE_SHIFT)) {
// double
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeDoubleImpl(id, (double)val);
break;
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedDoubleImpl(id, (double)val);
break;
// float
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFloatImpl(id, (float)val);
break;
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFloatImpl(id, (float)val);
break;
// int32
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedInt32Impl(id, (int)val);
break;
// int64
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedInt64Impl(id, (long)val);
break;
// uint32
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeUInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedUInt32Impl(id, (int)val);
break;
// uint64
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeUInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedUInt64Impl(id, (long)val);
break;
// sint32
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSInt32Impl(id, (int)val);
break;
// sint64
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSInt64Impl(id, (long)val);
break;
// fixed32
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFixed32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFixed32Impl(id, (int)val);
break;
// fixed64
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFixed64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFixed64Impl(id, (long)val);
break;
// sfixed32
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSFixed32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSFixed32Impl(id, (int)val);
break;
// sfixed64
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSFixed64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSFixed64Impl(id, (long)val);
break;
// bool
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeBoolImpl(id, val != 0);
break;
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedBoolImpl(id, val != 0);
break;
// enum
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeEnumImpl(id, (int)val);
break;
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedEnumImpl(id, (int)val);
break;
// string, bytes, object not allowed here.
default: {
throw new IllegalArgumentException("Attempt to call write(long, int) with "
+ getFieldIdString(fieldId));
}
}
}
/**
* Write a value for the given fieldId.
*
* <p>Will automatically convert for the following field types, and
* throw an exception for others: double, float, int32, int64, uint32, uint64,
* sint32, sint64, fixed32, fixed64, sfixed32, sfixed64, bool, enum.
*
* @param fieldId The field identifier constant from the generated class.
* @param val The value.
*/
public void write(long fieldId, long val) {
assertNotCompacted();
final int id = (int)fieldId;
switch ((int)((fieldId & (FIELD_TYPE_MASK | FIELD_COUNT_MASK)) >> FIELD_TYPE_SHIFT)) {
// double
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeDoubleImpl(id, (double)val);
break;
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_DOUBLE | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedDoubleImpl(id, (double)val);
break;
// float
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFloatImpl(id, (float)val);
break;
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FLOAT | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFloatImpl(id, (float)val);
break;
// int32
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_INT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedInt32Impl(id, (int)val);
break;
// int64
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_INT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedInt64Impl(id, (long)val);
break;
// uint32
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeUInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_UINT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedUInt32Impl(id, (int)val);
break;
// uint64
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeUInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_UINT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedUInt64Impl(id, (long)val);
break;
// sint32
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSInt32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SINT32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSInt32Impl(id, (int)val);
break;
// sint64
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSInt64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SINT64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSInt64Impl(id, (long)val);
break;
// fixed32
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFixed32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FIXED32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFixed32Impl(id, (int)val);
break;
// fixed64
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeFixed64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_FIXED64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedFixed64Impl(id, (long)val);
break;
// sfixed32
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSFixed32Impl(id, (int)val);
break;
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SFIXED32 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSFixed32Impl(id, (int)val);
break;
// sfixed64
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeSFixed64Impl(id, (long)val);
break;
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_SFIXED64 | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedSFixed64Impl(id, (long)val);
break;
// bool
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeBoolImpl(id, val != 0);
break;
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedBoolImpl(id, val != 0);
break;
// enum
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeEnumImpl(id, (int)val);
break;
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_ENUM | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedEnumImpl(id, (int)val);
break;
// string, bytes, object not allowed here.
default: {
throw new IllegalArgumentException("Attempt to call write(long, long) with "
+ getFieldIdString(fieldId));
}
}
}
/**
* Write a boolean value for the given fieldId.
*
* <p>If the field is not a bool field, an {@link IllegalStateException} will be thrown.
*
* @param fieldId The field identifier constant from the generated class.
* @param val The value.
*/
public void write(long fieldId, boolean val) {
assertNotCompacted();
final int id = (int)fieldId;
switch ((int)((fieldId & (FIELD_TYPE_MASK | FIELD_COUNT_MASK)) >> FIELD_TYPE_SHIFT)) {
// bool
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeBoolImpl(id, val);
break;
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_BOOL | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedBoolImpl(id, val);
break;
// nothing else allowed
default: {
throw new IllegalArgumentException("Attempt to call write(long, boolean) with "
+ getFieldIdString(fieldId));
}
}
}
/**
* Write a string value for the given fieldId.
*
* <p>If the field is not a string field, an exception will be thrown.
*
* @param fieldId The field identifier constant from the generated class.
* @param val The value.
*/
public void write(long fieldId, @Nullable String val) {
assertNotCompacted();
final int id = (int)fieldId;
switch ((int)((fieldId & (FIELD_TYPE_MASK | FIELD_COUNT_MASK)) >> FIELD_TYPE_SHIFT)) {
// string
case (int)((FIELD_TYPE_STRING | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeStringImpl(id, val);
break;
case (int)((FIELD_TYPE_STRING | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int)((FIELD_TYPE_STRING | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedStringImpl(id, val);
break;
// nothing else allowed
default: {
throw new IllegalArgumentException("Attempt to call write(long, String) with "
+ getFieldIdString(fieldId));
}
}
}
/**
* Write a byte[] value for the given fieldId.
*
* <p>If the field is not a bytes or object field, an exception will be thrown.
*
* @param fieldId The field identifier constant from the generated class.
* @param val The value.
*/
public void write(long fieldId, @Nullable byte[] val) {
assertNotCompacted();
final int id = (int)fieldId;
switch ((int) ((fieldId & (FIELD_TYPE_MASK | FIELD_COUNT_MASK)) >> FIELD_TYPE_SHIFT)) {
// bytes
case (int) ((FIELD_TYPE_BYTES | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeBytesImpl(id, val);
break;
case (int) ((FIELD_TYPE_BYTES | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int) ((FIELD_TYPE_BYTES | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedBytesImpl(id, val);
break;
// Object
case (int) ((FIELD_TYPE_MESSAGE | FIELD_COUNT_SINGLE) >> FIELD_TYPE_SHIFT):
writeObjectImpl(id, val);
break;
case (int) ((FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED) >> FIELD_TYPE_SHIFT):
case (int) ((FIELD_TYPE_MESSAGE | FIELD_COUNT_PACKED) >> FIELD_TYPE_SHIFT):
writeRepeatedObjectImpl(id, val);
break;
// nothing else allowed
default: {
throw new IllegalArgumentException("Attempt to call write(long, byte[]) with "
+ getFieldIdString(fieldId));
}
}
}
/**
* Start a sub object.
*
* @param fieldId The field identifier constant from the generated class.
* @return The token to call {@link #end(long)} with.
*/
public long start(long fieldId) {
assertNotCompacted();
final int id = (int)fieldId;
if ((fieldId & FIELD_TYPE_MASK) == FIELD_TYPE_MESSAGE) {
final long count = fieldId & FIELD_COUNT_MASK;
if (count == FIELD_COUNT_SINGLE) {
return startObjectImpl(id, false);
} else if (count == FIELD_COUNT_REPEATED || count == FIELD_COUNT_PACKED) {
return startObjectImpl(id, true);
}
}
throw new IllegalArgumentException("Attempt to call start(long) with "
+ getFieldIdString(fieldId));
}
/**
* End the object started by start() that returned token.
*
* @param token The token returned from {@link #start(long)}
*/
public void end(long token) {
endObjectImpl(token, getRepeatedFromToken(token));
}
//
// proto3 type: double
// java type: double
// encoding: fixed64
// wire type: WIRE_TYPE_FIXED64
//
/**
* Write a single proto "double" type field value.
*
* @deprecated Use {@link #write(long, double)} instead.
* @hide
*/
@Deprecated
public void writeDouble(long fieldId, double val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_DOUBLE);
writeDoubleImpl(id, val);
}
private void writeDoubleImpl(int id, double val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_FIXED64);
mBuffer.writeRawFixed64(Double.doubleToLongBits(val));
}
}
/**
* Write a single repeated proto "double" type field value.
*
* @deprecated Use {@link #write(long, double)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedDouble(long fieldId, double val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_DOUBLE);
writeRepeatedDoubleImpl(id, val);
}
private void writeRepeatedDoubleImpl(int id, double val) {
writeTag(id, WIRE_TYPE_FIXED64);
mBuffer.writeRawFixed64(Double.doubleToLongBits(val));
}
/**
* Write a list of packed proto "double" type field values.
*
* @deprecated Use {@link #write(long, double)} instead.
* @hide
*/
@Deprecated
public void writePackedDouble(long fieldId, @Nullable double[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_DOUBLE);
final int N = val != null ? val.length : 0;
if (N > 0) {
writeKnownLengthHeader(id, N * 8);
for (int i=0; i<N; i++) {
mBuffer.writeRawFixed64(Double.doubleToLongBits(val[i]));
}
}
}
//
// proto3 type: float
// java type: float
// encoding: fixed32
// wire type: WIRE_TYPE_FIXED32
//
/**
* Write a single proto "float" type field value.
*
* @deprecated Use {@link #write(long, float)} instead.
* @hide
*/
@Deprecated
public void writeFloat(long fieldId, float val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_FLOAT);
writeFloatImpl(id, val);
}
private void writeFloatImpl(int id, float val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_FIXED32);
mBuffer.writeRawFixed32(Float.floatToIntBits(val));
}
}
/**
* Write a single repeated proto "float" type field value.
*
* @deprecated Use {@link #write(long, float)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedFloat(long fieldId, float val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_FLOAT);
writeRepeatedFloatImpl(id, val);
}
private void writeRepeatedFloatImpl(int id, float val) {
writeTag(id, WIRE_TYPE_FIXED32);
mBuffer.writeRawFixed32(Float.floatToIntBits(val));
}
/**
* Write a list of packed proto "float" type field value.
*
* @deprecated Use {@link #write(long, float)} instead.
* @hide
*/
@Deprecated
public void writePackedFloat(long fieldId, @Nullable float[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_FLOAT);
final int N = val != null ? val.length : 0;
if (N > 0) {
writeKnownLengthHeader(id, N * 4);
for (int i=0; i<N; i++) {
mBuffer.writeRawFixed32(Float.floatToIntBits(val[i]));
}
}
}
//
// proto3 type: int32
// java type: int
// signed/unsigned: signed
// encoding: varint
// wire type: WIRE_TYPE_VARINT
//
/**
* Writes a java int as an usigned varint.
*
* <p>The unadorned int32 type in protobuf is unfortunate because it
* is stored in memory as a signed value, but encodes as unsigned
* varints, which are formally always longs. So here, we encode
* negative values as 64 bits, which will get the sign-extension,
* and positive values as 32 bits, which saves a marginal amount
* of work in that it processes ints instead of longs.
*/
private void writeUnsignedVarintFromSignedInt(int val) {
if (val >= 0) {
mBuffer.writeRawVarint32(val);
} else {
mBuffer.writeRawVarint64(val);
}
}
/**
* Write a single proto "int32" type field value.
*
* <p>Note that these are stored in memory as signed values and written as unsigned
* varints, which if negative, are 10 bytes long. If you know the data is likely
* to be negative, use "sint32".
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeInt32(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_INT32);
writeInt32Impl(id, val);
}
private void writeInt32Impl(int id, int val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_VARINT);
writeUnsignedVarintFromSignedInt(val);
}
}
/**
* Write a single repeated proto "int32" type field value.
*
* <p>Note that these are stored in memory as signed values and written as unsigned
* varints, which if negative, are 10 bytes long. If you know the data is likely
* to be negative, use "sint32".
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedInt32(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_INT32);
writeRepeatedInt32Impl(id, val);
}
private void writeRepeatedInt32Impl(int id, int val) {
writeTag(id, WIRE_TYPE_VARINT);
writeUnsignedVarintFromSignedInt(val);
}
/**
* Write a list of packed proto "int32" type field value.
*
* <p>Note that these are stored in memory as signed values and written as unsigned
* varints, which if negative, are 10 bytes long. If you know the data is likely
* to be negative, use "sint32".
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writePackedInt32(long fieldId, @Nullable int[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_INT32);
final int N = val != null ? val.length : 0;
if (N > 0) {
int size = 0;
for (int i=0; i<N; i++) {
final int v = val[i];
size += v >= 0 ? EncodedBuffer.getRawVarint32Size(v) : 10;
}
writeKnownLengthHeader(id, size);
for (int i=0; i<N; i++) {
writeUnsignedVarintFromSignedInt(val[i]);
}
}
}
//
// proto3 type: int64
// java type: int
// signed/unsigned: signed
// encoding: varint
// wire type: WIRE_TYPE_VARINT
//
/**
* Write a single proto "int64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writeInt64(long fieldId, long val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_INT64);
writeInt64Impl(id, val);
}
private void writeInt64Impl(int id, long val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_VARINT);
mBuffer.writeRawVarint64(val);
}
}
/**
* Write a single repeated proto "int64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedInt64(long fieldId, long val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_INT64);
writeRepeatedInt64Impl(id, val);
}
private void writeRepeatedInt64Impl(int id, long val) {
writeTag(id, WIRE_TYPE_VARINT);
mBuffer.writeRawVarint64(val);
}
/**
* Write a list of packed proto "int64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writePackedInt64(long fieldId, @Nullable long[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_INT64);
final int N = val != null ? val.length : 0;
if (N > 0) {
int size = 0;
for (int i=0; i<N; i++) {
size += EncodedBuffer.getRawVarint64Size(val[i]);
}
writeKnownLengthHeader(id, size);
for (int i=0; i<N; i++) {
mBuffer.writeRawVarint64(val[i]);
}
}
}
//
// proto3 type: uint32
// java type: int
// signed/unsigned: unsigned
// encoding: varint
// wire type: WIRE_TYPE_VARINT
//
/**
* Write a single proto "uint32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeUInt32(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_UINT32);
writeUInt32Impl(id, val);
}
private void writeUInt32Impl(int id, int val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_VARINT);
mBuffer.writeRawVarint32(val);
}
}
/**
* Write a single repeated proto "uint32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedUInt32(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_UINT32);
writeRepeatedUInt32Impl(id, val);
}
private void writeRepeatedUInt32Impl(int id, int val) {
writeTag(id, WIRE_TYPE_VARINT);
mBuffer.writeRawVarint32(val);
}
/**
* Write a list of packed proto "uint32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writePackedUInt32(long fieldId, @Nullable int[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_UINT32);
final int N = val != null ? val.length : 0;
if (N > 0) {
int size = 0;
for (int i=0; i<N; i++) {
size += EncodedBuffer.getRawVarint32Size(val[i]);
}
writeKnownLengthHeader(id, size);
for (int i=0; i<N; i++) {
mBuffer.writeRawVarint32(val[i]);
}
}
}
//
// proto3 type: uint64
// java type: int
// signed/unsigned: unsigned
// encoding: varint
// wire type: WIRE_TYPE_VARINT
//
/**
* Write a single proto "uint64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writeUInt64(long fieldId, long val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_UINT64);
writeUInt64Impl(id, val);
}
private void writeUInt64Impl(int id, long val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_VARINT);
mBuffer.writeRawVarint64(val);
}
}
/**
* Write a single proto "uint64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedUInt64(long fieldId, long val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_UINT64);
writeRepeatedUInt64Impl(id, val);
}
private void writeRepeatedUInt64Impl(int id, long val) {
writeTag(id, WIRE_TYPE_VARINT);
mBuffer.writeRawVarint64(val);
}
/**
* Write a single proto "uint64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writePackedUInt64(long fieldId, @Nullable long[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_UINT64);
final int N = val != null ? val.length : 0;
if (N > 0) {
int size = 0;
for (int i=0; i<N; i++) {
size += EncodedBuffer.getRawVarint64Size(val[i]);
}
writeKnownLengthHeader(id, size);
for (int i=0; i<N; i++) {
mBuffer.writeRawVarint64(val[i]);
}
}
}
//
// proto3 type: sint32
// java type: int
// signed/unsigned: signed
// encoding: zig-zag
// wire type: WIRE_TYPE_VARINT
//
/**
* Write a single proto "sint32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeSInt32(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_SINT32);
writeSInt32Impl(id, val);
}
private void writeSInt32Impl(int id, int val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_VARINT);
mBuffer.writeRawZigZag32(val);
}
}
/**
* Write a single repeated proto "sint32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedSInt32(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_SINT32);
writeRepeatedSInt32Impl(id, val);
}
private void writeRepeatedSInt32Impl(int id, int val) {
writeTag(id, WIRE_TYPE_VARINT);
mBuffer.writeRawZigZag32(val);
}
/**
* Write a list of packed proto "sint32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writePackedSInt32(long fieldId, @Nullable int[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_SINT32);
final int N = val != null ? val.length : 0;
if (N > 0) {
int size = 0;
for (int i=0; i<N; i++) {
size += EncodedBuffer.getRawZigZag32Size(val[i]);
}
writeKnownLengthHeader(id, size);
for (int i=0; i<N; i++) {
mBuffer.writeRawZigZag32(val[i]);
}
}
}
//
// proto3 type: sint64
// java type: int
// signed/unsigned: signed
// encoding: zig-zag
// wire type: WIRE_TYPE_VARINT
//
/**
* Write a single proto "sint64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writeSInt64(long fieldId, long val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_SINT64);
writeSInt64Impl(id, val);
}
private void writeSInt64Impl(int id, long val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_VARINT);
mBuffer.writeRawZigZag64(val);
}
}
/**
* Write a single repeated proto "sint64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedSInt64(long fieldId, long val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_SINT64);
writeRepeatedSInt64Impl(id, val);
}
private void writeRepeatedSInt64Impl(int id, long val) {
writeTag(id, WIRE_TYPE_VARINT);
mBuffer.writeRawZigZag64(val);
}
/**
* Write a list of packed proto "sint64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writePackedSInt64(long fieldId, @Nullable long[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_SINT64);
final int N = val != null ? val.length : 0;
if (N > 0) {
int size = 0;
for (int i=0; i<N; i++) {
size += EncodedBuffer.getRawZigZag64Size(val[i]);
}
writeKnownLengthHeader(id, size);
for (int i=0; i<N; i++) {
mBuffer.writeRawZigZag64(val[i]);
}
}
}
//
// proto3 type: fixed32
// java type: int
// encoding: little endian
// wire type: WIRE_TYPE_FIXED32
//
/**
* Write a single proto "fixed32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeFixed32(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_FIXED32);
writeFixed32Impl(id, val);
}
private void writeFixed32Impl(int id, int val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_FIXED32);
mBuffer.writeRawFixed32(val);
}
}
/**
* Write a single repeated proto "fixed32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedFixed32(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_FIXED32);
writeRepeatedFixed32Impl(id, val);
}
private void writeRepeatedFixed32Impl(int id, int val) {
writeTag(id, WIRE_TYPE_FIXED32);
mBuffer.writeRawFixed32(val);
}
/**
* Write a list of packed proto "fixed32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writePackedFixed32(long fieldId, @Nullable int[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_FIXED32);
final int N = val != null ? val.length : 0;
if (N > 0) {
writeKnownLengthHeader(id, N * 4);
for (int i=0; i<N; i++) {
mBuffer.writeRawFixed32(val[i]);
}
}
}
//
// proto3 type: fixed64
// java type: long
// encoding: fixed64
// wire type: WIRE_TYPE_FIXED64
//
/**
* Write a single proto "fixed64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writeFixed64(long fieldId, long val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_FIXED64);
writeFixed64Impl(id, val);
}
private void writeFixed64Impl(int id, long val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_FIXED64);
mBuffer.writeRawFixed64(val);
}
}
/**
* Write a single repeated proto "fixed64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedFixed64(long fieldId, long val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_FIXED64);
writeRepeatedFixed64Impl(id, val);
}
private void writeRepeatedFixed64Impl(int id, long val) {
writeTag(id, WIRE_TYPE_FIXED64);
mBuffer.writeRawFixed64(val);
}
/**
* Write a list of packed proto "fixed64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writePackedFixed64(long fieldId, @Nullable long[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_FIXED64);
final int N = val != null ? val.length : 0;
if (N > 0) {
writeKnownLengthHeader(id, N * 8);
for (int i=0; i<N; i++) {
mBuffer.writeRawFixed64(val[i]);
}
}
}
//
// proto3 type: sfixed32
// java type: int
// encoding: little endian
// wire type: WIRE_TYPE_FIXED32
//
/**
* Write a single proto "sfixed32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeSFixed32(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_SFIXED32);
writeSFixed32Impl(id, val);
}
private void writeSFixed32Impl(int id, int val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_FIXED32);
mBuffer.writeRawFixed32(val);
}
}
/**
* Write a single repeated proto "sfixed32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedSFixed32(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_SFIXED32);
writeRepeatedSFixed32Impl(id, val);
}
private void writeRepeatedSFixed32Impl(int id, int val) {
writeTag(id, WIRE_TYPE_FIXED32);
mBuffer.writeRawFixed32(val);
}
/**
* Write a list of packed proto "sfixed32" type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writePackedSFixed32(long fieldId, @Nullable int[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_SFIXED32);
final int N = val != null ? val.length : 0;
if (N > 0) {
writeKnownLengthHeader(id, N * 4);
for (int i=0; i<N; i++) {
mBuffer.writeRawFixed32(val[i]);
}
}
}
//
// proto3 type: sfixed64
// java type: long
// encoding: little endian
// wire type: WIRE_TYPE_FIXED64
//
/**
* Write a single proto "sfixed64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writeSFixed64(long fieldId, long val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_SFIXED64);
writeSFixed64Impl(id, val);
}
private void writeSFixed64Impl(int id, long val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_FIXED64);
mBuffer.writeRawFixed64(val);
}
}
/**
* Write a single repeated proto "sfixed64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedSFixed64(long fieldId, long val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_SFIXED64);
writeRepeatedSFixed64Impl(id, val);
}
private void writeRepeatedSFixed64Impl(int id, long val) {
writeTag(id, WIRE_TYPE_FIXED64);
mBuffer.writeRawFixed64(val);
}
/**
* Write a list of packed proto "sfixed64" type field value.
*
* @deprecated Use {@link #write(long, long)} instead.
* @hide
*/
@Deprecated
public void writePackedSFixed64(long fieldId, @Nullable long[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_SFIXED64);
final int N = val != null ? val.length : 0;
if (N > 0) {
writeKnownLengthHeader(id, N * 8);
for (int i=0; i<N; i++) {
mBuffer.writeRawFixed64(val[i]);
}
}
}
//
// proto3 type: bool
// java type: boolean
// encoding: varint
// wire type: WIRE_TYPE_VARINT
//
/**
* Write a single proto "bool" type field value.
*
* @deprecated Use {@link #write(long, boolean)} instead.
* @hide
*/
@Deprecated
public void writeBool(long fieldId, boolean val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_BOOL);
writeBoolImpl(id, val);
}
private void writeBoolImpl(int id, boolean val) {
if (val) {
writeTag(id, WIRE_TYPE_VARINT);
// 0 and 1 are the same as their varint counterparts
mBuffer.writeRawByte((byte)1);
}
}
/**
* Write a single repeated proto "bool" type field value.
*
* @deprecated Use {@link #write(long, boolean)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedBool(long fieldId, boolean val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_BOOL);
writeRepeatedBoolImpl(id, val);
}
private void writeRepeatedBoolImpl(int id, boolean val) {
writeTag(id, WIRE_TYPE_VARINT);
mBuffer.writeRawByte((byte)(val ? 1 : 0));
}
/**
* Write a list of packed proto "bool" type field value.
*
* @deprecated Use {@link #write(long, boolean)} instead.
* @hide
*/
@Deprecated
public void writePackedBool(long fieldId, @Nullable boolean[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_BOOL);
final int N = val != null ? val.length : 0;
if (N > 0) {
// Write the header
writeKnownLengthHeader(id, N);
// Write the data
for (int i=0; i<N; i++) {
// 0 and 1 are the same as their varint counterparts
mBuffer.writeRawByte((byte)(val[i] ? 1 : 0));
}
}
}
//
// proto3 type: string
// java type: String
// encoding: utf-8
// wire type: WIRE_TYPE_LENGTH_DELIMITED
//
/**
* Write a single proto "string" type field value.
*
* @deprecated Use {@link #write(long, String)} instead.
* @hide
*/
@Deprecated
public void writeString(long fieldId, @Nullable String val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_STRING);
writeStringImpl(id, val);
}
private void writeStringImpl(int id, String val) {
if (val != null && val.length() > 0) {
writeUtf8String(id, val);
}
}
/**
* Write a single repeated proto "string" type field value.
*
* @deprecated Use {@link #write(long, String)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedString(long fieldId, @Nullable String val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_STRING);
writeRepeatedStringImpl(id, val);
}
private void writeRepeatedStringImpl(int id, String val) {
if (val == null || val.length() == 0) {
writeKnownLengthHeader(id, 0);
} else {
writeUtf8String(id, val);
}
}
/**
* Write a list of packed proto "string" type field value.
*/
private void writeUtf8String(int id, String val) {
// TODO: Is it worth converting by hand in order to not allocate?
try {
final byte[] buf = val.getBytes("UTF-8");
writeKnownLengthHeader(id, buf.length);
mBuffer.writeRawBuffer(buf);
} catch (UnsupportedEncodingException ex) {
throw new RuntimeException("not possible");
}
}
//
// proto3 type: bytes
// java type: byte[]
// encoding: varint
// wire type: WIRE_TYPE_VARINT
//
/**
* Write a single proto "bytes" type field value.
*
* @deprecated Use {@link #write(long, byte[])} instead.
* @hide
*/
@Deprecated
public void writeBytes(long fieldId, @Nullable byte[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_BYTES);
writeBytesImpl(id, val);
}
private void writeBytesImpl(int id, byte[] val) {
if (val != null && val.length > 0) {
writeKnownLengthHeader(id, val.length);
mBuffer.writeRawBuffer(val);
}
}
/**
* Write a single repeated proto "bytes" type field value.
*
* @deprecated Use {@link #write(long, byte[])} instead.
* @hide
*/
@Deprecated
public void writeRepeatedBytes(long fieldId, @Nullable byte[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_BYTES);
writeRepeatedBytesImpl(id, val);
}
private void writeRepeatedBytesImpl(int id, byte[] val) {
writeKnownLengthHeader(id, val == null ? 0 : val.length);
mBuffer.writeRawBuffer(val);
}
//
// proto3 type: enum
// java type: int
// signed/unsigned: unsigned
// encoding: varint
// wire type: WIRE_TYPE_VARINT
//
/**
* Write a single proto enum type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeEnum(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_ENUM);
writeEnumImpl(id, val);
}
private void writeEnumImpl(int id, int val) {
if (val != 0) {
writeTag(id, WIRE_TYPE_VARINT);
writeUnsignedVarintFromSignedInt(val);
}
}
/**
* Write a single repeated proto enum type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writeRepeatedEnum(long fieldId, int val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_ENUM);
writeRepeatedEnumImpl(id, val);
}
private void writeRepeatedEnumImpl(int id, int val) {
writeTag(id, WIRE_TYPE_VARINT);
writeUnsignedVarintFromSignedInt(val);
}
/**
* Write a list of packed proto enum type field value.
*
* @deprecated Use {@link #write(long, int)} instead.
* @hide
*/
@Deprecated
public void writePackedEnum(long fieldId, @Nullable int[] val) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_PACKED | FIELD_TYPE_ENUM);
final int N = val != null ? val.length : 0;
if (N > 0) {
int size = 0;
for (int i=0; i<N; i++) {
final int v = val[i];
size += v >= 0 ? EncodedBuffer.getRawVarint32Size(v) : 10;
}
writeKnownLengthHeader(id, size);
for (int i=0; i<N; i++) {
writeUnsignedVarintFromSignedInt(val[i]);
}
}
}
/**
* Start a child object.
*
* Returns a token which should be passed to endObject. Calls to endObject must be
* nested properly.
*
* @deprecated Use {@link #start(long)} instead.
* @hide
*/
@Deprecated
public long startObject(long fieldId) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_MESSAGE);
return startObjectImpl(id, false);
}
/**
* End a child object. Pass in the token from the correspoinding startObject call.
*
* @deprecated Use {@link #end(long)} instead.
* @hide
*/
@Deprecated
public void endObject(long token) {
assertNotCompacted();
endObjectImpl(token, false);
}
/**
* Start a repeated child object.
*
* Returns a token which should be passed to endObject. Calls to endObject must be
* nested properly.
*
* @deprecated Use {@link #start(long)} instead.
* @hide
*/
@Deprecated
public long startRepeatedObject(long fieldId) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_MESSAGE);
return startObjectImpl(id, true);
}
/**
* End a child object. Pass in the token from the correspoinding startRepeatedObject call.
*
* @deprecated Use {@link #end(long)} instead.
* @hide
*/
@Deprecated
public void endRepeatedObject(long token) {
assertNotCompacted();
endObjectImpl(token, true);
}
/**
* Common implementation of startObject and startRepeatedObject.
*/
private long startObjectImpl(final int id, boolean repeated) {
writeTag(id, WIRE_TYPE_LENGTH_DELIMITED);
final int sizePos = mBuffer.getWritePos();
mDepth++;
mNextObjectId--;
// Write the previous token, giving us a stack of expected tokens.
// After endObject returns, the first fixed32 becomeschildRawSize (set in endObject)
// and the second one becomes childEncodedSize (set in editEncodedSize).
mBuffer.writeRawFixed32((int)(mExpectedObjectToken >> 32));
mBuffer.writeRawFixed32((int)mExpectedObjectToken);
long old = mExpectedObjectToken;
mExpectedObjectToken = makeToken(getTagSize(id), repeated, mDepth, mNextObjectId, sizePos);
return mExpectedObjectToken;
}
/**
* Common implementation of endObject and endRepeatedObject.
*/
private void endObjectImpl(long token, boolean repeated) {
// The upper 32 bits of the token is the depth of startObject /
// endObject calls. We could get aritrarily sophisticated, but
// that's enough to prevent the common error of missing an
// endObject somewhere.
// The lower 32 bits of the token is the offset in the buffer
// at which to write the size.
final int depth = getDepthFromToken(token);
final boolean expectedRepeated = getRepeatedFromToken(token);
final int sizePos = getOffsetFromToken(token);
final int childRawSize = mBuffer.getWritePos() - sizePos - 8;
if (repeated != expectedRepeated) {
if (repeated) {
throw new IllegalArgumentException("endRepeatedObject called where endObject should"
+ " have been");
} else {
throw new IllegalArgumentException("endObject called where endRepeatedObject should"
+ " have been");
}
}
// Check that we're getting the token and depth that we are expecting.
if ((mDepth & 0x01ff) != depth || mExpectedObjectToken != token) {
// This text of exception is united tested. That test also implicity checks
// that we're tracking the objectIds and depths correctly.
throw new IllegalArgumentException("Mismatched startObject/endObject calls."
+ " Current depth " + mDepth
+ " token=" + token2String(token)
+ " expectedToken=" + token2String(mExpectedObjectToken));
}
// Get the next expected token that we stashed away in the buffer.
mExpectedObjectToken = (((long)mBuffer.getRawFixed32At(sizePos)) << 32)
| (0x0ffffffffL & (long)mBuffer.getRawFixed32At(sizePos+4));
mDepth--;
if (childRawSize > 0) {
mBuffer.editRawFixed32(sizePos, -childRawSize);
mBuffer.editRawFixed32(sizePos+4, -1);
} else if (repeated) {
mBuffer.editRawFixed32(sizePos, 0);
mBuffer.editRawFixed32(sizePos+4, 0);
} else {
// The object has no data. Don't include it.
mBuffer.rewindWriteTo(sizePos - getTagSizeFromToken(token));
}
}
/**
* Write an object that has already been flattened.
*
* @deprecated Use {@link #write(long, byte[])} instead.
* @hide
*/
@Deprecated
public void writeObject(long fieldId, @Nullable byte[] value) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_SINGLE | FIELD_TYPE_MESSAGE);
writeObjectImpl(id, value);
}
void writeObjectImpl(int id, byte[] value) {
if (value != null && value.length != 0) {
writeKnownLengthHeader(id, value.length);
mBuffer.writeRawBuffer(value);
}
}
/**
* Write an object that has already been flattened.
*
* @deprecated Use {@link #write(long, byte[])} instead.
* @hide
*/
@Deprecated
public void writeRepeatedObject(long fieldId, @Nullable byte[] value) {
assertNotCompacted();
final int id = checkFieldId(fieldId, FIELD_COUNT_REPEATED | FIELD_TYPE_MESSAGE);
writeRepeatedObjectImpl(id, value);
}
void writeRepeatedObjectImpl(int id, byte[] value) {
writeKnownLengthHeader(id, value == null ? 0 : value.length);
mBuffer.writeRawBuffer(value);
}
//
// Tags
//
/**
* Combine a fieldId (the field keys in the proto file) and the field flags.
* Mostly useful for testing because the generated code contains the fieldId
* constants.
*/
public static long makeFieldId(int id, long fieldFlags) {
return fieldFlags | (((long)id) & 0x0ffffffffL);
}
/**
* Validates that the fieldId provided is of the type and count from expectedType.
*
* <p>The type must match exactly to pass this check.
*
* <p>The count must match according to this truth table to pass the check:
*
* expectedFlags
* UNKNOWN SINGLE REPEATED PACKED
* fieldId
* UNKNOWN true false false false
* SINGLE x true false false
* REPEATED x false true false
* PACKED x false true true
*
* @throws {@link IllegalArgumentException} if it is not.
*
* @return The raw ID of that field.
*/
public static int checkFieldId(long fieldId, long expectedFlags) {
final long fieldCount = fieldId & FIELD_COUNT_MASK;
final long fieldType = fieldId & FIELD_TYPE_MASK;
final long expectedCount = expectedFlags & FIELD_COUNT_MASK;
final long expectedType = expectedFlags & FIELD_TYPE_MASK;
if (((int)fieldId) == 0) {
throw new IllegalArgumentException("Invalid proto field " + (int)fieldId
+ " fieldId=" + Long.toHexString(fieldId));
}
if (fieldType != expectedType
|| !((fieldCount == expectedCount)
|| (fieldCount == FIELD_COUNT_PACKED
&& expectedCount == FIELD_COUNT_REPEATED))) {
final String countString = getFieldCountString(fieldCount);
final String typeString = getFieldTypeString(fieldType);
if (typeString != null && countString != null) {
final StringBuilder sb = new StringBuilder();
if (expectedType == FIELD_TYPE_MESSAGE) {
sb.append("start");
} else {
sb.append("write");
}
sb.append(getFieldCountString(expectedCount));
sb.append(getFieldTypeString(expectedType));
sb.append(" called for field ");
sb.append((int)fieldId);
sb.append(" which should be used with ");
if (fieldType == FIELD_TYPE_MESSAGE) {
sb.append("start");
} else {
sb.append("write");
}
sb.append(countString);
sb.append(typeString);
if (fieldCount == FIELD_COUNT_PACKED) {
sb.append(" or writeRepeated");
sb.append(typeString);
}
sb.append('.');
throw new IllegalArgumentException(sb.toString());
} else {
final StringBuilder sb = new StringBuilder();
if (expectedType == FIELD_TYPE_MESSAGE) {
sb.append("start");
} else {
sb.append("write");
}
sb.append(getFieldCountString(expectedCount));
sb.append(getFieldTypeString(expectedType));
sb.append(" called with an invalid fieldId: 0x");
sb.append(Long.toHexString(fieldId));
sb.append(". The proto field ID might be ");
sb.append((int)fieldId);
sb.append('.');
throw new IllegalArgumentException(sb.toString());
}
}
return (int)fieldId;
}
/**
* Return how many bytes an encoded field tag will require.
*/
private static int getTagSize(int id) {
return EncodedBuffer.getRawVarint32Size(id << FIELD_ID_SHIFT);
}
/**
* Write an individual field tag by hand.
*
* See <a href="https://developers.google.com/protocol-buffers/docs/encoding">Protobuf
* Encoding</a> for details on the structure of how tags and data are written.
*/
public void writeTag(int id, @WireType int wireType) {
mBuffer.writeRawVarint32((id << FIELD_ID_SHIFT) | wireType);
}
/**
* Write the header of a WIRE_TYPE_LENGTH_DELIMITED field for one where
* we know the size in advance and do not need to compute and compact.
*/
private void writeKnownLengthHeader(int id, int size) {
// Write the tag
writeTag(id, WIRE_TYPE_LENGTH_DELIMITED);
// Size will be compacted later, but we know the size, so write it,
// once for the rawSize and once for the encodedSize.
mBuffer.writeRawFixed32(size);
mBuffer.writeRawFixed32(size);
}
//
// Getting the buffer and compaction
//
/**
* Assert that the compact call has not already occured.
*
* TODO: Will change when we add the OutputStream version of ProtoOutputStream.
*/
private void assertNotCompacted() {
if (mCompacted) {
throw new IllegalArgumentException("write called after compact");
}
}
/**
* Finish the encoding of the data, and return a byte[] with
* the protobuf formatted data.
*
* <p>After this call, do not call any of the write* functions. The
* behavior is undefined.
*/
public @NonNull byte[] getBytes() {
compactIfNecessary();
return mBuffer.getBytes(mBuffer.getReadableSize());
}
/**
* If the buffer hasn't already had the nested object size fields compacted
* and turned into an actual protobuf format, then do so.
*/
private void compactIfNecessary() {
if (!mCompacted) {
if (mDepth != 0) {
throw new IllegalArgumentException("Trying to compact with " + mDepth
+ " missing calls to endObject");
}
// The buffer must be compacted.
mBuffer.startEditing();
final int readableSize = mBuffer.getReadableSize();
// Cache the sizes of the objects
editEncodedSize(readableSize);
// Re-write the buffer with the sizes as proper varints instead
// of pairs of uint32s. We know this will always fit in the same
// buffer because the pair of uint32s is exactly 8 bytes long, and
// the single varint size will be no more than 5 bytes long.
mBuffer.rewindRead();
compactSizes(readableSize);
// If there is any data left over that wasn't copied yet, copy it.
if (mCopyBegin < readableSize) {
mBuffer.writeFromThisBuffer(mCopyBegin, readableSize - mCopyBegin);
}
// Set the new readableSize
mBuffer.startEditing();
// It's not valid to write to this object anymore. The write
// pointers are off, and then some of the data would be compacted
// and some not.
mCompacted = true;
}
}
/**
* First compaction pass. Iterate through the data, and fill in the
* nested object sizes so the next pass can compact them.
*/
private int editEncodedSize(int rawSize) {
int objectStart = mBuffer.getReadPos();
int objectEnd = objectStart + rawSize;
int encodedSize = 0;
int tagPos;
while ((tagPos = mBuffer.getReadPos()) < objectEnd) {
int tag = readRawTag();
encodedSize += EncodedBuffer.getRawVarint32Size(tag);
final int wireType = tag & WIRE_TYPE_MASK;
switch (wireType) {
case WIRE_TYPE_VARINT:
encodedSize++;
while ((mBuffer.readRawByte() & 0x80) != 0) {
encodedSize++;
}
break;
case WIRE_TYPE_FIXED64:
encodedSize += 8;
mBuffer.skipRead(8);
break;
case WIRE_TYPE_LENGTH_DELIMITED: {
// This object is not of a fixed-size type. So we need to figure
// out how big it should be.
final int childRawSize = mBuffer.readRawFixed32();
final int childEncodedSizePos = mBuffer.getReadPos();
int childEncodedSize = mBuffer.readRawFixed32();
if (childRawSize >= 0) {
// We know the size, just skip ahead.
if (childEncodedSize != childRawSize) {
throw new RuntimeException("Pre-computed size where the"
+ " precomputed size and the raw size in the buffer"
+ " don't match! childRawSize=" + childRawSize
+ " childEncodedSize=" + childEncodedSize
+ " childEncodedSizePos=" + childEncodedSizePos);
}
mBuffer.skipRead(childRawSize);
} else {
// We need to compute the size. Recurse.
childEncodedSize = editEncodedSize(-childRawSize);
mBuffer.editRawFixed32(childEncodedSizePos, childEncodedSize);
}
encodedSize += EncodedBuffer.getRawVarint32Size(childEncodedSize)
+ childEncodedSize;
break;
}
case WIRE_TYPE_START_GROUP:
case WIRE_TYPE_END_GROUP:
throw new RuntimeException("groups not supported at index " + tagPos);
case WIRE_TYPE_FIXED32:
encodedSize += 4;
mBuffer.skipRead(4);
break;
default:
throw new ProtoParseException("editEncodedSize Bad tag tag=0x"
+ Integer.toHexString(tag) + " wireType=" + wireType
+ " -- " + mBuffer.getDebugString());
}
}
return encodedSize;
}
/**
* Second compaction pass. Iterate through the data, and copy the data
* forward in the buffer, converting the pairs of uint32s into a single
* unsigned varint of the size.
*/
private void compactSizes(int rawSize) {
int objectStart = mBuffer.getReadPos();
int objectEnd = objectStart + rawSize;
int tagPos;
while ((tagPos = mBuffer.getReadPos()) < objectEnd) {
int tag = readRawTag();
// For all the non-length-delimited field types, just skip over them,
// and we'll just System.arraycopy it later, either in the case for
// WIRE_TYPE_LENGTH_DELIMITED or at the top of the stack in compactIfNecessary().
final int wireType = tag & WIRE_TYPE_MASK;
switch (wireType) {
case WIRE_TYPE_VARINT:
while ((mBuffer.readRawByte() & 0x80) != 0) { }
break;
case WIRE_TYPE_FIXED64:
mBuffer.skipRead(8);
break;
case WIRE_TYPE_LENGTH_DELIMITED: {
// Copy everything up to now, including the tag for this field.
mBuffer.writeFromThisBuffer(mCopyBegin, mBuffer.getReadPos() - mCopyBegin);
// Write the new size.
final int childRawSize = mBuffer.readRawFixed32();
final int childEncodedSize = mBuffer.readRawFixed32();
mBuffer.writeRawVarint32(childEncodedSize);
// Next time, start copying from here.
mCopyBegin = mBuffer.getReadPos();
if (childRawSize >= 0) {
// This is raw data, not an object. Skip ahead by the size.
// Recurse into the child
mBuffer.skipRead(childEncodedSize);
} else {
compactSizes(-childRawSize);
}
break;
// TODO: What does regular proto do if the object would be 0 size
// (e.g. if it is all default values).
}
case WIRE_TYPE_START_GROUP:
case WIRE_TYPE_END_GROUP:
throw new RuntimeException("groups not supported at index " + tagPos);
case WIRE_TYPE_FIXED32:
mBuffer.skipRead(4);
break;
default:
throw new ProtoParseException("compactSizes Bad tag tag=0x"
+ Integer.toHexString(tag) + " wireType=" + wireType
+ " -- " + mBuffer.getDebugString());
}
}
}
/**
* Write remaining data to the output stream. If there is no output stream,
* this function does nothing. Any currently open objects (i.e. ones that
* have not had {@link #end(long)} called for them will not be written). Whether this
* writes objects that are closed if there are remaining open objects is
* undefined (current implementation does not write it, future ones will).
* For now, can either call {@link #getBytes()} or {@link #flush()}, but not both.
*/
public void flush() {
if (mStream == null) {
return;
}
if (mDepth != 0) {
// TODO: The compacting code isn't ready yet to compact unless we're done.
// TODO: Fix that.
return;
}
if (mCompacted) {
// If we're compacted, we already wrote it finished.
return;
}
compactIfNecessary();
final byte[] data = mBuffer.getBytes(mBuffer.getReadableSize());
try {
mStream.write(data);
mStream.flush();
} catch (IOException ex) {
throw new RuntimeException("Error flushing proto to stream", ex);
}
}
/**
* Read a raw tag from the buffer.
*/
private int readRawTag() {
if (mBuffer.getReadPos() == mBuffer.getReadableSize()) {
return 0;
}
return (int)mBuffer.readRawUnsigned();
}
/**
* Dump debugging data about the buffers with the given log tag.
*/
public void dump(@NonNull String tag) {
Log.d(tag, mBuffer.getDebugString());
mBuffer.dumpBuffers(tag);
}
}
|
[
"[email protected]"
] | |
ee039fb4c55d01ef5b7306670cbbac99c990eeca
|
f366774024aaaf8b81492176c2ed809c9959d955
|
/ep1/plp/funcional2/ListaValor.java
|
c3a395f11f069e3b1ee6eb5db31e7d7092455c51
|
[
"MIT"
] |
permissive
|
rmleme/mac-316
|
624cc83ce983fc2521892d2d09133bd62024bc11
|
3f0c0fd156de2cd325774471902dd27162dc9155
|
refs/heads/main
| 2023-01-28T18:03:30.449884 | 2020-12-08T02:37:58 | 2020-12-08T02:37:58 | 319,504,399 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 126 |
java
|
package plp.funcional2;
public interface ListaValor extends Valor {
public Valor head();
public ListaValor tail();
}
|
[
"[email protected]"
] | |
fc0fea587411ff9a8f44d1bdbc6c530f7e4a7b3d
|
c7dcee67f5cadd7c45d11fbebae25a207f44439a
|
/src/test/java/skysea/app/ios/pageElement/contactPageElement.java
|
43086c8603d724f00594b395ec2c57ad233ee383
|
[] |
no_license
|
adazhang2015/iosSkyseaAppAutomation
|
47222db698db15403f5ce82597f091a2b2d2f5de
|
076deb4516093135a29a83dc165bddb5a0c04ff0
|
refs/heads/master
| 2021-01-11T04:17:34.663541 | 2016-10-19T07:39:49 | 2016-10-19T07:39:49 | 71,214,379 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 113 |
java
|
package skysea.app.ios.pageElement;
/**
* Created by ctrip on 16/9/23.
*/
public class contactPageElement {
}
|
[
"[email protected]"
] | |
e7c9ac8ce253d3f86510d49adc9f6facda46b2a9
|
09afb035c288309a4d3266ec732577f82582a813
|
/src/main/java/com/cole/project/web/dao/authorization/ResourceMapper.java
|
572617c2c53a21e4e33d46b2f880667b8280a4f1
|
[] |
no_license
|
myorganizationqq/cole-project
|
30e3a8ea5a32c1073b39d3ab75f83c1788b2bb18
|
38a0aaffda63107d0ad125d21e4dbb1b289ef6c9
|
refs/heads/master
| 2021-08-14T08:06:36.198720 | 2017-11-15T02:28:01 | 2017-11-15T02:28:01 | 110,059,887 | 0 | 0 | null | 2017-11-11T04:03:01 | 2017-11-09T02:58:41 |
JavaScript
|
UTF-8
|
Java
| false | false | 458 |
java
|
package com.cole.project.web.dao.authorization;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.cole.project.web.entity.Resource;
@Repository
public interface ResourceMapper {
List<Resource> findResourceByUid(long uid);
List<Resource> findALLResource();
int insertResource(Resource resource);
int updateResourceByResid(Resource resource);
int deleteResourceByResid(long resid);
}
|
[
"[email protected]"
] | |
0b79c9091e5a74fdaa891dc15cef58e48395407c
|
4aa245c1344a4b21e71a205c2615ec37b26958e2
|
/app/src/main/java/com/anthonynahas/autocallrecorder/utilities/actions/ContactPhotoAction.java
|
ca0496eba874d812bd7f366cdefc275402cbe6f1
|
[
"MIT"
] |
permissive
|
VeeraaBhaii/android-auto-call-recorder
|
1103a05f7c24d1e386732456a96fa9b435501ac8
|
aa52ee872a53bc90019daaedc256442bae3e9a77
|
refs/heads/master
| 2020-08-03T22:40:50.698192 | 2019-09-30T17:54:15 | 2019-09-30T17:54:15 | 211,906,995 | 0 | 0 |
MIT
| 2019-09-30T16:41:05 | 2019-09-30T16:41:04 | null |
UTF-8
|
Java
| false | false | 390 |
java
|
package com.anthonynahas.autocallrecorder.utilities.actions;
import com.anthonynahas.autocallrecorder.interfaces.Executable;
import com.anthonynahas.autocallrecorder.utilities.helpers.ContactHelper;
/**
* Created by A on 16.06.17.
*/
public class ContactPhotoAction implements Executable {
private ContactHelper mContactHelper;
@Override
public void execute() {
}
}
|
[
"[email protected]"
] | |
306091bfecd38636d91c5931e4fa188e8088d2a3
|
946786a2a19b1fcaa659e0c812a4753431ae68d1
|
/src/test/java/com/codeup/spring/AdsIntegrationTests.java
|
3ddac71f6ccc54b33ddf67eecd40b180d21e43e4
|
[] |
no_license
|
Caroline1986/spring
|
5db751441127daeca6dcfdfa9ca809408a141f31
|
c0046573a632cba3be4f2f35cfe06e3d4c8dbaa6
|
refs/heads/master
| 2023-02-28T16:18:40.282904 | 2021-02-16T23:01:50 | 2021-02-16T23:01:50 | 315,675,322 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,600 |
java
|
package com.codeup.spring;
import com.codeup.spring.models.Ad;
import com.codeup.spring.models.User;
import com.codeup.spring.repository.AdRepository;
import com.codeup.spring.repository.UserRepository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpStatus;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import javax.servlet.http.HttpSession;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertNotNull;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@AutoConfigureMockMvc
public class AdsIntegrationTests {
private User testUser;
private HttpSession httpSession;
@Autowired
private MockMvc mvc;
@Autowired
UserRepository userDao;
@Autowired
AdRepository adsDao;
@Autowired
private PasswordEncoder passwordEncoder;//<---from bean created in security
@Before
public void setup() throws Exception {
testUser = userDao.findByUsername("testUser");
// Creates the test user if not exists
if(testUser == null){
User newUser = new User();
newUser.setUsername("testUser");
newUser.setPassword(passwordEncoder.encode("pass"));
newUser.setEmail("[email protected]");
testUser = userDao.save(newUser);
}
// Throws a Post request to /login and expect a redirection to the Ads index page after being logged in
httpSession = this.mvc.perform(post("/login").with(csrf())//more actions ...import mockmvc for post
.param("username", "testUser")
.param("password", "pass"))
.andExpect(status().is(HttpStatus.FOUND.value()))
.andExpect(redirectedUrl("/ads"))
.andReturn()
.getRequest()
.getSession();
}
@Test
public void contextLoads() {
// Sanity Test, just to make sure the MVC bean is working
assertNotNull(mvc);
}
@Test
public void testIfUserSessionIsActive() throws Exception {
// It makes sure the returned session is not null
assertNotNull(httpSession);
}
@Test
public void testCreateAd() throws Exception {
// Makes a Post request to /ads/create and expect a redirection to the Ad
this.mvc.perform(
post("/ads/create").with(csrf())
.session((MockHttpSession) httpSession)
// Add all the required parameters to your request like this
.param("title", "test")
.param("description", "for sale"))
.andExpect(status().is3xxRedirection());
}
@Test
public void testShowAd() throws Exception {
Ad existingAd = adsDao.findAll().get(0);
// Makes a Get request to /ads/{id} and expect a redirection to the Ad show page
this.mvc.perform(get("/ads/" + existingAd.getId()))
.andExpect(status().isOk())
// Test the dynamic content of the page
.andExpect(content().string(containsString(existingAd.getDescription())));
}
@Test
public void testAdsIndex() throws Exception {
Ad existingAd = adsDao.findAll().get(0);
// Makes a Get request to /ads and verifies that we get some of the static text of the ads/index.html template and at least the title from the first Ad is present in the template.
this.mvc.perform(get("/ads"))
.andExpect(status().isOk())
// Test the static content of the page
.andExpect(content().string(containsString("Latest ads")))
// Test the dynamic content of the page
.andExpect(content().string(containsString(existingAd.getTitle())));
}
@Test
public void testEditAd() throws Exception {
// Gets the first Ad for tests purposes
Ad existingAd = adsDao.findAll().get(0);
// Makes a Post request to /ads/{id}/edit and expect a redirection to the Ad show page
this.mvc.perform(
post("/ads/" + existingAd.getId() + "/edit").with(csrf())
.session((MockHttpSession) httpSession)
.param("title", "edited title")
.param("description", "edited description"))
.andExpect(status().is3xxRedirection());
// Makes a GET request to /ads/{id} and expect a redirection to the Ad show page
this.mvc.perform(get("/ads/" + existingAd.getId()))
.andExpect(status().isOk())
// Test the dynamic content of the page
.andExpect(content().string(containsString("edited title")))
.andExpect(content().string(containsString("edited description")));
}
@Test
public void testDeleteAd() throws Exception {
// Creates a test Ad to be deleted
this.mvc.perform(
post("/ads/create").with(csrf())
.session((MockHttpSession) httpSession)
.param("title", "ad to be deleted")
.param("description", "won't last long"))
.andExpect(status().is3xxRedirection());
// Get the recent Ad that matches the title
Ad existingAd = adsDao.findByTitle("ad to be deleted");
// Makes a Post request to /ads/{id}/delete and expect a redirection to the Ads index
this.mvc.perform(
post("/ads/" + existingAd.getId() + "/delete").with(csrf())
.session((MockHttpSession) httpSession)
.param("id", String.valueOf(existingAd.getId())))
.andExpect(status().is3xxRedirection());
}
}
|
[
"[email protected]"
] | |
46775d84ee18b29dd36f41537c6d49e6e0a3b78e
|
b5d3282797bbe64ae6e7f70235920b3dde0decdb
|
/booking-hotel-system-backend/src/main/java/com/ptit/controller/rest/WardController.java
|
91d0a769fdc7fcc3efa6eabc7257001692dd2f15
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
vanvananh/DOAn
|
2433d50e5a693d5b86e89a9cd14d3a2dfd83c814
|
2bf38bfd23ad5384254f2f5594c777cc7c6d762f
|
refs/heads/master
| 2020-04-13T00:30:42.529087 | 2018-12-23T13:48:13 | 2018-12-23T13:48:13 | 162,847,242 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,007 |
java
|
package com.ptit.controller.rest;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ptit.entity.Ward;
import com.ptit.service.RoleService;
import com.ptit.service.WardService;
import com.ptit.util.Constants;
@CrossOrigin("*")
@RestController
@RequestMapping(value = Constants.Url.API + Constants.Url.WARD)
public class WardController {
@Autowired
private WardService wardService;
@Autowired
RoleService roleService;
@GetMapping(value = Constants.Url.CRUD.GET_ALL)
public ResponseEntity<?> getAllWard() {
return new ResponseEntity<List<Ward>>(
wardService.getAllWard(), HttpStatus.OK);
}
}
|
[
"[email protected]"
] | |
07c65da76edeceb5b3e61b98edaba5b42aded7a1
|
d7e40f17f59a503c9f053a60847242843ac0fc18
|
/src/modelo/LineaProducto.java
|
163f3b51733eec6d9d7c2e8f04925b49458fad13
|
[] |
no_license
|
ClaraPalacios/ListaCompra
|
417ec3ce96bdd31477c13fba5395a9307cec4f66
|
e6dd111f3ad4ca322708ea9cd098d7fc17a3a987
|
refs/heads/master
| 2021-08-19T12:47:49.492011 | 2017-11-26T10:57:02 | 2017-11-26T10:57:02 | 112,074,138 | 0 | 0 | null | null | null | null |
ISO-8859-2
|
Java
| false | false | 2,650 |
java
|
package modelo;
/**
* Contiene información relativa a un producto almacenado en la lista de la
* compra.
* <p>
*
* @author MIGUEL ANGEL LEON BARDAVIO
*
*/
public class LineaProducto {
// private Integer numLinea;
/**
* Producto a almacenar en la lista.
*/
private Producto producto;
/**
* Cantidad del producto a comprar.
*/
private Integer cantidad;
/**
* Variable que indica si el producto está comprado o no.
*/
private Boolean estaComprado;
/**
* Constructor de la clase.
* <p>
* Crea una instancia de la clase asignandole el nombre del producto, la
* cantidad a comprar y si se va a almacenar el producto como favorito o no.
* Inicialmente el producto no está comprado.
*
* @paramproducto Producto a almacenar en la lista.
* @param cantidad
* Cantidad del producto a comprar.
* @param esFavorito
* Variable que indica si el producto está almacenado como
* favorito o no.
*/
LineaProducto(Producto producto, Integer cantidad) {
this.producto = producto;
this.cantidad = cantidad;
this.estaComprado = false;
// TODO Comprobar errores en LineaProducto(Producto producto, Integer
// cantidad)
}
/**
* Devuelve el producto asociado a la linea de la lista.
*
* @return El producto asociado a la linea de la lista.
*/
public Producto getProducto() {
return producto;
}
/**
* Devuelve la cantidad de producto que se desea comprar.
*
* @return La cantidad de producto que se desea comprar.
*/
public Integer getCantidad() {
return cantidad;
}
/**
* Modifica la cantidad de producto que se desea comprar, siempre que no sea
* un valor negativo.
*
* @param cantidad
* Cantidad de un producto que se desea comprar.
* @return Devuelve true si se ha modificado la cantidad y false en caso
* contrario.
*/
public boolean setCantidad(Integer cantidad) {
if (cantidad > 0) {
this.cantidad = cantidad;
return true;
}
return false;
}
/**
* Devuelve si el producto está marcado como comprado o no.
*
* @return Devuelve true si el producto ha sido comprado y false en caso
* contrario.
*/
public Boolean getEstaComprado() {
return estaComprado;
}
/**
* Marca un producto de la lista como comprado.
*/
public void marcarComprado() {
this.estaComprado = true;
}
/**
* Marca un producto de la lista como no comprado.
*/
public void desmarcarComprado() {
this.estaComprado = false;
}
@Override
public String toString() {
return "Producto:" + producto + ", Cantidad:" + cantidad + ", Esta Comprado:" + estaComprado + "\n";
}
}
|
[
"[email protected]"
] | |
85bd51fd1305d8910915cf13ef088261232d5989
|
21d5b027e6cdd7eac43d26b6e96960a51c79797c
|
/MiniJavaCompiler_Frontend/src/compiler/IR/MJNoExpression.java
|
89b863ada8c1c2d7e111a3095c97b1b61f009ed0
|
[] |
no_license
|
404-html/Area51
|
969213aa529dfdfb420e3f533d2045c6b85b70b5
|
8186900c7efcc30f26ad28e769df0cc8f91082fb
|
refs/heads/master
| 2020-05-07T18:17:44.829200 | 2014-11-25T16:05:46 | 2014-11-25T16:05:46 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 201 |
java
|
package compiler.IR;
import compiler.PrettyPrinter;
public final class MJNoExpression extends MJExpression {
public MJNoExpression() {
}
public void prettyPrint(PrettyPrinter prepri) {
}
}
|
[
"Splat1477"
] |
Splat1477
|
dc65a6f5e412c3cfd2c3bbc6585c33d8bc28ecdd
|
f3fde7565ec6e9fa55cfe2aa76c25cd3d2054e54
|
/src/com/inter/client/ClientRemoteSens.java
|
7505e9743b087d97a49c57a370b439f7bd94470a
|
[] |
no_license
|
rufinachettiar/ExampleClient
|
06fc61872680df5a490e362d610e66ea8203f215
|
c0b4e1159ce21f26e338518a487a1b0ad5d88f20
|
refs/heads/master
| 2021-01-10T20:29:43.854204 | 2015-03-22T05:59:04 | 2015-03-22T05:59:04 | 32,663,977 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 188 |
java
|
package com.inter.client;
import java.rmi.RemoteException;
public interface ClientRemoteSens extends java.rmi.Remote {
public String query_state(int id) throws RemoteException;
}
|
[
"[email protected]"
] | |
9f54e4812dde30de6f61a8c31c64992c594167d1
|
45aa5dc1261695dc984fcab5991c7d7a97028fa7
|
/src/pack1/Invisibile.java
|
29e9e631a1125bc0be1f3348e3cae72778d999ef
|
[] |
no_license
|
davidecorsi/java-visibilita
|
fc02eecf70378472c3a7eced2a5328af51a071cb
|
adbf45b93fb73b0f5c2b677190f176cdb4fa82ab
|
refs/heads/main
| 2023-08-27T01:16:02.942761 | 2021-10-13T14:11:51 | 2021-10-13T14:11:51 | 394,925,310 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 124 |
java
|
package pack1;
class Invisibile {
public String nascostoFuori() {
return "pack1.Invisibile: metodo nascostoFuori";
}
}
|
[
"[email protected]"
] | |
c72600907cfc91fbd9bbe5780a3df6c7291d2ff4
|
b038c4919101ef3a9f37415b0ca49869fddc73ed
|
/core/src/test/java/org/openmbee/syncservice/core/utils/JSONUtilsTest.java
|
e0555b789205c63903e3d4f70a7c54693c7a367a
|
[
"Apache-2.0"
] |
permissive
|
Open-MBEE/sync-service
|
2284784b3ca93641ffe636c84f251065501f53c9
|
ad4113fac244fa890c00b1bc2c05fe5d657ba5aa
|
refs/heads/develop
| 2023-01-22T09:24:08.733317 | 2020-12-03T17:22:01 | 2020-12-03T17:22:01 | 310,330,863 | 0 | 0 |
Apache-2.0
| 2020-12-03T17:22:02 | 2020-11-05T14:52:13 | null |
UTF-8
|
Java
| false | false | 4,189 |
java
|
package org.openmbee.syncservice.core.utils;
import org.json.JSONArray;
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
public class JSONUtilsTest {
@Spy
private JSONUtils jsonUtils;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
}
@Test
public void parseStringToJsonArrayTest1() {
JSONArray a = jsonUtils.parseStringToJsonArray("[{},{}]");
assertNotNull(a);
assertEquals(2, a.length());
}
@Test
public void parseStringToJsonArrayTest2() {
JSONArray a = jsonUtils.parseStringToJsonArray("[]");
assertNull(a);
}
@Test
public void parseStringToJsonArrayTest3() {
try {
JSONArray a = jsonUtils.parseStringToJsonArray(null);
fail("Should have thrown...");
} catch(Exception ex) {}
}
@Test
public void parseStringToJsonArrayTest4() {
try {
JSONArray a = jsonUtils.parseStringToJsonArray("{}");
fail("Should have thrown...");
} catch(Exception ex) {}
}
@Test
public void convertJsonArrayToStringListTest1() {
List<String> list = jsonUtils.convertJsonArrayToStringList(new JSONArray("['one','two']"));
assertNotNull(list);
assertEquals(2, list.size());
}
@Test
public void convertJsonArrayToStringListTest2() {
List<String> list = jsonUtils.convertJsonArrayToStringList(new JSONArray("['one', 1]"));
assertNotNull(list);
assertEquals(2, list.size());
assertEquals("1", list.get(1));
}
@Test
public void convertJsonArrayToStringListTest3() {
List<String> list = jsonUtils.convertJsonArrayToStringList(null);
assertNull(list);
}
@Test
public void getStringFromArrayOfJSONObjectsTest1() {
String s = jsonUtils.getStringFromArrayOfJSONObjects(new JSONArray("[{},{'key':'val'}]"), "key");
assertNotNull(s);
assertEquals("val", s);
}
@Test
public void getStringFromArrayOfJSONObjectsTest2() {
String s = jsonUtils.getStringFromArrayOfJSONObjects(new JSONArray("[{},{'keyyy':'val'}]"), "key");
assertNull(s);
}
@Test
public void getStringFromArrayOfJSONObjectsTest3() {
String s = jsonUtils.getStringFromArrayOfJSONObjects(null, "key");
assertNull(s);
}
@Test
public void getStringFromArrayOfJSONObjectsTest4() {
try {
String s = jsonUtils.getStringFromArrayOfJSONObjects(new JSONArray("[{},{'key':1}]"), "key");
fail("Should have thrown...");
} catch(Exception ex) {}
}
@Test
public void getIntFromArrayOfJSONObjectsTest1() {
Integer s = jsonUtils.getIntFromArrayOfJSONObjects(new JSONArray("[{},{'key':1}]"), "key");
assertNotNull(s);
assertEquals(1, s);
}
@Test
public void getIntFromArrayOfJSONObjectsTest2() {
Integer s = jsonUtils.getIntFromArrayOfJSONObjects(new JSONArray("[{},{'keyyy':1}]"), "key");
assertNull(s);
}
@Test
public void getIntFromArrayOfJSONObjectsTest3() {
Integer s = jsonUtils.getIntFromArrayOfJSONObjects(null, "key");
assertNull(s);
}
@Test
public void getIntFromArrayOfJSONObjectsTest4() {
try {
Integer s = jsonUtils.getIntFromArrayOfJSONObjects(new JSONArray("[{},{'key':'val'}]"), "key");
fail("Should have thrown...");
} catch(Exception ex) {}
}
@Test
public void flattenObjectArrayTest1() {
String json = "[{'id':'1'},{'id':'2','me':'3'},{'you':'4'}]";
JSONArray array = new JSONArray(json);
List<String> flattened = jsonUtils.flattenObjectArray(array, "id");
assertEquals(2,flattened.size());
assertEquals("1", flattened.get(0));
assertEquals("2", flattened.get(1));
}
@Test
public void flattenObjectArrayTest2() {
List<String> flattened = jsonUtils.flattenObjectArray(null, "id");
assertNull(flattened);
}
}
|
[
"[email protected]"
] | |
280834b18d43d15c52a491556901be72d2e9e397
|
4fdf6fc8b3fa4462bcea50f7808d31dbe4f53ecf
|
/app/src/test/java/com/example/android/tutr/MainActivityTest.java
|
052f692ad68bb86538584e118f2ca247ed831a38
|
[] |
no_license
|
anushamamidala/Crammer-Android-Proj
|
7df0efdb5da4249cf1321b5f8c81d02da472fcae
|
d2c69b0a30212249e230540700e4c3fa713dad5a
|
refs/heads/master
| 2023-01-08T22:15:46.851831 | 2020-11-05T08:48:17 | 2020-11-05T08:48:17 | 310,201,620 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 894 |
java
|
package com.example.android.tutr;
import junit.framework.TestCase;
import org.junit.Test;
/**
* Created by yito on 2/28/16.
*/
public class MainActivityTest extends TestCase {
MainActivity main = new MainActivity();
@Test
public void testInputChecker(){
String nameAlphabet = "Jhonny";
String nameNumber = "John123";
String nameEmpty = "";
String courseNotEmpty = "ECSE421";
String courseEmpty = "";
assertEquals(main.inputChecker(nameEmpty, courseEmpty), 0);
assertEquals(main.inputChecker(nameAlphabet, courseEmpty), 1);
assertEquals(main.inputChecker(nameEmpty, courseNotEmpty), 2);
assertEquals(main.inputChecker(nameAlphabet, courseNotEmpty), 3);
assertEquals(main.inputChecker(nameNumber, courseEmpty), 4);
assertEquals(main.inputChecker(nameNumber, courseNotEmpty), 4);
}
}
|
[
"[email protected]"
] | |
e3269203de6853d54a426995ed2170ca89446270
|
8af1164bac943cef64e41bae312223c3c0e38114
|
/results-java/orientechnologies--orientdb/5dd71651d74bf13c98e3b8b1f1c30ae4a4730d3f/before/ONetworkProtocolBinary.java
|
d8f58e028f00fcff161d9c8a18b5ad8dd59e2b70
|
[] |
no_license
|
fracz/refactor-extractor
|
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
|
dd5e82bfcc376e74a99e18c2bf54c95676914272
|
refs/heads/master
| 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 100,394 |
java
|
/*
*
* * Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com)
* *
* * 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.
* *
* * For more information: http://www.orientechnologies.com
*
*/
package com.orientechnologies.orient.server.network.protocol.binary;
import com.orientechnologies.common.collection.OMultiValue;
import com.orientechnologies.common.concur.lock.OLockException;
import com.orientechnologies.common.exception.OException;
import com.orientechnologies.common.io.OIOException;
import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.common.serialization.types.OBinarySerializer;
import com.orientechnologies.common.serialization.types.OByteSerializer;
import com.orientechnologies.common.serialization.types.OIntegerSerializer;
import com.orientechnologies.common.serialization.types.ONullSerializer;
import com.orientechnologies.common.util.OCommonConst;
import com.orientechnologies.orient.client.remote.OCollectionNetworkSerializer;
import com.orientechnologies.orient.core.OConstants;
import com.orientechnologies.orient.core.Orient;
import com.orientechnologies.orient.core.cache.OCommandCache;
import com.orientechnologies.orient.core.command.OCommandRequestInternal;
import com.orientechnologies.orient.core.command.OCommandRequestText;
import com.orientechnologies.orient.core.command.OCommandResultListener;
import com.orientechnologies.orient.core.config.OContextConfiguration;
import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.db.ODatabase;
import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal;
import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
import com.orientechnologies.orient.core.db.record.ridbag.sbtree.OBonsaiCollectionPointer;
import com.orientechnologies.orient.core.db.record.ridbag.sbtree.OSBTreeCollectionManager;
import com.orientechnologies.orient.core.db.record.ridbag.sbtree.OSBTreeRidBag;
import com.orientechnologies.orient.core.engine.local.OEngineLocalPaginated;
import com.orientechnologies.orient.core.engine.memory.OEngineMemory;
import com.orientechnologies.orient.core.exception.*;
import com.orientechnologies.orient.core.fetch.OFetchContext;
import com.orientechnologies.orient.core.fetch.OFetchHelper;
import com.orientechnologies.orient.core.fetch.OFetchListener;
import com.orientechnologies.orient.core.fetch.OFetchPlan;
import com.orientechnologies.orient.core.fetch.remote.ORemoteFetchContext;
import com.orientechnologies.orient.core.fetch.remote.ORemoteFetchListener;
import com.orientechnologies.orient.core.id.ORID;
import com.orientechnologies.orient.core.id.ORecordId;
import com.orientechnologies.orient.core.index.sbtree.OTreeInternal;
import com.orientechnologies.orient.core.index.sbtreebonsai.local.OSBTreeBonsai;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.metadata.security.ORole;
import com.orientechnologies.orient.core.metadata.security.OUser;
import com.orientechnologies.orient.core.record.ORecord;
import com.orientechnologies.orient.core.record.ORecordInternal;
import com.orientechnologies.orient.core.record.impl.OBlob;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.serialization.OMemoryStream;
import com.orientechnologies.orient.core.serialization.serializer.ONetworkThreadLocalSerializer;
import com.orientechnologies.orient.core.serialization.serializer.record.ORecordSerializer;
import com.orientechnologies.orient.core.serialization.serializer.record.ORecordSerializerFactory;
import com.orientechnologies.orient.core.serialization.serializer.record.OSerializationThreadLocal;
import com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerSchemaAware2CSV;
import com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerStringAbstract;
import com.orientechnologies.orient.core.serialization.serializer.stream.OStreamSerializerAnyStreamable;
import com.orientechnologies.orient.core.sql.query.OConcurrentResultSet;
import com.orientechnologies.orient.core.sql.query.OResultSet;
import com.orientechnologies.orient.core.sql.query.OSQLAsynchQuery;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import com.orientechnologies.orient.core.storage.*;
import com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage;
import com.orientechnologies.orient.core.storage.impl.local.paginated.OOfflineClusterException;
import com.orientechnologies.orient.core.type.ODocumentWrapper;
import com.orientechnologies.orient.enterprise.channel.binary.*;
import com.orientechnologies.orient.server.OClientConnection;
import com.orientechnologies.orient.server.OServer;
import com.orientechnologies.orient.server.OServerInfo;
import com.orientechnologies.orient.server.ShutdownHelper;
import com.orientechnologies.orient.server.distributed.*;
import com.orientechnologies.orient.server.network.OServerNetworkListener;
import com.orientechnologies.orient.server.network.protocol.ONetworkProtocol;
import com.orientechnologies.orient.server.plugin.OServerPlugin;
import com.orientechnologies.orient.server.plugin.OServerPluginHelper;
import com.orientechnologies.orient.server.tx.OTransactionOptimisticProxy;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.util.*;
import java.util.Map.Entry;
import java.util.logging.Level;
public class ONetworkProtocolBinary extends ONetworkProtocol {
protected final Level logClientExceptions;
protected final boolean logClientFullStackTrace;
protected OChannelBinary channel;
protected volatile int requestType;
protected int clientTxId;
protected boolean okSent;
private boolean tokenConnection = false;
private long distributedRequests = 0;
private long distributedResponses = 0;
public ONetworkProtocolBinary() {
this("OrientDB <- BinaryClient/?");
}
public ONetworkProtocolBinary(final String iThreadName) {
super(Orient.instance().getThreadGroup(), iThreadName);
logClientExceptions = Level.parse(OGlobalConfiguration.SERVER_LOG_DUMP_CLIENT_EXCEPTION_LEVEL.getValueAsString());
logClientFullStackTrace = OGlobalConfiguration.SERVER_LOG_DUMP_CLIENT_EXCEPTION_FULLSTACKTRACE.getValueAsBoolean();
}
/**
* Internal varialbe injection useful for testing.
* @param server
* @param channel
*/
public void initVariables(final OServer server, OChannelBinaryServer channel){
this.server = server;
this.channel = channel;
}
@Override
public void config(final OServerNetworkListener iListener, final OServer iServer, final Socket iSocket,
final OContextConfiguration iConfig) throws IOException {
OChannelBinaryServer channel = new OChannelBinaryServer(iSocket, iConfig);
initVariables(iServer, channel);
// SEND PROTOCOL VERSION
channel.writeShort((short) getVersion());
channel.flush();
start();
setName("OrientDB (" + iSocket.getLocalSocketAddress() + ") <- BinaryClient (" + iSocket.getRemoteSocketAddress() + ")");
}
@Override
public void startup() {
super.startup();
}
@Override
public void shutdown() {
sendShutdown();
channel.close();
}
@Override
protected void execute() throws Exception {
requestType = -1;
// do not remove this or we will get deadlock upon shutdown.
if (isShutdownFlag())
return;
clientTxId = 0;
okSent = false;
long timer = 0;
OClientConnection connection = null;
try {
requestType = channel.readByte();
clientTxId = channel.readInt();
timer = Orient.instance().getProfiler().startChrono();
try {
connection = onBeforeRequest();
} catch (Exception e) {
if (requestType != OChannelBinaryProtocol.REQUEST_DB_CLOSE) {
sendError(connection, clientTxId, e);
handleConnectionError(connection, e);
onAfterRequest(connection);
sendShutdown();
}
return;
}
OLogManager.instance().debug(this, "Request id:" + clientTxId + " type:" + requestType);
try {
if (!executeRequest(connection)) {
OLogManager.instance().error(this, "Request not supported. Code: " + requestType);
channel.clearInput();
sendErrorOrDropConnection(connection, clientTxId,
new ONetworkProtocolException("Request not supported. Code: " + requestType));
}
} finally {
onAfterRequest(connection);
}
} catch (IOException e) {
OLogManager.instance().debug(this, "I/O Error on client clientId=%d reqType=%d", clientTxId, requestType, e);
sendShutdown();
} catch (OException e) {
sendErrorOrDropConnection(connection, clientTxId, e);
} catch (RuntimeException e) {
sendErrorOrDropConnection(connection, clientTxId, e);
} catch (Throwable t) {
sendErrorOrDropConnection(connection, clientTxId, t);
} finally {
Orient.instance().getProfiler()
.stopChrono("server.network.requests", "Total received requests", timer, "server.network.requests");
OSerializationThreadLocal.INSTANCE.get().clear();
}
}
protected OClientConnection onBeforeRequest() throws IOException {
OClientConnection connection = solveSession();
if (connection != null) {
connection.statsUpdate();
} else {
ODatabaseRecordThreadLocal.INSTANCE.remove();
if (requestType != OChannelBinaryProtocol.REQUEST_DB_CLOSE && requestType != OChannelBinaryProtocol.REQUEST_SHUTDOWN) {
OLogManager.instance().debug(this, "Found unknown session %d, shutdown current connection", clientTxId);
shutdown();
throw new OIOException("Found unknown session " + clientTxId);
}
}
OServerPluginHelper.invokeHandlerCallbackOnBeforeClientRequest(server, connection, (byte) requestType);
return connection;
}
private OClientConnection solveSession() throws IOException {
OClientConnection connection = server.getClientConnectionManager().getConnection(clientTxId, this);
try {
boolean noToken = false;
if (connection == null && clientTxId < 0 && requestType != OChannelBinaryProtocol.REQUEST_DB_REOPEN) {
// OPEN OF OLD STYLE SESSION.
noToken = true;
}
if (requestType == OChannelBinaryProtocol.REQUEST_CONNECT || requestType == OChannelBinaryProtocol.REQUEST_DB_OPEN
|| requestType == OChannelBinaryProtocol.REQUEST_SHUTDOWN) {
// OPERATIONS THAT DON'T USE TOKEN
noToken = true;
}
if (connection != null && !Boolean.TRUE.equals(connection.getTokenBased())) {
// CONNECTION WITHOUT TOKEN/OLD MODE
noToken = true;
}
if (noToken) {
if (clientTxId < 0) {
connection = server.getClientConnectionManager().connect(this);
connection.getData().sessionId = clientTxId;
}
if (connection != null) {
// This should not be needed
connection.setTokenBytes(null);
connection.acquire();
}
} else {
tokenConnection = true;
byte[] bytes = channel.readBytes();
if (connection == null && bytes != null && bytes.length > 0) {
// THIS IS THE CASE OF A TOKEN OPERATION WITHOUT HANDSHAKE ON THIS CONNECTION.
connection = server.getClientConnectionManager().connect(this);
}
if (connection == null) {
throw new OTokenSecurityException("missing session and token");
}
if (requestType != OChannelBinaryProtocol.REQUEST_DB_REOPEN) {
connection.acquire();
connection.validateSession(bytes, server.getTokenHandler(), this);
} else {
connection.validateSession(bytes, server.getTokenHandler(), this);
server.getClientConnectionManager().disconnect(clientTxId);
connection = server.getClientConnectionManager().reConnect(this, connection.getTokenBytes(), connection.getToken());
connection.acquire();
}
if (requestType != OChannelBinaryProtocol.REQUEST_DB_CLOSE) {
connection.init(server);
}
if (connection.getData().serverUser) {
connection.setServerUser(server.getUser(connection.getData().serverUsername));
}
}
} catch (RuntimeException e) {
if (connection != null)
server.getClientConnectionManager().disconnect(connection);
ODatabaseRecordThreadLocal.INSTANCE.remove();
throw e;
} catch (IOException e) {
if (connection != null)
server.getClientConnectionManager().disconnect(connection);
ODatabaseRecordThreadLocal.INSTANCE.remove();
throw e;
}
return connection;
}
protected void onAfterRequest(OClientConnection connection) throws IOException {
OServerPluginHelper.invokeHandlerCallbackOnAfterClientRequest(server, connection, (byte) requestType);
if (connection != null) {
connection.endOperation();
}
setDataCommandInfo(connection, "Listening");
}
protected boolean executeRequest(OClientConnection connection) throws IOException {
try {
switch (requestType) {
case OChannelBinaryProtocol.REQUEST_SHUTDOWN:
shutdownConnection(connection);
break;
case OChannelBinaryProtocol.REQUEST_CONNECT:
connect(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_LIST:
listDatabases(connection);
break;
case OChannelBinaryProtocol.REQUEST_SERVER_INFO:
serverInfo(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_OPEN:
openDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_REOPEN:
reopenDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_RELOAD:
reloadDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_CREATE:
createDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_CLOSE:
closeDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_EXIST:
existsDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_DROP:
dropDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_SIZE:
sizeDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_COUNTRECORDS:
countDatabaseRecords(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_COPY:
copyDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_REPLICATION:
replicationDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_CLUSTER:
distributedCluster(connection);
break;
case OChannelBinaryProtocol.REQUEST_DATACLUSTER_COUNT:
countClusters(connection);
break;
case OChannelBinaryProtocol.REQUEST_DATACLUSTER_DATARANGE:
rangeCluster(connection);
break;
case OChannelBinaryProtocol.REQUEST_DATACLUSTER_ADD:
addCluster(connection);
break;
case OChannelBinaryProtocol.REQUEST_DATACLUSTER_DROP:
removeCluster(connection);
break;
case OChannelBinaryProtocol.REQUEST_RECORD_METADATA:
readRecordMetadata(connection);
break;
case OChannelBinaryProtocol.REQUEST_RECORD_LOAD:
readRecord(connection);
break;
case OChannelBinaryProtocol.REQUEST_RECORD_LOAD_IF_VERSION_NOT_LATEST:
readRecordIfVersionIsNotLatest(connection);
break;
case OChannelBinaryProtocol.REQUEST_RECORD_CREATE:
createRecord(connection);
break;
case OChannelBinaryProtocol.REQUEST_RECORD_UPDATE:
updateRecord(connection);
break;
case OChannelBinaryProtocol.REQUEST_RECORD_DELETE:
deleteRecord(connection);
break;
case OChannelBinaryProtocol.REQUEST_RECORD_HIDE:
hideRecord(connection);
break;
case OChannelBinaryProtocol.REQUEST_POSITIONS_HIGHER:
higherPositions(connection);
break;
case OChannelBinaryProtocol.REQUEST_POSITIONS_CEILING:
ceilingPositions(connection);
break;
case OChannelBinaryProtocol.REQUEST_POSITIONS_LOWER:
lowerPositions(connection);
break;
case OChannelBinaryProtocol.REQUEST_POSITIONS_FLOOR:
floorPositions(connection);
break;
case OChannelBinaryProtocol.REQUEST_COUNT:
throw new UnsupportedOperationException("Operation OChannelBinaryProtocol.REQUEST_COUNT has been deprecated");
case OChannelBinaryProtocol.REQUEST_COMMAND:
command(connection);
break;
case OChannelBinaryProtocol.REQUEST_TX_COMMIT:
commit(connection);
break;
case OChannelBinaryProtocol.REQUEST_CONFIG_GET:
configGet(connection);
break;
case OChannelBinaryProtocol.REQUEST_CONFIG_SET:
configSet(connection);
break;
case OChannelBinaryProtocol.REQUEST_CONFIG_LIST:
configList(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_FREEZE:
freezeDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_DB_RELEASE:
releaseDatabase(connection);
break;
case OChannelBinaryProtocol.REQUEST_RECORD_CLEAN_OUT:
cleanOutRecord(connection);
break;
case OChannelBinaryProtocol.REQUEST_CREATE_SBTREE_BONSAI:
createSBTreeBonsai(connection);
break;
case OChannelBinaryProtocol.REQUEST_SBTREE_BONSAI_GET:
sbTreeBonsaiGet(connection);
break;
case OChannelBinaryProtocol.REQUEST_SBTREE_BONSAI_FIRST_KEY:
sbTreeBonsaiFirstKey(connection);
break;
case OChannelBinaryProtocol.REQUEST_SBTREE_BONSAI_GET_ENTRIES_MAJOR:
sbTreeBonsaiGetEntriesMajor(connection);
break;
case OChannelBinaryProtocol.REQUEST_RIDBAG_GET_SIZE:
ridBagSize(connection);
break;
case OChannelBinaryProtocol.REQUEST_INCREMENTAL_BACKUP:
incrementalBackup(connection);
break;
case OChannelBinaryProtocol.DISTRIBUTED_REQUEST:
executeDistributedRequest(connection);
break;
case OChannelBinaryProtocol.DISTRIBUTED_RESPONSE:
executeDistributedResponse(connection);
break;
default:
setDataCommandInfo(connection, "Command not supported");
return false;
}
return true;
} catch (RuntimeException e) {
if (connection != null && connection.getDatabase() != null) {
final OSBTreeCollectionManager collectionManager = connection.getDatabase().getSbTreeCollectionManager();
if (collectionManager != null)
collectionManager.clearChangedIds();
}
throw e;
}
}
private void reopenDatabase(OClientConnection connection) throws IOException {
// TODO:REASSOCIATE CONNECTION TO CLIENT.
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeInt(connection.getId());
} finally {
endResponse(connection);
}
}
protected void checkServerAccess(final String iResource, OClientConnection connection) {
if (connection.getData().protocolVersion <= OChannelBinaryProtocol.PROTOCOL_VERSION_26) {
if (connection.getServerUser() == null)
throw new OSecurityAccessException("Server user not authenticated");
if (!server.isAllowed(connection.getServerUser().name, iResource))
throw new OSecurityAccessException(
"User '" + connection.getServerUser().name + "' cannot access to the resource [" + iResource
+ "]. Use another server user or change permission in the file config/orientdb-server-config.xml");
} else {
if (!connection.getData().serverUser)
throw new OSecurityAccessException("Server user not authenticated");
if (!server.isAllowed(connection.getData().serverUsername, iResource))
throw new OSecurityAccessException(
"User '" + connection.getData().serverUsername + "' cannot access to the resource [" + iResource
+ "]. Use another server user or change permission in the file config/orientdb-server-config.xml");
}
}
protected void removeCluster(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Remove cluster");
if (!isConnectionAlive(connection))
return;
final int id = channel.readShort();
final String clusterName = connection.getDatabase().getClusterNameById(id);
if (clusterName == null)
throw new IllegalArgumentException(
"Cluster " + id + " does not exist anymore. Refresh the db structure or just reconnect to the database");
boolean result = connection.getDatabase().dropCluster(clusterName, false);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeByte((byte) (result ? 1 : 0));
} finally {
endResponse(connection);
}
}
protected void addCluster(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Add cluster");
if (!isConnectionAlive(connection))
return;
String type = "";
if (connection.getData().protocolVersion < 24)
type = channel.readString();
final String name = channel.readString();
int clusterId = -1;
final String location;
if (connection.getData().protocolVersion < 24 || type.equalsIgnoreCase("PHYSICAL"))
location = channel.readString();
else
location = null;
if (connection.getData().protocolVersion < 24) {
final String dataSegmentName;
dataSegmentName = channel.readString();
}
clusterId = channel.readShort();
final int num;
if (clusterId < 0)
num = connection.getDatabase().addCluster(name);
else
num = connection.getDatabase().addCluster(name, clusterId, null);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeShort((short) num);
} finally {
endResponse(connection);
}
}
protected void rangeCluster(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Get the begin/end range of data in cluster");
if (!isConnectionAlive(connection))
return;
final long[] pos = connection.getDatabase().getStorage().getClusterDataRange(channel.readShort());
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeLong(pos[0]);
channel.writeLong(pos[1]);
} finally {
endResponse(connection);
}
}
protected void countClusters(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Count cluster elements");
if (!isConnectionAlive(connection))
return;
int[] clusterIds = new int[channel.readShort()];
for (int i = 0; i < clusterIds.length; ++i)
clusterIds[i] = channel.readShort();
boolean countTombstones = false;
countTombstones = channel.readByte() > 0;
final long count = connection.getDatabase().countClusterElements(clusterIds, countTombstones);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeLong(count);
} finally {
endResponse(connection);
}
}
protected void reloadDatabase(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Reload database information");
if (!isConnectionAlive(connection))
return;
beginResponse();
try {
sendOk(connection, clientTxId);
sendDatabaseInformation(connection);
} finally {
endResponse(connection);
}
}
protected void openDatabase(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Open database");
readConnectionData(connection);
final String dbURL = channel.readString();
String dbType = ODatabaseDocument.TYPE;
if (connection.getData().protocolVersion <= OChannelBinaryProtocol.PROTOCOL_VERSION_32)
// READ DB-TYPE FROM THE CLIENT. NOT USED ANYMORE
dbType = channel.readString();
final String user = channel.readString();
final String passwd = channel.readString();
try {
connection.setDatabase((ODatabaseDocumentTx) server.openDatabase(dbURL, user, passwd, connection.getData()));
} catch (OException e) {
server.getClientConnectionManager().disconnect(connection);
throw e;
}
byte[] token = null;
if (Boolean.TRUE.equals(connection.getTokenBased())) {
token = server.getTokenHandler()
.getSignedBinaryToken(connection.getDatabase(), connection.getDatabase().getUser(), connection.getData());
// TODO: do not use the parse split getSignedBinaryToken in two methods.
getServer().getClientConnectionManager().connect(this, connection, token, server.getTokenHandler());
}
if (connection.getDatabase().getStorage() instanceof OStorageProxy && !loadUserFromSchema(connection, user, passwd)) {
sendErrorOrDropConnection(connection, clientTxId, new OSecurityAccessException(connection.getDatabase().getName(),
"User or password not valid for database: '" + connection.getDatabase().getName() + "'"));
} else {
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeInt(connection.getId());
if (connection.getData().protocolVersion > OChannelBinaryProtocol.PROTOCOL_VERSION_26) {
if (Boolean.TRUE.equals(connection.getTokenBased())) {
channel.writeBytes(token);
} else
channel.writeBytes(OCommonConst.EMPTY_BYTE_ARRAY);
}
sendDatabaseInformation(connection);
final OServerPlugin plugin = server.getPlugin("cluster");
ODocument distributedCfg = null;
if (plugin != null && plugin instanceof ODistributedServerManager) {
distributedCfg = ((ODistributedServerManager) plugin).getClusterConfiguration();
final ODistributedConfiguration dbCfg = ((ODistributedServerManager) plugin)
.getDatabaseConfiguration(connection.getDatabase().getName());
if (dbCfg != null) {
// ENHANCE SERVER CFG WITH DATABASE CFG
distributedCfg.field("database", dbCfg.getDocument(), OType.EMBEDDED);
}
}
channel.writeBytes(distributedCfg != null ? getRecordBytes(connection, distributedCfg) : null);
if (connection.getData().protocolVersion >= 14)
channel.writeString(OConstants.getVersion());
} finally {
endResponse(connection);
}
}
}
protected void connect(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Connect");
readConnectionData(connection);
connection.setServerUser(server.serverLogin(channel.readString(), channel.readString(), "connect"));
if (connection.getServerUser() == null)
throw new OSecurityAccessException(
"Wrong user/password to [connect] to the remote OrientDB Server instance");
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeInt(connection.getId());
if (connection.getData().protocolVersion > OChannelBinaryProtocol.PROTOCOL_VERSION_26) {
connection.getData().serverUsername = connection.getServerUser().name;
connection.getData().serverUser = true;
byte[] token;
if (Boolean.TRUE.equals(connection.getTokenBased())) {
token = server.getTokenHandler().getSignedBinaryToken(null, null, connection.getData());
} else
token = OCommonConst.EMPTY_BYTE_ARRAY;
channel.writeBytes(token);
}
} finally {
endResponse(connection);
}
}
private void incrementalBackup(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Incremental backup");
if (!isConnectionAlive(connection))
return;
final String path = channel.readString();
String fileName = connection.getDatabase().incrementalBackup(path);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeString(fileName);
} finally {
endResponse(connection);
}
}
private void executeDistributedRequest(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Distributed request");
checkServerAccess("server.replication", connection);
final byte[] serializedReq = channel.readBytes();
final ODistributedServerManager manager = server.getDistributedManager();
final ODistributedRequest req = new ODistributedRequest(manager.getTaskFactory());
final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(serializedReq));
try {
req.readExternal(in);
} catch (ClassNotFoundException e) {
throw new IOException("Error on unmarshalling of remote task", e);
} finally {
in.close();
}
ODistributedServerLog.debug(this, manager.getLocalNodeName(), manager.getNodeNameById(req.getId().getNodeId()),
ODistributedServerLog.DIRECTION.IN, "Received request %s (%d bytes)", req, serializedReq.length);
final String dbName = req.getDatabaseName();
if (dbName != null) {
if (distributedRequests == 0) {
if (req.getTask().isNodeOnlineRequired()) {
try {
manager.waitUntilNodeOnline(manager.getLocalNodeName(), dbName);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
ODistributedServerLog.error(this, manager.getLocalNodeName(), manager.getNodeNameById(req.getId().getNodeId()),
ODistributedServerLog.DIRECTION.IN, "Distributed request %s interrupted waiting for the database to be online",
req);
throw new ODistributedException(
"Distributed request " + req.getId() + " interrupted waiting for the database to be online");
}
}
}
ODistributedDatabase ddb = manager.getMessageService().getDatabase(dbName);
if (ddb == null)
throw new ODistributedException("Database configuration not found for database '" + req.getDatabaseName() + "'");
ddb.processRequest(req);
} else
manager.executeOnLocalNode(req.getId(), req.getTask(), null);
distributedRequests++;
}
private void executeDistributedResponse(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Distributed response");
checkServerAccess("server.replication", connection);
final byte[] serializedResponse = channel.readBytes();
final ODistributedServerManager manager = server.getDistributedManager();
final ODistributedResponse response = new ODistributedResponse();
final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(serializedResponse));
try {
response.readExternal(in);
} catch (ClassNotFoundException e) {
throw new IOException("Error on unmarshalling of remote task", e);
}
ODistributedServerLog.debug(this, manager.getLocalNodeName(), response.getExecutorNodeName(), ODistributedServerLog.DIRECTION.IN,
"Executing distributed response %s", response);
manager.getMessageService().dispatchResponseToThread(response);
distributedResponses++;
}
protected void sendError(final OClientConnection connection, final int iClientTxId, final Throwable t) throws IOException {
channel.acquireWriteLock();
try {
channel.writeByte(OChannelBinaryProtocol.RESPONSE_STATUS_ERROR);
channel.writeInt(iClientTxId);
if (tokenConnection && requestType != OChannelBinaryProtocol.REQUEST_CONNECT && (
requestType != OChannelBinaryProtocol.REQUEST_DB_OPEN && requestType != OChannelBinaryProtocol.REQUEST_SHUTDOWN || (
connection != null && connection.getData() != null
&& connection.getData().protocolVersion <= OChannelBinaryProtocol.PROTOCOL_VERSION_32))
|| requestType == OChannelBinaryProtocol.REQUEST_DB_REOPEN) {
// TODO: Check if the token is expiring and if it is send a new token
if (connection != null && connection.getToken() != null) {
byte[] renewedToken = server.getTokenHandler().renewIfNeeded(connection.getToken());
channel.writeBytes(renewedToken);
} else
channel.writeBytes(new byte[] {});
}
final Throwable current;
if (t instanceof OLockException && t.getCause() instanceof ODatabaseException)
// BYPASS THE DB POOL EXCEPTION TO PROPAGATE THE RIGHT SECURITY ONE
current = t.getCause();
else
current = t;
sendErrorDetails(current);
serializeExceptionObject(current);
channel.flush();
if (OLogManager.instance().isLevelEnabled(logClientExceptions)) {
if (logClientFullStackTrace)
OLogManager.instance().log(this, logClientExceptions, "Sent run-time exception to the client %s: %s", t,
channel.socket.getRemoteSocketAddress(), t.toString());
else
OLogManager.instance().log(this, logClientExceptions, "Sent run-time exception to the client %s: %s", null,
channel.socket.getRemoteSocketAddress(), t.toString());
}
} catch (Exception e) {
if (e instanceof SocketException)
shutdown();
else
OLogManager.instance().error(this, "Error during sending an error to client", e);
} finally {
if (channel.getLockWrite().isHeldByCurrentThread())
// NO EXCEPTION SO FAR: UNLOCK IT
channel.releaseWriteLock();
}
}
protected void shutdownConnection(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Shutdowning");
OLogManager.instance().info(this, "Received shutdown command from the remote client %s:%d", channel.socket.getInetAddress(),
channel.socket.getPort());
final String user = channel.readString();
final String passwd = channel.readString();
if (server.authenticate(user, passwd, "shutdown")) {
OLogManager.instance()
.info(this, "Remote client %s:%d authenticated. Starting shutdown of server...", channel.socket.getInetAddress(),
channel.socket.getPort());
beginResponse();
try {
sendOk(connection, clientTxId);
} finally {
endResponse(connection);
}
runShutdownInNonDaemonThread();
return;
}
OLogManager.instance()
.error(this, "Authentication error of remote client %s:%d: shutdown is aborted.", channel.socket.getInetAddress(),
channel.socket.getPort());
sendErrorOrDropConnection(connection, clientTxId, new OSecurityAccessException("Invalid user/password to shutdown the server"));
}
protected void copyDatabase(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Copy the database to a remote server");
final String dbUrl = channel.readString();
final String dbUser = channel.readString();
final String dbPassword = channel.readString();
final String remoteServerName = channel.readString();
final String remoteServerEngine = channel.readString();
checkServerAccess("database.copy", connection);
final ODatabaseDocument db = (ODatabaseDocumentTx) server.openDatabase(dbUrl, dbUser, dbPassword);
beginResponse();
try {
sendOk(connection, clientTxId);
} finally {
endResponse(connection);
}
}
protected void replicationDatabase(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Replication command");
final ODocument request = new ODocument(channel.readBytes());
final ODistributedServerManager dManager = server.getDistributedManager();
if (dManager == null)
throw new OConfigurationException("No distributed manager configured");
final String operation = request.field("operation");
ODocument response = null;
if (operation.equals("start")) {
checkServerAccess("server.replication.start", connection);
} else if (operation.equals("stop")) {
checkServerAccess("server.replication.stop", connection);
} else if (operation.equals("config")) {
checkServerAccess("server.replication.config", connection);
response = new ODocument()
.fromJSON(dManager.getDatabaseConfiguration((String) request.field("db")).getDocument().toJSON("prettyPrint"));
}
sendResponse(connection, response);
}
protected void distributedCluster(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Cluster status");
final ODocument req = new ODocument(channel.readBytes());
ODocument response = null;
final String operation = req.field("operation");
if (operation == null)
throw new IllegalArgumentException("Cluster operation is null");
if (operation.equals("status")) {
final OServerPlugin plugin = server.getPlugin("cluster");
if (plugin != null && plugin instanceof ODistributedServerManager)
response = ((ODistributedServerManager) plugin).getClusterConfiguration();
} else
throw new IllegalArgumentException("Cluster operation '" + operation + "' is not supported");
sendResponse(connection, response);
}
protected void countDatabaseRecords(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Database count records");
if (!isConnectionAlive(connection))
return;
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeLong(connection.getDatabase().getStorage().countRecords());
} finally {
endResponse(connection);
}
}
protected void sizeDatabase(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Database size");
if (!isConnectionAlive(connection))
return;
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeLong(connection.getDatabase().getStorage().getSize());
} finally {
endResponse(connection);
}
}
protected void dropDatabase(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Drop database");
String dbName = channel.readString();
String storageType = null;
storageType = channel.readString();
if (storageType == null)
storageType = "plocal";
checkServerAccess("database.drop", connection);
connection.setDatabase(getDatabaseInstance(dbName, ODatabaseDocument.TYPE, storageType));
if (connection.getDatabase().exists()) {
if (connection.getDatabase().isClosed())
server.openDatabaseBypassingSecurity(connection.getDatabase(), connection.getData(), connection.getServerUser().name);
connection.getDatabase().drop();
OLogManager.instance().info(this, "Dropped database '%s'", connection.getDatabase().getName());
connection.close();
} else {
throw new OStorageException("Database with name '" + dbName + "' does not exist");
}
beginResponse();
try {
sendOk(connection, clientTxId);
} finally {
endResponse(connection);
}
}
protected void existsDatabase(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Exists database");
final String dbName = channel.readString();
String storageType = null;
storageType = channel.readString();
if (storageType == null)
storageType = "plocal";
checkServerAccess("database.exists", connection);
boolean result = false;
ODatabaseDocumentInternal database;
database = getDatabaseInstance(dbName, ODatabaseDocument.TYPE, storageType);
if (database.exists())
result = true;
else
Orient.instance().unregisterStorage(database.getStorage());
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeByte((byte) (result ? 1 : 0));
} finally {
endResponse(connection);
}
}
protected void createDatabase(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Create database");
String dbName = channel.readString();
String dbType = ODatabaseDocument.TYPE;
// READ DB-TYPE FROM THE CLIENT
dbType = channel.readString();
String storageType = channel.readString();
String backupPath = null;
if (connection.getData().protocolVersion > 35) {
backupPath = channel.readString();
}
checkServerAccess("database.create", connection);
checkStorageExistence(dbName);
connection.setDatabase(getDatabaseInstance(dbName, dbType, storageType));
createDatabase(connection.getDatabase(), null, null, backupPath);
beginResponse();
try {
sendOk(connection, clientTxId);
} finally {
endResponse(connection);
}
}
protected void closeDatabase(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Close Database");
if (connection != null) {
server.getClientConnectionManager().disconnect(connection);
}
}
protected void configList(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "List config");
checkServerAccess("server.config.get", connection);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeShort((short) OGlobalConfiguration.values().length);
for (OGlobalConfiguration cfg : OGlobalConfiguration.values()) {
String key;
try {
key = cfg.getKey();
} catch (Exception e) {
key = "?";
}
String value;
if (cfg.isHidden())
value = "<hidden>";
else
try {
value = cfg.getValueAsString() != null ? cfg.getValueAsString() : "";
} catch (Exception e) {
value = "";
}
channel.writeString(key);
channel.writeString(value);
}
} finally {
endResponse(connection);
}
}
protected void configSet(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Set config");
checkServerAccess("server.config.set", connection);
final String key = channel.readString();
final String value = channel.readString();
final OGlobalConfiguration cfg = OGlobalConfiguration.findByKey(key);
if (cfg != null) {
cfg.setValue(value);
if (!cfg.isChangeableAtRuntime())
throw new OConfigurationException("Property '" + key + "' cannot be changed at runtime. Change the setting at startup");
} else
throw new OConfigurationException("Property '" + key + "' was not found in global configuration");
beginResponse();
try {
sendOk(connection, clientTxId);
} finally {
endResponse(connection);
}
}
protected void configGet(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Get config");
checkServerAccess("server.config.get", connection);
final String key = channel.readString();
final OGlobalConfiguration cfg = OGlobalConfiguration.findByKey(key);
String cfgValue = cfg != null ? cfg.isHidden() ? "<hidden>" : cfg.getValueAsString() : "";
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeString(cfgValue);
} finally {
endResponse(connection);
}
}
protected void commit(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Transaction commit");
if (!isConnectionAlive(connection))
return;
final OTransactionOptimisticProxy tx = new OTransactionOptimisticProxy(connection, this);
try {
connection.getDatabase().begin(tx);
try {
connection.getDatabase().commit();
beginResponse();
try {
sendOk(connection, clientTxId);
// SEND BACK ALL THE RECORD IDS FOR THE CREATED RECORDS
channel.writeInt(tx.getCreatedRecords().size());
for (Entry<ORecordId, ORecord> entry : tx.getCreatedRecords().entrySet()) {
channel.writeRID(entry.getKey());
channel.writeRID(entry.getValue().getIdentity());
// IF THE NEW OBJECT HAS VERSION > 0 MEANS THAT HAS BEEN UPDATED IN THE SAME TX. THIS HAPPENS FOR GRAPHS
if (entry.getValue().getVersion() > 0)
tx.getUpdatedRecords().put((ORecordId) entry.getValue().getIdentity(), entry.getValue());
}
// SEND BACK ALL THE NEW VERSIONS FOR THE UPDATED RECORDS
channel.writeInt(tx.getUpdatedRecords().size());
for (Entry<ORecordId, ORecord> entry : tx.getUpdatedRecords().entrySet()) {
channel.writeRID(entry.getKey());
channel.writeVersion(entry.getValue().getVersion());
}
if (connection.getData().protocolVersion >= 20)
sendCollectionChanges(connection);
} finally {
endResponse(connection);
}
} catch (Exception e) {
if (connection != null && connection.getDatabase() != null) {
if (connection.getDatabase().getTransaction().isActive())
connection.getDatabase().rollback(true);
final OSBTreeCollectionManager collectionManager = connection.getDatabase().getSbTreeCollectionManager();
if (collectionManager != null)
collectionManager.clearChangedIds();
}
sendErrorOrDropConnection(connection, clientTxId, e);
}
} catch (OTransactionAbortedException e) {
// TX ABORTED BY THE CLIENT
} catch (Exception e) {
// Error during TX initialization, possibly index constraints violation.
if (tx.isActive())
tx.rollback(true, -1);
sendErrorOrDropConnection(connection, clientTxId, e);
}
}
protected void command(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Execute remote command");
byte type = channel.readByte();
final boolean live = type == 'l';
final boolean asynch = type == 'a';
String dbSerializerName = connection.getDatabase().getSerializer().toString();
String name = getRecordSerializerName(connection);
if (!dbSerializerName.equals(name)) {
ORecordSerializer ser = ORecordSerializerFactory.instance().getFormat(name);
ONetworkThreadLocalSerializer.setNetworkSerializer(ser);
}
OCommandRequestText command = (OCommandRequestText) OStreamSerializerAnyStreamable.INSTANCE.fromStream(channel.readBytes());
ONetworkThreadLocalSerializer.setNetworkSerializer(null);
final Map<Object, Object> params = command.getParameters();
if (asynch && command instanceof OSQLSynchQuery) {
// CONVERT IT IN ASYNCHRONOUS QUERY
final OSQLAsynchQuery asynchQuery = new OSQLAsynchQuery(command.getText());
asynchQuery.setFetchPlan(command.getFetchPlan());
asynchQuery.setLimit(command.getLimit());
asynchQuery.setTimeout(command.getTimeoutTime(), command.getTimeoutStrategy());
asynchQuery.setUseCache(((OSQLSynchQuery) command).isUseCache());
command = asynchQuery;
}
connection.getData().commandDetail = command.getText();
beginResponse();
try {
connection.getData().command = command;
OAbstractCommandResultListener listener = null;
OLiveCommandResultListener liveListener = null;
OCommandResultListener cmdResultListener = command.getResultListener();
if (live) {
liveListener = new OLiveCommandResultListener(server, connection, clientTxId, cmdResultListener);
listener = new OSyncCommandResultListener(null);
command.setResultListener(liveListener);
} else if (asynch) {
// IF COMMAND CACHE IS ENABLED, RESULT MUST BE COLLECTED
final OCommandCache cmdCache = connection.getDatabase().getMetadata().getCommandCache();
if (cmdCache.isEnabled())
// CREATE E COLLECTOR OF RESULT IN RAM TO CACHE THE RESULT
cmdResultListener = new OAbstractCommandResultListener(cmdResultListener) {
private OResultSet collector = new OConcurrentResultSet<ORecord>();
@Override
public boolean isEmpty() {
return collector != null && collector.isEmpty();
}
@Override
public boolean result(final Object iRecord) {
if (collector != null) {
if (collector.currentSize() > cmdCache.getMaxResultsetSize()) {
// TOO MANY RESULTS: STOP COLLECTING IT BECAUSE THEY WOULD NEVER CACHED
collector = null;
} else if (iRecord != null && iRecord instanceof ORecord)
collector.add(iRecord);
}
return true;
}
@Override
public Object getResult() {
return collector;
}
@Override
public void end() {
collector.setCompleted();
}
};
listener = new OAsyncCommandResultListener(connection, this, clientTxId, cmdResultListener);
command.setResultListener(listener);
} else {
listener = new OSyncCommandResultListener(null);
}
final long serverTimeout = OGlobalConfiguration.COMMAND_TIMEOUT.getValueAsLong();
if (serverTimeout > 0 && command.getTimeoutTime() > serverTimeout)
// FORCE THE SERVER'S TIMEOUT
command.setTimeout(serverTimeout, command.getTimeoutStrategy());
if (!isConnectionAlive(connection))
return;
// REQUEST CAN'T MODIFY THE RESULT, SO IT'S CACHEABLE
command.setCacheableResult(true);
// ASSIGNED THE PARSED FETCHPLAN
listener.setFetchPlan(connection.getDatabase().command(command).getFetchPlan());
final Object result;
if (params == null)
result = connection.getDatabase().command(command).execute();
else
result = connection.getDatabase().command(command).execute(params);
// FETCHPLAN HAS TO BE ASSIGNED AGAIN, because it can be changed by SQL statement
listener.setFetchPlan(command.getFetchPlan());
if (asynch) {
// ASYNCHRONOUS
if (listener.isEmpty())
try {
sendOk(connection, clientTxId);
} catch (IOException ignored) {
}
channel.writeByte((byte) 0); // NO MORE RECORDS
} else {
// SYNCHRONOUS
sendOk(connection, clientTxId);
boolean isRecordResultSet = true;
if (command instanceof OCommandRequestInternal)
isRecordResultSet = command.isRecordResultSet();
serializeValue(connection, listener, result, false, isRecordResultSet);
if (listener instanceof OSyncCommandResultListener) {
// SEND FETCHED RECORDS TO LOAD IN CLIENT CACHE
for (ORecord rec : ((OSyncCommandResultListener) listener).getFetchedRecordsToSend()) {
channel.writeByte((byte) 2); // CLIENT CACHE RECORD. IT
// ISN'T PART OF THE
// RESULT SET
writeIdentifiable(connection, rec);
}
channel.writeByte((byte) 0); // NO MORE RECORDS
}
}
} finally {
connection.getData().command = null;
endResponse(connection);
}
}
public void serializeValue(final OClientConnection connection, final OAbstractCommandResultListener listener, Object result,
boolean load, boolean isRecordResultSet) throws IOException {
if (result == null) {
// NULL VALUE
channel.writeByte((byte) 'n');
} else if (result instanceof OIdentifiable) {
// RECORD
channel.writeByte((byte) 'r');
if (load && result instanceof ORecordId)
result = ((ORecordId) result).getRecord();
if (listener != null)
listener.result(result);
writeIdentifiable(connection, (OIdentifiable) result);
} else if (result instanceof ODocumentWrapper) {
// RECORD
channel.writeByte((byte) 'r');
final ODocument doc = ((ODocumentWrapper) result).getDocument();
if (listener != null)
listener.result(doc);
writeIdentifiable(connection, doc);
} else if (!isRecordResultSet) {
writeSimpleValue(connection, listener, result);
} else if (OMultiValue.isMultiValue(result)) {
final byte collectionType = result instanceof Set ? (byte) 's' : (byte) 'l';
channel.writeByte(collectionType);
channel.writeInt(OMultiValue.getSize(result));
for (Object o : OMultiValue.getMultiValueIterable(result, false)) {
try {
if (load && o instanceof ORecordId)
o = ((ORecordId) o).getRecord();
if (listener != null)
listener.result(o);
writeIdentifiable(connection, (OIdentifiable) o);
} catch (Exception e) {
OLogManager.instance().warn(this, "Cannot serialize record: " + o);
// WRITE NULL RECORD TO AVOID BREAKING PROTOCOL
writeIdentifiable(connection, null);
}
}
} else if (OMultiValue.isIterable(result)) {
if (connection.getData().protocolVersion >= OChannelBinaryProtocol.PROTOCOL_VERSION_32) {
channel.writeByte((byte) 'i');
for (Object o : OMultiValue.getMultiValueIterable(result)) {
try {
if (load && o instanceof ORecordId)
o = ((ORecordId) o).getRecord();
if (listener != null)
listener.result(o);
channel.writeByte((byte) 1); // ONE MORE RECORD
writeIdentifiable(connection, (OIdentifiable) o);
} catch (Exception e) {
OLogManager.instance().warn(this, "Cannot serialize record: " + o);
}
}
channel.writeByte((byte) 0); // NO MORE RECORD
} else {
// OLD RELEASES: TRANSFORM IN A COLLECTION
final byte collectionType = result instanceof Set ? (byte) 's' : (byte) 'l';
channel.writeByte(collectionType);
channel.writeInt(OMultiValue.getSize(result));
for (Object o : OMultiValue.getMultiValueIterable(result)) {
try {
if (load && o instanceof ORecordId)
o = ((ORecordId) o).getRecord();
if (listener != null)
listener.result(o);
writeIdentifiable(connection, (OIdentifiable) o);
} catch (Exception e) {
OLogManager.instance().warn(this, "Cannot serialize record: " + o);
}
}
}
} else {
// ANY OTHER (INCLUDING LITERALS)
writeSimpleValue(connection, listener, result);
}
}
private void writeSimpleValue(OClientConnection connection, OAbstractCommandResultListener listener, Object result)
throws IOException {
if (connection.getData().protocolVersion >= OChannelBinaryProtocol.PROTOCOL_VERSION_35) {
channel.writeByte((byte) 'w');
ODocument document = new ODocument();
document.field("result", result);
writeIdentifiable(connection, document);
} else {
channel.writeByte((byte) 'a');
final StringBuilder value = new StringBuilder(64);
if (listener != null)
listener.result(result);
ORecordSerializerStringAbstract.fieldTypeToString(value, OType.getTypeByClass(result.getClass()), result);
channel.writeString(value.toString());
}
}
protected void deleteRecord(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Delete record");
if (!isConnectionAlive(connection))
return;
final ORID rid = channel.readRID();
final int version = channel.readVersion();
final byte mode = channel.readByte();
final int result = deleteRecord(connection.getDatabase(), rid, version);
if (mode < 2) {
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeByte((byte) result);
} finally {
endResponse(connection);
}
}
}
protected void hideRecord(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Hide record");
if (!isConnectionAlive(connection))
return;
final ORID rid = channel.readRID();
final byte mode = channel.readByte();
final int result = hideRecord(connection.getDatabase(), rid);
if (mode < 2) {
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeByte((byte) result);
} finally {
endResponse(connection);
}
}
}
protected void cleanOutRecord(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Clean out record");
if (!isConnectionAlive(connection))
return;
final ORID rid = channel.readRID();
final int version = channel.readVersion();
final byte mode = channel.readByte();
final int result = cleanOutRecord(connection.getDatabase(), rid, version);
if (mode < 2) {
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeByte((byte) result);
} finally {
endResponse(connection);
}
}
}
/**
* VERSION MANAGEMENT:<br>
* -1 : DOCUMENT UPDATE, NO VERSION CONTROL<br>
* -2 : DOCUMENT UPDATE, NO VERSION CONTROL, NO VERSION INCREMENT<br>
* -3 : DOCUMENT ROLLBACK, DECREMENT VERSION<br>
* >-1 : MVCC CONTROL, RECORD UPDATE AND VERSION INCREMENT<br>
* <-3 : WRONG VERSION VALUE
*
* @param connection
* @throws IOException
*/
protected void updateRecord(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Update record");
if (!isConnectionAlive(connection))
return;
final ORecordId rid = channel.readRID();
boolean updateContent = true;
if (connection.getData().protocolVersion >= 23)
updateContent = channel.readBoolean();
final byte[] buffer = channel.readBytes();
final int version = channel.readVersion();
final byte recordType = channel.readByte();
final byte mode = channel.readByte();
final int newVersion = updateRecord(connection, rid, buffer, version, recordType, updateContent);
if (mode < 2) {
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeVersion(newVersion);
if (connection.getData().protocolVersion >= 20)
sendCollectionChanges(connection);
} finally {
endResponse(connection);
}
}
}
protected void createRecord(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Create record");
if (!isConnectionAlive(connection))
return;
final int dataSegmentId = connection.getData().protocolVersion < 24 ? channel.readInt() : 0;
final ORecordId rid = new ORecordId(channel.readShort(), ORID.CLUSTER_POS_INVALID);
final byte[] buffer = channel.readBytes();
final byte recordType = channel.readByte();
final byte mode = channel.readByte();
final ORecord record = createRecord(connection, rid, buffer, recordType);
if (mode < 2) {
beginResponse();
try {
sendOk(connection, clientTxId);
if (connection.getData().protocolVersion > OChannelBinaryProtocol.PROTOCOL_VERSION_25)
channel.writeShort((short) record.getIdentity().getClusterId());
channel.writeLong(record.getIdentity().getClusterPosition());
channel.writeVersion(record.getVersion());
if (connection.getData().protocolVersion >= 20)
sendCollectionChanges(connection);
} finally {
endResponse(connection);
}
}
}
protected void readRecordMetadata(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Record metadata");
final ORID rid = channel.readRID();
beginResponse();
try {
final ORecordMetadata metadata = connection.getDatabase().getRecordMetadata(rid);
if (metadata != null) {
sendOk(connection, clientTxId);
channel.writeRID(metadata.getRecordId());
channel.writeVersion(metadata.getVersion());
} else {
throw new ODatabaseException(String.format("Record metadata for RID: %s, Not found", rid));
}
} finally {
endResponse(connection);
}
}
protected void readRecord(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Load record");
if (!isConnectionAlive(connection))
return;
final ORecordId rid = channel.readRID();
final String fetchPlanString = channel.readString();
boolean ignoreCache = false;
ignoreCache = channel.readByte() == 1;
boolean loadTombstones = false;
loadTombstones = channel.readByte() > 0;
if (rid.clusterId == 0 && rid.clusterPosition == 0) {
// @COMPATIBILITY 0.9.25
// SEND THE DB CONFIGURATION INSTEAD SINCE IT WAS ON RECORD 0:0
OFetchHelper.checkFetchPlanValid(fetchPlanString);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeByte((byte) 1);
if (connection.getData().protocolVersion <= OChannelBinaryProtocol.PROTOCOL_VERSION_27) {
channel
.writeBytes(connection.getDatabase().getStorage().getConfiguration().toStream(connection.getData().protocolVersion));
channel.writeVersion(0);
channel.writeByte(OBlob.RECORD_TYPE);
} else {
channel.writeByte(OBlob.RECORD_TYPE);
channel.writeVersion(0);
channel
.writeBytes(connection.getDatabase().getStorage().getConfiguration().toStream(connection.getData().protocolVersion));
}
channel.writeByte((byte) 0); // NO MORE RECORDS
} finally {
endResponse(connection);
}
} else {
final ORecord record = connection.getDatabase()
.load(rid, fetchPlanString, ignoreCache, loadTombstones, OStorage.LOCKING_STRATEGY.NONE);
beginResponse();
try {
sendOk(connection, clientTxId);
if (record != null) {
channel.writeByte((byte) 1); // HAS RECORD
byte[] bytes = getRecordBytes(connection, record);
int length = trimCsvSerializedContent(connection, bytes);
if (connection.getData().protocolVersion <= OChannelBinaryProtocol.PROTOCOL_VERSION_27) {
channel.writeBytes(bytes, length);
channel.writeVersion(record.getVersion());
channel.writeByte(ORecordInternal.getRecordType(record));
} else {
channel.writeByte(ORecordInternal.getRecordType(record));
channel.writeVersion(record.getVersion());
channel.writeBytes(bytes, length);
}
if (fetchPlanString.length() > 0) {
// BUILD THE SERVER SIDE RECORD TO ACCES TO THE FETCH
// PLAN
if (record instanceof ODocument) {
final OFetchPlan fetchPlan = OFetchHelper.buildFetchPlan(fetchPlanString);
final Set<ORecord> recordsToSend = new HashSet<ORecord>();
final ODocument doc = (ODocument) record;
final OFetchListener listener = new ORemoteFetchListener() {
@Override
protected void sendRecord(ORecord iLinked) {
recordsToSend.add(iLinked);
}
};
final OFetchContext context = new ORemoteFetchContext();
OFetchHelper.fetch(doc, doc, fetchPlan, listener, context, "");
// SEND RECORDS TO LOAD IN CLIENT CACHE
for (ORecord d : recordsToSend) {
if (d.getIdentity().isValid()) {
channel.writeByte((byte) 2); // CLIENT CACHE
// RECORD. IT ISN'T PART OF THE RESULT SET
writeIdentifiable(connection, d);
}
}
}
}
}
channel.writeByte((byte) 0); // NO MORE RECORDS
} finally {
endResponse(connection);
}
}
}
protected void readRecordIfVersionIsNotLatest(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Load record if version is not latest");
if (!isConnectionAlive(connection))
return;
final ORecordId rid = channel.readRID();
final int recordVersion = channel.readVersion();
final String fetchPlanString = channel.readString();
boolean ignoreCache = channel.readByte() == 1;
if (rid.clusterId == 0 && rid.clusterPosition == 0) {
// @COMPATIBILITY 0.9.25
// SEND THE DB CONFIGURATION INSTEAD SINCE IT WAS ON RECORD 0:0
OFetchHelper.checkFetchPlanValid(fetchPlanString);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeByte((byte) 1);
if (connection.getData().protocolVersion <= OChannelBinaryProtocol.PROTOCOL_VERSION_27) {
channel
.writeBytes(connection.getDatabase().getStorage().getConfiguration().toStream(connection.getData().protocolVersion));
channel.writeVersion(0);
channel.writeByte(OBlob.RECORD_TYPE);
} else {
channel.writeByte(OBlob.RECORD_TYPE);
channel.writeVersion(0);
channel
.writeBytes(connection.getDatabase().getStorage().getConfiguration().toStream(connection.getData().protocolVersion));
}
channel.writeByte((byte) 0); // NO MORE RECORDS
} finally {
endResponse(connection);
}
} else {
final ORecord record = connection.getDatabase().loadIfVersionIsNotLatest(rid, recordVersion, fetchPlanString, ignoreCache);
beginResponse();
try {
sendOk(connection, clientTxId);
if (record != null) {
channel.writeByte((byte) 1); // HAS RECORD
byte[] bytes = getRecordBytes(connection, record);
int length = trimCsvSerializedContent(connection, bytes);
channel.writeByte(ORecordInternal.getRecordType(record));
channel.writeVersion(record.getVersion());
channel.writeBytes(bytes, length);
if (fetchPlanString.length() > 0) {
// BUILD THE SERVER SIDE RECORD TO ACCES TO THE FETCH
// PLAN
if (record instanceof ODocument) {
final OFetchPlan fetchPlan = OFetchHelper.buildFetchPlan(fetchPlanString);
final Set<ORecord> recordsToSend = new HashSet<ORecord>();
final ODocument doc = (ODocument) record;
final OFetchListener listener = new ORemoteFetchListener() {
@Override
protected void sendRecord(ORecord iLinked) {
recordsToSend.add(iLinked);
}
};
final OFetchContext context = new ORemoteFetchContext();
OFetchHelper.fetch(doc, doc, fetchPlan, listener, context, "");
// SEND RECORDS TO LOAD IN CLIENT CACHE
for (ORecord d : recordsToSend) {
if (d.getIdentity().isValid()) {
channel.writeByte((byte) 2); // CLIENT CACHE
// RECORD. IT ISN'T PART OF THE RESULT SET
writeIdentifiable(connection, d);
}
}
}
}
}
channel.writeByte((byte) 0); // NO MORE RECORDS
} finally {
endResponse(connection);
}
}
}
protected void beginResponse() {
channel.acquireWriteLock();
}
protected void endResponse(OClientConnection connection) throws IOException {
// resetting transaction state. Commands are stateless and connection should be cleared
// otherwise reused connection (connections pool) may lead to unpredicted errors
if (connection != null && connection.getDatabase() != null
&& connection.getDatabase().activateOnCurrentThread().getTransaction() != null) {
connection.getDatabase().activateOnCurrentThread();
connection.getDatabase().getTransaction().rollback();
}
channel.flush();
channel.releaseWriteLock();
}
protected void setDataCommandInfo(OClientConnection connection, final String iCommandInfo) {
if (connection != null)
connection.getData().commandInfo = iCommandInfo;
}
protected void readConnectionData(OClientConnection connection) throws IOException {
connection.getData().driverName = channel.readString();
connection.getData().driverVersion = channel.readString();
connection.getData().protocolVersion = channel.readShort();
connection.getData().clientId = channel.readString();
if (connection.getData().protocolVersion > OChannelBinaryProtocol.PROTOCOL_VERSION_21)
connection.getData().serializationImpl = channel.readString();
else
connection.getData().serializationImpl = ORecordSerializerSchemaAware2CSV.NAME;
if (connection.getTokenBased() == null) {
if (connection.getData().protocolVersion > OChannelBinaryProtocol.PROTOCOL_VERSION_26)
connection.setTokenBased(channel.readBoolean());
else
connection.setTokenBased(false);
} else {
if (connection.getData().protocolVersion > OChannelBinaryProtocol.PROTOCOL_VERSION_26)
if (channel.readBoolean() != connection.getTokenBased()) {
// throw new OException("Not supported mixed connection managment");
}
}
if (connection.getData().protocolVersion > OChannelBinaryProtocol.PROTOCOL_VERSION_33) {
connection.getData().supportsPushMessages = channel.readBoolean();
connection.getData().collectStats = channel.readBoolean();
} else {
connection.getData().supportsPushMessages = true;
connection.getData().collectStats = true;
}
}
protected void sendOk(OClientConnection connection, final int iClientTxId) throws IOException {
channel.writeByte(OChannelBinaryProtocol.RESPONSE_STATUS_OK);
channel.writeInt(iClientTxId);
okSent = true;
if (connection != null && Boolean.TRUE.equals(connection.getTokenBased()) && connection.getToken() != null
&& requestType != OChannelBinaryProtocol.REQUEST_CONNECT && requestType != OChannelBinaryProtocol.REQUEST_DB_OPEN) {
// TODO: Check if the token is expiring and if it is send a new token
byte[] renewedToken = server.getTokenHandler().renewIfNeeded(connection.getToken());
channel.writeBytes(renewedToken);
}
}
protected void handleConnectionError(OClientConnection connection, final Throwable e) {
try {
channel.flush();
} catch (IOException e1) {
OLogManager.instance().debug(this, "Error during channel flush", e1);
}
OLogManager.instance().error(this, "Error executing request", e);
OServerPluginHelper.invokeHandlerCallbackOnClientError(server, connection, e);
}
protected void sendResponse(OClientConnection connection, final ODocument iResponse) throws IOException {
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeBytes(iResponse != null ? iResponse.toStream() : null);
} finally {
endResponse(connection);
}
}
protected void freezeDatabase(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Freeze database");
String dbName = channel.readString();
checkServerAccess("database.freeze", connection);
String storageType = null;
storageType = channel.readString();
if (storageType == null)
storageType = "plocal";
connection.setDatabase(getDatabaseInstance(dbName, ODatabaseDocument.TYPE, storageType));
if (connection.getDatabase().exists()) {
OLogManager.instance().info(this, "Freezing database '%s'", connection.getDatabase().getURL());
if (connection.getDatabase().isClosed())
server.openDatabaseBypassingSecurity(connection.getDatabase(), connection.getData(), connection.getServerUser().name);
connection.getDatabase().freeze(true);
} else {
throw new OStorageException("Database with name '" + dbName + "' does not exist");
}
beginResponse();
try {
sendOk(connection, clientTxId);
} finally {
endResponse(connection);
}
}
protected void releaseDatabase(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Release database");
String dbName = channel.readString();
checkServerAccess("database.release", connection);
String storageType = null;
storageType = channel.readString();
if (storageType == null)
storageType = "plocal";
connection.setDatabase(getDatabaseInstance(dbName, ODatabaseDocument.TYPE, storageType));
if (connection.getDatabase().exists()) {
OLogManager.instance().info(this, "Realising database '%s'", connection.getDatabase().getURL());
if (connection.getDatabase().isClosed())
server.openDatabaseBypassingSecurity(connection.getDatabase(), connection.getData(), connection.getServerUser().name);
connection.getDatabase().release();
} else {
throw new OStorageException("Database with name '" + dbName + "' does not exist");
}
beginResponse();
try {
sendOk(connection, clientTxId);
} finally {
endResponse(connection);
}
}
public String getRecordSerializerName(OClientConnection connection) {
return connection.getData().serializationImpl;
}
private void sendErrorDetails(Throwable current) throws IOException {
while (current != null) {
// MORE DETAILS ARE COMING AS EXCEPTION
channel.writeByte((byte) 1);
channel.writeString(current.getClass().getName());
channel.writeString(current.getMessage());
current = current.getCause();
}
channel.writeByte((byte) 0);
}
private void serializeExceptionObject(Throwable original) throws IOException {
try {
final ODistributedServerManager srvMgr = server.getDistributedManager();
if (srvMgr != null)
original = srvMgr.convertException(original);
final OMemoryStream memoryStream = new OMemoryStream();
final ObjectOutputStream objectOutputStream = new ObjectOutputStream(memoryStream);
objectOutputStream.writeObject(original);
objectOutputStream.flush();
final byte[] result = memoryStream.toByteArray();
objectOutputStream.close();
channel.writeBytes(result);
} catch (Exception e) {
OLogManager.instance().warn(this, "Cannot serialize an exception object", e);
// Write empty stream for binary compatibility
channel.writeBytes(OCommonConst.EMPTY_BYTE_ARRAY);
}
}
/**
* Due to protocol thread is daemon, shutdown should be executed in separate thread to guarantee its complete execution.
* <p/>
* This method never returns normally.
*/
private void runShutdownInNonDaemonThread() {
Thread shutdownThread = new Thread("OrientDB server shutdown thread") {
public void run() {
server.shutdown();
ShutdownHelper.shutdown(1);
}
};
shutdownThread.setDaemon(false);
shutdownThread.start();
try {
shutdownThread.join();
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
}
}
private void ridBagSize(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "RidBag get size");
OBonsaiCollectionPointer collectionPointer = OCollectionNetworkSerializer.INSTANCE.readCollectionPointer(channel);
final byte[] changeStream = channel.readBytes();
final OSBTreeCollectionManager sbTreeCollectionManager = connection.getDatabase().getSbTreeCollectionManager();
final OSBTreeBonsai<OIdentifiable, Integer> tree = sbTreeCollectionManager.loadSBTree(collectionPointer);
try {
final Map<OIdentifiable, OSBTreeRidBag.Change> changes = OSBTreeRidBag.ChangeSerializationHelper.INSTANCE
.deserializeChanges(changeStream, 0);
int realSize = tree.getRealBagSize(changes);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeInt(realSize);
} finally {
endResponse(connection);
}
} finally {
sbTreeCollectionManager.releaseSBTree(collectionPointer);
}
}
private void sbTreeBonsaiGetEntriesMajor(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "SB-Tree bonsai get values major");
OBonsaiCollectionPointer collectionPointer = OCollectionNetworkSerializer.INSTANCE.readCollectionPointer(channel);
byte[] keyStream = channel.readBytes();
boolean inclusive = channel.readBoolean();
int pageSize = 128;
if (connection.getData().protocolVersion >= 21)
pageSize = channel.readInt();
final OSBTreeCollectionManager sbTreeCollectionManager = connection.getDatabase().getSbTreeCollectionManager();
final OSBTreeBonsai<OIdentifiable, Integer> tree = sbTreeCollectionManager.loadSBTree(collectionPointer);
try {
final OBinarySerializer<OIdentifiable> keySerializer = tree.getKeySerializer();
OIdentifiable key = keySerializer.deserialize(keyStream, 0);
final OBinarySerializer<Integer> valueSerializer = tree.getValueSerializer();
OTreeInternal.AccumulativeListener<OIdentifiable, Integer> listener = new OTreeInternal.AccumulativeListener<OIdentifiable, Integer>(
pageSize);
tree.loadEntriesMajor(key, inclusive, true, listener);
List<Entry<OIdentifiable, Integer>> result = listener.getResult();
byte[] stream = serializeSBTreeEntryCollection(result, keySerializer, valueSerializer);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeBytes(stream);
} finally {
endResponse(connection);
}
} finally {
sbTreeCollectionManager.releaseSBTree(collectionPointer);
}
}
private byte[] serializeSBTreeEntryCollection(List<Entry<OIdentifiable, Integer>> collection,
OBinarySerializer<OIdentifiable> keySerializer, OBinarySerializer<Integer> valueSerializer) {
byte[] stream = new byte[OIntegerSerializer.INT_SIZE + collection.size() * (keySerializer.getFixedLength() + valueSerializer
.getFixedLength())];
int offset = 0;
OIntegerSerializer.INSTANCE.serializeLiteral(collection.size(), stream, offset);
offset += OIntegerSerializer.INT_SIZE;
for (Entry<OIdentifiable, Integer> entry : collection) {
keySerializer.serialize(entry.getKey(), stream, offset);
offset += keySerializer.getObjectSize(entry.getKey());
valueSerializer.serialize(entry.getValue(), stream, offset);
offset += valueSerializer.getObjectSize(entry.getValue());
}
return stream;
}
private void sbTreeBonsaiFirstKey(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "SB-Tree bonsai get first key");
OBonsaiCollectionPointer collectionPointer = OCollectionNetworkSerializer.INSTANCE.readCollectionPointer(channel);
final OSBTreeCollectionManager sbTreeCollectionManager = connection.getDatabase().getSbTreeCollectionManager();
final OSBTreeBonsai<OIdentifiable, Integer> tree = sbTreeCollectionManager.loadSBTree(collectionPointer);
try {
OIdentifiable result = tree.firstKey();
final OBinarySerializer<? super OIdentifiable> keySerializer;
if (result == null) {
keySerializer = ONullSerializer.INSTANCE;
} else {
keySerializer = tree.getKeySerializer();
}
byte[] stream = new byte[OByteSerializer.BYTE_SIZE + keySerializer.getObjectSize(result)];
OByteSerializer.INSTANCE.serialize(keySerializer.getId(), stream, 0);
keySerializer.serialize(result, stream, OByteSerializer.BYTE_SIZE);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeBytes(stream);
} finally {
endResponse(connection);
}
} finally {
sbTreeCollectionManager.releaseSBTree(collectionPointer);
}
}
private void sbTreeBonsaiGet(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "SB-Tree bonsai get");
OBonsaiCollectionPointer collectionPointer = OCollectionNetworkSerializer.INSTANCE.readCollectionPointer(channel);
final byte[] keyStream = channel.readBytes();
final OSBTreeCollectionManager sbTreeCollectionManager = connection.getDatabase().getSbTreeCollectionManager();
final OSBTreeBonsai<OIdentifiable, Integer> tree = sbTreeCollectionManager.loadSBTree(collectionPointer);
try {
final OIdentifiable key = tree.getKeySerializer().deserialize(keyStream, 0);
Integer result = tree.get(key);
final OBinarySerializer<? super Integer> valueSerializer;
if (result == null) {
valueSerializer = ONullSerializer.INSTANCE;
} else {
valueSerializer = tree.getValueSerializer();
}
byte[] stream = new byte[OByteSerializer.BYTE_SIZE + valueSerializer.getObjectSize(result)];
OByteSerializer.INSTANCE.serialize(valueSerializer.getId(), stream, 0);
valueSerializer.serialize(result, stream, OByteSerializer.BYTE_SIZE);
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeBytes(stream);
} finally {
endResponse(connection);
}
} finally {
sbTreeCollectionManager.releaseSBTree(collectionPointer);
}
}
private void createSBTreeBonsai(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Create SB-Tree bonsai instance");
int clusterId = channel.readInt();
OBonsaiCollectionPointer collectionPointer = connection.getDatabase().getSbTreeCollectionManager()
.createSBTree(clusterId, null);
beginResponse();
try {
sendOk(connection, clientTxId);
OCollectionNetworkSerializer.INSTANCE.writeCollectionPointer(channel, collectionPointer);
} finally {
endResponse(connection);
}
}
private void lowerPositions(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Retrieve lower positions");
final int clusterId = channel.readInt();
final long clusterPosition = channel.readLong();
beginResponse();
try {
sendOk(connection, clientTxId);
final OPhysicalPosition[] previousPositions = connection.getDatabase().getStorage()
.lowerPhysicalPositions(clusterId, new OPhysicalPosition(clusterPosition));
if (previousPositions != null) {
channel.writeInt(previousPositions.length);
for (final OPhysicalPosition physicalPosition : previousPositions) {
channel.writeLong(physicalPosition.clusterPosition);
channel.writeInt(physicalPosition.recordSize);
channel.writeVersion(physicalPosition.recordVersion);
}
} else {
channel.writeInt(0); // NO MORE RECORDS
}
} finally {
endResponse(connection);
}
}
private void floorPositions(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Retrieve floor positions");
final int clusterId = channel.readInt();
final long clusterPosition = channel.readLong();
beginResponse();
try {
sendOk(connection, clientTxId);
final OPhysicalPosition[] previousPositions = connection.getDatabase().getStorage()
.floorPhysicalPositions(clusterId, new OPhysicalPosition(clusterPosition));
if (previousPositions != null) {
channel.writeInt(previousPositions.length);
for (final OPhysicalPosition physicalPosition : previousPositions) {
channel.writeLong(physicalPosition.clusterPosition);
channel.writeInt(physicalPosition.recordSize);
channel.writeVersion(physicalPosition.recordVersion);
}
} else {
channel.writeInt(0); // NO MORE RECORDS
}
} finally {
endResponse(connection);
}
}
private void higherPositions(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Retrieve higher positions");
final int clusterId = channel.readInt();
final long clusterPosition = channel.readLong();
beginResponse();
try {
sendOk(connection, clientTxId);
OPhysicalPosition[] nextPositions = connection.getDatabase().getStorage()
.higherPhysicalPositions(clusterId, new OPhysicalPosition(clusterPosition));
if (nextPositions != null) {
channel.writeInt(nextPositions.length);
for (final OPhysicalPosition physicalPosition : nextPositions) {
channel.writeLong(physicalPosition.clusterPosition);
channel.writeInt(physicalPosition.recordSize);
channel.writeVersion(physicalPosition.recordVersion);
}
} else {
channel.writeInt(0); // NO MORE RECORDS
}
} finally {
endResponse(connection);
}
}
private void ceilingPositions(OClientConnection connection) throws IOException {
setDataCommandInfo(connection, "Retrieve ceiling positions");
final int clusterId = channel.readInt();
final long clusterPosition = channel.readLong();
beginResponse();
try {
sendOk(connection, clientTxId);
final OPhysicalPosition[] previousPositions = connection.getDatabase().getStorage()
.ceilingPhysicalPositions(clusterId, new OPhysicalPosition(clusterPosition));
if (previousPositions != null) {
channel.writeInt(previousPositions.length);
for (final OPhysicalPosition physicalPosition : previousPositions) {
channel.writeLong(physicalPosition.clusterPosition);
channel.writeInt(physicalPosition.recordSize);
channel.writeVersion(physicalPosition.recordVersion);
}
} else {
channel.writeInt(0); // NO MORE RECORDS
}
} finally {
endResponse(connection);
}
}
private boolean isConnectionAlive(OClientConnection connection) {
if (connection == null || connection.getDatabase() == null) {
// CONNECTION/DATABASE CLOSED, KILL IT
server.getClientConnectionManager().kill(connection);
return false;
}
return true;
}
private void sendCollectionChanges(OClientConnection connection) throws IOException {
OSBTreeCollectionManager collectionManager = connection.getDatabase().getSbTreeCollectionManager();
if (collectionManager != null) {
Map<UUID, OBonsaiCollectionPointer> changedIds = collectionManager.changedIds();
channel.writeInt(changedIds.size());
for (Entry<UUID, OBonsaiCollectionPointer> entry : changedIds.entrySet()) {
UUID id = entry.getKey();
channel.writeLong(id.getMostSignificantBits());
channel.writeLong(id.getLeastSignificantBits());
OCollectionNetworkSerializer.INSTANCE.writeCollectionPointer(channel, entry.getValue());
}
collectionManager.clearChangedIds();
}
}
private void sendDatabaseInformation(OClientConnection connection) throws IOException {
final Collection<? extends OCluster> clusters = connection.getDatabase().getStorage().getClusterInstances();
int clusterCount = 0;
for (OCluster c : clusters) {
if (c != null) {
++clusterCount;
}
}
channel.writeShort((short) clusterCount);
for (OCluster c : clusters) {
if (c != null) {
channel.writeString(c.getName());
channel.writeShort((short) c.getId());
if (connection.getData().protocolVersion < 24) {
channel.writeString("none");
channel.writeShort((short) -1);
}
}
}
}
private void listDatabases(OClientConnection connection) throws IOException {
checkServerAccess("server.dblist", connection);
final ODocument result = new ODocument();
result.field("databases", server.getAvailableStorageNames());
setDataCommandInfo(connection, "List databases");
beginResponse();
try {
sendOk(connection, clientTxId);
byte[] stream = getRecordBytes(connection, result);
channel.writeBytes(stream);
} finally {
endResponse(connection);
}
}
private void serverInfo(OClientConnection connection) throws IOException {
checkServerAccess("server.info", connection);
setDataCommandInfo(connection, "Server Info");
beginResponse();
try {
sendOk(connection, clientTxId);
channel.writeString(OServerInfo.getServerInfo(server));
} finally {
endResponse(connection);
}
}
private boolean loadUserFromSchema(OClientConnection connection, final String iUserName, final String iUserPassword) {
connection.getDatabase().getMetadata().getSecurity().authenticate(iUserName, iUserPassword);
return true;
}
@Override
public int getVersion() {
return OChannelBinaryProtocol.CURRENT_PROTOCOL_VERSION;
}
@Override
public OChannelBinary getChannel() {
return channel;
}
/**
* Write a OIdentifiable instance using this format:<br>
* - 2 bytes: class id [-2=no record, -3=rid, -1=no class id, > -1 = valid] <br>
* - 1 byte: record type [d,b,f] <br>
* - 2 bytes: cluster id <br>
* - 8 bytes: position in cluster <br>
* - 4 bytes: record version <br>
* - x bytes: record content <br>
*
* @param connection
* @param o
* @throws IOException
*/
public void writeIdentifiable(OClientConnection connection, final OIdentifiable o) throws IOException {
if (o == null)
channel.writeShort(OChannelBinaryProtocol.RECORD_NULL);
else if (o instanceof ORecordId) {
channel.writeShort(OChannelBinaryProtocol.RECORD_RID);
channel.writeRID((ORID) o);
} else {
writeRecord(connection, o.getRecord());
}
}
public String getType() {
return "binary";
}
public void fillRecord(OClientConnection connection, final ORecordId rid, final byte[] buffer, final int version,
final ORecord record) {
String dbSerializerName = "";
if (connection.getDatabase() != null)
dbSerializerName = connection.getDatabase().getSerializer().toString();
String name = getRecordSerializerName(connection);
if (ORecordInternal.getRecordType(record) == ODocument.RECORD_TYPE && !dbSerializerName.equals(name)) {
ORecordInternal.fill(record, rid, version, null, true);
ORecordSerializer ser = ORecordSerializerFactory.instance().getFormat(name);
ser.fromStream(buffer, record, null);
record.setDirty();
} else
ORecordInternal.fill(record, rid, version, buffer, true);
}
protected void sendErrorOrDropConnection(OClientConnection connection, final int iClientTxId, final Throwable t)
throws IOException {
if (okSent || requestType == OChannelBinaryProtocol.REQUEST_DB_CLOSE) {
handleConnectionError(connection, t);
sendShutdown();
} else {
okSent = true;
sendError(connection, iClientTxId, t);
}
}
protected void checkStorageExistence(final String iDatabaseName) {
for (OStorage stg : Orient.instance().getStorages()) {
if (!(stg instanceof OStorageProxy) && stg.getName().equalsIgnoreCase(iDatabaseName) && stg.exists())
throw new ODatabaseException("Database named '" + iDatabaseName + "' already exists: " + stg);
}
}
protected ODatabaseDocumentInternal createDatabase(final ODatabaseDocumentInternal iDatabase, String dbUser, final String dbPasswd,
final String backupPath) {
if (iDatabase.exists())
throw new ODatabaseException("Database '" + iDatabase.getURL() + "' already exists");
if (backupPath == null)
iDatabase.create();
else
iDatabase.create(backupPath);
if (dbUser != null) {
OUser oUser = iDatabase.getMetadata().getSecurity().getUser(dbUser);
if (oUser == null) {
iDatabase.getMetadata().getSecurity().createUser(dbUser, dbPasswd, new String[] { ORole.ADMIN });
} else {
oUser.setPassword(dbPasswd);
oUser.save();
}
}
OLogManager.instance().info(this, "Created database '%s' of type '%s'", iDatabase.getName(),
iDatabase.getStorage().getUnderlying() instanceof OAbstractPaginatedStorage ?
iDatabase.getStorage().getUnderlying().getType() :
"memory");
// if (iDatabase.getStorage() instanceof OStorageLocal)
// // CLOSE IT BECAUSE IT WILL BE OPEN AT FIRST USE
// iDatabase.close();
return iDatabase;
}
/**
* Returns a database instance giving the database name, the database type and storage type.
*
* @param dbName
* @param dbType
* @param storageType Storage type between "plocal" or "memory".
* @return
*/
protected ODatabaseDocumentInternal getDatabaseInstance(final String dbName, final String dbType, final String storageType) {
String path;
final OStorage stg = Orient.instance().getStorage(dbName);
if (stg != null)
path = stg.getURL();
else if (storageType.equals(OEngineLocalPaginated.NAME)) {
// if this storage was configured return always path from config file, otherwise return default path
path = server.getConfiguration().getStoragePath(dbName);
if (path == null)
path = storageType + ":" + server.getDatabaseDirectory() + "/" + dbName;
} else if (storageType.equals(OEngineMemory.NAME)) {
path = storageType + ":" + dbName;
} else
throw new IllegalArgumentException("Cannot create database: storage mode '" + storageType + "' is not supported.");
return new ODatabaseDocumentTx(path);
}
protected int deleteRecord(final ODatabaseDocument iDatabase, final ORID rid, final int version) {
try {
// TRY TO SEE IF THE RECORD EXISTS
final ORecord record = rid.getRecord();
if (record == null)
return 0;
iDatabase.delete(rid, version);
return 1;
} catch (ORecordNotFoundException e) {
// MAINTAIN COHERENT THE BEHAVIOR FOR ALL THE STORAGE TYPES
if (e.getCause() instanceof OOfflineClusterException)
throw (OOfflineClusterException) e.getCause();
} catch (OOfflineClusterException e) {
throw e;
} catch (Exception e) {
// IGNORE IT
}
return 0;
}
protected int hideRecord(final ODatabaseDocument iDatabase, final ORID rid) {
try {
iDatabase.hide(rid);
return 1;
} catch (ORecordNotFoundException e) {
return 0;
}
}
protected int cleanOutRecord(final ODatabaseDocument iDatabase, final ORID rid, final int version) {
iDatabase.delete(rid, version);
return 1;
}
protected ORecord createRecord(OClientConnection connection, final ORecordId rid, final byte[] buffer, final byte recordType) {
final ORecord record = Orient.instance().getRecordFactoryManager().newInstance(recordType);
fillRecord(connection, rid, buffer, 0, record);
connection.getDatabase().save(record);
return record;
}
protected int updateRecord(OClientConnection connection, final ORecordId rid, final byte[] buffer, final int version,
final byte recordType, boolean updateContent) {
ODatabaseDocumentInternal database = connection.getDatabase();
final ORecord newRecord = Orient.instance().getRecordFactoryManager().newInstance(recordType);
fillRecord(connection, rid, buffer, version, newRecord);
ORecordInternal.setContentChanged(newRecord, updateContent);
ORecordInternal.getDirtyManager(newRecord).clearForSave();
ORecord currentRecord = null;
if (newRecord instanceof ODocument) {
try {
currentRecord = database.load(rid);
} catch (ORecordNotFoundException e) {
// MAINTAIN COHERENT THE BEHAVIOR FOR ALL THE STORAGE TYPES
if (e.getCause() instanceof OOfflineClusterException)
throw (OOfflineClusterException) e.getCause();
}
if (currentRecord == null)
throw new ORecordNotFoundException(rid);
((ODocument) currentRecord).merge((ODocument) newRecord, false, false);
} else
currentRecord = newRecord;
ORecordInternal.setVersion(currentRecord, version);
database.save(currentRecord);
if (currentRecord.getIdentity().toString().equals(database.getStorage().getConfiguration().indexMgrRecordId) && !database
.getStatus().equals(ODatabase.STATUS.IMPORTING)) {
// FORCE INDEX MANAGER UPDATE. THIS HAPPENS FOR DIRECT CHANGES FROM REMOTE LIKE IN GRAPH
database.getMetadata().getIndexManager().reload();
}
return currentRecord.getVersion();
}
public byte[] getRecordBytes(OClientConnection connection, final ORecord iRecord) {
final byte[] stream;
String dbSerializerName = null;
if (ODatabaseRecordThreadLocal.INSTANCE.getIfDefined() != null)
dbSerializerName = ((ODatabaseDocumentInternal) iRecord.getDatabase()).getSerializer().toString();
String name = getRecordSerializerName(connection);
if (ORecordInternal.getRecordType(iRecord) == ODocument.RECORD_TYPE && (dbSerializerName == null || !dbSerializerName
.equals(name))) {
((ODocument) iRecord).deserializeFields();
ORecordSerializer ser = ORecordSerializerFactory.instance().getFormat(name);
stream = ser.toStream(iRecord, false);
} else
stream = iRecord.toStream();
return stream;
}
private void writeRecord(OClientConnection connection, final ORecord iRecord) throws IOException {
channel.writeShort((short) 0);
channel.writeByte(ORecordInternal.getRecordType(iRecord));
channel.writeRID(iRecord.getIdentity());
channel.writeVersion(iRecord.getVersion());
try {
final byte[] stream = getRecordBytes(connection, iRecord);
// TODO: This Logic should not be here provide an api in the Serializer if asked for trimmed content.
int realLength = trimCsvSerializedContent(connection, stream);
channel.writeBytes(stream, realLength);
} catch (Exception e) {
channel.writeBytes(null);
final String message = "Error on unmarshalling record " + iRecord.getIdentity().toString() + " (" + e + ")";
OLogManager.instance().error(this, message, e);
throw OException.wrapException(new OSerializationException(message), e);
}
}
protected int trimCsvSerializedContent(OClientConnection connection, final byte[] stream) {
int realLength = stream.length;
final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined();
if (db != null && db instanceof ODatabaseDocument) {
if (ORecordSerializerSchemaAware2CSV.NAME.equals(getRecordSerializerName(connection))) {
// TRIM TAILING SPACES (DUE TO OVERSIZE)
for (int i = stream.length - 1; i > -1; --i) {
if (stream[i] == 32)
--realLength;
else
break;
}
}
}
return realLength;
}
public int getRequestType() {
return requestType;
}
public String getRemoteAddress() {
final Socket socket = getChannel().socket;
if (socket != null) {
final InetSocketAddress remoteAddress = (InetSocketAddress) socket.getRemoteSocketAddress();
return remoteAddress.getAddress().getHostAddress() + ":" + remoteAddress.getPort();
}
return null;
}
}
|
[
"[email protected]"
] | |
55eda33a1fb23bb6cc9fa0ccb564ffd509bd7e54
|
48ade0965b63dcf50ca907c0ad777554d075858a
|
/cas-demo/my-cas-client/src/main/java/lwj/demo/cas/CasClientBootApplication.java
|
71260fa03442941154440b443ba18981879784bc
|
[] |
no_license
|
lwj984/fengying
|
12f63d0ff9b090d77efa8849e5e1626a089e2891
|
9443b66f17335570f9003c511ba0265b1c6501ac
|
refs/heads/master
| 2023-07-10T16:37:40.081066 | 2021-08-24T06:38:10 | 2021-08-24T06:38:10 | 299,156,339 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,341 |
java
|
package lwj.demo.cas;
import org.jasig.cas.client.session.SingleSignOutFilter;
import org.jasig.cas.client.session.SingleSignOutHttpSessionListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import net.unicon.cas.client.configuration.CasClientConfigurerAdapter;
import net.unicon.cas.client.configuration.EnableCasClient;
@SpringBootApplication
@EnableCasClient
public class CasClientBootApplication extends CasClientConfigurerAdapter {
public static void main(String[] args) {
SpringApplication.run(CasClientBootApplication.class, args);
}
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> registration = new ServletListenerRegistrationBean<SingleSignOutHttpSessionListener>(
new SingleSignOutHttpSessionListener());
registration.setOrder(1);
return registration;
}
@Bean
public FilterRegistrationBean singleSignOutFilter() {
FilterRegistrationBean registration = new FilterRegistrationBean(new SingleSignOutFilter());
registration.addUrlPatterns("/*");
registration.addInitParameter("casServerUrlPrefix", "http://192.168.89.69:8090");
registration.setName("Single Sign Out Filter");
registration.setOrder(2);
return registration;
}
@Override
public void configureAuthenticationFilter(FilterRegistrationBean authenticationFilter) {
authenticationFilter.setOrder(3);
}
@Override
public void configureValidationFilter(FilterRegistrationBean validationFilter) {
validationFilter.setOrder(4);
}
@Override
public void configureHttpServletRequestWrapperFilter(FilterRegistrationBean httpServletRequestWrapperFilter) {
httpServletRequestWrapperFilter.setOrder(5);
}
@Override
public void configureAssertionThreadLocalFilter(FilterRegistrationBean assertionThreadLocalFilter) {
assertionThreadLocalFilter.setOrder(6);
}
}
|
[
"[email protected]"
] | |
bfd47091f18acbc056442c5da28eb24b86b7e025
|
2342a26ec391290bff5f47036d3e8f2b9a7e13c7
|
/activiti-services/activiti-services-query/activiti-services-query-repo/src/test/java/org/activiti/services/query/app/repository/EntityFinderTest.java
|
e7f26a14741a04551fa4462190e367777405eeb7
|
[
"Apache-2.0"
] |
permissive
|
doris2013/Activiti
|
b8b99ad6c5e9cba4ce6dccb7b63139553beb7230
|
491b7ab00edfdd65b563437e32f25b70ef68d7a9
|
refs/heads/master
| 2021-07-12T16:34:22.847836 | 2017-10-11T16:17:39 | 2017-10-11T16:17:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,779 |
java
|
/*
* Copyright 2017 Alfresco, Inc. and/or its affiliates.
*
* 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.activiti.services.query.app.repository;
import java.util.Optional;
import com.querydsl.core.types.Predicate;
import org.activiti.engine.ActivitiException;
import org.activiti.services.query.model.ProcessInstance;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.*;
import static org.mockito.MockitoAnnotations.initMocks;
public class EntityFinderTest {
@InjectMocks
private EntityFinder entityFinder;
@Mock
private ProcessInstanceRepository repository;
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Before
public void setUp() throws Exception {
initMocks(this);
}
@Test
public void findByIdShouldReturnResultWhenIsPresent() throws Exception {
//given
String processInstanceId = "5";
ProcessInstance processInstance = mock(ProcessInstance.class);
given(repository.findById(processInstanceId)).willReturn(Optional.of(processInstance));
//when
ProcessInstance retrieveProcessInstance = entityFinder.findById(repository,
processInstanceId,
"error");
//then
assertThat(retrieveProcessInstance).isEqualTo(processInstance);
}
@Test
public void findByIdShouldThrowExceptionWhenNotPresent() throws Exception {
//given
String processInstanceId = "5";
given(repository.findById(processInstanceId)).willReturn(Optional.empty());
//then
expectedException.expect(ActivitiException.class);
expectedException.expectMessage("Error");
//when
entityFinder.findById(repository, processInstanceId, "Error");
}
@Test
public void findOneShouldReturnResultWhenIsPresent() throws Exception {
//given
Predicate predicate = mock(Predicate.class);
ProcessInstance processInstance = mock(ProcessInstance.class);
given(repository.findOne(predicate)).willReturn(Optional.of(processInstance));
//when
ProcessInstance retrievedProcessInstance = entityFinder.findOne(repository,
predicate,
"error");
//then
assertThat(retrievedProcessInstance).isEqualTo(processInstance);
}
@Test
public void findOneShouldThrowExceptionWhenNotPresent() throws Exception {
//given
Predicate predicate = mock(Predicate.class);
given(repository.findOne(predicate)).willReturn(Optional.empty());
//then
expectedException.expect(ActivitiException.class);
expectedException.expectMessage("Error");
//when
entityFinder.findOne(repository, predicate, "Error");
}
}
|
[
"[email protected]"
] | |
9484481e4557fd6a38b00b59ac3b9f0c96ddbab3
|
98e5c183a92ca33a3b718eb980c2a74b1ef6ed8b
|
/https:/github.com/dangkimgiao/TestGUI.git/TestGUI/src/GUI/FlowLayoutGUI.java
|
835b28d00c73ebb8fcbaa11168f242a1a03404b1
|
[] |
no_license
|
dangkimgiao/LoginProject2
|
c8f80c8b3b8e41bef09ab88a670d2e26cea43649
|
4ba2ac6387e64ddb751a2e3510fbbeea9893aadd
|
refs/heads/master
| 2022-06-17T03:20:49.441207 | 2020-05-08T03:15:50 | 2020-05-08T03:15:50 | 256,375,779 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,533 |
java
|
package GUI;
//import 2 goi awt va swing.awt
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.*;
public class FlowLayoutGUI extends JFrame {
public FlowLayoutGUI(String title) {
this.setTitle(title);
this.setSize(500, 500);
//this.setSize(new Dimension(600,100));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
AddControl();
this.setVisible(true);
}
private void AddControl() {
//ve JPanel và set layout
JPanel pnFlow = new JPanel();
pnFlow.setLayout(new FlowLayout());
pnFlow.setBackground(Color.PINK);
ImageIcon next = new ImageIcon(FlowLayoutGUI.class.getResource("/resources/next.jpg"), "Next");
//JPanel pnFlow = new JPanel(new FlowLayout());
//ve các control
JButton btn1 = new JButton(next);
//btn1.setForeground(Color.BLUE);
JButton btn2 = new JButton ("Button 2");
btn2.setPreferredSize(new Dimension(100,30));
JButton btn3 = new JButton ("Button 3");
JButton btn4 = new JButton("Button 4");
JButton btn5 = new JButton ("Button 5");
JButton btn6 = new JButton("Button 6");
JTextField tf1 = new JTextField("Nhap Password:");
tf1.setForeground(Color.LIGHT_GRAY);
tf1.setPreferredSize(new Dimension(100,30));
tf1.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
if(tf1.getText().equals("Nhap Password:")) {
tf1.setText("");
tf1.setForeground(Color.BLACK);
}
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
/* if(tf1.getText().equals("Nhap Password:")) {
tf1.setText("");
tf1.setForeground(Color.BLACK);
}*/
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
tf1.setForeground(Color.RED);
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
tf1.setForeground(Color.BLACK);
}
});
JPasswordField pf = new JPasswordField();
pf.setPreferredSize(new Dimension(100,30));
JTextField tf2 = new JTextField(200);
JTextArea ta = new JTextArea("JTextArea(): Tạo một TextArea mới.\n" +
"JTextArea(String s): Tạo một TextArea mới với text đã cho.\n" +
"JTextArea(int row, int column): Tạo một TextArea mới với số hàng và cột đã cho.\n" +
"JTextArea(String s, int row, int column): Tạo một TextArea mới với text, số hàng và cột đã cho.\n" +
"");
ta.insert("SGU", 2);
ta.append("SGU");
/* JTextField tf1 = new JTextField(20);
JTextArea ta1 = new JTextArea("ws): Được sử dụng để thiết lập số hàng đã cho.\n" +
"\n" +
"2. public void setColumns(int cols): Được sử dụng để thiết lập số cột đã cho",10, 10);
ta1.insert("Giao", 3);
ta1.append("Giao");*/
pnFlow.add(btn1);
pnFlow.add(btn2);
pnFlow.add(btn3);
pnFlow.add(btn4);
pnFlow.add(btn5);
//pnFlow.add(tf1);
//pnFlow.add(ta1);
pnFlow.add(btn6);
pnFlow.add(tf1);
pnFlow.add(pf);
pnFlow.add(tf2);
pnFlow.add(ta);
this.setContentPane(pnFlow);
}
/* public static void main (String[] args) {
FlowLayoutGUI layout = new FlowLayoutGUI("Flow Layout");
}*/
}
|
[
"giaodang@giaos-air"
] |
giaodang@giaos-air
|
a346161a0a31238460d926ec57c1fa04911e65a5
|
097d0ea49b1b887834fe47df05f9ae1fe6c18200
|
/app/src/main/java/roomdemo/wiseass/com/roomdemo/viewmodel/ListItemCollectionViewModel.java
|
97cadca1ebdd50ef8c4fad291c6f587a4f89b961
|
[
"Apache-2.0"
] |
permissive
|
bilthon/RoomDemo2017
|
0de57a65fe60ae89543bb3ce7583d1f20c4fa1dc
|
0b61b68589929c920a700ed70113653bd736ed59
|
refs/heads/master
| 2021-07-18T19:53:21.042666 | 2017-10-27T17:49:17 | 2017-10-27T17:49:17 | 108,577,037 | 0 | 0 | null | 2017-10-27T17:48:32 | 2017-10-27T17:48:32 | null |
UTF-8
|
Java
| false | false | 1,763 |
java
|
/*
* *
* * Copyright (C) 2017 Ryan Kay Open Source Project
* *
* * 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 roomdemo.wiseass.com.roomdemo.viewmodel;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.ViewModel;
import android.os.AsyncTask;
import java.util.List;
import javax.inject.Inject;
import roomdemo.wiseass.com.roomdemo.data.ListItem;
import roomdemo.wiseass.com.roomdemo.data.ListItemRepository;
/**
* Created by R_KAY on 8/3/2017.
*/
public class ListItemCollectionViewModel extends ViewModel {
private ListItemRepository repository;
ListItemCollectionViewModel(ListItemRepository repository) {
this.repository = repository;
}
public LiveData<List<ListItem>> getListItems() {
return repository.getListOfData();
}
public void deleteListItem(ListItem listItem) {
DeleteItemTask deleteItemTask = new DeleteItemTask();
deleteItemTask.execute(listItem);
}
private class DeleteItemTask extends AsyncTask<ListItem, Void, Void> {
@Override
protected Void doInBackground(ListItem... item) {
repository.deleteListItem(item[0]);
return null;
}
}
}
|
[
"[email protected]"
] | |
0af048f4f36ba1e494024d0f34d7360b80532dd0
|
d58bc3baf2a3b986368d92a305e262fee4a300d1
|
/src/test/java/utility/QueryGetter.java
|
ab5b03dacbe96e3c05887d424c4bcc72049a553a
|
[] |
no_license
|
test79425/testproject123
|
ce8dd01e4ca368f37cfe161e775268bf6e4e035c
|
53e633a73899e83c1bba7927e8bf2ad87943546b
|
refs/heads/master
| 2023-07-26T20:31:29.681770 | 2021-09-07T13:12:15 | 2021-09-07T13:12:15 | 403,947,961 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 467 |
java
|
package utility;
import java.io.IOException;
import java.util.Properties;
public class QueryGetter {
static final Properties properties = new Properties();
static {
try {
properties.load(ClassLoader.getSystemResourceAsStream("test.properties"));
} catch (IOException e) {
e.printStackTrace();
}
}
public static String getString(String target) {
return properties.getProperty(target);
}
}
|
[
"[email protected]"
] | |
892a4ef9acb22423c43366a20124099fd7a88680
|
0d504a0088c38775544dd885a818ff9ea2a42748
|
/app/src/main/java/com/musicbase/ui/view/ProgressWebview.java
|
9ce0df5e5785b3eef8304d12653045b130b067a6
|
[] |
no_license
|
wzyxzy/MusicBase2
|
c3ac4881579bedd01a97812194616ba328d89c7d
|
fd981715fbb60ee60432b10cc0ac57d4f9019bc0
|
refs/heads/master
| 2022-06-14T12:15:33.443401 | 2020-05-09T11:37:22 | 2020-05-09T11:37:22 | 262,557,400 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,497 |
java
|
package com.musicbase.ui.view;
import android.content.Context;
import android.util.AttributeSet;
import android.webkit.WebView;
import android.widget.ProgressBar;
public class ProgressWebview extends WebView {
private ProgressBar progressbar;
public ProgressWebview(Context context, AttributeSet attrs) {
super(context, attrs);
progressbar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
progressbar.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 8, 0, 0));
int tv_progess = context.getResources().getIdentifier("webprogress_color", "drawable", context.getPackageName());
progressbar.setProgressDrawable(context.getResources().getDrawable(tv_progess));
addView(progressbar);
// setWebViewClient(new WebViewClient(){});
setWebChromeClient(new WebChromeClient());
}
public class WebChromeClient extends android.webkit.WebChromeClient {
@Override
public void onProgressChanged(WebView view, int newProgress) {
if (newProgress == 100) {
progressbar.setVisibility(GONE);
} else {
if (progressbar.getVisibility() == GONE)
progressbar.setVisibility(VISIBLE);
progressbar.setProgress(newProgress);
}
super.onProgressChanged(view, newProgress);
}
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
LayoutParams lp = (LayoutParams) progressbar.getLayoutParams();
lp.x = l;
lp.y = t;
progressbar.setLayoutParams(lp);
super.onScrollChanged(l, t, oldl, oldt);
}
}
|
[
"[email protected]"
] | |
1061762144139b9b28ab837637ba52ee5efa384f
|
d60e287543a95a20350c2caeabafbec517cabe75
|
/LACCPlus/HBase/13330_1.java
|
3efc1158362e1aaaa3b16f3fe900cfc54171cba7
|
[
"MIT"
] |
permissive
|
sgholamian/log-aware-clone-detection
|
242067df2db6fd056f8d917cfbc143615c558b2c
|
9993cb081c420413c231d1807bfff342c39aa69a
|
refs/heads/main
| 2023-07-20T09:32:19.757643 | 2021-08-27T15:02:50 | 2021-08-27T15:02:50 | 337,837,827 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,544 |
java
|
//,temp,THBaseService.java,6581,6608,temp,THBaseService.java,6517,6544
//,2
public class xxx {
public void onError(java.lang.Exception e) {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TSerializable msg;
createTable_result result = new createTable_result();
if (e instanceof TIOError) {
result.io = (TIOError) e;
result.setIoIsSet(true);
msg = result;
} else if (e instanceof org.apache.thrift.transport.TTransportException) {
_LOGGER.error("TTransportException inside handler", e);
fb.close();
return;
} else if (e instanceof org.apache.thrift.TApplicationException) {
_LOGGER.error("TApplicationException inside handler", e);
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TApplicationException)e;
} else {
_LOGGER.error("Exception inside handler", e);
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
} catch (java.lang.Exception ex) {
_LOGGER.error("Exception writing to internal frame buffer", ex);
fb.close();
}
}
};
|
[
"[email protected]"
] | |
c16e82346080d20201515540859e453a000b08f7
|
1b9edcce2f7f3ace7c7d66bb0a1746908c9a8058
|
/all-webgis-java/hstore-api/src/main/java/com/trgis/trmap/hstore/service/query/Conditions.java
|
c2f1853e6b1a455c6ae2be2748904bb01a6ede5b
|
[] |
no_license
|
ideli/csevice
|
00cac33b7abd9c338ca2aceaf8b67a6ae7ef3e08
|
ba3d533e98ced8af15996360deba4a16a2ca5572
|
refs/heads/master
| 2020-06-12T11:55:19.837737 | 2016-05-24T12:03:50 | 2016-05-24T12:03:50 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,658 |
java
|
package com.trgis.trmap.hstore.service.query;
import com.trgis.trmap.hstore.exception.HStoreSQLException;
import com.trgis.trmap.hstore.exception.MapPropertiesException;
/**
* 组装条件对象
*
* @see postgresql to_date formatter
* http://www.techonthenet.com/postgresql/functions/to_date.php
*
* @author zhangqian
*
*/
public class Conditions {
private String key;
private String[] value;
private TypeEnum typeEnum = TypeEnum.STRING;// DEFAULT
private ConditionalEnum conditional = ConditionalEnum.LIKE; // DEFAULT
public Conditions(String key, String[] value) {
this.key = key;
this.value = value;
}
public Conditions(String key, String[] value, TypeEnum typeEnum) {
this.key = key;
this.value = value;
this.typeEnum = typeEnum;
}
public Conditions(String key, String[] value, ConditionalEnum conditional) {
this.key = key;
this.value = value;
this.conditional = conditional;
}
public Conditions(String key, String[] value, TypeEnum typeEnum, ConditionalEnum conditional) {
super();
this.key = key;
this.value = value;
this.typeEnum = typeEnum;
this.conditional = conditional;
}
/**
* 将条件转换为hstore sql 语句
* @return
* @throws HStoreSQLException
*/
public String convertHStoreSql() throws MapPropertiesException {
switch (this.conditional) {
case LT:
switch (this.typeEnum) {
case STRING:
throw new MapPropertiesException("字符串不能比较大小");
case INT:
return String.format("cast((stores->'%s') as INT) < %s", this.key, this.value[0]);
case DATE:
//TODO 需要加入日期格式的正则表达式判断
return String.format("cast((stores->'%s') as DATE) < to_date('%s','YYYY-MM-DD HH24:MI:SS');", this.key,this.value[0]);
default:
throw new MapPropertiesException("值类型错误");
}
case LTE:
switch (this.typeEnum) {
case STRING:
throw new MapPropertiesException("字符串不能比较大小");
case INT:
return String.format("cast((stores->'%s') as INT) <= %s", this.key, this.value[0]);
case DATE:
//TODO 需要加入日期格式的正则表达式判断
return String.format("cast((stores->'%s') as DATE) <= to_date('%s','YYYY-MM-DD HH24:MI:SS');", this.key,this.value[0]);
default:
throw new MapPropertiesException("值类型错误");
}
case GT:
switch (this.typeEnum) {
case STRING:
throw new MapPropertiesException("字符串不能比较大小");
case INT:
return String.format("cast((stores->'%s') as INT) > %s", this.key, this.value[0]);
case DATE:
//TODO 需要加入日期格式的正则表达式判断
return String.format("cast((stores->'%s') as DATE) > to_date('%s','YYYY-MM-DD HH24:MI:SS')", this.key,this.value[0]);
default:
throw new MapPropertiesException("值类型错误");
}
case GTE:
switch (this.typeEnum) {
case STRING:
throw new MapPropertiesException("字符串不能比较大小");
case INT:
return String.format("cast((stores->'%s') as INT) >= %s", this.key, this.value[0]);
case DATE:
//TODO 需要加入日期格式的正则表达式判断
return String.format("cast((stores->'%s') as DATE) >= to_date('%s','YYYY-MM-DD HH24:MI:SS')", this.key,this.value[0]);
default:
throw new MapPropertiesException("值类型错误");
}
case LIKE:
return String.format("(stores->'%s') like '%s'", this.key, this.value[0]);
case NOTLIKE:
return String.format("(stores->'%s') not like '%s'", this.key, this.value[0]);
case EQUALS:
return String.format("(stores->'%s') = '%s'", this.key, this.value[0]);
case BETWEEN:
// TODO 需要验证参数长度
switch (this.typeEnum) {
case STRING:
throw new MapPropertiesException("字符串不能比较");
case INT:
return String.format("cast((stores->'%s') as INT) between %s and %s", this.key, this.value[0],this.value[1]);
case DATE:
//TODO 需要加入日期格式的正则表达式判断
return String.format("cast((stores->'%s') as DATE) => to_date('%s','YYYY-MM-DD HH24:MI:SS') and to_date('%s','YYYY-MM-DD HH24:MI:SS')", this.key,this.value[0],this.value[1]);
default:
throw new MapPropertiesException("值类型错误");
}
case IN:
return String.format("(stores->'%s') in (%s)", this.key, this.value[0]);
case NOTIN:
return String.format("(stores->'%s') not in (%s)", this.key, this.value[0]);
default:
return "";
}
}
public static void main(String[] args) throws MapPropertiesException {
Conditions cs = new Conditions("age", new String[] { "'12','13'" },TypeEnum.STRING,ConditionalEnum.IN);
System.out.println(cs.convertHStoreSql());
}
}
|
[
"[email protected]"
] | |
8791b925e814c4942ea27ac66c97e0360d8c7f7a
|
cc3abaa3e1fb86a5494390ffdfbf085e6b416246
|
/course/app/src/main/java/com/example/my_hotel/activity/FeedbackActivity.java
|
46b04a95cb72a5860652c5292fef6e7bc64229eb
|
[] |
no_license
|
AntonHutsko/coursework
|
199f7253e065d9bd8218520f1178d6c52d48f0c5
|
65a93b98d5966f6b33e2a34a21140277e128d94b
|
refs/heads/main
| 2023-04-28T17:40:57.729242 | 2021-05-16T18:10:54 | 2021-05-16T18:10:54 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,275 |
java
|
package com.example.my_hotel.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.RatingBar;
import android.widget.TextView;
import com.example.my_hotel.R;
import com.example.my_hotel.main.MainActivity;
import static com.example.my_hotel.R.id.ratingbar;
public class FeedbackActivity extends AppCompatActivity implements View.OnClickListener {
public RatingBar txtView;
@SuppressLint("WrongViewCast")
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feedback);
txtView = findViewById(ratingbar);
showRatingDialog();
Button homeButton = (Button) findViewById(R.id.home);
homeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent main = new Intent(FeedbackActivity.this, MainActivity.class);
Log.d("123", "1233");
startActivity(main);
}
});
}
public void onClick(View v) {
showRatingDialog();
}
public void showRatingDialog() {
final AlertDialog.Builder ratingdialog = new AlertDialog.Builder(this);
ratingdialog.setIcon(android.R.drawable.btn_star_big_on);
ratingdialog.setTitle("Rate our hotel!");
View linearlayout = getLayoutInflater().inflate(R.layout.ratingdialog, null);
ratingdialog.setView(linearlayout);
final RatingBar rating = (RatingBar)linearlayout.findViewById(ratingbar);
ratingdialog.setPositiveButton("Done",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//txtView.setText(String.valueOf(rating.getRating()));
dialog.dismiss();
}
})
.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
ratingdialog.create();
ratingdialog.show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Получаем идентификатор выбранного пункта меню
int id = item.getItemId();
// Операции для выбранного пункта меню
switch (id) {
case R.id.action_info_hotel:
Intent hotel = new Intent(FeedbackActivity.this, HotelActivity.class);
startActivity(hotel);
return true;
case R.id.action_info_program:
Intent main = new Intent(FeedbackActivity.this, MainActivity.class);
startActivity(main);
return true;
case R.id.action_location:
Intent location = new Intent(FeedbackActivity.this, LocationActivity.class);
startActivity(location);
return true;
case R.id.action_reservation:
Intent reservation = new Intent(FeedbackActivity.this, ReservationActivity.class);
startActivity(reservation);
return true;
case R.id.action_room:
Intent gallery = new Intent(FeedbackActivity.this, GalleryActivity.class);
startActivity(gallery);
return true;
case R.id.action_settings:
//infoTextView.setText("action_settings");
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
|
[
"[email protected]"
] | |
788b6e3f1616bc7c80c90eb804289aebf8413efb
|
30830ca37a27d8b1e411e7880b6b9689287c003c
|
/src/com/josh/Main.java
|
63df9a198f54bbbaac10fd18c48cdd2b3df9fb8f
|
[] |
no_license
|
KortasSN/MovieRatingGUI
|
0c408560873c762b5c7698f240bc3b56841d7586
|
fa3403434e302374fe70edbab52ea5a5ac891ef0
|
refs/heads/master
| 2021-05-31T08:52:56.817716 | 2016-04-24T23:58:00 | 2016-04-24T23:58:00 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 137 |
java
|
package com.josh;
public class Main {
public static void main(String[] args) {
MovieRatingGUI gui = new MovieRatingGUI();
}
}
|
[
"[email protected]"
] | |
7b105a6e879320478c63e84f47b14ca7cd2b28fb
|
3f91d63c9d0e404d99f56ba4f80f2eab3346b5af
|
/LGC_Applications/src/luiss/it/LGCDB_Clienti/dao/DatiAccademiciHome.java
|
169452b3dac376cad81d41f3262f50cc2cdfb788
|
[] |
no_license
|
lgcjsa/applications
|
ef76f65a5a29eaa71625d052873143609b6b2558
|
c5a532ad5202f2b7b392f8ce4981b7ad40908f05
|
refs/heads/master
| 2020-04-17T22:03:31.205881 | 2019-01-22T13:13:51 | 2019-01-22T13:13:51 | 166,978,448 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,564 |
java
|
package luiss.it.LGCDB_Clienti.dao;
// Generated 11-dic-2018 16.15.37 by Hibernate Tools 5.2.6.Final
import java.util.List;
import javax.naming.InitialContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Example;
/**
* Home object for domain model class DatiAccademici.
* @see luiss.it.LGCDB_Clienti.dao.DatiAccademici
* @author Hibernate Tools
*/
public class DatiAccademiciHome {
private static final Log log = LogFactory.getLog(DatiAccademiciHome.class);
private final SessionFactory sessionFactory = getSessionFactory();
protected SessionFactory getSessionFactory() {
try {
return (SessionFactory) new InitialContext().lookup("SessionFactory");
} catch (Exception e) {
log.error("Could not locate SessionFactory in JNDI", e);
throw new IllegalStateException("Could not locate SessionFactory in JNDI");
}
}
public void persist(DatiAccademici transientInstance) {
log.debug("persisting DatiAccademici instance");
try {
sessionFactory.getCurrentSession().persist(transientInstance);
log.debug("persist successful");
} catch (RuntimeException re) {
log.error("persist failed", re);
throw re;
}
}
public void attachDirty(DatiAccademici instance) {
log.debug("attaching dirty DatiAccademici instance");
try {
sessionFactory.getCurrentSession().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(DatiAccademici instance) {
log.debug("attaching clean DatiAccademici instance");
try {
sessionFactory.getCurrentSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void delete(DatiAccademici persistentInstance) {
log.debug("deleting DatiAccademici instance");
try {
sessionFactory.getCurrentSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public DatiAccademici merge(DatiAccademici detachedInstance) {
log.debug("merging DatiAccademici instance");
try {
DatiAccademici result = (DatiAccademici) sessionFactory.getCurrentSession().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public DatiAccademici findById(java.lang.Integer id) {
log.debug("getting DatiAccademici instance with id: " + id);
try {
DatiAccademici instance = (DatiAccademici) sessionFactory.getCurrentSession()
.get("luiss.it.LGCDB_Clienti.dao.DatiAccademici", id);
if (instance == null) {
log.debug("get successful, no instance found");
} else {
log.debug("get successful, instance found");
}
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(DatiAccademici instance) {
log.debug("finding DatiAccademici instance by example");
try {
List results = sessionFactory.getCurrentSession()
.createCriteria("luiss.it.LGCDB_Clienti.dao.DatiAccademici").add(Example.create(instance)).list();
log.debug("find by example successful, result size: " + results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
}
|
[
"[email protected]"
] | |
e5a13ff46fd6056b65c95cb25e374a9de03d264c
|
7909c7d145876fc68b58ab5c059b81728c6d9c54
|
/myException/src/com/shf2/ScoreException.java
|
93c4ac9765825868e495608df1584399c0f87afa
|
[] |
no_license
|
shuhongfan/Java
|
2cbf6e2a257fb04c025dde4c7eb0f22ec628f1f2
|
cc922f9b6536c6777bf3b21d0ad99e0db367a04f
|
refs/heads/main
| 2023-06-18T14:46:03.415828 | 2021-07-21T03:31:22 | 2021-07-21T03:31:22 | 384,601,617 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 161 |
java
|
package com.shf2;
public class ScoreException extends Exception{
public ScoreException(){}
public ScoreException(String message){
super(message);
}
}
|
[
"[email protected]"
] | |
d4251c552a47e25cb91a14a001414a67dc74044d
|
cc1701cadaa3b0e138e30740f98d48264e2010bd
|
/chrome/browser/thumbnail/generator/android/java/src/org/chromium/chrome/browser/thumbnail/generator/ThumbnailDiskStorageTest.java
|
6c9acd310d9da6ccc05521a75611491d3ba2d2b6
|
[
"BSD-3-Clause"
] |
permissive
|
dbuskariol-org/chromium
|
35d3d7a441009c6f8961227f1f7f7d4823a4207e
|
e91a999f13a0bda0aff594961762668196c4d22a
|
refs/heads/master
| 2023-05-03T10:50:11.717004 | 2020-06-26T03:33:12 | 2020-06-26T03:33:12 | 275,070,037 | 1 | 3 |
BSD-3-Clause
| 2020-06-26T04:04:30 | 2020-06-26T04:04:29 | null |
UTF-8
|
Java
| false | false | 13,768 |
java
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.thumbnail.generator;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.util.Pair;
import androidx.test.filters.SmallTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.FlakyTest;
import org.chromium.base.test.util.UrlUtils;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.components.browser_ui.util.ConversionUtils;
import org.chromium.content_public.browser.test.util.Criteria;
import org.chromium.content_public.browser.test.util.CriteriaHelper;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
import java.util.ArrayList;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Tests ThumbnailProviderDiskStorage.
*/
@RunWith(ChromeJUnit4ClassRunner.class)
public class ThumbnailDiskStorageTest {
private static final String TAG = "ThumbnailDiskTest";
private static final String CONTENT_ID1 = "contentId1";
private static final String CONTENT_ID2 = "contentId2";
private static final String CONTENT_ID3 = "contentId3";
private static final String FILE_PATH1 = UrlUtils.getTestFilePath("android/google.png");
private static final String FILE_PATH2 = UrlUtils.getTestFilePath("android/favicon.png");
private static final Bitmap BITMAP1 = BitmapFactory.decodeFile(FILE_PATH1);
private static final Bitmap BITMAP2 = BitmapFactory.decodeFile(FILE_PATH2);
private static final int ICON_WIDTH1 = 50;
private static final int ICON_WIDTH2 = 70;
private static final int TEST_MAX_CACHE_BYTES = 1 * ConversionUtils.BYTES_PER_MEGABYTE;
private static final long TIMEOUT_MS = 10000;
private static final long INTERVAL_MS = 500;
private TestThumbnailStorageDelegate mTestThumbnailStorageDelegate;
private TestThumbnailGenerator mTestThumbnailGenerator;
private TestThumbnailDiskStorage mTestThumbnailDiskStorage;
private static class TestThumbnailRequest implements ThumbnailProvider.ThumbnailRequest {
private String mContentId;
public TestThumbnailRequest(String contentId) {
mContentId = contentId;
}
// This is not called in the test.
@Override
public String getFilePath() {
return null;
}
@Override
public String getMimeType() {
return null;
}
@Override
public String getContentId() {
return mContentId;
}
@Override
public void onThumbnailRetrieved(@NonNull String contentId, @Nullable Bitmap thumbnail) {}
@Override
public int getIconSize() {
return ICON_WIDTH1;
}
}
private static class TestThumbnailStorageDelegate implements ThumbnailStorageDelegate {
// Accessed by UI and test threads.
public final AtomicInteger retrievedCount = new AtomicInteger();
@Override
public void onThumbnailRetrieved(@NonNull String contentId, @Nullable Bitmap bitmap) {
retrievedCount.getAndIncrement();
}
}
private static class TestThumbnailDiskStorage extends ThumbnailDiskStorage {
// Incremented when adding an existing entry and trimming. Accessed by test and UI threads.
public AtomicInteger removeCount = new AtomicInteger();
// Accessed by test and UI threads.
public final AtomicBoolean initialized = new AtomicBoolean();
public TestThumbnailDiskStorage(TestThumbnailStorageDelegate delegate,
TestThumbnailGenerator thumbnailGenerator, int maxCacheSizeBytes) {
super(delegate, thumbnailGenerator, maxCacheSizeBytes);
}
@Override
void initDiskCache() {
super.initDiskCache();
initialized.set(true);
}
@Override
public void removeFromDiskHelper(Pair<String, Integer> contentIdSizePair) {
removeCount.getAndIncrement();
super.removeFromDiskHelper(contentIdSizePair);
}
/**
* The number of entries in the disk cache. Accessed in testing thread.
*/
int getCacheCount() {
return sDiskLruCache.size();
}
public Pair<String, Integer> getOldestEntry() {
if (getCacheCount() <= 0) return null;
return sDiskLruCache.iterator().next();
}
public Pair<String, Integer> getMostRecentEntry() {
if (getCacheCount() <= 0) return null;
ArrayList<Pair<String, Integer>> list =
new ArrayList<Pair<String, Integer>>(sDiskLruCache);
return list.get(list.size() - 1);
}
}
/**
* Dummy thumbnail generator that calls back immediately.
*/
private static class TestThumbnailGenerator extends ThumbnailGenerator {
// Accessed by test and UI threads.
public final AtomicInteger generateCount = new AtomicInteger();
@Override
public void retrieveThumbnail(
ThumbnailProvider.ThumbnailRequest request, ThumbnailGeneratorCallback callback) {
generateCount.getAndIncrement();
onThumbnailRetrieved(request.getContentId(), request.getIconSize(), null, callback);
}
}
@Before
public void setUp() {
mTestThumbnailStorageDelegate = new TestThumbnailStorageDelegate();
mTestThumbnailGenerator = new TestThumbnailGenerator();
TestThreadUtils.runOnUiThreadBlocking(() -> {
mTestThumbnailDiskStorage = new TestThumbnailDiskStorage(
mTestThumbnailStorageDelegate, mTestThumbnailGenerator, TEST_MAX_CACHE_BYTES);
// Clear the disk cache so that cached entries from previous runs won't show up.
mTestThumbnailDiskStorage.clear();
});
assertInitialized();
assertDiskSizeBytes(0);
mTestThumbnailDiskStorage.removeCount.set(0);
}
/**
* Verify that an inserted thumbnail can be retrieved.
*/
@Test
@SmallTest
public void testCanInsertAndGet() {
mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP1, ICON_WIDTH1);
Assert.assertEquals(1, mTestThumbnailDiskStorage.getCacheCount());
TestThumbnailRequest request = new TestThumbnailRequest(CONTENT_ID1);
retrieveThumbnailAndAssertRetrieved(request);
// Ensure the thumbnail generator is not called.
Assert.assertEquals(0, mTestThumbnailGenerator.generateCount.get());
Assert.assertTrue(
mTestThumbnailDiskStorage.getFromDisk(CONTENT_ID1, ICON_WIDTH1).sameAs(BITMAP1));
// Since retrieval re-adds an existing entry, remove was called once already.
removeThumbnailAndExpectedCount(CONTENT_ID1, 2);
assertDiskSizeBytes(0);
}
/**
* Verify that two inserted entries with the same key (content ID) will count as only one entry
* and the first entry data will be replaced with the second.
*/
@Test
@SmallTest
public void testRepeatedInsertShouldBeUpdated() {
mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP1, ICON_WIDTH1);
mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP2, ICON_WIDTH1);
// Verify that the old entry is updated with the new
Assert.assertEquals(1, mTestThumbnailDiskStorage.getCacheCount());
Assert.assertTrue(
mTestThumbnailDiskStorage.getFromDisk(CONTENT_ID1, ICON_WIDTH1).sameAs(BITMAP2));
// Note: since an existing entry is re-added, remove was called once already
removeThumbnailAndExpectedCount(CONTENT_ID1, 2);
assertDiskSizeBytes(0);
}
/**
* Verify that retrieveThumbnail makes the called entry the most recent entry in cache.
*/
@Test
@SmallTest
public void testRetrieveThumbnailShouldMakeEntryMostRecent() {
mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP1, ICON_WIDTH1);
mTestThumbnailDiskStorage.addToDisk(CONTENT_ID2, BITMAP1, ICON_WIDTH1);
mTestThumbnailDiskStorage.addToDisk(CONTENT_ID3, BITMAP1, ICON_WIDTH1);
Assert.assertEquals(3, mTestThumbnailDiskStorage.getCacheCount());
// Verify no trimming is done
Assert.assertEquals(0, mTestThumbnailDiskStorage.removeCount.get());
TestThumbnailRequest request = new TestThumbnailRequest(CONTENT_ID1);
retrieveThumbnailAndAssertRetrieved(request);
Assert.assertEquals(mTestThumbnailGenerator.generateCount.get(), 0);
// Since retrieval re-adds an existing entry, remove was called once already
Assert.assertEquals(1, mTestThumbnailDiskStorage.removeCount.get());
// Verify that the called entry is the most recent entry
Assert.assertTrue(mTestThumbnailDiskStorage.getMostRecentEntry().equals(
Pair.create(CONTENT_ID1, ICON_WIDTH1)));
removeThumbnailAndExpectedCount(CONTENT_ID1, 2);
removeThumbnailAndExpectedCount(CONTENT_ID2, 3);
removeThumbnailAndExpectedCount(CONTENT_ID3, 4);
assertDiskSizeBytes(0);
}
/**
* Verify that trim removes the least recently used entry.
*/
@Test
@SmallTest
public void testExceedLimitShouldTrim() {
// Add thumbnails up to cache limit to get 1 entry trimmed
int count = 0;
while (mTestThumbnailDiskStorage.removeCount.get() == 0) {
mTestThumbnailDiskStorage.addToDisk("contentId" + count, BITMAP1, ICON_WIDTH1);
++count;
}
// Since count includes the oldest entry trimmed, verify that cache size is one less
Assert.assertEquals(count - 1, mTestThumbnailDiskStorage.getCacheCount());
// The oldest entry was contentId0 before trim and should now be contentId1.
Assert.assertTrue(mTestThumbnailDiskStorage.getOldestEntry().equals(
Pair.create(CONTENT_ID1, ICON_WIDTH1)));
// Since contentId0 has been removed, {@code i} should start at 1 and removeCount is now 1.
for (int i = 1; i <= count - 1; i++) {
removeThumbnailAndExpectedCount("contentId" + i, i + 1);
}
assertDiskSizeBytes(0);
}
/**
* Verify that removeFromDisk removes all thumbnails with the same content ID but different
* sizes.
*/
@Test
@SmallTest
@FlakyTest(message = "crbug.com/1075676")
public void testRemoveAllThumbnailsWithSameContentId() {
mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP1, ICON_WIDTH1);
mTestThumbnailDiskStorage.addToDisk(CONTENT_ID1, BITMAP1, ICON_WIDTH2);
Assert.assertEquals(2, mTestThumbnailDiskStorage.getCacheCount());
Assert.assertEquals(2, getIconSizes(CONTENT_ID1).size());
// Expect two removals from cache for the two thumbnails
removeThumbnailAndExpectedCount(CONTENT_ID1, 2);
Assert.assertEquals(0, mTestThumbnailDiskStorage.getCacheCount());
Assert.assertTrue(getIconSizes(CONTENT_ID1) == null);
assertDiskSizeBytes(0);
}
/**
* Checks the internal {@link ThumbnailDiskStorage} state for whether the number of bytes
* expected to have been stored on disk matches the given |expectedBytes|.
*
* @param expectedBytes the expected number of bytes stored on disk.
*/
private void assertDiskSizeBytes(long expectedBytes) {
CriteriaHelper.pollInstrumentationThread(new Criteria() {
@Override
public boolean isSatisfied() {
return expectedBytes == mTestThumbnailDiskStorage.mSizeBytes;
}
}, TIMEOUT_MS, INTERVAL_MS);
}
/**
* Retrieve thumbnail and assert that {@link ThumbnailStorageDelegate} has received it.
*/
private void retrieveThumbnailAndAssertRetrieved(final TestThumbnailRequest request) {
TestThreadUtils.runOnUiThreadBlocking(
() -> { mTestThumbnailDiskStorage.retrieveThumbnail(request); });
CriteriaHelper.pollInstrumentationThread(new Criteria() {
@Override
public boolean isSatisfied() {
return mTestThumbnailStorageDelegate.retrievedCount.get() == 1;
}
}, TIMEOUT_MS, INTERVAL_MS);
}
private void assertInitialized() {
CriteriaHelper.pollInstrumentationThread(new Criteria() {
@Override
public boolean isSatisfied() {
return mTestThumbnailDiskStorage.initialized.get();
}
}, TIMEOUT_MS, INTERVAL_MS);
}
/**
* Remove thumbnail and ensure removal is completed.
* @param contentId Content ID of the thumbnail to remove
* @param expectedRemoveCount The expected removeCount.
*/
private void removeThumbnailAndExpectedCount(String contentId, int expectedRemoveCount) {
TestThreadUtils.runOnUiThreadBlocking(
() -> { mTestThumbnailDiskStorage.removeFromDisk(contentId); });
CriteriaHelper.pollInstrumentationThread(new Criteria() {
@Override
public boolean isSatisfied() {
return mTestThumbnailDiskStorage.removeCount.get() == expectedRemoveCount;
}
}, TIMEOUT_MS, INTERVAL_MS);
}
private Set<Integer> getIconSizes(String contentId) {
return ThumbnailDiskStorage.sIconSizesMap.get(contentId);
}
}
|
[
"[email protected]"
] | |
9c9b55e26240c8d9f3a5dfcea10555c8bf8c4a3b
|
a3ec34dbffaaa37674662cc76e0af567a15e321e
|
/src/test/java/com/mycelium/rolefen/model/DaoTest.java
|
c779abf6ca6568109e457362ed8dd3f60d5b84ec
|
[] |
no_license
|
tar/rolefen
|
17f10cd7ceab5b6c1488a3ef1c6ac4e253659ea9
|
c35f53c6f9c6d50a3ff35fdf87dd7364396dc051
|
refs/heads/master
| 2020-06-05T05:40:42.994880 | 2013-08-16T09:33:43 | 2013-08-16T09:33:43 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 960 |
java
|
package com.mycelium.rolefen.model;
import java.util.List;
import javax.annotation.Resource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import com.mycelium.rolefen.model.dao.JdbcCrudDao;
import com.mycelium.rolefen.model.entities.UserEntity;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/test-config.xml" })
@Transactional
public class DaoTest {
@Resource(name = "userDao")
private JdbcCrudDao<UserEntity> _userDao;
@Test
public void testUserDao() {
List<UserEntity> allUsers = _userDao.findAll();
System.out.println("users in DB = " + allUsers.size());
for (UserEntity user : allUsers) {
System.out.println("login : " + user.getLogin());
}
}
}
|
[
"[email protected]"
] | |
93ce7fe5549697dc00623a7edf1dcf70494e3b00
|
435792bb94a72cebd6e2844c4228da744f89f7ba
|
/onlineshopping/src/main/java/com/mukesh/onlineshopping/model/RegisterModel.java
|
4a652e669d6a03c97dda48b69babf05c05e08f8a
|
[] |
no_license
|
MukeshTatrari/online-shopping
|
c78ae5ac4b83ef3a19c5b6e144c8febf1075c1fd
|
9a730370335d1c39f6474f468a617857cacee4c6
|
refs/heads/master
| 2021-04-26T22:13:57.982763 | 2018-04-20T11:01:14 | 2018-04-20T11:01:14 | 124,046,774 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 592 |
java
|
package com.mukesh.onlineshopping.model;
import java.io.Serializable;
import com.mukesh.shoppingbackend.dto.Address;
import com.mukesh.shoppingbackend.dto.User;
public class RegisterModel implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private User user;
private Address billing;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Address getBilling() {
return billing;
}
public void setBilling(Address billing) {
this.billing = billing;
}
}
|
[
"[email protected]"
] | |
64086540388bf07ac97f58b282aa9ecefaefbe44
|
69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e
|
/methods/Method_16933.java
|
ad948216ee689f8b69edeb79a25a56368dca3fbb
|
[] |
no_license
|
P79N6A/icse_20_user_study
|
5b9c42c6384502fdc9588430899f257761f1f506
|
8a3676bc96059ea2c4f6d209016f5088a5628f3c
|
refs/heads/master
| 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 227 |
java
|
private FieldSpec newKeyField(){
FieldSpec.Builder fieldSpec=isStrongKeys() ? FieldSpec.builder(kTypeVar,"key",Modifier.VOLATILE) : FieldSpec.builder(keyReferenceType(),"key",Modifier.VOLATILE);
return fieldSpec.build();
}
|
[
"[email protected]"
] | |
5f7b99319e84818836922186f814a8c5a0cdf34d
|
cf16d6dcd1ac75dfe58811a9046d84545a9276ac
|
/ly-item/ly-item-service/src/main/java/cn/x5456/leyou/item/service/impl/SpecServiceImpl.java
|
8f3a3cff6def264316ac4c49df5f54f99e5a98be
|
[] |
no_license
|
x54256/ly
|
a01f09ff95b4e50d55f86064fda20b6dd67f152f
|
b1c9921923125fc277348f8907d5c1eda25dd5ec
|
refs/heads/master
| 2020-04-07T02:18:36.568260 | 2018-12-20T01:29:26 | 2018-12-20T01:29:26 | 157,971,377 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,149 |
java
|
package cn.x5456.leyou.item.service.impl;
import cn.x5456.leyou.item.entity.TbSpecGroupEntity;
import cn.x5456.leyou.item.entity.TbSpecParamEntity;
import cn.x5456.leyou.item.repository.SpecGroupRepository;
import cn.x5456.leyou.item.repository.SpecParamRepository;
import cn.x5456.leyou.item.service.SpecService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Service
public class SpecServiceImpl implements SpecService {
@Resource
private SpecGroupRepository specGroupRepository;
@Resource
private SpecParamRepository specParamRepository;
/**
* 根据分类id进行查询下面的多个规格组
* @param cid:商品分类id,一个分类下有多个规格组
* @return
*/
@Override
public List<TbSpecGroupEntity> findSpecGroupById(Long cid) {
return specGroupRepository.findAllByCid(cid);
}
/**
*
* @param gid:根据参数组id查询参数集合
* @param cid:根据商品分类id查询参数集合(并不需要规格参数组)
* @return
*/
@Override
public List<TbSpecParamEntity> findSpecParamsByGidOrCid(Long gid, Long cid) {
List<TbSpecParamEntity> list = null;
if (gid == null && cid != null){
list = specParamRepository.findAllByCid(cid);
}else if(gid != null && cid == null){
list = specParamRepository.findAllByGroupId(gid);
}else if(gid != null){
list = specParamRepository.findAllByCidAndGroupId(cid,gid);
}
return list;
}
@Override
public List<TbSpecParamEntity> findAllBySearchingAndCid(Long cid) {
return specParamRepository.findAllBySearchingAndCid(true,cid);
}
/**
* 根据分类id获取规格参数组的所有信息(包括参数)
* @param cid
* @return
*/
@Override
public List<TbSpecGroupEntity> querySpecsByCid(Long cid) {
List<TbSpecGroupEntity> specGroupById = this.findSpecGroupById(cid);
// TODO: 2018/11/18 这中方式,要与数据库进行多次交互,数据量大时时间很长
// specGroupById.forEach(x -> {
// // 根据组id查询所有的参数
// x.setParams(specParamRepository.findAllByGroupId(x.getId()));
// });
// 一次性查出所有的params
List<TbSpecParamEntity> allByCid = specParamRepository.findAllByCid(cid);
// 将其进行根据组id进行分组,key是组id,value是组下的参数列表
Map<Long, List<TbSpecParamEntity>> map = allByCid.stream().collect(Collectors.groupingBy(TbSpecParamEntity::getGroupId));
specGroupById.forEach(x -> x.setParams(map.get(x.getId())));
return specGroupById;
}
/**
* 通过商品分类和是否通用进行查询
* @param cid
* @return
*/
@Override
public List<TbSpecParamEntity> findAllByGenericAndCid(Long cid) {
return specParamRepository.findAllByGenericAndCid(false,cid);
}
}
|
[
"[email protected]"
] | |
c255d365c661bcfa54435e6bcb69bbc74bcd6015
|
5252dade0e96b05700a208e5ee5c2a24bd5c7c7a
|
/src/main/java/br/com/planner/model/TarefaModel.java
|
c3394cc4a66817276dd0c4926b4da3d19519af47
|
[] |
no_license
|
iagobcosta/selecao-jsf
|
27e2e240e7b7c62d9572716da57eff249fbc2b94
|
b0e3fffccc0ccb441ddbf972058d9e08de5e8e69
|
refs/heads/master
| 2022-10-02T18:17:53.325907 | 2020-06-30T01:28:09 | 2020-06-30T01:28:09 | 190,770,851 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,179 |
java
|
package br.com.planner.model;
import java.io.Serializable;
import java.util.Date;
public class TarefaModel implements Serializable {
private static final long serialVersionUID = -5223669248359401661L;
private Integer id;
private String titulo;
private String descricao;
private String prioridade;
private Date dataCriacao;
private UsuarioModel usuarioModel;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String titulo) {
this.titulo = titulo;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public String getPrioridade() {
return prioridade;
}
public void setPrioridade(String prioridade) {
this.prioridade = prioridade;
}
public Date getDataCriacao() {
return dataCriacao;
}
public void setDataCriacao(Date dataCriacao) {
this.dataCriacao = dataCriacao;
}
public UsuarioModel getUsuarioModel() {
return usuarioModel;
}
public void setUsuarioModel(UsuarioModel usuarioModel) {
this.usuarioModel = usuarioModel;
}
}
|
[
"[email protected]"
] | |
c4c1c33c5f043ce96331786fd44d2437adfcac40
|
b1c287f1dcba766a128873957445b7baf527a729
|
/ReviewGUI/src/org/bechclipse/review/wizard/export/ExportReviewPage.java
|
d597d1c4b18df8e566d5ec050731356926e4bc9d
|
[] |
no_license
|
bechhansen/bechclipsereview
|
34e8305f990c36599464fe560c1cbe8175539898
|
6a6016726cbb206cfaa58160ff1e60a8080872e0
|
refs/heads/master
| 2020-06-02T13:03:40.695583 | 2010-06-06T16:12:12 | 2010-06-06T16:12:12 | 32,348,617 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 792 |
java
|
package org.bechclipse.review.wizard.export;
import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
public class ExportReviewPage extends WizardPage {
public ExportReviewPage() {
super("Export");
setTitle("Export Review");
setDescription("Export the review as Word document");
}
/**
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
layout.numColumns = 2;
layout.verticalSpacing = 9;
setControl(container);
}
}
|
[
"peer.bech.hansen@70bfe038-276d-11df-97a4-e9f47260eb65"
] |
peer.bech.hansen@70bfe038-276d-11df-97a4-e9f47260eb65
|
f1e6c2753578ef6c7015e5fc60e7d1e284cb1719
|
a431f2f1e48a055d52981bfa93de50f81e30abdc
|
/app/src/main/java/com/akioss/leanote/model/entity/NoteItemEntity.java
|
10edb46c0c37c7ef6689be0c2c2a036654357ee8
|
[
"Apache-2.0"
] |
permissive
|
Akioss/Leanote
|
6fa48bc8aa7f4b7c2d2e3bcc29033b9816cdbab5
|
ea5f4fc77f433f83ef1ed432d26d0f68e43144f8
|
refs/heads/master
| 2021-01-13T00:45:48.646822 | 2016-02-24T06:14:23 | 2016-02-24T06:14:23 | 47,524,072 | 4 | 1 | null | 2016-04-07T01:27:15 | 2015-12-07T02:20:53 |
Java
|
UTF-8
|
Java
| false | false | 4,486 |
java
|
package com.akioss.leanote.model.entity;
import java.util.List;
/*****************************************************************************************************************
* Author: liyi
* Create Date: 15/12/10.
* Package: com.akioss.leanote.model.entities
* Discription:
* Version: 1.0
* ---------------------------------------------------------------------------------------------------------------
* Modified By:
* Modified Date:
* Why & What is modified :
*****************************************************************************************************************/
public class NoteItemEntity extends BaseInfoEntity {
private String NoteId;
private String NotebookId;
private String UserId;
private String Title;
private String Desc;
private String Abstract;
private String Content;
private boolean IsMarkdown;
private boolean IsBlog;
private boolean IsTrash;
private boolean IsDeleted;
private int Usn;
private String CreatedTime;
private String UpdatedTime;
private String PublicTime;
private List<String> Tags;
private List<FileEntity> Files;
public String getNoteId() {
return NoteId;
}
public void setNoteId(String noteId) {
NoteId = noteId;
}
public String getNotebookId() {
return NotebookId;
}
public void setNotebookId(String notebookId) {
NotebookId = notebookId;
}
public String getUserId() {
return UserId;
}
public void setUserId(String userId) {
UserId = userId;
}
public String getTitle() {
return Title;
}
public void setTitle(String title) {
Title = title;
}
public String getDesc() {
return Desc;
}
public void setDesc(String desc) {
Desc = desc;
}
public String getAbstract() {
return Abstract;
}
public void setAbstract(String anAbstract) {
Abstract = anAbstract;
}
public String getContent() {
return Content;
}
public void setContent(String content) {
Content = content;
}
public boolean isMarkdown() {
return IsMarkdown;
}
public void setMarkdown(boolean markdown) {
IsMarkdown = markdown;
}
public boolean isBlog() {
return IsBlog;
}
public void setBlog(boolean blog) {
IsBlog = blog;
}
public boolean isTrash() {
return IsTrash;
}
public void setTrash(boolean trash) {
IsTrash = trash;
}
public boolean isDeleted() {
return IsDeleted;
}
public void setDeleted(boolean deleted) {
IsDeleted = deleted;
}
public int getUsn() {
return Usn;
}
public void setUsn(int usn) {
Usn = usn;
}
public String getCreatedTime() {
return CreatedTime;
}
public void setCreatedTime(String createdTime) {
CreatedTime = createdTime;
}
public String getUpdatedTime() {
return UpdatedTime;
}
public void setUpdatedTime(String updatedTime) {
UpdatedTime = updatedTime;
}
public String getPublicTime() {
return PublicTime;
}
public void setPublicTime(String publicTime) {
PublicTime = publicTime;
}
public List<String> getTags() {
return Tags;
}
public void setTags(List<String> tags) {
Tags = tags;
}
public List<FileEntity> getFiles() {
return Files;
}
public void setFiles(List<FileEntity> files) {
Files = files;
}
@Override
public String toString() {
return "NoteItemEntity{" +
"NoteId='" + NoteId + '\'' +
", NotebookId='" + NotebookId + '\'' +
", UserId='" + UserId + '\'' +
", Title='" + Title + '\'' +
", Desc='" + Desc + '\'' +
", Abstract='" + Abstract + '\'' +
", Content='" + Content + '\'' +
", IsMarkdown=" + IsMarkdown +
", IsBlog=" + IsBlog +
", IsTrash=" + IsTrash +
", IsDeleted=" + IsDeleted +
", Usn=" + Usn +
", CreatedTime='" + CreatedTime + '\'' +
", UpdatedTime='" + UpdatedTime + '\'' +
", PublicTime='" + PublicTime + '\'' +
", Tags=" + Tags +
", Files=" + Files +
'}';
}
}
|
[
"[email protected]"
] | |
d347e46e4609c676b46a8fe040ced831f6e7a469
|
77190085f33a518d87cd2cc2c1b3e2c7eee736c6
|
/app/src/main/java/com/crysoft/me/tobias/adapters/ShippingAdapter.java
|
92bcc5cfab461b01c1687058db85351a337ff4d9
|
[] |
no_license
|
creative-junk/Tobias
|
a15482bf2567a47b3bcb9a6603b92cbde6ba7dd4
|
ae1a0503fcc1a917444ecb7ac6eee239540cf99b
|
refs/heads/master
| 2021-01-16T21:49:50.294149 | 2016-08-04T16:18:20 | 2016-08-04T16:18:20 | 63,245,153 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 576 |
java
|
package com.crysoft.me.tobias.adapters;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/**
* Created by Maxx on 8/3/2016.
*/
public class ShippingAdapter extends BaseAdapter {
@Override
public int getCount() {
return 0;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return null;
}
}
|
[
"[email protected]"
] | |
0f1ae75a35f69093fa18720c0ce8d26943d9802f
|
68f67c83ec08558141e2ee4339849bd43520cf72
|
/src/java/com/bsapp/manager/UserManager.java
|
f51110f86564e713df00f72cc54de073b872c44c
|
[] |
no_license
|
Colms152/SketchyWebStoreFinal
|
0da7a9f04aba387725c21e3be7a0b3bd19c8c56f
|
0d76a4e60db8413dfee2ef54f99d1b08e0a3c43c
|
refs/heads/master
| 2020-12-12T15:43:07.456803 | 2020-01-15T20:40:49 | 2020-01-15T20:40:49 | 234,163,930 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 933 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.bsapp.manager;
import com.bsapp.dao.UserDAO;
import com.bsapp.model.User;
/**
*
* @author bemerson
*/
public class UserManager {
/** This will take a username and select from user table
* This will return three possible statuses, login correct,
* unknown user or password incorrect
* @param inUser
*/
public User loginUser(String email, String passWord){
UserDAO userDAO = new UserDAO();
User user = userDAO.getUserByEmail(email);
System.out.println("The email found in the Db was:" + user.getEmail());
if (user.getPassword().equals(passWord) && user.getEmail() != "0"){
return user;
}
else return null;
}
}
|
[
"[email protected]"
] | |
b47d80e58c3cb02377aea90754b0f3a3abcdc204
|
9b80a01768462666e0dffb60bcf47a03a1f4e53b
|
/src/java/com/example/negocio/EncryptionService.java
|
b44c1fe2627c421d50aa882bc800b9bfae3d81da
|
[] |
no_license
|
georgeslater/CasosDeUso2
|
0ceea4eec6b6256a8e9fe5f58501ea9f4dd78358
|
ea88f7d8b10382a61cc9bd242fec10389b62acca
|
refs/heads/master
| 2016-09-10T00:34:41.687711 | 2013-10-18T01:36:12 | 2013-10-18T01:36:12 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,499 |
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.example.negocio;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import javax.ejb.Stateless;
/**
*
* @author George
*/
@Stateless
public class EncryptionService {
public String encryptar(String input) {
try {
//Fuente: http://www.mkyong.com/java/java-md5-hashing-example/
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(input.getBytes());
byte byteData[] = md.digest();
//convert the byte to hex format method 1
StringBuilder sb = new StringBuilder();
for (int i = 0; i < byteData.length; i++) {
sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
}
System.out.println("Digest(in hex format):: " + sb.toString());
//convert the byte to hex format method 2
StringBuilder hexString = new StringBuilder();
for (int i = 0; i < byteData.length; i++) {
String hex = Integer.toHexString(0xff & byteData[i]);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
return null;
}
}
}
|
[
"[email protected]"
] | |
77f750a7f0113aa039e7645433e8265a0e4282a7
|
24bfe990a7af08285efc1202a3194fe71bb996f3
|
/LWJGL3D_Try1/src/engine/render/Transformations.java
|
bc9c03f82f6558b1bfd67a402c046ec209b46965
|
[] |
no_license
|
IlanAzoulay/ECE3SAT_Simulation
|
57798d6dd30a5dc3c5e9acb26ab276d584ae5fcd
|
3bc3912d6216798fb51324e221e7b478f7e91403
|
refs/heads/master
| 2020-04-18T16:19:45.641488 | 2019-02-01T17:49:13 | 2019-02-01T17:49:13 | 167,015,727 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,568 |
java
|
package engine.render;
//import org.joml.Matrix4f;
//import org.joml.Vector3f;
import engine.maths.Matrix4f;
import engine.maths.Vector3f;
public class Transformations {
private Vector3f translation, rotation, scale;
//Constructor 1
public Transformations() {
translation = new Vector3f(0, 0, 0);
rotation = new Vector3f(0, 0, 0);
scale = new Vector3f(1, 1, 1);
}
//Constructor 2
public Transformations(Vector3f t, Vector3f r, Vector3f s) {
translation = t;
rotation = r;
scale = s;
}
public Matrix4f getTransformation() {
Matrix4f translationMatrix = new Matrix4f().translate(translation);
Matrix4f rotationMatrix = new Matrix4f().rotate(rotation);
Matrix4f scaleMatrix = new Matrix4f().scale(scale);
return translationMatrix.mul(rotationMatrix.mul(scaleMatrix));
}
public Vector3f getTranslation() {
return translation;
}
public void setTranslation(Vector3f translation) {
this.translation = translation;
}
public void setTranslation(float x, float y, float z) {
translation = new Vector3f(x, y, z);
}
public Vector3f getRotation() {
return rotation;
}
public void setRotation(Vector3f rotation) {
this.rotation = rotation;
}
public void setRotation(float x, float y, float z) {
rotation = new Vector3f(x, y, z);
}
public Vector3f getScale() {
return scale;
}
public void setScale(Vector3f scale) {
this.scale = scale;
}
public void setScale(float x, float y, float z) {
scale = new Vector3f(x, y, z);
}
}
|
[
"[email protected]"
] | |
043a3227e8e04c976122478c88ab170558810319
|
f745113faff44b410e88e19f15d18626cc81153a
|
/order-backend/src/main/java/com/example/orderbackend/entity/Order.java
|
b95f3b3b0d6289594777d86093bf244c0dee2801
|
[] |
no_license
|
BaiYunfei-TW/store-micro
|
6dfc27d32957c99feb92b7cdf542906792f2590e
|
e732f8b4b461cce75156ada03ad467c4de85546c
|
refs/heads/master
| 2020-03-30T03:59:19.800681 | 2018-09-28T09:38:29 | 2018-09-28T09:38:29 | 150,718,581 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 942 |
java
|
package com.example.orderbackend.entity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.List;
@Entity
@Table(name = "orders")
public class Order {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private String id;
private String userId;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "orderId")
private List<OrderItem> orderItems;
public <T> void setOrderItems(List<OrderItem> orderItems) {
this.orderItems = orderItems;
}
public List<OrderItem> getOrderItems() {
return orderItems;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserId() {
return userId;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
}
|
[
"[email protected]"
] | |
f0d999621b5d4ab5b87cc9995459fe7042ccb095
|
d62c9ce6f988d1f95192695b5ff39c6ca22fa036
|
/JavaProjects/HomeSurveyorServices/.svn/pristine/eb/eb14f34d065ff34945e895b2963a9d4c9b83bb63.svn-base
|
74917d66413d42475b1bc46f0cc8ccc1379f44f8
|
[] |
no_license
|
InsuranceNextLab/MuthuProjects
|
8ba81008fb3c0b5ca0e0bc619f2fd76f0ba2e4cc
|
a175a374e408cb6b5ed32fc7ef9ffc6382f59b84
|
refs/heads/master
| 2021-01-10T17:50:29.307751 | 2016-03-14T07:43:34 | 2016-03-14T07:43:34 | 53,717,357 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,284 |
package com.cts.homesurveyor.domain;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"PropertyId",
"PropertyType",
"YearBuilt",
"OccupancyType",
"ConstructionType",
"RoofType",
"FoundationType",
"SquareFeet",
"Floors",
"Bedrooms", "Baths","Garage", "HeatingSystem","HeatingSystemType", "PriorLoss", "Decks", "Pools", "Address", "City", "State", "Zip"})
@XmlRootElement(name = "PropertyInfo")
public class PropertyInfo implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@XmlElement(name = "PropertyId", required = true)
private String PropertyId;
@XmlElement(name = "PropertyType", required = true)
private String PropertyType;
@XmlElement(name = "YearBuilt", required = true)
private String YearBuilt;
@XmlElement(name = "OccupancyType", required = true)
private String OccupancyType;
@XmlElement(name = "ConstructionType", required = true)
private String ConstructionType;
@XmlElement(name = "RoofType", required = true)
private String RoofType;
@XmlElement(name = "FoundationType", required = true)
private String FoundationType;
@XmlElement(name = "SquareFeet", required = true)
private String SquareFeet;
@XmlElement(name = "Floors", required = true)
private String Floors;
@XmlElement(name = "Bedrooms", required = true)
private String Bedrooms;
@XmlElement(name = "Baths", required = true)
private String Baths;
@XmlElement(name = "Garage", required = true)
private String Garage;
@XmlElement(name = "HeatingSystem", required = true)
private String HeatingSystem;
@XmlElement(name = "HeatingSystemType", required = true)
private String HeatingSystemType;
@XmlElement(name = "PriorLoss", required = true)
private String PriorLoss;
@XmlElement(name = "Decks", required = true)
private String Decks;
@XmlElement(name = "Pools", required = true)
private String Pools;
@XmlElement(name = "Address", required = true)
private String Address;
@XmlElement(name = "City", required = true)
private String City;
@XmlElement(name = "State", required = true)
private String State;
@XmlElement(name = "Zip", required = true)
private String Zip;
public String getPropertyId() {
return PropertyId;
}
public void setPropertyId(String propertyId) {
PropertyId = propertyId;
}
public String getPropertyType() {
return PropertyType;
}
public void setPropertyType(String propertyType) {
PropertyType = propertyType;
}
public String getYearBuilt() {
return YearBuilt;
}
public void setYearBuilt(String yearBuilt) {
YearBuilt = yearBuilt;
}
public String getOccupancyType() {
return OccupancyType;
}
public void setOccupancyType(String occupancyType) {
OccupancyType = occupancyType;
}
public String getConstructionType() {
return ConstructionType;
}
public void setConstructionType(String constructionType) {
ConstructionType = constructionType;
}
public String getRoofType() {
return RoofType;
}
public void setRoofType(String roofType) {
RoofType = roofType;
}
public String getFoundationType() {
return FoundationType;
}
public void setFoundationType(String foundationType) {
FoundationType = foundationType;
}
public String getSquareFeet() {
return SquareFeet;
}
public void setSquareFeet(String squareFeet) {
SquareFeet = squareFeet;
}
public String getFloors() {
return Floors;
}
public void setFloors(String floors) {
Floors = floors;
}
public String getBedrooms() {
return Bedrooms;
}
public void setBedrooms(String bedrooms) {
Bedrooms = bedrooms;
}
public String getBaths() {
return Baths;
}
public void setBaths(String baths) {
Baths = baths;
}
public String getGarage() {
return Garage;
}
public void setGarage(String garage) {
Garage = garage;
}
public String getHeatingSystem() {
return HeatingSystem;
}
public void setHeatingSystem(String heatingSystem) {
HeatingSystem = heatingSystem;
}
public String getHeatingSystemType() {
return HeatingSystemType;
}
public void setHeatingSystemType(String heatingSystemType) {
HeatingSystemType = heatingSystemType;
}
public String getPriorLoss() {
return PriorLoss;
}
public void setPriorLoss(String priorLoss) {
PriorLoss = priorLoss;
}
public String getDecks() {
return Decks;
}
public void setDecks(String decks) {
Decks = decks;
}
public String getPools() {
return Pools;
}
public void setPools(String pools) {
Pools = pools;
}
public String getAddress() {
return Address;
}
public void setAddress(String address) {
Address = address;
}
public String getCity() {
return City;
}
public void setCity(String city) {
City = city;
}
public String getState() {
return State;
}
public void setState(String state) {
State = state;
}
public String getZip() {
return Zip;
}
public void setZip(String zip) {
Zip = zip;
}
}
|
[
"[email protected]"
] | ||
a3b4deb34ff949c67b62ac763b395c693575c4c1
|
c4d1992bbfe4552ad16ff35e0355b08c9e4998d6
|
/releases/2.1.1/src/java/org/apache/poi/ss/formula/functions/Hlookup.java
|
c46fadbb8d88cdb0fcf061f323c801633a53ea03
|
[] |
no_license
|
BGCX261/zkpoi-svn-to-git
|
36f2a50d2618c73e40f24ddc2d3df5aadc8eca30
|
81a63fb1c06a2dccff20cab1291c7284f1687508
|
refs/heads/master
| 2016-08-04T08:42:59.622864 | 2015-08-25T15:19:51 | 2015-08-25T15:19:51 | 41,594,557 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,834 |
java
|
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.zkoss.poi.ss.formula.functions;
import org.zkoss.poi.ss.formula.eval.BoolEval;
import org.zkoss.poi.ss.formula.eval.EvaluationException;
import org.zkoss.poi.ss.formula.eval.OperandResolver;
import org.zkoss.poi.ss.formula.eval.ValueEval;
import org.zkoss.poi.ss.formula.functions.LookupUtils.ValueVector;
import org.zkoss.poi.ss.formula.TwoDEval;
/**
* Implementation of the HLOOKUP() function.<p/>
*
* HLOOKUP finds a column in a lookup table by the first row value and returns the value from another row.<br/>
*
* <b>Syntax</b>:<br/>
* <b>HLOOKUP</b>(<b>lookup_value</b>, <b>table_array</b>, <b>row_index_num</b>, range_lookup)<p/>
*
* <b>lookup_value</b> The value to be found in the first column of the table array.<br/>
* <b>table_array</b> An area reference for the lookup data. <br/>
* <b>row_index_num</b> a 1 based index specifying which row value of the lookup data will be returned.<br/>
* <b>range_lookup</b> If TRUE (default), HLOOKUP finds the largest value less than or equal to
* the lookup_value. If FALSE, only exact matches will be considered<br/>
*
* @author Josh Micich
*/
public final class Hlookup extends Var3or4ArgFunction {
private static final ValueEval DEFAULT_ARG3 = BoolEval.TRUE;
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1,
ValueEval arg2) {
return evaluate(srcRowIndex, srcColumnIndex, arg0, arg1, arg2, DEFAULT_ARG3);
}
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1,
ValueEval arg2, ValueEval arg3) {
try {
// Evaluation order:
// arg0 lookup_value, arg1 table_array, arg3 range_lookup, find lookup value, arg2 row_index, fetch result
ValueEval lookupValue = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex);
TwoDEval tableArray = LookupUtils.resolveTableArrayArg(arg1);
boolean isRangeLookup = LookupUtils.resolveRangeLookupArg(arg3, srcRowIndex, srcColumnIndex);
int colIndex = LookupUtils.lookupIndexOfValue(lookupValue, LookupUtils.createRowVector(tableArray, 0), isRangeLookup);
int rowIndex = LookupUtils.resolveRowOrColIndexArg(arg2, srcRowIndex, srcColumnIndex);
ValueVector resultCol = createResultColumnVector(tableArray, rowIndex);
return resultCol.getItem(colIndex);
} catch (EvaluationException e) {
return e.getErrorEval();
}
}
/**
* Returns one column from an <tt>AreaEval</tt>
*
* @param rowIndex assumed to be non-negative
*
* @throws EvaluationException (#REF!) if colIndex is too high
*/
private ValueVector createResultColumnVector(TwoDEval tableArray, int rowIndex) throws EvaluationException {
if(rowIndex >= tableArray.getHeight()) {
throw EvaluationException.invalidRef();
}
return LookupUtils.createRowVector(tableArray, rowIndex);
}
}
|
[
"[email protected]"
] | |
0e67a5446e66428f74b6910b85ca321449c4261c
|
50ce8fac90900da067e196da73afdcc3a2b7259b
|
/app/src/main/java/com/andrea/bakingapp/application/BakingApplication.java
|
74dba32c2e29349d850ecdcc706623a95458727a
|
[] |
no_license
|
AndreaWolff/AndroidNanoDegreeBakingApp
|
ff3571959138a59f5f9afa3dc56e70a51bb2c0a1
|
1efb4bae4a31dfb6b7fa028aa33c0eef5c4f836a
|
refs/heads/master
| 2020-03-13T02:00:48.059771 | 2018-05-02T20:43:33 | 2018-05-02T20:43:33 | 130,915,975 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,125 |
java
|
package com.andrea.bakingapp.application;
import android.app.Application;
import com.andrea.bakingapp.dagger.component.AppComponent;
import com.andrea.bakingapp.dagger.component.DaggerAppComponent;
import com.andrea.bakingapp.dagger.module.AppModule;
import com.andrea.bakingapp.dagger.module.NetModule;
import com.facebook.stetho.Stetho;
public class BakingApplication extends Application {
private static BakingApplication application;
private AppComponent appComponent;
@Override
public void onCreate() {
super.onCreate();
application = this;
appComponent = createDaggerComponent();
Stetho.initializeWithDefaults(this);
}
private AppComponent createDaggerComponent() {
return DaggerAppComponent.builder()
.appModule(new AppModule(this))
.netModule(new NetModule("https://d17h27t6h515a5.cloudfront.net/topher/2017/May/59121517_baking/"))
.build();
}
public static AppComponent getDagger() {
return application.appComponent;
}
}
|
[
"[email protected]"
] | |
34fe2e94427247b1ee8a0d2006c33c3e67bc8d6d
|
044278382429ff472b6642bc51c1407616f4e511
|
/abator-extend/trunk/src/java/org/apache/ibatis/abator/config/GeneratorSet.java
|
b349811c29150df195b4d2d575682dfc7a4dc55c
|
[] |
no_license
|
albertodepaola/abator-extend
|
90804c88fd78e9c6f38bc0c019788d04e23891ba
|
b5ada551ca90fc92e74580ebeb895162b502148d
|
refs/heads/master
| 2021-01-19T13:33:18.828200 | 2009-04-30T08:09:22 | 2009-04-30T08:09:22 | 37,686,361 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,498 |
java
|
/*
* Copyright 2006 The Apache Software Foundation
*
* 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.apache.ibatis.abator.config;
/**
* @author Jeff Butler
*
*/
public abstract class GeneratorSet {
protected String javaModelGeneratorType;
protected String sqlMapGeneratorType;
protected String javaTypeResolverType;
/**
*
*/
public GeneratorSet() {
super();
}
/**
* This method is used to translate the configuration nicknames for the
* different types of DAO generators into the actual implementation
* class names. Typically, the method should handle translation
* of the special values IBATIS, SPRING, GENERIC-SI and GENERIC-CI.
*
* @param configurationType
* @return the fully qualified class name of the correct implementation class
*/
public abstract String translateDAOGeneratorType(String configurationType);
public String getJavaModelGeneratorType() {
return javaModelGeneratorType;
}
public void setJavaModelGeneratorType(String javaModelGeneratorType) {
if (!"DEFAULT".equalsIgnoreCase(javaModelGeneratorType)) { //$NON-NLS-1$
this.javaModelGeneratorType = javaModelGeneratorType;
}
}
public String getJavaTypeResolverType() {
return javaTypeResolverType;
}
public void setJavaTypeResolverType(String javaTypeResolverType) {
if (!"DEFAULT".equalsIgnoreCase(javaTypeResolverType)) { //$NON-NLS-1$
this.javaTypeResolverType = javaTypeResolverType;
}
}
public String getSqlMapGeneratorType() {
return sqlMapGeneratorType;
}
public void setSqlMapGeneratorType(String sqlMapGeneratorType) {
if (!"DEFAULT".equalsIgnoreCase(sqlMapGeneratorType)) { //$NON-NLS-1$
this.sqlMapGeneratorType = sqlMapGeneratorType;
}
}
}
|
[
"sheyudong@47d76a34-6e55-0410-9958-1dd311f0855e"
] |
sheyudong@47d76a34-6e55-0410-9958-1dd311f0855e
|
93cb1066294ad0c02ebe06c865b4b5c7cd78de34
|
be1ed9fade7c1e948d09f30b916af64b7780d522
|
/infrastructure/services/search-server/src/edu/uci/ics/sourcerer/search/analysis/DelimiterFilterFactory.java
|
0b479bb43e9e6997a9de235dbdaacacd4c871cae
|
[] |
no_license
|
calinburloiu/Sourcerer
|
5fcffaf60df2e07b762830029467cef7b2af775e
|
9c9f48991f83812ab96dd53020e5fd4dd1095370
|
refs/heads/master
| 2021-01-21T00:21:32.172407 | 2012-08-27T06:09:07 | 2012-08-27T06:09:07 | 4,491,162 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,216 |
java
|
/*
* Sourcerer: An infrastructure for large-scale source code analysis.
* Copyright (C) by contributors. See CONTRIBUTORS.txt for full list.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package edu.uci.ics.sourcerer.search.analysis;
import org.apache.lucene.analysis.TokenStream;
import org.apache.solr.analysis.BaseTokenFilterFactory;
/**
* @author <a href="[email protected]">Sushil Bajracharya</a>
* @created Jul 2, 2009
*
*/
public class DelimiterFilterFactory extends BaseTokenFilterFactory {
public DelimiterFilter create(TokenStream input) {
return new DelimiterFilter(input);
}
}
|
[
"[email protected]"
] | |
22b568b6ae2e5d35a1e10ebbca22a67238454c44
|
564749fa8e0996d3f76a2c2df8fb77962830e922
|
/tools/MOCK/Trunk/mock-parent/mock-business/src/main/java/com/gome/test/mock/util/DOMUtils.java
|
0fbc1db0bae0493333bbfa6dc764c7c1bfeb0a43
|
[] |
no_license
|
wang-shun/automation
|
ab7fd40e42740b09f527c0a20e2a4a00e3d234f4
|
2e621b3a9f4890c03e63479357ec2b6e6015af21
|
refs/heads/master
| 2020-03-29T13:46:37.342288 | 2018-08-20T16:01:44 | 2018-08-20T16:01:44 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 10,021 |
java
|
package com.gome.test.mock.util;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Properties;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class DOMUtils {
/**
* 初始化一个空Document对象返回。
*
* @return a Document
*/
public static Document newXMLDocument() {
try {
return newDocumentBuilder().newDocument();
} catch (ParserConfigurationException e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* 初始化一个DocumentBuilder
*
* @return a DocumentBuilder
* @throws ParserConfigurationException
*/
public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
return newDocumentBuilderFactory().newDocumentBuilder();
}
/**
* 初始化一个DocumentBuilderFactory
*
* @return a DocumentBuilderFactory
*/
public static DocumentBuilderFactory newDocumentBuilderFactory() {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
return dbf;
}
/**
* 将传入的一个XML String转换成一个org.w3c.dom.Document对象返回。
*
* @param xmlString
* 一个符合XML规范的字符串表达。
* @return a Document
*/
public static Document parseXMLDocument(String xmlString) {
if (xmlString == null) {
throw new IllegalArgumentException();
}
try {
return newDocumentBuilder().parse(new InputSource(new StringReader(xmlString)));
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* 给定一个输入流,解析为一个org.w3c.dom.Document对象返回。
*
* @param input
* @return a org.w3c.dom.Document
*/
public static Document parseXMLDocument(InputStream input) {
if (input == null) {
throw new IllegalArgumentException("参数为null!");
}
try {
return newDocumentBuilder().parse(input);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* 给定一个文件名,获取该文件并解析为一个org.w3c.dom.Document对象返回。
*
* @param fileName
* 待解析文件的文件名
* @return a org.w3c.dom.Document
*/
public static Document loadXMLDocumentFromFile(String fileName) {
if (fileName == null) {
throw new IllegalArgumentException("未指定文件名及其物理路径!");
}
try {
return newDocumentBuilder().parse(new File(fileName));
} catch (SAXException e) {
throw new IllegalArgumentException("目标文件(" + fileName + ")不能被正确解析为XML!" + e.getMessage());
} catch (IOException e) {
throw new IllegalArgumentException("不能获取目标文件(" + fileName + ")!" + e.getMessage());
} catch (ParserConfigurationException e) {
throw new RuntimeException(e.getMessage());
}
}
/*
* 把dom文件转换为xml字符串
*/
public static String toStringFromDoc(Document document) {
String result = null;
if (document != null) {
StringWriter strWtr = new StringWriter();
StreamResult strResult = new StreamResult(strWtr);
TransformerFactory tfac = TransformerFactory.newInstance();
try {
javax.xml.transform.Transformer t = tfac.newTransformer();
t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
t.setOutputProperty(OutputKeys.INDENT, "yes");
t.setOutputProperty(OutputKeys.METHOD, "xml"); // xml, html,
// text
t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
t.transform(new DOMSource(document.getDocumentElement()), strResult);
} catch (Exception e) {
System.err.println("XML.toString(Document): " + e);
}
result = strResult.getWriter().toString();
try {
strWtr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
/**
* 给定一个节点,将该节点加入新构造的Document中。
*
* @param node
* a Document node
* @return a new Document
*/
public static Document newXMLDocument(Node node) {
Document doc = newXMLDocument();
doc.appendChild(doc.importNode(node, true));
return doc;
}
/**
* 将传入的一个DOM Node对象输出成字符串。如果失败则返回一个空字符串""。
*
* @param node
* DOM Node 对象。
* @return a XML String from node
*/
/*
* public static String toString(Node node) { if (node == null) { throw new
* IllegalArgumentException(); } Transformer transformer = new
* Transformer(); if (transformer != null) { try { StringWriter sw = new
* StringWriter(); transformer .transform(new DOMSource(node), new
* StreamResult(sw)); return sw.toString(); } catch (TransformerException
* te) { throw new RuntimeException(te.getMessage()); } } return ""; }
*/
/**
* 将传入的一个DOM Node对象输出成字符串。如果失败则返回一个空字符串""。
*
* @param node
* DOM Node 对象。
* @return a XML String from node
*/
/*
* public static String toString(Node node) { if (node == null) { throw new
* IllegalArgumentException(); } Transformer transformer = new
* Transformer(); if (transformer != null) { try { StringWriter sw = new
* StringWriter(); transformer .transform(new DOMSource(node), new
* StreamResult(sw)); return sw.toString(); } catch (TransformerException
* te) { throw new RuntimeException(te.getMessage()); } } return ""; }
*/
/**
* 获取一个Transformer对象,由于使用时都做相同的初始化,所以提取出来作为公共方法。
*
* @return a Transformer encoding gb2312
*/
public static Transformer newTransformer() {
try {
Transformer transformer = TransformerFactory.newInstance().newTransformer();
Properties properties = transformer.getOutputProperties();
properties.setProperty(OutputKeys.ENCODING, "gb2312");
properties.setProperty(OutputKeys.METHOD, "xml");
properties.setProperty(OutputKeys.VERSION, "1.0");
properties.setProperty(OutputKeys.INDENT, "no");
transformer.setOutputProperties(properties);
return transformer;
} catch (TransformerConfigurationException tce) {
throw new RuntimeException(tce.getMessage());
}
}
/**
* 返回一段XML表述的错误信息。提示信息的TITLE为:系统错误。之所以使用字符串拼装,主要是这样做一般 不会有异常出现。
*
* @param errMsg
* 提示错误信息
* @return a XML String show err msg
*/
/*
* public static String errXMLString(String errMsg) { StringBuffer msg = new
* StringBuffer(100);
* msg.append("<?xml version="1.0" encoding="gb2312" ?>");
* msg.append("<errNode title="系统错误" errMsg="" + errMsg + ""/>"); return
* msg.toString(); }
*/
/**
* 返回一段XML表述的错误信息。提示信息的TITLE为:系统错误
*
* @param errMsg
* 提示错误信息
* @param errClass
* 抛出该错误的类,用于提取错误来源信息。
* @return a XML String show err msg
*/
/*
* public static String errXMLString(String errMsg, Class errClass) {
* StringBuffer msg = new StringBuffer(100);
* msg.append("<?xml version='1.0' encoding='gb2312' ?>");
* msg.append("<errNode title="
* 系统错误" errMsg=""+ errMsg + "" errSource=""+ errClass.getName()+ ""/>");
* return msg.toString(); }
*/
/**
* 返回一段XML表述的错误信息。
*
* @param title
* 提示的title
* @param errMsg
* 提示错误信息
* @param errClass
* 抛出该错误的类,用于提取错误来源信息。
* @return a XML String show err msg
*/
public static String errXMLString(String title, String errMsg, Class errClass) {
StringBuffer msg = new StringBuffer(100);
msg.append("<?xml version='1.0' encoding='utf-8' ?>");
msg.append("<errNode title=" + title + "errMsg=" + errMsg + "errSource=" + errClass.getName() + "/>");
return msg.toString();
}
}
|
[
"[email protected]"
] | |
6ff46f14597283222273cf3fe38cca5608367c45
|
82c40d0235b6e4df988bd10d44c897f86e5f4836
|
/app/src/main/java/com/toon/estore/Model/SignUser.java
|
211e40c0b2748c6fe4ed0e387ba41103c44e64d7
|
[] |
no_license
|
SushmitSingh/Estore
|
591de860153bdb49da43e5096b83f737e0b874aa
|
1387eae24310106485d1ff2004a154230f6e6d9c
|
refs/heads/master
| 2023-06-24T21:18:23.247772 | 2021-07-22T11:08:33 | 2021-07-22T11:08:33 | 388,362,380 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 676 |
java
|
package com.toon.estore.Model;
public class SignUser {
public String name,email,phone;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public SignUser(){
}
public SignUser(String name, String email, String phone) {
this.name = name;
this.email = email;
this.phone = phone;
}
}
|
[
"[email protected]"
] | |
fb69726912fa2c06b76920631baac4a82887d136
|
89b0683c7238a53e854fac95bf882b93d98a2e01
|
/src/playerstats/observers/impl/GamesPlayedHighestAndLowestObservable.java
|
c23fc7ab6b01ff5716882aec1272764c10679769
|
[] |
no_license
|
filipemarruda/playerStatsBoard
|
5caa0a8b3854c1473eaa913bfb7acff23fde26d8
|
a141069c36b789c6bf489c4a212a48adfa2b3d0b
|
refs/heads/main
| 2023-06-06T03:35:55.798866 | 2021-07-05T21:02:24 | 2021-07-05T21:02:24 | 383,263,303 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 975 |
java
|
package playerstats.observers.impl;
import java.util.TreeSet;
import playerstats.PlayerStats;
import playerstats.observers.HighestAndLowerStatObserver;
public class GamesPlayedHighestAndLowestObservable implements HighestAndLowerStatObserver {
private TreeSet<PlayerStats> stats = new TreeSet<PlayerStats>((stat1, stat2) -> stat1.getGamesPlayed().compareTo(stat2.getGamesPlayed()));
@Override
public void process(PlayerStats playerStats) {
stats.add(playerStats);
}
@Override
public String getResult() {
PlayerStats highest = getPlayerStatsHighest();
PlayerStats lowest = getPlayerStatsLowest();
return highest.getGamesPlayed() + " games played by " + highest.getName() + " / " + lowest.getGamesPlayed() + " games played by " + lowest.getName();
}
@Override
public PlayerStats getPlayerStatsHighest() {
return stats.last();
}
@Override
public PlayerStats getPlayerStatsLowest() {
return stats.first();
}
}
|
[
"[email protected]"
] | |
5304a3054931497c2cb72524477acbeb18c482c6
|
e85d76b8e5890bedcd3d9d33587bf534de94358f
|
/gulimall-member/src/main/java/com/atguigu/gulimall/member/service/MemberCollectSpuService.java
|
dcbb90a313744517a1bb10c1fef7184d6b610200
|
[] |
no_license
|
Inuyasha-Monster/gulimall-study
|
5ec49c33674c8c42aaf231dcbb63fb6414b0ad74
|
c2e5f54770c0939bfbb71842a1f80041f274aab5
|
refs/heads/master
| 2023-07-01T09:33:16.670476 | 2021-08-01T11:57:35 | 2021-08-01T11:57:35 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 500 |
java
|
package com.atguigu.gulimall.member.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.member.entity.MemberCollectSpuEntity;
import java.util.Map;
/**
* 会员收藏的商品
*
* @author dujianglong
* @email [email protected]
* @date 2021-05-29 11:23:14
*/
public interface MemberCollectSpuService extends IService<MemberCollectSpuEntity> {
PageUtils queryPage(Map<String, Object> params);
}
|
[
"[email protected]"
] | |
5d66cf6409d836f8c303c443d8d8723b839f3100
|
8bfda8da3322f19c6678cff4d883aca63a048bae
|
/convert-exchange-service/src/main/java/com/convert/pack/domain/AbstractDomain.java
|
1a42741de6d1da6eccda3c28e0c2a1d3c5ef004b
|
[] |
no_license
|
vtakhtaulov/Bank
|
edf9424f00585986fc1aade7abf50942c29f2a37
|
ee06dbaf5500792d6332ac7c261b3944213adf26
|
refs/heads/master
| 2023-01-22T09:43:45.203049 | 2020-12-09T17:43:14 | 2020-12-09T17:43:14 | 320,032,426 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 355 |
java
|
package com.convert.pack.domain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.persistence.*;
@Data
@EqualsAndHashCode
@MappedSuperclass
@NoArgsConstructor
public class AbstractDomain {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
}
|
[
"[email protected]"
] | |
bb49401a903863ac5649138f7052796eff114a67
|
b72a509b0535867b7fbc9e0ba99a018c4a3e22ad
|
/src/main/java/rx/codegen/internal/util/TypeContext.java
|
a0b0196b0110ca9821e6b2b550b8b27433b051c7
|
[
"Apache-2.0"
] |
permissive
|
mschorsch/rxjava-codegen
|
660ba6acccb7ea7097189cd32c394525af49c586
|
a7388af13bb289eb402ac7e1f34b4cfcc1f9ae85
|
refs/heads/master
| 2020-05-02T01:01:37.909112 | 2015-04-06T09:51:22 | 2015-04-06T09:51:22 | 32,609,580 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,047 |
java
|
/*
* Copyright 2015 Matthias Schorsch.
*
* 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 rx.codegen.internal.util;
import javax.lang.model.type.TypeMirror;
/**
*
* @author Matthias
*/
class TypeContext implements Context {
private final TypeMirror type;
public TypeContext(TypeMirror type) {
this.type = type;
}
public TypeMirror getType() {
return type;
}
@Override
public String toString() {
return String.format("TypeContext => (%s)", type.toString());
}
}
|
[
"[email protected]"
] | |
78930075e44e94e098973054f539c559fbac821c
|
055a05d9c0d0bb6f8328c9331c74f127860a80d5
|
/app/src/main/java/indonative/museumid/utilities/ConstantValue.java
|
20d146d75b5b44de43253e153887b7c798acc526
|
[] |
no_license
|
FRizkiaA/MuseumID
|
a66501680c77c051b5bae5d2fa87b80ef48a3700
|
cc64d68b87fe2693947d55ad41d2805071cccd69
|
refs/heads/master
| 2021-01-12T07:26:43.750165 | 2016-12-22T08:56:41 | 2016-12-22T08:56:41 | 76,962,687 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 304 |
java
|
package indonative.museumid.utilities;
import indonative.museumid.credits.CreatorInfo;
/**
* Created by andika on 12/13/16.
*/
@CreatorInfo(
teamName = "Indonative Ltd",
creators = {"Andika Kurniawan","Fyka Rizkia Auliandy" ,"Wahyu Dwi Nurhalim" }
)
public class ConstantValue {
}
|
[
"[email protected]"
] | |
8ea4183443a25606d6e732586d544dc204301d8c
|
bed81fbcbd2f2fea4931c3979cba2c6a3848908d
|
/dotx/src/main/java/edu/buaa/rse/dotx/dbmodel/JobModel.java
|
8eb9d8ac5a22eccf123a3da52984ff6fe0972a53
|
[] |
no_license
|
fjp210/ConfigurationAnalysisTool
|
222b1b3517349c114fb96dae8872ae7515605dc4
|
81851a0bb6e91d192f0cc6c347a5ec9e889c2ee9
|
refs/heads/master
| 2020-03-22T13:09:44.679500 | 2018-10-17T12:16:54 | 2018-10-17T12:16:54 | 140,087,920 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,046 |
java
|
package edu.buaa.rse.dotx.dbmodel;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.Session;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.query.Query;
@Entity
@Table(name = "job", uniqueConstraints = { @UniqueConstraint(columnNames = { "id" }) })
public class JobModel extends BaseModel{
private Integer id;
private TaskModel task;
private Integer status;
private Set<JobResultModel> results = new HashSet<JobResultModel>(0);
public JobModel(){
}
public JobModel(TaskModel task){
this.task = task;
}
public static JobModel getJob(Session session, Integer id){
String sql = "Select job from " + JobModel.class.getName() + " job "
+ " where job.id= :id ";
Query<JobModel> query = session.createQuery(sql);
query.setParameter("id", id);
return (JobModel) query.getSingleResult();
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", length = 36)
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "taskid", nullable = false)
public TaskModel getTask() {
return task;
}
public void setTask(TaskModel task) {
this.task = task;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "job")
public Set<JobResultModel> getResults() {
return results;
}
public void setResults(Set<JobResultModel> results) {
this.results = results;
}
@Column(name="status")
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
|
[
"[email protected]"
] | |
a9046e43becc11c06195df43b8d6c2f8d992f4cf
|
bdec8690cb52e33692c084e87940533534c67701
|
/chat-server/src/main/java/com/mathilde/chat/websocket/MessageToChat.java
|
f4c1e407fa60c13c9cffe880906194c97e13b996
|
[] |
no_license
|
814040/TMDAD_Proyecto_septiembre
|
604904fdc87a4090342869897c0b5ac390446664
|
9788d329645b48a0416cf03f5cdcca0ebdc4ceae
|
refs/heads/master
| 2022-12-10T04:20:19.265978 | 2020-09-12T12:25:40 | 2020-09-12T12:25:40 | 294,915,183 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 225 |
java
|
package com.mathilde.chat.websocket;
import lombok.Data;
@Data
public class MessageToChat {
private String date;
private String from;
private Integer idFrom;
private Integer idTo;
private String text;
}
|
[
"[email protected]"
] | |
05de2d4c95dffaddd2e646e3cf06c235c875e2ab
|
53337c1502c258fab762d1f22c6632418b60194b
|
/app/src/main/java/com/hulianhujia/spellway/javaBeans/GuideDetailBean.java
|
de0e89bcc4f585bb1f155804527735597d399f8f
|
[] |
no_license
|
Gan97/PinTop_CodePresentation
|
3dad43552ac0b82c16df8986e1a7f254101383ae
|
874ebd25866fdf879ea2bd231e6f62b989508243
|
refs/heads/master
| 2020-04-11T03:52:55.767846 | 2018-12-12T18:35:09 | 2018-12-12T18:35:09 | 161,492,824 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 15,348 |
java
|
package com.hulianhujia.spellway.javaBeans;
import java.util.List;
/**
* Created by FHP on 2017/8/3.
*/
public class GuideDetailBean {
/**
* code : 1
* msg : 获取成功
* returnArr : {"user_id":"17","username":"13028194826","password":"123456","type":"2","amount":"0.00","logintime":"0","loginip":"","nickname":"","picture":"","age":"0","sex":"女","height":"0","weight":"","address":"","hoby":"","autograph":"爱上范特西","idcard":"http://pintu.hlhjapp.com/upload","certificate":"http://pintu.hlhjapp.com/upload","lat":"30.53422356","lon":"104.06913757","lct_time":"1502087050","base_fee":"80.00","time_fee":"100.00","onduty":"1","message_permit":"1","judge":[{"jg_id":"2","guidename":"13028194826","username":"17781481226","star":"0","content":"","jg_time":"","order_id":"0","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"3","guidename":"13028194826","username":"17781481226","star":"0","content":null,"jg_time":"","order_id":"0","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"4","guidename":"13028194826","username":"17781481226","star":"3","content":"不满意","jg_time":"1501837127","order_id":"0","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"6","guidename":"13028194826","username":"17781481226","star":"5","content":"你他妈","jg_time":"1502091168","order_id":"2147483647","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"7","guidename":"13028194826","username":"17781481226","star":"5","content":"再次贫困","jg_time":"1502091306","order_id":"2147483647","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"8","guidename":"13028194826","username":"17781481226","star":"5","content":"恩","jg_time":"1502091544","order_id":"2","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"9","guidename":"13028194826","username":"17781481226","star":"5","content":"恩","jg_time":"1502091552","order_id":"2","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"}]}
*/
private int code;
private String msg;
/**
* user_id : 17
* username : 13028194826
* password : 123456
* type : 2
* amount : 0.00
* logintime : 0
* loginip :
* nickname :
* picture :
* age : 0
* sex : 女
* height : 0
* weight :
* address :
* hoby :
* autograph : 爱上范特西
* idcard : http://pintu.hlhjapp.com/upload
* certificate : http://pintu.hlhjapp.com/upload
* lat : 30.53422356
* lon : 104.06913757
* lct_time : 1502087050
* base_fee : 80.00
* time_fee : 100.00
* onduty : 1
* message_permit : 1
* judge : [{"jg_id":"2","guidename":"13028194826","username":"17781481226","star":"0","content":"","jg_time":"","order_id":"0","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"3","guidename":"13028194826","username":"17781481226","star":"0","content":null,"jg_time":"","order_id":"0","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"4","guidename":"13028194826","username":"17781481226","star":"3","content":"不满意","jg_time":"1501837127","order_id":"0","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"6","guidename":"13028194826","username":"17781481226","star":"5","content":"你他妈","jg_time":"1502091168","order_id":"2147483647","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"7","guidename":"13028194826","username":"17781481226","star":"5","content":"再次贫困","jg_time":"1502091306","order_id":"2147483647","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"8","guidename":"13028194826","username":"17781481226","star":"5","content":"恩","jg_time":"1502091544","order_id":"2","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"},{"jg_id":"9","guidename":"13028194826","username":"17781481226","star":"5","content":"恩","jg_time":"1502091552","order_id":"2","status":"1","nickname":"Tom","picture":"http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png"}]
*/
private ReturnArrBean returnArr;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public ReturnArrBean getReturnArr() {
return returnArr;
}
public void setReturnArr(ReturnArrBean returnArr) {
this.returnArr = returnArr;
}
public static class ReturnArrBean {
private String user_id;
private String username;
private String password;
private String type;
private String amount;
private String logintime;
private String loginip;
private String nickname;
private String picture;
private String age;
private String sex;
private String height;
private String weight;
private String address;
private String hoby;
private String autograph;
private String idcard;
private String certificate;
private String lat;
private String lon;
private String level;
private String lct_time;
private String base_fee;
private String time_fee;
private String onduty;
private String average_score;
private String message_permit;
private String countorder;
private String fengcai_url;
private String skill;
private String introduce;
private int is_guanzhu;
private String pindan_peoplenumber;
private String pindan_permit;
public String getPindan_permit() {
return pindan_permit;
}
public void setPindan_permit(String pindan_permit) {
this.pindan_permit = pindan_permit;
}
public String getPindan_peoplenumber() {
return pindan_peoplenumber;
}
public void setPindan_peoplenumber(String pindan_peoplenumber) {
this.pindan_peoplenumber = pindan_peoplenumber;
}
public int getIs_guanzhu() {
return is_guanzhu;
}
public void setIs_guanzhu(int is_guanzhu) {
this.is_guanzhu = is_guanzhu;
}
public String getSkill() {
return skill;
}
public void setSkill(String skill) {
this.skill = skill;
}
public String getIntroduce() {
return introduce;
}
public void setIntroduce(String introduce) {
this.introduce = introduce;
}
public String getFengcai_url() {
return fengcai_url;
}
public void setFengcai_url(String fengcai_url) {
this.fengcai_url = fengcai_url;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getCountorder() {
return countorder;
}
public void setCountorder(String countorder) {
this.countorder = countorder;
}
public String getAverage_score() {
return average_score;
}
public void setAverage_score(String average_score) {
this.average_score = average_score;
}
/**
* jg_id : 2
* guidename : 13028194826
* username : 17781481226
* star : 0
* content :
* jg_time :
* order_id : 0
* status : 1
* nickname : Tom
* picture : http://pintu.hlhjapp.com/upload/2017-07-262017-07-26/5978590ab5ad5.png
*/
private List<JudgeBean> judge;
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getLogintime() {
return logintime;
}
public void setLogintime(String logintime) {
this.logintime = logintime;
}
public String getLoginip() {
return loginip;
}
public void setLoginip(String loginip) {
this.loginip = loginip;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getPicture() {
return picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
public String getWeight() {
return weight;
}
public void setWeight(String weight) {
this.weight = weight;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getHoby() {
return hoby;
}
public void setHoby(String hoby) {
this.hoby = hoby;
}
public String getAutograph() {
return autograph;
}
public void setAutograph(String autograph) {
this.autograph = autograph;
}
public String getIdcard() {
return idcard;
}
public void setIdcard(String idcard) {
this.idcard = idcard;
}
public String getCertificate() {
return certificate;
}
public void setCertificate(String certificate) {
this.certificate = certificate;
}
public String getLat() {
return lat;
}
public void setLat(String lat) {
this.lat = lat;
}
public String getLon() {
return lon;
}
public void setLon(String lon) {
this.lon = lon;
}
public String getLct_time() {
return lct_time;
}
public void setLct_time(String lct_time) {
this.lct_time = lct_time;
}
public String getBase_fee() {
return base_fee;
}
public void setBase_fee(String base_fee) {
this.base_fee = base_fee;
}
public String getTime_fee() {
return time_fee;
}
public void setTime_fee(String time_fee) {
this.time_fee = time_fee;
}
public String getOnduty() {
return onduty;
}
public void setOnduty(String onduty) {
this.onduty = onduty;
}
public String getMessage_permit() {
return message_permit;
}
public void setMessage_permit(String message_permit) {
this.message_permit = message_permit;
}
public List<JudgeBean> getJudge() {
return judge;
}
public void setJudge(List<JudgeBean> judge) {
this.judge = judge;
}
public static class JudgeBean {
private String jg_id;
private String guidename;
private String username;
private String star;
private String content;
private String jg_time;
private String order_id;
private String status;
private String nickname;
private String picture;
public String getJg_id() {
return jg_id;
}
public void setJg_id(String jg_id) {
this.jg_id = jg_id;
}
public String getGuidename() {
return guidename;
}
public void setGuidename(String guidename) {
this.guidename = guidename;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getStar() {
return star;
}
public void setStar(String star) {
this.star = star;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getJg_time() {
return jg_time;
}
public void setJg_time(String jg_time) {
this.jg_time = jg_time;
}
public String getOrder_id() {
return order_id;
}
public void setOrder_id(String order_id) {
this.order_id = order_id;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getPicture() {
return picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
}
}
}
|
[
"[email protected]"
] | |
ec8330bc032304a5769b5c605dbc089e32aa1f82
|
ad9e231e510fd73ab8381f93a408d13a782b7946
|
/src/test/java/com/kakaopay/fds/core/rule/RuleATest.java
|
2cb1e1092082ac6ca5d34548bd5af7b4bb0dd10f
|
[] |
no_license
|
qhdrl12/fds
|
492a1c3232e6d11c970f17be7231754eb08969d3
|
ad641cfaeabbb7ccd1c5e2e1890d4cd3a2ae49db
|
refs/heads/master
| 2020-03-27T22:48:37.710442 | 2018-09-03T23:45:40 | 2018-09-03T23:45:40 | 147,024,958 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,816 |
java
|
package com.kakaopay.fds.core.rule;
import com.kakaopay.fds.api.repository.KakaoChargeLogRepository;
import com.kakaopay.fds.api.repository.KakaoReceiverLogRepository;
import com.kakaopay.fds.api.repository.KakaoSenderLogRepository;
import com.kakaopay.fds.api.repository.KakaoServiceAccountOpenLogRepository;
import com.kakaopay.fds.core.KakaoLogSetup;
import com.kakaopay.fds.core.dto.KakaoMoneyLog;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest
public class RuleATest {
@Autowired
KakaoServiceAccountOpenLogRepository kakaoServiceAccountOpenLogRepository;
@Autowired
KakaoChargeLogRepository kakaoChargeLogRepository;
@Autowired
KakaoSenderLogRepository kakaoSenderLogRepository;
@Autowired
KakaoReceiverLogRepository kakaoReceiverLogRepository;
private static List<KakaoMoneyLog> kakaoMoneyLogs = new ArrayList<>();
private static Rule rule;
@Before
public void setup() {
rule = new RuleA();
KakaoLogSetup kakaoLogSetup = new KakaoLogSetup(kakaoServiceAccountOpenLogRepository, kakaoChargeLogRepository, kakaoSenderLogRepository, kakaoReceiverLogRepository);
kakaoMoneyLogs = kakaoLogSetup.getKakaoMoneyLogs();
}
@Test
public void 룰_검사() {
assertThat(rule.isMatch(kakaoMoneyLogs)).isTrue();
}
@Test
public void LOG_데이터가_없을경우() {
assertThat(rule.isMatch(new ArrayList<>())).isFalse();
}
}
|
[
"[email protected]"
] | |
c403bc11242cda9741402f896feb4c8a679e8f13
|
c0bfa317d27128479a13f0ea30b60ef9f756bde6
|
/PracaDomowa_3/src/Ogloszenie.java
|
2e25656d194be2eed575506cccf6bc46535dec74
|
[] |
no_license
|
LukaszSajenko/exercises
|
b6910c0afa341ed9395e88fd430f44d4298f914f
|
89c1b903d80fc800b6c4885cb6318ce1e8378c9c
|
refs/heads/master
| 2021-05-14T10:46:01.521673 | 2018-01-05T08:42:16 | 2018-01-05T08:42:16 | 116,361,933 | 0 | 0 | null | null | null | null |
WINDOWS-1250
|
Java
| false | false | 603 |
java
|
public class Ogloszenie {
private String tytul, opis;
private int cena;
public Ogloszenie(String t, String o, int c) {
tytul = t;
opis = o;
cena = c;
}
public Ogloszenie() {
}
public String toString() {
return "Ogłoszenie " + tytul + " " + opis + " Dom kosztuje " + cena + " zł.";
}
public String getTytul() {
return tytul;
}
public void setTytul(String tytul) {
this.tytul = tytul;
}
public String getOpis() {
return opis;
}
public void setOpis(String opis) {
this.opis = opis;
}
public int getCena() {
return cena;
}
public void setCena(int cena) {
this.cena = cena;
}
}
|
[
"[email protected]"
] | |
162b217e40218e7fd6d33599f34f709853e525f8
|
6d1419ac75e9e3412895e2ca1a502f2893187eca
|
/src/main/java/com/ontotoone/last/Instructordetail.java
|
c2cde7f16c671bdf886086f5c9ad623411c6f3f4
|
[] |
no_license
|
sunilhn27/Hibernate
|
45bb5429ad31fc7e009d275a1c86f7a3c8cffcd9
|
7418def37bfc37eb4ac8caaafbcf3666cbeff4b0
|
refs/heads/master
| 2023-01-10T01:30:42.852006 | 2018-04-10T18:56:20 | 2018-04-10T18:56:20 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,322 |
java
|
package com.ontotoone.last;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "instructor_detail")
public class Instructordetail {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "youtube_channel")
private String youtubechannel;
public Instructor getInstructor() {
return instructor;
}
public void setInstructor(Instructor instructor) {
this.instructor = instructor;
}
@Column(name = "hobby")
private String hobby;
@OneToOne(mappedBy = "instructordetails")
private Instructor instructor;
public Instructordetail() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getYoutubechannel() {
return youtubechannel;
}
public void setYoutubechannel(String youtubechannel) {
this.youtubechannel = youtubechannel;
}
public String getHobby() {
return hobby;
}
public void setHobby(String hobby) {
this.hobby = hobby;
}
public Instructordetail(String youtubechannel, String hobby) {
this.youtubechannel = youtubechannel;
this.hobby = hobby;
}
}
|
[
"[email protected]"
] | |
aeb43ed0b79c5188b5c375cc13a1178ac331222e
|
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
|
/benchmark/test/uk/gov/gchq/gaffer/federatedstore/operation/FederatedOperationChainTest.java
|
e405f5e103cfb0eddb5f75ecb484f332e1813e80
|
[] |
no_license
|
STAMP-project/dspot-experiments
|
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
|
121487e65cdce6988081b67f21bbc6731354a47f
|
refs/heads/master
| 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null |
UTF-8
|
Java
| false | false | 5,310 |
java
|
/**
* Copyright 2017-2019 Crown Copyright
*
* 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 uk.gov.gchq.gaffer.federatedstore.operation;
import org.junit.Assert;
import org.junit.Test;
import uk.gov.gchq.gaffer.commonutil.StringUtil;
import uk.gov.gchq.gaffer.commonutil.iterable.CloseableIterable;
import uk.gov.gchq.gaffer.data.element.Element;
import uk.gov.gchq.gaffer.operation.OperationChain;
import uk.gov.gchq.gaffer.operation.OperationTest;
import uk.gov.gchq.gaffer.operation.impl.get.GetAllElements;
public class FederatedOperationChainTest extends OperationTest<FederatedOperationChain> {
@Test
@Override
public void shouldShallowCloneOperation() {
// Given
final OperationChain<CloseableIterable<? extends Element>> opChain = new OperationChain.Builder().first(new GetAllElements()).build();
final FederatedOperationChain op = new FederatedOperationChain.Builder<>().operationChain(opChain).option("key", "value").build();
// When
final FederatedOperationChain clone = op.shallowClone();
// Then
Assert.assertNotSame(op.getOperationChain(), clone.getOperationChain());
Assert.assertEquals(1, clone.getOperationChain().getOperations().size());
Assert.assertEquals(GetAllElements.class, clone.getOperationChain().getOperations().get(0).getClass());
Assert.assertEquals("value", clone.getOption("key"));
}
@Test
public void shouldThrowAnErrorIfJsonDeserialiseWithoutOperationChain() {
// Given
final String json = String.format(("{%n" + ((((" \"class\" : \"uk.gov.gchq.gaffer.federatedstore.operation.FederatedOperationChain\",%n" + " \"options\" : {%n") + " \"key\" : \"value\"%n") + " }%n") + "}")));
// When / Then
try {
fromJson(StringUtil.toBytes(json));
Assert.fail("Exception expected");
} catch (final RuntimeException e) {
Assert.assertTrue(e.getMessage().contains("operationChain is required"));
}
}
@Test
public void shouldJsonDeserialiseWithInvalidOperationChainClassName() {
// Given
final String json = String.format(("{%n" + ((((((((((" \"class\" : \"uk.gov.gchq.gaffer.federatedstore.operation.FederatedOperationChain\",%n" + " \"operationChain\" : {%n") + " \"class\" : \"uk.gov.gchq.gaffer.operation.OperationChainInvalidClassName\",%n") + " \"operations\" : [ {%n") + " \"class\" : \"uk.gov.gchq.gaffer.operation.impl.get.GetAllElements\"%n") + " } ]%n") + " },%n") + " \"options\" : {%n") + " \"key\" : \"value\"%n") + " }%n") + "}")));
// When / Then
try {
fromJson(StringUtil.toBytes(json));
Assert.fail("Exception expected");
} catch (final RuntimeException e) {
Assert.assertTrue(e.getMessage().contains("Class name should be"));
}
}
@Test
public void shouldJsonDeserialiseWithOperationChainClassName() {
// Given
final String json = String.format(("{%n" + ((((((((((" \"class\" : \"uk.gov.gchq.gaffer.federatedstore.operation.FederatedOperationChain\",%n" + " \"operationChain\" : {%n") + " \"class\" : \"uk.gov.gchq.gaffer.operation.OperationChain\",%n") + " \"operations\" : [ {%n") + " \"class\" : \"uk.gov.gchq.gaffer.operation.impl.get.GetAllElements\"%n") + " } ]%n") + " },%n") + " \"options\" : {%n") + " \"key\" : \"value\"%n") + " }%n") + "}")));
// When
final FederatedOperationChain deserialisedOp = fromJson(StringUtil.toBytes(json));
// Then
Assert.assertEquals(1, deserialisedOp.getOperationChain().getOperations().size());
Assert.assertEquals(GetAllElements.class, deserialisedOp.getOperationChain().getOperations().get(0).getClass());
Assert.assertEquals("value", deserialisedOp.getOption("key"));
}
@Test
public void shouldJsonDeserialiseWithoutOperationChainClassName() {
// Given
final String json = String.format(("{%n" + (((((((((" \"class\" : \"uk.gov.gchq.gaffer.federatedstore.operation.FederatedOperationChain\",%n" + " \"operationChain\" : {%n") + " \"operations\" : [ {%n") + " \"class\" : \"uk.gov.gchq.gaffer.operation.impl.get.GetAllElements\"%n") + " } ]%n") + " },%n") + " \"options\" : {%n") + " \"key\" : \"value\"%n") + " }%n") + "}")));
// When
final FederatedOperationChain deserialisedOp = fromJson(StringUtil.toBytes(json));
// Then
Assert.assertEquals(1, deserialisedOp.getOperationChain().getOperations().size());
Assert.assertEquals(GetAllElements.class, deserialisedOp.getOperationChain().getOperations().get(0).getClass());
Assert.assertEquals("value", deserialisedOp.getOption("key"));
}
}
|
[
"[email protected]"
] | |
eac10958767af2be61693d25afc1915cfdf7e22c
|
10378c580b62125a184f74f595d2c37be90a5769
|
/com/google/common/base/Strings.java
|
baf4ebc0e8d780f780705962499bea1d4856f668
|
[] |
no_license
|
ClientPlayground/Melon-Client
|
4299d7f3e8f2446ae9f225c0d7fcc770d4d48ecb
|
afc9b11493e15745b78dec1c2b62bb9e01573c3d
|
refs/heads/beta-v2
| 2023-04-05T20:17:00.521159 | 2021-03-14T19:13:31 | 2021-03-14T19:13:31 | 347,509,882 | 33 | 19 | null | 2021-03-14T19:13:32 | 2021-03-14T00:27:40 | null |
UTF-8
|
Java
| false | false | 3,272 |
java
|
package com.google.common.base;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.VisibleForTesting;
import javax.annotation.Nullable;
@GwtCompatible
public final class Strings {
public static String nullToEmpty(@Nullable String string) {
return (string == null) ? "" : string;
}
@Nullable
public static String emptyToNull(@Nullable String string) {
return isNullOrEmpty(string) ? null : string;
}
public static boolean isNullOrEmpty(@Nullable String string) {
return (string == null || string.length() == 0);
}
public static String padStart(String string, int minLength, char padChar) {
Preconditions.checkNotNull(string);
if (string.length() >= minLength)
return string;
StringBuilder sb = new StringBuilder(minLength);
for (int i = string.length(); i < minLength; i++)
sb.append(padChar);
sb.append(string);
return sb.toString();
}
public static String padEnd(String string, int minLength, char padChar) {
Preconditions.checkNotNull(string);
if (string.length() >= minLength)
return string;
StringBuilder sb = new StringBuilder(minLength);
sb.append(string);
for (int i = string.length(); i < minLength; i++)
sb.append(padChar);
return sb.toString();
}
public static String repeat(String string, int count) {
Preconditions.checkNotNull(string);
if (count <= 1) {
Preconditions.checkArgument((count >= 0), "invalid count: %s", new Object[] { Integer.valueOf(count) });
return (count == 0) ? "" : string;
}
int len = string.length();
long longSize = len * count;
int size = (int)longSize;
if (size != longSize)
throw new ArrayIndexOutOfBoundsException("Required array size too large: " + longSize);
char[] array = new char[size];
string.getChars(0, len, array, 0);
int n;
for (n = len; n < size - n; n <<= 1)
System.arraycopy(array, 0, array, n, n);
System.arraycopy(array, 0, array, n, size - n);
return new String(array);
}
public static String commonPrefix(CharSequence a, CharSequence b) {
Preconditions.checkNotNull(a);
Preconditions.checkNotNull(b);
int maxPrefixLength = Math.min(a.length(), b.length());
int p = 0;
while (p < maxPrefixLength && a.charAt(p) == b.charAt(p))
p++;
if (validSurrogatePairAt(a, p - 1) || validSurrogatePairAt(b, p - 1))
p--;
return a.subSequence(0, p).toString();
}
public static String commonSuffix(CharSequence a, CharSequence b) {
Preconditions.checkNotNull(a);
Preconditions.checkNotNull(b);
int maxSuffixLength = Math.min(a.length(), b.length());
int s = 0;
while (s < maxSuffixLength && a.charAt(a.length() - s - 1) == b.charAt(b.length() - s - 1))
s++;
if (validSurrogatePairAt(a, a.length() - s - 1) || validSurrogatePairAt(b, b.length() - s - 1))
s--;
return a.subSequence(a.length() - s, a.length()).toString();
}
@VisibleForTesting
static boolean validSurrogatePairAt(CharSequence string, int index) {
return (index >= 0 && index <= string.length() - 2 && Character.isHighSurrogate(string.charAt(index)) && Character.isLowSurrogate(string.charAt(index + 1)));
}
}
|
[
"[email protected]"
] | |
6dd5cf6ae467a6fc4b05a5e4ad1a2e78427c7d74
|
92e64a750e6a994927c006e7dcb5647bccd73ec2
|
/app/src/main/java/com/minicup/junittest/Calculator.java
|
4c1aef952567f2d80a9c30b0b3fbfc0c14c3bb52
|
[] |
no_license
|
daydreamer1988/Junit
|
46fa446977238565e2430a8248c0f2962cf88072
|
476898a6aff3bcd15fbfabaa6450f67bcac156cc
|
refs/heads/master
| 2021-05-08T12:42:47.790167 | 2018-02-02T09:05:17 | 2018-02-02T09:05:17 | 119,958,599 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 230 |
java
|
package com.minicup.junittest;
/**
* Created by gy on 2018/1/31.
*/
public class Calculator {
public int add(int a, int b){
return a + b;
}
public int minus(int a, int b){
return a - b;
}
}
|
[
"[email protected]"
] | |
55e9e56cc5f32df02ab49bb8a744f5026a34ab9c
|
82fa5da43f3d7b3fe6ada9859214408e83250ff3
|
/ProyectoMvcBoot/src/main/java/es/IMFE/refugio/model/Usuario.java
|
df93ad166f702833da8bcefae811f7e5cf851798
|
[] |
no_license
|
marikar93/MariCarmenTorres
|
108f16cf1641b8a273c916bddf0cd19e74513b3c
|
d8843b2e1ad283d6544fac37c21145fd67438af8
|
refs/heads/master
| 2020-04-05T12:43:37.662730 | 2018-12-20T16:10:23 | 2018-12-20T16:10:23 | 156,872,796 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,375 |
java
|
package es.IMFE.refugio.model;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
/**
* Clase para crear un usuario
* @author Mari
*
*/
@Entity
@Table(name="usuario")
public class Usuario {
//Atributos
private Integer idusuario;
private String user;
private String pass;
private String dni;
private String nombre;
private String correo;
private Integer telefono;
private String direccion;
private Integer numsocio;
private TipoUsuario tipoUsuario;
//Atributo para one to many
private Set<Animal> adoptados;
//Getters and Setters
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Integer getIdusuario() {
return idusuario;
}
public void setIdusuario(Integer idusuario) {
this.idusuario = idusuario;
}
@NotEmpty
@Length(max=45)
@Column(name = "user", nullable = false, length = 45)
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
@NotEmpty
@Length(max=45)
@Column(name = "pass", nullable = false, length = 45)
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
@NotEmpty
@Length(max=9)
@Column(name = "dni", nullable = false, length = 9)
public String getDni() {
return dni;
}
public void setDni(String dni) {
this.dni = dni;
}
@NotEmpty
@Length(max=255)
@Column(name = "nombre", nullable = false, length = 255)
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
@Length(max=45)
@Column(name = "correo", length = 45)
public String getCorreo() {
return correo;
}
public void setCorreo(String correo) {
this.correo = correo;
}
@NotNull
@Column(name = "telefono", nullable = false)
public Integer getTelefono() {
return telefono;
}
public void setTelefono(Integer telefono) {
this.telefono = telefono;
}
@NotEmpty
@Length(max=255)
@Column(name = "direccion", nullable = false, length = 255)
public String getDireccion() {
return direccion;
}
public void setDireccion(String direccion) {
this.direccion = direccion;
}
@Column(name = "numsocio")
public Integer getNumsocio() {
return numsocio;
}
public void setNumsocio(Integer numsocio) {
this.numsocio = numsocio;
}
//Relacion many to one
@NotNull
@ManyToOne
@JoinColumn(name="idtipo", nullable=false)
public TipoUsuario getTipoUsuario() {
return tipoUsuario;
}
public void setTipoUsuario(TipoUsuario tipoUsuario) {
this.tipoUsuario = tipoUsuario;
}
//Relacion one to many
@OneToMany(fetch=FetchType.EAGER, mappedBy="usuario")
public Set<Animal> getAdoptados() {
return adoptados;
}
public void setAdoptados(Set<Animal> adoptados) {
this.adoptados = adoptados;
}
}
|
[
"[email protected]"
] | |
4d89e8267b9d19c8b8e7cc2d7058e83b86eb3448
|
192a4b56d9bff1a4591d26e3c8111564ca93dfa1
|
/basic/src/control/Gugudan1.java
|
ca570b6183e3f638a939f4d90e780061f6086b6b
|
[] |
no_license
|
yunhy97/Java_workspace
|
e852cdcdeb9a348a82e7c1a01216a77288a09d2a
|
b5ebb60a98f23607f16aeffaa731138289088299
|
refs/heads/master
| 2022-11-16T04:05:01.341520 | 2020-07-20T00:31:28 | 2020-07-20T00:31:28 | 280,975,796 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 411 |
java
|
package control;
import java.util.Scanner;
public class Gugudan1 {
public static void main(String[] args) {
//숫자를 입력받아서 해당 숫자에 대한 구구단을 출력하기
Scanner sc = new Scanner(System.in);
System.out.print("출력할 숫자를 입력하세요: ");
int num = sc.nextInt();
for(int i=1; i<=9;i++) {
System.out.println(num+"*"+i+"="+(num*i));
}
}
}
|
[
"[email protected]"
] | |
51e1a0efd425b40a61acf2ca4082a8a416c5ea53
|
38ad02955e1b536f3ed44168497aa9883767684e
|
/src/util/ariba/util/core/GlobalLockingService.java
|
08dea2275cf1196317bf5378dcf062f205c1fb31
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
kabassociates/aribaweb
|
576e3b10759ecd484b967af8f4f8affb66630c3c
|
1b71afcff218ce53ec3a903d31dc36e1c86cfe88
|
refs/heads/master
| 2021-01-01T06:10:30.599588 | 2013-06-09T19:24:24 | 2013-06-09T19:24:24 | 10,587,828 | 0 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,786 |
java
|
/*
Copyright 1996-2008 Ariba, 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.
$Id: //ariba/platform/util/core/ariba/util/core/GlobalLockingService.java#5 $
*/
package ariba.util.core;
/**
provide services for acquiring global locks and creating
lock groups. Global Locks provide cluster-wide synchronization.
. A lock is identified by its name. The name must be unique.
. A lock is represented by a lock object. There can be only
one valid (i.e. locked and unexpired) lock object for the lock
throughout the cluster.
. You can obtain a lock only if it is currently unlocked.
. A lock is created if it does not exist. It is created in the
locked state.
. Each lock has a specific lifetime. If that lifetime is
exceeded, the lock expires, and becomes unlocked.
. A lock is acquired with the default lifetime (currently 2 minutes).
The lifetime must be extended if the lock is to be held longer
than that.
. If a lock expires, a cleanup notification will be sent when the
lock is next acquired. The notification is posted on a local
topic to the default Notification Center.
. All lock operations other than acquiring the lock are performed
on the lock object.
. All operations on an invalid (expired or released) lock object
throw an exception.
. No synchronization is done on any of these methods. If the user
wishes to share a lock object between threads on a node, the
user is responsible for proper synchronization.
. An acquired lock can be added to a Lock Group. Once added,
the lock can be later acquired through a request to the Lock Group.
. When a node goes down, all locks acquired by that node become
expired. However, the lock may not become available until the
node restarts. This means that a lock that becomes available
due to a node crashing will always have the cleanup notification
sent when the lock is next acquired.
. On Cluster Restart, Global Locking is initialized (i.e. there are
no locks, and there are no lock groups). This is necessary, or
else creating new Lock Groups with different numbers of locks
becomes unnecessarily complicated.
@aribaapi ariba
*/
public interface GlobalLockingService
{
/**
Acquire requested GlobalLock. If the lock does not
exist, it is created and obtained. Return immediately if
the lock is not available.
@param lockName The name of the lock. Must be unique
@return The lock object, or null if the lock is not free
*/
public GlobalLock acquireLock (String lockName);
/**
Aacquire requested GlobalLock with an acquistion timeout.
If the lock does not exist, it is created and obtained.
Try to obtain the lock for specified number of milliseconds,
then return a null if the lock is not available.
@param lockName The name of the lock. Must be unique
@param acquireTimeout The number of milliseconds to try for
@return The lock object, or null if the lock is not free
*/
public GlobalLock acquireLock (String lockName, long acquireTimeout);
/**
Acquire a lock from the requested lock group. The lock group
must exist, and there must be locks assigned to it. Returns
immediatley if no lock is available
@param groupName The lock group
@return The lock object if one is available, null otherwise
@exception GlobalLockingException thrown if the lock group does
not exist, or if there are no locks assigned to the group.
*/
public GlobalLock acquireLockFromGroup (String groupName)
throws GlobalLockingException;
/**
Acquire a lock from the requested lock group. The lock group
must exist, and there must be locks assigned to it. Try to obtain
the lock for acquireTimeOut milliseconds before returning.
@param groupName The lock group
@param acquireTimeout The number of milliseconds to try to obtain
the lock
@return The lock object if one is available, null otherwise
@exception GlobalLockingException thrown if the lock group does
not exist, or if there are no locks assigned to the group.
*/
public GlobalLock acquireLockFromGroup (String groupName,
long acquireTimeout)
throws GlobalLockingException;
/**
Create a new lock group, and allow numLocks locks to be assigned
to it. The name must be unique
@param groupName The name of the group
@param numLocks How many locks can be in this group
@exception GlobalLockingException if the group already exists
*/
public void createLockGroup (String groupName, int numLocks)
throws GlobalLockingException;
/**
Create a new lockgroup, and a pool of locks for it. The
locks are given the name <groupName>Lock<n>, and are added to
the group. Each lock is then released. When this call successfully
completes, you may immediately acquire locks by calling
acquireLockFromGroup.
@param groupName The name of the group to create
@param numLocks How many locks to create
@exception GlobalLockingException if the group already exists, or
if any of the locks associated with the group already exits and are
assigned to the group.
*/
public void createLockPool (String groupName, int numLocks)
throws GlobalLockingException;
/**
Delete the specified lock group. The lock group can be
deleted only if all the locks in the group are free. If any
of the locks are not free, the lockgroup is not deleted.
@param groupName The name of the group to delete
@exception GlobalLockingException if the group does not exist,
or if any of the locks within the group are locked or expired.
*/
public void deleteLockGroup (String groupName)
throws GlobalLockingException;
public final static String CleanupTopic =
"ariba.util.GlobalLocking.Cleanup";
}
|
[
"[email protected]"
] | |
c103cedd6e15a11e3b373e97f8021a64a4f2afb7
|
6d208b9d0828f63a8c3fb69266fc31ae1142355d
|
/src/main/java/io/swagger/api/CustomerAccountApiController.java
|
69e964f4ae2bc23e62d312fd101b026b9483e045
|
[] |
no_license
|
Philin92/JD2_PROJECT
|
8021778daeae0da42f98f8a0d8b86be033e83bf4
|
7748b711d1e7441c6cc71f2fc8221f96c12c89fd
|
refs/heads/master
| 2020-04-10T16:59:22.505404 | 2019-01-22T20:07:42 | 2019-01-22T20:07:42 | 161,161,385 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 49,007 |
java
|
package io.swagger.api;
import io.swagger.model.CustomerAccount;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*;
import io.swagger.model.CustomerAccountTaxExemption;
import io.swagger.services.interfaces.CustomerAccountService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-12-08T11:08:14.094+03:00")
@Controller
public class CustomerAccountApiController implements CustomerAccountApi {
private static final Logger log = LoggerFactory.getLogger(CustomerAccountApiController.class);
private final ObjectMapper objectMapper;
private final HttpServletRequest request;
@Autowired
private CustomerAccountService customerAccountHibService;
@org.springframework.beans.factory.annotation.Autowired
public CustomerAccountApiController(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper;
this.request = request;
}
private CustomerAccount customerAccount(String prefix){
CustomerAccount customerAccount = new CustomerAccount();
CustomerAccountTaxExemption taxExemption1 = new CustomerAccountTaxExemption();
CustomerAccountTaxExemption taxExemption2 = new CustomerAccountTaxExemption();
taxExemption1.setCertificateNumber("1232444"+prefix);
taxExemption1.setIssuingJurisdiction("urisdiction"+prefix);
taxExemption1.setReason("reason"+prefix);
taxExemption2.setCertificateNumber("923269874"+prefix);
taxExemption2.setIssuingJurisdiction("urisdiction22"+prefix);
taxExemption2.setReason("reason22"+prefix);
customerAccount.setName("CustomerAccount"+prefix);
customerAccount.setDescription("Description"+prefix);
customerAccount.setCreditLimit("10000"+prefix);
customerAccount.setCustomerAccountTaxExemption(List.of(taxExemption1,taxExemption2));
return customerAccount;
}
public ResponseEntity<CustomerAccount> customerAccountCreate(@ApiParam(value = "" ,required=true ) @Valid @RequestBody CustomerAccount customerAccount) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
//return new ResponseEntity<CustomerAccount>(objectMapper.readValue("{ \"paymentPlan\" : [ { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" }, { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" } ], \"accountType\" : \"accountType\", \"receivableBalance\" : 1.4658129, \"description\" : \"description\", \"pin\" : \"pin\", \"customerAccountRelationship\" : [ { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] }, { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] } ], \"contact\" : [ { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } }, { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } } ], \"name\" : \"name\", \"creditLimit\" : \"creditLimit\", \"customerAccountTaxExemption\" : [ { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" }, { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" } ], \"customerAccountBalance\" : [ { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" }, { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" } ], \"id\" : 6, \"href\" : \"href\", \"lastModified\" : \"2000-01-23T04:56:07.000+00:00\", \"status\" : \"status\", \"customer\" : { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\" }}", CustomerAccount.class), HttpStatus.NOT_IMPLEMENTED);
CustomerAccount newCustomerAccount = new CustomerAccount();
BeanUtils.copyProperties(customerAccount, newCustomerAccount);
customerAccountHibService.saveOrUpdate(newCustomerAccount);
return new ResponseEntity<CustomerAccount>(HttpStatus.OK);
} catch (Exception e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<CustomerAccount>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<CustomerAccount>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<Void> customerAccountDelete(@ApiParam(value = "",required=true) @PathVariable("customerAccountId") String customerAccountId) {
String accept = request.getHeader("Accept");
try {
Long id = Long.valueOf(customerAccountId);
customerAccountHibService.deleteById(id);
return new ResponseEntity<Void>(HttpStatus.OK);
} catch (Exception e) {
e.printStackTrace();
}
return new ResponseEntity<Void>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<List<CustomerAccount>> customerAccountFind(@ApiParam(value = "") @Valid @RequestParam(value = "fields", required = false) String fields) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
return new ResponseEntity<List<CustomerAccount>>(
customerAccountHibService.findList(),HttpStatus.OK
);
//return new ResponseEntity<List<CustomerAccount>>(objectMapper.readValue("[ { \"paymentPlan\" : [ { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" }, { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" } ], \"accountType\" : \"accountType\", \"receivableBalance\" : 1.4658129, \"description\" : \"description\", \"pin\" : \"pin\", \"customerAccountRelationship\" : [ { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] }, { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] } ], \"contact\" : [ { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } }, { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } } ], \"name\" : \"name\", \"creditLimit\" : \"creditLimit\", \"customerAccountTaxExemption\" : [ { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" }, { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" } ], \"customerAccountBalance\" : [ { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" }, { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" } ], \"id\" : 6, \"href\" : \"href\", \"lastModified\" : \"2000-01-23T04:56:07.000+00:00\", \"status\" : \"status\", \"customer\" : { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\" }}, { \"paymentPlan\" : [ { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" }, { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" } ], \"accountType\" : \"accountType\", \"receivableBalance\" : 1.4658129, \"description\" : \"description\", \"pin\" : \"pin\", \"customerAccountRelationship\" : [ { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] }, { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] } ], \"contact\" : [ { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } }, { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } } ], \"name\" : \"name\", \"creditLimit\" : \"creditLimit\", \"customerAccountTaxExemption\" : [ { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" }, { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" } ], \"customerAccountBalance\" : [ { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" }, { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" } ], \"id\" : 6, \"href\" : \"href\", \"lastModified\" : \"2000-01-23T04:56:07.000+00:00\", \"status\" : \"status\", \"customer\" : { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\" }} ]", List.class), HttpStatus.NOT_IMPLEMENTED);
} catch (Exception e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<List<CustomerAccount>>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<List<CustomerAccount>>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<CustomerAccount> customerAccountGet(@ApiParam(value = "",required=true) @PathVariable("customerAccountId") String customerAccountId,@ApiParam(value = "") @Valid @RequestParam(value = "fields", required = false) String fields) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
Long id = Long.valueOf(customerAccountId);
return new ResponseEntity<CustomerAccount>(
customerAccountHibService.getById(id),HttpStatus.OK
);
//return new ResponseEntity<CustomerAccount>(objectMapper.readValue("{ \"paymentPlan\" : [ { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" }, { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" } ], \"accountType\" : \"accountType\", \"receivableBalance\" : 1.4658129, \"description\" : \"description\", \"pin\" : \"pin\", \"customerAccountRelationship\" : [ { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] }, { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] } ], \"contact\" : [ { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } }, { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } } ], \"name\" : \"name\", \"creditLimit\" : \"creditLimit\", \"customerAccountTaxExemption\" : [ { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" }, { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" } ], \"customerAccountBalance\" : [ { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" }, { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" } ], \"id\" : 6, \"href\" : \"href\", \"lastModified\" : \"2000-01-23T04:56:07.000+00:00\", \"status\" : \"status\", \"customer\" : { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\" }}", CustomerAccount.class), HttpStatus.NOT_IMPLEMENTED);
} catch (Exception e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<CustomerAccount>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<CustomerAccount>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<CustomerAccount> customerAccountPatch(@ApiParam(value = "",required=true) @PathVariable("customerAccountId") String customerAccountId,@ApiParam(value = "" ,required=true ) @Valid @RequestBody CustomerAccount customerAccount) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
Long id = Long.valueOf(customerAccountId);
CustomerAccount newCustomerAccount = new CustomerAccount();
BeanUtils.copyProperties(customerAccount, newCustomerAccount);
return new ResponseEntity<CustomerAccount>(
customerAccountHibService.patch(id,newCustomerAccount),HttpStatus.OK
);
//return new ResponseEntity<CustomerAccount>(objectMapper.readValue("{ \"paymentPlan\" : [ { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" }, { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" } ], \"accountType\" : \"accountType\", \"receivableBalance\" : 1.4658129, \"description\" : \"description\", \"pin\" : \"pin\", \"customerAccountRelationship\" : [ { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] }, { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] } ], \"contact\" : [ { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } }, { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } } ], \"name\" : \"name\", \"creditLimit\" : \"creditLimit\", \"customerAccountTaxExemption\" : [ { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" }, { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" } ], \"customerAccountBalance\" : [ { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" }, { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" } ], \"id\" : 6, \"href\" : \"href\", \"lastModified\" : \"2000-01-23T04:56:07.000+00:00\", \"status\" : \"status\", \"customer\" : { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\" }}", CustomerAccount.class), HttpStatus.NOT_IMPLEMENTED);
} catch (Exception e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<CustomerAccount>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<CustomerAccount>(HttpStatus.NOT_IMPLEMENTED);
}
public ResponseEntity<CustomerAccount> customerAccountUpdate(@ApiParam(value = "",required=true) @PathVariable("customerAccountId") String customerAccountId,@ApiParam(value = "" ,required=true ) @Valid @RequestBody CustomerAccount customerAccount) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
Long id = Long.valueOf(customerAccountId);
CustomerAccount update = new CustomerAccount();
BeanUtils.copyProperties(customerAccount, update);
update.setId(id);
return new ResponseEntity<CustomerAccount>(
customerAccountHibService.update(id,update),HttpStatus.OK
);
//return new ResponseEntity<CustomerAccount>(objectMapper.readValue("{ \"paymentPlan\" : [ { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" }, { \"numberOfPayments\" : \"numberOfPayments\", \"amount\" : 5.637377, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"paymentMean\" : { \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" }, \"type\" : \"type\", \"priority\" : \"priority\", \"paymentFrequency\" : \"paymentFrequency\", \"status\" : \"status\" } ], \"accountType\" : \"accountType\", \"receivableBalance\" : 1.4658129, \"description\" : \"description\", \"pin\" : \"pin\", \"customerAccountRelationship\" : [ { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] }, { \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"customerAccount\" : [ { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" }, { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\", \"status\" : \"status\" } ] } ], \"contact\" : [ { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } }, { \"contactMedium\" : [ { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" }, { \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"medium\" : { \"country\" : \"country\", \"number\" : \"number\", \"emailAddress\" : \"emailAddress\", \"streetTwo\" : \"streetTwo\", \"stateOrProvince\" : \"stateOrProvince\", \"city\" : \"city\", \"postcode\" : \"postcode\", \"streetOne\" : \"streetOne\", \"type\" : \"type\" }, \"type\" : \"type\", \"preferred\" : \"preferred\" } ], \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"contactName\" : \"contactName\", \"partyRoleType\" : \"partyRoleType\", \"contactType\" : \"contactType\", \"relatedParty\" : { \"role\" : \"role\", \"name\" : \"name\", \"id\" : \"id\", \"href\" : \"href\" } } ], \"name\" : \"name\", \"creditLimit\" : \"creditLimit\", \"customerAccountTaxExemption\" : [ { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" }, { \"reason\" : \"reason\", \"certificateNumber\" : \"certificateNumber\", \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"issuingJurisdiction\" : \"issuingJurisdiction\" } ], \"customerAccountBalance\" : [ { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" }, { \"amount\" : 5.962134, \"validFor\" : { \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\", \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\" }, \"type\" : \"type\", \"status\" : \"status\" } ], \"id\" : 6, \"href\" : \"href\", \"lastModified\" : \"2000-01-23T04:56:07.000+00:00\", \"status\" : \"status\", \"customer\" : { \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"id\", \"href\" : \"href\" }}", CustomerAccount.class), HttpStatus.NOT_IMPLEMENTED);
} catch (Exception e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<CustomerAccount>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new ResponseEntity<CustomerAccount>(HttpStatus.NOT_IMPLEMENTED);
}
}
|
[
"[email protected]"
] | |
6272ad1b7af1d5fb9bdb0f0a6d8d698b02c5c9fb
|
2d0aa33af96fecb942cb119fbbba281b14e998ed
|
/src/main/java/com/company/hrm/common/ResResult.java
|
9193074caf3d3190a15ed85c304d08aca47ea25e
|
[] |
no_license
|
Dhh666/HRM
|
7cc4a0c87ad37b697b8bcf8831d1004d6ae916ad
|
1082fdf9ec2d93b5e87d1f908686b9aeefff3683
|
refs/heads/master
| 2020-04-28T20:57:10.243156 | 2019-03-14T06:47:08 | 2019-03-14T06:47:08 | 175,563,460 | 0 | 0 | null | null | null | null |
GB18030
|
Java
| false | false | 1,381 |
java
|
package com.company.hrm.common;
import java.io.Serializable;
public class ResResult<T> implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L; //json传值 需要序列化
private Integer code;//integer返回值可为空
private String msg;
private T data;
public ResResult() {//有类要继承这个类的时候 ,一定要由无参构造
super();
}
public ResResult(Integer code, String msg, T data) {
super();
this.code = code;
this.msg = msg;
this.data = data;
}
public ResResult(Integer code, String msg) {
super();
this.code = code;
this.msg = msg;
}
public ResResult(Integer code) {
super();
this.code = code;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
//静态工具方法
public static ResResult success(){
return new ResResult(200);
}
public static ResResult success(String msg){
return new ResResult(200,msg);
}
public static<T> ResResult<T> success(String msg,T data){
return new ResResult(200,msg,data);
}
public static ResResult error(Integer code,String msg){
return new ResResult(code,msg);
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.