blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 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 684M ⌀ | 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 132 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 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cab018335113eaedba6a23dcb1fecad5bc798dfc | b1516a208b439606ff4b5bcc10fd10a5a2b3cffe | /MLRGui.java | d76e4feafe01763c57a056e21bc760719ac0fe62 | [] | no_license | AngelZacarias/multilinear-regression | 47c24ab87ce13cc20a412d695675855a6b4261bd | 9626b39d1d3953f4be6fa965cd81490b80ad32b1 | refs/heads/master | 2023-06-12T04:29:43.539780 | 2021-06-24T20:12:39 | 2021-06-24T20:12:39 | 375,159,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,726 | java | package examples.mlr;
import jade.core.AID;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class MLRGUI extends JFrame {
private MLRAgent mlrAgent;
private JTextField valueX1;
private JTextField valueX2;
MLRGUI(MLRAgent a) {
super(a.getLocalName());
mlrAgent = a;
JPanel p = new JPanel();
p.setLayout(new GridLayout(2, 2));
p.add(new JLabel("x1:"));
valueX1 = new JTextField(15);
p.add(valueX1);
p.add(new JLabel("x2:"));
valueX2 = new JTextField(15);
p.add(valueX2);
getContentPane().add(p, BorderLayout.CENTER);
JButton addButton = new JButton("Calcular valor");
addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
try {
String value1ToPredict = valueX1.getText().trim();
String value2ToPredict = valueX2.getText().trim();
mlrAgent.makePrediction(Double.parseDouble(value1ToPredict), Double.parseDouble(value2ToPredict));
valueX1.setText("");
valueX2.setText("");
}
catch (Exception e) {
JOptionPane.showMessageDialog(MLRGUI.this, "valores erróneos. "+e.getMessage(), "Error: ", JOptionPane.ERROR_MESSAGE);
}
}
});
p = new JPanel();
p.add(addButton);
getContentPane().add(p, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
mlrAgent.doDelete();
}
} );
setResizable(false);
}
public void showGui() {
pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int centerX = (int)screenSize.getWidth() / 2;
int centerY = (int)screenSize.getHeight() / 2;
setLocation(centerX - getWidth() / 2, centerY - getHeight() / 2);
super.setVisible(true);
}
} | [
"luis.zacariasm@alumnos.udg.mx"
] | luis.zacariasm@alumnos.udg.mx |
9eeab4e6129167d05b76ea945e9f830d3e7f14eb | 546535d586d8e11f746f5af5faa4724e02e117c9 | /src/main/java/net/socialhub/core/action/RequestActionImpl.java | a7d75b948048ad34022e73b5b9288dd3b39c897e | [
"MIT"
] | permissive | uakihir0/SocialHub | 84521d9efebbbdf546048f81f6e255dc61417c25 | 0c88f29abc7014158cac6a6499b7fe8beb796f6c | refs/heads/master | 2023-07-07T09:10:35.661951 | 2023-06-26T13:19:38 | 2023-06-26T13:19:38 | 140,700,591 | 50 | 4 | MIT | 2023-06-26T13:19:40 | 2018-07-12T10:51:13 | Java | UTF-8 | Java | false | false | 12,184 | java | package net.socialhub.core.action;
import com.google.gson.Gson;
import net.socialhub.core.action.request.CommentsRequest;
import net.socialhub.core.action.request.CommentsRequestImpl;
import net.socialhub.core.action.request.UsersRequest;
import net.socialhub.core.action.request.UsersRequestImpl;
import net.socialhub.core.define.action.ActionType;
import net.socialhub.core.define.action.TimeLineActionType;
import net.socialhub.core.define.action.UsersActionType;
import net.socialhub.core.model.Account;
import net.socialhub.core.model.Comment;
import net.socialhub.core.model.Identify;
import net.socialhub.core.model.Pageable;
import net.socialhub.core.model.Paging;
import net.socialhub.core.model.Request;
import net.socialhub.core.model.User;
import net.socialhub.logger.Logger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Stream;
import static java.util.stream.Collectors.toList;
import static net.socialhub.core.define.action.TimeLineActionType.ChannelTimeLine;
import static net.socialhub.core.define.action.TimeLineActionType.HomeTimeLine;
import static net.socialhub.core.define.action.TimeLineActionType.MentionTimeLine;
import static net.socialhub.core.define.action.TimeLineActionType.MessageTimeLine;
import static net.socialhub.core.define.action.TimeLineActionType.SearchTimeLine;
import static net.socialhub.core.define.action.TimeLineActionType.UserCommentTimeLine;
import static net.socialhub.core.define.action.TimeLineActionType.UserLikeTimeLine;
import static net.socialhub.core.define.action.TimeLineActionType.UserMediaTimeLine;
import static net.socialhub.core.define.action.UsersActionType.GetFollowerUsers;
import static net.socialhub.core.define.action.UsersActionType.GetFollowingUsers;
import static net.socialhub.core.define.action.UsersActionType.SearchUsers;
public class RequestActionImpl implements RequestAction {
private Logger log = Logger.getLogger(RequestActionImpl.class);
protected Account account;
public RequestActionImpl(Account account) {
this.account = account;
}
// ============================================================== //
// User API
// ============================================================== //
/**
* {@inheritDoc}
*/
@Override
public UsersRequest getFollowingUsers(Identify id) {
return getUsersRequest(GetFollowingUsers,
(paging) -> account.action().getFollowingUsers(id, paging),
new SerializeBuilder(GetFollowingUsers));
}
/**
* {@inheritDoc}
*/
@Override
public UsersRequest getFollowerUsers(Identify id) {
return getUsersRequest(GetFollowerUsers,
(paging) -> account.action().getFollowerUsers(id, paging),
new SerializeBuilder(GetFollowerUsers)
.add("id", id.getSerializedIdString()));
}
/**
* {@inheritDoc}
*/
@Override
public UsersRequest searchUsers(String query) {
return getUsersRequest(SearchUsers,
(paging) -> account.action().searchUsers(query, paging),
new SerializeBuilder(SearchUsers)
.add("query", query));
}
// ============================================================== //
// TimeLine API
// ============================================================== //
/**
* {@inheritDoc}
*/
@Override
public CommentsRequest getHomeTimeLine() {
return getCommentsRequest(HomeTimeLine,
(paging) -> account.action().getHomeTimeLine(paging),
new SerializeBuilder(HomeTimeLine));
}
/**
* {@inheritDoc}
*/
@Override
public CommentsRequest getMentionTimeLine() {
return getCommentsRequest(MentionTimeLine,
(paging) -> account.action().getMentionTimeLine(paging),
new SerializeBuilder(MentionTimeLine));
}
/**
* {@inheritDoc}
*/
@Override
public CommentsRequest getUserCommentTimeLine(Identify id) {
return getCommentsRequest(UserCommentTimeLine,
(paging) -> account.action().getUserCommentTimeLine(id, paging),
new SerializeBuilder(UserCommentTimeLine)
.add("id", id.getSerializedIdString()));
}
/**
* {@inheritDoc}
*/
@Override
public CommentsRequest getUserLikeTimeLine(Identify id) {
return getCommentsRequest(UserLikeTimeLine,
(paging) -> account.action().getUserLikeTimeLine(id, paging),
new SerializeBuilder(UserLikeTimeLine)
.add("id", id.getSerializedIdString()));
}
/**
* {@inheritDoc}
*/
@Override
public CommentsRequest getUserMediaTimeLine(Identify id) {
return getCommentsRequest(UserMediaTimeLine,
(paging) -> account.action().getUserMediaTimeLine(id, paging),
new SerializeBuilder(UserMediaTimeLine)
.add("id", id.getSerializedIdString()));
}
/**
* {@inheritDoc}
*/
@Override
public CommentsRequest getSearchTimeLine(String query) {
return getCommentsRequest(SearchTimeLine,
(paging) -> account.action().getSearchTimeLine(query, paging),
new SerializeBuilder(SearchTimeLine)
.add("query", query));
}
/**
* {@inheritDoc}
*/
@Override
public CommentsRequest getChannelTimeLine(Identify id) {
return getCommentsRequest(ChannelTimeLine,
(paging) -> account.action().getChannelTimeLine(id, paging),
new SerializeBuilder(ChannelTimeLine)
.add("id", id.getSerializedIdString()));
}
/**
* {@inheritDoc}
*/
@Override
public CommentsRequest getMessageTimeLine(Identify id) {
CommentsRequest request = getCommentsRequest(MessageTimeLine,
(paging) -> account.action().getMessageTimeLine(id, paging),
new SerializeBuilder(MessageTimeLine)
.add("id", id.getSerializedIdString()));
request.getCommentFrom()
.message(true)
.replyId(id);
return request;
}
// ============================================================== //
// From Serialized
// ============================================================== //
/**
* {@inheritDoc}
*/
@Override
public Request fromSerializedString(String serialize) {
try {
SerializeParams params = new Gson().fromJson(serialize, SerializeParams.class);
String action = params.get("action");
// Identify
Identify id = null;
if (params.contains("id")) {
id = new Identify(account.getService());
id.setSerializedIdString(params.get("id"));
}
// Query
String query = null;
if (params.contains("query")) {
query = params.get("query");
}
// ------------------------------------------------------------- //
// User Actions
// ------------------------------------------------------------- //
if (isTypeIncluded(UsersActionType.values(), action)) {
switch (UsersActionType.valueOf(action)) {
case GetFollowingUsers:
return getFollowingUsers(id);
case GetFollowerUsers:
return getFollowerUsers(id);
case SearchUsers:
return getSearchTimeLine(query);
case ChannelUsers:
return getChannelTimeLine(id);
default:
log.debug("invalid user action type: " + action);
return null;
}
}
// ------------------------------------------------------------- //
// Comment Actions
// ------------------------------------------------------------- //
if (isTypeIncluded(TimeLineActionType.values(), action)) {
switch (TimeLineActionType.valueOf(action)) {
case HomeTimeLine:
return getHomeTimeLine();
case MentionTimeLine:
return getMentionTimeLine();
case SearchTimeLine:
return getSearchTimeLine(query);
case ChannelTimeLine:
return getChannelTimeLine(id);
case MessageTimeLine:
return getMessageTimeLine(id);
case UserLikeTimeLine:
return getUserLikeTimeLine(id);
case UserMediaTimeLine:
return getUserMediaTimeLine(id);
case UserCommentTimeLine:
return getUserCommentTimeLine(id);
default:
log.debug("invalid comment action type: " + action);
return null;
}
}
log.debug("invalid action type: " + action);
return null;
} catch (Exception e) {
log.debug("json parse error.", e);
return null;
}
}
protected boolean isTypeIncluded(Enum<?>[] members, String action) {
List<String> names = Stream.of(members).map(Enum::name).collect(toList());
return names.contains(action);
}
// ============================================================== //
// Inner Class
// ============================================================== //
/**
* Serialize Params
*/
public static class SerializeParams {
private final Map<String, String> params = new HashMap<>();
public String get(String key) {
return params.get(key);
}
public boolean contains(String key) {
return params.containsKey(key);
}
public void add(String key, String value) {
params.put(key, value);
}
}
/**
* Serialize Builder
*/
public static class SerializeBuilder {
private final SerializeParams params = new SerializeParams();
public <T extends Enum<T>> SerializeBuilder(Enum<T> action) {
add("action", action.name());
}
public SerializeBuilder add(String key, String value) {
params.add(key, value);
return this;
}
public String toJson() {
return new Gson().toJson(params);
}
}
// ============================================================== //
// Support
// ============================================================== //
// User
protected UsersRequestImpl getUsersRequest(
ActionType type,
Function<Paging, Pageable<User>> usersFunction,
SerializeBuilder serializeBuilder) {
UsersRequestImpl request = new UsersRequestImpl();
request.setSerializeBuilder(serializeBuilder);
request.setUsersFunction(usersFunction);
request.setActionType(type);
request.setAccount(account);
return request;
}
// Comments
protected CommentsRequestImpl getCommentsRequest(
ActionType type,
Function<Paging, Pageable<Comment>> commentsFunction,
SerializeBuilder serializeBuilder) {
CommentsRequestImpl request = new CommentsRequestImpl();
request.setSerializeBuilder(serializeBuilder);
request.setCommentsFunction(commentsFunction);
request.setActionType(type);
request.setAccount(account);
return request;
}
//region // Getter&Setter
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
//endregion
}
| [
"a.urusihara@gmail.com"
] | a.urusihara@gmail.com |
bf0068597d241647a9ca39e3f0d8a15b1aab5d28 | a6fd65d5de085ffe1d6d45493623e6ca77191cd4 | /TelemetryServer/app/src/main/java/org/mavlink/messages/ardupilotmega/msg_raw_imu.java | dd679d1348fa43a679ac661e0a8c7dc001940574 | [
"MIT"
] | permissive | chrisphillips/Telemetry-For-DJI | eeb130c210b1e90aafdcee8f48e3316b899bb4e9 | f36d00ab682191021be0468deaebcdbd6a7ce67b | refs/heads/master | 2021-04-29T19:30:39.340796 | 2018-03-04T21:40:17 | 2018-03-04T21:40:17 | 121,578,334 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,339 | java | /**
* Generated class : msg_raw_imu
* DO NOT MODIFY!
**/
package org.mavlink.messages.ardupilotmega;
import org.mavlink.messages.MAVLinkMessage;
import org.mavlink.IMAVLinkCRC;
import org.mavlink.MAVLinkCRC;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/**
* Class msg_raw_imu
* The RAW IMU readings for the usual 9DOF sensor setup. This message should always contain the true raw values without any scaling to allow data capture and system debugging.
**/
public class msg_raw_imu extends MAVLinkMessage {
public static final int MAVLINK_MSG_ID_RAW_IMU = 27;
private static final long serialVersionUID = MAVLINK_MSG_ID_RAW_IMU;
public msg_raw_imu(int sysId, int componentId) {
messageType = MAVLINK_MSG_ID_RAW_IMU;
this.sysId = sysId;
this.componentId = componentId;
length = 26;
}
/**
* Timestamp (microseconds since UNIX epoch or microseconds since system boot)
*/
public long time_usec;
/**
* X acceleration (raw)
*/
public int xacc;
/**
* Y acceleration (raw)
*/
public int yacc;
/**
* Z acceleration (raw)
*/
public int zacc;
/**
* Angular speed around X axis (raw)
*/
public int xgyro;
/**
* Angular speed around Y axis (raw)
*/
public int ygyro;
/**
* Angular speed around Z axis (raw)
*/
public int zgyro;
/**
* X Magnetic field (raw)
*/
public int xmag;
/**
* Y Magnetic field (raw)
*/
public int ymag;
/**
* Z Magnetic field (raw)
*/
public int zmag;
/**
* Decode message with raw data
*/
public void decode(ByteBuffer dis) throws IOException {
time_usec = (long)dis.getLong();
xacc = (int)dis.getShort();
yacc = (int)dis.getShort();
zacc = (int)dis.getShort();
xgyro = (int)dis.getShort();
ygyro = (int)dis.getShort();
zgyro = (int)dis.getShort();
xmag = (int)dis.getShort();
ymag = (int)dis.getShort();
zmag = (int)dis.getShort();
}
/**
* Encode message with raw data and other informations
*/
public byte[] encode() throws IOException {
byte[] buffer = new byte[8+26];
ByteBuffer dos = ByteBuffer.wrap(buffer).order(ByteOrder.LITTLE_ENDIAN);
dos.put((byte)0xFE);
dos.put((byte)(length & 0x00FF));
dos.put((byte)(sequence & 0x00FF));
dos.put((byte)(sysId & 0x00FF));
dos.put((byte)(componentId & 0x00FF));
dos.put((byte)(messageType & 0x00FF));
dos.putLong(time_usec);
dos.putShort((short)(xacc&0x00FFFF));
dos.putShort((short)(yacc&0x00FFFF));
dos.putShort((short)(zacc&0x00FFFF));
dos.putShort((short)(xgyro&0x00FFFF));
dos.putShort((short)(ygyro&0x00FFFF));
dos.putShort((short)(zgyro&0x00FFFF));
dos.putShort((short)(xmag&0x00FFFF));
dos.putShort((short)(ymag&0x00FFFF));
dos.putShort((short)(zmag&0x00FFFF));
int crc = MAVLinkCRC.crc_calculate_encode(buffer, 26);
crc = MAVLinkCRC.crc_accumulate((byte) IMAVLinkCRC.MAVLINK_MESSAGE_CRCS[messageType], crc);
byte crcl = (byte) (crc & 0x00FF);
byte crch = (byte) ((crc >> 8) & 0x00FF);
buffer[32] = crcl;
buffer[33] = crch;
return buffer;
}
public String toString() {
return "MAVLINK_MSG_ID_RAW_IMU : " + " time_usec="+time_usec+ " xacc="+xacc+ " yacc="+yacc+ " zacc="+zacc+ " xgyro="+xgyro+ " ygyro="+ygyro+ " zgyro="+zgyro+ " xmag="+xmag+ " ymag="+ymag+ " zmag="+zmag;}
}
| [
"darthgak@gmail.com"
] | darthgak@gmail.com |
f94a68bb349aca4506b83cb0b1094d5c079a63e6 | e336473ecdc8043480de6c5235bbab86dac588d0 | /Mms/src/com/android/mms/model/MediaModelFactory.java | cb231ce61f093b16f329eeb026f1754c69fbf536 | [
"Apache-2.0"
] | permissive | wangyx0055/AZ8188-LOW13 | 509c96bf75b170be4d97c262be5c15286d77018a | 7f430136afbd4c91af57dde3e43fb90a4ccaf9e1 | refs/heads/master | 2023-08-30T21:37:31.239462 | 2012-11-19T09:04:21 | 2012-11-19T09:04:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,866 | java | /* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein
* is confidential and proprietary to MediaTek Inc. and/or its licensors.
* Without the prior written permission of MediaTek inc. and/or its licensors,
* any reproduction, modification, use or disclosure of MediaTek Software,
* and information contained herein, in whole or in part, shall be strictly prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
* THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
* CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
* SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
* CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*/
/*
* Copyright (C) 2008 Esmertec AG.
* Copyright (C) 2008 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 com.android.mms.model;
import com.android.mms.UnsupportContentTypeException;
import com.android.mms.LogTag;
import com.android.mms.MmsConfig;
import android.drm.mobile1.DrmException;
import com.android.mms.drm.DrmWrapper;
import com.google.android.mms.ContentType;
import com.google.android.mms.MmsException;
import com.google.android.mms.pdu.PduBody;
import com.google.android.mms.pdu.PduPart;
import org.w3c.dom.smil.SMILMediaElement;
import org.w3c.dom.smil.SMILRegionElement;
import org.w3c.dom.smil.SMILRegionMediaElement;
import org.w3c.dom.smil.Time;
import org.w3c.dom.smil.TimeList;
import android.content.Context;
import android.util.Log;
import java.io.IOException;
public class MediaModelFactory {
private static final String TAG = "Mms:media";
public static MediaModel getMediaModel(Context context,
SMILMediaElement sme, LayoutModel layouts, PduBody pb)
throws DrmException, IOException, IllegalArgumentException, MmsException {
String tag = sme.getTagName();
String src = sme.getSrc();
PduPart part = findPart(pb, src);
if (sme instanceof SMILRegionMediaElement) {
return getRegionMediaModel(
context, tag, src, (SMILRegionMediaElement) sme, layouts, part);
} else {
return getGenericMediaModel(
context, tag, src, sme, part, null);
}
}
private static PduPart findPart(PduBody pb, String src) {
PduPart part = null;
if (src != null) {
src = unescapeXML(src);
if (src.startsWith("cid:")) {
part = pb.getPartByContentId("<" + src.substring("cid:".length()) + ">");
} else {
Log.i("Mms/compose", "findPart(): src1 = " + src);
part = pb.getPartByContentId("<" + src + ">");
if (part == null) {
part = pb.getPartByName(src);
if (part == null) {
part = pb.getPartByFileName(src);
if (part == null) {
part = pb.getPartByContentLocation(src);
if (part == null) {
int lastDocCharAt = src.lastIndexOf(".");
if (lastDocCharAt > 0) {
Log.i("Mms/compose", "findPart(): src2 = " + src.substring(0, lastDocCharAt));
part = pb.getPartByContentLocation(src.substring(0, lastDocCharAt));
}
if (part == null) {
part = pb.getPartByFileName(src.substring(0, lastDocCharAt));
if (part == null) {
part = pb.getPartByName(src.substring(0, lastDocCharAt));
if (part == null) {
part = pb.getPartByContentId("<" + src.substring(0, lastDocCharAt) + ">");
}
}
}
}
}
}
}
}
}
if (part != null) {
return part;
}
throw new IllegalArgumentException("No part found for the model.");
}
private static String unescapeXML(String str) {
return str.replaceAll("<","<")
.replaceAll(">", ">")
.replaceAll(""","\"")
.replaceAll("'","'")
.replaceAll("&", "&");
}
private static MediaModel getRegionMediaModel(Context context,
String tag, String src, SMILRegionMediaElement srme,
LayoutModel layouts, PduPart part) throws DrmException, IOException, MmsException {
SMILRegionElement sre = srme.getRegion();
if (sre != null) {
RegionModel region = layouts.findRegionById(sre.getId());
if (region != null) {
return getGenericMediaModel(context, tag, src, srme, part, region);
}
} else {
String rId = null;
if (tag.equals(SmilHelper.ELEMENT_TAG_TEXT)) {
rId = LayoutModel.TEXT_REGION_ID;
} else {
rId = LayoutModel.IMAGE_REGION_ID;
}
RegionModel region = layouts.findRegionById(rId);
if (region != null) {
return getGenericMediaModel(context, tag, src, srme, part, region);
}
}
throw new IllegalArgumentException("Region not found or bad region ID.");
}
private static MediaModel getGenericMediaModel(Context context,
String tag, String src, SMILMediaElement sme, PduPart part,
RegionModel regionModel) throws DrmException, IOException, MmsException {
byte[] bytes = part.getContentType();
if (bytes == null) {
throw new IllegalArgumentException(
"Content-Type of the part may not be null.");
}
String contentType = new String(bytes);
MediaModel media = null;
if (ContentType.isDrmType(contentType)) {
DrmWrapper wrapper = new DrmWrapper(
contentType, part.getDataUri(), part.getData());
if (tag.equals(SmilHelper.ELEMENT_TAG_TEXT)) {
media = new TextModel(context, contentType, src,
part.getCharset(), wrapper, regionModel);
} else if (tag.equals(SmilHelper.ELEMENT_TAG_IMAGE)) {
Log.d("Mms/compose","mediamodelFactory. contenttype="+contentType);
if (contentType.equals("application/oct-stream") || contentType.equals("application/octet-stream")) {
if (src!=null) {
Log.d("Mms/compose","file name="+src);
String suffix = src.substring(src.lastIndexOf("."), src.length());
if (suffix.equals(".bmp")) {
contentType=ContentType.IMAGE_BMP;
} else if (suffix.equals(".jpg")) {
contentType = ContentType.IMAGE_JPG;
} else if (suffix.equals(".wbmp")) {
contentType = ContentType.IMAGE_WBMP;
} else if (suffix.equals(".gif")) {
contentType = ContentType.IMAGE_GIF;
} else if (suffix.equals(".png")) {
contentType = ContentType.IMAGE_PNG;
} else if (suffix.equals(".jpeg")) {
contentType = ContentType.IMAGE_JPEG;
} else {
Log.e("Mms/compose","can not parse content-type from src. src: "+src);
}
} else {
throw new UnsupportContentTypeException("Unsupported Content-Type: " + contentType +"; src==null");
}
}
Log.d("Mms/compose","Done! contentType="+contentType);
media = new ImageModel(context, contentType, src,
wrapper, regionModel);
} else if (tag.equals(SmilHelper.ELEMENT_TAG_VIDEO)) {
media = new VideoModel(context, contentType, src,
wrapper, regionModel);
} else if (tag.equals(SmilHelper.ELEMENT_TAG_AUDIO)) {
media = new AudioModel(context, contentType, src,
wrapper);
} else if (tag.equals(SmilHelper.ELEMENT_TAG_REF)) {
String drmContentType = wrapper.getContentType();
if (ContentType.isTextType(drmContentType)) {
media = new TextModel(context, contentType, src,
part.getCharset(), wrapper, regionModel);
} else if (ContentType.isImageType(drmContentType)) {
media = new ImageModel(context, contentType, src,
wrapper, regionModel);
} else if (ContentType.isVideoType(drmContentType)) {
media = new VideoModel(context, contentType, src,
wrapper, regionModel);
} else if (ContentType.isAudioType(drmContentType)) {
media = new AudioModel(context, contentType, src,
wrapper);
} else {
throw new UnsupportContentTypeException(
"Unsupported Content-Type: " + drmContentType);
}
} else {
throw new IllegalArgumentException("Unsupported TAG: " + tag);
}
} else {
if (tag.equals(SmilHelper.ELEMENT_TAG_TEXT)) {
media = new TextModel(context, contentType, src,
part.getCharset(), part.getData(), regionModel);
} else if (tag.equals(SmilHelper.ELEMENT_TAG_IMAGE)) {
Log.d("Mms/compose","mediamodelFactory. contenttype="+contentType);
if (contentType.equals("application/oct-stream") || contentType.equals("application/octet-stream")) {
if (src!=null) {
Log.d("Mms/compose","file name="+src);
String suffix = src.substring(src.lastIndexOf("."),src.length());
if (suffix.equals(".bmp")) {
contentType=ContentType.IMAGE_BMP;
} else if(suffix.equals(".jpg")) {
contentType = ContentType.IMAGE_JPG;
} else if(suffix.equals(".wbmp")) {
contentType = ContentType.IMAGE_WBMP;
} else if(suffix.equals(".gif")) {
contentType = ContentType.IMAGE_GIF;
} else if(suffix.equals(".png")) {
contentType = ContentType.IMAGE_PNG;
} else if(suffix.equals(".jpeg")) {
contentType = ContentType.IMAGE_JPEG;
} else {
Log.e("Mms/compose","can not parse content-type from src. src: "+src);
}
} else {
throw new UnsupportContentTypeException("Unsupported Content-Type: " + contentType +"; src is null");
}
}
Log.d("Mms/compose","Done! contentType="+contentType);
media = new ImageModel(context, contentType, src,
part.getDataUri(), regionModel);
} else if (tag.equals(SmilHelper.ELEMENT_TAG_VIDEO)) {
media = new VideoModel(context, contentType, src,
part.getDataUri(), regionModel);
} else if (tag.equals(SmilHelper.ELEMENT_TAG_AUDIO)) {
media = new AudioModel(context, contentType, src,
part.getDataUri());
} else if (tag.equals(SmilHelper.ELEMENT_TAG_REF)) {
if (ContentType.isTextType(contentType)) {
media = new TextModel(context, contentType, src,
part.getCharset(), part.getData(), regionModel);
} else if (ContentType.isImageType(contentType)) {
media = new ImageModel(context, contentType, src,
part.getDataUri(), regionModel);
} else if (ContentType.isVideoType(contentType)) {
media = new VideoModel(context, contentType, src,
part.getDataUri(), regionModel);
} else if (ContentType.isAudioType(contentType)) {
media = new AudioModel(context, contentType, src,
part.getDataUri());
} else {
throw new UnsupportContentTypeException(
"Unsupported Content-Type: " + contentType);
}
} else {
throw new IllegalArgumentException("Unsupported TAG: " + tag);
}
}
// Set 'begin' property.
int begin = 0;
TimeList tl = sme.getBegin();
if ((tl != null) && (tl.getLength() > 0)) {
// We only support a single begin value.
Time t = tl.item(0);
begin = (int) (t.getResolvedOffset() * 1000);
}
media.setBegin(begin);
// Set 'duration' property.
int duration = (int) (sme.getDur() * 1000);
if (duration <= 0) {
tl = sme.getEnd();
if ((tl != null) && (tl.getLength() > 0)) {
// We only support a single end value.
Time t = tl.item(0);
if (t.getTimeType() != Time.SMIL_TIME_INDEFINITE) {
duration = (int) (t.getResolvedOffset() * 1000) - begin;
if (duration == 0 &&
(media instanceof AudioModel || media instanceof VideoModel)) {
duration = MmsConfig.getMinimumSlideElementDuration();
if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) {
Log.d(TAG, "[MediaModelFactory] compute new duration for " + tag +
", duration=" + duration);
}
}
}
}
}
media.setDuration(duration);
if (!MmsConfig.getSlideDurationEnabled()) {
/**
* Because The slide duration is not supported by mmsc,
* the device has to set fill type as FILL_FREEZE.
* If not, the media will disappear while rotating the screen
* in the slide show play view.
*/
media.setFill(sme.FILL_FREEZE);
} else {
// Set 'fill' property.
media.setFill(sme.getFill());
}
return media;
}
}
| [
"powerbush@gmail.com"
] | powerbush@gmail.com |
cd68392146f9e9408284aee2d4ec1da187384672 | e8cd24201cbfadef0f267151ea5b8a90cc505766 | /group05/810574652/src/com/github/PingPi357/coding2017/homework2/ArrayUtil.java | 151dae82b6100b6ebf7223e9b539bb5450dbe921 | [] | no_license | XMT-CN/coding2017-s1 | 30dd4ee886dd0a021498108353c20360148a6065 | 382f6bfeeeda2e76ffe27b440df4f328f9eafbe2 | refs/heads/master | 2021-01-21T21:38:42.199253 | 2017-06-25T07:44:21 | 2017-06-25T07:44:21 | 94,863,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,088 | java | package com.github.PingPi357.coding2017.homework2;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
public class ArrayUtil {
/**
* 给定一个整形数组a , 对该数组的值进行置换 例如: a = [7, 9 , 30, 3] , 置换后为 [3, 30, 9,7] 如果 a =
* [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
*
* @param origin
* @return
*/
public int[] reverseArray(int[] origin) {
int len = origin.length;
int[] temp = new int[len];
for (int i = 0; i < len; i++) {
temp[i] = origin[--len];
}
return temp;
}
/**
* 现在有如下的一个数组: int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}
* 要求将以上数组中值为0的项去掉,将不为0的值存入一个新的数组,生成的新数组为: {1,3,4,5,6,6,5,4,7,6,7,5}
*
* @param oldArray
* @return
*/
public int[] removeZero(int[] oldArray) {
int[] newArray = new int[oldArray.length];
int i = 0;
for (int element : oldArray) {
if (element != 0) {
newArray[i++] = element;
}
}
return newArray;
}
/**
* 给定两个已经排序好的整形数组, a1和a2 , 创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素, 并且仍然是有序的 例如 a1 =
* [3, 5, 7,8] a2 = [4, 5, 6,7] 则 a3 为[3,4,5,6,7,8] , 注意: 已经消除了重复
*
* @param array1
* @param array2
* @return
*/
public int[] merge(int[] array1, int[] array2) {
ArrayList<Integer> list = new ArrayList<Integer>();
int k1=0;
int k2 = 0;
for (int i = 0; i < array1.length; i++) {
for (int j = k2; j < array2.length; j++) {
if (array1[i] < array2[j]) {
list.add(array1[i]);
k1++;
break;
} else if(array1[i] > array2[j]) {
list.add(array2[j]);
k2++;
}else{
list.add(array1[i]);
k1++;
k2++;
break;
}
}
if(k2==array2.length-1){
for (; k1 <= array1.length-1 ; k1++) {
list.add(array1[k1]);
}
break;
}
if(k1== array1.length-1){
for (; k2 <= array2.length-1 ; k2++) {
list.add(array2[k2]);
}
break;
}
}
int[] mergeArray = arrayListToArray(list);
return mergeArray;
}
/**
* 把一个已经存满数据的数组 oldArray的容量进行扩展, 扩展后的新数据大小为oldArray.length + size
* 注意,老数组的元素在新数组中需要保持 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
* [2,3,6,0,0,0]
*
* @param oldArray
* @param size
* @return
*/
public int[] grow(int[] oldArray, int size) {
int[] growArray = Arrays.copyOf(oldArray, oldArray.length + size);
return growArray;
}
/**
* 斐波那契数列为:1,1,2,3,5,8,13,21...... ,给定一个最大值, 返回小于该值的数列 例如, max = 15 ,
* 则返回的数组应该为 [1,1,2,3,5,8,13] max = 1, 则返回空数组 []
*
* @param max
* @return
*/
public int[] fibonacci(int max) {
int a = 1;
int b = 1;
int fibMaxNum = 1;
ArrayList<Integer> list=new ArrayList<Integer>();
list.add(1);
if (max <= 1) {
return new int[0];
}
while (max > fibMaxNum) {
list.add(fibMaxNum);
fibMaxNum = a + b;
b = fibMaxNum;
a = b;
}
return arrayListToArray(list);
}
/**
* 返回小于给定最大值max的所有素数数组 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
*
* @param max
* @return
*/
public int[] getPrimes(int max) {
ArrayList<Integer> list =new ArrayList<Integer>();
for(int i=2; i <=max-1;i++){
boolean flag=true;
for(int j=2; j < Math.floor(i/2); j++){
if(i%j==0){
flag=false;
break;
}
}
if(!flag){
list.add(i);
}
}
return arrayListToArray(list);
}
/**
* 所谓“完数”, 是指这个数恰好等于它的因子之和,例如6=1+2+3 给定一个最大值max, 返回一个数组, 数组中是小于max 的所有完数
*
* @param max
* @return
*/
public int[] getPerfectNumbers(int max) {
ArrayList<Integer> list =new ArrayList<Integer>();
int sum=0;
if(max<=1){
return null;
}
for(int i=1;i <=(max-1);i++){
for(int j=1; j<=i/2;j++){
if(i%j==0){
sum+=j;
}
}
if(sum==i){
list.add(i);
}
}
return arrayListToArray(list);
}
/**
* 用seperator 把数组 array给连接起来 例如array= [3,8,9], seperator = "-" 则返回值为"3-8-9"
*
* @param array
* @param s
* @return
*/
public String join(int[] array, String seperator) {
StringBuilder sb=new StringBuilder();
sb.append(array[0]);
for(int i=1;i<array.length;i++){
sb.append(seperator);
sb.append(array[i]);
}
return sb.toString();
}
private int[] arrayListToArray(ArrayList<?> list) {
int[] Array = new int[list.size()];
for (int i = 0; i < list.size(); i++) {
Array[i] = (int) list.get(i);
}
return Array;
}
}
| [
"542194147@qq.com"
] | 542194147@qq.com |
8b31b5f4a2ea3ee746bf998daf8aead8696ec149 | b768fb8f87f35af4f29a4ec74beb19dce626cf8c | /src/main/java/com/yw/crud/service/EmployeeService.java | 917973e7b43726310187ee5f8b9b7009e7eda867 | [] | no_license | a20081225/ssmcrud | 490f746e97429ff732d4644735cd35c741bf0373 | 149a4c1efced8fdbb8a15229c44f063521feb29b | refs/heads/master | 2021-05-11T01:33:37.870558 | 2018-01-30T15:11:36 | 2018-01-30T15:11:36 | 118,330,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,095 | java | package com.yw.crud.service;
import com.yw.crud.bean.Employee;
import com.yw.crud.bean.EmployeeExample;
import com.yw.crud.dao.EmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class EmployeeService {
@Autowired
EmployeeMapper employeeMapper;
/**
* 查询所有员工
* @return
*/
public List<Employee> getall() {
EmployeeExample example = new EmployeeExample();
example.setOrderByClause("emp_id");
return employeeMapper.selectByExampleWithDept(example);
}
/**
* 保存员工
* @param employee
*/
public void saveEmp(Employee employee) {
employeeMapper.insertSelective(employee);
}
/**
* 检验用户是否重复
* @param empName
* @return true可用
*/
public boolean checkUser(String empName) {
EmployeeExample employeeExample = new EmployeeExample();
EmployeeExample.Criteria criteria = employeeExample.createCriteria();
criteria.andEmpNameEqualTo(empName);
long count = employeeMapper.countByExample(employeeExample);
return count == 0;
}
/**
* 根据id查询员工
* @param id
* @return
*/
public Employee getEmp(Integer id) {
Employee employee = employeeMapper.selectByPrimaryKeyWithDept(id);
return employee;
}
/**
* 员工更新
* @param employee
*/
public void updateEmp(Employee employee) {
employeeMapper.updateByPrimaryKeySelective(employee);
}
/**
* 删除员工
* @param id
*/
public void delEmp(Integer id) {
employeeMapper.deleteByPrimaryKey(id);
}
/**
* 批量删除
* @param ids
*/
public void delEmpAll(List<Integer> ids) {
EmployeeExample example = new EmployeeExample();
EmployeeExample.Criteria criteria = example.createCriteria();
criteria.andEmpIdIn(ids);
employeeMapper.deleteByExample(example);
}
}
| [
"yanw_mail@sina.com"
] | yanw_mail@sina.com |
6f796ef90ed2ae4c7ed40e65aa7635210db7f8ba | 25a2e3bccf049042081b7463a5e1827c4d9db737 | /WEB-INF/src/com/wfp/utils/MailSender.java | b0fbc48cfc29a96b70321ae9bc89f02c5d666b5d | [] | no_license | kaleem6110/SI-Server-5.0 | 3b47904502ac8ffa9373e2f7bfc2ee11ac5a9781 | 7e31ff3d5087641382dc1f7b10df3dca01fc5035 | refs/heads/master | 2021-01-17T05:39:14.221676 | 2015-02-08T19:34:46 | 2015-02-08T19:34:46 | 28,292,039 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,001 | java | /**
*
*/
package com.wfp.utils;
import java.util.List;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.ArrayList;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeBodyPart;
import com.enterprisehorizons.util.Logger;
/**
* @author kaleem.mohammed
*
*/
public class MailSender implements IEPICConstants {
public static void main(String args[]) {
List<String> toAddressList = new ArrayList<String>();
toAddressList.add("kaleem6110@gmail.com");
// toAddressList.add("kaleem6110@gmail.com"); //
sendEmail(toAddressList, "",
":9080 testing from Java Mailprogram-sent multipart mimetype sent" );
sendHTMLEmail(toAddressList, "hi", "This is message body");
}
public static void sendEmail(List<String> toAddressList,
String subject, String messageBody) {
System.out
.println("@@@@@@@@@ START MailSender.sendEmail @@@@@@@@@@@@@@@@@@@@ ");
Properties props = System.getProperties();
props.put("mail.smtp.host", MAIL_HOST);
props.put("mail.smtp.user", MAIL_FROM);
props.put("mail.smtp.password", MAIL_PWD);
props.put("mail.smtp.port", "25");
props.put("mail.smtp.auth", "true");
String[] toEmailAddress = null;
try
{
toEmailAddress = new String[toAddressList.size()];
toEmailAddress = toAddressList.toArray(toEmailAddress);
Session session = Session.getDefaultInstance(props, null);
MimeMultipart content = new MimeMultipart("alternative");
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(EMAIL_FROM_));
MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(messageBody);
content.addBodyPart(messageBodyPart);
InternetAddress[] toAddress = new InternetAddress[toEmailAddress.length];
// To get the array of addresses
for (int i = 0; i < toEmailAddress.length; i++) { // changed from
// a while loop
toAddress[i] = new InternetAddress(toEmailAddress[i]);
}
System.out.println(Message.RecipientType.TO);
for (int i = 0; i < toAddress.length; i++) { // changed from a
// while loop
message.addRecipient(Message.RecipientType.TO, toAddress[i]);
}
message.setContent(content );
Transport transport = session.getTransport("smtp");
transport.connect(MAIL_HOST, MAIL_FROM, MAIL_PWD);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
} catch (Exception e) {
System.out.println(" Failed to send email to : "
+ messageBody);
e.printStackTrace();
}
System.out
.println("@@@@@@@@@ END MailSender.sendEmail @@@@@@@@@@@@@@@@@@@@ "+toEmailAddress );
}
public static void sendHTMLEmail(List<String> toAddressList, String subject, String messageBody )
{
Logger.info("@@@@@@@@@ START MailSender.sendHTMLEmail @@@@@@@@@@@@@@@@@@@@ ", MailSender.class);
Properties props = System.getProperties();
props.put("mail.smtp.host", MAIL_HOST);
props.put("mail.smtp.user", MAIL_FROM);
props.put("mail.smtp.password", MAIL_PWD);
props.put("mail.smtp.port", "25");
props.put("mail.smtp.auth", "true");
try
{
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(EMAIL_FROM_));
for( String addr : toAddressList ) message.addRecipient(Message.RecipientType.TO, new InternetAddress( addr ) );
message.setSubject( subject );
message.setContent( messageBody, "text/html" );
Transport transport = session.getTransport("smtp");
transport.connect(MAIL_HOST, MAIL_FROM, MAIL_PWD);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
}
catch(Exception e){ e.printStackTrace(); };
Logger.info("@@@@@@@@@ END MailSender.sendHTMLEmail @@@@@@@@@@@@@@@@@@@@ ", MailSender.class );
}
}
| [
"kaleem6110@gmail.com"
] | kaleem6110@gmail.com |
669d9e48ef036f8664de923d5a3def448809482e | b6aace7b0682b3e72a24b8dd33428d0113d1f05c | /work/network-management-0.4/src/ClientGUI/ManagerException.java | 8eebb0f76a75e34a78facdc7cf8653d94889977e | [] | no_license | erikvanzijst/oldschool | c8e3dcfdc35e0f84660ab48c1e2fdf3e01c8f56c | 699459731054d4657eead2ee041360369b422727 | refs/heads/master | 2020-09-07T20:07:17.881998 | 2019-11-11T05:58:45 | 2019-11-11T05:58:45 | 220,897,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | /*
* ManagerException.java
*
* Created on 23 oktober 2003, 15:26
*/
package ClientGUI;
/**
*
* @author laurence.crutcher
*/
public class ManagerException extends java.lang.Exception {
/**
* Creates a new instance of <code>ManagerException</code> without detail message.
*/
public ManagerException() {
}
/**
* Constructs an instance of <code>ManagerException</code> with the specified detail message.
* @param msg the detail message.
*/
public ManagerException(String msg) {
super(msg);
}
}
| [
"erik.van.zijst@gmail.com"
] | erik.van.zijst@gmail.com |
b502b8750e197313be1a5927ce0253cb3e17a4bd | 67fb3f6bb743bf0ad0b90af516e3c5ae8d994b76 | /behavioral/Solutions/src/behavioral/iterator/Demo.java | 8bc6521db1d94b96c679380aa69f318b7e7004a9 | [] | no_license | pesekt1/SWC3-Patterns | 63f14519d729ebb44765dc305f58abd40b21ef32 | a25b88c80b1d3445a8d708818748fe9329a0d09f | refs/heads/master | 2022-11-30T16:39:09.942685 | 2020-08-09T07:39:56 | 2020-08-09T07:39:56 | 286,189,840 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 412 | java | package behavioral.iterator;
public class Demo {
public static void show() {
var collection = new ProductCollection();
collection.add(new Product(1, "a"));
collection.add(new Product(2, "b"));
collection.add(new Product(3, "c"));
var iterator = collection.createIterator();
while (iterator.hasNext()) {
System.out.println(iterator.current());
iterator.next();
}
}
}
| [
"pesekt@gmail.com"
] | pesekt@gmail.com |
a86fcb7c3f96594ff6a1a9d9159657cf84536eed | 45734ed6109da13fd6ab2c40c6807d80eb3c4377 | /cloud-stock-service/src/main/java/com/xiaoka/cloud/stock/service/wrapper/superepc/resp/GetPartsInfoResp.java | e6db96bc87102854823aac26e20e0b52e3d8ba41 | [] | no_license | Dujishi/cloud-stock | 646edfa3eaa62dd486648a8bdb6228ebdec64bbd | f1d22c631979928a8758230bb82d620cd65f641e | refs/heads/master | 2021-05-08T21:08:33.275745 | 2018-01-31T05:37:57 | 2018-01-31T05:37:57 | 119,628,967 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,536 | java | package com.xiaoka.cloud.stock.service.wrapper.superepc.resp;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
/**
* Created by suqin on 16/11/2017.
*/
public class GetPartsInfoResp implements Serializable {
private static final long serialVersionUID = -1137455486082855363L;
private String assembly;
private String enable;
@JsonProperty("epc_no")
private String epcNo;
@JsonProperty("gp_id")
private String gpId;
@JsonProperty("kps_code")
private String kpsCode;
@JsonProperty("kps_name")
private String kpsName;
@JsonProperty("per_use_num")
private String perUseNum;
@JsonProperty("pic_name")
private String picName;
@JsonProperty("pic_num")
private String picNum;
@JsonProperty("pic_path")
private String picPath;
@JsonProperty("pic_sequence")
private String picSequence;
@JsonProperty("remark_brief")
private String remarkBrief;
@JsonProperty("remark_detail")
private String remarkDetail;
@JsonProperty("sub_assembly")
private String subAssembly;
private String tid;
@JsonProperty("timer_assembly")
private String timerAssembly;
@JsonProperty("timer_assembly_id")
private String timerAssemblyId;
@JsonProperty("timer_id")
private String timerId;
@JsonProperty("timer_name")
private String timerName;
@JsonProperty("timer_stand_name")
private String timerStandName;
@JsonProperty("timer_sub_assembly")
private String timerSubAssembly;
@JsonProperty("timer_sub_assembly_id")
private String timerSubAssemblyId;
public void setAssembly(String assembly) {
this.assembly = assembly;
}
public String getAssembly() {
return assembly;
}
public void setEnable(String enable) {
this.enable = enable;
}
public String getEnable() {
return enable;
}
public void setEpcNo(String epcNo) {
this.epcNo = epcNo;
}
public String getEpcNo() {
return epcNo;
}
public void setGpId(String gpId) {
this.gpId = gpId;
}
public String getGpId() {
return gpId;
}
public void setKpsCode(String kpsCode) {
this.kpsCode = kpsCode;
}
public String getKpsCode() {
return kpsCode;
}
public void setKpsName(String kpsName) {
this.kpsName = kpsName;
}
public String getKpsName() {
return kpsName;
}
public void setPerUseNum(String perUseNum) {
this.perUseNum = perUseNum;
}
public String getPerUseNum() {
return perUseNum;
}
public void setPicName(String picName) {
this.picName = picName;
}
public String getPicName() {
return picName;
}
public void setPicNum(String picNum) {
this.picNum = picNum;
}
public String getPicNum() {
return picNum;
}
public void setPicPath(String picPath) {
this.picPath = picPath;
}
public String getPicPath() {
return picPath;
}
public void setPicSequence(String picSequence) {
this.picSequence = picSequence;
}
public String getPicSequence() {
return picSequence;
}
public void setRemarkBrief(String remarkBrief) {
this.remarkBrief = remarkBrief;
}
public String getRemarkBrief() {
return remarkBrief;
}
public void setRemarkDetail(String remarkDetail) {
this.remarkDetail = remarkDetail;
}
public String getRemarkDetail() {
return remarkDetail;
}
public void setSubAssembly(String subAssembly) {
this.subAssembly = subAssembly;
}
public String getSubAssembly() {
return subAssembly;
}
public void setTid(String tid) {
this.tid = tid;
}
public String getTid() {
return tid;
}
public void setTimerAssembly(String timerAssembly) {
this.timerAssembly = timerAssembly;
}
public String getTimerAssembly() {
return timerAssembly;
}
public void setTimerAssemblyId(String timerAssemblyId) {
this.timerAssemblyId = timerAssemblyId;
}
public String getTimerAssemblyId() {
return timerAssemblyId;
}
public void setTimerId(String timerId) {
this.timerId = timerId;
}
public String getTimerId() {
return timerId;
}
public void setTimerName(String timerName) {
this.timerName = timerName;
}
public String getTimerName() {
return timerName;
}
public void setTimerStandName(String timerStandName) {
this.timerStandName = timerStandName;
}
public String getTimerStandName() {
return timerStandName;
}
public void setTimerSubAssembly(String timerSubAssembly) {
this.timerSubAssembly = timerSubAssembly;
}
public String getTimerSubAssembly() {
return timerSubAssembly;
}
public void setTimerSubAssemblyId(String timerSubAssemblyId) {
this.timerSubAssemblyId = timerSubAssemblyId;
}
public String getTimerSubAssemblyId() {
return timerSubAssemblyId;
}
}
| [
"kein.du@cnoneteam.com"
] | kein.du@cnoneteam.com |
0774c1e46119eeaae402a1bf3f6b1da765632845 | b45d1eb9757f3d1ecb95175ec0d9d6dd97d50ae3 | /src/main/java/com/accounttransactions/controller/TransactionController.java | 59068f12ec74c6ba7c31994059ed5845b5e7de0b | [] | no_license | jordanohc3m/account-transaction-app | f8193a26a0bc50c00dbd62056e6ebc69c47554b5 | f6795808604d271d46712fa9bcf1d0e089a749cb | refs/heads/main | 2023-01-05T05:56:49.700284 | 2020-10-05T11:25:37 | 2020-10-05T11:25:37 | 300,925,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,482 | java | package com.accounttransactions.controller;
import com.accounttransactions.dto.TransactionDTO;
import com.accounttransactions.entity.Transaction;
import com.accounttransactions.service.ITransactionService;
import java.net.URI;
import javax.validation.Valid;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
@RestController
@RequestMapping("/transactions")
public class TransactionController {
private ITransactionService service;
public TransactionController(final ITransactionService service) {
this.service = service;
}
@PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<TransactionDTO> create(@Valid @RequestBody TransactionDTO transactionDTO) {
Transaction transaction = service.create(transactionDTO.toEntity());
URI location = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}")
.buildAndExpand(transaction.getId())
.toUri();
return ResponseEntity.created(location)
.body(transaction.toDto());
}
}
| [
"jordano.goncalves@sensedia.com"
] | jordano.goncalves@sensedia.com |
0f99690279d3aa58d1f055a1e02450bde45a6c6e | f4f53618aecaa2223dd9b8c738314824e85dc3fa | /android/app/src/main/java/com/HelloWorld/umeng/DplusReactPackage.java | a337b079cda9f826681ec28068639af7b22a7e72 | [
"MIT"
] | permissive | xiongcaichang/react-native-template-mcrn | 1034ecc39add840c37cf163c364d355de9be6051 | 70a3a2ec4e20c65ab1d0cb6ce5f0745bbd26fc1c | refs/heads/master | 2020-03-29T21:46:07.948714 | 2019-01-20T03:16:13 | 2019-01-20T03:16:13 | 150,386,428 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | package com.HelloWorld.umeng;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.modules.share.ShareModule;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Created by wangfei on 17/8/28.
*/
public class DplusReactPackage implements ReactPackage {
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
/**
* 如需要添加本地方法,只需在这里add
*
* @param reactContext
* @return
*/
@Override
public List<NativeModule> createNativeModules(
ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
// modules.add(new ShareModule(reactContext));
// modules.add(new PushModule(reactContext));
modules.add(new AnalyticsModule(reactContext));
return modules;
}
} | [
"xiongcaichang@meicai.cn"
] | xiongcaichang@meicai.cn |
d76ebb649ad8fdebe5df863f59e0b695d2f574cd | 72161249b60c45cdf378f689f8ea3cda55608837 | /src/recommender/CompareRecommenders.java | 808603e3921f9e78e5f312ed6282b16694908bd4 | [] | no_license | kartikkukreja/recsys-lib | 716e99014c19186be3498f55e5ba35f77ef6acc3 | 677cc6641039652fba6ecb9064f624c10f75bb8d | refs/heads/master | 2020-12-24T13:44:49.061581 | 2013-12-12T19:01:20 | 2013-12-12T19:01:20 | 15,143,640 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,015 | java | package recommender;
import java.io.IOException;
/**
* Sample Class that instantiates different recommenders for movielens 100K data set
* and outputs their performance statistics for comparison
*/
public class CompareRecommenders {
public static void main ( String[] args )
throws IOException
{
BaseRecommender baserec = null;
System.out.println("Creating data access object...");
DAO dao = new DAO("data/u1.base", "data/u1.test", "\t");
System.out.println("Data access object created.");
System.out.println("\nBase Recommender");
baserec = new BaseRecommender(dao);
System.out.println("Training...");
baserec.train();
System.out.println("Testing...");
baserec.evaluate("data\\baserec.predict");
System.out.println("\nUser User Collaborative Filtering Recommender");
baserec = new UUCollaborativeFiltering(dao, 378, 12);
System.out.println("Training...");
baserec.train();
System.out.println("Testing...");
baserec.evaluate("data\\uucf.predict");
dao.userMeanDeNormalize();
System.out.println("\nItem Item Collaborative Filtering Recommender");
baserec = new IICollaborativeFiltering(dao, 1116, 10);
System.out.println("Training...");
baserec.train();
System.out.println("Testing...");
baserec.evaluate("data\\iicf.predict");
dao.itemMeanDeNormalize();
System.out.println("\nSlope One Recommender");
baserec = new SlopeOneRecommender(dao);
System.out.println("Training...");
baserec.train();
System.out.println("Testing...");
baserec.evaluate("data\\slopeone.predict");
System.out.println("\nFunk SVD Recommender");
baserec = new FunkSVDRecommender(dao, 20, 100, 0.1, 0.0001, 0.001, 0.015, "data\\funksvd_users_1.features", "data\\funksvd_movies_1.features");
//baserec = new FunkSVDRecommender(dao, "data\\funksvd_users_4.features", "data\\funksvd_movies_4.features");
System.out.println("Training...");
baserec.train();
System.out.println("Testing...");
baserec.evaluate("data\\funksvd.predict");
}
}
| [
"kartikkukreja92@gmail.com"
] | kartikkukreja92@gmail.com |
2da0220946067c3194f607f100e9b15ebc7d3812 | a855152a90d2f406d223c6c3fa002c8efe83cfdc | /Jpaint/Sprint2/src/model/ShapeType.java | 8ca33ed92a930a9efafa1c4ce02fdf7ca3aa414f | [] | no_license | sdevagup/J-Paint-Application | f24768b7eec46e4952e1139ffdbe7970e0e9cd00 | e38a20c96b031dafe1604678e99c60a557a2017d | refs/heads/master | 2022-11-06T04:24:44.221955 | 2020-06-19T05:41:08 | 2020-06-19T05:41:08 | 273,411,418 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | package model;
public enum ShapeType
{
ELLIPSE,
RECTANGLE,
TRIANGLE
}
| [
"SDEVAGUP@mail.depaul.edu"
] | SDEVAGUP@mail.depaul.edu |
be03820e8db7a5923a6e86aabd40ccce68748642 | 9f16c947034e950c9d4d5b240f65256f7d06bda7 | /subprojects/plugins/src/main/groovy/org/gradle/api/internal/tasks/compile/daemon/CompilerDaemonFactory.java | 1e22f4b31ba9fbbaae964893bf78ca35f16ee484 | [] | no_license | ben-manes/gradle | 74ad626db79ae4b52720dbb5fc0c53a3001ab176 | 73b68b55467f8acc1a8a08432492f16498feeba5 | refs/heads/master | 2023-03-19T00:09:50.654080 | 2012-09-04T20:31:58 | 2012-11-05T03:34:15 | 5,677,792 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 858 | java | /*
* Copyright 2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.api.internal.tasks.compile.daemon;
import org.gradle.api.internal.project.ProjectInternal;
public interface CompilerDaemonFactory {
CompilerDaemon getDaemon(ProjectInternal project, DaemonForkOptions forkOptions);
}
| [
"adam.murdoch@gradleware.com"
] | adam.murdoch@gradleware.com |
c7a4c2547fda3f2293304e02a14ac4878185dea3 | a5108ca821cdbae0c372179e621f008113505f29 | /src/localsearch/domainspecific/vehiclerouting/vrp/CBLSVR.java | 14cc229b868720df6fed33590d126e2acbb5b72b | [
"BSD-2-Clause"
] | permissive | anhtu-phan/cblsvr | 1a57a126b9ad00da8dbf74280c17e2e3089dac57 | f1d078451b9758615b49bf8507b3d4c3cb9c4860 | refs/heads/master | 2022-04-30T17:39:33.239243 | 2017-11-09T03:08:48 | 2017-11-09T03:08:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java |
/*
* authors: PHAM Quang Dung (dungkhmt@gmail.com)
* date: 10/09/2015
*/
package localsearch.domainspecific.vehiclerouting.vrp;
import localsearch.domainspecific.vehiclerouting.vrp.entities.Point;
public class CBLSVR {
public static final int MAX_INT = 2147483647;
public static final double EPSILON = 0.0000000001;
public static final Point NULL_POINT = new Point(-1);
public static boolean equal(double a, double b){
return Math.abs(a-b) < EPSILON;
}
}
| [
"sonnv188@gmail.com"
] | sonnv188@gmail.com |
de67533fc45022558e586c88297592a049613dfe | fd271fb05706dc8a935b2611ba494e20f6f95f3d | /WebPoster/app/src/test/java/com/tactfactory/webposter/ExampleUnitTest.java | 0dfa52ac72c38a036fbe951395d694d589c84038 | [] | no_license | antoinecronier/ENI-D2WM004-2018-2019 | 364b58f975e6aaab797103eadf2a5c73cc3dd484 | 04fe76e5e4ea1bcf50d43bd6752f707ed1759d83 | refs/heads/master | 2020-05-07T09:21:53.049882 | 2019-06-21T13:42:27 | 2019-06-21T13:42:27 | 180,371,760 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.tactfactory.webposter;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"root@tactfactory.com"
] | root@tactfactory.com |
3f10832de825c3ff0854642757e51d76f27adb86 | e67b0d013bc41757234b97fa7f9c797efd3ca08e | /algorithms/src/main/java/com/isa/section4/chapter1/IMultiPaths.java | b25c5503b14d0e298de878a29583f71cbff09f3b | [] | no_license | vasu-kukkapalli/algorithms-1 | 591e266efe562f06b95aa2ee9e96855f31796faa | 2c4a513806b9d036ad4c315b35eff53a1cb084b6 | refs/heads/master | 2021-08-27T17:16:20.530106 | 2017-05-07T11:31:40 | 2017-05-07T11:31:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 146 | java | package com.isa.section4.chapter1;
public interface IMultiPaths {
boolean hasPathTo(int v, int w);
Iterable<Integer> pathTo(int v, int w);
}
| [
"isaolmez@gmail.com"
] | isaolmez@gmail.com |
e17cd0da7c2decfd4f73bc801f44da71f6c6a4a4 | 29b3fcab921b96404494e4a96f3209aed5baf5d9 | /src/main/java/com/shgx/rocketmq/listener/MQConsumeMsgListenerProcessor.java | ed1d904e24edc3f3a67a3a03faf9143509105511 | [] | no_license | guangxush/SpringBoot_RocketMQ | 8a92cce6199b6b789809c649dd4ce76cf20bf49c | 9f82f31a54b161db5083d16515193ef45170179d | refs/heads/master | 2020-04-18T03:40:38.840957 | 2019-01-24T15:35:03 | 2019-01-24T15:35:03 | 167,208,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,386 | java | package com.shgx.rocketmq.listener;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.common.message.MessageExt;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* @Description
* @auther guangxush
* @create 2019/1/23
*/
@Component
public class MQConsumeMsgListenerProcessor implements MessageListenerConcurrently {
private static final Logger logger = LoggerFactory.getLogger(MQConsumeMsgListenerProcessor.class);
/**
* 默认msgs里只有一条消息,可以通过设置consumeMessageBatchMaxSize参数来批量接收消息<br/>
* 不要抛异常,如果没有return CONSUME_SUCCESS ,consumer会重新消费该消息,直到return CONSUME_SUCCESS
*/
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
if(CollectionUtils.isEmpty(msgs)){
logger.info("接受到的消息为空,不处理,直接返回成功");
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
MessageExt messageExt = msgs.get(0);
logger.info("接受到的消息为:"+messageExt.toString());
if(messageExt.getTopic().equals("你的Topic")){
if(messageExt.getTags().equals("你的Tag")){
//TODO 判断该消息是否重复消费(RocketMQ不保证消息不重复,如果你的业务需要保证严格的不重复消息,需要你自己在业务端去重)
//TODO 获取该消息重试次数
int reconsume = messageExt.getReconsumeTimes();
if(reconsume ==3){//消息已经重试了3次,如果不需要再次消费,则返回成功
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
//TODO 处理对应的业务逻辑
}
}
// 如果没有return success ,consumer会重新消费该消息,直到return success
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
}
| [
"guangxush@163.com"
] | guangxush@163.com |
a9d3898f60718c8bfe7ae5582201d114ed611c7a | ef9c39df1786e12ce75a5828634fc824bc40cd00 | /src/org/uecide/themes/Nocturne.java | 2d555339360bb475c87ad1a25653e5b9691df3a1 | [] | no_license | UECIDE-Themes/theme-nocturne | cfac1d66a57cf0a55bf19f62064224bca91525c1 | ff3c303d32d7da6d50df770878f69fb8e4d9586b | refs/heads/master | 2020-05-18T06:36:31.891024 | 2018-07-10T11:15:54 | 2018-07-10T11:15:54 | 41,973,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 177 | java | package org.uecide.themes;
public class Nocturne extends ThemeControl {
public static void init() {
loadFont("/org/uecide/fonts/nk57-monospace-no-rg.ttf");
}
}
| [
"matt@majenko.co.uk"
] | matt@majenko.co.uk |
8dd506a369f89d097dd351e3e6a3ef2d14101820 | f693691fce24120da77973ddaa02f95aea7628d8 | /src/main/java/davecat/controller/ExceptionControllerImplementation.java | d574e60b5473b35dc179b355bc3ecc1bf9d684b3 | [] | no_license | hahagioi998/DaveCAT | e57116d06739d005d669772975d7c3cf227947aa | 9f90d7e1b05da0002a6e6884283abb10da0aab92 | refs/heads/master | 2022-04-17T06:32:05.773734 | 2018-06-29T12:05:47 | 2018-06-29T12:05:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,880 | java | package davecat.controller;
import davecat.exceptions.AttendanceAlreadyExistsException;
import davecat.exceptions.NotEmptyException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.persistence.EntityNotFoundException;
import javax.servlet.http.HttpServletRequest;
@Controller
@ControllerAdvice
public class ExceptionControllerImplementation implements ExceptionController {
@Override
@ExceptionHandler(EntityNotFoundException.class)
public String EntityNotFoundExceptionHandler(Model model, HttpServletRequest req, Exception ex) {
return MessageController.generateMessage(model,
"404 - Nem található",
ex.getMessage(),
"danger",
"A kért objektum nem található a rendszerben!",
false);
}
@Override
@ExceptionHandler(NotEmptyException.class)
public String NotEmptyExceptionHandler(Model model, HttpServletRequest req, Exception ex) {
return MessageController.generateMessage(model,
"Hiba!",
ex.getMessage(),
"warning",
"A kért művelet nem hajtható végre, ugyanis jelenléti ívek tartoznak hozzá. A törléshez előbb kérlet töröld ezeket!",
true);
}
@Override
@ExceptionHandler(AttendanceAlreadyExistsException.class)
public String AttendanceAlreadyExistsExceptionHandler(Model model, HttpServletRequest req, Exception ex) {
return MessageController.generateMessage(model,
"Jelenléti ív!",
ex.getMessage(),
"warning",
"A jelenléti ív már létezik!",
true);
}
}
| [
"davidka1997@gmail.com"
] | davidka1997@gmail.com |
8cc8a25a4855887fe0954d1cd62a82f15ab331e6 | b0376cc58ae5ab37da97ea4eaef88e2aeac9e99e | /server/src/main/java/com/example/package-info.java | 092b47301576bac725cd61838afd857800a1e314 | [] | no_license | jausanca/maven-project | d0ada88f455c3273ec6a8604a91807aa4a2cd419 | e6d223b6857aa494b88ae58e46a72c4a729a7ebf | refs/heads/master | 2020-04-10T19:36:44.242544 | 2018-12-10T22:44:24 | 2018-12-10T22:44:24 | 161,241,432 | 0 | 0 | null | 2018-12-10T21:55:41 | 2018-12-10T21:55:41 | null | UTF-8 | Java | false | false | 51 | java | /**
* Package com.example.
*/
package com.example;
| [
"jaume.sanjuan@gmail.com"
] | jaume.sanjuan@gmail.com |
b660e564eae8d631f6c0de3b8a96ae219fe3da2c | 5da891f4b722f0a9ba3eff9c606ddc20803716aa | /sharding-jdbc-demo/src/main/java/cn/dox/jdbcdemo/controller/UserController.java | 5c1c9ccd2d797d8311acbdd6c52b31c540708ac1 | [] | no_license | wdx9413/java-example | 730138186a2fd896559de81d37acb6582da5fc27 | 78b440cbe3517c375831597335e6d6d01b02a80f | refs/heads/master | 2021-06-16T03:57:18.220953 | 2020-07-07T07:09:14 | 2020-07-07T07:09:14 | 187,327,645 | 0 | 0 | null | 2020-10-13T13:19:15 | 2019-05-18T07:27:00 | Java | UTF-8 | Java | false | false | 941 | java | package cn.dox.jdbcdemo.controller;
import cn.dox.jdbcdemo.model.vo.Response;
import cn.dox.jdbcdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.util.Date;
import static cn.dox.jdbcdemo.common.constant.ResponseEnum.*;
/**
* @author: weidx
* @date: 2019/7/28
*/
@RestController
@RequestMapping("user")
public class UserController {
@Autowired
UserService userService;
@PostMapping("add")
public Response<String> add(String username, @DateTimeFormat(pattern = "yyyy-MM-dd") Date birthDate) {
userService.add(username, birthDate);
return Response.getInstance(OK, "");
}
}
| [
"wdx9413@163.com"
] | wdx9413@163.com |
61e8b1eee22e9718e14647dc1d4cc0f7f325f521 | 508e10c85d1bc6d1a0cf27ca0c71ed9c9541c225 | /src/main/java/com/mattxo/googleteamdriveservercopier/RemoteFile.java | 267e70cc9aea5d508712fd626fa7857d3090e3b8 | [] | no_license | matthew-stafford/GoogleTeamDriveServerCopier | 430037722d232941b2d0d80ed4ced306a545ebcc | 59a7f0b720b07b9a1a9e662ce892a05c413953a8 | refs/heads/master | 2023-02-10T03:14:36.393304 | 2021-01-09T13:07:34 | 2021-01-09T13:07:34 | 327,240,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 466 | 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.mattxo.googleteamdriveservercopier;
/**
*
* @author matt
*/
class RemoteFile {
public boolean isDirectory = false;
public boolean isFile = false;
public long fileSize = 0;
public String name = "";
public String filePath = "";
}
| [
"matt@matt-laptop"
] | matt@matt-laptop |
9620b842542098654555fdd4a593836f44bff585 | bed3f7009d56c0dca6ed5c74fd361f515c57395a | /01-DaneiWang/02-OOP/Day04/c_StaticDemo.java | cc5431b4616b18e3f7e844195f1b30bd10b6c117 | [] | no_license | czbijian/Java | 132af0d9a3a735ec761076fbf5eefdf1cb738c8d | 2bd74d7e34f2f70e757d8e1afc9b25ae6cee4b3b | refs/heads/master | 2022-04-29T08:46:20.144471 | 2022-04-19T04:53:52 | 2022-04-19T04:53:52 | 195,326,357 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 316 | java | public class c_StaticDemo {
public static void main(String[] args) {
Loo o1 = new Loo();
o1.show();
Loo o2 = new Loo();
o2.show();
}
}
class Loo{
int a; //实例变量
static int b; //静态变量
Loo(){
a++;
b++;
}
void show() {
System.out.println("a="+a);
System.out.println("b="+b);
}
} | [
"bijian@citos.cn"
] | bijian@citos.cn |
46dca11c6ae7e9557af64d5661607dca1acfc9a1 | 9f05595383ea123c370d7ecc39aa754d465d137e | /TaGO_android/app/src/main/java/com/automation/tago/Main/ShopFragment.java | 20fed82ef146659ce6310e3f76d73f8078310c10 | [] | no_license | reonlim/Android-Projects | 1ae46a6751ce247be094c3a314d76bc93f91ec0f | 4e504fc6fbcdafb9af361a4d71f95cd6814485de | refs/heads/master | 2020-04-27T13:39:47.179280 | 2019-03-11T11:53:57 | 2019-03-11T11:53:57 | 174,378,287 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,377 | java | package com.automation.tago.Main;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import com.automation.tago.Models.ShopItem;
import com.automation.tago.R;
import com.automation.tago.Utils.GlobalMemories;
import com.automation.tago.Utils.ShopListAdapter;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
public class ShopFragment extends Fragment {
//preliminaries in this fragment
private static final String TAG = "ShopFragment";
private Context mContext;
//view objects initiation
private ListView listView;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_list_shop, container, false);
Log.d(TAG, "onCreateView: inflating ShopFragment");
GlobalMemories.getmInstance().main_counter = 1;
mContext = getActivity();
startingSetup(view);
return view;
}
private void startingSetup(View view){
listView = view.findViewById(R.id.listView);
gettingShopDetails();
}
private void gettingShopDetails(){
final List<ShopItem> list_shop_items = new ArrayList<>();
DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
Query query = reference.child("Shop_list");
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for (DataSnapshot singleSnapshot : dataSnapshot.getChildren()) {
if(singleSnapshot.getKey() != null) {
if (singleSnapshot.getKey().equals(gettingUniName())) {
for (DataSnapshot singleSnapshot2 : singleSnapshot.getChildren()) {
list_shop_items.add(singleSnapshot2.getValue(ShopItem.class));
}
}
}
}
if(list_shop_items.size() > 0){
setupListView(list_shop_items);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
private String gettingUniName(){
Bundle bundle = getArguments();
if(bundle != null){
return bundle.getString("uni");
}else{
return null;
}
}
private void setupListView(List<ShopItem> list_shop_items){
ShopListAdapter adapter = new ShopListAdapter(mContext,R.layout.layout_listview_shopitem,
list_shop_items,getFragmentManager());
listView.setAdapter(adapter);
}
}
| [
"reonljhui@gmail.com"
] | reonljhui@gmail.com |
506da304cf935dc1b7cfc44a778dba238453b877 | 5fecdba0898fc229b3dfb3abfac2572af46eb229 | /src/main/java/com/dao/impl/SayDaoImpl.java | 06e39e576d57ef7b567dd38dc7124653ab2e7977 | [] | no_license | yao2923828/KeepAccount | 73d58e7f7f319bdd90d241c94e1cf0293a5d62ce | dcab1bc6bcce7e8cfe9c8147315d63332db78a03 | refs/heads/master | 2022-12-20T13:17:41.575598 | 2019-07-24T14:12:08 | 2019-07-24T14:12:08 | 137,498,772 | 0 | 0 | null | 2022-12-16T03:21:25 | 2018-06-15T14:44:00 | Java | UTF-8 | Java | false | false | 216 | java | package com.dao.impl;
import com.dao.ISayDao;
import org.springframework.stereotype.Repository;
@Repository
public class SayDaoImpl implements ISayDao {
public void say() {
System.out.println("hello");
}
}
| [
"Phhv0JCx7Nn8fLVN"
] | Phhv0JCx7Nn8fLVN |
f052ad91a4b5af36ad137e45d810bae0940357f6 | cff96544b1995bf6aaf222f66105cc7d87bb813a | /src/com/chen/db/bean/Role.java | 2669e0491e63aecab783b2e920f97dd661150b4d | [] | no_license | xuqinghuan/DataoshaLockstepGameServer | 3ac6d30080170431b1cf13127bbfb4712e7b02b0 | 3f497ec5f547092583d0a12fcec0575ef1359afe | refs/heads/master | 2020-04-01T07:18:56.442958 | 2017-09-27T09:32:16 | 2017-09-27T09:32:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,290 | java | package com.chen.db.bean;
public class Role
{
private Long roleId;
private String userId;
private Integer createServer;
private String name;
private Integer sex;
private Integer level;
private Long exp;
private Integer icon;
private int money;
private int ticket;
private String loginIp;
private Long onlineTime;
private int addBlackCount;
private int isForbit;
private String data;
public int getMoney() {
return money;
}
public void setMoney(int money) {
this.money = money;
}
public int getTicket() {
return ticket;
}
public void setTicket(int ticket) {
this.ticket = ticket;
}
public Long getOnlineTime() {
return onlineTime;
}
public void setOnlineTime(Long onlineTime) {
this.onlineTime = onlineTime;
}
public int getAddBlackCount() {
return addBlackCount;
}
public void setAddBlackCount(int addBlackCount) {
this.addBlackCount = addBlackCount;
}
public Role() {
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Integer getCreateServer() {
return createServer;
}
public void setCreateServer(Integer createServer) {
this.createServer = createServer;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Long getExp() {
return exp;
}
public void setExp(Long exp) {
this.exp = exp;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
public Integer getIcon() {
return icon;
}
public void setIcon(Integer icon) {
this.icon = icon;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public int getIsForbit() {
return isForbit;
}
public void setIsForbit(int isForbit) {
this.isForbit = isForbit;
}
}
| [
"443850741@qq.com"
] | 443850741@qq.com |
1d81bb7222fbdc47778842934838d82e877213c6 | b78837c778faf07a4878cfcf7f90e9d8884d4546 | /Dumpit_Sweeper/app/src/main/java/com/a000webhostapp/trackingdaily/dumpit_sweeper/Sector.java | 6ca10c47c9cb3c845fd6eb3a83d48c90f1a1d626 | [] | no_license | onucsecu2/dumpIt | d379a3b12922664258c809dfa1a0fb28c5a4cd17 | e5aa0c36884bf69668004b7718106c4e84f1e685 | refs/heads/master | 2020-09-28T04:04:34.191048 | 2019-12-10T11:27:46 | 2019-12-10T11:27:46 | 146,156,074 | 1 | 0 | null | 2018-08-26T06:07:45 | 2018-08-26T06:07:44 | null | UTF-8 | Java | false | false | 570 | java | package com.a000webhostapp.trackingdaily.dumpit_sweeper;
import com.google.android.gms.maps.model.PolygonOptions;
/**
* Created by onu on 8/29/18.
*/
public class Sector {
PolygonOptions polygonOptions;
String areacode;
public Sector(){
}
public Sector(PolygonOptions polygonOptions, String areacode) {
this.polygonOptions = polygonOptions;
this.areacode = areacode;
}
public PolygonOptions getPolygonOptions() {
return polygonOptions;
}
public String getAreacode() {
return areacode;
}
}
| [
"onucsecu@gmail.com"
] | onucsecu@gmail.com |
faba1d6519a5e1ca4ffccc6e6a2d7c97964cb85b | f525deacb5c97e139ae2d73a4c1304affb7ea197 | /gitv/src/main/java/com/gala/video/app/epg/init/task/PushServiceInitTask.java | 71981958735b8393e30af18b579e84329b6b8b4d | [] | no_license | AgnitumuS/gitv | 93b2359e1bf9f2b6c945298c61c5c6dbfeea49b3 | 242c9a10a0aeb41b9589de9f254e6ce9f57bd77a | refs/heads/master | 2021-08-08T00:50:10.630301 | 2017-11-09T08:10:33 | 2017-11-09T08:10:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | package com.gala.video.app.epg.init.task;
import android.content.Context;
import com.gala.video.app.epg.ui.imsg.dialog.MsgDialogHelper;
import com.gala.video.lib.share.ifimpl.imsg.utils.IMsgUtils;
import com.gala.video.lib.share.project.Project;
import com.gala.video.lib.share.system.preference.setting.SettingPlayPreference;
public class PushServiceInitTask implements Runnable {
private Context mContext;
public PushServiceInitTask(Context context) {
this.mContext = context;
}
public void run() {
IMsgUtils.getAppId(Project.getInstance().getBuild().getPingbackP2());
IMsgUtils.sPkgName = this.mContext.getPackageName();
IMsgUtils.setShowDialog(SettingPlayPreference.getMessDialogOpen(this.mContext));
MsgDialogHelper.get().setReceiverListener();
IMsgUtils.init();
IMsgUtils.getSystem();
}
}
| [
"liuwencai@le.com"
] | liuwencai@le.com |
65b3d859fe8df030e9c251fb7d5424d1681fa073 | ae6e7a9310cb6d8de1260e8aab16bd0574a0f4e7 | /src/C3Collections/Programs/StackADT.java | 5346c4bf081e85d101ae878da8e3f8e00da40edc | [
"MIT"
] | permissive | gosaliajigar/DesigningAndUsingDataStructures | 3297664247b69ece95f444c282ce0502edc7155c | 62a8d5176b2f1ba351c1509dab7619dbb02b24b5 | refs/heads/master | 2021-01-10T10:57:00.157077 | 2016-03-08T00:07:16 | 2016-03-08T00:07:16 | 53,279,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | package C3Collections.Programs;
/**
* Stack Abstract Data Type Interface.
*
* @author "Jigar Gosalia"
*
*/
public interface StackADT<T> {
/**
* Push elements in stack. <br><br>
*
* Time Complexity: Worst Case O(n) & Average Case O(1)
*
* @param element
*/
public void push(T element);
/**
* Push elements from stack. <br><br>
*
* Time Complexity: Worst Case O(1) & Average Case O(1)
*
* @return
*/
public T pop() throws Exception;
/**
* Peek top most element from stack. <br><br>
*
* Time Complexity: Worst Case O(1) & Average Case O(1)
*
* @return
*/
public T peek() throws Exception;
/**
* Check if stack is empty. <br><br>
*
* Time Complexity: Worst Case O(1) & Average Case O(1)
*
* @return
*/
public boolean isEmpty();
/**
* Get size of stack. <br><br>
*
* Time Complexity: Worst Case O(1) & Average Case O(1)
*
* @return
*/
public int size();
/**
* Print stack. <br><br>
*
* Time Complexity: Worst Case O(n) & Average Case O(n)
*
* @return
*/
public String toString();
}
| [
"jgosalia@paypal.com"
] | jgosalia@paypal.com |
5f04ec6aae910ebc0495fd5a0550e168a940e0a8 | 4aa4a8fb3c13dcdf674c66c9711c29b51aa51e30 | /src/main/java/com/cashup/repository/ClientRepository.java | a8e7315e1276bf9bc0aa5c86d44c83efe11b10a9 | [] | no_license | TomashenkoI/rest_service | e8899a4b35f514f759b3fc72610397434cbae74a | 270545f5b06daa61d24de886d811fcb67a4f208e | refs/heads/master | 2021-03-16T08:38:06.900818 | 2017-10-22T09:42:29 | 2017-10-22T09:42:29 | 106,169,407 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package com.cashup.repository;
import com.cashup.entity.Client;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ClientRepository extends JpaRepository<Client, Integer> {
Client findByLastName(String lastName);
}
| [
"TomashenkoI@gmail.com"
] | TomashenkoI@gmail.com |
d0552fc8c72736e8784f702c06d5041887f183b6 | de90e39f1a15f0431079cd38b8b324c73dcffb03 | /app/src/main/java/ru/sberbank/lesson12/task/alarmclock/domain/interactor/impl/GetAllAlarmClocksInteractor.java | e6619c7175b3f782736aac3a6d4997514c55241c | [] | no_license | w3dip/lesson12.task.alarmclock | 38255c08d840d97d0ed75b8b9f45c89ad6607f9c | d502c897fd31270a885fff0185ae98e0cc105b0c | refs/heads/master | 2020-04-23T10:15:00.656874 | 2019-03-08T12:01:13 | 2019-03-08T12:01:13 | 171,097,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 970 | java | package ru.sberbank.lesson12.task.alarmclock.domain.interactor.impl;
import java.util.List;
import javax.inject.Inject;
import io.reactivex.Flowable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import ru.sberbank.lesson12.task.alarmclock.domain.interactor.Interactor;
import ru.sberbank.lesson12.task.alarmclock.domain.model.AlarmClockItem;
import ru.sberbank.lesson12.task.alarmclock.domain.repository.AlarmClockRepository;
public class GetAllAlarmClocksInteractor implements Interactor<Flowable<List<AlarmClockItem>>> {
private AlarmClockRepository repository;
@Inject
GetAllAlarmClocksInteractor(AlarmClockRepository repository) {
this.repository = repository;
}
@Override
public Flowable<List<AlarmClockItem>> execute() {
return repository.getAll()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
}
| [
"w3dipmail@gmail.com"
] | w3dipmail@gmail.com |
f70c8407651b6a5d97d502738659ff64b8bc42bc | 2c20bc30d350c7bd1d37bc826889a6514eb14d4f | /src/main/java/com/eason/api_member/base/ResponseResult.java | 2e865b3ca734f0ab1bd7a06c64e9188774f9981c | [] | no_license | Easonnaly/api-memeber | a0b79edca4bddcf3d778964a85af3852fd7ad634 | 228567fe0953116bf6cbe9f2fce37a918af095b4 | refs/heads/master | 2022-12-09T20:04:07.146840 | 2019-11-08T05:43:27 | 2019-11-08T05:43:27 | 220,368,482 | 0 | 0 | null | 2022-12-06T00:33:35 | 2019-11-08T02:14:58 | Java | UTF-8 | Java | false | false | 486 | java | package com.eason.api_member.base;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Copyright (C), 2019-2025, xingyun information technology wuxi Co., Ltd.
*
* @author Eason
* @version 1.00
* @date 2019/11/5 22:39
*/
@Data
@NoArgsConstructor
public class ResponseResult<T> {
private Integer code;
private String message;
private T data;
public ResponseResult(Integer code,String message){
this.code=code;
this.message=message;
}
}
| [
"18888046840@163.com"
] | 18888046840@163.com |
8fb9012083625023f16574294cf57ceb94d1ebf7 | 67411a71725b0287eab6f18c1c95640249998ce4 | /src/src/de/tubs/ibr/android/ldap/provider/SearchThread.java | f72dd81df485f906a1c391ba418b8190365c716c | [] | no_license | soneyworld/AndroidLab | ba8136c467aece276c609581bbfa33df7cbf4f66 | e052670cc1286cc2c7bf071d87ddd878bbe94585 | refs/heads/master | 2016-09-06T21:41:37.675215 | 2011-07-12T14:09:41 | 2011-07-12T14:09:41 | 1,566,558 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,195 | java | /*
* Copyright 2009-2010 UnboundID Corp.
* All Rights Reserved.
*/
/*
* Copyright (C) 2009-2010 UnboundID Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (GPLv2 only)
* or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
* as published by the Free Software Foundation.
*
* 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 de.tubs.ibr.android.ldap.provider;
import com.unboundid.ldap.sdk.Filter;
import com.unboundid.ldap.sdk.LDAPConnection;
import com.unboundid.ldap.sdk.LDAPException;
import com.unboundid.ldap.sdk.LDAPSearchException;
import com.unboundid.ldap.sdk.SearchRequest;
import com.unboundid.ldap.sdk.SearchResult;
import com.unboundid.ldap.sdk.SearchScope;
import de.tubs.ibr.android.ldap.auth.ServerInstance;
/**
* This class defines a thread that will be used to perform a search and
* provide the result to the activity that started it.
*/
public final class SearchThread
extends Thread
{
/**
* The size limit that will be used for searches.
*/
static final int SIZE_LIMIT = 100;
/**
* The time limit (in seconds) that will be used for searches.
*/
static final int TIME_LIMIT_SECONDS = 30;
// The filter to use for the search.
private final Filter filter;
// The activity that created this thread.
private final SearchServerInterface caller;
// The instance in which the search is to be performed.
private final ServerInstance instance;
/**
* Creates a new search thread with the provided information.
*
* @param caller The activity that created this thread.
* @param instance The instance in which the search is to be performed.
* @param filter The filter to use for the search.
*/
public SearchThread(final SearchServerInterface caller, final ServerInstance instance,
final Filter filter)
{
this.caller = caller;
this.instance = instance;
this.filter = filter;
}
/**
* Processes the search and returns the result to the caller.
*/
@Override()
public void run()
{
// Perform the search.
SearchResult result;
LDAPConnection conn = null;
try
{
conn = instance.getConnection();
final SearchRequest request = new SearchRequest(instance.getBaseDN(),
SearchScope.SUB, filter);
request.setSizeLimit(SIZE_LIMIT);
request.setTimeLimitSeconds(TIME_LIMIT_SECONDS);
result = conn.search(request);
}
catch (LDAPSearchException lse)
{
result = lse.getSearchResult();
}
catch (LDAPException le)
{
result = new LDAPSearchException(le).getSearchResult();
}
finally
{
if (conn != null)
{
conn.close();
}
}
caller.searchDone(result);
}
}
| [
"t.lorentzen@tu-bs.de"
] | t.lorentzen@tu-bs.de |
21343e0c621d440ab11e8378a6e9c0100eafa037 | eb460695a7c48bef932aca0c22c8774fa8873e88 | /JavaBasic/project03/src/domain/NoteBook.java | 7fb81ced95e8081bb2210013aa8422677711846d | [] | no_license | 1065464173/java-language-basic | 71fd4b00594dab14f84bc5228a33aeca38d87fb2 | ff187e09c5eba8f96e9b779e40aa737c64cb31ce | refs/heads/master | 2023-07-06T21:28:38.155074 | 2021-08-14T14:34:01 | 2021-08-14T14:34:01 | 395,994,933 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 849 | java | /*
* @Author: Sxuet
* @Date: 2021-06-05 17:11:52
* @LastEditTime: 2021-06-05 18:10:29
* @LastEditors: Sxuet
* @FilePath: /project03/src/domain/NoteBook.java
* @Description:
*/
package domain;
public class NoteBook implements Equipment {
private String model;
private double price;
public NoteBook() {
super();
}
public NoteBook(String model, double price) {
this.model = model;
this.price = price;
}
public String getModel() {
return this.model;
}
public void setModel(String model) {
this.model = model;
}
public double getPrice() {
return this.price;
}
public void setPrice(double price) {
this.price = price;
}
@Override
public String getDescription() {
return model+"("+price+")";
}
}
| [
"1065464173@qq.com"
] | 1065464173@qq.com |
a146b86a69512193bd0454bd0e003635ca6f5c92 | b8d5f84b1d6720cc6296b4335d57c58b72a19643 | /java-base-review/src/main/java/com/xdq/unsynch/Bank.java | 52729bab6f0d2b24a8dc94439034fbce595409b7 | [] | no_license | sleepxdq/java-learn | 0daf235f2ad411f2357f7dd25798a19a7c4cea12 | 4a5d658781c206137d80dd05b2570966181e37b5 | refs/heads/master | 2021-01-20T07:27:30.805493 | 2018-08-25T11:49:18 | 2018-08-25T11:49:18 | 101,538,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,524 | java | package com.xdq.unsynch;
import java.util.Arrays;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* Created by xu_do on 2018/1/21.
*/
public class Bank {
private final double[] accounts;
private Lock bankLock;
private Condition sufficientFunds;
public Bank(int n, double initialBalance) {
accounts = new double[n];
Arrays.fill(accounts, initialBalance);
bankLock = new ReentrantLock();
sufficientFunds = bankLock.newCondition();
}
public void transfer(int from, int to, double amount) throws InterruptedException {
bankLock.lock();
try {
while (accounts[from] < amount)
sufficientFunds.await();
System.out.print(Thread.currentThread());
accounts[from] -= amount;
System.out.printf(" %10.2f from %d to %d", amount, from, to);
accounts[to] += amount;
System.out.printf(" Total Balance: %10.2f%n", getTotalBalance());
sufficientFunds.signalAll();
}
finally {
bankLock.unlock();
}
}
public double getTotalBalance() {
bankLock.lock();
try {
double sum = 0;
for (double a : accounts)
sum += a;
return sum;
}
finally {
bankLock.unlock();
}
}
public int size() {
return accounts.length;
}
}
| [
"xu_dongqiang@foxmail.com"
] | xu_dongqiang@foxmail.com |
a3f9bf30038759f2382a42322d0233f70e9e0bcd | 49c7742f7a0c9d70c785b47a057fd90430ad32fe | /src/com/techproed/Day03_LocatorsGiris.java | 688c2ff7f34469ebcb8e482446158133864b20ae | [] | no_license | huseyin0865/SeleniumIlkProje | 0c81688b80bff873c291403e9a67839d7cd7c867 | 50a1f01425544f041cac27ba8c4110250235cf84 | refs/heads/master | 2022-12-08T08:30:02.722463 | 2020-08-23T23:30:38 | 2020-08-23T23:30:38 | 288,774,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,687 | java | package com.techproed;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class Day03_LocatorsGiris {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\CEM BULUT\\Documents\\selenium dependencies\\drivers\\chromedriver.exe");
WebDriver driver= new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10000, TimeUnit.MILLISECONDS);
driver.manage().window().maximize();
driver.get("http://a.testaddressbook.com/");
//ilk webelementi buluyoruz
//"Hamza"; string
// web sayfasindaki tum eelmanlar webelement
//web elementi bulduk ve
WebElement singInLink = driver.findElement(By.id("sign-in"));
//webelemente tikladik
singInLink.click();
//e mail kutusunu bulkalim
WebElement emailKutusu = driver.findElement(By.id("session_email"));
emailKutusu.sendKeys("testtechproed@gmail.com");
//sifre kutusunu buluyor
WebElement sifreKutusu = driver.findElement(By.id("session_password"));
//sifre giriyor
sifreKutusu.sendKeys("Test1234!");
// sign in butonunu buluyoruz. // name="commit"
WebElement signInButonu = driver.findElement(By.name("commit"));
signInButonu.click();
String baslik = driver.getTitle();
if(baslik.equals("Address Book")){
System.out.println("Giriş Başarılı.");
}else{
System.out.println("Giriş Başarısız.");
}
}
}
| [
"huseyingun0865@gmail.com"
] | huseyingun0865@gmail.com |
08fe7c1cc16ab94028bb496c46865dfed9939e4d | b3ec7b9aa29efa64bce578f1a4a3e875dfdc9fb1 | /hw02-diy-array-list/src/main/java/ru.otus/DIYIterator.java | 36a954998bd59ad82b05b66e4749718bd6997f92 | [] | no_license | ArtyomZoloto/2020-06-otus-java-Zolotoverkhov | 5a3a51d8bdc831f74ba1a642eb3896ede3102190 | 62f6fc114c0facc7020ea5a391e2b27e62dc2924 | refs/heads/master | 2023-03-13T23:46:13.342452 | 2021-03-01T18:20:44 | 2021-03-01T18:20:44 | 276,190,370 | 0 | 0 | null | 2021-03-01T18:20:45 | 2020-06-30T19:28:38 | Java | UTF-8 | Java | false | false | 457 | java | package ru.otus;
import java.util.Iterator;
public class DIYIterator<T> implements Iterator<T> {
Object[] array;
int index;
public DIYIterator(Object[] array) {
this.array = array;
}
@Override
public boolean hasNext() {
return array.length > index;
}
@Override
public T next() {
return (T) array[index++];
}
@Override
public void remove() {
array[index] = null;
}
}
| [
"artyomzolotoverkhov@gmail.com"
] | artyomzolotoverkhov@gmail.com |
f488cbb277bedc74620f5fe08c43f5786f710350 | a6c1f09062fb769e289690f48a47a6736d48422d | /NightgamesMod/nightgames/characters/body/mods/ParasitedMod.java | 007a129b5e81b5b3ca5115b3053668fa93c5f752 | [] | no_license | DarkSinfulMage/nightgamesmod | a771f8378e5d2a6e0b4b9fb97123a00f20229c87 | 19f8eda7d107cf13fc3e7fa31e73a1e5920a97ad | refs/heads/master | 2021-01-20T18:32:55.300423 | 2018-11-16T18:30:15 | 2018-11-16T18:30:15 | 90,923,012 | 4 | 2 | null | 2017-08-13T00:37:36 | 2017-05-11T01:18:01 | Java | UTF-8 | Java | false | false | 1,370 | java | package nightgames.characters.body.mods;
import java.util.Optional;
import nightgames.characters.Character;
import nightgames.characters.body.BodyPart;
import nightgames.combat.Combat;
import nightgames.global.Global;
public class ParasitedMod extends PartMod {
public static final ParasitedMod INSTANCE = new ParasitedMod();
public ParasitedMod() {
super("parasited", 0, 0, 0, -1000);
}
public double applyReceiveBonuses(Combat c, Character self, Character opponent, BodyPart part, BodyPart target, double damage) {
c.write(self, Global.format("The parasite inhabiting {self:name-possessive} %s is making {self:direct-object} <b>extremely sensitive</b>.", self, opponent, part.getType()));
return 10;
}
public void onOrgasm(Combat c, Character self, Character opponent, BodyPart part) {
String partName = part.describe(self);
c.write(self, Global.format(
"The force of {self:name-possessive} orgasm ejects the slimy lifeform from {self:possessive} %s.",
self, opponent, partName));
self.body.removeTemporaryPartMod(part.getType(), this);
}
public Optional<String> getFluids() {
return Optional.of("slime parasite");
}
@Override
public String describeAdjective(String partType) {
return "parasite";
}
} | [
"nergantre@mail.com"
] | nergantre@mail.com |
f4e256ecf1ab633eda0f8b6f4ceef76d03e89d2d | f154a75455594aca333705ff74e5c71e8a4ddd2e | /src/main/java/com/mrbysco/justenoughprofessions/jei/ProfessionEntry.java | e68f74c74ce1f8af0489243e943ebc3c662ae66b | [
"MIT"
] | permissive | BernardoGrigiastro/JustEnoughProfessions | 7a4b480262a2986f80dc888fae3e3fe3e3fa2ba9 | 9e5a2db90c2d3ce18e5410a2550d84b9e74752d9 | refs/heads/main | 2023-08-19T06:21:03.188522 | 2021-10-01T17:38:09 | 2021-10-01T17:38:09 | 412,569,130 | 0 | 0 | MIT | 2021-10-01T17:59:25 | 2021-10-01T17:59:25 | null | UTF-8 | Java | false | false | 2,109 | java | package com.mrbysco.justenoughprofessions.jei;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.merchant.villager.VillagerProfession;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.world.World;
import net.minecraftforge.registries.ForgeRegistries;
import javax.annotation.Nullable;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Function;
public class ProfessionEntry {
private final VillagerProfession profession;
private final List<ItemStack> blockStacks;
public ProfessionEntry(VillagerProfession profession, Int2ObjectMap<ItemStack> stacks) {
this.profession = profession;
this.blockStacks = new LinkedList<>();
addProfessionStacks(stacks);
}
public void addProfessionStacks(Int2ObjectMap<ItemStack> stackList) {
for (int i = 0; i < stackList.size(); i++) {
this.blockStacks.add(stackList.get(i));
}
}
public VillagerProfession getProfession() {
return profession;
}
public List<ItemStack> getBlockStacks() {
return blockStacks;
}
@Nullable
public VillagerEntity getVillagerEntity() {
CompoundNBT nbt = new CompoundNBT();
nbt.putString("id", ForgeRegistries.ENTITIES.getKey(EntityType.VILLAGER).toString());
Minecraft mc = Minecraft.getInstance();
World world = mc.hasSingleplayerServer() && mc.getSingleplayerServer() != null ? mc.getSingleplayerServer().getAllLevels().iterator().next() : mc.level;
if(world != null) {
VillagerEntity villagerEntity = (VillagerEntity)EntityType.loadEntityRecursive(nbt, world, Function.identity());
if(villagerEntity != null) {
villagerEntity.setVillagerData(villagerEntity.getVillagerData().setProfession(this.profession));
return villagerEntity;
}
}
return null;
}
}
| [
"Mrbysco@users.noreply.github.com"
] | Mrbysco@users.noreply.github.com |
005b183bebf22659169264885f6f758eb3757084 | 88eb6195ff8dc7f7493af8fe392b0e5f2fa9a9fc | /src/main/java/org/sabar/easynotes/repository/NoteRepository.java | b65ec37a429ae40d9ed0818f88515593d8575e76 | [] | no_license | SabarTanjungsari/easy-notes | cf0ceda65176de86e17723f389e5b12bd0337c24 | 0d0480f27a58911f03c46fb56bdc259a7682b48c | refs/heads/master | 2020-05-03T00:40:46.053558 | 2019-04-11T09:50:40 | 2019-04-11T09:50:40 | 178,315,351 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 277 | java | package org.sabar.easynotes.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import org.sabar.easynotes.model.Note;
@Repository
public interface NoteRepository extends JpaRepository<Note, Long> {
}
| [
"sabartanjungsari@gmail.com"
] | sabartanjungsari@gmail.com |
8ae5e957e2befa6e47fdeb96f76a6d6f00e1f2f6 | 7a03c488b94e0ab1805d573935272389a248b429 | /src/main/java/com/dashan/news/po/user/User.java | a2683a0ac90991c3cac46931fa73a73cd2078fd7 | [] | no_license | Shanchun95/daxiaoshinews | cb726a2e5cd991d04606de875bfe92e4bc9e0dfa | e1660557bfedb75fbc7a896f5cd2363c5a333c5b | refs/heads/master | 2022-07-04T04:12:06.837791 | 2019-09-29T01:48:40 | 2019-09-29T01:48:40 | 210,991,792 | 0 | 0 | null | 2022-06-17T02:31:58 | 2019-09-26T03:29:13 | CSS | UTF-8 | Java | false | false | 2,205 | java | package com.dashan.news.po.user;
public class User {
private Integer userId;
private String userName;
private String password;
private String name;
private String sex;
private String age;
private String phone;
private String address;
private String remark;
private Integer createtime;
private Integer updatetime;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex == null ? null : sex.trim();
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age == null ? null : age.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Integer getCreatetime() {
return createtime;
}
public void setCreatetime(Integer createtime) {
this.createtime = createtime;
}
public Integer getUpdatetime() {
return updatetime;
}
public void setUpdatetime(Integer updatetime) {
this.updatetime = updatetime;
}
} | [
"1446533395@qq.com"
] | 1446533395@qq.com |
4ef9ca7b44412100ca7d2a2bd467ddc0ebd3904d | c675cef7c86ccd878d557abe88974d6cd4c275c9 | /C109118106_w06/src/models/DBConnection.java | e8b66b791f1772d5bab42a96a92b1e40f0c2d171 | [] | no_license | RXiau6/UMLhomework | 8495caeeb5bb0e736f100c42c32dbf7523f91004 | 66c5172b7e42b149558c900aa24af38ba1dfe858 | refs/heads/main | 2023-05-08T13:44:21.913703 | 2021-06-02T14:54:09 | 2021-06-02T14:54:09 | 345,651,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,236 | 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 models;
/**
*
* @author RXiau6
*/
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBConnection {
private static Connection conn = null;
private static final String URL = "jdbc:mariadb://localhost:3306/db_pos";
private static final String USER = "root";
private static final String PWD = "Skills39";
public static Connection getConnection() {
try {
if (conn != null && !conn.isClosed()) {
System.out.println("取得已連線靜態物件connection");
return conn;
} else {
conn = DriverManager.getConnection(URL, USER, PWD);
System.out.println("使用帳號與密碼連線到資料庫...");
}
} catch (SQLException ex) {
System.out.println("連線錯誤!");
System.out.println(ex.toString());
//ex.printStackTrace();
}
return conn;
}
}
| [
"qq5565227@gmail.com"
] | qq5565227@gmail.com |
f69606c2a57f0a58599297bde21e23b387f104fb | fec350c56c46798198a60facf43c6262713787ac | /Charm_Entry/src/net/sf/anathema/charmentry/model/data/ConfigurableCost.java | 9150968d68cbc3753c591a71f2acdaa516a84ff6 | [] | no_license | DoctorCalgori/anathema | 02d679a2015c872addd27f65a22bd8ddb77ea206 | 52cf73efe3b6a7ab2b51590a2837d562c8c927f8 | refs/heads/master | 2020-12-30T17:32:36.834119 | 2012-09-02T06:44:43 | 2012-09-02T06:44:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | package net.sf.anathema.charmentry.model.data;
public class ConfigurableCost implements IConfigurableCost {
private String value;
private String text;
private boolean permanent;
@Override
public String getCost() {
return value;
}
@Override
public String getText() {
return text;
}
@Override
public void setValue(String value) {
this.value = value;
}
@Override
public void setText(String text) {
this.text = text;
}
@Override
public boolean isPermanent() {
return permanent;
}
public void setPermanent(boolean permanent) {
this.permanent = permanent;
}
} | [
"ursreupke@gmail.com"
] | ursreupke@gmail.com |
4bcd2c0e72d69fa48982cbdc5ec9f98a00a9e05e | daa119690aa43a0cd2142b281f245696cb8fc275 | /FSRGallery/src/com/foresee/fsr/gallery/client/examples/misc/ToolTipsExample.java | ca242ce0b274ce4654d533e937087f555a4b8ce1 | [] | no_license | neolee/fsrg | bda34ef4655230acccccb482a462407fb2962463 | 7ec0cefa90c9a90de90807933dbda197f6b037c1 | refs/heads/master | 2016-09-16T05:05:43.474640 | 2010-02-04T04:02:45 | 2010-02-04T04:02:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 791 | java | /*
* Ext GWT - Ext for GWT
* Copyright(c) 2007-2009, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
package com.foresee.fsr.gallery.client.examples.misc;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.layout.FlowData;
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
import com.google.gwt.user.client.Element;
public class ToolTipsExample extends LayoutContainer {
@Override
protected void onRender(Element parent, int pos) {
super.onRender(parent, pos);
Button btn = new Button("Print");
btn.setToolTip(new ToolTipConfig("Information", "Prints the current document"));
add(btn, new FlowData(10));
}
}
| [
"neo.lee@gmail.com"
] | neo.lee@gmail.com |
2a20152b7b7d79a2d31d0cee2a9e31e5170a0095 | cdcf51931d561205f053662e0e195abe165309a2 | /src/main/java/cn/com/bsfit/frms/pay/engine/kryo/MemCachedItemSerializer.java | 8d5e033d895efb277fb600714730b20ed9fb3976 | [] | no_license | hhhcommon/validator-engine | a8b2c1a1979306a66c83013e1babd21191335919 | bceb95ebef11eb44620ad3486c8d22178369589a | refs/heads/master | 2020-04-02T12:49:11.290264 | 2017-02-24T06:42:48 | 2017-02-24T06:42:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,146 | java | package cn.com.bsfit.frms.pay.engine.kryo;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import cn.com.bsfit.frms.obj.MemCachedItem;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.esotericsoftware.kryo.serializers.DefaultSerializers.StringSerializer;
public class MemCachedItemSerializer extends Serializer<MemCachedItem> {
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Map create(Kryo kryo, Input input, Class type) {
return (Map) kryo.newInstance(type);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public MemCachedItem read(Kryo kryo, Input input, Class<MemCachedItem> class1) {
MemCachedItem item = new MemCachedItem();
item.setPrimaryKey(input.readString());
item.setPrimaryTag(input.readString());
Map map = create(kryo, input, HashMap.class);
int length = input.readInt(true);
Class keyClass = String.class;
Serializer keySerializer = new StringSerializer();
kryo.reference(map);
for (int i = 0; i < length; i++) {
Object key;
key = kryo.readObject(input, keyClass, keySerializer);
Object value;
value = kryo.readClassAndObject(input);
map.put(key, value);
}
item.putAll(map);
return item;
}
@SuppressWarnings({ "rawtypes" })
@Override
public void write(Kryo kryo, Output output, MemCachedItem item) {
output.writeString(item.getPrimaryKey());
output.writeString(item.getPrimaryTag());
int length = item.size();
output.writeInt(length, true);
Serializer keySerializer = new StringSerializer();
for (Iterator iter = item.entrySet().iterator(); iter.hasNext();) {
java.util.Map.Entry entry = (java.util.Map.Entry) iter.next();
kryo.writeObjectOrNull(output, entry.getKey(), keySerializer);
kryo.writeClassAndObject(output, entry.getValue());
}
}
} | [
"cxy@bsfit.com.cn"
] | cxy@bsfit.com.cn |
e6eb184c5170b1f1164b9ff361b37ae988497de9 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/plugin/finder/feed/ui/FinderAppPushRouteProxyUI$g.java | d9adf88c9de3ee1c6b14b26ffcd351208fa73edf | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 879 | java | package com.tencent.mm.plugin.finder.feed.ui;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.finder.extension.reddot.p;
import kotlin.Metadata;
import kotlin.g.a.b;
import kotlin.g.b.u;
@Metadata(d1={""}, d2={"<anonymous>", "", "it", "Lcom/tencent/mm/plugin/finder/extension/reddot/LocalFinderRedDotCtrInfo;"}, k=3, mv={1, 5, 1}, xi=48)
final class FinderAppPushRouteProxyUI$g
extends u
implements b<p, Boolean>
{
public static final g BlA;
static
{
AppMethodBeat.i(365714);
BlA = new g();
AppMethodBeat.o(365714);
}
FinderAppPushRouteProxyUI$g()
{
super(1);
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes.jar
* Qualified Name: com.tencent.mm.plugin.finder.feed.ui.FinderAppPushRouteProxyUI.g
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
0bc34d8704c651b0b8e39117045115a5d8dd8639 | 2e041183e95c14e46e1f27450f39960521fe09d8 | /src/cgv/deagu/handler/movie/MovieTimeHandler.java | 378fbf21d82aa03080d45c818fbd0f6ba5ecb767 | [] | no_license | JamesAreuming/MVC_CGV | 14821ca601e358bb509c3d7a13a4b0d4f2d98dde | 0bf4b01682c00d3ce4c324ba4dde6a61498586e1 | refs/heads/master | 2021-05-18T15:23:07.345399 | 2020-03-30T12:22:31 | 2020-03-30T12:22:31 | 251,296,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package cgv.deagu.handler.movie;
import java.sql.Connection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cgv.deagu.dao.MovieDao;
import cgv.deagu.jdbc.JDBCUtil;
import cgv.deagu.model.Movie;
import cgv.deagu.mvc.CommandHandler;
public class MovieTimeHandler implements CommandHandler{
@Override
public String process(HttpServletRequest req, HttpServletResponse res) throws Exception {
if(req.getMethod().equalsIgnoreCase("get")) {
Connection conn = null;
try {
conn = JDBCUtil.getConnection();
MovieDao dao = MovieDao.getInstance();
List<Movie> list = dao.listMovie(conn);
req.setAttribute("list", list);
}catch(Exception e) {
e.printStackTrace();
}finally {
JDBCUtil.close(conn);
}
return "/WEB-INF/view/movie/menu2.jsp";
}
return null;
}
}
| [
"hothihi5@gmail.com"
] | hothihi5@gmail.com |
f4657d1b0282415e93c9a7c7f070f7a8749922f0 | 65042718252bde6e84bb55ae45446124b0353fbc | /Project/孙莹娇/接口测试2021/4月19~21日+分页展示信息/inter/service/InterServiceImpl.java | 7035e1df57eb7abd39c273c4b9dbfdf0eb8523fb | [] | no_license | huhuxx/MetInfoTestWork | 11d934bfd0b8756c4f14a44c533f2e07b3ddab69 | 0bb78f5685636d0d8dba0e939d841b3b9887b58b | refs/heads/main | 2023-05-25T13:19:14.724616 | 2021-06-07T00:45:40 | 2021-06-07T00:45:40 | 311,310,093 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 763 | java | package com.inter.service;
import java.util.List;
import com.inter.dao.InterDaoImpl;
import com.inter.entity.InterfaceRecord;
import com.inter.entity.Page;
public class InterServiceImpl {
public Page<InterfaceRecord> listByPage(int pageNum, int pageSize,String tableName){
Page<InterfaceRecord> page=new Page<InterfaceRecord>(pageNum,pageSize);
//调用Dao层方法
InterDaoImpl interDaoImpl=new InterDaoImpl();
//计算总的数据量
int count=interDaoImpl.countByPage(tableName);
//获取保存着要查询数据的list
List<InterfaceRecord> list=interDaoImpl.findByPage(pageNum, pageSize,tableName);
//page对象中的list保存数据集合,以便jsp中直接取出
page.setList(list);
page.setTotalCount(count);
return page;
}
}
| [
"1604447597@qq.com"
] | 1604447597@qq.com |
14ce70cfb5b96604ffccb99223a34e396e37657a | 38dce2742174a77892aeda720d5413004ea760a5 | /app/src/main/java/com/surat/surate_app/Sementara_Activity.java | 6f2b5141e8c911a2539319795dded991c224a0ea | [] | no_license | widhihandono/surat-e | f3a56f6b0c59bce2de9619fab9875670de9e386a | 857532e32d06f1e89664ef989b73046b847e312e | refs/heads/master | 2023-06-30T23:27:25.817197 | 2021-07-29T04:18:52 | 2021-07-29T04:18:52 | 276,835,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,236 | java | package com.surat.surate_app;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.surat.surate_app.Adapter.TabPager_sifat_jenis_Adapter;
import com.surat.surate_app.Fragment.fg_jenis;
import com.surat.surate_app.Fragment.fg_sifat;
public class Sementara_Activity extends AppCompatActivity implements fg_sifat.OnFragmentInteractionListener,
fg_jenis.OnFragmentInteractionListener{
ViewPager vPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sementara_);
getSupportActionBar().hide();
vPager = findViewById(R.id.pager);
TabPager_sifat_jenis_Adapter myPagerAdapter = new TabPager_sifat_jenis_Adapter(getSupportFragmentManager());
myPagerAdapter.addFragment();
myPagerAdapter.addFragment();
vPager.setAdapter(myPagerAdapter);
TabLayout tabLayout = findViewById(R.id.tablayout);
tabLayout.setupWithViewPager(vPager);
}
@Override
public void onFragmentInteraction(Uri uri) {
}
}
| [
"widhihandono7@gmail.com"
] | widhihandono7@gmail.com |
176006d9e2189dc197282684dd2e93fc1b5f8efc | 17c30fed606a8b1c8f07f3befbef6ccc78288299 | /Mate10_8_1_0/src/main/java/com/google/gson/internal/bind/util/ISO8601Utils.java | 15e3e4b78907d341a7dc9034957de7b0e051a819 | [] | no_license | EggUncle/HwFrameWorkSource | 4e67f1b832a2f68f5eaae065c90215777b8633a7 | 162e751d0952ca13548f700aad987852b969a4ad | refs/heads/master | 2020-04-06T14:29:22.781911 | 2018-11-09T05:05:03 | 2018-11-09T05:05:03 | 157,543,151 | 1 | 0 | null | 2018-11-14T12:08:01 | 2018-11-14T12:08:01 | null | UTF-8 | Java | false | false | 11,321 | java | package com.google.gson.internal.bind.util;
import com.android.server.rms.iaware.appmng.AwareAppAssociate;
import java.text.ParseException;
import java.text.ParsePosition;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
public class ISO8601Utils {
private static final TimeZone TIMEZONE_UTC = TimeZone.getTimeZone(UTC_ID);
private static final String UTC_ID = "UTC";
public static String format(Date date) {
return format(date, false, TIMEZONE_UTC);
}
public static String format(Date date, boolean millis) {
return format(date, millis, TIMEZONE_UTC);
}
public static String format(Date date, boolean millis, TimeZone tz) {
int i = 0;
Calendar calendar = new GregorianCalendar(tz, Locale.US);
calendar.setTime(date);
int capacity = "yyyy-MM-ddThh:mm:ss".length();
if (millis) {
i = ".sss".length();
}
capacity += i;
if (tz.getRawOffset() != 0) {
i = "+hh:mm".length();
} else {
i = "Z".length();
}
StringBuilder formatted = new StringBuilder(capacity + i);
padInt(formatted, calendar.get(1), "yyyy".length());
formatted.append('-');
padInt(formatted, calendar.get(2) + 1, "MM".length());
formatted.append('-');
padInt(formatted, calendar.get(5), "dd".length());
formatted.append('T');
padInt(formatted, calendar.get(11), "hh".length());
formatted.append(':');
padInt(formatted, calendar.get(12), "mm".length());
formatted.append(':');
padInt(formatted, calendar.get(13), "ss".length());
if (millis) {
formatted.append('.');
padInt(formatted, calendar.get(14), "sss".length());
}
int offset = tz.getOffset(calendar.getTimeInMillis());
if (offset == 0) {
formatted.append('Z');
} else {
char c;
int hours = Math.abs((offset / AwareAppAssociate.ASSOC_REPORT_MIN_TIME) / 60);
int minutes = Math.abs((offset / AwareAppAssociate.ASSOC_REPORT_MIN_TIME) % 60);
if (offset >= 0) {
c = '+';
} else {
c = '-';
}
formatted.append(c);
padInt(formatted, hours, "hh".length());
formatted.append(':');
padInt(formatted, minutes, "mm".length());
}
return formatted.toString();
}
public static Date parse(String date, ParsePosition pos) throws ParseException {
Exception fail;
String input;
String msg;
ParseException ex;
try {
int index = pos.getIndex();
int offset = index + 4;
int year = parseInt(date, index, offset);
if (checkOffset(date, offset, '-')) {
offset++;
}
index = offset + 2;
int month = parseInt(date, offset, index);
if (checkOffset(date, index, '-')) {
offset = index + 1;
} else {
offset = index;
}
index = offset + 2;
int day = parseInt(date, offset, index);
int hour = 0;
int minutes = 0;
int seconds = 0;
int milliseconds = 0;
boolean hasT = checkOffset(date, index, 'T');
Calendar calendar;
if (!hasT && date.length() <= index) {
calendar = new GregorianCalendar(year, month - 1, day);
pos.setIndex(index);
return calendar.getTime();
}
if (hasT) {
index++;
offset = index + 2;
hour = parseInt(date, index, offset);
if (checkOffset(date, offset, ':')) {
offset++;
}
index = offset + 2;
minutes = parseInt(date, offset, index);
if (checkOffset(date, index, ':')) {
offset = index + 1;
} else {
offset = index;
}
if (date.length() <= offset) {
index = offset;
} else {
char c = date.charAt(offset);
if (c == 'Z' || c == '+' || c == '-') {
index = offset;
} else {
index = offset + 2;
seconds = parseInt(date, offset, index);
if (seconds > 59 && seconds < 63) {
seconds = 59;
}
if (checkOffset(date, index, '.')) {
index++;
int endOffset = indexOfNonDigit(date, index + 1);
int parseEndOffset = Math.min(endOffset, index + 3);
int fraction = parseInt(date, index, parseEndOffset);
switch (parseEndOffset - index) {
case 1:
milliseconds = fraction * 100;
break;
case 2:
milliseconds = fraction * 10;
break;
default:
milliseconds = fraction;
break;
}
index = endOffset;
}
}
}
}
if (date.length() > index) {
TimeZone timezone;
char timezoneIndicator = date.charAt(index);
if (timezoneIndicator == 'Z') {
timezone = TIMEZONE_UTC;
index++;
} else if (timezoneIndicator == '+' || timezoneIndicator == '-') {
String timezoneOffset = date.substring(index);
if (timezoneOffset.length() < 5) {
timezoneOffset = timezoneOffset + "00";
}
index += timezoneOffset.length();
if ("+0000".equals(timezoneOffset) || "+00:00".equals(timezoneOffset)) {
timezone = TIMEZONE_UTC;
} else {
String timezoneId = "GMT" + timezoneOffset;
timezone = TimeZone.getTimeZone(timezoneId);
String act = timezone.getID();
if (!(act.equals(timezoneId) || act.replace(":", "").equals(timezoneId))) {
throw new IndexOutOfBoundsException("Mismatching time zone indicator: " + timezoneId + " given, resolves to " + timezone.getID());
}
}
} else {
throw new IndexOutOfBoundsException("Invalid time zone indicator '" + timezoneIndicator + "'");
}
calendar = new GregorianCalendar(timezone);
calendar.setLenient(false);
calendar.set(1, year);
calendar.set(2, month - 1);
calendar.set(5, day);
calendar.set(11, hour);
calendar.set(12, minutes);
calendar.set(13, seconds);
calendar.set(14, milliseconds);
pos.setIndex(index);
return calendar.getTime();
}
throw new IllegalArgumentException("No time zone indicator");
} catch (Exception e) {
fail = e;
input = date != null ? '\"' + date + "'" : null;
msg = fail.getMessage();
if (msg == null || msg.isEmpty()) {
msg = "(" + fail.getClass().getName() + ")";
}
ex = new ParseException("Failed to parse date [" + input + "]: " + msg, pos.getIndex());
ex.initCause(fail);
throw ex;
} catch (Exception e2) {
fail = e2;
if (date != null) {
}
msg = fail.getMessage();
if (msg == null) {
ex = new ParseException("Failed to parse date [" + input + "]: " + msg, pos.getIndex());
ex.initCause(fail);
throw ex;
}
msg = "(" + fail.getClass().getName() + ")";
ex = new ParseException("Failed to parse date [" + input + "]: " + msg, pos.getIndex());
ex.initCause(fail);
throw ex;
} catch (Exception e3) {
fail = e3;
if (date != null) {
}
msg = fail.getMessage();
if (msg == null) {
ex = new ParseException("Failed to parse date [" + input + "]: " + msg, pos.getIndex());
ex.initCause(fail);
throw ex;
}
msg = "(" + fail.getClass().getName() + ")";
ex = new ParseException("Failed to parse date [" + input + "]: " + msg, pos.getIndex());
ex.initCause(fail);
throw ex;
}
}
private static boolean checkOffset(String value, int offset, char expected) {
return offset < value.length() && value.charAt(offset) == expected;
}
private static int parseInt(String value, int beginIndex, int endIndex) throws NumberFormatException {
if (beginIndex >= 0 && endIndex <= value.length() && beginIndex <= endIndex) {
int i;
int digit;
int i2 = beginIndex;
int result = 0;
if (beginIndex >= endIndex) {
i = i2;
} else {
i2 = beginIndex + 1;
digit = Character.digit(value.charAt(beginIndex), 10);
if (digit >= 0) {
result = -digit;
i = i2;
} else {
throw new NumberFormatException("Invalid number: " + value.substring(beginIndex, endIndex));
}
}
while (i < endIndex) {
i2 = i + 1;
digit = Character.digit(value.charAt(i), 10);
if (digit >= 0) {
result = (result * 10) - digit;
i = i2;
} else {
throw new NumberFormatException("Invalid number: " + value.substring(beginIndex, endIndex));
}
}
return -result;
}
throw new NumberFormatException(value);
}
private static void padInt(StringBuilder buffer, int value, int length) {
String strValue = Integer.toString(value);
for (int i = length - strValue.length(); i > 0; i--) {
buffer.append('0');
}
buffer.append(strValue);
}
private static int indexOfNonDigit(String string, int offset) {
for (int i = offset; i < string.length(); i++) {
char c = string.charAt(i);
if (c < '0' || c > '9') {
return i;
}
}
return string.length();
}
}
| [
"lygforbs0@mail.com"
] | lygforbs0@mail.com |
b92cefb18cd5f094b7b72a911d4ea2b04d3a9df9 | 1358072379743cb0abdc61d6c4cc9de3afbd3889 | /mobileTravel/src/main/java/com/cmcc/hyapps/andyou/data/StringConverter.java | 4ad9733d640cc742ea62a3a59f8e544334e76655 | [] | no_license | gaoruishan/APP_v1.0 | 6263d300c0789546c9def4cdda5c1136933a13e4 | 81d9639b3bcbc7e20192f9df677fb907ebc30a8f | refs/heads/master | 2021-04-12T07:49:14.849539 | 2016-07-22T06:29:38 | 2016-07-22T06:29:38 | 63,929,088 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 962 | java | package com.cmcc.hyapps.andyou.data;
/**
* Created by Administrator on 2015/6/2.
*/
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import java.lang.reflect.Type;
public class StringConverter implements JsonSerializer<String>,JsonDeserializer<String> {
public JsonElement serialize(String src, Type typeOfSrc,JsonSerializationContext context) {
if ( src == null ) {
return new JsonPrimitive("");
} else {
return new JsonPrimitive(src.toString());
}
}
public String deserialize(JsonElement json, Type typeOfT,JsonDeserializationContext context)
throws JsonParseException {
return json.getAsJsonPrimitive().getAsString();
}
}
| [
"grs0515@163.com"
] | grs0515@163.com |
4e6f9f0351cd77b2da31a94aa5cf8b5dbe4a9a94 | 76a8c23c3038ca1e47aca330a027a66eb07cbd78 | /webui/src/main/java/com/vip/yyl/gateway/accesscontrol/AccessControlFilter.java | 14aa09f079f3812368ab1e1ebb6dfcb1f772620d | [] | no_license | ThunderStorm1503/ApiIntelligenceRobot | a17c0a7b1ee33b13f2b4a88c427f47d284f0a156 | 4c8e1e8e7c953029fe143fbac4ab3547cd7ad6ca | refs/heads/master | 2021-01-11T21:33:56.237708 | 2017-01-13T01:57:25 | 2017-01-13T01:57:25 | 78,805,492 | 0 | 1 | null | 2017-02-23T07:00:21 | 2017-01-13T02:02:24 | Java | UTF-8 | Java | false | false | 3,731 | java | package com.vip.yyl.gateway.accesscontrol;
import com.vip.yyl.config.JHipsterProperties;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.netflix.zuul.filters.Route;
import org.springframework.cloud.netflix.zuul.filters.RouteLocator;
import org.springframework.http.HttpStatus;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
/**
* Zuul filter for restricting access to backend micro-services endpoints.
*/
public class AccessControlFilter extends ZuulFilter {
private final Logger log = LoggerFactory.getLogger(AccessControlFilter.class);
@Inject
private RouteLocator routeLocator;
@Inject
private JHipsterProperties jHipsterProperties;
@Override
public String filterType() {
return "pre";
}
@Override
public int filterOrder() {
return 0;
}
/**
* Filter requests on endpoints that are not in the list of authorized microservices endpoints.
*/
@Override
public boolean shouldFilter() {
String requestUri = RequestContext.getCurrentContext().getRequest().getRequestURI();
// If the request Uri does not start with the path of the authorized endpoints, we block the request
for (Route route : routeLocator.getRoutes()) {
String serviceUrl = route.getFullPath();
String serviceName = route.getId();
// If this route correspond to the current request URI
// We do a substring to remove the "**" at the end of the route URL
if (requestUri.startsWith(serviceUrl.substring(0, serviceUrl.length() - 2))) {
return !isAuthorizedRequest(serviceUrl, serviceName, requestUri);
}
}
return true;
}
private boolean isAuthorizedRequest(String serviceUrl, String serviceName, String requestUri) {
Map<String, List<String>> authorizedMicroservicesEndpoints = jHipsterProperties.getGateway()
.getAuthorizedMicroservicesEndpoints();
// If the authorized endpoints list was left empty for this route, all access are allowed
if (authorizedMicroservicesEndpoints.get(serviceName) == null) {
log.debug("Access Control: allowing access for {}, as no access control policy has been set up for " +
"service: {}", requestUri, serviceName);
return true;
} else {
List<String> authorizedEndpoints = authorizedMicroservicesEndpoints.get(serviceName);
// Go over the authorized endpoints to control that the request URI matches it
for (String endpoint : authorizedEndpoints) {
// We do a substring to remove the "**/" at the end of the route URL
String gatewayEndpoint = serviceUrl.substring(0, serviceUrl.length() - 3) + endpoint;
if (requestUri.startsWith(gatewayEndpoint)) {
log.debug("Access Control: allowing access for {}, as it matches the following authorized " +
"microservice endpoint: {}", requestUri, gatewayEndpoint);
return true;
}
}
}
return false;
}
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
ctx.setResponseStatusCode(HttpStatus.FORBIDDEN.value());
if (ctx.getResponseBody() == null && !ctx.getResponseGZipped()) {
ctx.setSendZuulResponse(false);
}
log.debug("Access Control: filtered unauthorized access on endpoint {}", ctx.getRequest().getRequestURI());
return null;
}
}
| [
"king.yu@vipshop.com"
] | king.yu@vipshop.com |
52a1bd3e0a56993f8bdce8a39321811e040f5b0e | 80ad06f7cff900ac31c9715dd8c44963d3e307e0 | /src/main/java/ma/lnet/boncmd/service/dto/PanierDTO.java | 3ec5af2a11472597b2b0da3137a0ac6dcc1e47b6 | [] | no_license | BulkSecurityGeneratorProject/boncmd_mysql | 7058ce9eee4c72980ff67fd86a753c06ef96d0ae | f7fc9e76b02db9f6219afc409b952d7f1f862b7e | refs/heads/master | 2022-12-17T08:12:45.195254 | 2017-01-05T11:38:16 | 2017-01-05T11:38:16 | 296,593,974 | 0 | 0 | null | 2020-09-18T10:51:56 | 2020-09-18T10:51:55 | null | UTF-8 | Java | false | false | 1,646 | java | package ma.lnet.boncmd.service.dto;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
/**
* A DTO for the Panier entity.
*/
public class PanierDTO implements Serializable {
private Long id;
private Long quantite;
private Long commandeId;
private String commandeReferenceCommande;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getQuantite() {
return quantite;
}
public void setQuantite(Long quantite) {
this.quantite = quantite;
}
public Long getCommandeId() {
return commandeId;
}
public void setCommandeId(Long commandeId) {
this.commandeId = commandeId;
}
public String getCommandeReferenceCommande() {
return commandeReferenceCommande;
}
public void setCommandeReferenceCommande(String commandeReferenceCommande) {
this.commandeReferenceCommande = commandeReferenceCommande;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PanierDTO panierDTO = (PanierDTO) o;
if ( ! Objects.equals(id, panierDTO.id)) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
@Override
public String toString() {
return "PanierDTO{" +
"id=" + id +
", quantite='" + quantite + "'" +
'}';
}
}
| [
"osallah@lnet.ma"
] | osallah@lnet.ma |
23704709fc1634fd054d0553bd72d425b5879d53 | acedc6dd80d2a3f35fb737590987c014de4f95db | /Task/src/main/java/com/Project/Task2.java | 60d266aabb2a3dea41fa1716858c8ddc7c49063b | [] | no_license | gsaitarun/institute | 0bcba9d3bbe3abce946b812415d79d535cb548d9 | a23e8429210d591619478674b75392f3eaee19da | refs/heads/master | 2022-07-09T16:03:17.891858 | 2019-08-05T10:53:07 | 2019-08-05T10:53:07 | 200,637,163 | 0 | 0 | null | 2022-06-21T01:36:20 | 2019-08-05T10:50:49 | Java | UTF-8 | Java | false | false | 1,886 | java | package com.Project;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/s2")
public class Task2 extends HttpServlet
{
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
PrintWriter out = res.getWriter();
ResultSet rs = null;
try {
rs = DataBase2.getConnection2();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
while(rs.next())
{
out.print("<html>"
+ "<head>"
+ "<style>"
+ "body{ background-image: url(\"background.jpg\")}"
+ "</style>"
+ "</head>"
+ "<body> <pre><center><tr><td>"+rs.getInt(1)+"</td>"+" "+"<td>"+rs.getString(2)+"</td>"+" "+"<td>"+ rs.getString(3)+"</td></tr><br></center></pre> "
+ "</body>"
+ "</html>");
// out.println( "<center><tr><td>"+rs.getInt(1)+"</td>"+" "+"<td>"+rs.getString(2)+"</td>"+" "+"<td>"+ rs.getString(3)+"</td></tr><br></center>");
String n = ( rs.getInt(1)+" "+rs.getString(2)+" "+ rs.getString(3));
System.out.println(n);
// res.sendRedirect("index.jsp");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"manikantha.m@techouts.com"
] | manikantha.m@techouts.com |
dfa8804852e7499f53ba01ec21e005caf548997b | eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3 | /tags/2012-05-19/seasar2-2.4.46/s2jdbc-it/src/test/java/org/seasar/extension/jdbc/it/auto/AutoBatchUpdateTest.java | f292ca9954c0c0a08befd916977a216eae917127 | [] | no_license | svn2github/s2container | 54ca27cf0c1200a93e1cb88884eb8226a9be677d | 625adc6c4e1396654a7297d00ec206c077a78696 | refs/heads/master | 2020-06-04T17:15:02.140847 | 2013-08-09T09:38:15 | 2013-08-09T09:38:15 | 10,850,644 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 19,810 | java | /*
* Copyright 2004-2012 the Seasar Foundation and the Others.
*
* 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.seasar.extension.jdbc.it.auto;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityExistsException;
import javax.persistence.OptimisticLockException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.seasar.extension.jdbc.JdbcManager;
import org.seasar.extension.jdbc.exception.NoIdPropertyRuntimeException;
import org.seasar.extension.jdbc.it.entity.CompKeyDepartment;
import org.seasar.extension.jdbc.it.entity.ConcreteDepartment;
import org.seasar.extension.jdbc.it.entity.Department;
import org.seasar.extension.jdbc.it.entity.Department2;
import org.seasar.extension.jdbc.it.entity.Department3;
import org.seasar.extension.jdbc.it.entity.Department4;
import org.seasar.extension.jdbc.it.entity.Employee;
import org.seasar.extension.jdbc.it.entity.NoId;
import org.seasar.extension.jdbc.where.SimpleWhere;
import org.seasar.framework.unit.Seasar2;
import org.seasar.framework.unit.annotation.Prerequisite;
import static junit.framework.Assert.*;
/**
* @author taedium
*
*/
@RunWith(Seasar2.class)
public class AutoBatchUpdateTest {
private JdbcManager jdbcManager;
/**
*
* @throws Exception
*/
public void testExecute() throws Exception {
List<Department> list = new ArrayList<Department>();
Department department = new Department();
department.departmentId = 1;
department.departmentName = "hoge";
department.departmentNo = 10;
department.version = 1;
list.add(department);
Department department2 = new Department();
department2.departmentId = 2;
department2.departmentNo = 20;
department2.departmentName = "foo";
department2.version = 1;
list.add(department2);
int[] result = jdbcManager.updateBatch(list).execute();
assertEquals(2, result.length);
assertEquals(2, department.version);
assertEquals(2, department2.version);
department =
jdbcManager.from(Department.class).where(
new SimpleWhere().eq("departmentId", 1)).getSingleResult();
assertEquals(1, department.departmentId);
assertEquals(10, department.departmentNo);
assertEquals("hoge", department.departmentName);
assertNull(department.location);
assertEquals(2, department.version);
department =
jdbcManager.from(Department.class).where(
new SimpleWhere().eq("departmentId", 2)).getSingleResult();
assertEquals(2, department.departmentId);
assertEquals(20, department.departmentNo);
assertEquals("foo", department.departmentName);
assertNull(department.location);
assertEquals(2, department.version);
}
/**
*
* @throws Exception
*/
public void testExecute_includesVersion() throws Exception {
List<Department> list = new ArrayList<Department>();
Department department = new Department();
department.departmentId = 1;
department.departmentNo = 10;
department.departmentName = "hoge";
department.version = 100;
list.add(department);
Department department2 = new Department();
department2.departmentId = 2;
department2.departmentNo = 20;
department2.departmentName = "foo";
department2.version = 200;
list.add(department2);
int[] result =
jdbcManager.updateBatch(list).includesVersion().execute();
assertEquals(2, result.length);
assertEquals(100, department.version);
assertEquals(200, department2.version);
department =
jdbcManager.from(Department.class).where(
new SimpleWhere().eq("departmentId", 1)).getSingleResult();
assertEquals(1, department.departmentId);
assertEquals(10, department.departmentNo);
assertEquals("hoge", department.departmentName);
assertNull(department.location);
assertEquals(100, department.version);
department =
jdbcManager.from(Department.class).where(
new SimpleWhere().eq("departmentId", 2)).getSingleResult();
assertEquals(2, department.departmentId);
assertEquals(20, department.departmentNo);
assertEquals("foo", department.departmentName);
assertNull(department.location);
assertEquals(200, department.version);
}
/**
*
* @throws Exception
*/
public void testExecute_includes() throws Exception {
List<Department> list = new ArrayList<Department>();
Department department = new Department();
department.departmentId = 1;
department.departmentNo = 100;
department.departmentName = "hoge";
department.location = "foo";
department.version = 1;
list.add(department);
Department department2 = new Department();
department2.departmentId = 2;
department2.departmentNo = 200;
department2.departmentName = "bar";
department2.location = "baz";
department2.version = 1;
list.add(department2);
int[] result =
jdbcManager
.updateBatch(list)
.includes("departmentName", "location")
.execute();
assertEquals(2, result.length);
assertEquals(2, department.version);
assertEquals(2, department2.version);
department =
jdbcManager.from(Department.class).where(
new SimpleWhere().eq("departmentId", 1)).getSingleResult();
assertEquals(1, department.departmentId);
assertEquals(10, department.departmentNo);
assertEquals("hoge", department.departmentName);
assertEquals("foo", department.location);
assertEquals(2, department.version);
department =
jdbcManager.from(Department.class).where(
new SimpleWhere().eq("departmentId", 2)).getSingleResult();
assertEquals(2, department.departmentId);
assertEquals(20, department.departmentNo);
assertEquals("bar", department.departmentName);
assertEquals("baz", department.location);
assertEquals(2, department.version);
}
/**
*
* @throws Exception
*/
public void testExecute_excludes() throws Exception {
List<Department> list = new ArrayList<Department>();
Department department = new Department();
department.departmentId = 1;
department.departmentNo = 98;
department.departmentName = "hoge";
department.location = "foo";
department.version = 1;
list.add(department);
Department department2 = new Department();
department2.departmentId = 2;
department2.departmentNo = 99;
department2.departmentName = "bar";
department2.location = "baz";
department2.version = 1;
list.add(department2);
int[] result =
jdbcManager
.updateBatch(list)
.excludes("departmentName", "location")
.execute();
assertEquals(2, result.length);
assertEquals(2, department.version);
assertEquals(2, department2.version);
department =
jdbcManager.from(Department.class).where(
new SimpleWhere().eq("departmentId", 1)).getSingleResult();
assertEquals(1, department.departmentId);
assertEquals(98, department.departmentNo);
assertEquals("ACCOUNTING", department.departmentName);
assertEquals("NEW YORK", department.location);
assertEquals(2, department.version);
department =
jdbcManager.from(Department.class).where(
new SimpleWhere().eq("departmentId", 2)).getSingleResult();
assertEquals(2, department.departmentId);
assertEquals(99, department.departmentNo);
assertEquals("RESEARCH", department.departmentName);
assertEquals("DALLAS", department.location);
assertEquals(2, department.version);
}
/**
*
* @throws Exception
*/
public void testExecute_compKey() throws Exception {
List<CompKeyDepartment> list = new ArrayList<CompKeyDepartment>();
CompKeyDepartment department = new CompKeyDepartment();
department.departmentId1 = 1;
department.departmentId2 = 1;
department.departmentNo = 10;
department.departmentName = "hoge";
department.version = 1;
list.add(department);
CompKeyDepartment department2 = new CompKeyDepartment();
department2.departmentId1 = 2;
department2.departmentId2 = 2;
department2.departmentNo = 20;
department2.departmentName = "foo";
department2.version = 1;
list.add(department2);
int[] result = jdbcManager.updateBatch(list).execute();
assertEquals(2, result.length);
assertEquals(2, department.version);
assertEquals(2, department2.version);
department =
jdbcManager
.from(CompKeyDepartment.class)
.where(
new SimpleWhere().eq("departmentId1", 1).eq(
"departmentId2",
1))
.getSingleResult();
assertEquals(1, department.departmentId1);
assertEquals(1, department.departmentId2);
assertEquals(10, department.departmentNo);
assertEquals("hoge", department.departmentName);
assertNull(department.location);
assertEquals(2, department.version);
department =
jdbcManager
.from(CompKeyDepartment.class)
.where(
new SimpleWhere().eq("departmentId1", 2).eq(
"departmentId2",
2))
.getSingleResult();
assertEquals(2, department.departmentId1);
assertEquals(2, department.departmentId2);
assertEquals(20, department.departmentNo);
assertEquals("foo", department.departmentName);
assertNull(department.location);
assertEquals(2, department.version);
}
/**
*
* @throws Exception
*/
public void testExecute_mappedSuperclass() throws Exception {
List<ConcreteDepartment> list = new ArrayList<ConcreteDepartment>();
ConcreteDepartment department = new ConcreteDepartment();
department.departmentId = 1;
department.departmentName = "hoge";
department.departmentNo = 10;
department.version = 1;
list.add(department);
ConcreteDepartment department2 = new ConcreteDepartment();
department2.departmentId = 2;
department2.departmentNo = 20;
department2.departmentName = "foo";
department2.version = 1;
list.add(department2);
int[] result = jdbcManager.updateBatch(list).execute();
assertEquals(2, result.length);
assertEquals(2, department.version);
assertEquals(2, department2.version);
department =
jdbcManager.from(ConcreteDepartment.class).where(
new SimpleWhere().eq("departmentId", 1)).getSingleResult();
assertEquals(1, department.departmentId);
assertEquals(10, department.departmentNo);
assertEquals("hoge", department.departmentName);
assertNull(department.location);
assertEquals(2, department.version);
department =
jdbcManager.from(ConcreteDepartment.class).where(
new SimpleWhere().eq("departmentId", 2)).getSingleResult();
assertEquals(2, department.departmentId);
assertEquals(20, department.departmentNo);
assertEquals("foo", department.departmentName);
assertNull(department.location);
assertEquals(2, department.version);
}
/**
*
* @throws Exception
*/
public void testOptimisticLockException() throws Exception {
Employee employee1 =
jdbcManager
.from(Employee.class)
.where("employeeId = ?", 1)
.getSingleResult();
Employee employee2 =
jdbcManager
.from(Employee.class)
.where("employeeId = ?", 1)
.getSingleResult();
Employee employee3 =
jdbcManager
.from(Employee.class)
.where("employeeId = ?", 2)
.getSingleResult();
jdbcManager.update(employee1).execute();
try {
jdbcManager.updateBatch(employee2, employee3).execute();
fail();
} catch (OptimisticLockException expected) {
}
}
/**
*
* @throws Exception
*/
public void testOptimisticLockException_includesVersion() throws Exception {
Employee employee1 =
jdbcManager
.from(Employee.class)
.where("employeeId = ?", 1)
.getSingleResult();
Employee employee2 =
jdbcManager
.from(Employee.class)
.where("employeeId = ?", 1)
.getSingleResult();
Employee employee3 =
jdbcManager
.from(Employee.class)
.where("employeeId = ?", 2)
.getSingleResult();
jdbcManager.update(employee1).execute();
jdbcManager
.updateBatch(employee2, employee3)
.includesVersion()
.execute();
}
/**
*
* @throws Exception
*/
public void testSuppresOptimisticLockException() throws Exception {
Employee employee1 =
jdbcManager
.from(Employee.class)
.where("employeeId = ?", 1)
.getSingleResult();
Employee employee2 =
jdbcManager
.from(Employee.class)
.where("employeeId = ?", 1)
.getSingleResult();
Employee employee3 =
jdbcManager
.from(Employee.class)
.where("employeeId = ?", 2)
.getSingleResult();
jdbcManager.update(employee1).execute();
jdbcManager
.updateBatch(employee2, employee3)
.suppresOptimisticLockException()
.execute();
}
/**
*
* @throws Exception
*/
public void testColumnAnnotation() throws Exception {
List<Department2> list = new ArrayList<Department2>();
Department2 department = new Department2();
department.departmentId = 1;
department.departmentNo = 10;
department.departmentName = "hoge";
list.add(department);
Department2 department2 = new Department2();
department2.departmentId = 2;
department2.departmentNo = 20;
department2.departmentName = "foo";
list.add(department2);
int[] result = jdbcManager.updateBatch(list).execute();
assertEquals(2, result.length);
String sql =
"select DEPARTMENT_NAME from DEPARTMENT where DEPARTMENT_ID = ?";
String departmentName =
jdbcManager.selectBySql(String.class, sql, 1).getSingleResult();
assertEquals("ACCOUNTING", departmentName);
departmentName =
jdbcManager.selectBySql(String.class, sql, 2).getSingleResult();
assertEquals("RESEARCH", departmentName);
}
/**
*
* @throws Exception
*/
public void testTransientAnnotation() throws Exception {
List<Department3> list = new ArrayList<Department3>();
Department3 department = new Department3();
department.departmentId = 1;
department.departmentNo = 10;
department.departmentName = "hoge";
list.add(department);
Department3 department2 = new Department3();
department2.departmentId = 2;
department2.departmentNo = 20;
department2.departmentName = "foo";
list.add(department2);
int[] result = jdbcManager.updateBatch(list).execute();
assertEquals(2, result.length);
String sql =
"select DEPARTMENT_NAME from DEPARTMENT where DEPARTMENT_ID = ?";
String departmentName =
jdbcManager.selectBySql(String.class, sql, 1).getSingleResult();
assertEquals("ACCOUNTING", departmentName);
departmentName =
jdbcManager.selectBySql(String.class, sql, 2).getSingleResult();
assertEquals("RESEARCH", departmentName);
}
/**
*
* @throws Exception
*/
public void testTransientModifier() throws Exception {
List<Department4> list = new ArrayList<Department4>();
Department4 department = new Department4();
department.departmentId = 1;
department.departmentNo = 10;
department.departmentName = "hoge";
list.add(department);
Department4 department2 = new Department4();
department2.departmentId = 2;
department2.departmentNo = 20;
department2.departmentName = "foo";
list.add(department2);
int[] result = jdbcManager.updateBatch(list).execute();
assertEquals(2, result.length);
String sql =
"select DEPARTMENT_NAME from DEPARTMENT where DEPARTMENT_ID = ?";
String departmentName =
jdbcManager.selectBySql(String.class, sql, 1).getSingleResult();
assertEquals("ACCOUNTING", departmentName);
departmentName =
jdbcManager.selectBySql(String.class, sql, 2).getSingleResult();
assertEquals("RESEARCH", departmentName);
}
/**
*
* @throws Exception
*/
@Prerequisite("#ENV != 'hsqldb'")
public void testEntityExistsException() throws Exception {
Department department =
jdbcManager
.from(Department.class)
.where("departmentId = ?", 1)
.getSingleResult();
department.departmentNo = 20;
try {
jdbcManager.updateBatch(department).execute();
fail();
} catch (EntityExistsException e) {
}
}
/**
*
* @throws Exception
*/
@Test(expected = NoIdPropertyRuntimeException.class)
public void testNoId() throws Exception {
NoId noId1 = new NoId();
noId1.value1 = 1;
noId1.value1 = 2;
NoId noId2 = new NoId();
noId2.value1 = 1;
noId2.value1 = 2;
jdbcManager.updateBatch(noId1, noId2).execute();
}
}
| [
"koichik@319488c0-e101-0410-93bc-b5e51f62721a"
] | koichik@319488c0-e101-0410-93bc-b5e51f62721a |
5613a352ad0755ac8ddb7c99d4af0003c1e07795 | c5498743036544b67876707222d974582d435b40 | /Mybatis/Mybatis-03-mapper/src/sylu/mybatis/test/MyBatisTest.java | 8b08819ac0cebba5566391e64cdb07b5e6171acb | [] | no_license | lhang662543608/Java_Notes | 3035dd5eedc98eec9d154d081cddb0007d36ecf5 | 10b816c0c7fffc7dfe7876c643a2beefb4557b3d | refs/heads/master | 2020-05-25T22:06:03.871757 | 2020-01-11T02:13:40 | 2020-01-11T02:13:40 | 188,006,603 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 7,294 | java | package sylu.mybatis.test;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;
import sylu.mybatis.been.Department;
import sylu.mybatis.been.Employee;
import sylu.mybatis.dao.DepartmentMapper;
import sylu.mybatis.dao.EmployeeMapper;
import sylu.mybatis.dao.EmployeeMapperAnnotation;
import sylu.mybatis.dao.EmployeeMapperPlus;
/**
* 1、接口式编程 原生: Dao ====> DaoImpl mybatis: Mapper ====> xxMapper.xml
*
* 2、SqlSession代表和数据库的一次会话;用完必须关闭;
* 3、SqlSession和connection一样她都是非线程安全。每次使用都应该去获取新的对象。
* 4、mapper接口没有实现类,但是mybatis会为这个接口生成一个代理对象。 (将接口和xml进行绑定) EmployeeMapper
* empMapper = sqlSession.getMapper(EmployeeMapper.class); 5、两个重要的配置文件:
* mybatis的全局配置文件:包含数据库连接池信息,事务管理器信息等...系统运行环境信息 sql映射文件:保存了每一个sql语句的映射信息:
* 将sql抽取出来。
*
*
* @author lfy
*
*/
public class MyBatisTest {
public SqlSessionFactory getSqlSessionFactory() throws IOException {
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
return new SqlSessionFactoryBuilder().build(inputStream);
}
/**
* 1、根据xml配置文件(全局配置文件)创建一个SqlSessionFactory对象 有数据源一些运行环境信息
* 2、sql映射文件;配置了每一个sql,以及sql的封装规则等。 3、将sql映射文件注册在全局配置文件中 4、写代码:
* 1)、根据全局配置文件得到SqlSessionFactory;
* 2)、使用sqlSession工厂,获取到sqlSession对象使用他来执行增删改查
* 一个sqlSession就是代表和数据库的一次会话,用完关闭
* 3)、使用sql的唯一标志来告诉MyBatis执行哪个sql。sql都是保存在sql映射文件中的。
*
* @throws IOException
*/
@Test
public void test() throws IOException {
// 2、获取sqlSession实例,能直接执行已经映射的sql语句
// sql的唯一标识:statement Unique identifier matching the statement to use.
// 执行sql要用的参数:parameter A parameter object to pass to the statement.
SqlSessionFactory sqlSessionFactory = getSqlSessionFactory();
SqlSession openSession = sqlSessionFactory.openSession();
try {
Employee employee = openSession.selectOne("sylu.mybatis.dao.EmployeeMapper.getEmpById", 1);
System.out.println(employee);
} finally {
openSession.close();
}
}
@Test
public void test01() throws IOException {
// 1、获取sqlSessionFactory对象
SqlSessionFactory sqlSessionFactory = getSqlSessionFactory();
// 2、获取sqlSession对象
SqlSession openSession = sqlSessionFactory.openSession();
try {
// 3、获取接口的实现类对象
// 会为接口自动的创建一个代理对象,代理对象去执行增删改查方法
EmployeeMapper mapper = openSession.getMapper(EmployeeMapper.class);
Employee employee = mapper.getEmpById(1);
System.out.println(mapper.getClass());
System.out.println(employee);
} finally {
openSession.close();
}
}
@Test
public void test02() throws IOException {
SqlSessionFactory sqlSessionFactory = getSqlSessionFactory();
SqlSession openSession = sqlSessionFactory.openSession();
try {
EmployeeMapperAnnotation mapper = openSession.getMapper(EmployeeMapperAnnotation.class);
Employee empById = mapper.getEmpById(1);
System.out.println(empById);
} finally {
openSession.close();
}
}
/**
* 测试增删改 1.mybatis允许增删改直接定义以下类型的返回值: Integer、Long、Boolean、void 2.我们需要手动提交数据
* sqlSessionFactory.openSession();==>手动提交
* sqlSessionFactory.openSession(true);==>自动提交
*
* @throws IOException
*/
@Test
public void test03() throws IOException {
SqlSessionFactory sqlSessionFactory = getSqlSessionFactory();
// 1。获取到的Sqlsession不会自动提交数据
SqlSession openSession = sqlSessionFactory.openSession();
try {
EmployeeMapper mapper = openSession.getMapper(EmployeeMapper.class);
// 测试添加
Employee employee = new Employee(null, "Jack", "Jack@163.com", "0");
mapper.addEmp(employee);
System.out.println(employee.getId());
// 测试修改
/*
* Employee employee = new Employee(1, "lhang", "lhang@163.com",
* "0"); boolean updateEmp = mapper.updateEmp(employee);
* System.out.println(updateEmp);
*/
// 测试删除
// mapper.deleteEmpById(2);
// 2.手动提交
openSession.commit();
} finally {
openSession.close();
}
}
@Test
public void test04() throws IOException {
SqlSessionFactory sqlSessionFactory = getSqlSessionFactory();
// 1、获取到的SqlSession不会自动提交数据
SqlSession openSession = sqlSessionFactory.openSession();
try {
EmployeeMapper mapper = openSession.getMapper(EmployeeMapper.class);
// Employee employee = mapper.getEmpByIdAndLastName(1, "tom");
/*
* Map<String, Object> map = new HashMap<>(); map.put("id", 1);
* map.put("lastName", "lhang"); map.put("tableName",
* "tbl_employee"); Employee employee = mapper.getEmpByMap(map);
*/
List<Employee> empsByLastNameLike = mapper.getEmpsByLastNameLike("%e%");
for (Employee employee : empsByLastNameLike) {
System.out.println(employee);
}
Map<String, Object> returnMap = mapper.getEmpByIdReturnMap(1);
System.out.println(returnMap);
} finally {
openSession.close();
}
}
@Test
public void test05() throws IOException {
SqlSessionFactory sqlSessionFactory = getSqlSessionFactory();
SqlSession openSession = sqlSessionFactory.openSession();
try {
EmployeeMapperPlus mapper = openSession.getMapper(EmployeeMapperPlus.class);
/*
* Employee employee = mapper.getEmpById(1);
* System.out.println(employee);
*/
/*
* Employee empAndDept = mapper.getEmpAndDept(1);
* System.out.println(empAndDept);
* System.out.println(empAndDept.getDept());
*/
Employee empByIdStep = mapper.getEmpByIdStep(2);
System.out.println(empByIdStep);
// System.out.println(empByIdStep.getDept());
} finally {
openSession.close();
}
}
@Test
public void test06() throws IOException {
SqlSessionFactory sqlSessionFactory = getSqlSessionFactory();
SqlSession openSession = sqlSessionFactory.openSession();
try {
DepartmentMapper mapper = openSession.getMapper(DepartmentMapper.class);
/*
* Department deptByIdPlus = mapper.getDeptByIdPlus(1);
* List<Employee> emps = deptByIdPlus.getEmps();
* System.out.println(deptByIdPlus); System.out.println(emps);
*/
Department deptByIdStep = mapper.getDeptByIdStep(1);
System.out.println(deptByIdStep.getDepartmentName());
System.out.println(deptByIdStep.getEmps());
} finally {
openSession.close();
}
}
}
| [
"ljh_662543608@163.com"
] | ljh_662543608@163.com |
0c637893d7c79634e5afd773008f4819142425ea | 73de76b8144375708a574735ba4e93b0d4e6cb4c | /resVue/src/com/yc/dao/DBUtil.java | 33cfbd72e0ad12c7f2563a9173ce3796aeac6fcc | [] | no_license | kerm11/resvue | fdf210ea4edab7b6154d9008b496928b068486f9 | 7db1fc9e7e555838a6d79c9f9bd705a32b1cd17c | refs/heads/master | 2022-11-26T17:10:42.880314 | 2020-08-03T00:47:14 | 2020-08-03T00:47:14 | 284,566,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,152 | java | package com.yc.dao;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.yc.utils.LogUtils;
public class DBUtil {
private static MyProperties mp = MyProperties.getInstance();
static {
// 加载驱动程序
try {
Class.forName(mp.getProperty("driverClassName"));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
// 数据库连
public static Connection getConn() throws SQLException {
Connection con = null;
try {
Context context = new InitialContext();
DataSource source = (DataSource) context.lookup(mp
.getProperty("jndiName"));
con = source.getConnection();
} catch (Exception e) {
// 如果web容器( tomcat) 联接池没有配置,则使用传统jdbc来操作
try {
con = DriverManager.getConnection(mp.getProperty("url"),
mp.getProperty("username"), mp.getProperty("password"));
} catch (SQLException e1) {
LogUtils.logger.error("could not connect to the server", e1);
throw e1;
}
}
return con;
}
// 数据库关�?
public static void close(Connection con, Statement st, ResultSet rs)
throws SQLException {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
LogUtils.logger.error("could not close the resultset", e);
throw e;
}
}
if (st != null) {
try {
st.close();
} catch (SQLException e) {
LogUtils.logger.error("could not close the st", e);
throw e;
}
}
if (con != null) {
try {
con.close();
} catch (SQLException e) {
LogUtils.logger.error("could not close the connection", e);
throw e;
}
}
}
/**
* 执行insert, update, delete的sql语句
*
* @param sql
* :要执行的sql语句
* @param params
* : sql语句中占位符对应的�?
* @return 执行sql语句受影响的行数
* @throws SQLException
*/
public static int doUpdate(String sql, List<Object> params)
throws SQLException {
int result = -1;
Connection con = null;
PreparedStatement ps = null; // 预处理sql语句执行工具
try {
con = getConn();
ps = con.prepareStatement(sql); // 预处理sql语句
setParams(ps, params);
result = ps.executeUpdate();
} catch (SQLException e1) {
LogUtils.logger.error("could not update ", e1);
throw e1;
} finally {
DBUtil.close(con, ps, null);
}
return result;
}
/**
* 执行带事务的insert, update, delete的sql语句
*
* @param sqls
* :要执行的事务sql语句集合
* @param params
* : sql语句中占位符对应的�?
* @return 执行sql语句受影响的行数
* @throws SQLException
*/
public static int doUpdate(List<String> sqls, List<List<Object>> params)
throws SQLException {
Connection con = null;
PreparedStatement ps = null; // 预处理sql语句执行工具
int rows = -1;
try {
con = getConn();
con.setAutoCommit(false);
for (int i = 0; i < sqls.size(); i++) {
ps = con.prepareStatement(sqls.get(i)); // 预处理sql语句
setParams(ps, params.get(i));
rows += ps.executeUpdate();
}
con.commit();
} catch (SQLException e) {
con.rollback();
rows = 0;
LogUtils.logger.error("could not update more than one statement ", e);
throw e;
} finally {
DBUtil.close(con, ps, null);
}
return rows;
}
/**
* 针对聚合函数和大数据的查询
* @param sql
* : 要执行的sql语句
* @param params
* : sql语句中占位符对应的�?
* @return : �?��数据
* @throws IOException
* @throws SQLException
*/
public Map<String, Object> doQueryOne(String sql, List<Object> params) throws IOException, SQLException {
Connection con = null;
PreparedStatement ps = null; // 预处理sql语句执行工具
ResultSet rs = null;
Map<String, Object> results = null;
try {
con = getConn();
ps = con.prepareStatement(sql); // 预处理sql语句
setParams(ps, params);
rs = ps.executeQuery();
if (rs.next()) {
results = new HashMap<String, Object>();
ResultSetMetaData rsmd = rs.getMetaData();
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
if ("BLOB".equals(rsmd.getColumnTypeName(i))) {
Blob b = rs.getBlob(i);
BufferedInputStream bin = new BufferedInputStream(
rs.getBinaryStream(i));
if (b != null) {
byte[] bs = new byte[(int) b.length()];
bin.read(bs);
results.put(rsmd.getColumnName(i).toLowerCase(), bs);
} else {
results.put(rsmd.getColumnName(i).toLowerCase(),
null);
}
} else {
results.put(rsmd.getColumnName(i).toLowerCase(),
rs.getObject(i));
}
}
}
} catch (SQLException e1) {
LogUtils.logger.error("could not update more than one statement ", e1);
throw e1;
} finally {
DBUtil.close(con, ps, rs);
}
return results;
}
/**
* 针对多条数据的查�?
* @param sql
* : 要执行的sql语句
* @param params
* : sql语句中占位符对应的�?
* @return : 多条数据
* @throws SQLException
* @throws IOException
*/
public static List<Map<String, Object>> doQueryList(String sql,
List<Object> params) throws SQLException, IOException {
Connection con = null;
PreparedStatement ps = null; // 预处理sql语句执行工具
ResultSet rs = null;
List<Map<String, Object>> results = null;
try {
con = getConn();
ps = con.prepareStatement(sql); // 预处理sql语句
setParams(ps, params);
rs = ps.executeQuery();
if (rs.next()) {
results = new ArrayList<Map<String, Object>>();
ResultSetMetaData rsmd = rs.getMetaData();
do {
Map<String, Object> result = new HashMap<String, Object>();
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
if ("BLOB".equals(rsmd.getColumnTypeName(i))) {
Blob b = rs.getBlob(i);
BufferedInputStream bin = new BufferedInputStream(
b.getBinaryStream());
byte[] bs = new byte[(int) b.length()];
bin.read(bs);
result.put(rsmd.getColumnName(i).toLowerCase(), bs);
} else {
result.put(rsmd.getColumnName(i).toLowerCase(),
rs.getObject(i));
}
}
results.add(result);
} while (rs.next());
}
} catch (SQLException e1) {
LogUtils.logger.error("could not query ", e1);
throw e1;
} finally {
DBUtil.close(con, ps, rs);
}
return results;
}
/**
* 基于对象查询
*
* @param sql
* @param params
* @return
* @throws Exception
*/
public static <T> List<T> find(String sql, List<Object> params, Class<T> c) throws Exception {
List<T> list = new ArrayList<T>();
Connection con = null;
PreparedStatement ps = null; // 预处理sql语句执行工具
ResultSet rs = null;
try {
con = getConn();
ps = con.prepareStatement(sql); // 预处理sql语句
setParams(ps, params);
rs = ps.executeQuery(); // 执行查询
// 获取元数�?
ResultSetMetaData rsmd = rs.getMetaData();
int length = rsmd.getColumnCount();// 获取列的数量
// 取出�?��列的列明存放在一个数组中
String[] colNames = new String[length];
// 循环取出�?��的列
for (int i = 0; i < length; i++) {
colNames[i] = rsmd.getColumnName(i + 1);
}
// 获取给定对象的所有方�?
Method[] methods = c.getMethods();
T t;
String cname;
String colName;
String methodName = null;
while (rs.next()) {
t = c.newInstance();
// 根据类信息,实例化一个对�?new Dept()
for (int i = 0; i < length; i++) { // 循环取列
cname = colNames[i];
colName = "set" + cname;
if (methods != null && methods.length > 0) {
for (Method m : methods) { // 循环�?��方法
methodName = m.getName();
if (colName.equalsIgnoreCase(methodName)
&& rs.getObject(cname) != null) {
//修改: 1. 取 m 这个方法 ( setXXX() )的参数的类型 2. 因为 setXXX是java的方法,java的数据类型 是固定
String parameterTypeName=m.getParameterTypes()[0].getName();
if( "int".equals(parameterTypeName) || "java.lang.Integer".equals( parameterTypeName) ){
m.invoke(t, rs.getInt(cname));
}else if( "float".equals(parameterTypeName) || "java.lang.Float".equals( parameterTypeName) ){
m.invoke(t, rs.getFloat(cname));
}else if( "double".equals(parameterTypeName) || "java.lang.Double".equals( parameterTypeName) ){
m.invoke(t, rs.getDouble(cname));
}else if( "boolean".equals(parameterTypeName) || "java.lang.Boolean".equals( parameterTypeName) ){
m.invoke(t, rs.getBoolean(cname));
}else if( "String".equals(parameterTypeName) || "java.lang.String".equals( parameterTypeName) ){
m.invoke(t, rs.getString(cname));
}else{
m.invoke(t, rs.getObject(cname));
}
break;
}
}
}
}
list.add(t);
}
} catch (Exception e) {
LogUtils.logger.error("could not query ", e);
throw e;
} finally {
DBUtil.close(con, ps, rs);
}
return list;
}
/**
* 给预处理sql语句中占位符赋�?
* @param ps
* 预处理sql语句执行工具
* @param params
* 预处理sql语句中占位符的�?
*/
private static void setParams(PreparedStatement ps, List<Object> params) {
if (params != null) {
for (int i = 0; i < params.size(); i++) {
Object obj = params.get(i);
try {
if (obj instanceof Integer) {
ps.setInt(i + 1, (int) obj);
} else if (obj instanceof Double) {
ps.setDouble(i + 1, (double) obj);
} else if (obj instanceof String) {
ps.setString(i + 1, (String) obj);
} else if (obj instanceof Date) {
ps.setTimestamp(i + 1,
new Timestamp(((Date) obj).getTime()));
} else if (obj instanceof InputStream) {
ps.setBlob(i + 1, (InputStream) obj);
} else {
ps.setObject(i + 1, obj);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
| [
"邹蔓@LAPTOP-H6TJ5N9I"
] | 邹蔓@LAPTOP-H6TJ5N9I |
26dd6abc3bcf351218ea9fc37f7061ee13cb653a | 0fe9265a6ff585f02a640429dc2444fd9d101a61 | /gulimall-ums/src/main/java/com/atguigu/gulimall/ums/entity/MemberCollectSpuEntity.java | f90a21c11cf85b14ed4e0e692a0393473d5eee19 | [
"Apache-2.0"
] | permissive | xiaoyumen/gulimall | 67928d883fade1679e70519e2af65bc180fd8a32 | c6ba2ff89d6333d9f088b4ac7312fa133c78587c | refs/heads/master | 2022-08-01T15:19:57.284676 | 2019-08-15T09:32:06 | 2019-08-15T09:32:06 | 200,015,549 | 0 | 0 | Apache-2.0 | 2022-07-06T20:40:00 | 2019-08-01T09:00:04 | JavaScript | UTF-8 | Java | false | false | 1,197 | java | package com.atguigu.gulimall.ums.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 会员收藏的商品
*
* @author xieweiquan
* @email xx@atguigu.com
* @date 2019-08-01 19:39:11
*/
@ApiModel
@Data
@TableName("ums_member_collect_spu")
public class MemberCollectSpuEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
@ApiModelProperty(name = "id",value = "id")
private Long id;
/**
* 会员id
*/
@ApiModelProperty(name = "memberId",value = "会员id")
private Long memberId;
/**
* spu_id
*/
@ApiModelProperty(name = "spuId",value = "spu_id")
private Long spuId;
/**
* spu_name
*/
@ApiModelProperty(name = "spuName",value = "spu_name")
private String spuName;
/**
* spu_img
*/
@ApiModelProperty(name = "spuImg",value = "spu_img")
private String spuImg;
/**
* create_time
*/
@ApiModelProperty(name = "createTime",value = "create_time")
private Date createTime;
}
| [
"1050696826@qq.com"
] | 1050696826@qq.com |
d933b7ee64d5e838f5f1327b31f56402daa0da1e | 7d8773a2a5dfc2b837fc4c7a0805a6ca8b4734a9 | /src/main/java/org/reaktivity/nukleus/http_cache/internal/watcher/Watcher.java | 0ba4c37d953c638cb0abd6b981549caa45a8842a | [
"Apache-2.0"
] | permissive | a-zuckut/nukleus-http-cache.java | 94891e9a73a489bc3c7b75cc24a3c314340c2313 | 966795a380244c96f372223ec066f7b5dd7468a6 | refs/heads/develop | 2021-01-11T13:57:37.982714 | 2017-06-22T21:00:05 | 2017-06-22T21:00:05 | 94,913,780 | 0 | 0 | null | 2017-06-20T16:42:59 | 2017-06-20T16:42:58 | null | UTF-8 | Java | false | false | 4,654 | java | /**
* Copyright 2016-2017 The Reaktivity Project
*
* The Reaktivity Project 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.reaktivity.nukleus.http_cache.internal.watcher;
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
import static java.nio.file.StandardWatchEventKinds.OVERFLOW;
import static java.util.Arrays.stream;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.StandardWatchEventKinds;
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import org.agrona.LangUtil;
import org.reaktivity.nukleus.Nukleus;
import org.reaktivity.nukleus.http_cache.internal.Context;
import org.reaktivity.nukleus.http_cache.internal.router.Router;
public final class Watcher implements Nukleus
{
private final WatchService service;
private final Path streamsPath;
private final Set<Path> sourcePaths;
private final Consumer<WatchEvent<?>> handleEvent;
private Router router;
private WatchKey streamsKey;
public Watcher(
Context context)
{
this.service = context.watchService();
this.streamsPath = context.streamsPath();
this.sourcePaths = new HashSet<>();
Map<WatchEvent.Kind<?>, Consumer<WatchEvent<?>>> handlerMap = new HashMap<>();
handlerMap.put(StandardWatchEventKinds.OVERFLOW, this::handleOverflow);
handlerMap.put(StandardWatchEventKinds.ENTRY_CREATE, this::handleCreate);
handlerMap.put(StandardWatchEventKinds.ENTRY_DELETE, this::handleDelete);
this.handleEvent = e -> handlerMap.getOrDefault(e.kind(), this::handleUnexpected).accept(e);
}
public void setRouter(
Router router)
{
this.router = router;
}
@Override
public String name()
{
return "watcher";
}
@Override
public int process()
{
registerIfNecessary();
int workCount = 0;
WatchKey key = service.poll();
if (key != null && key.isValid())
{
List<WatchEvent<?>> events = key.pollEvents();
workCount += events.size();
events.forEach(handleEvent);
key.reset();
}
return workCount;
}
@Override
public void close() throws Exception
{
this.streamsKey = null;
}
private void handleCreate(
WatchEvent<?> event)
{
Path sourcePath = (Path) event.context();
handleCreatePath(sourcePath);
}
private void handleCreatePath(
Path sourcePath)
{
if (sourcePaths.add(sourcePath))
{
router.onReadable(sourcePath);
}
}
private void handleDelete(
WatchEvent<?> event)
{
Path sourcePath = (Path) event.context();
handleDeletePath(sourcePath);
}
private void handleDeletePath(
Path sourcePath)
{
if (sourcePaths.remove(sourcePath))
{
router.onExpired(sourcePath);
}
}
private void handleOverflow(
WatchEvent<?> event)
{
syncWithFileSystem();
}
private void handleUnexpected(
WatchEvent<?> event)
{
// ignore
}
private void registerIfNecessary()
{
if (streamsKey == null)
{
try
{
streamsPath.toFile().mkdirs();
streamsKey = streamsPath.register(service, ENTRY_CREATE, ENTRY_DELETE, OVERFLOW);
syncWithFileSystem();
}
catch (IOException ex)
{
LangUtil.rethrowUnchecked(ex);
}
}
}
private void syncWithFileSystem()
{
sourcePaths.stream().filter(p -> !p.toFile().exists()).forEach(this::handleDeletePath);
stream(streamsPath.toFile().listFiles()).map(f -> f.toPath()).forEach(this::handleCreatePath);
}
}
| [
"david.witherspoon@kaazing.com"
] | david.witherspoon@kaazing.com |
d10021aeb696977f63eb4d72bfa48f9c29dc66ba | d1c77e985823b5c92e5770d853dc363e22868c25 | /src/com/ihongqiqu/util/PhoneUtil.java | b8c7ba68c6bc8abf2c1883d25e69f32862871c44 | [] | no_license | robin201107/android-framework | 25283d5a4770d6a9f80efb52bd749c12a6819e2c | 023a42c867808e1104f5b9e0062196e3e26392ac | refs/heads/master | 2021-01-19T03:15:00.889017 | 2016-06-13T12:07:06 | 2016-06-13T12:07:06 | 48,729,849 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,946 | java | /**
* Copyright 2014 Zhenguo Jin
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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.ihongqiqu.util;
import android.Manifest;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
/**
* 手机组件调用工具类
*
* @author jingle1267@163.com
*/
public final class PhoneUtil {
/**
* Don't let anyone instantiate this class.
*/
private PhoneUtil() {
throw new Error("Do not need instantiate!");
}
/**
* 调用系统发短信界面
*
* @param activity Activity
* @param phoneNumber 手机号码
* @param smsContent 短信内容
*/
public static void sendMessage(Context activity, String phoneNumber,
String smsContent) {
if (phoneNumber == null || phoneNumber.length() < 4) {
return;
}
Uri uri = Uri.parse("smsto:" + phoneNumber);
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
it.putExtra("sms_body", smsContent);
it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(it);
}
/**
* 调用系统打电话界面
*
* @param context 上下文
* @param phoneNumber 手机号码
*/
//@TargetApi(Build.VERSION_CODES.M)
public static void callPhones(Context context, String phoneNumber) {
if (phoneNumber == null || phoneNumber.length() < 1) {
return;
}
Uri uri = Uri.parse("tel:" + phoneNumber);
Intent intent = new Intent(Intent.ACTION_CALL, uri);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//if (context.checkSelfPermission(Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// Activity#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for Activity#requestPermissions for more details.
// return;
//}
context.startActivity(intent);
}
}
| [
"liguobin@shililu.com"
] | liguobin@shililu.com |
ff8236a8f5519df539a2fd9294f96743653747d6 | d35d829725163fd302015644e6097a18d6a025b3 | /PolyCryptanalysisAlgorithm/MonoalphabetComparer.java | b2ede63689ccaa8fc2c81f5d6c87a42c9b5ba59f | [
"MIT"
] | permissive | rahulraj/Cryptology | 0b7109868966e8330cec82c9890b4672d6d8641a | 4faf16486f344d3a90f9a7060324468aad861df6 | refs/heads/master | 2021-01-23T21:38:17.756514 | 2011-01-03T18:15:49 | 2011-01-03T18:15:49 | 1,211,604 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,859 | java | /*
* Class to compare the monoalphabets and use their data to solve for less common letters
*/
import java.util.LinkedList;
public class MonoalphabetComparer
{
private MonoalphabetAnalyzer[] analyzers;
public MonoalphabetComparer(MonoalphabetAnalyzer[] monos)
{
analyzers = monos;
}
public void analyzeSubData() // used if the cipher is substitution, not needed otherwise
{
analyzeWithDepth();
}
public String firstGuess()
{
for (MonoalphabetAnalyzer mon : analyzers)
{
mon.makeFirstGuess();
}
return getDeciphered();
}
private void analyzeWithDepth()
{
// use knowledge of some of the more common letters (solved locally) to solve the less common ones
// NOTE: This uses data collected from the Shakespeare plays!
// Data from Abraham Sinkov's Elementary Cryptanalysis: A Mathematical Approach is also used
// But it is the secondary source to the Shakespeare plays.
// It will be necessary to do some modifications for ciphertexts different from Shakespeare!
for (MonoalphabetAnalyzer mono : analyzers)
{
mono.solveFreqs(); // the most common letters are solved locally
// these are E, T, O, and A
}
DigraphAnalyzer[] diAnalyze = new DigraphAnalyzer[analyzers.length];
for (int loc = 0; loc < (analyzers.length - 1); loc++)
{
diAnalyze[loc] = new DigraphAnalyzer(analyzers[loc], analyzers[loc + 1], false);
}
diAnalyze[diAnalyze.length - 1] = new DigraphAnalyzer(analyzers[analyzers.length - 1],
analyzers[0], true);
TrigraphAnalyzer[] triAnalyze = new TrigraphAnalyzer[analyzers.length];
if (analyzers.length == 2)
{
// only two alphabets
triAnalyze[0] = new TrigraphAnalyzer(analyzers[0], analyzers[1], analyzers[0], 2);
triAnalyze[1] = new TrigraphAnalyzer(analyzers[1], analyzers[0], analyzers[1], 2);
}
for (int loc = 0; loc < (analyzers.length - 2); loc++)
{
triAnalyze[loc] = new TrigraphAnalyzer(analyzers[loc], analyzers[loc + 1], analyzers[loc + 2], -1);
}
triAnalyze[triAnalyze.length - 2] = new TrigraphAnalyzer(analyzers[analyzers.length - 2],
analyzers[analyzers.length - 1], analyzers[0], 2);
triAnalyze[triAnalyze.length - 1] = new TrigraphAnalyzer(analyzers[analyzers.length - 1],
analyzers[0], analyzers[1], 1);
for (DigraphAnalyzer di : diAnalyze)
di.solveH();
for (DigraphAnalyzer di : diAnalyze)
di.solveN();
for (DigraphAnalyzer di : diAnalyze)
di.solveR();
for (DigraphAnalyzer di : diAnalyze)
di.solveU();
for (TrigraphAnalyzer tri : triAnalyze)
tri.solveD();
for (TrigraphAnalyzer tri : triAnalyze)
tri.solveI();
for (TrigraphAnalyzer tri : triAnalyze)
tri.solveY();
for (TrigraphAnalyzer tri : triAnalyze)
tri.solveG();
for (DigraphAnalyzer di : diAnalyze)
di.solveS(); // solveS() requires that "I" be solved
// update the plaintext strings
for (MonoalphabetAnalyzer m : analyzers)
{
m.makePlaintext();
}
}
public String getDeciphered()
{
StringBuilder pl = new StringBuilder("");
int alphCount = 0;
int wordCount = 0;
for (int anIndex = 0; anIndex < analyzers[0].getLength(); anIndex++)
{
for (MonoalphabetAnalyzer mono : analyzers)
{
pl.append(mono.getPlainLetterAt(anIndex));
alphCount++;
if (alphCount == 5)
{
alphCount = 0;
wordCount++;
pl.append(' '); // for readability
}
if (wordCount == 10)
{
wordCount = 0;
pl.append("\n"); // also for readability
}
}
}
pl.trimToSize(); // delete whitespace
pl.append("\n\n");
for (MonoalphabetAnalyzer mono : analyzers)
{
pl.append("Keys for: " + mono.toString() + "\n");
pl.append(mono.getKeys() + "\n");
}
return pl.toString();
}
} | [
"rahulrajago@gmail.com"
] | rahulrajago@gmail.com |
2fb4af4fd7082946fabdf7dd6bb0f72d2484a43c | dbc341c1223666f1fc909077423cc9f973d9ab8d | /src/test/java/com/iapp/reclamos/web/rest/UserResourceIntTest.java | 04fa6663624390615c217938375017f8b1ee551b | [] | no_license | msampolwal/IAPPReclamos | f48c7221aa7ddedc8c75cc6770b5fb0eebd45d07 | f12f153a5f93e989c2ccf4dad16ccfbb7db6022b | refs/heads/master | 2020-03-26T07:40:55.995833 | 2018-11-26T19:31:03 | 2018-11-26T19:31:03 | 144,665,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,599 | java | package com.iapp.reclamos.web.rest;
import com.iapp.reclamos.IappReclamosApp;
import com.iapp.reclamos.domain.Authority;
import com.iapp.reclamos.domain.User;
import com.iapp.reclamos.repository.UserRepository;
import com.iapp.reclamos.security.AuthoritiesConstants;
import com.iapp.reclamos.service.MailService;
import com.iapp.reclamos.service.UserService;
import com.iapp.reclamos.service.dto.UserDTO;
import com.iapp.reclamos.service.mapper.UserMapper;
import com.iapp.reclamos.web.rest.errors.ExceptionTranslator;
import com.iapp.reclamos.web.rest.vm.ManagedUserVM;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cache.CacheManager;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import java.time.Instant;
import java.util.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the UserResource REST controller.
*
* @see UserResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = IappReclamosApp.class)
public class UserResourceIntTest {
private static final String DEFAULT_LOGIN = "johndoe";
private static final String UPDATED_LOGIN = "jhipster";
private static final Long DEFAULT_ID = 1L;
private static final String DEFAULT_PASSWORD = "passjohndoe";
private static final String UPDATED_PASSWORD = "passjhipster";
private static final String DEFAULT_EMAIL = "johndoe@localhost";
private static final String UPDATED_EMAIL = "jhipster@localhost";
private static final String DEFAULT_FIRSTNAME = "john";
private static final String UPDATED_FIRSTNAME = "jhipsterFirstName";
private static final String DEFAULT_LASTNAME = "doe";
private static final String UPDATED_LASTNAME = "jhipsterLastName";
private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50";
private static final String UPDATED_IMAGEURL = "http://placehold.it/40x40";
private static final String DEFAULT_LANGKEY = "en";
private static final String UPDATED_LANGKEY = "fr";
@Autowired
private UserRepository userRepository;
@Autowired
private MailService mailService;
@Autowired
private UserService userService;
@Autowired
private UserMapper userMapper;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
@Autowired
private CacheManager cacheManager;
private MockMvc restUserMockMvc;
private User user;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).clear();
cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE).clear();
UserResource userResource = new UserResource(userService, userRepository, mailService);
this.restUserMockMvc = MockMvcBuilders.standaloneSetup(userResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setMessageConverters(jacksonMessageConverter)
.build();
}
/**
* Create a User.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which has a required relationship to the User entity.
*/
public static User createEntity(EntityManager em) {
User user = new User();
user.setLogin(DEFAULT_LOGIN + RandomStringUtils.randomAlphabetic(5));
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setEmail(RandomStringUtils.randomAlphabetic(5) + DEFAULT_EMAIL);
user.setFirstName(DEFAULT_FIRSTNAME);
user.setLastName(DEFAULT_LASTNAME);
user.setImageUrl(DEFAULT_IMAGEURL);
user.setLangKey(DEFAULT_LANGKEY);
return user;
}
@Before
public void initTest() {
user = createEntity(em);
user.setLogin(DEFAULT_LOGIN);
user.setEmail(DEFAULT_EMAIL);
}
@Test
@Transactional
public void createUser() throws Exception {
int databaseSizeBeforeCreate = userRepository.findAll().size();
// Create the User
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setLogin(DEFAULT_LOGIN);
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail(DEFAULT_EMAIL);
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isCreated());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate + 1);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(testUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
}
@Test
@Transactional
public void createUserWithExistingId() throws Exception {
int databaseSizeBeforeCreate = userRepository.findAll().size();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(1L);
managedUserVM.setLogin(DEFAULT_LOGIN);
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail(DEFAULT_EMAIL);
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// An entity with an existing ID cannot be created, so this API call must fail
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void createUserWithExistingLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeCreate = userRepository.findAll().size();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setLogin(DEFAULT_LOGIN);// this login should already be used
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail("anothermail@localhost");
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Create the User
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void createUserWithExistingEmail() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeCreate = userRepository.findAll().size();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setLogin("anotherlogin");
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail(DEFAULT_EMAIL);// this email should already be used
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Create the User
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void getAllUsers() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
// Get all the users
restUserMockMvc.perform(get("/api/users?sort=id,desc")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN)))
.andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME)))
.andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME)))
.andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL)))
.andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL)))
.andExpect(jsonPath("$.[*].langKey").value(hasItem(DEFAULT_LANGKEY)));
}
@Test
@Transactional
public void getUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull();
// Get the user
restUserMockMvc.perform(get("/api/users/{login}", user.getLogin()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.login").value(user.getLogin()))
.andExpect(jsonPath("$.firstName").value(DEFAULT_FIRSTNAME))
.andExpect(jsonPath("$.lastName").value(DEFAULT_LASTNAME))
.andExpect(jsonPath("$.email").value(DEFAULT_EMAIL))
.andExpect(jsonPath("$.imageUrl").value(DEFAULT_IMAGEURL))
.andExpect(jsonPath("$.langKey").value(DEFAULT_LANGKEY));
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNotNull();
}
@Test
@Transactional
public void getNonExistingUser() throws Exception {
restUserMockMvc.perform(get("/api/users/unknown"))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeUpdate = userRepository.findAll().size();
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin(updatedUser.getLogin());
managedUserVM.setPassword(UPDATED_PASSWORD);
managedUserVM.setFirstName(UPDATED_FIRSTNAME);
managedUserVM.setLastName(UPDATED_LASTNAME);
managedUserVM.setEmail(UPDATED_EMAIL);
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(UPDATED_IMAGEURL);
managedUserVM.setLangKey(UPDATED_LANGKEY);
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isOk());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeUpdate);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY);
}
@Test
@Transactional
public void updateUserLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeUpdate = userRepository.findAll().size();
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin(UPDATED_LOGIN);
managedUserVM.setPassword(UPDATED_PASSWORD);
managedUserVM.setFirstName(UPDATED_FIRSTNAME);
managedUserVM.setLastName(UPDATED_LASTNAME);
managedUserVM.setEmail(UPDATED_EMAIL);
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(UPDATED_IMAGEURL);
managedUserVM.setLangKey(UPDATED_LANGKEY);
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isOk());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeUpdate);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN);
assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY);
}
@Test
@Transactional
public void updateUserExistingEmail() throws Exception {
// Initialize the database with 2 users
userRepository.saveAndFlush(user);
User anotherUser = new User();
anotherUser.setLogin("jhipster");
anotherUser.setPassword(RandomStringUtils.random(60));
anotherUser.setActivated(true);
anotherUser.setEmail("jhipster@localhost");
anotherUser.setFirstName("java");
anotherUser.setLastName("hipster");
anotherUser.setImageUrl("");
anotherUser.setLangKey("en");
userRepository.saveAndFlush(anotherUser);
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin(updatedUser.getLogin());
managedUserVM.setPassword(updatedUser.getPassword());
managedUserVM.setFirstName(updatedUser.getFirstName());
managedUserVM.setLastName(updatedUser.getLastName());
managedUserVM.setEmail("jhipster@localhost");// this email should already be used by anotherUser
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(updatedUser.getImageUrl());
managedUserVM.setLangKey(updatedUser.getLangKey());
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
}
@Test
@Transactional
public void updateUserExistingLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
User anotherUser = new User();
anotherUser.setLogin("jhipster");
anotherUser.setPassword(RandomStringUtils.random(60));
anotherUser.setActivated(true);
anotherUser.setEmail("jhipster@localhost");
anotherUser.setFirstName("java");
anotherUser.setLastName("hipster");
anotherUser.setImageUrl("");
anotherUser.setLangKey("en");
userRepository.saveAndFlush(anotherUser);
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin("jhipster");// this login should already be used by anotherUser
managedUserVM.setPassword(updatedUser.getPassword());
managedUserVM.setFirstName(updatedUser.getFirstName());
managedUserVM.setLastName(updatedUser.getLastName());
managedUserVM.setEmail(updatedUser.getEmail());
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(updatedUser.getImageUrl());
managedUserVM.setLangKey(updatedUser.getLangKey());
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
}
@Test
@Transactional
public void deleteUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeDelete = userRepository.findAll().size();
// Delete the user
restUserMockMvc.perform(delete("/api/users/{login}", user.getLogin())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk());
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull();
// Validate the database is empty
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void getAllAuthorities() throws Exception {
restUserMockMvc.perform(get("/api/users/authorities")
.accept(TestUtil.APPLICATION_JSON_UTF8)
.contentType(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$").value(containsInAnyOrder(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN)));
}
@Test
@Transactional
public void testUserEquals() throws Exception {
TestUtil.equalsVerifier(User.class);
User user1 = new User();
user1.setId(1L);
User user2 = new User();
user2.setId(user1.getId());
assertThat(user1).isEqualTo(user2);
user2.setId(2L);
assertThat(user1).isNotEqualTo(user2);
user1.setId(null);
assertThat(user1).isNotEqualTo(user2);
}
@Test
public void testUserFromId() {
assertThat(userMapper.userFromId(DEFAULT_ID).getId()).isEqualTo(DEFAULT_ID);
assertThat(userMapper.userFromId(null)).isNull();
}
@Test
public void testUserDTOtoUser() {
UserDTO userDTO = new UserDTO();
userDTO.setId(DEFAULT_ID);
userDTO.setLogin(DEFAULT_LOGIN);
userDTO.setFirstName(DEFAULT_FIRSTNAME);
userDTO.setLastName(DEFAULT_LASTNAME);
userDTO.setEmail(DEFAULT_EMAIL);
userDTO.setActivated(true);
userDTO.setImageUrl(DEFAULT_IMAGEURL);
userDTO.setLangKey(DEFAULT_LANGKEY);
userDTO.setCreatedBy(DEFAULT_LOGIN);
userDTO.setLastModifiedBy(DEFAULT_LOGIN);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
User user = userMapper.userDTOToUser(userDTO);
assertThat(user.getId()).isEqualTo(DEFAULT_ID);
assertThat(user.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(user.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(user.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(user.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(user.getActivated()).isEqualTo(true);
assertThat(user.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(user.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
assertThat(user.getCreatedBy()).isNull();
assertThat(user.getCreatedDate()).isNotNull();
assertThat(user.getLastModifiedBy()).isNull();
assertThat(user.getLastModifiedDate()).isNotNull();
assertThat(user.getAuthorities()).extracting("name").containsExactly(AuthoritiesConstants.USER);
}
@Test
public void testUserToUserDTO() {
user.setId(DEFAULT_ID);
user.setCreatedBy(DEFAULT_LOGIN);
user.setCreatedDate(Instant.now());
user.setLastModifiedBy(DEFAULT_LOGIN);
user.setLastModifiedDate(Instant.now());
Set<Authority> authorities = new HashSet<>();
Authority authority = new Authority();
authority.setName(AuthoritiesConstants.USER);
authorities.add(authority);
user.setAuthorities(authorities);
UserDTO userDTO = userMapper.userToUserDTO(user);
assertThat(userDTO.getId()).isEqualTo(DEFAULT_ID);
assertThat(userDTO.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(userDTO.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(userDTO.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(userDTO.isActivated()).isEqualTo(true);
assertThat(userDTO.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(userDTO.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
assertThat(userDTO.getCreatedBy()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getCreatedDate()).isEqualTo(user.getCreatedDate());
assertThat(userDTO.getLastModifiedBy()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getLastModifiedDate()).isEqualTo(user.getLastModifiedDate());
assertThat(userDTO.getAuthorities()).containsExactly(AuthoritiesConstants.USER);
assertThat(userDTO.toString()).isNotNull();
}
@Test
public void testAuthorityEquals() throws Exception {
Authority authorityA = new Authority();
assertThat(authorityA).isEqualTo(authorityA);
assertThat(authorityA).isNotEqualTo(null);
assertThat(authorityA).isNotEqualTo(new Object());
assertThat(authorityA.hashCode()).isEqualTo(0);
assertThat(authorityA.toString()).isNotNull();
Authority authorityB = new Authority();
assertThat(authorityA).isEqualTo(authorityB);
authorityB.setName(AuthoritiesConstants.ADMIN);
assertThat(authorityA).isNotEqualTo(authorityB);
authorityA.setName(AuthoritiesConstants.USER);
assertThat(authorityA).isNotEqualTo(authorityB);
authorityB.setName(AuthoritiesConstants.USER);
assertThat(authorityA).isEqualTo(authorityB);
assertThat(authorityA.hashCode()).isEqualTo(authorityB.hashCode());
}
}
| [
"msampolwal@gmail.com"
] | msampolwal@gmail.com |
b8f297774fc95b21a3ceb19c5a29691622c7fcdf | b70f4220fd15afc41a82507982e086bf53f886b5 | /src/main/java/com/qa/util/SqlDBUtil.java | 75cc2684c4338201ba8a08f0d72730b5daebcd4f | [] | no_license | DeepKandey/POMFramework | 699a6cb3d4a78f1c5039d171ad0b7758db4ff68d | d3bcfb5a7b9da9c1647195fe541a8eded62be304 | refs/heads/master | 2023-06-23T10:10:25.711150 | 2023-06-10T17:36:07 | 2023-06-10T17:36:07 | 248,160,862 | 4 | 0 | null | 2022-03-23T09:11:20 | 2020-03-18T07:01:49 | Java | UTF-8 | Java | false | false | 6,162 | java | package com.qa.util;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class SqlDBUtil {
protected static DriverManagerDataSource dataSource;
public static Connection connection;
public SqlDBUtil(String DBName) throws Exception {
initDBConnection(DBName);
}
public static void initDBConnection(String DBName) throws Exception {
switch (DBName.toUpperCase()) {
case "ORACLE" -> {
dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
dataSource.setUrl("jdbc:oracle:thin:@" + System.getenv("ORACLE_CONNECTION_STRING"));
dataSource.setUsername(System.getenv("ORACLE_UNAME"));
dataSource.setPassword(System.getenv("ORACLE_PASSWORD"));
connection = dataSource.getConnection();
}
case "MYSQL" -> {
dataSource = new DriverManagerDataSource();
dataSource.setUrl("jdbc:mysql://" + System.getenv("MYSQL_CONNECTION_STRING"));
dataSource.setUsername(System.getenv("MYSQL_UNAME"));
dataSource.setPassword(System.getenv("MYSQL_PASSWORD"));
connection = dataSource.getConnection();
}
default -> throw new Exception("Please specify correct DB Name");
}
}
public void closeConnection() {
if (connection != null) {
try {
connection.close();
} catch (SQLException throwable) {
throwable.printStackTrace();
}
}
}
public boolean verifyFirstQueryResult(String DBQuery, String expVal) {
return getFirstQueryResult(DBQuery).equals(expVal);
}
public String getFirstQueryResult(String DBQuery) {
Statement statement = null;
ResultSet resultSet = null;
try {
statement = connection.createStatement();
resultSet = statement.executeQuery(DBQuery);
resultSet.next();
return resultSet.getString(1);
} catch (SQLException sqlException) {
sqlException.printStackTrace();
} finally {
try {
if (statement != null)
statement.close();
if (resultSet != null)
resultSet.close();
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
}
return null;
}
public Map<String, Object> readRow(String DBQuery) {
Map<String, Object> row = new HashMap<>();
Statement statement = null;
ResultSet resultSet = null;
ResultSetMetaData resultSetMetaData;
try {
statement = connection.createStatement();
resultSet = statement.executeQuery(DBQuery);
resultSetMetaData = resultSet.getMetaData();
resultSet.next();
int columns = resultSetMetaData.getColumnCount();
for (int i = 1; i < columns; i++) {
row.put(resultSetMetaData.getColumnName(i), resultSet.getObject(i));
}
} catch (SQLException sqlException) {
sqlException.printStackTrace();
} finally {
try {
if (statement != null)
statement.close();
if (resultSet != null)
resultSet.close();
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
}
return null;
}
public List<Map<String, Object>> readRows(String DBQuery) {
List<Map<String, Object>> rows = new ArrayList<>();
Statement statement = null;
ResultSet resultSet = null;
ResultSetMetaData resultSetMetaData;
try {
statement = connection.createStatement();
resultSet = statement.executeQuery(DBQuery);
resultSetMetaData = resultSet.getMetaData();
int columns = resultSetMetaData.getColumnCount();
Map<String, Object> row;
while (resultSet.next()) {
row = new HashMap<>();
for (int i = 1; i < columns; i++) {
row.put(resultSetMetaData.getColumnName(i), resultSet.getObject(i));
}
rows.add(row);
}
} catch (SQLException sqlException) {
sqlException.printStackTrace();
} finally {
try {
if (statement != null)
statement.close();
if (resultSet != null)
resultSet.close();
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
}
return rows;
}
public List<Object> retrieveSpecificColumnValueFromDB(String columnName, List<Map<String, Object>> mapList) {
List<Object> objectList;
objectList = mapList.stream().flatMap(map -> map.entrySet().stream())
.filter(entry -> entry.getKey().equals(columnName)).map(Map.Entry::getValue)
.collect(Collectors.toList());
return objectList;
}
public int updateTable(String updateQuery) {
Statement statement = null;
try {
statement = connection.createStatement();
return statement.executeUpdate(updateQuery);
} catch (SQLException sqlException) {
sqlException.printStackTrace();
} finally {
try {
if (statement != null)
statement.close();
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
}
return -1;
}
}
| [
"Deepakggsipu@gmail.com"
] | Deepakggsipu@gmail.com |
19abfb02d8a0143ceeac9b7fc4e649f86520c3b4 | fd466696c3d0152b7604e82f59d24fb016886f52 | /src/sensors/BarrelFB.java | 671f88dd5c9bba1bc6206ce6f1bdca3140f126fa | [] | no_license | blakemccawe/RobotBattleGame | 0b955942659e400f6653cda0c4d59d5a596b8dbc | ff40caa9c4823a35957a4185870df0eb833bf6e1 | refs/heads/master | 2021-05-29T02:06:56.232776 | 2015-08-26T11:54:13 | 2015-08-26T11:54:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,294 | java | package sensors;
import grammar.EXP;
import java.util.Scanner;
import main.Parser;
import main.Robot;
import main.RobotProgramNode;
import main.RobotReturnValueNode;
public class BarrelFB extends SEN implements RobotReturnValueNode {
private RobotReturnValueNode expr;
private Integer value;
private static final String LOG = "BARRELFB: ";
public BarrelFB(RobotProgramNode root) {
super(root);
}
@Override
public void evaluate(Robot robot) {
//added barrel expression
if (expr != null) {
expr.evaluate(robot);
value = robot.getBarrelFB(Integer.parseInt(expr.getValue()));
}
value = robot.getClosestBarrelFB();
}
@Override
public boolean parse(Scanner s) {
Parser.require(Parser.BARRELFBPAT, LOG + "Expecting "
+ Parser.BARRELFBPAT.toString(), s);
if(s.hasNext(Parser.OPENPAREN)) barrelLength(s);
return true;
}
public boolean barrelLength(Scanner s) {
Parser.require(Parser.OPENPAREN, LOG + "Expecting " + Parser.OPENPAREN,
s);
expr = new EXP(getRoot());
if (!expr.parse(s)) {
return false;
}
Parser.require(Parser.CLOSEPAREN, LOG + "Expecting "
+ Parser.CLOSEPAREN, s);
return true;
}
@Override
public String getValue() {
return value.toString();
}
@Override
public String toString() {
return "barrelFB";
}
}
| [
"BAM"
] | BAM |
53d1eaf286208eba4d118dbe5556c386bfdb7ab8 | a50839b778e4ba90e376941ea875d73066d98b7b | /src/main/java/org/prestocloud/tosca/model/definitions/constraints/LengthConstraint.java | 52a3f7a0f480ff7b6e514f3f44b09e734e88c766 | [
"Apache-2.0"
] | permissive | ow2-proactive/prestocloud-tosca-interpreter | bc6996297de4223bc1ce4b915dd7989516aaeb74 | 28fb65d60540d3bba9c0981ff32ddf99896abf9c | refs/heads/master | 2023-03-18T19:31:57.087738 | 2021-03-10T19:34:05 | 2021-03-10T19:34:05 | 345,635,766 | 0 | 0 | Apache-2.0 | 2021-03-10T19:33:30 | 2021-03-08T11:40:12 | Java | UTF-8 | Java | false | false | 707 | java | package org.prestocloud.tosca.model.definitions.constraints;
import javax.validation.constraints.NotNull;
import org.prestocloud.tosca.exceptions.ConstraintViolationException;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@EqualsAndHashCode(callSuper = false, of = { "length" })
public class LengthConstraint extends AbstractLengthConstraint {
@NotNull
private Integer length;
@Override
protected void doValidate(int propertyValue) throws ConstraintViolationException {
if (propertyValue != length) {
throw new ConstraintViolationException("The length of the value is not equals to [" + length + "]");
}
}
} | [
"vincent.kherbache@activeeon.com"
] | vincent.kherbache@activeeon.com |
5df1332c09b17cb8527b58f4d33ef0d0485f5a9d | 2ec282c465a50429743a6cfd10782ef6a50d6f8b | /src/Leetcode/BinaryTreePaths.java | 47298b132d7d4c7f5d496907c3373467330aeea1 | [] | no_license | kalpak92/TechInterview2020 | c72f288e24c78bc69551e4e0b1d41b095cd93ef1 | d835ab8f9fa4cc1fd1b54d377d833c5a2fda4d54 | refs/heads/master | 2023-04-12T02:29:45.858841 | 2021-04-14T02:50:03 | 2021-04-14T02:50:03 | 294,589,117 | 11 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,462 | java | package Leetcode;
import java.util.ArrayList;
import java.util.List;
/**
* @author kalpak
*
* Given a binary tree, return all root-to-leaf paths.
* Note: A leaf is a node with no children.
*
* Example:
* Input:
*
* 1
* / \
* 2 3
* \
* 5
*
* Output: ["1->2->5", "1->3"]
* Explanation: All root-to-leaf paths are: 1->2->5, 1->3
*
*/
public class BinaryTreePaths {
public static List<String> binaryTreePaths(TreeNode root) {
List<String> result = new ArrayList<>();
StringBuilder path = new StringBuilder();
dfsBinaryTreePaths(result, path, root);
return result;
}
private static void dfsBinaryTreePaths(List<String> result, StringBuilder path, TreeNode root) {
if(root == null)
return;
int len = path.length();
path.append(root.val);
if(root.left == null && root.right == null) {
result.add(path.toString());
} else {
path.append("->");
dfsBinaryTreePaths(result, path, root.left);
dfsBinaryTreePaths(result, path, root.right);
}
path.setLength(len);
}
public static void main(String[] args) {
TreeNode root = new TreeNode(4);
root.left = new TreeNode(9);
root.right = new TreeNode(0);
root.left.left = new TreeNode(5);
root.left.right = new TreeNode(1);
System.out.println(binaryTreePaths(root));
}
}
| [
"kals9seals@gmail.com"
] | kals9seals@gmail.com |
a852170009e0a0d76abcdca363fbbe04d9372970 | 6047d639d9e2f88de8213753a0f60e743817035d | /hmp-modules/hmp-core/src/main/target/generated-sources/annotations/com/qiaobei/hmp/modules/entity/AppointConfig_.java | 0e8449ab49af154281300981639fed73c2b03f4e | [] | no_license | fxbyun/hmp | 7a8e4f9cffd5572434fcfe726ff9bd18b853605d | 3a422430fc6797d378921675cae64de6c3a0de23 | refs/heads/master | 2021-07-24T11:32:13.701210 | 2017-11-04T08:05:36 | 2017-11-04T08:05:36 | 109,476,832 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 873 | java | package com.qiaobei.hmp.modules.entity;
import com.qiaobei.hmp.modules.entity.AppointConfig.Static;
import java.util.Date;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(AppointConfig.class)
public abstract class AppointConfig_ extends com.qiaobei.hmp.modules.entity.IdEntity_ {
public static volatile SingularAttribute<AppointConfig, Doctor> doctor;
public static volatile SingularAttribute<AppointConfig, Integer> perMin;
public static volatile SingularAttribute<AppointConfig, Static> openStatic;
public static volatile SingularAttribute<AppointConfig, Date> flagChangeDate;
public static volatile SingularAttribute<AppointConfig, Integer> personNum;
}
| [
"1508622779@qq.com"
] | 1508622779@qq.com |
4a5b8b7474895cf4159456a3f742696932b30d24 | 32b406739ab2c541c757227ed2cd588f025d2e48 | /src/com/luv2code/springdemo/mvc/StudentController.java | 78b8dfb6b0252a45c9f25e84f36f1e571320de90 | [] | no_license | didier-Alfea/spring-mvc-demo | 0359a716cee788d03d50c21e497f703825113a6a | 812a58543fe4b6a19fbabba4be1d20366e3f463a | refs/heads/master | 2020-04-19T03:37:49.428465 | 2019-01-28T10:53:11 | 2019-01-28T10:53:11 | 167,939,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | package com.luv2code.springdemo.mvc;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/student")
public class StudentController {
@RequestMapping("/showForm")
public String showForm(Model theModel) {
//Create a student object
Student theStudent = new Student();
// add student obj to the mmodel
theModel.addAttribute("student", theStudent);
return "student-form";
}
@RequestMapping("/processForm")
public String processForm(@ModelAttribute("student") Student theStudent) {
// Affiche les data recues
System.out.println("The Student : " + theStudent.getFirstName()
+ " " + theStudent.getLastName());
return "student-confirmation";
}
}
| [
"Didier.CLIN@alfea-consulting.com"
] | Didier.CLIN@alfea-consulting.com |
bd874b27ab717bdbbcf747f388373666c42c3b12 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/4/4_e7968b27093a8a5973aa1f21f436d539b232bbe6/KeyguardViewBase/4_e7968b27093a8a5973aa1f21f436d539b232bbe6_KeyguardViewBase_s.java | 8a9332837eecd63b1b9646907340deab010e5c23 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 8,175 | java | /*
* Copyright (C) 2007 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 com.android.internal.policy.impl;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
import android.view.View;
import android.view.Gravity;
import android.widget.FrameLayout;
import android.util.AttributeSet;
/**
* Base class for keyguard views. {@link #reset} is where you should
* reset the state of your view. Use the {@link KeyguardViewCallback} via
* {@link #getCallback()} to send information back (such as poking the wake lock,
* or finishing the keyguard).
*
* Handles intercepting of media keys that still work when the keyguard is
* showing.
*/
public abstract class KeyguardViewBase extends FrameLayout {
private KeyguardViewCallback mCallback;
private AudioManager mAudioManager;
private TelephonyManager mTelephonyManager = null;
public KeyguardViewBase(Context context) {
super(context);
// drop shadow below status bar in keyguard too
mForegroundInPadding = false;
setForegroundGravity(Gravity.FILL_HORIZONTAL | Gravity.TOP);
setForeground(
context.getResources().getDrawable(
com.android.internal.R.drawable.title_bar_shadow));
}
// used to inject callback
void setCallback(KeyguardViewCallback callback) {
mCallback = callback;
}
public KeyguardViewCallback getCallback() {
return mCallback;
}
/**
* Called when you need to reset the state of your view.
*/
abstract public void reset();
/**
* Called when the screen turned off.
*/
abstract public void onScreenTurnedOff();
/**
* Called when the screen turned on.
*/
abstract public void onScreenTurnedOn();
/**
* Called when a key has woken the device to give us a chance to adjust our
* state according the the key. We are responsible for waking the device
* (by poking the wake lock) once we are ready.
*
* The 'Tq' suffix is per the documentation in {@link android.view.WindowManagerPolicy}.
* Be sure not to take any action that takes a long time; any significant
* action should be posted to a handler.
*
* @param keyCode The wake key, which may be relevant for configuring the
* keyguard.
*/
abstract public void wakeWhenReadyTq(int keyCode);
/**
* Verify that the user can get past the keyguard securely. This is called,
* for example, when the phone disables the keyguard but then wants to launch
* something else that requires secure access.
*
* The result will be propogated back via {@link KeyguardViewCallback#keyguardDone(boolean)}
*/
abstract public void verifyUnlock();
/**
* Called before this view is being removed.
*/
abstract public void cleanUp();
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (shouldEventKeepScreenOnWhileKeyguardShowing(event)) {
mCallback.pokeWakelock();
}
if (interceptMediaKey(event)) {
return true;
}
return super.dispatchKeyEvent(event);
}
private boolean shouldEventKeepScreenOnWhileKeyguardShowing(KeyEvent event) {
if (event.getAction() != KeyEvent.ACTION_DOWN) {
return false;
}
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_DPAD_LEFT:
case KeyEvent.KEYCODE_DPAD_RIGHT:
case KeyEvent.KEYCODE_DPAD_UP:
return false;
default:
return true;
}
}
/**
* Allows the media keys to work when the keygaurd is showing.
* The media keys should be of no interest to the actualy keygaurd view(s),
* so intercepting them here should not be of any harm.
* @param event The key event
* @return whether the event was consumed as a media key.
*/
private boolean interceptMediaKey(KeyEvent event) {
final int keyCode = event.getKeyCode();
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (keyCode) {
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
/* Suppress PLAYPAUSE toggle when phone is ringing or
* in-call to avoid music playback */
if (mTelephonyManager == null) {
mTelephonyManager = (TelephonyManager) getContext().getSystemService(
Context.TELEPHONY_SERVICE);
}
if (mTelephonyManager != null &&
mTelephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE) {
return true; // suppress key event
}
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_STOP:
case KeyEvent.KEYCODE_MEDIA_NEXT:
case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
case KeyEvent.KEYCODE_MEDIA_REWIND:
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: {
Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
getContext().sendOrderedBroadcast(intent, null);
return true;
}
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_VOLUME_DOWN: {
synchronized (this) {
if (mAudioManager == null) {
mAudioManager = (AudioManager) getContext().getSystemService(
Context.AUDIO_SERVICE);
}
}
// Volume buttons should only function for music.
if (mAudioManager.isMusicActive()) {
mAudioManager.adjustStreamVolume(
AudioManager.STREAM_MUSIC,
keyCode == KeyEvent.KEYCODE_VOLUME_UP
? AudioManager.ADJUST_RAISE
: AudioManager.ADJUST_LOWER,
0);
}
// Don't execute default volume behavior
return true;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (keyCode) {
case KeyEvent.KEYCODE_MUTE:
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
case KeyEvent.KEYCODE_MEDIA_STOP:
case KeyEvent.KEYCODE_MEDIA_NEXT:
case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
case KeyEvent.KEYCODE_MEDIA_REWIND:
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: {
Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
getContext().sendOrderedBroadcast(intent, null);
return true;
}
}
}
return false;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
da45e1613401b8399893fb2a70705aa47ebbd587 | 9398bf50bbdf7aec2769868bd3523b6e4c6f4924 | /app/src/main/java/louai/com/budgetmanagement/AddBudget.java | 437f17bd15ab5b28b78434c2fe8806a18f8734e0 | [] | no_license | louxs/BudgetManagement | b7df04fcceb4e5dc95ed63ac6bcc82f7edcdb8a1 | c5ed9b115862ebb4b4c0ac5fc5e9084bc1087e93 | refs/heads/master | 2020-12-06T02:18:34.463690 | 2016-08-24T17:02:22 | 2016-08-24T17:02:24 | 66,482,220 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,004 | java | package louai.com.budgetmanagement;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
public class AddBudget extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_budget);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
}
| [
"louai.kraiem@gmail.com"
] | louai.kraiem@gmail.com |
db93aa52a59ba60ae6c616bca5d2b9528d0f9de9 | d05368221e2bcb6a3840d5641cb15cd256dcace6 | /src/main/java/com/ocp/day15/Airplane.java | ac2cd9914269f99104b74cafaba82838795d11e1 | [] | no_license | erick21033/erick21033-Javaocp | 09e5b5efc3d21fe3b95c2e96f0670bbfbeac304c | 88636624d94efeb81940ed437f524966c6f14753 | refs/heads/master | 2023-05-22T12:41:38.621194 | 2021-06-10T11:28:41 | 2021-06-10T11:28:41 | 348,335,204 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 100 | java |
package com.ocp.day15;
public abstract class Airplane {
abstract int speed();
}
| [
"MB-study@192.168.1.142"
] | MB-study@192.168.1.142 |
06c4200d36dd47072fce2963ee7c5293c0ab749b | a1446ab29c78dbdd8cdac64a08644dbcd00fccd1 | /src/com/wise/extend/MyFrameLayout.java | 7997b1ab92578d73d5478a935f7e9e9196efc9cc | [] | no_license | ycs0405/Wawc | d701a612f8478648d345854f26d6602b0a1a7d1b | d18d9b7a156bdd05bb72b44ce9ecc44a579880e9 | refs/heads/master | 2021-01-23T01:51:46.842020 | 2014-03-28T10:11:22 | 2014-03-28T10:11:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 863 | java | package com.wise.extend;
import com.wise.wawc.ActivityFactory;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.FrameLayout;
/**
* 自定义FrameLayout,用于滑出菜单后点击onLoad页面关闭菜单
* @author honesty
*/
public class MyFrameLayout extends FrameLayout{
public MyFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
//如果当前屏幕处在第一屏,则不需要拦截事件
//如果屏幕处在非第一屏,则拦截load页面里的点击事件
if(ActivityFactory.S.getCurrentScreen() == 1){
return false;
}
ActivityFactory.A.LeftMenu();
return true;
}
}
| [
"wisegps@333"
] | wisegps@333 |
f85b91e4061537be20b185f9115f1112f24f9eec | c42c0ed00c13d3a5f1a3a5395908d9c1b011790d | /src/programmers/Programmers_TheBiggestNumber.java | 8133333a89af23bddc7f0155fa0dabc4ef9ef0c7 | [] | no_license | Bellroute/algorithm | ef6b82026255313f239ea31188aac605c88684ce | b1337bfed5440dd2fb63f6fb8ae54c5659aa5f5d | refs/heads/master | 2021-06-10T03:22:33.780786 | 2021-04-20T08:56:52 | 2021-04-20T08:56:52 | 170,351,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | package programmers;
import java.util.Arrays;
public class Programmers_TheBiggestNumber {
public String solution(int[] numbers) {
String[] arr = new String[numbers.length];
for (int i = 0; i < arr.length; i++) {
arr[i] = String.valueOf(numbers[i]);
}
Arrays.sort(arr, (o1, o2) -> (o2 + o1).compareTo(o1 + o2));
String answer = "";
for (int i = 0; i < arr.length; i++) {
answer += arr[i];
}
if (arr[0].equals("0")) {
answer = "0";
}
return answer;
}
}
| [
"kjkun7631@gmail.com"
] | kjkun7631@gmail.com |
f6e3d201bc50a93cf05186b09a9b7f617c07b7a1 | 432b9994cd1950f4f7379a71fee16bfd7a08500e | /Healthcare/src/main/java/com/cafe24/kyungsu93/healthsurvey/service/HealthSurveyQuestion.java | 2286e28f0b9980a8af1787e70c02027cc096d99d | [] | no_license | KyungsuJin/Healthcare | 6fedd1fd523e59d3aa18ab0de331446b37d3b53a | 123d02015b0473f9707468e5bf8128f44369dbb9 | refs/heads/master | 2020-03-19T05:41:55.705530 | 2018-07-06T08:11:22 | 2018-07-06T08:11:22 | 135,950,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,352 | java | package com.cafe24.kyungsu93.healthsurvey.service;
import java.util.Arrays;
import java.util.List;
public class HealthSurveyQuestion {
private String healthSurveyQuestionNo;
private String healthSurveyRegisterNo;
private int[] questionNoList;
private int questionNo;
private String[] healthSurveyQuestionList;
private String healthSurveyQuestion;
private List<HealthSurveySelection> healthSurveySelection;
public String getHealthSurveyQuestionNo() {
return healthSurveyQuestionNo;
}
public void setHealthSurveyQuestionNo(String healthSurveyQuestionNo) {
this.healthSurveyQuestionNo = healthSurveyQuestionNo;
}
public String getHealthSurveyRegisterNo() {
return healthSurveyRegisterNo;
}
public void setHealthSurveyRegisterNo(String healthSurveyRegisterNo) {
this.healthSurveyRegisterNo = healthSurveyRegisterNo;
}
public int[] getQuestionNoList() {
return questionNoList;
}
public void setQuestionNoList(int[] questionNoList) {
this.questionNoList = questionNoList;
}
public int getQuestionNo() {
return questionNo;
}
public void setQuestionNo(int questionNo) {
this.questionNo = questionNo;
}
public String[] getHealthSurveyQuestionList() {
return healthSurveyQuestionList;
}
public void setHealthSurveyQuestionList(String[] healthSurveyQuestionList) {
this.healthSurveyQuestionList = healthSurveyQuestionList;
}
public String getHealthSurveyQuestion() {
return healthSurveyQuestion;
}
public void setHealthSurveyQuestion(String healthSurveyQuestion) {
this.healthSurveyQuestion = healthSurveyQuestion;
}
public List<HealthSurveySelection> getHealthSurveySelection() {
return healthSurveySelection;
}
public void setHealthSurveySelection(List<HealthSurveySelection> healthSurveySelection) {
this.healthSurveySelection = healthSurveySelection;
}
@Override
public String toString() {
return "HealthSurveyQuestion [healthSurveyQuestionNo=" + healthSurveyQuestionNo + ", healthSurveyRegisterNo="
+ healthSurveyRegisterNo + ", questionNoList=" + Arrays.toString(questionNoList) + ", questionNo="
+ questionNo + ", healthSurveyQuestionList=" + Arrays.toString(healthSurveyQuestionList)
+ ", healthSurveyQuestion=" + healthSurveyQuestion + ", healthSurveySelection=" + healthSurveySelection
+ "]";
}
}
| [
"smart-202-22@smart-202-22-PC"
] | smart-202-22@smart-202-22-PC |
36e59e721346c97321116cf2b8e568c31592c033 | b3168bf24ae8f33f3a451448e4b9d2bdeb4a3794 | /aMusicStore/src/main/java/com/emusicstore/controller/CartController.java | 61313aafbbd83afbdf9c5d877fa68be63b90ee2d | [] | no_license | tharunjasti/eMusicstoreWebApp | 99778a32d71aaaa22487692ed51114b94c32b6a7 | 9e4b33d31e39191a0c3d03ca4ed7245459a226fc | refs/heads/master | 2021-03-27T19:03:09.387872 | 2018-01-26T17:30:04 | 2018-01-26T17:30:04 | 118,531,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,214 | java | package com.emusicstore.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.web.bind.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import com.emusicstore.model.Customer;
import com.emusicstore.service.CustomerService;
@Controller
@RequestMapping("/customer/cart")
public class CartController {
@Autowired
private CustomerService customerService;
@RequestMapping
public String getCart(@AuthenticationPrincipal User activeUser){
Customer customer = customerService.getCustomerByUsername (activeUser.getUsername());
int cartId = customer.getCart().getCartId();
return "redirect:/customer/cart/"+cartId;
}
@RequestMapping("/{cartId}")
public String getCartRedirect(@PathVariable (value = "cartId") int cartId, Model model) {
model.addAttribute("cartId", cartId);
return "cart";
}
}
| [
"tharunjasti@gmail.com"
] | tharunjasti@gmail.com |
ee5302f927c179e7f0be45343c784525f9acff35 | 5e7608123a22cecef836ec02fbe48f93aa03190a | /Java-Multi-Thread-Programming/src/main/java/com/multi/thread/chapter1/example27/MyThread.java | 3846a22e04a4b984b0c8739c29caa77aa8eaa669 | [
"Apache-2.0"
] | permissive | liiibpm/Java_Multi_Thread | a01e2ba428d4cc9277357232ef37d4b770fddd6a | 39200a1096475557c749db68993e3a3ccc0547b5 | refs/heads/master | 2023-03-26T16:16:29.039854 | 2020-12-01T12:22:23 | 2020-12-01T12:22:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package com.multi.thread.chapter1.example27;
/**
* @Description
* @Author dongzonglei
* @Date 2018/12/08 下午3:09
*/
public class MyThread extends Thread {
@Override
public void run() {
try {
this.stop();
} catch (Exception e) {
System.out.println("进入了catch()方法");
e.printStackTrace();
}
}
}
| [
"dzllikelsw@163.com"
] | dzllikelsw@163.com |
91ea726cd6524155a639fbd0482ae066eb45f16a | 7b4fd58090aa7013137ba2734d7f256b812861e1 | /src/Ellias/rm/com/tencent/tmassistantsdk/openSDK/opensdktomsdk/a.java | d66e318f3be4004f9e9f9c74386a54b95a36f4e9 | [] | no_license | daihuabin/Ellias | e37798a6a2e63454f80de512319ece885b6a2237 | fd010991a5677e6aa104b927b82fc3d6da801887 | refs/heads/master | 2023-03-16T21:12:33.908495 | 2020-02-10T15:42:22 | 2020-02-10T15:42:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,611 | java | package com.tencent.tmassistantsdk.openSDK.opensdktomsdk;
import android.os.Bundle;
import android.os.Handler.Callback;
import android.os.Message;
import com.tencent.tmassistantsdk.openSDK.opensdktomsdk.b.b;
class a
implements Handler.Callback
{
a(TMOpenSDKToMsdkManager paramTMOpenSDKToMsdkManager)
{
}
public boolean handleMessage(Message paramMessage)
{
switch (paramMessage.what)
{
case 2:
default:
case 4:
case 5:
case 0:
case 1:
case 6:
case 3:
}
while (true)
{
return false;
b localb = (b)paramMessage.obj;
if (localb == null)
continue;
this.a.onNetworkFinishedSuccess(localb);
continue;
int j = ((Integer)paramMessage.obj).intValue();
this.a.onNetworkFinishedFailed(j);
continue;
int i = paramMessage.arg1;
String str = paramMessage.obj.toString();
this.a.handleInstall(str, i);
continue;
Bundle localBundle2 = paramMessage.getData();
if (localBundle2 == null)
continue;
this.a.handleDownloading(localBundle2.getLong("receiveDataLen"), localBundle2.getLong("totalDataLen"));
continue;
Bundle localBundle1 = paramMessage.getData();
if (localBundle1 == null)
continue;
this.a.handleDownloadContinue(localBundle1.getLong("receiveDataLen"), localBundle1.getLong("totalDataLen"));
continue;
this.a.handleDownloadFailed();
}
}
}
/* Location: D:\rm_src\classes_dex2jar\
* Qualified Name: com.tencent.tmassistantsdk.openSDK.opensdktomsdk.a
* JD-Core Version: 0.6.0
*/ | [
"sevarsti@sina.com"
] | sevarsti@sina.com |
3131fab450443d6fa926e6ba7353407a5eab7451 | 47eb5bf54da6c19ca175fc8938ca9b6a2b545dfa | /ga-issue-card/src/main/java/com/whty/ga/pojo/GaPersonInfo.java | 153e4629970be13785f875a6bc0406578de659ba | [] | no_license | liszhu/whatever_ty | 44ddb837f2de19cb980c28fe06e6634f9d6bd8cb | e02ef9e125cac9103848c776e420edcf0dcaed2f | refs/heads/master | 2021-12-13T21:37:06.539805 | 2017-04-05T01:50:23 | 2017-04-05T01:50:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,272 | java | package com.whty.ga.pojo;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.GenericGenerator;
/**
* @ClassName GaPersonInfo
* @author Administrator
* @date 2017-3-3 上午9:51:36
* @Description TODO(个人信息)
*/
@Entity
@Table(name="ga_person_info")
public class GaPersonInfo {
@Id
@GenericGenerator(name="generator",strategy="uuid")
@GeneratedValue(generator="generator")
@Column(name="id",unique=true,nullable=false)
private String id;
@Column(name="id_card_no")
private String idCardNo;
@Column(name="name")
private String name;
@Column(name="sex")
private String sex;
@Column(name="ethnic")
private String ethnic;
@Column(name="birthday")
@Temporal(TemporalType.DATE)
private Date birthday;
@Column(name="political_status")
private String politicalStatus;
@Column(name="education_degree")
private String educationDegree;
@Column(name="height")
private String height;
@Column(name="marital_status")
private String maritalStatus;
@Column(name="hukou_area_no")
private String hukouAreaNo;
@Column(name="hukou_address")
private String hukouAddress;
@Column(name="residence_address")
private String residenceAddress;
@Column(name="former_address")
private String formerAddress;
@Column(name="blood_type")
private String bloodType;
@Column(name="religion")
private String religion;
@Column(name="company")
private String company;
@Column(name="tel")
private String tel;
@Column(name="mobil")
private String mobil;
@Column(name="face")
private String face;
@Column(name="person_type_code")
private String personTypeCode;
@Column(name="issue_organ")
private String issueOrgan;
@Column(name="expiry_time")
@Temporal(TemporalType.DATE)
private Date expiryTime;
@Column(name="create_date")
@Temporal(TemporalType.TIMESTAMP)
private Date createDate;
@Column(name="update_date")
@Temporal(TemporalType.TIMESTAMP)
private Date updateDate;
@Column(name="del_flag")
private String delFlag;
@Column(name="remarks")
private String remarks;
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the idCardNo
*/
public String getIdCardNo() {
return idCardNo;
}
/**
* @param idCardNo the idCardNo to set
*/
public void setIdCardNo(String idCardNo) {
this.idCardNo = idCardNo;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the expiryTime
*/
public Date getExpiryTime() {
return expiryTime;
}
/**
* @param expiryTime the expiryTime to set
*/
public void setExpiryTime(Date expiryTime) {
this.expiryTime = expiryTime;
}
/**
* @return the ethnic
*/
public String getEthnic() {
return ethnic;
}
/**
* @param ethnic the ethnic to set
*/
public void setEthnic(String ethnic) {
this.ethnic = ethnic;
}
/**
* @return the birthday
*/
public Date getBirthday() {
return birthday;
}
/**
* @param birthday the birthday to set
*/
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
/**
* @return the politicalStatus
*/
public String getPoliticalStatus() {
return politicalStatus;
}
/**
* @param politicalStatus the politicalStatus to set
*/
public void setPoliticalStatus(String politicalStatus) {
this.politicalStatus = politicalStatus;
}
/**
* @return the educationDegree
*/
public String getEducationDegree() {
return educationDegree;
}
/**
* @param educationDegree the educationDegree to set
*/
public void setEducationDegree(String educationDegree) {
this.educationDegree = educationDegree;
}
/**
* @return the height
*/
public String getHeight() {
return height;
}
/**
* @param height the height to set
*/
public void setHeight(String height) {
this.height = height;
}
/**
* @return the maritalStatus
*/
public String getMaritalStatus() {
return maritalStatus;
}
/**
* @param maritalStatus the maritalStatus to set
*/
public void setMaritalStatus(String maritalStatus) {
this.maritalStatus = maritalStatus;
}
/**
* @return the hukouAreaNo
*/
public String getHukouAreaNo() {
return hukouAreaNo;
}
/**
* @param hukouAreaNo the hukouAreaNo to set
*/
public void setHukouAreaNo(String hukouAreaNo) {
this.hukouAreaNo = hukouAreaNo;
}
/**
* @return the hukouAddress
*/
public String getHukouAddress() {
return hukouAddress;
}
/**
* @param hukouAddress the hukouAddress to set
*/
public void setHukouAddress(String hukouAddress) {
this.hukouAddress = hukouAddress;
}
/**
* @return the residenceAddress
*/
public String getResidenceAddress() {
return residenceAddress;
}
/**
* @param residenceAddress the residenceAddress to set
*/
public void setResidenceAddress(String residenceAddress) {
this.residenceAddress = residenceAddress;
}
/**
* @return the formerAddress
*/
public String getFormerAddress() {
return formerAddress;
}
/**
* @param formerAddress the formerAddress to set
*/
public void setFormerAddress(String formerAddress) {
this.formerAddress = formerAddress;
}
/**
* @return the bloodType
*/
public String getBloodType() {
return bloodType;
}
/**
* @param bloodType the bloodType to set
*/
public void setBloodType(String bloodType) {
this.bloodType = bloodType;
}
/**
* @return the religion
*/
public String getReligion() {
return religion;
}
/**
* @param religion the religion to set
*/
public void setReligion(String religion) {
this.religion = religion;
}
/**
* @return the company
*/
public String getCompany() {
return company;
}
/**
* @param company the company to set
*/
public void setCompany(String company) {
this.company = company;
}
/**
* @return the tel
*/
public String getTel() {
return tel;
}
/**
* @param tel the tel to set
*/
public void setTel(String tel) {
this.tel = tel;
}
/**
* @return the mobil
*/
public String getMobil() {
return mobil;
}
/**
* @param mobil the mobil to set
*/
public void setMobil(String mobil) {
this.mobil = mobil;
}
/**
* @return the face
*/
public String getFace() {
return face;
}
/**
* @param face the face to set
*/
public void setFace(String face) {
this.face = face;
}
/**
* @return the personTypeCode
*/
public String getPersonTypeCode() {
return personTypeCode;
}
/**
* @param personTypeCode the personTypeCode to set
*/
public void setPersonTypeCode(String personTypeCode) {
this.personTypeCode = personTypeCode;
}
/**
* @return the issueOrgan
*/
public String getIssueOrgan() {
return issueOrgan;
}
/**
* @param issueOrgan the issueOrgan to set
*/
public void setIssueOrgan(String issueOrgan) {
this.issueOrgan = issueOrgan;
}
/**
* @return the sex
*/
public String getSex() {
return sex;
}
/**
* @param sex the sex to set
*/
public void setSex(String sex) {
this.sex = sex;
}
/**
* @return the createDate
*/
public Date getCreateDate() {
return createDate;
}
/**
* @param createDate the createDate to set
*/
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
/**
* @return the updateDate
*/
public Date getUpdateDate() {
return updateDate;
}
/**
* @param updateDate the updateDate to set
*/
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
/**
* @return the delFlag
*/
public String getDelFlag() {
return delFlag;
}
/**
* @param delFlag the delFlag to set
*/
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
/**
* @return the remarks
*/
public String getRemarks() {
return remarks;
}
/**
* @param remarks the remarks to set
*/
public void setRemarks(String remarks) {
this.remarks = remarks;
}
}
| [
"652241956@qq.com"
] | 652241956@qq.com |
1882736a4bbf8b192a94ae8b2c4477c41e7b7182 | 84de785f113a03a5e200218fa41711e67cd61b63 | /core/src/main/java/org/fourthline/cling/android/alternate/AndroidNetworkAddressFactory.java | 440bd8a8e594a900e2609bbd9abdaccffae2edcc | [] | no_license | bubbleguuum/cling | 3be10c3096334fce691a815c730935e73c654d97 | 28ee8b0fbbc0b71a73e383af530f6bb168b1f9f7 | refs/heads/master | 2021-01-18T08:24:29.950159 | 2013-10-26T13:02:46 | 2013-10-26T13:02:46 | 2,954,144 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,547 | java | /*
* Copyright (C) 2011 4th Line GmbH, Switzerland
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.fourthline.cling.android.alternate;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.logging.Logger;
import org.fourthline.cling.transport.impl.NetworkAddressFactoryImpl;
import org.fourthline.cling.transport.spi.InitializationException;
public class AndroidNetworkAddressFactory extends NetworkAddressFactoryImpl {
final private static Logger log = Logger.getLogger(AndroidUpnpServiceConfiguration.class.getName());
final private static int VERSION_CODE_GINGERBREAD = 9;
public AndroidNetworkAddressFactory(int streamListenPort) {
super(streamListenPort);
}
@Override
protected boolean requiresNetworkInterface() {
return false;
}
@Override
protected boolean isUsableNetworkInterface(NetworkInterface iface) throws Exception {
if(android.os.Build.VERSION.SDK_INT >= VERSION_CODE_GINGERBREAD && !iface.isUp()) {
log.finer("Skipping network interface (down): " + iface.getDisplayName());
return false;
}
if (getInetAddresses(iface).size() == 0) {
log.finer("Skipping network interface without bound IP addresses: " + iface.getDisplayName());
return false;
}
if (android.os.Build.VERSION.SDK_INT >= VERSION_CODE_GINGERBREAD && iface.isLoopback()) {
log.finer("Skipping network interface (ignoring loopback): " + iface.getDisplayName());
return false;
}
return true;
}
@Override
protected void displayInterfaceInformation(NetworkInterface netint) throws SocketException {
if(android.os.Build.VERSION.SDK_INT >= VERSION_CODE_GINGERBREAD) {
super.displayInterfaceInformation(netint);
}
}
@Override
public byte[] getHardwareAddress(InetAddress inetAddress) {
if(android.os.Build.VERSION.SDK_INT >= VERSION_CODE_GINGERBREAD) {
try {
NetworkInterface iface = NetworkInterface.getByInetAddress(inetAddress);
return iface != null ? iface.getHardwareAddress() : null;
} catch (Exception ex) {
// seen NullPointerException on Android 4.0.3 with inetAddress != null
// on Android we sometimes get "java.net.SocketException: No such device or address" when switching networks (mobile -> WiFi)
log.warning("cannot get hardware address for inet address: " + ex);
}
}
return null;
}
@Override
public InetAddress getLocalAddress(NetworkInterface networkInterface, boolean isIPv6, InetAddress remoteAddress) {
/*
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD ) {
// First try to find a local IP that is in the same subnet as the remote IP
InetAddress localIPInSubnet = getBindAddressInSubnetOf(remoteAddress);
if (localIPInSubnet != null) return localIPInSubnet;
}
*/
// TODO: This is totally random because we can't access low level InterfaceAddress on Android!
for (InetAddress localAddress : getInetAddresses(networkInterface)) {
if (isIPv6 && localAddress instanceof Inet6Address)
return localAddress;
if (!isIPv6 && localAddress instanceof Inet4Address)
return localAddress;
}
throw new IllegalStateException("Can't find any IPv4 or IPv6 address on interface: " + networkInterface.getDisplayName());
}
@Override
protected void discoverNetworkInterfaces() throws InitializationException {
try {
super.discoverNetworkInterfaces();
} catch (Exception ex) {
// try to workaround ICS bug on some model with network interface disappearing while enumerated
// http://code.google.com/p/android/issues/detail?id=33661
log.warning("Exception while enumerating network interfaces, trying once more: " + ex);
super.discoverNetworkInterfaces();
}
}
}
| [
"bubbleguuum@free.fr"
] | bubbleguuum@free.fr |
4110f10bd10133e34bd7349f4393a83a64662555 | 39bfe12467406aea98e7880ee678a71bafca1dbd | /src/main/java/californium/core/coap/CoAP.java | 19fc3b0b0549b47cd05df252ba25721b5039a22c | [] | no_license | artkar22/simulety | 9df46bcdd952130fe042a8f69a3943e79e3267e3 | 330595fafd8a180f1d233de5e01b371b2abc963b | refs/heads/master | 2020-07-14T11:07:04.707332 | 2017-09-16T12:16:21 | 2017-09-16T12:16:21 | 66,023,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,649 | java | /*******************************************************************************
* Copyright (c) 2015 Institute for Pervasive Computing, ETH Zurich and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.html.
*
* Contributors:
* Matthias Kovatsch - creator and main architect
* Martin Lanter - architect and re-implementation
* Dominique Im Obersteg - parsers and initial implementation
* Daniel Pauli - parsers and initial implementation
* Kai Hudalla - logging
******************************************************************************/
package californium.core.coap;
import java.nio.charset.Charset;
/**
* CoAP defines several constants.
* <ul>
* <li>Message types: CON, NON, ACK, RST</li>
* <li>Request codes: GET, POST, PUT, DELETE</li>
* <li>Response codes</li>
* <li>Option numbers</li>
* <li>Message format</li>
* </ul>
* @see OptionNumberRegistry
* @see MediaTypeRegistry
*/
public class CoAP {
/** RFC 7252 CoAP version */
public static final int VERSION = 0x01;
/** The CoAP URI scheme */
public static final String COAP_URI_SCHEME = "coap";
/** The CoAPS URI scheme */
public static final String COAP_SECURE_URI_SCHEME = "coaps";
/** The default CoAP port for normal CoAP communication (coap) */
public static final int DEFAULT_COAP_PORT = 5683;
/** The default CoAP port for secure CoAP communication (coaps) */
public static final int DEFAULT_COAP_SECURE_PORT = 5684;
/** The CoAP charset is always UTF-8 */
public static final Charset UTF8_CHARSET = Charset.forName("UTF-8");
private CoAP() {
// prevent initialization
}
/**
* CoAP defines four types of messages:
* Confirmable, Non-confirmable, Acknowledgment, Reset.
*/
public enum Type {
/** The Confirmable. */
CON(0),
/** The Non-confirmable. */
NON(1),
/** The Acknowledgment. */
ACK(2),
/** The Reject. */
RST(3);
/** The integer value of a message type. */
public final int value;
/**
* Instantiates a new type with the specified integer value.
*
* @param value the integer value
*/
Type(int value) {
this.value = value;
}
/**
* Converts an integer into its corresponding message type.
*
* @param value the integer value
* @return the message type
* @throws IllegalArgumentException if the integer value is unrecognized
*/
public static Type valueOf(int value) {
switch (value) {
case 0: return CON;
case 1: return NON;
case 2: return ACK;
case 3: return RST;
default: throw new IllegalArgumentException("Unknown CoAP type "+value);
}
}
}
/**
* The enumeration of request codes: GET, POST; PUT and DELETE.
*/
public enum Code {
/** The GET code. */
GET(1),
/** The POST code. */
POST(2),
/** The PUT code. */
PUT(3),
/** The DELETE code. */
DELETE(4);
/** The code value. */
public final int value;
/**
* Instantiates a new code with the specified code value.
*
* @param value the integer value of the code
*/
Code(int value) {
this.value = value;
}
/**
* Converts the specified integer value to a request code.
*
* @param value the integer value
* @return the request code
* @throws IllegalArgumentException if the integer value is unrecognized
*/
public static Code valueOf(int value) {
switch (value) {
case 1: return GET;
case 2: return POST;
case 3: return PUT;
case 4: return DELETE;
default: throw new IllegalArgumentException("Unknwon CoAP request code "+value);
}
}
}
/**
* The enumeration of response codes
*/
public enum ResponseCode {
// Success: 64--95
_UNKNOWN_SUCCESS_CODE(64), // 2.00 is undefined -- only used to identify class
CREATED(65),
DELETED(66),
VALID(67),
CHANGED(68),
CONTENT(69),
CONTINUE(95),
// Client error: 128--159
BAD_REQUEST(128),
UNAUTHORIZED(129),
BAD_OPTION(130),
FORBIDDEN(131),
NOT_FOUND(132),
METHOD_NOT_ALLOWED(133),
NOT_ACCEPTABLE(134),
REQUEST_ENTITY_INCOMPLETE(136),
PRECONDITION_FAILED(140),
REQUEST_ENTITY_TOO_LARGE(141),
UNSUPPORTED_CONTENT_FORMAT(143),
// Server error: 160--192
INTERNAL_SERVER_ERROR(160),
NOT_IMPLEMENTED(161),
BAD_GATEWAY(162),
SERVICE_UNAVAILABLE(163),
GATEWAY_TIMEOUT(164),
PROXY_NOT_SUPPORTED(165);
/** The code value. */
public final int value;
/**
* Instantiates a new response code with the specified integer value.
*
* @param value the integer value
*/
private ResponseCode(int value) {
this.value = value;
}
/**
* Converts the specified integer value to a response code.
*
* @param value the value
* @return the response code
* @throws IllegalArgumentException if integer value is not recognized
*/
public static ResponseCode valueOf(int value) {
switch (value) {
// CoAPTest.testResponseCode ensures we keep this up to date
case 65: return CREATED;
case 66: return DELETED;
case 67: return VALID;
case 68: return CHANGED;
case 69: return CONTENT;
case 95: return CONTINUE;
case 128: return BAD_REQUEST;
case 129: return UNAUTHORIZED;
case 130: return BAD_OPTION;
case 131: return FORBIDDEN;
case 132: return NOT_FOUND;
case 133: return METHOD_NOT_ALLOWED;
case 134: return NOT_ACCEPTABLE;
case 136: return REQUEST_ENTITY_INCOMPLETE;
case 140: return PRECONDITION_FAILED;
case 141: return REQUEST_ENTITY_TOO_LARGE;
case 143: return UNSUPPORTED_CONTENT_FORMAT;
case 160: return INTERNAL_SERVER_ERROR;
case 161: return NOT_IMPLEMENTED;
case 162: return BAD_GATEWAY;
case 163: return SERVICE_UNAVAILABLE;
case 164: return GATEWAY_TIMEOUT;
case 165: return PROXY_NOT_SUPPORTED;
// codes unknown at release time
default:
// Fallback to class
if (value/32 == 2) return _UNKNOWN_SUCCESS_CODE;
else if (value/32 == 4) return BAD_REQUEST;
else if (value/32 == 5) return INTERNAL_SERVER_ERROR;
/// Undecidable
else throw new IllegalArgumentException("Unknown CoAP response code "+value);
}
}
public String toString() {
return String.format("%d.%02d", this.value/32, this.value%32);
}
public static boolean isSuccess(ResponseCode code) {
return 64 <= code.value && code.value < 96;
}
public static boolean isClientError(ResponseCode code) {
return 128 <= code.value && code.value < 160;
}
public static boolean isServerError(ResponseCode code) {
return 160 <= code.value && code.value < 192;
}
}
/**
* CoAP message format.
*/
public class MessageFormat {
/** number of bits used for the encoding of the CoAP version field. */
public static final int VERSION_BITS = 2;
/** number of bits used for the encoding of the message type field. */
public static final int TYPE_BITS = 2;
/** number of bits used for the encoding of the token length field. */
public static final int TOKEN_LENGTH_BITS = 4;
/** number of bits used for the encoding of the request method/response code field. */
public static final int CODE_BITS = 8;
/** number of bits used for the encoding of the message ID. */
public static final int MESSAGE_ID_BITS = 16;
/** number of bits used for the encoding of the option delta field. */
public static final int OPTION_DELTA_BITS = 4;
/** number of bits used for the encoding of the option delta field. */
public static final int OPTION_LENGTH_BITS = 4;
/** One byte which indicates indicates the end of options and the start of the payload. */
public static final byte PAYLOAD_MARKER = (byte) 0xFF;
/** CoAP version supported by this Californium version. */
public static final int VERSION = 1;
/** The code value of an empty message. */
public static final int EMPTY_CODE = 0;
/** The lowest value of a request code. */
public static final int REQUEST_CODE_LOWER_BOUND = 1;
/** The highest value of a request code. */
public static final int REQUEST_CODE_UPPER_BOUND = 31;
/** The lowest value of a response code. */
public static final int RESPONSE_CODE_LOWER_BOUND = 64;
/** The highest value of a response code. */
public static final int RESPONSE_CODE_UPPER_BOUND = 191;
}
}
| [
"artur.karolak@primaris.eu"
] | artur.karolak@primaris.eu |
3038cb2e31a33e3dd1320583acecd4084d09b695 | 080c39332daae500462045672222b63be88eb5a5 | /nulled/codecanyon-23526581-oxoo-android-live-tv-movie-portal-app-with-powerful-admin-panel/ANDROID/ANDROID-SOUCE-CODE/app/src/main/java/com/oxoo/spagreen/adapters/CountryAdapter.java | 86c6e95c8eb43ae415a25cddeaf767183f6ec4c6 | [] | no_license | jakcal/APPS | 14f6ec76a7d0555bd39651a7c36c7e8da0100525 | 76673796577d5327601d05e7d3fc0987526045eb | refs/heads/master | 2022-12-13T03:27:33.140138 | 2021-05-02T15:29:30 | 2021-05-02T15:29:30 | 235,700,979 | 0 | 0 | null | 2022-12-12T06:23:47 | 2020-01-23T01:14:31 | PHP | UTF-8 | Java | false | false | 2,684 | java | package com.oxoo.spagreen.adapters;
import android.content.Context;
import android.content.Intent;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.oxoo.spagreen.ItemMovieActivity;
import com.oxoo.spagreen.R;
import com.oxoo.spagreen.models.CommonModels;
import java.util.ArrayList;
import java.util.List;
public class CountryAdapter extends RecyclerView.Adapter<CountryAdapter.OriginalViewHolder> {
private List<CommonModels> items = new ArrayList<>();
private Context ctx;
private String type;
private int c=0;
public CountryAdapter(Context context, List<CommonModels> items,String type) {
this.items = items;
ctx = context;
this.type=type;
}
@Override
public CountryAdapter.OriginalViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
CountryAdapter.OriginalViewHolder vh;
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_country, parent, false);
vh = new CountryAdapter.OriginalViewHolder(v);
return vh;
}
@Override
public void onBindViewHolder(CountryAdapter.OriginalViewHolder holder, final int position) {
final CommonModels obj = items.get(position);
holder.name.setText(obj.getTitle());
holder.lyt_parent.setCardBackgroundColor(ctx.getResources().getColor(getColor()));
holder.lyt_parent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(ctx, ItemMovieActivity.class);
intent.putExtra("id",obj.getId());
intent.putExtra("title",obj.getTitle());
intent.putExtra("type",type);
ctx.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return items.size();
}
public class OriginalViewHolder extends RecyclerView.ViewHolder {
public TextView name;
private CardView lyt_parent;
public OriginalViewHolder(View v) {
super(v);
name = v.findViewById(R.id.name);
lyt_parent=v.findViewById(R.id.lyt_parent);
}
}
private int getColor(){
int colorList[] = {R.color.red_400,R.color.blue_400,R.color.indigo_400,R.color.orange_400,R.color.light_green_400,R.color.blue_grey_400};
if (c>=6){
c=0;
}
int color = colorList[c];
c++;
return color;
}
} | [
"31854556+jakcal@users.noreply.github.com"
] | 31854556+jakcal@users.noreply.github.com |
46e039273412607c862fa1ae10e160c55bc4f801 | c66994198f8a6d74b88c11c40cda1eb2924ad623 | /ts-generator/src/com/siliconmint/ts/translator/ImportStatementTranslatorBase.java | a4589b7e5d55ba24960b99c8c828cb5df3919a40 | [] | no_license | Skory/translator | 4249bc39e3968b399638ac86d51af8fb21de41bf | ed3a6397d8f69e70c6b8f55daa530ff166cdc00a | refs/heads/master | 2016-09-06T11:56:02.040597 | 2014-01-14T08:42:43 | 2014-01-14T08:42:43 | 15,894,963 | 6 | 3 | null | null | null | null | UTF-8 | Java | false | false | 3,087 | java | package com.siliconmint.ts.translator;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiImportStatementBase;
import com.siliconmint.ts.util.FileUtil;
import java.io.File;
import java.util.Arrays;
public abstract class ImportStatementTranslatorBase<T extends PsiImportStatementBase> extends Translator<T> {
@Override
public void translate(PsiElementVisitor visitor, T element, TranslationContext ctx) {
String [] packagePath = ctx.getClassPackage().split("\\.");
String [] importPath = getImportPath(element);
int firstClassComponent = 0;
for (String importPathComponent : importPath) {
if (Character.isUpperCase(importPathComponent.charAt(0)) || importPathComponent.charAt(0) == '*') {
break;
}
firstClassComponent++;
}
boolean multiImport = firstClassComponent >= importPath.length;
int matchingPaths = 0;
while (packagePath.length > matchingPaths && firstClassComponent > matchingPaths
&& packagePath[matchingPaths].equals(importPath[matchingPaths])){
matchingPaths++;
}
StringBuilder sb = new StringBuilder();
if (packagePath.length > matchingPaths) {
for (int i=0; i < packagePath.length - matchingPaths; i++) {
sb.append("../");
}
}
if (firstClassComponent > matchingPaths) {
for (int i=matchingPaths; i < firstClassComponent; i++) {
sb.append(importPath[i]).append("/");
}
}
String dirPath = sb.toString();
if (!multiImport) {
String fileName = importPath[firstClassComponent];
printReference(ctx, dirPath, fileName);
} else {
if (ctx.getTranslatedFile() == null) {
printTodoMultiImportResolve(ctx, dirPath);
} else {
File sourceFile = ctx.getTranslatedFile();
File referencedSourcePackage = new File(sourceFile.getParentFile(), dirPath);
if (!referencedSourcePackage.exists()) {
printTodoMultiImportResolve(ctx, dirPath);
} else {
File[] sourceFiles = referencedSourcePackage.listFiles(FileUtil.JAVA_SOURCE_FILE_FILTER);
Arrays.sort(sourceFiles, FileUtil.FILE_NAME_COMPARATOR);
for (File file : sourceFiles) {
String fileName = file.getName();
fileName = fileName.substring(0, fileName.lastIndexOf(".java"));
// Check if current file contains referenced file (=class) name
if (element.getContainingFile().getText().contains(fileName)) {
printReference(ctx, dirPath, fileName);
}
}
}
}
}
}
private void printReference(TranslationContext ctx, String dirPath, String fileName) {
ctx.print("///<reference path=\"");
ctx.append(dirPath);
ctx.append(fileName).append(".ts");
ctx.append("\"/>\n");
}
private void printTodoMultiImportResolve(TranslationContext ctx, String dirPath) {
ctx.print("//TODO Resolve multi-import\n");
ctx.print("///<reference path=\"").append(dirPath).append("\"/>\n");
}
protected abstract String[] getImportPath(T element);
}
| [
"borisskorobogaty@gmail.com"
] | borisskorobogaty@gmail.com |
d6c3d65a1b7dde933772fb090144c1b2a7381b7a | 3578aeb3d73be6d1b1a90bb4a1cec394b40dd519 | /src/facturacioncarniceria/controlador/CReportes.java | ed170fd67cc1ed1189adc12c91bfbba0b3299c3d | [] | no_license | Jordy2529/FacturaEscritorio | 620782ec3371247d0d3586b66a369a8161ea4851 | 86ed41fae2ef397bf64e6f0649d9c05b521c314c | refs/heads/master | 2023-01-10T18:49:51.717270 | 2020-10-02T07:13:15 | 2020-10-02T07:13:15 | 289,428,984 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 24,637 | 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 facturacioncarniceria.controlador;
import facturacioncarniceria.estrategia.Context;
import facturacioncarniceria.estrategia.ReportesEstrategia;
import facturacioncarniceria.modelo.Conexion;
import facturacioncarniceria.modelo.ReportesDAO;
import facturacioncarniceria.modelo.Validaciones;
import facturacioncarniceria.vista.VPrincipal;
import facturacioncarniceria.vista.VReportes;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.RowFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableRowSorter;
import javax.swing.text.TableView;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
/**
*
* @author JORDY
*/
public class CReportes implements KeyListener, MouseListener, ActionListener {
VReportes vreportes;
Context contextReportes;
VPrincipal vprincipal;
ReportesDAO reportesDAO;
ReportesEstrategia strategyReportes = new ReportesEstrategia();
Conexion connectionBD;
Validaciones validar = new Validaciones();
DefaultTableModel modeloTablaVentas = new DefaultTableModel() {
@Override
public boolean isCellEditable(int filas, int columnas) {
if (columnas == 3) {
return true;
} else {
return false;
}
}
};
DefaultTableModel modeloTablaVentas1 = new DefaultTableModel() {
@Override
public boolean isCellEditable(int filas, int columnas) {
if (columnas == 3) {
return true;
} else {
return false;
}
}
};
DefaultTableModel modeloTablaCompras = new DefaultTableModel() {
@Override
public boolean isCellEditable(int filas, int columnas) {
if (columnas == 3) {
return true;
} else {
return false;
}
}
};
DefaultTableModel modeloTablaCompras1 = new DefaultTableModel() {
@Override
public boolean isCellEditable(int filas, int columnas) {
if (columnas == 3) {
return true;
} else {
return false;
}
}
};
TableRowSorter trs;
TableRowSorter trs1;
TableRowSorter trs2;
public CReportes(Context context, VReportes vreportes, VPrincipal vmain) {
reportesDAO = new ReportesDAO();
this.vreportes = vreportes;
this.contextReportes = context;
this.vprincipal = vmain;
this.contextReportes = new Context(strategyReportes);
this.vreportes.getTxtBuscarProducto().addKeyListener(this);
this.vreportes.getTxtCodigoProducto().addKeyListener(this);
this.vreportes.getTxtProveedorBuscar().addKeyListener(this);
this.vreportes.getBtnActualizar().addActionListener(this);
this.vreportes.getBtnActualizarCompra().addActionListener(this);
this.vreportes.getBtnExportarCompras().addActionListener(this);
// // this.vreportes.getJmiModificar().addActionListener(this);
this.vreportes.getBtnExportarVentas().addActionListener(this);
this.vreportes.getBtnExportar1().addActionListener(this);
this.vreportes.getBtnExportar2().addActionListener(this);
this.vreportes.getBtnActualizar1().addActionListener(this);
// // this.vreportes.getJmiModificar().addActionListener(this);
// this.vreportes.getTxtBuscar().addKeyListener(this);
// this.vreportes.getTablaUsuario().addMouseListener(this);
this.connectionBD = new Conexion();
modeloTablaCompras.addColumn("#");
modeloTablaCompras.addColumn("TIPO");
modeloTablaCompras.addColumn("FECHA");
modeloTablaCompras.addColumn("IDENT. RUC");
modeloTablaCompras.addColumn("NOM. PROVEEDOR");
modeloTablaCompras.addColumn("NUM. FACTURA");
modeloTablaCompras.addColumn("SUB 12%");
modeloTablaCompras.addColumn("BASE 0%");
modeloTablaCompras.addColumn("IVA 12%");
modeloTablaCompras.addColumn("TOTAL");
modeloTablaCompras.addColumn("PAGO");
modeloTablaCompras.addColumn("REALIZADO");
vreportes.getTablaReporteCompra().setModel(modeloTablaCompras);
modeloTablaCompras1.addColumn("#");
modeloTablaCompras1.addColumn("FACT. COMPRA");
modeloTablaCompras1.addColumn("COD. PRODUCTO");
modeloTablaCompras1.addColumn("NOMBRE");
modeloTablaCompras1.addColumn("CANTIDAD");
modeloTablaCompras1.addColumn("PRECIO");
modeloTablaCompras1.addColumn("TOTAL");
modeloTablaCompras1.addColumn("FECHA");
modeloTablaCompras1.addColumn("PROVEEDOR");
modeloTablaCompras1.addColumn("DIRECCION");
modeloTablaCompras1.addColumn("TELEFONO");
vreportes.getTablaReporteCompra1().setModel(modeloTablaCompras1);
modeloTablaVentas.addColumn("#");
modeloTablaVentas.addColumn("TIPO");
modeloTablaVentas.addColumn("FECHA");
modeloTablaVentas.addColumn("IDENT. CEDULA");
modeloTablaVentas.addColumn("NOM. CLIENTE");
modeloTablaVentas.addColumn("NUM. FACTURA");
modeloTablaVentas.addColumn("SUB 12%");
modeloTablaVentas.addColumn("BASE 0%");
modeloTablaVentas.addColumn("IVA 12%");
modeloTablaVentas.addColumn("TOTAL");
modeloTablaVentas.addColumn("PAGO");
modeloTablaVentas.addColumn("REALIZADO");
modeloTablaVentas.addColumn("ANULADO");
vreportes.getTablaReporteVenta().setModel(modeloTablaVentas);
modeloTablaVentas1.addColumn("#");
modeloTablaVentas1.addColumn("TIPO");
modeloTablaVentas1.addColumn("FECHA");
modeloTablaVentas1.addColumn("IDENT. CEDULA");
modeloTablaVentas1.addColumn("NOM. CLIENTE");
modeloTablaVentas1.addColumn("NUM. FACTURA");
modeloTablaVentas1.addColumn("SUB 12%");
modeloTablaVentas1.addColumn("BASE 0%");
modeloTablaVentas1.addColumn("IVA 12%");
modeloTablaVentas1.addColumn("TOTAL");
modeloTablaVentas1.addColumn("PAGO");
modeloTablaVentas1.addColumn("REALIZADO");
vreportes.getTablaReporteVenta1().setModel(modeloTablaVentas1);
}
public void validarCampos() {
}
public void iniciarVentana() {
vreportes.show();
validarCampos();
vreportes.getTxtCodigoProducto().setDocument(new Validaciones());
vreportes.getTxtProveedorBuscar().setDocument(new Validaciones());
vreportes.getTxtBuscarProducto().setDocument(new Validaciones());
vreportes.getTablaReporteCompra().getColumnModel().getColumn(0).setPreferredWidth(2);
vreportes.getTablaReporteCompra().getColumnModel().getColumn(1).setPreferredWidth(50);
vreportes.getTablaReporteCompra().getColumnModel().getColumn(2).setPreferredWidth(40);
vreportes.getTablaReporteCompra().getColumnModel().getColumn(3).setPreferredWidth(60);
vreportes.getTablaReporteCompra().getColumnModel().getColumn(4).setPreferredWidth(150);
vreportes.getTablaReporteCompra().getColumnModel().getColumn(5).setPreferredWidth(80);
vreportes.getTablaReporteCompra().getColumnModel().getColumn(6).setPreferredWidth(20);
vreportes.getTablaReporteCompra().getColumnModel().getColumn(7).setPreferredWidth(20);
vreportes.getTablaReporteCompra().getColumnModel().getColumn(8).setPreferredWidth(20);
vreportes.getTablaReporteCompra().getColumnModel().getColumn(9).setPreferredWidth(20);
vreportes.getTablaReporteCompra().getColumnModel().getColumn(10).setPreferredWidth(20);
vreportes.getTablaReporteCompra().getColumnModel().getColumn(11).setPreferredWidth(100);
vreportes.getTablaReporteCompra1().getColumnModel().getColumn(0).setPreferredWidth(15);
vreportes.getTablaReporteCompra1().getColumnModel().getColumn(1).setPreferredWidth(25);
vreportes.getTablaReporteCompra1().getColumnModel().getColumn(2).setPreferredWidth(15);
vreportes.getTablaReporteCompra1().getColumnModel().getColumn(3).setPreferredWidth(200);
vreportes.getTablaReporteCompra1().getColumnModel().getColumn(4).setPreferredWidth(25);
vreportes.getTablaReporteCompra1().getColumnModel().getColumn(5).setPreferredWidth(25);
vreportes.getTablaReporteCompra1().getColumnModel().getColumn(6).setPreferredWidth(25);
vreportes.getTablaReporteCompra1().getColumnModel().getColumn(7).setPreferredWidth(25);
vreportes.getTablaReporteCompra1().getColumnModel().getColumn(8).setPreferredWidth(100);
vreportes.getTablaReporteCompra1().getColumnModel().getColumn(9).setPreferredWidth(200);
vreportes.getTablaReporteCompra1().getColumnModel().getColumn(10).setPreferredWidth(50);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(0).setPreferredWidth(2);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(1).setPreferredWidth(50);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(2).setPreferredWidth(40);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(3).setPreferredWidth(60);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(4).setPreferredWidth(150);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(5).setPreferredWidth(80);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(6).setPreferredWidth(20);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(7).setPreferredWidth(20);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(8).setPreferredWidth(20);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(9).setPreferredWidth(20);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(10).setPreferredWidth(20);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(11).setPreferredWidth(100);
vreportes.getTablaReporteVenta().getColumnModel().getColumn(12).setPreferredWidth(50);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(0).setPreferredWidth(2);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(1).setPreferredWidth(50);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(2).setPreferredWidth(40);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(3).setPreferredWidth(60);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(4).setPreferredWidth(150);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(5).setPreferredWidth(80);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(6).setPreferredWidth(20);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(7).setPreferredWidth(20);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(8).setPreferredWidth(20);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(9).setPreferredWidth(20);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(10).setPreferredWidth(20);
vreportes.getTablaReporteVenta1().getColumnModel().getColumn(11).setPreferredWidth(100);
Date fechaActual = new Date();
vreportes.getDcInicial().setDate(fechaActual);
vreportes.getDcFinal().setDate(fechaActual);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
vreportes.getDcInicial1().setDate(fechaActual);
vreportes.getDcFinal1().setDate(fechaActual);
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
String fechaIngreso = sdf.format(vreportes.getDcInicial().getDate());
String fechaIngresoFin = sdf.format(vreportes.getDcFinal().getDate());
String fechaIngresoFin1 = sdf1.format(vreportes.getDcFinal1().getDate());
contextReportes.RunvisualizeCompraVenta(modeloTablaCompras, fechaIngreso, fechaIngresoFin, 1);
contextReportes.RunvisualizeCompraVenta(modeloTablaVentas, fechaIngreso, fechaIngresoFin, 2);
contextReportes.RunvisualizeCompraVenta(modeloTablaVentas1, fechaIngreso, fechaIngresoFin1, 3);
contextReportes.RunVisualizar(modeloTablaCompras1, 0);
vprincipal.getLblCedula().getText();
// contextReportes.RunVisualizeContra(vmodificarcontra.getTxtCedula(),vmodificarcontra.getTxtContra(),vmodificarcontra.getTxtNombres(),vmodificarcontra.getTxtCargo(),vmain.getLblcedula().getText());
}
public void cleanTableCompra() {
for (int i = 0; i < vreportes.getTablaReporteCompra().getRowCount(); i++) {
modeloTablaCompras.removeRow(i);
i -= 1;
}
}
public void cleanTableCompra1() {
for (int i = 0; i < vreportes.getTablaReporteCompra1().getRowCount(); i++) {
modeloTablaCompras1.removeRow(i);
i -= 1;
}
}
public void cleanTableVenta() {
for (int i = 0; i < vreportes.getTablaReporteVenta().getRowCount(); i++) {
modeloTablaVentas.removeRow(i);
i -= 1;
}
}
public void cleanTableVenta1() {
for (int i = 0; i < vreportes.getTablaReporteVenta1().getRowCount(); i++) {
modeloTablaVentas1.removeRow(i);
i -= 1;
}
}
public void limpiarCampos() {
vreportes.getTxtBuscarProducto().setText(null);
vreportes.getTxtCodigoProducto().setText("");
vreportes.getTxtProveedorBuscar().setText("");
}
@Override
public void keyReleased(KeyEvent ae) {
if (vreportes.getTxtCodigoProducto()== ae.getSource()) {
trs.setRowFilter(RowFilter.regexFilter("(?i)"+vreportes.getTxtCodigoProducto().getText(), 2));
}
if (vreportes.getTxtBuscarProducto()== ae.getSource()) {
trs1.setRowFilter(RowFilter.regexFilter("(?i)"+vreportes.getTxtBuscarProducto().getText(), 3));
}
if (vreportes.getTxtProveedorBuscar()== ae.getSource()) {
trs2.setRowFilter(RowFilter.regexFilter("(?i)"+vreportes.getTxtProveedorBuscar().getText(), 8));
}
}
@Override
public void keyTyped(KeyEvent ae) {
if (vreportes.getTxtCodigoProducto()== ae.getSource()) {
trs = new TableRowSorter(modeloTablaCompras1);
vreportes.getTablaReporteCompra1().setRowSorter(trs);
}
if (vreportes.getTxtBuscarProducto()== ae.getSource()) {
trs1 = new TableRowSorter(modeloTablaCompras1);
vreportes.getTablaReporteCompra1().setRowSorter(trs1);
}
if (vreportes.getTxtProveedorBuscar()== ae.getSource()) {
trs2 = new TableRowSorter(modeloTablaCompras1);
vreportes.getTablaReporteCompra1().setRowSorter(trs2);
}
}
@Override
public void keyPressed(KeyEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void mouseClicked(MouseEvent e) {
// if (e.getClickCount() == 2 && !e.isConsumed() && vreportes.getTablaUsuario()== e.getSource()) {
// try {
// int fila = vreportes.getTablaUsuario().getSelectedRow();
// if (fila >= 0) {
// vreportes.getTxtCedula().setText(vreportes.getTablaUsuario().getValueAt(fila,0).toString());
// vreportes.getTxtNombres().setText(vreportes.getTablaUsuario().getValueAt(fila,1).toString());
// vreportes.getTxtApellido().setText(vreportes.getTablaUsuario().getValueAt(fila,2).toString());
// vreportes.getBtnGuardarUsuario().setEnabled(false);
// vreportes.getBtnModificarUsuario().setEnabled(true);
// vreportes.getTablaUsuario().setEnabled(false);
// }
// }catch (Exception ex) {
// JOptionPane.showMessageDialog(vprincipal, "No se Guardo");
// }
// }
}
@Override
public void mousePressed(MouseEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void mouseReleased(MouseEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void mouseEntered(MouseEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void mouseExited(MouseEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public void crearCarpetas(String compraVenta, String fechaInicio, String fechaFinal) {
File directorio = new File("A:\\COMPRA VENTA\\" + compraVenta+"_"+fechaInicio+"_"+fechaFinal);
directorio.mkdirs();
}
public void exportarExcel(JTable t, String compraVenta) throws IOException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String fechaIngreso = sdf.format(vreportes.getDcInicial().getDate());
String fechaIngresoFin = sdf.format(vreportes.getDcFinal().getDate());
crearCarpetas(compraVenta,fechaIngreso,fechaIngresoFin);
JFileChooser chooser = new JFileChooser("A:/COMPRA VENTA/" + compraVenta+"_"+fechaIngreso+"_"+fechaIngresoFin);
chooser.setSelectedFile(new File("REPORTE_" + compraVenta+"_"+fechaIngreso+"_"+fechaIngresoFin));
FileNameExtensionFilter filter = new FileNameExtensionFilter("Archivos de excel", "xls");
chooser.setFileFilter(filter);
chooser.setDialogTitle("Guardar archivo");
chooser.setAcceptAllFileFilterUsed(false);
if (chooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
String ruta = chooser.getSelectedFile().toString().concat(".xls");
try {
File archivoXLS = new File(ruta);
if (archivoXLS.exists()) {
archivoXLS.delete();
}
archivoXLS.createNewFile();
Workbook libro = new HSSFWorkbook();
FileOutputStream archivo = new FileOutputStream(archivoXLS);
Sheet hoja = libro.createSheet("Lista de Productos Cotización");
hoja.setDisplayGridlines(false);
for (int f = 0; f < t.getRowCount(); f++) {
Row fila = hoja.createRow(f);
for (int c = 0; c < t.getColumnCount(); c++) {
Cell celda = fila.createCell(c);
if (f == 0) {
celda.setCellValue(t.getColumnName(c));
}
}
}
int filaInicio = 1;
for (int f = 0; f < t.getRowCount(); f++) {
Row fila = hoja.createRow(filaInicio);
filaInicio++;
for (int c = 0; c < t.getColumnCount(); c++) {
Cell celda = fila.createCell(c);
if (t.getValueAt(f, c) instanceof Double) {
celda.setCellValue(Double.parseDouble(t.getValueAt(f, c).toString()));
} else if (t.getValueAt(f, c) instanceof Float) {
celda.setCellValue(Float.parseFloat((String) t.getValueAt(f, c)));
} else {
celda.setCellValue(String.valueOf(t.getValueAt(f, c)));
}
}
}
libro.write(archivo);
archivo.close();
Desktop.getDesktop().open(archivoXLS);
} catch (IOException | NumberFormatException e) {
throw e;
}
}
}
public void cajaNum(){
int totalColumnaCompra = vreportes.getTablaReporteVenta1().getRowCount();
vreportes.getTxtNumFacturas().setText(Integer.toString(totalColumnaCompra));
double totalProductos1 = 0;
for (int j = 0; j < vreportes.getTablaReporteVenta1().getRowCount(); j++) {
totalProductos1 = totalProductos1 + Float.parseFloat(vreportes.getTablaReporteVenta1().getValueAt(j, 9).toString());
totalProductos1 = Math.round(totalProductos1 * 100) / 100d;
System.out.println(totalProductos1);
vreportes.getTxtCaja().setText(Double.toString(totalProductos1));
}
}
@Override
public void actionPerformed(ActionEvent ae) {
if (this.vreportes.getBtnExportarVentas() == ae.getSource()) {
try {
exportarExcel(vreportes.getTablaReporteVenta(),"VENTAS");
} catch (IOException ex) {
Logger.getLogger(CProducto.class.getName()).log(Level.SEVERE, null, ex);
}
}
if (this.vreportes.getBtnExportarCompras()== ae.getSource()) {
try {
exportarExcel(vreportes.getTablaReporteCompra(),"COMPRAS");
} catch (IOException ex) {
Logger.getLogger(CProducto.class.getName()).log(Level.SEVERE, null, ex);
}
}
if (this.vreportes.getBtnExportar1()== ae.getSource()) {
try {
exportarExcel(vreportes.getTablaReporteVenta1(),"VENTAS/CAJA");
} catch (IOException ex) {
Logger.getLogger(CProducto.class.getName()).log(Level.SEVERE, null, ex);
}
}
if (this.vreportes.getBtnExportar2()== ae.getSource()) {
try {
exportarExcel(vreportes.getTablaReporteCompra1(),"COMPRAS/PROVEEDORES");
} catch (IOException ex) {
Logger.getLogger(CProducto.class.getName()).log(Level.SEVERE, null, ex);
}
}
if (this.vreportes.getBtnActualizar() == ae.getSource()) {
cleanTableCompra();
cleanTableVenta();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String fechaIngreso = sdf.format(vreportes.getDcInicial().getDate());
String fechaIngresoFin = sdf.format(vreportes.getDcFinal().getDate());
// vreportes.getDcInicial().setFormatoFecha(fechaActual);
// vreportes.getDcFinal().setDate(fechaActual);
contextReportes.RunvisualizeCompraVenta(modeloTablaCompras, fechaIngreso, fechaIngresoFin, 1);
contextReportes.RunvisualizeCompraVenta(modeloTablaVentas, fechaIngreso, fechaIngresoFin, 2);
}
if (this.vreportes.getBtnActualizarCompra()== ae.getSource()) {
cleanTableCompra1();
limpiarCampos();
vreportes.getTxtBuscarProducto().requestFocus();
contextReportes.RunVisualizar(modeloTablaCompras1, 0);
}
if (this.vreportes.getBtnActualizar1()== ae.getSource()) {
cleanTableVenta1();
vreportes.getTxtCaja().setText("");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String fechaIngreso = sdf.format(vreportes.getDcInicial1().getDate());
String fechaIngresoFin = sdf.format(vreportes.getDcFinal1().getDate());
contextReportes.RunvisualizeCompraVenta(modeloTablaVentas1, fechaIngreso, fechaIngresoFin, 3);
cajaNum();
}
}
}
| [
"luis.jordy21@gmail.com"
] | luis.jordy21@gmail.com |
aedbca5accb3d4d2e8f5d3249e22f0675c4e9f20 | 2f9c3ec3e69aacbce1085fa29e89526ebe6f711d | /parent0613/babasport-commons/src/main/java/cn/itcast/common/json/JsonUtils.java | 4114ce3fa7df961db605636c83fe6009a58dab86 | [] | no_license | huchuanqiping/xhhy | 95d947803dd4be9a2d03f6703cb3079915c60251 | 8101dda94935fa9201274eb62ee9f0ced84fb610 | refs/heads/master | 2020-03-26T18:17:19.430255 | 2018-08-18T09:16:17 | 2018-08-18T09:16:17 | 142,732,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,038 | java | package cn.itcast.common.json;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* 对象转换JSON
* @author xujie
*
*/
public class JsonUtils {
//List集合转成JSON字符串
public static String ObjeceToJson(Object obj) {
ObjectMapper om = new ObjectMapper();
//设置null不转
om.setSerializationInclusion(Include.NON_NULL);
//写
String value = null;
try {
value = om.writeValueAsString(obj);
} catch (JsonProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return value;
}
//将JSON字符串转成POJO对象
public static <T> T jsonToObject(String json, Class<T> t){
ObjectMapper om = new ObjectMapper();
om.setSerializationInclusion(Include.NON_NULL);
T object=null;
try {
object = om.readValue(json,t);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return object;
}
} | [
"huchuanqiping@163.com"
] | huchuanqiping@163.com |
d2fc9be89236f74bacf344b7d8723f731f6fd956 | d98fdbba8be0f3b3075aabb4812165e5f484c437 | /link-redirector/src/main/java/com/hoang/linkredirector/view_model/UserSearchCriteria.java | 22c41acf335cfbd7bdd9e2e975042d1cf904a575 | [] | no_license | homertruong66/research | 61fbecb06ebc65c0695e60b72a37444508d531f8 | 4f4ff309b872aa1056f197f29622fb3d66821520 | refs/heads/master | 2022-12-22T00:51:57.846631 | 2019-07-19T10:32:03 | 2019-07-19T10:32:03 | 197,752,073 | 0 | 0 | null | 2022-12-16T04:43:32 | 2019-07-19T10:17:41 | Java | UTF-8 | Java | false | false | 1,806 | java | package com.hoang.linkredirector.view_model;
import java.io.Serializable;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.QueryParam;
public class UserSearchCriteria implements Serializable {
private static final long serialVersionUID = -2621089893136317367L;
@QueryParam("name")
@DefaultValue("")
private String name;
@QueryParam("sort_name")
@DefaultValue("id")
private String sortName;
@QueryParam("sort_direction")
@DefaultValue("asc")
private String sortDirection;
@Min(value = 1, message = "page_index must be greater than 1")
@Max(value = Integer.MAX_VALUE, message = "page_index can't be greater than " + Integer.MAX_VALUE)
@DefaultValue("1")
@QueryParam("page_index")
private int pageIndex;
@QueryParam("page_size")
@DefaultValue("50")
private int pageSize;
public String getName () {
return name;
}
public void setName (String name) {
this.name = name;
}
public String getSortName () {
return sortName;
}
public void setSortName (String sortName) {
this.sortName = sortName;
}
public String getSortDirection () {
return sortDirection;
}
public void setSortDirection (String sortDirection) {
this.sortDirection = sortDirection;
}
public int getPageIndex () {
return pageIndex;
}
public void setPageIndex (int pageIndex) {
this.pageIndex = pageIndex;
}
public int getPageSize () {
return pageSize;
}
public void setPageSize (int pageSize) {
this.pageSize = pageSize;
}
public int getOffset () {
return (this.pageIndex - 1) * this.pageSize;
}
}
| [
"homer.truong@eztable.com"
] | homer.truong@eztable.com |
147ccdaa581735b1210784cd9a8ad36ef7f979c6 | 8cf88b68c04c1f8bc7c9f48a7e782bcd99998661 | /src/ui/AddCommunityJPanel.java | a352e26be1494f1d64f031039d9b54e6b18b92ae | [] | no_license | gunasekharv6/VitalSigns | 464cab1cf86545f576f708ef63749ddc6f49f19d | 3ebb17c02df92eeaef25184225f43dc213408dfc | refs/heads/main | 2023-08-29T11:16:48.247595 | 2021-11-03T03:59:29 | 2021-11-03T03:59:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,584 | 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 ui;
import java.awt.CardLayout;
import java.awt.Component;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import model.City;
import model.Community;
import model.House;
/**
*
* @author gunasekhar
*/
public class AddCommunityJPanel extends javax.swing.JPanel {
/**
* Creates new form AddCommunityJPanel
*/
private JPanel displayJPanel;
private City city;
public AddCommunityJPanel(JPanel displayJPanel, City city) {
this.displayJPanel=displayJPanel;
this.city=city;
initComponents();
}
String regxCommunityName = "^[a-zA-Z\\s]+$";
String regxPopulation = "^[0-9]*$";
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
addCommunityJLabel = new javax.swing.JLabel();
communityNameJLabel = new javax.swing.JLabel();
txtcommunityname = new javax.swing.JTextField();
addJButton = new javax.swing.JButton();
backJButton = new javax.swing.JButton();
lblpopulation = new javax.swing.JLabel();
txtpopulation = new javax.swing.JTextField();
addCommunityJLabel.setFont(new java.awt.Font("Lucida Grande", 1, 18)); // NOI18N
addCommunityJLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
addCommunityJLabel.setText("Add New Community");
communityNameJLabel.setText("Community Name :");
addJButton.setText("Add");
addJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addJButtonActionPerformed(evt);
}
});
backJButton.setText("< < Back");
backJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backJButtonActionPerformed(evt);
}
});
lblpopulation.setText("Population :");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(backJButton, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(69, 69, 69)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(addCommunityJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(communityNameJLabel)
.addComponent(lblpopulation))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtpopulation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtcommunityname, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup()
.addGap(269, 269, 269)
.addComponent(addJButton)))
.addContainerGap(222, Short.MAX_VALUE))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {txtcommunityname, txtpopulation});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(51, 51, 51)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addCommunityJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(backJButton))
.addGap(67, 67, 67)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(communityNameJLabel)
.addComponent(txtcommunityname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblpopulation, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtpopulation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(13, 13, 13)
.addComponent(addJButton)
.addContainerGap(155, Short.MAX_VALUE))
);
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {txtcommunityname, txtpopulation});
}// </editor-fold>//GEN-END:initComponents
private void addJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addJButtonActionPerformed
if (txtcommunityname.getText().matches(regxCommunityName) && txtpopulation.getText().matches(regxPopulation)){
java.lang.System.out.println("Inside add button of addcommunity");
String communityName = txtcommunityname.getText();
long population = txtpopulation.getText().isEmpty()?0:Long.parseLong(txtpopulation.getText());
java.lang.System.out.println("1");
Community community = new Community(communityName, population, new ArrayList<>());
java.lang.System.out.println(community);
java.lang.System.out.println(city.getCommunities());
city.addCommunity(community);
java.lang.System.out.println("3");
JOptionPane.showMessageDialog(this, "Successfully Saved");
txtcommunityname.setText("");
txtpopulation.setText("");
}else{
JOptionPane.showMessageDialog(this, "Enter a valid details\nOnly alphabets and spaces allowed for Community Name\nOnly numbers allowed for Population");
}
}//GEN-LAST:event_addJButtonActionPerformed
private void backJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backJButtonActionPerformed
// TODO add your handling code here:
displayJPanel.remove(this);
Component[] componentArray = displayJPanel.getComponents();
Component component = componentArray[componentArray.length-1];
communityJPanel communityJPanel = (communityJPanel) component;
communityJPanel.populateTable();
CardLayout cardLayout = (CardLayout) displayJPanel.getLayout();
cardLayout.previous(displayJPanel);
}//GEN-LAST:event_backJButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel addCommunityJLabel;
private javax.swing.JButton addJButton;
private javax.swing.JButton backJButton;
private javax.swing.JLabel communityNameJLabel;
private javax.swing.JLabel lblpopulation;
private javax.swing.JTextField txtcommunityname;
private javax.swing.JTextField txtpopulation;
// End of variables declaration//GEN-END:variables
}
| [
"vinugolu.g@northeastern.edu"
] | vinugolu.g@northeastern.edu |
31df24ccee3eede63b31ad6577562b87ec8ec0e6 | 5b2928cab1404673185e81f3332e52724984c5ac | /src/main/java/com/revature/models/Pitch.java | be54cdcab185b747c959fa635c9725e750791eed | [] | no_license | DoYeunKim/SPMS | b3ae4810a5c10c769ca17663bc9a38647254250b | 651005f014e741094253f5d8488cc01478e4d8b3 | refs/heads/master | 2023-02-10T23:05:16.740124 | 2021-01-08T18:03:31 | 2021-01-08T18:03:31 | 327,941,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,476 | java | package com.revature.models;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
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.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
@Entity
@Table(name="pitch")
public class Pitch {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
@ManyToOne(fetch=FetchType.EAGER)
@JoinTable(name="author_pitch",
joinColumns=@JoinColumn(name="pitch_id"),
inverseJoinColumns=@JoinColumn(name="user_id"))
private User author;
@Column(name="title")
private String title;
@Column(name="tagline")
private String tagline;
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="type_id")
private StoryType storyType;
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="genre_id")
private Genre genre;
@Column(name="description")
private String description;
@Column(name="completion_date")
private LocalDate completionDate;
@Column(name="pitch_made_at")
private LocalDateTime pitchMadeAt;
@Column(name="pitch_arrived_at")
private LocalDateTime pitchArrivedAt;
@Transient
private Priority priority;
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="stage_id")
private PitchStage pitchStage;
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="status_id")
private ReviewStatus reviewStatus;
@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(name="pitch_add_file",
joinColumns=@JoinColumn(name="pitch_id"),
inverseJoinColumns=@JoinColumn(name="add_file_id"))
private Set<AdditionalFile> additionalFiles;
public Pitch() {
id = 0;
author = new User();
title = "";
tagline = "";
storyType = new StoryType();
genre = new Genre();
description = "";
completionDate = LocalDate.now();
pitchMadeAt = LocalDateTime.now();
pitchArrivedAt = LocalDateTime.now();
priority = Priority.NORMAL;
pitchStage = new PitchStage();
reviewStatus = new ReviewStatus();
additionalFiles = new HashSet<>();
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public User getAuthor() {
return author;
}
public void setAuthor(User author) {
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTagline() {
return tagline;
}
public void setTagline(String tagline) {
this.tagline = tagline;
}
public StoryType getStoryType() {
return storyType;
}
public void setStoryType(StoryType storyType) {
this.storyType = storyType;
}
public Genre getGenre() {
return genre;
}
public void setGenre(Genre genre) {
this.genre = genre;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public LocalDate getCompletionDate() {
return completionDate;
}
public void setCompletionDate(LocalDate completionDate) {
this.completionDate = completionDate;
}
public LocalDateTime getPitchMadeAt() {
return pitchMadeAt;
}
public void setPitchMadeAt(LocalDateTime pitchMadeAt) {
this.pitchMadeAt = pitchMadeAt;
}
public LocalDateTime getPitchArrivedAt() {
return pitchArrivedAt;
}
public void setPitchArrivedAt(LocalDateTime pitchArrivedAt) {
this.pitchArrivedAt = pitchArrivedAt;
}
public Priority getPriority() {
return priority;
}
public void setPriority(Priority priority) {
this.priority = priority;
}
public PitchStage getPitchStage() {
return pitchStage;
}
public void setPitchStage(PitchStage pitchStage) {
this.pitchStage = pitchStage;
}
public ReviewStatus getReviewStatus() {
return reviewStatus;
}
public void setReviewStatus(ReviewStatus reviewStatus) {
this.reviewStatus = reviewStatus;
}
public Set<AdditionalFile> getAdditionalFiles() {
return additionalFiles;
}
public void setAdditionalFiles(Set<AdditionalFile> additionalFiles) {
this.additionalFiles = additionalFiles;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((additionalFiles == null) ? 0 : additionalFiles.hashCode());
result = prime * result + ((author == null) ? 0 : author.hashCode());
result = prime * result + ((completionDate == null) ? 0 : completionDate.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((genre == null) ? 0 : genre.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((pitchArrivedAt == null) ? 0 : pitchArrivedAt.hashCode());
result = prime * result + ((pitchMadeAt == null) ? 0 : pitchMadeAt.hashCode());
result = prime * result + ((pitchStage == null) ? 0 : pitchStage.hashCode());
result = prime * result + ((priority == null) ? 0 : priority.hashCode());
result = prime * result + ((reviewStatus == null) ? 0 : reviewStatus.hashCode());
result = prime * result + ((storyType == null) ? 0 : storyType.hashCode());
result = prime * result + ((tagline == null) ? 0 : tagline.hashCode());
result = prime * result + ((title == null) ? 0 : title.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pitch other = (Pitch) obj;
if (additionalFiles == null) {
if (other.additionalFiles != null)
return false;
} else if (!additionalFiles.equals(other.additionalFiles))
return false;
if (author == null) {
if (other.author != null)
return false;
} else if (!author.equals(other.author))
return false;
if (completionDate == null) {
if (other.completionDate != null)
return false;
} else if (!completionDate.equals(other.completionDate))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (genre == null) {
if (other.genre != null)
return false;
} else if (!genre.equals(other.genre))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (pitchArrivedAt == null) {
if (other.pitchArrivedAt != null)
return false;
} else if (!pitchArrivedAt.equals(other.pitchArrivedAt))
return false;
if (pitchMadeAt == null) {
if (other.pitchMadeAt != null)
return false;
} else if (!pitchMadeAt.equals(other.pitchMadeAt))
return false;
if (pitchStage == null) {
if (other.pitchStage != null)
return false;
} else if (!pitchStage.equals(other.pitchStage))
return false;
if (priority != other.priority)
return false;
if (reviewStatus == null) {
if (other.reviewStatus != null)
return false;
} else if (!reviewStatus.equals(other.reviewStatus))
return false;
if (storyType == null) {
if (other.storyType != null)
return false;
} else if (!storyType.equals(other.storyType))
return false;
if (tagline == null) {
if (other.tagline != null)
return false;
} else if (!tagline.equals(other.tagline))
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
return true;
}
@Override
public String toString() {
return "Pitch [id=" + id + ", author=" + author + ", title=" + title + ", tagline=" + tagline + ", storyType="
+ storyType + ", genre=" + genre + ", description=" + description + ", completionDate=" + completionDate
+ ", pitchMadeAt=" + pitchMadeAt + ", pitchArrivedAt=" + pitchArrivedAt + ", priority=" + priority
+ ", pitchStage=" + pitchStage + ", reviewStatus=" + reviewStatus + ", additionalFiles="
+ additionalFiles + "]";
}
}
| [
"doyeunkim.vm@gmail.com"
] | doyeunkim.vm@gmail.com |
79ed657c51910a2ab1d2a43ced219015c638f725 | eb10149642e48f97ca8f11ae353d974770e4f8f0 | /baekjoon/BOJ_10157_직사각형.java | 3966e53cb64d3857348857ae41371595f287a943 | [] | no_license | ljeehwan/Algorithm | 13762fd11948e74f080d65b41bfca7019142b0fd | 6cf12f8df4050df84cb1c0c29c566f1345a955f7 | refs/heads/master | 2023-08-30T04:08:36.151370 | 2021-10-21T13:59:00 | 2021-10-21T13:59:00 | 372,665,859 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 873 | java | package day0923;
import java.util.ArrayList;
import java.util.Scanner;
public class BOJ_10157_Á÷»ç°¢Çü {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int C = sc.nextInt();
int R = sc.nextInt();
int[][]map = new int[R][C];
int K = sc.nextInt();
int []dx = {-1, 0, 1, 0};
int []dy = {0, 1, 0, -1};
int dir = 0;
map[R-1][0] = 1;
int x = R-1;
int y = 0;
int nx = 0;
int ny = 0;
int cnt = 2;
while(cnt-1 != K && K <= R*C) {
dir = dir%4;
nx = x + dx[dir];
ny = y + dy[dir];
if(nx < R && nx >= 0 && ny < C && ny >= 0 && map[nx][ny] == 0) {
map[nx][ny] = cnt;
cnt++;
x = nx;
y = ny;
}
else {
dir++;
}
}
if(cnt-1 == K) {
System.out.print((y+1) + " " + (R-x));
}
else {
System.out.println(0);
}
}
}
| [
"ljeehwan@naver.com"
] | ljeehwan@naver.com |
7523e31e50c5c07e80d82df9f754e9a26bb23313 | 3c6bf408609c09ff5abb63177b418b3e357d758a | /src/main/java/SpringCore16_Annotations_Qualifier/ClassB.java | f6f7b0da265212f4d62ed8f863dd7135c5593f4e | [] | no_license | rolando926/Spring-Core | cee19a92953b8584bc4f7ef69f2d1d3307a802f3 | fe0d26af62d711e5780a5b6aa701903b12830efb | refs/heads/master | 2021-01-18T16:09:10.910599 | 2017-04-10T17:30:13 | 2017-04-10T17:30:13 | 86,716,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package SpringCore16_Annotations_Qualifier;
/**
* Created by RXC8414 on 3/30/2017.
*/
public class ClassB {
private String strMessage;
public String getStrMessage() {
return strMessage;
}
public void setStrMessage(String strMessage) {
this.strMessage = strMessage;
}
public String identifyClass(){
return strMessage;
}
}
| [
"rolando_colon@homedepot.com"
] | rolando_colon@homedepot.com |
048230fb0443b3f12e43641b52acdbb0a9919830 | d5f5bc518bb9c1a054178101680948a31758de7b | /src/main/java/com/epam/networker/controller/TaskController.java | 60fd8d9012827311d8fa6bb1b683bb7bc81ba018 | [] | no_license | harker777/NetworkOptimizer | 290a7f7f9c8db0fe2fcbfdab1a9b3c4ee2857c73 | 15828ec344194beab94afe1dc1cf5ba6a4a1490f | refs/heads/master | 2021-01-20T06:56:52.482157 | 2013-11-12T12:47:23 | 2013-11-12T12:47:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.epam.networker.controller;
import com.epam.networker.db.entities.Task;
import com.epam.networker.db.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
/**
*
* @author Iaroslav_Mazai
*/
@Controller
public class TaskController {
@Autowired
TaskService taskService;
@RequestMapping(value = "/tasks")
public String list(Model uiModel) {
uiModel.addAttribute("tasks", taskService.findAll());
return "tasks/list";
}
@RequestMapping(value = "/tasks/{id}")
public String details(@PathVariable Integer id, Model uiModel) {
Task task = taskService.findById(id);
uiModel.addAttribute("task", task);
return "tasks/details";
}
}
| [
"harker6666@gmail.com"
] | harker6666@gmail.com |
15ad6efcf710a072b71b0bad63a8776108f2f910 | 8ced32b21f1be9511c256cb8b589d7976b4b98d6 | /alanmall-client/alanmall-mscard/src/main/java/com/itcrazy/alanmall/mscard/action/user/UserAction.java | 0b69c37efde6a13731334849f625b14ea82f3baf | [] | no_license | Yangliang266/Alanmall | e5d1e57441790a481ae5aa75aa9d091909440281 | 38c2bde86dab6fd0277c87f99bc860bfc0fbdc0a | refs/heads/master | 2023-06-13T05:01:25.747444 | 2021-07-10T12:18:58 | 2021-07-10T12:18:58 | 293,702,057 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,091 | java | package com.itcrazy.alanmall.mscard.action.user;
import org.apache.dubbo.config.annotation.Reference;
import com.itcrazy.alanmall.mscard.action.base.InterfaceBaseAction;
import com.itcrazy.alanmall.mscard.vo.user.ScopeVo;
import com.itcrazy.alanmall.mscard.vo.user.UserVo;
import com.itcrazy.alanmall.common.client.util.MD5Util;
import com.itcrazy.alanmall.merchant.manager.BrandManager;
import com.itcrazy.alanmall.merchant.manager.StoreManager;
import com.itcrazy.alanmall.merchant.model.Brand;
import com.itcrazy.alanmall.merchant.model.Store;
import com.itcrazy.alanmall.user.carddto.UserDto;
import com.itcrazy.alanmall.user.manager.RoleManager;
import com.itcrazy.alanmall.user.manager.UserManager;
import com.itcrazy.alanmall.user.manager.UserScopeManager;
import com.itcrazy.alanmall.user.model.Role;
import com.itcrazy.alanmall.user.model.RoleLevel;
import com.itcrazy.alanmall.user.model.User;
import com.itcrazy.alanmall.user.model.UserScope;
import java.util.ArrayList;
import java.util.List;
/**
* 用户管理
*
* @author DDD
*
*/
public class UserAction extends InterfaceBaseAction {
private static final long serialVersionUID = -6419368447328657417L;
private User companyUser;
private String storeIds;// 选择管理的门店
private Long userId;
private UserDto userDto;
private User detailVo;
@Reference
private UserManager userManager;
private BrandManager brandManager;
private StoreManager storeManager;
@Reference
private RoleManager roleManager;
@Reference
private UserScopeManager userScopeManager;
public String updateUser() {
if (companyUser == null) {
result.setParamErrorInfo("User");
return SUCCESS;
}
if (companyUser.getRealName() == null) {
result.setParamErrorInfo("realname");
return SUCCESS;
}
if (companyUser.getMobile() == null
|| companyUser.getMobile().length() != 11) {
result.setParamErrorInfo("手机号码");
return SUCCESS;
}
if (companyUser.getRoleId() == null) {
result.setParamErrorInfo("角色");
return SUCCESS;
}
if(companyUser.getIsAllScope()==null){
result.setParamErrorInfo("是否全部门店");
return SUCCESS;
}
if (storeIds == null) {
result.setParamErrorInfo("门店");
return SUCCESS;
}
Role r = roleManager.getRoleById(companyUser.getRoleId());
if (r == null) {
result.setParamErrorInfo("角色不存在");
return SUCCESS;
}
companyUser.setCompanyId(user.getCompanyId());
if (r.getRoleLevelId() == RoleLevel.ID_COMPANY) {// 商家角色
companyUser.setBrandId(0L);
companyUser.setStoreId(0L);
}
if (r.getRoleLevelId() == RoleLevel.ID_BRAND) {// 品牌角色,1个品牌
int n = 0;
for (String sid : storeIds.split(",")) {
Long bId = Long.valueOf(sid);
if (bId > ScopeVo.BRAND_START_ID
&& bId < ScopeVo.COMPANY_START_ID) {
n++;
if (n > 1) {
result.setResultInfo(11, "品牌组不能管理多个品牌");
return SUCCESS;
}
companyUser.setBrandId(bId - ScopeVo.BRAND_START_ID);
}
}
}
if (r.getRoleLevelId() == RoleLevel.ID_SHOP) {// 品牌角色,1个品牌
int n = 0;
for (String sid : storeIds.split(",")) {
Long bId = Long.valueOf(sid);
if (bId < ScopeVo.BRAND_START_ID && bId > 0) {
n++;
if (n > 1) {
result.setResultInfo(11, "门店角色不能管理多个门店");
return SUCCESS;
}
companyUser.setStoreId(bId);
Store s = storeManager.getStoreById(bId);
if (s == null) {
result.setResultInfo(13, "门店不存在");
return SUCCESS;
}
companyUser.setBrandId(s.getBrandId());
}
}
}
User u = userManager.getUserByLoginName(companyUser.getMobile());
if (u != null) {
if (companyUser.getId() == null
|| !companyUser.getId().equals(u.getId())) {
result.setResultInfo(1, "手机号码已经存在");
return SUCCESS;
}
}
if (companyUser.getEmail() != null
&& !"".equals(companyUser.getEmail().trim())) {
u = userManager.getUserByLoginName(companyUser.getEmail());
if (u != null) {
if (companyUser.getId() == null
|| !companyUser.getId().equals(u.getId())) {
result.setResultInfo(1, "邮箱已经存在");
return SUCCESS;
}
}
}
companyUser.setRoleLevelId(r.getRoleLevelId());
companyUser.setUpdateId(user.getId());
if (companyUser.getId() == null) {
companyUser.setCompanyId(user.getCompanyId());
companyUser.setCreateId(user.getId());
companyUser.setStatus(User.STATUS_FLAG_OK);
String pass = companyUser.getMobile().substring(5);
companyUser.setPassword(MD5Util.MD5(pass));
companyUser.setIsMemberUnlock(User.IS_FLAG_NO);
userManager.addUser(companyUser);
} else {
userManager.updateUser(companyUser);
UserScope us = new UserScope();
us.setUserId(companyUser.getId());
us.setUpdateId(user.getId());
userScopeManager.removeUserScope(us);// 删除管理的门店
}
List<UserScope> usList = new ArrayList<UserScope>();
for (String sid : storeIds.split(",")) { // 设置同样的管理门店
Long id = Long.valueOf(sid);
if (id > ScopeVo.BRAND_START_ID) {
continue;
}
UserScope us = new UserScope();
if(id < 0) {//“总部”门店id,格式:-brandId,如-44
Brand brand = brandManager.getBrandById(-id);
if(brand == null) {
continue;
}
us.setCompanyId(brand.getCompanyId());
us.setBrandId(brand.getId());
us.setStoreId(0L);//总部门店id存为0
} else {
Store s = storeManager.getStoreById(id);
if(s==null){
continue;
}
us.setBrandId(s.getBrandId());
us.setCompanyId(s.getCompanyId());
us.setStoreId(s.getId());
}
us.setCreateId(user.getId());
us.setUpdateId(user.getId());
us.setUserId(companyUser.getId());
usList.add(us);
}
userScopeManager.saveBatch(usList);
result.setSuccessInfo();
return SUCCESS;
}
public String getUserList() {
if (userDto == null) {
userDto = new UserDto();
}
//设置成缓存里面存的商户id
userDto.setCompanyId(user.getCompanyId());
//设置成缓存里面存的品牌
userDto.setBrandIds(user.getBrandIds());
pageSet(userDto);
List<User> uList = userManager.getPageList(userDto);
if (uList != null && uList.size() > 0) {
List<UserVo> cuvList = new ArrayList<UserVo>();
for (User u : uList) {
UserVo uv = new UserVo();
if (u.getBrandId() != null) {
Brand b = brandManager.getBrandById(u.getBrandId());
if (b != null) {
uv.setBrandName(b.getName());
}
}
if (u.getStoreId() != null) {
Store s = storeManager.getStoreById(u.getStoreId());
if (s != null) {
uv.setStoreName(s.getName());
}
}
uv.setEmail(u.getEmail());
uv.setId(u.getId());
uv.setMobile(u.getMobile());
uv.setRealName(u.getRealName());
uv.setStatus(u.getStatus());
uv.setIsAllScopeName(u.getIsAllScopeName());
uv.setRoleLevelId(u.getRoleLevelId());
uv.setIsMemberUnlock(u.getIsMemberUnlock());
Role r = roleManager.getRoleById(u.getRoleId());
if (r != null) {
uv.setRoleName(r.getName());
uv.setRoleLevelName(RoleLevel.getName(r.getRoleLevelId()));
}
uv.setStatusName(u.getStatusName());
if (u.getMobile() != null && u.getMobile().length() == 11) {
String password = u.getMobile().substring(5);
if (MD5Util.MD5(password).equals(u.getPassword())) {
uv.setInitPassword(password);
}
}
cuvList.add(uv);
}
pageData.rows = cuvList;
pageData.setTotal(uList.size());
}
Integer total = userManager.getPageTotal(userDto);
pageData.setTotal(total);
result.setSuccessInfo();
return SUCCESS;
}
public String getUserDetail() {
if (userId == null) {
result.setParamErrorInfo("userId");
return SUCCESS;
}
detailVo = userManager.getUserById(userId);
result.setSuccessInfo();
return SUCCESS;
}
public User getCompanyUser() {
return companyUser;
}
public void setCompanyUser(User companyUser) {
this.companyUser = companyUser;
}
public void setUserManager(UserManager userManager) {
this.userManager = userManager;
}
public void setBrandManager(BrandManager brandManager) {
this.brandManager = brandManager;
}
public void setStoreManager(StoreManager storeManager) {
this.storeManager = storeManager;
}
public void setRoleManager(RoleManager roleManager) {
this.roleManager = roleManager;
}
public void setUserDto(UserDto userDto) {
this.userDto = userDto;
}
public UserDto getUserDto() {
return userDto;
}
public void setUserScopeManager(UserScopeManager userScopeManager) {
this.userScopeManager = userScopeManager;
}
public User getDetailVo() {
return detailVo;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public void setStoreIds(String storeIds) {
this.storeIds = storeIds;
}
}
| [
"546493589@qq.com"
] | 546493589@qq.com |
470f2d75f0458a1c8f269485317a54182216bc6d | f0ef082568f43e3dbc820e2a5c9bb27fe74faa34 | /com/google/android/gms/maps/model/internal/zzb.java | 7dc19f307a2ce5819365615ff72828c2deec8e4d | [] | no_license | mzkh/Taxify | f929ea67b6ad12a9d69e84cad027b8dd6bdba587 | 5c6d0854396b46995ddd4d8b2215592c64fbaecb | refs/heads/master | 2020-12-03T05:13:40.604450 | 2017-05-20T05:19:49 | 2017-05-20T05:19:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,632 | java | package com.google.android.gms.maps.model.internal;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.internal.safeparcel.zza;
import com.google.android.gms.drive.events.CompletionEvent;
import com.google.android.gms.location.places.Place;
public class zzb implements Creator<zza> {
static void zza(zza com_google_android_gms_maps_model_internal_zza, Parcel parcel, int i) {
int zzK = com.google.android.gms.common.internal.safeparcel.zzb.zzK(parcel);
com.google.android.gms.common.internal.safeparcel.zzb.zzc(parcel, 1, com_google_android_gms_maps_model_internal_zza.getVersionCode());
com.google.android.gms.common.internal.safeparcel.zzb.zza(parcel, 2, com_google_android_gms_maps_model_internal_zza.getType());
com.google.android.gms.common.internal.safeparcel.zzb.zza(parcel, 3, com_google_android_gms_maps_model_internal_zza.zzqL(), false);
com.google.android.gms.common.internal.safeparcel.zzb.zza(parcel, 4, com_google_android_gms_maps_model_internal_zza.getBitmap(), i, false);
com.google.android.gms.common.internal.safeparcel.zzb.zzH(parcel, zzK);
}
public /* synthetic */ Object createFromParcel(Parcel x0) {
return zzeh(x0);
}
public /* synthetic */ Object[] newArray(int x0) {
return zzgk(x0);
}
public zza zzeh(Parcel parcel) {
Bitmap bitmap = null;
byte b = (byte) 0;
int zzJ = zza.zzJ(parcel);
Bundle bundle = null;
int i = 0;
while (parcel.dataPosition() < zzJ) {
int zzI = zza.zzI(parcel);
switch (zza.zzaP(zzI)) {
case CompletionEvent.STATUS_FAILURE /*1*/:
i = zza.zzg(parcel, zzI);
break;
case CompletionEvent.STATUS_CONFLICT /*2*/:
b = zza.zze(parcel, zzI);
break;
case CompletionEvent.STATUS_CANCELED /*3*/:
bundle = zza.zzq(parcel, zzI);
break;
case Place.TYPE_AQUARIUM /*4*/:
bitmap = (Bitmap) zza.zza(parcel, zzI, Bitmap.CREATOR);
break;
default:
zza.zzb(parcel, zzI);
break;
}
}
if (parcel.dataPosition() == zzJ) {
return new zza(i, b, bundle, bitmap);
}
throw new zza.zza("Overread allowed size end=" + zzJ, parcel);
}
public zza[] zzgk(int i) {
return new zza[i];
}
}
| [
"mozammil.khan@webyog.com"
] | mozammil.khan@webyog.com |
aa58443264206913dc4767511ddf0d8210046dac | 8273dedf80a0377f7168e891dcd9bbb42bba23e8 | /legacy/11g/bined-jdeveloper-extension/src/org/exbin/framework/gui/utils/panel/RemovalControlPanel.java | 77177a4a2f1d5d300adcacc6f4be6f9ec7baf16f | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | exbin/bined-jdeveloper-extension | 238d76a582ec055b96a8e266598dc363433d8587 | fe502f500f2f351d6fe4cd4d0ec5704fd7398f5b | refs/heads/master | 2021-06-25T01:53:50.862170 | 2019-08-15T07:32:04 | 2019-08-15T07:32:04 | 79,743,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,282 | java | /*
* Copyright (C) ExBin 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 org.exbin.framework.gui.utils.panel;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import org.exbin.framework.gui.utils.LanguageUtils;
import org.exbin.framework.gui.utils.OkCancelListener;
import org.exbin.framework.gui.utils.WindowUtils;
import org.exbin.framework.gui.utils.handler.RemovalControlHandler;
/**
* Basic control panel with support for removal.
*
* @version 0.2.1 2019/07/14
* @author ExBin Project (http://exbin.org)
*/
@ParametersAreNonnullByDefault
public class RemovalControlPanel extends javax.swing.JPanel implements RemovalControlHandler.RemovalControlService {
private final java.util.ResourceBundle resourceBundle;
private RemovalControlHandler handler;
private OkCancelListener okCancelListener;
public RemovalControlPanel() {
this(LanguageUtils.getResourceBundleByClass(RemovalControlPanel.class));
}
public RemovalControlPanel(java.util.ResourceBundle resourceBundle) {
this.resourceBundle = resourceBundle;
initComponents();
okCancelListener = new OkCancelListener() {
@Override
public void okEvent() {
performClick(RemovalControlHandler.ControlActionType.OK);
}
@Override
public void cancelEvent() {
performClick(RemovalControlHandler.ControlActionType.CANCEL);
}
};
}
public void setHandler(RemovalControlHandler handler) {
this.handler = handler;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
cancelButton = new javax.swing.JButton();
okButton = new javax.swing.JButton();
removeButton = new javax.swing.JButton();
cancelButton.setText(resourceBundle.getString("cancelButton.text")); // NOI18N
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelButtonActionPerformed(evt);
}
});
okButton.setText(resourceBundle.getString("okButton.text")); // NOI18N
okButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
okButtonActionPerformed(evt);
}
});
removeButton.setText(resourceBundle.getString("removeButton.text")); // NOI18N
removeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
removeButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(removeButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(okButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cancelButton)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancelButton)
.addComponent(okButton)
.addComponent(removeButton))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
if (handler != null) {
handler.controlActionPerformed(RemovalControlHandler.ControlActionType.CANCEL);
}
}//GEN-LAST:event_cancelButtonActionPerformed
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
if (handler != null) {
handler.controlActionPerformed(RemovalControlHandler.ControlActionType.OK);
}
}//GEN-LAST:event_okButtonActionPerformed
private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
if (handler != null) {
handler.controlActionPerformed(RemovalControlHandler.ControlActionType.REMOVE);
}
}//GEN-LAST:event_removeButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cancelButton;
private javax.swing.JButton okButton;
private javax.swing.JButton removeButton;
// End of variables declaration//GEN-END:variables
@Override
public void performClick(RemovalControlHandler.ControlActionType actionType) {
WindowUtils.doButtonClick(actionType == RemovalControlHandler.ControlActionType.OK ? okButton : cancelButton);
}
@Nonnull
@Override
public OkCancelListener getOkCancelListener() {
return okCancelListener;
}
@Nonnull
@Override
public RemovalControlHandler.RemovalControlEnablementListener createEnablementListener() {
return new RemovalControlHandler.RemovalControlEnablementListener() {
@Override
public void actionEnabled(RemovalControlHandler.ControlActionType actionType, boolean enablement) {
switch (actionType) {
case OK: {
okButton.setEnabled(enablement);
break;
}
case CANCEL: {
cancelButton.setEnabled(enablement);
break;
}
default:
throw new IllegalStateException("Illegal action type " + actionType.name());
}
}
};
}
}
| [
"hajdam@users.sf.net"
] | hajdam@users.sf.net |
26059d59554a324262fcd56b700505afcdf86e1f | 83b0808ca6b097d7a769f5e705185ad1bca68402 | /server/src/com/billyoyo/cardcrawl/multiplayer/events/eventtypes/powergroup/UpdatePowersEvent.java | ef730c109312d038218cab75e8192477d02e7940 | [] | no_license | billy-yoyo/SlayTheSpire-Multiplayer | 87c386f33af3dac736a875a8aeb8be66e9a41230 | bfe439bc3831dd5c94f0cc33dcd7a31def74e0a4 | refs/heads/master | 2021-05-09T16:25:33.990438 | 2018-02-02T00:43:32 | 2018-02-02T00:43:32 | 119,114,478 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | package com.billyoyo.cardcrawl.multiplayer.events.eventtypes.powergroup;
import com.billyoyo.cardcrawl.multiplayer.events.eventtypes.EventId;
import com.megacrit.cardcrawl.powers.AbstractPower;
import java.util.List;
/**
* Created by william on 27/01/2018.
*/
public class UpdatePowersEvent extends BasePowerEvent {
private List<AbstractPower> powers;
public UpdatePowersEvent(String clientId, boolean ownerIsOpponent, List<AbstractPower> powers) {
super(clientId, ownerIsOpponent, EventId.UPDATE_POWERS);
this.powers = powers;
}
public List<AbstractPower> getPowers() {
return powers;
}
}
| [
"billyoyo@hotmail.co.uk"
] | billyoyo@hotmail.co.uk |
85b85e27bc7e426877fd68a0dfdfb233401d0e9d | af820062b886c64add1dd642c6c47b2faea74758 | /exit-common/src/main/java/org/exitsoft/common/utils/ImageUtils.java | 75dd1cfa788fe36b774d7ed0814d82086baecb6f | [
"Apache-2.0"
] | permissive | JeffreyWei/exit-web-framework | 24320ee9efeafba8206f35b481a5cd45bd3d0ade | d9365a2a3b039e04f20d0153b4716fc8392ab7d5 | refs/heads/master | 2021-01-17T23:02:32.367690 | 2013-09-19T04:06:23 | 2013-09-19T04:06:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,261 | java | package org.exitsoft.common.utils;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import javax.imageio.ImageIO;
/**
* 图片工具类
*
* @author vincent
*
*/
public class ImageUtils {
/**
* 缩放图片
*
* @param input
* 图片流
* @param targetPath
* 保存文件路径
* @param width
* 宽度
* @param height
* 高度
*/
public static void scale(InputStream input, File saveFile, int width, int height) {
BufferedImage bufferedImage = null;
try {
bufferedImage = ImageIO.read(input);// 读入文件
Image image = bufferedImage.getScaledInstance(width, height,
Image.SCALE_DEFAULT);
BufferedImage tag = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB); // 缩放图像
Graphics g = tag.getGraphics();
g.drawImage(image, 0, 0, null); // 绘制缩小后的图
g.dispose();
if (!saveFile.exists()) {
saveFile.mkdirs();
}
ImageIO.write(tag, "JPEG", saveFile);// 输出到bos
tag.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"es.chenxiaobo@gmail.com"
] | es.chenxiaobo@gmail.com |
5cdafe957612f52e5400390badf34ca933e4b4d1 | 45e15c89089c5eada79be57871addaab6e40b95e | /MainActivity.java | e5908040d1c57e5d0e8bf0d142ad92eca3b52cf6 | [] | no_license | malvika468/NetworkDemo | a595e3bf68b2e91ece98a9f6b64384977e96a42e | 54c06a022d6a0c00e74602d8c60a139b5bb91c77 | refs/heads/master | 2020-07-26T06:01:00.451532 | 2016-11-15T07:22:28 | 2016-11-15T07:22:28 | 73,730,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,023 | java | package com.example.user.networkdemo;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.DropBoxManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.widget.EditText;
import android.widget.TextView;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
public class MainActivity extends AppCompatActivity {
TextView textView;
TextView textView2;
String urlText="https://www.iiitd.ac.in/about";
String contentAsString = "";
String title = "";
String desc="";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView=(TextView)findViewById(R.id.textView);
textView2=(TextView)findViewById(R.id.textView2);
if (savedInstanceState != null) {
/*When rotation occurs
*/
String state = savedInstanceState.getString("myString");
textView2.setText(state);
String state1 = savedInstanceState.getString("myString1");
textView.setText(state1);
}
}
public void download(View view)
{
String stringUrl = urlText;
ConnectivityManager connMgr = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected()) {
new LoadWebTask().execute(stringUrl);
} else {
/// textView.setText("No network connection available.");
}
}
private class LoadWebTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
// params comes from the execute() call: params[0] is the url.
try {
downloadUrl(urls[0]);
Document document = Jsoup.connect(urls[0]).get();
Log.d("Html",document.toString());
title=document.title();
Elements elements = document.select("p");
String temp=elements.text();
String sub=temp.substring(0,750);
desc=sub;
} catch (IOException e) {
}
return null;
}
// onPostExecute displays the results of the AsyncTask.
@Override
protected void onPostExecute(String result) {
textView.setText(desc);
textView2.setText(title);
}
private void downloadUrl(String myurl) throws IOException {
InputStream is = null;
// Only display the first 500 characters of the retrieved
// web page content.
int MAX = 10000;
try {
URL url = new URL(myurl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000 /* milliseconds */);
conn.setConnectTimeout(15000 /* milliseconds */);
conn.setRequestMethod("GET");
conn.setDoInput(true);
// Starts the query
conn.connect();
int response = conn.getResponseCode();
Log.d("DEBUG_TAG", "The response is: " + response);
is = conn.getInputStream();
// Convert the InputStream into a string
contentAsString = readIt(is, MAX);
Log.d("Html",contentAsString);
// Makes sure that the InputStream is closed after the app is
// finished using it.
} finally {
if (is != null) {
is.close();
}
}
}
public String readIt(InputStream stream, int MAX)
throws IOException, UnsupportedEncodingException {
Reader reader = null;
reader = new InputStreamReader(stream, "UTF-8");
char[] buffer = new char[MAX];
reader.read(buffer);
return new String(buffer);
}
}
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
savedInstanceState.putCharSequence("myString",title);
savedInstanceState.putCharSequence("myString1",desc);
}
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
title = savedInstanceState.getString("myString");
desc = savedInstanceState.getString("myString1");
}
}
| [
"malvika468@gmail.com"
] | malvika468@gmail.com |
23136a909cc61875c021f6ff3fec69c3f85ae2bd | 7e19ec3e6245a28735eb8e0c816575a374cc753f | /src/ModelDao/Modeluser.java | 9f61ffff9e6f7cfaf3095a274824d89606508108 | [] | no_license | kasilianaoliveira/FBD | 4910e3cded2242f2caf87c672f3806342bc0fc19 | 3a9c9252d6e3b468f70bbec2b61f491abca71965 | refs/heads/master | 2022-12-02T04:32:54.090178 | 2020-08-16T16:47:12 | 2020-08-16T16:47:12 | 284,560,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | 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 ModelDao;
/**
*
* @author kasil
*/
class Modeluser {
}
| [
"kasilianaoliveira@gmail.com"
] | kasilianaoliveira@gmail.com |
3cbb630589bb4c8989e200e9dfc2b945330a39f8 | cfaf4da05f566a35a0f1efa85bb77550d8465412 | /CourtCounter/app/src/main/java/com/example/android/courtcounter/MainActivity.java | 8d4b4783152117b11b6875d47b5aa44f197659fd | [
"Apache-2.0"
] | permissive | kiranmadamanchi/TestRepo | ca511d4cd698b18aeea57b1cc8789b0a5b093492 | d764cb3613f797a97cc22cbbabf710a1dee8000b | refs/heads/master | 2020-12-24T19:13:00.863463 | 2016-05-14T07:53:58 | 2016-05-14T07:53:58 | 57,434,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,003 | java | package com.example.android.courtcounter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
int scoreTeamA = 0;
int scoreTeamB = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
/**
* Displays the given score for Team A.
*/
public void displayForTeam(int score) {
TextView scoreView = (TextView) findViewById(R.id.team_a_score);
scoreView.setText(String.valueOf(score));
// displayForTeam(8);
}
public void addThreeForTeamA(View view){
// displayForTeamA(3);
scoreTeamA = scoreTeamA + 3;
displayForTeam(scoreTeamA);
}
public void addTwoForTeamA(View view){
//displayForTeamA(2);
scoreTeamA = scoreTeamA + 2;
displayForTeam(scoreTeamA);
}
public void addOneForTeamA(View view){
//displayForTeamA(1);
scoreTeamA = scoreTeamA + 1;
displayForTeam(scoreTeamA);
}
/* public void displayForTeam(int score) {
TextView scoreView = (TextView) findViewById(R.id.team_a_score);
scoreView.setText(String.valueOf(score));
displayForTeam(0);
}
*/
public void addThreeForTeamB(View view){
// displayForTeamA(3);
scoreTeamB = scoreTeamB + 3;
displayForTeam(scoreTeamB);
}
public void addTwoForTeamB(View view){
//displayForTeamA(2);
scoreTeamB = scoreTeamB + 2;
displayForTeam(scoreTeamB);
}
public void addOneForTeamB(View view){
//displayForTeamA(1);
scoreTeamB = scoreTeamB + 1;
displayForTeam(scoreTeamB);
}
public void resetScore(View v){
scoreTeamA = 0;
scoreTeamB = 0;
displayForTeam(scoreTeamA);
displayForTeam(scoreTeamB);
}
}
| [
"Madamanchi_KiranKuma@AMER.DELL.COM"
] | Madamanchi_KiranKuma@AMER.DELL.COM |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.