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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5ca1536281fe873df6b4a237e20a5e18b567d88f
|
5a431fa70b4ba5b400ee13c27bd995adacc634d5
|
/src/main/java/jp/furplag/time/Millis.java
|
af86394543695fb7322b53e2764f4d81b0ffcf32
|
[
"Apache-2.0"
] |
permissive
|
furplag/deamtiet
|
4c6608591ef7f0145cd29729080612c377cf5ff5
|
8f615ac4ad1e8acecb568140b43c072eba3b9e2f
|
refs/heads/master
| 2023-04-09T10:15:10.462744
| 2021-04-26T04:34:31
| 2021-04-26T04:34:31
| 112,684,457
| 0
| 0
|
Apache-2.0
| 2021-04-26T04:30:20
| 2017-12-01T02:19:14
|
Java
|
UTF-8
|
Java
| false
| false
| 4,174
|
java
|
/**
* Copyright (C) 2017+ furplag (https://github.com/furplag)
*
* 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 jp.furplag.time;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
/**
* code snippets of timestamp .
*
* @author furplag
*
*/
public final class Millis {
/** the millis of one day. */
public static final long ofDay = 864_000_00L;
/** the epoch astronomical julian date of 1970-01-01T00:00:00.000Z. */
public static final double epoch = 2_440_587.5d;
/** the epoch millis of -4713-11-24T12:00:00.000Z. */
public static final long epochOfJulian = -210_866_760_000_000L;
/** the epoch modified julian date of 1858-11-17T00:00:00.000Z. */
public static final double epochOfModifiedJulian = 2_400_000.5d;
/** the epoch millis of 1582-10-15T00:00:00.000Z. */
public static final long epochOfGregorian = -12_219_292_800_000L;
/**
* calculates the epoch millis from {@link Millis#epoch epoch} .
*
* @param julianDate the astronomical julian date
* @return milliseconds of that have elapsed since {@link Millis#epoch epoch}
*/
public static long ofJulian(final double julianDate) {
return Double.valueOf((julianDate - Millis.epoch) * Millis.ofDay).longValue();
}
/**
* calculates the epoch millis from {@link Millis#epoch epoch} .
*
* @param modifiedJulianDate the modified julian date from {@link Millis#epochOfModifiedJulian}
* @return the epoch millis from {@link Millis#epoch epoch}
*/
public static long ofModifiedJulian(final double modifiedJulianDate) {
return ofJulian(modifiedJulianDate + Millis.epochOfModifiedJulian);
}
/**
* substitute for {@link Instant#ofEpochMilli(long)} .
*
* @param epochMilli the epoch millis from {@link Millis#epoch epoch}
* @return an {@link Instant} represented by specified epoch milliseconds from {@link Millis#epoch epoch}
*/
public static Instant toInstant(final long epochMilli) {
return Instant.ofEpochMilli(epochMilli);
}
/**
* calculates the days that have elapsed since {@link Millis#epoch epoch} .
*
* @param epochMilli the epoch millis from {@link Millis#epoch epoch}
* @return the days that have elapsed since {@link Millis#epoch epoch}
*/
public static long toEpochDay(final long epochMilli) {
return epochMilli / Millis.ofDay;
}
/**
* calculates the seconds that have elapsed since {@link Millis#epoch epoch} .
*
* @param epochMilli the epoch millis from {@link Millis#epoch epoch}
* @return the seconds that have elapsed since {@link Millis#epoch epoch}
*/
public static long toEpochSecond(final long epochMilli) {
return epochMilli / 1000L;
}
/**
* shorthand for {@code ZonedDateTime.ofInstant(Millis.toInstant(epochMilli), ZoneId.systemDefault()).toLocalDateTime()} .
*
* @param epochMilli the epoch millis from {@link Millis#epoch epoch}
* @return {@link LocalDateTime}
*/
public static LocalDateTime toLocalDateTime(final long epochMilli) {
return Deamtiet.toLocalDateTime(toInstant(epochMilli), null);
}
/**
* shorthand for {@code ZonedDateTime.ofInstant(Millis.toInstant(epochMilli), ZoneId.systemDefault()).toLocalDateTime()} .
*
* @param epochMilli the epoch millis from {@link Millis#epoch epoch}
* @param zoneId {@link ZoneId}
* @return {@link LocalDateTime}
*/
public static LocalDateTime toLocalDateTime(final long epochMilli, final ZoneId zoneId) {
return Deamtiet.toLocalDateTime(toInstant(epochMilli), zoneId);
}
/**
* Millis instances should NOT be constructed in standard programming .
*/
private Millis() {}
}
|
[
"furplag@furplag.jp"
] |
furplag@furplag.jp
|
6f4253873212c4d1c344ddaa725b8e8d395a2911
|
4c8cdf42afd7b6a2c125e7412e6b82edfe1d7ac0
|
/app/src/androidTest/java/REST.java
|
7058d3cd92abbfa470d8ce2f9f0efde95118a455
|
[] |
no_license
|
Kjaersgaard/LegendsQuiz17
|
8ae2f5e6dd0c047a639e3fc4dad7f65ff6f059d3
|
f18e4ac8dd345dc53a8cc9cad7b3a698c367688e
|
refs/heads/master
| 2021-01-20T07:41:59.385119
| 2017-05-02T12:23:22
| 2017-05-02T12:23:22
| 90,030,535
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 68
|
java
|
/**
* Created by kjaer on 02/05/2017.
*/
public class REST {
}
|
[
"Mads Thomsen"
] |
Mads Thomsen
|
24bb0fc23f9971f70099fe78d0a5b3fee1509154
|
5fa23d60f8bce0209870a04c7d8e4f71b96dafbb
|
/database/src/main/java/org/mk/badam7/database/entity/PlayerCurrentHandCardEntity.java
|
7273b19efeed912c54ed853c579d8f01950115a5
|
[] |
no_license
|
makzmslv/badam7
|
ab3533d56f7425b78d9511eacd55f239f2846843
|
a173c33bed7505a04d450fb916c5cd8485927ea0
|
refs/heads/master
| 2021-01-01T15:55:47.032585
| 2015-09-30T12:06:14
| 2015-09-30T12:06:14
| 25,087,872
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,891
|
java
|
package org.mk.badam7.database.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "PLAYER_CURRENT_CARD")
public class PlayerCurrentHandCardEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@OneToOne
@JoinColumn(name = "REF_CARD")
private CardEntity cardEntity;
@ManyToOne
@JoinColumn(name = "REF_HAND")
private HandEntity handEntity;
@ManyToOne
@JoinColumn(name = "REF_PLAYER_CURRENT_GAME_INSTANCE")
private PlayerCurrentGameInstanceEntity playerCurrentGameInstanceEntity;
@Column(name = "STATUS")
private Integer status;
@Column(name = "CARD_REMOVAL_RANK")
private Integer cardRemovalRank;
public Integer getId()
{
return id;
}
public void setId(Integer id)
{
this.id = id;
}
public CardEntity getCardEntity()
{
return cardEntity;
}
public void setCardEntity(CardEntity cardEntity)
{
this.cardEntity = cardEntity;
}
public HandEntity getHandEntity()
{
return handEntity;
}
public void setHandEntity(HandEntity handEntity)
{
this.handEntity = handEntity;
}
public PlayerCurrentGameInstanceEntity getPlayerCurrentGameInstanceEntity()
{
return playerCurrentGameInstanceEntity;
}
public void setPlayerCurrentGameInstanceEntity(PlayerCurrentGameInstanceEntity playerCurrentGameInstanceEntity)
{
this.playerCurrentGameInstanceEntity = playerCurrentGameInstanceEntity;
}
public Integer getStatus()
{
return status;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getCardRemovalRank()
{
return cardRemovalRank;
}
public void setCardRemovalRank(Integer cardRemovalRank)
{
this.cardRemovalRank = cardRemovalRank;
}
@Override
public String toString()
{
return "PlayerCurrentCard [id=" + id + ", card=" + cardEntity + ", playerCurrentGameInstance=" + playerCurrentGameInstanceEntity + ", status=" + status + ", cardRemovalRank="
+ cardRemovalRank + "]";
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((cardEntity == null) ? 0 : cardEntity.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((playerCurrentGameInstanceEntity == null) ? 0 : playerCurrentGameInstanceEntity.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;
PlayerCurrentHandCardEntity other = (PlayerCurrentHandCardEntity) obj;
if (cardEntity == null)
{
if (other.cardEntity != null)
return false;
}
else if (!cardEntity.equals(other.cardEntity))
return false;
if (id == null)
{
if (other.id != null)
return false;
}
else if (!id.equals(other.id))
return false;
if (playerCurrentGameInstanceEntity == null)
{
if (other.playerCurrentGameInstanceEntity != null)
return false;
}
else if (!playerCurrentGameInstanceEntity.equals(other.playerCurrentGameInstanceEntity))
return false;
return true;
}
}
|
[
"makarand.salvi@neptune-int.com"
] |
makarand.salvi@neptune-int.com
|
b369e550ba34c8f0f5200be9655dd4d4a529a52d
|
28bd4a04fad92ed3d988bd92bb8a64f710aeea8f
|
/src/RemoveDuplicateNumbers.java
|
8cb1bae67c60bc72261225d3acc324a4dcc24f78
|
[] |
no_license
|
wbwmartin/OnePiece
|
d0826d0dc3e2d982c6b3f1ac428c7332089a6597
|
769599e8b0851774c25cd621289eaa2363533efb
|
refs/heads/master
| 2021-01-16T18:56:15.933101
| 2018-02-03T05:34:23
| 2018-02-03T05:34:23
| 100,130,181
| 2
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,800
|
java
|
import java.util.Stack;
//Given a string which contains only lowercase letters, remove duplicate letters so that every letter
// appear once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.
//
// Example:
// Given "bcabc"
// Return "abc"
//
// Given "cbacdcbc"
// Return "acdb"
public class RemoveDuplicateNumbers {
// http://bookshadow.com/weblog/2015/12/09/leetcode-remove-duplicate-letters/
public static String removeDuplicateLetters(String s) {
if (s == null || s.length() == 0) {
return s;
}
int[] count = new int[26];
boolean[] visited = new boolean[26];
for (int i = 1; i < s.length(); i++) {
count[s.charAt(i) - 'a']++;
}
Stack<Character> stack = new Stack<>();
stack.push(s.charAt(0));
visited[s.charAt(0) - 'a'] = true;
for (int i = 1; i < s.length(); i++) {
count[s.charAt(i) - 'a']--;
if (visited[s.charAt(i) - 'a']) { // important
continue;
}
while (!stack.empty() && stack.peek() > s.charAt(i) && count[stack.peek() - 'a'] > 0) {
visited[stack.pop() - 'a'] = false;
}
stack.push(s.charAt(i));
visited[s.charAt(i) - 'a'] = true;
}
StringBuilder sb = new StringBuilder();
while (!stack.empty()) {
sb.append(stack.pop());
}
return sb.reverse().toString();
}
public static void main(String[] args) {
String s1 = "bcabc";
String s2 = "cbacdcbc";
System.out.println(removeDuplicateLetters(s1)); // abc
System.out.println(removeDuplicateLetters(s2)); // acdb
}
}
|
[
"wangbowen1990@gmail.com"
] |
wangbowen1990@gmail.com
|
3ebd10b5df255760dd8df8cee6102cce7051fbee
|
779374d3536940ab5e815266ee801d9c1ddc4e22
|
/flare-java/src/main/java/org/nting/flare/java/StraightPathPoint.java
|
a1b606eb285b9645514991762954ae26be3bf252
|
[] |
no_license
|
zsoltborcsok/flare
|
5a34e8626836db60be20eaa7ae50a5573fa581ea
|
2a77134e2ec42bc218a358c3090eb16ea0e640f9
|
refs/heads/master
| 2022-12-25T17:14:19.078311
| 2020-10-04T11:59:26
| 2020-10-04T13:51:56
| 263,033,422
| 0
| 0
| null | 2020-10-13T21:54:31
| 2020-05-11T12:17:25
|
Java
|
UTF-8
|
Java
| false
| false
| 2,258
|
java
|
package org.nting.flare.java;
import org.nting.flare.java.maths.Mat2D;
import org.nting.flare.java.maths.Vec2D;
public class StraightPathPoint extends PathPoint {
public float radius = 0.0f;
public StraightPathPoint() {
super(PointType.straight);
}
public StraightPathPoint(Vec2D translation) {
super(PointType.straight);
_translation = translation;
}
public StraightPathPoint(Vec2D translation, float radius) {
super(PointType.straight);
_translation = translation;
this.radius = radius;
}
public StraightPathPoint(StraightPathPoint from) {
super(from);
radius = from.radius;
}
@Override
public PathPoint makeInstance() {
return new StraightPathPoint(this);
}
@Override
public int readPoint(StreamReader reader, boolean isConnectedToBones) {
radius = reader.readFloat32("radius");
if (isConnectedToBones) {
return 8;
}
return 0;
}
@Override
public PathPoint skin(Mat2D world, float[] bones) {
StraightPathPoint point = new StraightPathPoint();
point.radius = radius; // Cascade notation (..) was used
float px = world.values()[0] * translation().values()[0] + world.values()[2] * translation().values()[1]
+ world.values()[4];
float py = world.values()[1] * translation().values()[0] + world.values()[3] * translation().values()[1]
+ world.values()[5];
float a = 0.0f, b = 0.0f, c = 0.0f, d = 0.0f, e = 0.0f, f = 0.0f;
for (int i = 0; i < 4; i++) {
int boneIndex = (int) Math.floor(_weights[i]);
float weight = _weights[i + 4];
if (weight > 0) {
int bb = boneIndex * 6;
a += bones[bb] * weight;
b += bones[bb + 1] * weight;
c += bones[bb + 2] * weight;
d += bones[bb + 3] * weight;
e += bones[bb + 4] * weight;
f += bones[bb + 5] * weight;
}
}
Vec2D pos = point.translation();
pos.values()[0] = a * px + c * py + e;
pos.values()[1] = b * px + d * py + f;
return point;
}
}
|
[
"zsolt.borcsok@gmail.com"
] |
zsolt.borcsok@gmail.com
|
d6e3bce5056d962adc63f629fe1a957a7a5ab14c
|
c5f0b9a449b0e22ad87a05f2a4d7a010ed167cb3
|
/3_implementation/src/net/hudup/core/logistic/ui/JRadioList.java
|
dab784df6029b221be1c37dd399cc4e832080814
|
[
"MIT"
] |
permissive
|
sunflowersoft/hudup-ext
|
91bcd5b48d84ab33d6d8184e381d27d8f42315f7
|
cb62d5d492a82f1ecc7bc28955a52e767837afd3
|
refs/heads/master
| 2023-08-03T12:25:02.578863
| 2023-07-21T08:23:52
| 2023-07-21T08:23:52
| 131,940,602
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,699
|
java
|
/**
* HUDUP: A FRAMEWORK OF E-COMMERCIAL RECOMMENDATION ALGORITHMS
* (C) Copyright by Loc Nguyen's Academic Network
* Project homepage: hudup.locnguyen.net
* Email: ng_phloc@yahoo.com
* Phone: +84-975250362
*/
package net.hudup.core.logistic.ui;
import java.awt.GridLayout;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import net.hudup.core.Util;
import net.hudup.core.parser.TextParserUtil;
/**
* This class creates a graphic user interface (GUI) component as a list of radio buttons.
* <br>
* Modified by Loc Nguyen 2011.
*
* @author Someone on internet.
*
* @param <E> type of elements attached with radio buttons.
* @version 10.0
*/
public class JRadioList<E> extends JPanel {
/**
* Serial version UID for serializable class.
*/
private static final long serialVersionUID = 1L;
/**
* List of ratio entries. Each entry has a radio button {@link JRadioButton} and an attached object (attached element).
*/
protected List<Object[]> radioList = Util.newList();
/**
* Button group.
*/
protected ButtonGroup bg = new ButtonGroup();
/**
* Constructor with a specified list of attached object. Each object is attached with a radion button {@link JRadioButton}.
* @param listData specified list of attached object.
* @param listName name of this {@link JRadioList}.
*/
public JRadioList(List<E> listData, String listName) {
super();
setLayout(new GridLayout(0, 1));
if (listName == null || listName.isEmpty()) {
setBorder(BorderFactory.createEtchedBorder());
}
else {
setBorder(BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(), listName) );
}
setListData(listData);
}
/**
* Setting radio list with data list.
* @param listData data list.
*/
public void setListData(List<E> listData) {
for (Object[] pair : radioList) {
JRadioButton rb = (JRadioButton)pair[0];
bg.remove(rb);
remove(rb);
}
radioList.clear();
for (E e : listData) {
String text = e.toString();
JRadioButton rb = new JRadioButton(TextParserUtil.split(text, TextParserUtil.LINK_SEP, null).get(0));
bg.add(rb);
add(rb);
radioList.add(new Object[] { rb, e});
}
updateUI();
}
/**
* Getting the object attached with the selected radio button (selected item).
* @return object attached with the selected radio button (selected item).
*/
@SuppressWarnings("unchecked")
public E getSelectedItem() {
for (Object[] pair : radioList) {
JRadioButton rb = (JRadioButton)pair[0];
if (rb.isSelected())
return (E) pair[1];
}
return null;
}
}
|
[
"ngphloc@gmail.com"
] |
ngphloc@gmail.com
|
2cc7ff876b0c3621caecedd047772daac2d6590d
|
e7e497b20442a4220296dea1550091a457df5a38
|
/main_project/socialgraph/newrecommendupdator/src/main/java/com/renren/xce/socialgraph/builder/BuilderFactory.java
|
f2e98717ec678ef9f31d50f463b373fa2aab9995
|
[] |
no_license
|
gunner14/old_rr_code
|
cf17a2dedf8dfcdcf441d49139adaadc770c0eea
|
bb047dc88fa7243ded61d840af0f8bad22d68dee
|
refs/heads/master
| 2021-01-17T18:23:28.154228
| 2013-12-02T23:45:33
| 2013-12-02T23:45:33
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,736
|
java
|
package com.renren.xce.socialgraph.builder;
import com.renren.xce.socialgraph.common.DataBuilder;
import com.renren.xce.socialgraph.updator.CreateRecommendDataThread;
/**
* BuilderFactory used to create different builder by type
* @author zhangnan
* @email zhangnan@renren-inc.com
*/
public class BuilderFactory {
public static DataBuilder createBuilder(String type) {
if (type.equals(CreateRecommendDataThread.COMMON_FRIENDS)) {
return new CommonFriendsBuilder();
} else if (type.equals(CreateRecommendDataThread.FREINDS_CLUSTER)) {
return new FriendClusterBuilder();
} else if (type.equals(CreateRecommendDataThread.PAGE)) {
return new PageBuilder();
} else if (type.equals(CreateRecommendDataThread.PAGECOLLEGE)) {
return new PageCollegeBuilder();
} else if (type.equals(CreateRecommendDataThread.INFO)) {
return new SameInfoFriendsBuilder();
} else if (type.equals(CreateRecommendDataThread.RVIDEO)) {
return new VideoRecommendDataBuilder();
} else if (type.equals(CreateRecommendDataThread.RBLOG)) {
return new BlogRecommendDataBuilder();
} else if (type.equals(CreateRecommendDataThread.RSITE)) {
return new RcdSiteBuilder();
} else if (type.equals(CreateRecommendDataThread.RAPP)) {
return new AppRecommendDataBuilder();
} else if (type.equals(CreateRecommendDataThread.RFOF)) {
return new RcdFoFBuilder();
} else if (type.equals(CreateRecommendDataThread.RDESK)) {
return new DeskRecommendDataBuilder();
} else if (type.equalsIgnoreCase(CreateRecommendDataThread.RFORUM)) {
return new ForumRecommendDataBuilder();
}else if(type.equalsIgnoreCase(CreateRecommendDataThread.RSHOPMASTER)) {
return new ShoppingMasterBuilder();
}
return null;
}
}
|
[
"liyong19861014@gmail.com"
] |
liyong19861014@gmail.com
|
ec35d03700c1a1e912a714c55a28749d255902e1
|
895d8ce51b68f16966338558b5eb8ee7ac29e6b2
|
/app/src/main/java/slogup/ssing/Network/SsingClientHelper.java
|
fba672737561c14f5ed060c95ad0372106a65ddc
|
[
"MIT"
] |
permissive
|
sngsng/ssing
|
067e50aa50d7a14f977a1a577316715706b4b484
|
6acee2c391bb1eb0213ff26258bf7d47e7bd4944
|
refs/heads/master
| 2020-06-21T02:40:40.514383
| 2016-12-09T00:53:35
| 2016-12-09T00:53:35
| 74,810,304
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,549
|
java
|
package slogup.ssing.Network;
import android.content.Context;
import android.util.Log;
import com.slogup.sgcore.network.CoreError;
import com.slogup.sgcore.network.RestClient;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by sngjoong on 2016. 12. 7..
*/
public class SsingClientHelper {
private static final String LOG_TAG = SsingClientHelper.class.getSimpleName();
public static void vote(Context context, int postId, String tagName, final RestClient.RestListener listener) {
JSONObject params = new JSONObject();
try {
params.put(SsingAPIMeta.Vote.Request.POST_ID, postId);
params.put(SsingAPIMeta.Vote.Request.TAG_NAME, tagName);
} catch (JSONException e) {
e.printStackTrace();
}
RestClient restClient = new RestClient(context);
restClient.request(RestClient.Method.POST, SsingAPIMeta.Vote.URL, params, new RestClient.RestListener() {
@Override
public void onBefore() {
listener.onBefore();
}
@Override
public void onSuccess(Object response) {
Log.i(LOG_TAG, response.toString());
listener.onSuccess(response);
}
@Override
public void onFail(CoreError error) {
listener.onFail(error);
}
@Override
public void onError(CoreError error) {
listener.onError(error);
}
});
}
}
|
[
"sngsng@slogup.com"
] |
sngsng@slogup.com
|
fbd9b6d97a8c1a9e42423f8b3a6e8f59220b30ac
|
f2771bb09905bfd96d75bc8eaa10bf8a9d8767ec
|
/NewChessGame/src/newchessgame/Applet.java
|
74cb44257a425ff19c5709ed4fbd34510150be7b
|
[] |
no_license
|
jefferickso/New-Chess-Game
|
b132db67a3d44b406d55c90395a0ef4c675cc005
|
7269a6279c7773c5412d2359a7a86caf1308536f
|
refs/heads/master
| 2020-04-02T13:43:38.403183
| 2018-10-24T11:33:50
| 2018-10-24T11:33:50
| 154,494,022
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,016
|
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 newchessgame;
import java.util.logging.Logger;
import javax.swing.JApplet;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
/**
*
* @author JLErickso
*/
public class Applet extends JApplet implements GameListener{
private static final Logger LOG =
Logger.getLogger("com.nullprogram.chess.ChessApplet");
@Override
public void init() {
try {
String lnf = UIManager.getSystemLookAndFeelClassName();
UIManager.setLookAndFeel(lnf);
} catch (IllegalAccessException e) {
LOG.warning("Failed to access 'Look and Feel'");
} catch (InstantiationException e) {
LOG.warning("Failed to instantiate 'Look and Feel'");
} catch (ClassNotFoundException e) {
LOG.warning("Failed to find 'Look and Feel'");
} catch (UnsupportedLookAndFeelException e) {
LOG.warning("Failed to set 'Look and Feel'");
}
StandardBoard board = new StandardBoard();
Panel panel = new Panel(board);
add(panel);
Rules game = new Rules(board);
game.seat(panel, new Minimax(game));
game.addGameListener(this);
game.addGameListener(panel);
game.start();
}
@Override
public void gameEvent(final GameEvent e) {
if (e.getGame().isDone()) {
String message;
Piece.Side winner = e.getGame().getWinner();
if (winner == Piece.Side.WHITE) {
message = "White wins";
} else if (winner == Piece.Side.BLACK) {
message = "Black wins";
} else {
message = "Stalemate";
}
JOptionPane.showMessageDialog(null, message);
}
}
}
|
[
"jefferickso@gmail.com"
] |
jefferickso@gmail.com
|
110bc49fb88a3f3f09932af37676d224581fedc0
|
616d1fe14653c1720cfc57a8028291c9ad8dd890
|
/TPMeningerie/src/Aigle.java
|
58129ddc5a686f70c9ed3c7f8882482eba2c5196
|
[] |
no_license
|
Awonefr/TpAerosalm
|
71666e1945b700ffffcf19613c1a2950209bc705
|
af67b4ac611fdeeee00a90418b75ef6c45ac0bd6
|
refs/heads/master
| 2020-04-05T03:17:50.354139
| 2018-11-07T07:41:55
| 2018-11-07T07:41:55
| 156,509,038
| 0
| 0
| null | null | null | null |
ISO-8859-2
|
Java
| false
| false
| 1,167
|
java
|
public class Aigle {
private String nomAigle;
private int ageAigle;
private String sexeAigle;
private int numEncloAigle;
private String contenueRepas;
private String heureRepas;
public String getNom() {
return this.nomAigle;
}
public int getAge() {
return this.ageAigle;
}
public String getsexe() {
return this.sexeAigle;
}
public int getNumEnclo() {
return this.numEncloAigle;
}
public String getContenueRepas() {
return this.contenueRepas;
}
public String getHeureRepas() {
return this.heureRepas;
}
public Aigle(String unNom,int unAge,String unSexe,int unNumEnclo,String unContenueRepas,String uneheureRepas) {
this.nomAigle=unNom;
this.ageAigle=unAge;
this.sexeAigle=unSexe;
this.numEncloAigle=unNumEnclo;
this.contenueRepas=unContenueRepas;
this.heureRepas=uneheureRepas;
}
public String toString() {
String mot="nom : "+nomAigle+"\n";
mot+="age : "+ageAigle+"\n";
mot+="sexe : "+sexeAigle+"\n";
mot+="numéro de l'enclo : "+numEncloAigle+"\n";
mot+="comptenu du repoas : "+contenueRepas+"\n";
mot+="heure du repas : "+heureRepas+"\n";
return mot;
}
}
|
[
"wonealexis@hotmail.fr"
] |
wonealexis@hotmail.fr
|
e283772aac20b18c1f512ecc27a138f859e4fe11
|
705a4392a9b8e8734f37c1db3dfddffc45e15b6f
|
/sc-excle/src/test/java/com/sc/excel/test/model/ReadModel2.java
|
32c3147175894b6ee64755f7da2c0f67a3b31cb3
|
[
"Apache-2.0"
] |
permissive
|
fullshit/com-sc
|
64f473804d1bbdeacd49a248a7e90e092f0a1466
|
76b66580185fab0d595619956ae6c40f60a00633
|
refs/heads/master
| 2020-05-31T15:52:33.690141
| 2019-03-04T11:34:54
| 2019-03-04T11:34:54
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,558
|
java
|
package com.sc.excel.test.model;
import com.sc.excel.annotation.ExcelProperty;
import com.sc.excel.metadata.BaseRowModel;
import java.math.BigDecimal;
import java.util.Date;
public class ReadModel2 extends BaseRowModel {
@ExcelProperty(index = 0)
private String str;
@ExcelProperty(index = 1)
private Float ff;
@ExcelProperty(index = 2)
private Integer mm;
@ExcelProperty(index = 3)
private BigDecimal money;
@ExcelProperty(index = 4)
private Long times;
@ExcelProperty(index = 5)
private Double activityCode;
@ExcelProperty(index = 6,format = "yyyy-MM-dd")
private Date date;
@ExcelProperty(index = 7)
private String lx;
@ExcelProperty(index = 8)
private String name;
@ExcelProperty(index = 18)
private String kk;
public String getStr() {
return str;
}
public void setStr(String str) {
this.str = str;
}
public Float getFf() {
return ff;
}
public void setFf(Float ff) {
this.ff = ff;
}
public Integer getMm() {
return mm;
}
public void setMm(Integer mm) {
this.mm = mm;
}
public BigDecimal getMoney() {
return money;
}
public void setMoney(BigDecimal money) {
this.money = money;
}
public Long getTimes() {
return times;
}
public void setTimes(Long times) {
this.times = times;
}
public Double getActivityCode() {
return activityCode;
}
public void setActivityCode(Double activityCode) {
this.activityCode = activityCode;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getLx() {
return lx;
}
public void setLx(String lx) {
this.lx = lx;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getKk() {
return kk;
}
public void setKk(String kk) {
this.kk = kk;
}
@Override
public String toString() {
return "JavaModel2{" +
"str='" + str + '\'' +
", ff=" + ff +
", mm=" + mm +
", money=" + money +
", times=" + times +
", activityCode=" + activityCode +
", date=" + date +
", lx='" + lx + '\'' +
", name='" + name + '\'' +
", kk='" + kk + '\'' +
'}';
}
}
|
[
"senssic@foxmail.com"
] |
senssic@foxmail.com
|
c15ee419231e3e208efe3a173728278523255251
|
3c7e596b471259d01d30e3013efa82eb340bc9ad
|
/src/com/java/diretory/VisitAllDirsAndFiles.java
|
5ea45d4240704d0bc313172aaa9286ecac78e9e0
|
[] |
no_license
|
selenium2015/Java_Example
|
00e1b100de1a31d032b84869fae3c5747c0ec5b4
|
a70c7dd4f5b5df66d75f852650c193439f247e72
|
refs/heads/master
| 2021-01-19T03:25:18.485773
| 2016-07-27T09:09:40
| 2016-07-27T09:09:40
| 53,017,221
| 1
| 0
| null | null | null | null |
GB18030
|
Java
| false
| false
| 700
|
java
|
package com.java.diretory;
import java.io.File;
/*
* 遍历目录和目录下的文件
* 使用 File 类的 dir.isDirectory() 和 dir.list() 方法来遍历目录
*
*/
public class VisitAllDirsAndFiles {
public static void main(String[] argv) throws Exception {
System.out.println("遍历目录");
File dir = new File("E:/Appium"); // 要遍历的目录
visitAllDirsAndFiles(dir);
}
public static void visitAllDirsAndFiles(File dir) {
System.out.println(dir);
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
visitAllDirsAndFiles(new File(dir, children[i]));//递归调用
}
}
}
}
|
[
"539530998@qq.com"
] |
539530998@qq.com
|
d92b4104d51462dcc141197de76caf9fdf0b2aca
|
d68148558ff58b680a3e67383862b159a7dc908f
|
/app/src/main/java/nichele/meusgastos/SectionedRecyclerView/RecyclerViewType.java
|
5a7d062f044ce59b6560dde1d39904fca8168b87
|
[] |
no_license
|
viniciuscn/MeusGastos
|
73917cd46512dbc859f5597a3479585805173c85
|
1506d3d3fa1d7cd3d1d393283bbe7eea557f3882
|
refs/heads/master
| 2020-07-31T17:09:26.550847
| 2020-02-06T19:25:29
| 2020-02-06T19:25:29
| 210,686,499
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 125
|
java
|
package nichele.meusgastos.SectionedRecyclerView;
public enum RecyclerViewType {
LINEAR_VERTICAL,LINEAR_HORIZONTAL,GRID;
}
|
[
"viniciuscn@gmail.com"
] |
viniciuscn@gmail.com
|
07c86f5533ab4780bfb341c4aefe860312892bee
|
ccc44441e962851ac5ab4822aea924214271c810
|
/src/main/java/com/jkm/service/impl/DeleteHistoryServiceImpl.java
|
9a2a6ca6305d40e5f16333cfd3f4ed06be7e7f81
|
[] |
no_license
|
guoling1/QB_Ticket
|
5a7a17fef00b6d2e2ff21ef8ebce68af2caa6600
|
8067af1da2afc3bfb0f680455a6c9b03abfb43b0
|
refs/heads/master
| 2021-08-14T08:24:43.575998
| 2016-12-23T06:31:06
| 2016-12-23T06:31:06
| 110,777,509
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 513
|
java
|
package com.jkm.service.impl;
import com.jkm.dao.DeleteHistoryDao;
import com.jkm.service.DeleteHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by zhangbin on 2016/11/15.
*/
@Service
public class DeleteHistoryServiceImpl implements DeleteHistoryService {
@Autowired
private DeleteHistoryDao deleteHistoryDao;
@Override
public void delete(String uid) {
deleteHistoryDao.delete(uid);
}
}
|
[
"706326182@qq.com"
] |
706326182@qq.com
|
13d54e091dfc943be36e8335b7bcdb5f80c889ac
|
48c5663dcec916e795bcedec82dea8bf9c178cb7
|
/src/main/java/com/example/demo/thread/safe/ThreadSafeDoubleCheckedLazyInition.java
|
623481161482b4de4fdf58800a8e0f7778a1d232
|
[] |
no_license
|
SimonePan/java-demo
|
0ac958126897a9b7773f385270079ab58aa1bb7e
|
7f5530e81275bdc8b6abb0e688e73b7ae4e25366
|
refs/heads/master
| 2022-07-02T06:54:25.780445
| 2021-04-19T09:45:32
| 2021-04-19T09:45:32
| 193,301,023
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 598
|
java
|
package com.example.demo.thread.safe;
import com.example.demo.thread.unsafe.Sequence;
/**
* @description: 双重校验延迟初始化
* @author: Grace.Pan
* @create: 2019-12-18 19:46
*/
public class ThreadSafeDoubleCheckedLazyInition {
private static volatile Sequence sequence;
public static Sequence getSequence() {
if (sequence == null) {
synchronized (ThreadSafeDoubleCheckedLazyInition.class) {
if (sequence == null) {
sequence = new Sequence(2);
}
}
}
return sequence;
}
}
|
[
"panxumei@mockuai.com"
] |
panxumei@mockuai.com
|
4037a8857e2ab0510a7c1db293ee3cfbd250615b
|
d0521d7fcf2d67db2b3d1cf28b4627322eb71e8f
|
/ACARI - Project/src/model/TiposDespesas.java
|
db34905aedfe62412fd4ce3afac2f64c11abe570
|
[] |
no_license
|
ruan113/ACARI-APP
|
612539e952b2b60b8667d2d0672ea44d576ce356
|
49362519a6fad3a3ad634666423a72c1575ae8dc
|
refs/heads/master
| 2020-03-25T07:16:39.793600
| 2018-11-23T21:33:15
| 2018-11-23T21:33:15
| 143,551,663
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,135
|
java
|
package model;
// Generated 08/08/2018 15:24:22 by Hibernate Tools 4.3.1
import java.util.HashSet;
import java.util.Set;
/**
* TiposDespesas generated by hbm2java
*/
public class TiposDespesas implements java.io.Serializable {
private int idTipo;
private String tituloTipo;
private Set despesases = new HashSet(0);
public TiposDespesas() {
}
public TiposDespesas(int idTipo) {
this.idTipo = idTipo;
}
public TiposDespesas(int idTipo, String tituloTipo, Set despesases) {
this.idTipo = idTipo;
this.tituloTipo = tituloTipo;
this.despesases = despesases;
}
public int getIdTipo() {
return this.idTipo;
}
public void setIdTipo(int idTipo) {
this.idTipo = idTipo;
}
public String getTituloTipo() {
return this.tituloTipo;
}
public void setTituloTipo(String tituloTipo) {
this.tituloTipo = tituloTipo;
}
public Set getDespesases() {
return this.despesases;
}
public void setDespesases(Set despesases) {
this.despesases = despesases;
}
}
|
[
"ianeloi@hotmail.com"
] |
ianeloi@hotmail.com
|
696525d8bd2dc5d1f1d433220d7633c0f29d9356
|
61bfe36b403683c715b9edb4d4f5d01f03960213
|
/sources/androidx/interpolator/view/animation/LookupTableInterpolator.java
|
4763b93e42b6a8d28bf2fb194be27f7f3af4b63b
|
[] |
no_license
|
tusharkeshav/Notification_hijacker_malware
|
959ccac34dcf069b1e461bd308dac9cdfd623c85
|
33322a71bb6108b35aa036642b80264139826ed2
|
refs/heads/main
| 2023-04-07T04:40:37.072404
| 2021-04-19T12:29:53
| 2021-04-19T12:29:53
| 359,343,331
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 782
|
java
|
package androidx.interpolator.view.animation;
import android.view.animation.Interpolator;
abstract class LookupTableInterpolator implements Interpolator {
private final float mStepSize = (1.0f / ((float) (this.mValues.length - 1)));
private final float[] mValues;
protected LookupTableInterpolator(float[] fArr) {
this.mValues = fArr;
}
public float getInterpolation(float f) {
if (f >= 1.0f) {
return 1.0f;
}
if (f <= 0.0f) {
return 0.0f;
}
int min = Math.min((int) (((float) (this.mValues.length - 1)) * f), this.mValues.length - 2);
return this.mValues[min] + (((f - (((float) min) * this.mStepSize)) / this.mStepSize) * (this.mValues[min + 1] - this.mValues[min]));
}
}
|
[
"ruletushar@gmail.com"
] |
ruletushar@gmail.com
|
95a5649789a2682fe7d4271c33a4d8c1fec688fc
|
e99f78a1d7d244a8def43ca73d570f3a1b0c435f
|
/PIJReview/src/theappbusiness/priorityqueue/Student.java
|
f53b604cbff281b15612dfe8e197a719e0c8b477
|
[] |
no_license
|
BBK-PiJ-2015-10/Ongoing
|
5e153280a7772b1ec6ad5df02ec2cf8115ec272d
|
3a6099079c5413d864c8b3ec435f14660d6fad5e
|
refs/heads/master
| 2021-01-13T11:59:36.191993
| 2017-06-29T18:35:31
| 2017-06-29T18:35:31
| 77,915,552
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,211
|
java
|
package theappbusiness.priorityqueue;
public class Student implements Comparable {
private String name;
private Double gpa;
private Integer token;
public double getGpa() {
return gpa;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getToken() {
return token;
}
public void setToken(Integer token) {
this.token = token;
}
public void setGpa(Double gpa) {
this.gpa = gpa;
}
@Override
public int compareTo(Object other) {
Student otherStudent = (Student) other;
if(!this.gpa.equals(otherStudent.gpa)){
return -(this.gpa.compareTo(otherStudent.gpa));
}
else if (!this.name.equals(otherStudent.name)){
int result = this.name.compareTo(otherStudent.name);
if (result>0){
return 1;
}
else {
return -1;
}
}
else if (this.token!=otherStudent.token){
return (this.token.compareTo(otherStudent.token));
}
return 0;
}
public Student(String name, Double gpa, Integer token) {
this.gpa = gpa;
this.name = name;
this.token = token;
}
public Student(){
}
@Override
public String toString(){
return this.name + " " +this.gpa + " " + this.token;
}
}
|
[
"yasserpo@hotmail.com"
] |
yasserpo@hotmail.com
|
dfcb4e74fda6e1f0deb6305409223c5ae6dcfc31
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/6/6_5acadce2ee450a7b7b41ac8a99ffb82eeb2c7473/AgentsRepo/6_5acadce2ee450a7b7b41ac8a99ffb82eeb2c7473_AgentsRepo_t.java
|
fb37f36ba73b6fcf019d99c57895ce8c2cc1ab71
|
[] |
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
| 71,086
|
java
|
/* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* https://opensso.dev.java.net/public/CDDLv1.0.html or
* opensso/legal/CDDLv1.0.txt
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: AgentsRepo.java,v 1.28 2008-05-16 17:52:11 goodearth Exp $
*
* Copyright 2007 Sun Microsystems Inc. All Rights Reserved
*/
package com.sun.identity.idm.plugins.internal;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import java.security.AccessController;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import com.iplanet.am.util.AdminUtils;
import com.iplanet.services.comm.server.PLLServer;
import com.iplanet.services.comm.server.SendNotificationException;
import com.iplanet.services.comm.share.Notification;
import com.iplanet.services.comm.share.NotificationSet;
import com.iplanet.sso.SSOException;
import com.iplanet.sso.SSOToken;
import com.sun.identity.authentication.spi.AuthLoginException;
import com.sun.identity.authentication.spi.InvalidPasswordException;
import com.sun.identity.common.CaseInsensitiveHashMap;
import com.sun.identity.common.CaseInsensitiveHashSet;
import com.sun.identity.idm.IdConstants;
import com.sun.identity.idm.IdOperation;
import com.sun.identity.idm.IdRepo;
import com.sun.identity.idm.IdRepoBundle;
import com.sun.identity.idm.IdRepoException;
import com.sun.identity.idm.IdRepoListener;
import com.sun.identity.idm.IdRepoUnsupportedOpException;
import com.sun.identity.idm.IdType;
import com.sun.identity.idm.RepoSearchResults;
import com.sun.identity.security.AdminPasswordAction;
import com.sun.identity.security.AdminTokenAction;
import com.sun.identity.shared.debug.Debug;
import com.sun.identity.shared.encode.Hash;
import com.sun.identity.sm.DNMapper;
import com.sun.identity.sm.SMSException;
import com.sun.identity.sm.SchemaType;
import com.sun.identity.sm.ServiceConfig;
import com.sun.identity.sm.ServiceConfigManager;
import com.sun.identity.sm.ServiceListener;
import com.sun.identity.sm.ServiceSchemaManager;
import netscape.ldap.LDAPDN;
import netscape.ldap.util.DN;
public class AgentsRepo extends IdRepo implements ServiceListener {
public static final String NAME =
"com.sun.identity.idm.plugins.internal.AgentsRepo";
// Status attribute
private static final String statusAttribute =
"sunIdentityServerDeviceStatus";
private static final String statusActive = "Active";
private static final String statusInactive = "Inactive";
private static final String version = "1.0";
private static final String comma = ",";
private static final String agentserviceName = IdConstants.AGENT_SERVICE;
private static final String agentGroupNode = "agentgroup";
private static final String instancesNode = "ou=Instances,";
private static final String labeledURI = "labeledURI";
private static final String hashAlgStr = "{SHA-1}";
IdRepoListener repoListener = null;
Debug debug = Debug.getInstance("amAgentsRepo");
private String realmName;
private Map supportedOps = new HashMap();
private static ServiceSchemaManager ssm = null;
private static ServiceConfigManager scm = null;
ServiceConfig orgConfig, agentGroupConfig;
String ssmListenerId, scmListenerId;
private static String notificationURLname =
"com.sun.identity.client.notification.url";
public static final String AGENT_CONFIG_SERVICE = "agentconfig";
static final String AGENT_NOTIFICATION = "AgentConfigChangeNotification";
static final String AGENT_ID = "agentName";
static final String AGENT_IDTYPE = "IdType";
// Initialization exception
IdRepoException initializationException;
public AgentsRepo() {
SSOToken adminToken = (SSOToken) AccessController.doPrivileged(
AdminTokenAction.getInstance());
if (debug.messageEnabled()) {
debug.message(": AgentsRepo adding Listener");
}
try {
ssm = new ServiceSchemaManager(adminToken, agentserviceName,
version);
scm = new ServiceConfigManager(adminToken, agentserviceName,
version);
if (ssm != null) {
ssmListenerId = ssm.addListener(this);
}
if (scm != null) {
scmListenerId = scm.addListener(this);
}
} catch (SMSException smse) {
if (debug.warningEnabled()) {
debug.warning("AgentsRepo.AgentsRepo: "
+ "Unable to init ssm and scm due to " + smse);
}
} catch (SSOException ssoe) {
if (debug.warningEnabled()) {
debug.warning("AgentsRepo.AgentsRepo: "
+ "Unable to init ssm and scm due to " + ssoe);
}
}
loadSupportedOps();
if (debug.messageEnabled()) {
debug.message("AgentsRepo invoked");
}
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#addListener(com.iplanet.sso.SSOToken,
* com.iplanet.am.sdk.IdRepoListener)
*/
public int addListener(SSOToken token, IdRepoListener listener)
throws IdRepoException, SSOException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.addListener().");
}
// Listeners are added when AgentsRepo got invoked.
repoListener = listener;
return 0;
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#create(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.util.Map)
*/
public String create(SSOToken token, IdType type, String agentName,
Map attrMap) throws IdRepoException, SSOException {
if (agentName.startsWith("\"")) {
agentName = "\\" + agentName ;
}
if (debug.messageEnabled()) {
debug.message("AgentsRepo.create() called: " + type + ": "
+ agentName);
}
if (initializationException != null) {
debug.error("AgentsRepo.create: "
+ "Realm " + realmName + " does not exist.");
throw (initializationException);
}
if (attrMap == null || attrMap.isEmpty()) {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.create(): Attribute Map is empty ");
}
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "201", null);
}
String agentType = null;
ServiceConfig aTypeConfig = null;
if (attrMap != null && !attrMap.isEmpty()) {
if ((attrMap.keySet()).contains(IdConstants.AGENT_TYPE)) {
Set aTypeSet = (HashSet) attrMap.get(IdConstants.AGENT_TYPE);
if ((aTypeSet != null) && (!aTypeSet.isEmpty())) {
agentType = (String) aTypeSet.iterator().next();
attrMap.remove(IdConstants.AGENT_TYPE);
} else {
debug.error("AgentsRepo.create():Unable to create agents."
+ " Agent Type "+aTypeSet+ " is empty");
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "201",
null);
}
} else {
// To be backward compatible, look for 'AgentType' attribute
// in the attribute map which is passed as a parameter and if
// not present/sent, check if the IdType.AGENTONLY and then
// assume that it is '2.2_Agent' type and create that agent
// under the 2.2_Agent node.
if (type.equals(IdType.AGENTONLY)) {
agentType = "2.2_Agent";
} else {
debug.error("AgentsRepo.create():Unable to create agents."
+ " Agent Type "+agentType+ " is empty");
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "201",
null);
}
}
}
try {
Set vals = (Set) attrMap.get("userpassword");
if (vals != null) {
Set hashedVals = new HashSet();
Iterator it = vals.iterator();
while (it.hasNext()) {
String val = (String) it.next();
hashedVals.add(hashAlgStr + Hash.hash(val));
}
attrMap.remove("userpassword");
attrMap.put("userpassword", hashedVals);
}
if (type.equals(IdType.AGENTONLY) || type.equals(IdType.AGENT)) {
orgConfig = getOrgConfig(token);
aTypeConfig = orgConfig.getSubConfig(agentName);
if (aTypeConfig == null) {
orgConfig.addSubConfig(agentName, agentType, 0, attrMap);
aTypeConfig = orgConfig.getSubConfig(agentName);
} else {
// Agent already found, throw an exception
Object args[] = { agentName, type };
throw (new IdRepoException(IdRepoBundle.BUNDLE_NAME,
"224", args));
}
} else if (type.equals(IdType.AGENTGROUP)) {
agentGroupConfig = getAgentGroupConfig(token);
aTypeConfig = agentGroupConfig.getSubConfig(agentName);
if (aTypeConfig == null) {
agentGroupConfig.addSubConfig(agentName, agentType, 0,
attrMap);
aTypeConfig = agentGroupConfig.getSubConfig(agentName);
} else {
// Agent already found, throw an exception
Object args[] = { agentName, type };
throw (new IdRepoException(IdRepoBundle.BUNDLE_NAME,
"224", args));
}
}
} catch (SMSException smse) {
debug.error("AgentsRepo.create():Unable to create agents ", smse);
Object args[] = { NAME };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "226", args);
}
return (aTypeConfig.getDN());
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#delete(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String)
*/
public void delete(SSOToken token, IdType type, String name)
throws IdRepoException, SSOException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.delete() called: " + type + ": "
+ name);
}
if (initializationException != null) {
debug.error("AgentsRepo.delete: "
+ "Realm " + realmName + " does not exist.");
throw (initializationException);
}
ServiceConfig aCfg = null;
try {
if (type.equals(IdType.AGENTONLY) || type.equals(IdType.AGENT)) {
orgConfig = getOrgConfig(token);
aCfg = orgConfig.getSubConfig(name);
if (aCfg != null) {
orgConfig.removeSubConfig(name);
} else {
// Agent not found, throw an exception
Object args[] = { name, type };
throw (new IdRepoException(IdRepoBundle.BUNDLE_NAME,
"223", args));
}
} else if (type.equals(IdType.AGENTGROUP)) {
agentGroupConfig = getAgentGroupConfig(token);
aCfg = agentGroupConfig.getSubConfig(name);
if (aCfg != null) {
// AgentGroup deletion should clear the group memberships
// of the agents that belong to this group.
// Get the members that belong to this group and their
// config and set the labeledURI to an empty string.
Set members = getMembers(token, type, name,
IdType.AGENTONLY);
Iterator it = members.iterator();
ServiceConfig memberCfg = null;
while (it.hasNext()) {
String agent = (String) it.next();
memberCfg = orgConfig.getSubConfig(agent);
if (memberCfg !=null) {
memberCfg.setLabeledUri("");
}
}
agentGroupConfig.removeSubConfig(name);
} else {
// Agent not found, throw an exception
Object args[] = { name, type };
throw (new IdRepoException(IdRepoBundle.BUNDLE_NAME,
"223", args));
}
}
} catch (SMSException smse) {
debug.error("AgentsRepo.delete: Unable to delete agents ", smse);
Object args[] = { NAME };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "200", args);
}
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#getAttributes(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.util.Set)
*/
public Map getAttributes(SSOToken token, IdType type, String name,
Set attrNames) throws IdRepoException, SSOException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.getAttributes() with attrNames called: "
+ type + ": " + name);
}
if (initializationException != null) {
debug.error("AgentsRepo.getAttributes: "
+ "Realm " + realmName + " does not exist.");
throw (initializationException);
}
CaseInsensitiveHashMap allAtt = new CaseInsensitiveHashMap(
getAttributes(token, type, name));
Map resultMap = new HashMap();
Iterator it = attrNames.iterator();
while (it.hasNext()) {
String attrName = (String) it.next();
if (allAtt.containsKey(attrName)) {
resultMap.put(attrName, allAtt.get(attrName));
}
}
return resultMap;
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#getAttributes(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String)
*/
public Map getAttributes(SSOToken token, IdType type, String name)
throws IdRepoException, SSOException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.getAttributes() called: " + type + ": "
+ name);
}
if (initializationException != null) {
debug.error("AgentsRepo.getAttributes: "
+ "Realm " + realmName + " does not exist.");
throw (initializationException);
}
if (type.equals(IdType.AGENT) || type.equals(IdType.AGENTONLY) ||
type.equals(IdType.AGENTGROUP)) {
Map agentsAttrMap = new HashMap(2);
try {
if (type.equals(IdType.AGENTONLY)) {
// Return the attributes for the given agent under
// default group.
orgConfig = getOrgConfig(token);
agentsAttrMap = getAgentAttrs(orgConfig, name);
} else if (type.equals(IdType.AGENTGROUP)) {
agentGroupConfig = getAgentGroupConfig(token);
// Return the attributes of agent under specified group.
agentsAttrMap = getAgentAttrs(agentGroupConfig, name);
} else if (type.equals(IdType.AGENT)) {
// By default return the union of agents under
// default group and the agent group.
orgConfig = getOrgConfig(token);
agentsAttrMap = getAgentAttrs(orgConfig, name);
String groupName = getGroupName(orgConfig, name);
if ((groupName != null) &&
(groupName.trim().length() > 0)) {
agentGroupConfig = getAgentGroupConfig(token);
Map agentGroupMap = getAgentAttrs(agentGroupConfig,
groupName);
if ((agentsAttrMap != null) && (agentGroupMap != null)){
agentGroupMap.putAll(agentsAttrMap);
agentsAttrMap = agentGroupMap;
}
}
}
return agentsAttrMap;
} catch (SMSException e) {
debug.error("AgentsRepo.getAttributes(): Unable to read agent"
+ " attributes ", e);
Object args[] = { NAME };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "200",
args);
} catch (IdRepoException idpe) {
debug.error("AgentsRepo.getAttributes(): Unable to read agent"
+ " attributes ", idpe);
Object args[] = { NAME };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "200",
args);
}
}
Object args[] = { NAME, IdOperation.READ.getName() };
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME, "305",
args);
}
private Map getAgentAttrs(ServiceConfig svcConfig, String agentName)
throws IdRepoException, SSOException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.getAgentAttrs() called: " + agentName);
}
Map answer = new HashMap(2);
try {
// Get the agent's config and then it's attributes.
ServiceConfig aCfg = svcConfig.getSubConfig(agentName);
if (aCfg != null) {
answer = aCfg.getAttributesWithoutDefaults();
// Send the agenttype of that agent.
Set vals = new HashSet(2);
vals.add(aCfg.getSchemaID());
answer.put(IdConstants.AGENT_TYPE, vals);
}
} catch (SMSException sme) {
debug.error("AgentsRepo.getAgentAttrs(): "
+ "Error occurred while getting " + agentName, sme);
throw new IdRepoException(sme.getMessage());
}
return (answer);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#getBinaryAttributes(
* com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.util.Set)
*/
public Map getBinaryAttributes(SSOToken token, IdType type, String name,
Set attrNames) throws IdRepoException, SSOException {
Object args[] = { NAME, IdOperation.READ.getName() };
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME, "305",
args);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#setBinaryAttributes(
* com.iplanet.sso.SSOToken, com.sun.identity.idm.IdType,
* java.lang.String, java.util.Map, boolean)
*/
public void setBinaryAttributes(SSOToken token, IdType type, String name,
Map attributes, boolean isAdd) throws IdRepoException,
SSOException {
Object args[] = { NAME, IdOperation.EDIT.getName() };
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME, "305",
args);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#getMembers(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String,
* com.sun.identity.idm.IdType)
*/
public Set getMembers(SSOToken token, IdType type, String name,
IdType membersType) throws IdRepoException, SSOException {
/*
* name would be the name of the agentgroup.
* membersType would be the IdType of the agent to be retrieved.
* type would be the IdType of the agentgroup.
*/
if (debug.messageEnabled()) {
debug.message("AgentsRepo.getMembers called" + type + ": " + name
+ ": " + membersType);
}
if (initializationException != null) {
debug.error("AgentsRepo.getMembers: "
+ "Realm " + realmName + " does not exist.");
throw (initializationException);
}
Set results = new HashSet();
if (type.equals(IdType.USER) || type.equals(IdType.AGENT)) {
debug.error("AgentsRepo.getMembers: Membership operation is "
+ "not supported for Users or Agents");
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "203", null);
}
if (!membersType.equals(IdType.AGENTONLY) &&
!membersType.equals(IdType.AGENT)) {
debug.error("AgentsRepo.getMembers: Cannot get member from a "
+ "non-agent type "+ membersType.getName());
Object[] args = { NAME };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "206", args);
}
if (type.equals(IdType.AGENTGROUP)) {
try {
// Search and get the serviceconfig of the agents and get
// the value of the attribute 'labeledURI' and if the agent
// belongs to the agentgroup, add the agent/member to the
// result set.
orgConfig = getOrgConfig(token);
for (Iterator items = orgConfig.getSubConfigNames()
.iterator(); items.hasNext();) {
String agent = (String) items.next();
ServiceConfig aCfg = null;
aCfg = orgConfig.getSubConfig(agent);
if (aCfg !=null) {
String lUri = aCfg.getLabeledUri();
if ((lUri != null) && lUri.equalsIgnoreCase(name)) {
results.add(agent);
}
}
}
} catch (SMSException sme) {
debug.error("AgentsRepo.getMembers: Caught "
+ "exception while getting agents"
+ " from groups", sme);
Object args[] = { NAME, type.getName(), name };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "212",
args);
}
} else {
Object args[] = { NAME, IdOperation.READ.getName() };
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME,
"305", args);
}
return (results);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#getMemberships(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String,
* com.sun.identity.idm.IdType)
*/
public Set getMemberships(SSOToken token, IdType type, String name,
IdType membershipType) throws IdRepoException, SSOException {
/*
* name would be the name of the agent.
* membersType would be the IdType of the agentgroup to be retrieved.
* type would be the IdType of the agent.
*/
if (debug.messageEnabled()) {
debug.message("AgentsRepo.getMemberships called " + type + ": " +
name + ": " + membershipType);
}
if (initializationException != null) {
debug.error("AgentsRepo.getMemberships: "
+ "Realm " + realmName + " does not exist.");
throw (initializationException);
}
// Memberships can be returned for agents.
if (!type.equals(IdType.AGENT) && !type.equals(IdType.AGENTONLY) &&
!type.equals(IdType.AGENTGROUP)) {
debug.message(
"AgentsRepo:getMemberships supported only for agents");
Object args[] = { NAME };
throw (new IdRepoException(IdRepoBundle.BUNDLE_NAME, "225", args));
}
// Set to maintain the members
Set results = new HashSet();
if (membershipType.equals(IdType.AGENTGROUP)) {
try {
// Search and get the serviceconfig of the agent and get
// the value of the attribute 'labeledURI' and if the agent
// belongs to the agentgroup, add the agentgroup to the
// result set.
orgConfig = getOrgConfig(token);
results = getGroupNames(orgConfig, name);
} catch (SMSException sme) {
debug.error("AgentsRepo.getMemberships: Caught "
+ "exception while getting memberships"
+ " for Agent", sme);
Object args[] = { NAME, type.getName(), name };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "212",
args);
}
} else {
// throw unsupported operation exception
Object args[] = { NAME, IdOperation.READ.getName(),
membershipType.getName() };
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME,
"305", args);
}
return (results);
}
private String getGroupName(ServiceConfig orgConfig, String agentName)
throws SSOException, SMSException {
Set groups = getGroupNames(orgConfig, agentName);
return ((groups != null) && !groups.isEmpty()) ?
(String)groups.iterator().next() : null;
}
private Set getGroupNames(ServiceConfig orgConfig, String agentName)
throws SSOException, SMSException {
Set results = new HashSet(2);
ServiceConfig aCfg = orgConfig.getSubConfig(agentName);
if (aCfg !=null) {
String lUri = aCfg.getLabeledUri();
if ((lUri != null) && (lUri.length() > 0)) {
results.add(lUri);
}
}
return results;
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#getServiceAttributes(
* com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.lang.String,
* java.util.Set)
*/
public Map getServiceAttributes(SSOToken token, IdType type, String name,
String serviceName, Set attrNames) throws IdRepoException,
SSOException {
Object args[] = {NAME, IdOperation.READ.getName()};
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME, "305",
args);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#getBinaryServiceAttributes(
* com.iplanet.sso.SSOToken, com.sun.identity.idm.IdType,
* java.lang.String, java.util.Set)
*/
public Map getBinaryServiceAttributes(SSOToken token, IdType type,
String name, String serviceName, Set attrNames)
throws IdRepoException, SSOException {
Object args[] = {NAME, IdOperation.READ.getName()};
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME, "305",
args);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#isExists(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String)
*/
public boolean isExists(SSOToken token, IdType type, String name)
throws IdRepoException, SSOException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.isExists() called: " + type + ": " +
name);
}
if (initializationException != null) {
debug.error("AgentsRepo.isExists: "
+ "Realm " + realmName + " does not exist.");
throw (initializationException);
}
boolean exist = false;
Map answer = getAttributes(token, type, name);
if (answer != null && !answer.isEmpty()) {
exist = true;
}
return (exist);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#modifyMemberShip(
* com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.util.Set,
* com.sun.identity.idm.IdType, int)
*/
public void modifyMemberShip(SSOToken token, IdType type, String name,
Set members, IdType membersType, int operation)
throws IdRepoException, SSOException {
/*
* name would be the name of the agentgroup.
* members would include the name of the agents to be added/removed
* to/from the group.
* membersType would be the IdType of the agent to be added/removed.
* type would be the IdType of the agentgroup.
*/
if (debug.messageEnabled()) {
debug.message("AgentsRepo: modifyMemberShip called " + type + ": "
+ name + ": " + members + ": " + membersType);
}
if (initializationException != null) {
debug.error("AgentsRepo.modifyMemberShip: "
+ "Realm " + realmName + " does not exist.");
throw (initializationException);
}
if (members == null || members.isEmpty()) {
debug.error("AgentsRepo.modifyMemberShip: Members set is empty");
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "201", null);
}
if (type.equals(IdType.USER) || type.equals(IdType.AGENT)) {
debug.error("AgentsRepo.modifyMembership: Membership to users "
+ "and agents is not supported");
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "203", null);
}
if (!membersType.equals(IdType.AGENTONLY)) {
debug.error("AgentsRepo.modifyMembership: A non-agent type"
+ " cannot be made a member of any identity"
+ membersType.getName());
Object[] args = { NAME };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "206", args);
}
if (type.equals(IdType.AGENTGROUP)) {
try {
// Search and get the serviceconfig of the agent and set
// the 'labeledURI' with the value of the agentgroup name
// eg., 'AgentGroup1'.
// One agent instance should belong to at most one group.
orgConfig = getOrgConfig(token);
Iterator it = members.iterator();
ServiceConfig aCfg = null;
while (it.hasNext()) {
String agent = (String) it.next();
aCfg = orgConfig.getSubConfig(agent);
if (aCfg !=null) {
switch (operation) {
case ADDMEMBER:
aCfg.setLabeledUri(name);
break;
case REMOVEMEMBER:
/* NOTE:
* set " "(empty string) instead of "" to avoid
* this LDAPException(21)
* When attempting to modify entry
* to replace the set of values for attribute
* labeledURI, value "" was found to be invalid
* according to the associated syntax: The
* operation attempted to assign a zero-length
* value to an attribute with the directory
* string syntax.
*/
aCfg.setLabeledUri("");
}
}
}
} catch (SMSException sme) {
debug.error("AgentsRepo.modifyMembership: Caught "
+ "exception while " + " adding/removing agents"
+ " to groups", sme);
Object args[] = { NAME, type.getName(), name };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "212",
args);
}
} else {
// throw an exception
debug.error("AgentsRepo.modifyMembership: Memberships cannot be"
+ "modified for type= " + type.getName());
Object[] args = { NAME, type.getName() };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "209", args);
}
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#removeAttributes(
* com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.util.Set)
*/
public void removeAttributes(SSOToken token, IdType type, String name,
Set attrNames) throws IdRepoException, SSOException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.removeAttributes() called: " + type +
": " + name);
}
if (initializationException != null) {
debug.error("AgentsRepo.removeAttributes: "
+ "Realm " + realmName + " does not exist.");
throw (initializationException);
}
if (attrNames == null || attrNames.isEmpty()) {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.removeAttributes(): Attributes " +
"are empty");
}
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "201", null);
} else {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.removeAttributes(): Attribute " +
" names" + attrNames);
}
}
ServiceConfig aCfg = null;
try {
if (type.equals(IdType.AGENTONLY)) {
orgConfig = getOrgConfig(token);
aCfg = orgConfig.getSubConfig(name);
Iterator it = attrNames.iterator();
while (it.hasNext()) {
String attrName = (String) it.next();
if (aCfg != null) {
aCfg.removeAttribute(attrName);
} else {
// Agent not found, throw an exception
Object args[] = { name, type };
throw (new IdRepoException(IdRepoBundle.BUNDLE_NAME,
"223", args));
}
}
}
} catch (SMSException smse) {
debug.error("AgentsRepo.removeAttributes(): Unable to remove "
+ "agent attributes ",smse);
Object args[] = { NAME, type.getName(), name };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "212", args);
}
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#removeListener()
*/
public void removeListener() {
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#search(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, int, int,
* java.util.Set, boolean, int, java.util.Map, boolean)
*/
public RepoSearchResults search(SSOToken token, IdType type,
String pattern, int maxTime, int maxResults, Set returnAttrs,
boolean returnAllAttrs, int filterOp, Map avPairs,
boolean recursive) throws IdRepoException, SSOException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.search() called: " + type + ": " +
pattern);
}
if (initializationException != null) {
debug.error("AgentsRepo.search: "
+ "Realm " + realmName + " does not exist.");
throw (initializationException);
}
Set agentRes = new HashSet(2);
Map agentAttrs = new HashMap();
int errorCode = RepoSearchResults.SUCCESS;
ServiceConfig aCfg = null;
try {
if (type.equals(IdType.AGENTONLY)) {
// Get the config from 'default' group.
orgConfig = getOrgConfig(token);
if (isAgentTypeSearch(orgConfig, pattern)) {
agentRes.add(pattern);
} else {
aCfg = orgConfig;
agentRes = getAgentPattern(aCfg, pattern, avPairs);
}
} else if (type.equals(IdType.AGENTGROUP)) {
// Get the config from specified group.
agentGroupConfig = getAgentGroupConfig(token);
if (isAgentTypeSearch(agentGroupConfig, pattern)) {
agentRes.add(pattern);
} else {
aCfg = agentGroupConfig;
agentRes = getAgentPattern(aCfg, pattern, avPairs);
}
} else if (type.equals(IdType.AGENT)) {
agentRes.add(pattern);
}
if (agentRes != null && (!agentRes.isEmpty())) {
Iterator it = agentRes.iterator();
while (it.hasNext()) {
String agName = (String) it.next();
Map attrsMap = getAttributes(token, type, agName);
if (attrsMap != null && !attrsMap.isEmpty()) {
agentAttrs.put(agName, attrsMap);
} else {
return new RepoSearchResults(new HashSet(),
RepoSearchResults.SUCCESS, Collections.EMPTY_MAP,
type);
}
}
}
} catch (SSOException sse) {
debug.error("AgentsRepo.search(): Unable to retrieve entries: ",
sse);
Object args[] = { NAME };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "219", args);
}
return new RepoSearchResults(agentRes, errorCode, agentAttrs, type);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#search(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.util.Map,
* boolean, int, int, java.util.Set)
*/
public RepoSearchResults search(SSOToken token, IdType type,
String pattern, Map avPairs, boolean recursive, int maxResults,
int maxTime, Set returnAttrs) throws IdRepoException, SSOException {
return (search(token, type, pattern, maxTime, maxResults, returnAttrs,
(returnAttrs == null), OR_MOD, avPairs, recursive));
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#setAttributes(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.util.Map,
* boolean)
*/
public void setAttributes(SSOToken token, IdType type, String name,
Map attributes, boolean isAdd)
throws IdRepoException, SSOException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.setAttributes() called: " + type + ": "
+ name);
}
if (initializationException != null) {
debug.error("AgentsRepo.setAttributes: "
+ "Realm " + realmName + " does not exist.");
throw (initializationException);
}
if (attributes == null || attributes.isEmpty()) {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.setAttributes(): Attributes " +
"are empty");
}
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "201", null);
}
ServiceConfig aCfg = null;
try {
if (type.equals(IdType.AGENTONLY)) {
orgConfig = getOrgConfig(token);
aCfg = orgConfig.getSubConfig(name);
} else if (type.equals(IdType.AGENTGROUP)) {
agentGroupConfig = getAgentGroupConfig(token);
aCfg = agentGroupConfig.getSubConfig(name);
} else {
Object args[] = { NAME, IdOperation.READ.getName() };
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME,
"305", args);
}
Set vals = (Set) attributes.get("userpassword");
if (vals != null) {
Set hashedVals = new HashSet();
Iterator it = vals.iterator();
while (it.hasNext()) {
String val = (String) it.next();
if (!val.startsWith(hashAlgStr)) {
hashedVals.add(hashAlgStr + Hash.hash(val));
attributes.remove("userpassword");
attributes.put("userpassword", hashedVals);
}
}
}
if (aCfg != null) {
aCfg.setAttributes(attributes);
} else {
// Agent not found, throw an exception
Object args[] = { name, type };
throw (new IdRepoException(IdRepoBundle.BUNDLE_NAME,
"223", args));
}
} catch (SMSException smse) {
debug.error("AgentsRepo.setAttributes(): Unable to set agent"
+ " attributes ",smse);
Object args[] = { NAME, type.getName(), name };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "212", args);
}
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#getSupportedOperations(
* com.sun.identity.idm.IdType)
*/
public Set getSupportedOperations(IdType type) {
return (Set) supportedOps.get(type);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#getSupportedTypes()
*/
public Set getSupportedTypes() {
return supportedOps.keySet();
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#initialize(java.util.Map)
*/
public void initialize(Map configParams) {
super.initialize(configParams);
// Initialize with the realm name
Set realms = (Set) configParams.get("agentsRepoRealmName");
if ((realms != null) && !realms.isEmpty()) {
realmName = DNMapper.orgNameToDN((String) realms.iterator().next());
// Initalize ServiceConfig with realm names
SSOToken adminToken = (SSOToken) AccessController.doPrivileged(
AdminTokenAction.getInstance());
if (getOrgConfig(adminToken) == null) {
debug.error("AgentsRepo.getAgentGroupConfig: "
+ "Realm " + realmName + " does not exist.");
String slashRealmName;
slashRealmName = DNMapper.orgNameToRealmName(realmName);
Object[] args = { slashRealmName };
initializationException =
new IdRepoException(IdRepoBundle.BUNDLE_NAME, "312", args);
}
getAgentGroupConfig(adminToken);
}
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#isActive(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String)
*/
public boolean isActive(SSOToken token, IdType type, String name)
throws IdRepoException, SSOException {
Map attributes = getAttributes(token, type, name);
if (attributes == null) {
Object[] args = { NAME, name };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "202", args);
}
Set activeVals = (Set) attributes.get(statusAttribute);
if (activeVals == null || activeVals.isEmpty()) {
return true;
} else {
Iterator it = activeVals.iterator();
String active = (String) it.next();
return (active.equalsIgnoreCase(statusActive) ? true : false);
}
}
/* (non-Javadoc)
* @see com.sun.identity.idm.IdRepo#setActiveStatus(
com.iplanet.sso.SSOToken, com.sun.identity.idm.IdType,
java.lang.String, boolean)
*/
public void setActiveStatus(SSOToken token, IdType type,
String name, boolean active)
throws IdRepoException, SSOException {
Map attrs = new HashMap();
Set vals = new HashSet(2);
if (active) {
vals.add(statusActive);
} else {
vals.add(statusInactive);
}
attrs.put(statusAttribute, vals);
setAttributes(token, type, name, attrs, false);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#shutdown()
*/
public void shutdown() {
scm.removeListener(scmListenerId);
ssm.removeListener(ssmListenerId);
}
private void loadSupportedOps() {
Set opSet = new HashSet(2);
opSet.add(IdOperation.EDIT);
opSet.add(IdOperation.READ);
opSet.add(IdOperation.CREATE);
opSet.add(IdOperation.DELETE);
Set opSet2 = new HashSet(opSet);
opSet2.remove(IdOperation.EDIT);
opSet2.remove(IdOperation.CREATE);
opSet2.remove(IdOperation.DELETE);
supportedOps.put(IdType.AGENTONLY, Collections.unmodifiableSet(
opSet));
supportedOps.put(IdType.AGENTGROUP, Collections.unmodifiableSet(
opSet));
supportedOps.put(IdType.AGENT, Collections.unmodifiableSet(opSet2));
if (debug.messageEnabled()) {
debug.message("AgentsRepo.loadSupportedOps() called: "
+ "supportedOps Map = " + supportedOps);
}
}
// The following three methods implement ServiceListener interface
/*
* (non-Javadoc)
*
* @see com.sun.identity.sm.ServiceListener#globalConfigChanged(
* java.lang.String,
* java.lang.String, java.lang.String, java.lang.String, int)
*/
public void globalConfigChanged(String serviceName, String version,
String groupName, String serviceComponent, int type) {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.globalConfigChanged..");
}
IdType idType;
if (groupName.equalsIgnoreCase("default")) {
idType = IdType.AGENTONLY;
} else {
idType = IdType.AGENTGROUP;
}
String name =
serviceComponent.substring(serviceComponent.indexOf('/') + 1);
// If notification URLs are present, send notifications
sendNotificationSet(type, idType, name);
if (repoListener != null) {
repoListener.objectChanged(name, type,
repoListener.getConfigMap());
}
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.sm.ServiceListener#organizationConfigChanged(
* java.lang.String,
* java.lang.String, java.lang.String, java.lang.String,
* java.lang.String, int)
*/
public void organizationConfigChanged(String serviceName, String version,
String orgName, String groupName, String serviceComponent, int type)
{
if (debug.messageEnabled()) {
debug.message("AgentsRepo.organizationConfigChanged..");
}
// Process notification only if realm name matches
if (orgName.equalsIgnoreCase(realmName)) {
IdType idType;
if (groupName.equalsIgnoreCase("default")) {
idType = IdType.AGENTONLY;
} else {
idType = IdType.AGENTGROUP;
}
String name =
serviceComponent.substring(serviceComponent.indexOf('/') + 1);
// If notification URLs are present, send notifications
sendNotificationSet(type, idType, name);
if (repoListener != null) {
repoListener.objectChanged(name, type,
repoListener.getConfigMap());
}
}
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.sm.ServiceListener#schemaChanged(java.lang.String,
* java.lang.String)
*/
public void schemaChanged(String serviceName, String version) {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.schemaChanged..");
}
if (repoListener != null) {
repoListener.allObjectsChanged();
}
}
public String getFullyQualifiedName(SSOToken token, IdType type,
String name) throws IdRepoException, SSOException {
RepoSearchResults results = search(token, type, name, null, true, 0, 0,
null);
Set dns = results.getSearchResults();
if (dns.size() != 1) {
String[] args = { name };
throw (new IdRepoException(IdRepoBundle.BUNDLE_NAME, "220", args));
}
return ("sms://AgentsRepo/" + dns.iterator().next().toString());
}
public boolean supportsAuthentication() {
return (true);
}
public boolean authenticate(Callback[] credentials)
throws IdRepoException, AuthLoginException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.authenticate() called");
}
// Obtain user name and password from credentials and compare
// with the ones from the agent profile to authorize the agent.
String username = null;
String password = null;
for (int i = 0; i < credentials.length; i++) {
if (credentials[i] instanceof NameCallback) {
username = ((NameCallback) credentials[i]).getName();
if (debug.messageEnabled()) {
debug.message("AgentsRepo.authenticate() username: "
+ username);
}
} else if (credentials[i] instanceof PasswordCallback) {
char[] passwd = ((PasswordCallback) credentials[i])
.getPassword();
if (passwd != null) {
password = new String(passwd);
password = hashAlgStr + Hash.hash(password);
if (debug.messageEnabled()) {
debug.message("AgentsRepo.authenticate() passwd "
+ "present");
}
}
}
}
if (username == null || (username.length() == 0) ||
password == null) {
Object args[] = { NAME };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, "221", args);
}
SSOToken adminToken = (SSOToken) AccessController.doPrivileged(
AdminTokenAction.getInstance());
boolean answer = false;
String userid = username;
try {
/* Only agents with IdType.AGENTONLY is used for authentication,
* not the agents with IdType.AGENTGROUP.
* AGENTGROUP is for storing common properties.
*/
if (DN.isDN(username)) {
userid = LDAPDN.explodeDN(username, true)[0];
}
Set pSet = new HashSet(2);
pSet.add("userpassword");
Map ansMap = new HashMap();
String userPwd = null;
ansMap = getAttributes(adminToken, IdType.AGENTONLY,
userid, pSet);
Set userPwdSet = (Set) ansMap.get("userpassword");
if ((userPwdSet != null) && (!userPwdSet.isEmpty())) {
userPwd = (String) userPwdSet.iterator().next();
if (!(answer = password.equals(userPwd))) {
throw (new InvalidPasswordException("invalid password",
userid));
}
}
if (debug.messageEnabled()) {
debug.message("AgentsRepo.authenticate() result: " + answer);
}
} catch (SSOException ssoe) {
if (debug.warningEnabled()) {
debug.warning("AgentsRepo.authenticate(): "
+ "Unable to authenticate SSOException:" + ssoe);
}
}
return (answer);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#modifyService(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.lang.String,
* com.sun.identity.sm.SchemaType, java.util.Map)
*/
public void modifyService(SSOToken token, IdType type, String name,
String serviceName, SchemaType sType, Map attrMap)
throws IdRepoException, SSOException {
Object args[] = { NAME, IdOperation.SERVICE.getName() };
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME, "305",
args);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#unassignService(
* com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.lang.String,
* java.util.Map)
*/
public void unassignService(SSOToken token, IdType type, String name,
String serviceName, Map attrMap) throws IdRepoException,
SSOException {
Object args[] = {
"com.sun.identity.idm.plugins.specialusers.SpecialRepo",
IdOperation.SERVICE.getName() };
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME, "305",
args);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#assignService(com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.lang.String,
* com.sun.identity.sm.SchemaType, java.util.Map)
*/
public void assignService(SSOToken token, IdType type, String name,
String serviceName, SchemaType stype, Map attrMap)
throws IdRepoException, SSOException {
Object args[] = { NAME, IdOperation.SERVICE.getName() };
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME, "305",
args);
}
/*
* (non-Javadoc)
*
* @see com.sun.identity.idm.IdRepo#getAssignedServices(
* com.iplanet.sso.SSOToken,
* com.sun.identity.idm.IdType, java.lang.String, java.util.Map)
*/
public Set getAssignedServices(SSOToken token, IdType type, String name,
Map mapOfServicesAndOCs) throws IdRepoException, SSOException {
Object args[] = { NAME, IdOperation.SERVICE.getName() };
throw new IdRepoUnsupportedOpException(IdRepoBundle.BUNDLE_NAME, "305",
args);
}
private ServiceConfig getOrgConfig(SSOToken token) {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.getOrgConfig() called. ");
}
try {
if (orgConfig == null) {
if (scm == null) {
scm = new ServiceConfigManager(token, agentserviceName,
version);
}
orgConfig = scm.getOrganizationConfig(realmName, null);
}
} catch (SMSException smse) {
if (debug.warningEnabled()) {
debug.warning("AgentsRepo.getOrgConfig(): "
+ "Unable to init ssm and scm due to " + smse);
}
} catch (SSOException ssoe) {
if (debug.warningEnabled()) {
debug.warning("AgentsRepo.getOrgConfig(): "
+ "Unable to init ssm and scm due to " + ssoe);
}
}
return (orgConfig);
}
private ServiceConfig getAgentGroupConfig(SSOToken token) {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.getAgentGroupConfig() called. ");
}
try {
if (agentGroupConfig == null) {
if (scm == null) {
scm = new ServiceConfigManager(token, agentserviceName,
version);
}
String agentGroupDN = constructDN(agentGroupNode,
instancesNode, realmName, version, agentserviceName);
ServiceConfig orgConfig = getOrgConfig(token);
if (orgConfig != null) {
orgConfig.checkAndCreateGroup(agentGroupDN,
agentGroupNode);
agentGroupConfig =
scm.getOrganizationConfig(realmName, agentGroupNode);
}
}
} catch (SMSException smse) {
if (debug.warningEnabled()) {
debug.warning("AgentsRepo.getAgentGroupConfig: "
+ "Unable to init ssm and scm due to " + smse);
}
} catch (SSOException ssoe) {
if (debug.warningEnabled()) {
debug.warning("AgentsRepo.getAgentGroupConfig: "
+ "Unable to init ssm and scm due to " + ssoe);
}
}
return (agentGroupConfig);
}
private boolean isAgentTypeSearch(ServiceConfig aConfig, String pattern)
throws IdRepoException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.isAgentTypeSearch() called: " + pattern);
}
String agentType = null;
boolean agentTypeflg = false;
try {
// Get the agentType and then compare the pattern sent for Search.
for (Iterator items = aConfig.getSubConfigNames()
.iterator(); items.hasNext();) {
agentType = (String) items.next();
if (agentType.equalsIgnoreCase(pattern)) {
agentTypeflg = true;
break;
}
}
} catch (SMSException sme) {
debug.error("AgentsRepo.isAgentTypeSearch(): Error occurred while "
+ "checking AgentType sent for pattern "+ pattern, sme);
throw new IdRepoException(sme.getMessage());
}
return (agentTypeflg);
}
private Set getAgentPattern(ServiceConfig aConfig, String pattern,
Map avPairs)
throws IdRepoException {
if (debug.messageEnabled()) {
debug.message("AgentsRepo.getAgentPattern() called: " + pattern);
}
Set agentRes = new HashSet(2);
try {
if (aConfig != null) {
// Support search through avpairs.. just for AgentType.
if (pattern.equals("*") && avPairs != null
&& !avPairs.isEmpty()) {
Set atypeVals = (Set) avPairs.get(IdConstants.AGENT_TYPE);
if (atypeVals != null && !atypeVals.isEmpty()) {
pattern = (String) atypeVals.iterator().next();
} else {
return (agentRes);
}
}
// If wild card is used for pattern, do a search else a lookup
if (pattern.indexOf('*') != -1) {
agentRes = aConfig.getSubConfigNames(pattern);
} else {
for (Iterator items = aConfig.getSubConfigNames()
.iterator(); items.hasNext();) {
String name = (String) items.next();
if (name.equalsIgnoreCase(pattern)) {
agentRes.add(pattern);
break;
} else {
// if pattern is AgentType, look for the AgentType
// value in the profile and compare. If they are
// the same, add that Agent that belongs to that
// AgentType.
Map attrMap = getAgentAttrs(aConfig, name);
if (attrMap != null && !attrMap.isEmpty()) {
Set aSet = (HashSet) attrMap.get(
IdConstants.AGENT_TYPE);
if ((aSet != null) && (!aSet.isEmpty()) &&
((String) aSet.iterator().next()).
equalsIgnoreCase(pattern)) {
agentRes.add(name);
}
}
}
}
}
}
} catch (SSOException sse) {
debug.error("AgentsRepo.getAgentPattern(): Error occurred while "
+ "checking AgentName sent for pattern "+ pattern, sse);
throw new IdRepoException(sse.getMessage());
} catch (SMSException sme) {
debug.error("AgentsRepo.getAgentPattern(): Error occurred while "
+ "checking AgentName sent for pattern "+ pattern, sme);
throw new IdRepoException(sme.getMessage());
}
return (agentRes);
}
String constructDN(String groupName, String configName, String orgName,
String version, String serviceName) throws SMSException {
StringBuffer sb = new StringBuffer(50);
sb.append("ou=").append(groupName).append(comma).append(
configName).append("ou=").append(version)
.append(comma).append("ou=").append(serviceName)
.append(comma).append("ou=services").append(comma);
orgName = DNMapper.orgNameToDN(orgName);
sb.append(orgName);
return (sb.toString());
}
// If notification URLs are present, send notifications to clients/agents.
private void sendNotificationSet(int type,
IdType agentIdTypeforNotificationSet,
String agentNameforNotificationSet) {
switch (type) {
case MODIFIED:
if (agentIdTypeforNotificationSet == null) {
break;
}
try {
String modItem = null;
Set aNameSet = new HashSet(2);
SSOToken adminToken =
(SSOToken) AccessController.doPrivileged(
AdminTokenAction.getInstance());
if (debug.messageEnabled()) {
debug.message("AgentsRepo.sendNotificationSet():" +
" agentIdTypeforNotificationSet " +
agentIdTypeforNotificationSet);
debug.message("AgentsRepo.sendNotificationSet():" +
" agentNameforNotificationSet " +
agentNameforNotificationSet);
}
// This checks if the changes happened to an agentgroup. If
// so,it gets all its members/agents and sends notifications
// to all its members.
if (agentIdTypeforNotificationSet.equals(IdType.AGENTGROUP)) {
Set members =
getMembers(adminToken, agentIdTypeforNotificationSet,
agentNameforNotificationSet, IdType.AGENTONLY);
Iterator it = members.iterator();
while (it.hasNext()) {
String agent = (String) it.next();
aNameSet.add(agent);
}
} else {
aNameSet.add(agentNameforNotificationSet);
}
if (debug.messageEnabled()) {
debug.message("AgentsRepo.sendNotificationSet():" +
" aNameSet " + aNameSet);
}
if ((aNameSet != null) && (!aNameSet.isEmpty())) {
Iterator itr = aNameSet.iterator();
while (itr.hasNext()) {
agentNameforNotificationSet = (String) itr.next();
agentIdTypeforNotificationSet = IdType.AGENTONLY;
// To be consistent and for easy web agent parsing,
// the notification set should start with
// "AgentConfigChangeNotification"
StringBuffer xmlsb = new StringBuffer(1000);
xmlsb.append("<")
.append(AGENT_NOTIFICATION)
.append(" ")
.append(AGENT_ID)
.append("=\"")
.append(agentNameforNotificationSet)
.append("\"")
.append(" ")
.append(AGENT_IDTYPE)
.append("=\"")
.append(agentIdTypeforNotificationSet.getName())
.append("\"/>");
modItem = xmlsb.toString();
if (debug.messageEnabled()) {
debug.message("AgentsRepo.sendNotificationSet():" +
" modItem " + modItem);
}
// If notification URLs are present,send notifications
Set nSet = new HashSet(2);
nSet.add(notificationURLname);
Map ansMap = new HashMap();
String nval = null;
ansMap = getAttributes(adminToken,
agentIdTypeforNotificationSet,
agentNameforNotificationSet, nSet);
Set nvalSet = (Set) ansMap.get(notificationURLname);
if ((nvalSet != null) && (!nvalSet.isEmpty())) {
nval = (String) nvalSet.iterator().next();
try {
URL url = new URL(nval);
// Construct NotificationSet to be sent to
// Agents.
Notification notification =
new Notification(modItem);
NotificationSet ns =
new NotificationSet(AGENT_CONFIG_SERVICE);
ns.addNotification(notification);
try {
PLLServer.send(url, ns);
if (debug.messageEnabled()) {
debug.message("AgentsRepo:"
+ "sendNotificationSet "
+ "Sent Notification to "
+ "URL: " + url + " Data: " + ns);
}
} catch (SendNotificationException ne) {
if (debug.warningEnabled()) {
debug.warning("AgentsRepo."
+ "sendNotificationSet: failed"
+ " sending notification to: "
+ url, ne);
}
}
} catch (MalformedURLException e) {
if (debug.warningEnabled()) {
debug.warning("AgentsRepo."
+ "sendNotificationSet:(): "
+ " invalid URL: " , e);
}
}
}
}
}
} catch (IdRepoException idpe) {
debug.error("AgentsRepo.sendNotificationSet(): "
+ "Unable to send notification due to " + idpe);
} catch (SSOException ssoe) {
if (debug.warningEnabled()) {
debug.warning("AgentsRepo.sendNotificationSet(): "
+ "Unable to send notification due to " + ssoe);
}
}
}
}
}
|
[
"yuzhongxing88@gmail.com"
] |
yuzhongxing88@gmail.com
|
cbcf98c1d4c81507ea40095820bae6a9b7d353bb
|
17a23b6e1f37ed70ed4896abdacac1cc004b4221
|
/jlight-web/src/main/java/com/lew/jlight/web/exception/handler/GlobalExceptionHandler.java
|
35f16f7c48ddf5481341d09c64dd1b2c426fd3a0
|
[
"Apache-2.0"
] |
permissive
|
HulkHou/Jlight
|
28457f92b8bad508272d1d25def1d4a05de37811
|
cbd67e4c0ab62d5e33a4f414b29d4b005b0174cf
|
refs/heads/master
| 2021-01-11T20:19:42.850387
| 2017-05-02T02:21:53
| 2017-05-02T02:21:53
| 79,090,926
| 3
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,442
|
java
|
package com.lew.jlight.web.exception.handler;
import com.lew.jlight.core.Response;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice()
public class GlobalExceptionHandler {
@ExceptionHandler(RuntimeException.class)
@ResponseBody
public Response exceptionHandler(RuntimeException e) {
Response resp = new Response();
resp.setCode(1);
String errorMsg = e.getMessage();
if(errorMsg.indexOf(":")>-1){
errorMsg = errorMsg.split(":")[1];
}
resp.setMsg(errorMsg);
return resp;
}
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return (container -> {
ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");
ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html");
container.addErrorPages(error401Page, error404Page, error500Page);
});
}
}
|
[
"houxiang86@gmail.com"
] |
houxiang86@gmail.com
|
9fbbdcb81985c3dc61e41c5e5fa1a0e7531687fa
|
12c0e200d81fcaa44757e35d922543a29f520374
|
/CrawlerExample/src/imagecrawler/ImageCrawlController.java
|
6c7e71f9c51283290def48bf880b394ad8f22579
|
[] |
no_license
|
tumaolin94/my_backup
|
77234b7129bed79c26c0bfcc6326e82238403489
|
4ac92f94ebb76c2aefb388e8366c44ef7654b1de
|
refs/heads/master
| 2020-03-28T04:50:53.800844
| 2018-09-06T22:27:24
| 2018-09-06T22:27:24
| 147,740,422
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,787
|
java
|
package imagecrawler;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.uci.ics.crawler4j.crawler.CrawlConfig;
import edu.uci.ics.crawler4j.crawler.CrawlController;
import edu.uci.ics.crawler4j.fetcher.PageFetcher;
import edu.uci.ics.crawler4j.robotstxt.RobotstxtConfig;
import edu.uci.ics.crawler4j.robotstxt.RobotstxtServer;
/**
* @author Yasser Ganjisaffar
*/
public class ImageCrawlController {
private static final Logger logger = LoggerFactory.getLogger(ImageCrawlController.class);
public static void main(String[] args) throws Exception {
// if (args.length < 3) {
// logger.info("Needed parameters: ");
// logger.info("\t rootFolder (it will contain intermediate crawl data)");
// logger.info("\t numberOfCrawlers (number of concurrent threads)");
// logger.info("\t storageFolder (a folder for storing downloaded images)");
// return;
// }
String rootFolder = "crawl/image";
int numberOfCrawlers = 5;
String storageFolder = "crawl/image/storage";
CrawlConfig config = new CrawlConfig();
config.setCrawlStorageFolder(rootFolder);
/*
* Since images are binary content, we need to set this parameter to
* true to make sure they are included in the crawl.
*/
config.setIncludeBinaryContentInCrawling(true);
String[] crawlDomains = {"https://uci.edu/"};
PageFetcher pageFetcher = new PageFetcher(config);
RobotstxtConfig robotstxtConfig = new RobotstxtConfig();
RobotstxtServer robotstxtServer = new RobotstxtServer(robotstxtConfig, pageFetcher);
CrawlController controller = new CrawlController(config, pageFetcher, robotstxtServer);
for (String domain : crawlDomains) {
controller.addSeed(domain);
}
ImageCrawler.configure(crawlDomains, storageFolder);
controller.start(ImageCrawler.class, numberOfCrawlers);
}
}
|
[
"524561223@qq.com"
] |
524561223@qq.com
|
f297428bb995099158799aed7454725bec0a90b2
|
13c371fffd8c0ecd5e735755e7337a093ac00e30
|
/com/planet_ink/coffee_mud/Abilities/Spells/Spell_DemonGate.java
|
492f4f12368fa5c28fe51b555f1f30233bf88925
|
[
"Apache-2.0"
] |
permissive
|
z3ndrag0n/CoffeeMud
|
e6b0c58953e47eb58544039b0781e4071a016372
|
50df765daee37765e76a1632a04c03f8a96d8f40
|
refs/heads/master
| 2020-09-15T10:27:26.511725
| 2019-11-18T15:41:42
| 2019-11-18T15:41:42
| 223,416,916
| 1
| 0
|
Apache-2.0
| 2019-11-22T14:09:54
| 2019-11-22T14:09:53
| null |
UTF-8
|
Java
| false
| false
| 7,889
|
java
|
package com.planet_ink.coffee_mud.Abilities.Spells;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2002-2019 Bo Zimmerman
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.
*/
public class Spell_DemonGate extends Spell
{
@Override
public String ID()
{
return "Spell_DemonGate";
}
private final static String localizedName = CMLib.lang().L("Demon Gate");
@Override
public String name()
{
return localizedName;
}
private final static String localizedStaticDisplay = CMLib.lang().L("(Demon Gate)");
@Override
public String displayText()
{
return localizedStaticDisplay;
}
@Override
public int abstractQuality()
{
return Ability.QUALITY_BENEFICIAL_SELF;
}
@Override
public int enchantQuality()
{
return Ability.QUALITY_INDIFFERENT;
}
@Override
protected int canAffectCode()
{
return CAN_MOBS;
}
@Override
protected int canTargetCode()
{
return 0;
}
@Override
protected int overrideMana()
{
return 100;
}
@Override
public int classificationCode()
{
return Ability.ACODE_SPELL|Ability.DOMAIN_CONJURATION;
}
@Override
public long flags()
{
return Ability.FLAG_SUMMONING;
}
protected MOB myTarget=null;
@Override
public boolean tick(final Tickable ticking, final int tickID)
{
if(tickID==Tickable.TICKID_MOB)
{
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if(myTarget==null)
myTarget=mob.getVictim();
else
if(myTarget!=mob.getVictim())
unInvoke();
}
}
return super.tick(ticking,tickID);
}
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker()))
&&(msg.sourceMinor()==CMMsg.TYP_QUIT))
{
unInvoke();
if(msg.source().playerStats()!=null)
msg.source().playerStats().setLastUpdated(0);
}
}
@Override
public void unInvoke()
{
final MOB mob=(MOB)affected;
super.unInvoke();
if((canBeUninvoked())&&(mob!=null))
{
final Room R=mob.location();
if(R!=null)
{
if(mob.amFollowing()!=null)
R.showOthers(mob,mob.amFollowing(),CMMsg.MSG_OK_ACTION,L("^F^<FIGHT^><S-NAME> uses the fight to wrest itself from out of <T-YOUPOSS> control!^?%0DTo <T-YOUPOSS> great relief, it disappears back into its home plane.^</FIGHT^>^?"));
else
R.showOthers(mob,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> disappears back into its home plane."));
}
if(mob.amDead())
mob.setLocation(null);
mob.destroy();
}
}
@Override
public boolean invoke(final MOB mob, final List<String> commands, final Physical givenTarget, final boolean auto, final int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
invoker=mob;
final CMMsg msg=CMClass.getMsg(mob,null,this,verbalCastCode(mob,null,auto),auto?"":L("^S<S-NAME> open(s) the gates of the abyss, incanting angrily.^?"));
if(mob.location().okMessage(mob,msg))
{
mob.location().send(mob,msg);
final MOB otherMonster=mob.location().fetchInhabitant("the great demonbeast$");
final MOB myMonster = determineMonster(mob, mob.phyStats().level()+(getXLEVELLevel(mob)+(2*getX1Level(mob))));
if(otherMonster!=null)
{
myMonster.location().showOthers(myMonster,mob,CMMsg.MSG_OK_ACTION,L("^F^<FIGHT^><S-NAME> wrests itself from out of <T-YOUPOSS> control!^</FIGHT^>^?"));
myMonster.setVictim(otherMonster);
}
else
if(CMLib.dice().rollPercentage()<10)
{
myMonster.location().showOthers(myMonster,mob,CMMsg.MSG_OK_ACTION,L("^F^<FIGHT^><S-NAME> wrests itself from out of <T-YOUPOSS> control!^</FIGHT^>^?"));
myMonster.setVictim(mob);
}
else
{
myMonster.setVictim(mob.getVictim());
CMLib.commands().postFollow(myMonster,mob,true);
if(myMonster.amFollowing()!=mob)
mob.tell(L("@x1 seems unwilling to follow you.",myMonster.name()));
}
invoker=mob;
beneficialAffect(mob,myMonster,asLevel,0);
}
}
else
return beneficialWordsFizzle(mob,null,L("<S-NAME> attempt(s) to open the gates of the abyss, but fail(s)."));
// return whether it worked
return success;
}
public MOB determineMonster(final MOB caster, final int level)
{
final MOB newMOB=CMClass.getMOB("GenRideable");
final Rideable ride=(Rideable)newMOB;
newMOB.basePhyStats().setAbility(22 + super.getXLEVELLevel(caster));
newMOB.basePhyStats().setLevel(level+ 2 + super.getXLEVELLevel(caster));
CMLib.factions().setAlignment(newMOB,Faction.Align.EVIL);
newMOB.basePhyStats().setWeight(850);
newMOB.basePhyStats().setRejuv(PhyStats.NO_REJUV);
newMOB.baseCharStats().setStat(CharStats.STAT_STRENGTH,18);
newMOB.baseCharStats().setStat(CharStats.STAT_DEXTERITY,18);
newMOB.baseCharStats().setStat(CharStats.STAT_CONSTITUTION,18);
newMOB.baseCharStats().setMyRace(CMClass.getRace("Demon"));
newMOB.baseCharStats().getMyRace().startRacing(newMOB,false);
newMOB.baseCharStats().setStat(CharStats.STAT_GENDER,'M');
newMOB.recoverPhyStats();
newMOB.recoverCharStats();
newMOB.basePhyStats().setArmor(CMLib.leveler().getLevelMOBArmor(newMOB));
newMOB.basePhyStats().setAttackAdjustment(CMLib.leveler().getLevelAttack(newMOB));
newMOB.basePhyStats().setDamage(CMLib.leveler().getLevelMOBDamage(newMOB));
newMOB.basePhyStats().setSpeed(CMLib.leveler().getLevelMOBSpeed(newMOB));
newMOB.setName(L("the great demonbeast"));
newMOB.setDisplayText(L("a horrendous demonbeast is stalking around here"));
newMOB.setDescription(L("Blood red skin with massive horns, and of course muscles in places you didn`t know existed."));
newMOB.addNonUninvokableEffect(CMClass.getAbility("Prop_ModExperience"));
ride.setRiderCapacity(2);
newMOB.recoverCharStats();
newMOB.recoverPhyStats();
newMOB.recoverMaxState();
newMOB.resetToMaxState();
newMOB.text();
newMOB.bringToLife(caster.location(),true);
CMLib.beanCounter().clearZeroMoney(newMOB,null);
newMOB.setMoneyVariation(0);
newMOB.location().showOthers(newMOB,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> tears through the fabric of reality and steps into this world!"));
caster.location().recoverRoomStats();
newMOB.setStartRoom(null);
return(newMOB);
}
}
|
[
"bo@zimmers.net"
] |
bo@zimmers.net
|
4422522fa3a12e66badaf40d7b745ccfaece600f
|
130f321a23dee784274f861c352ae2bf19cf4aeb
|
/src/number/MultipleWords.java
|
ff6afc4e2575a1390aef471ab05894ad4c9cc230
|
[] |
no_license
|
venerakadyr/Java_Project_B14
|
ef2da72c7f25b56639ce253f1a8d1ebd8a07f17e
|
f4c90b6e53ee07c3a71c8104016abbf800c398e2
|
refs/heads/master
| 2022-09-17T20:05:51.176889
| 2020-05-27T19:52:22
| 2020-05-27T19:52:22
| 220,682,456
| 0
| 0
| null | 2020-05-27T19:52:23
| 2019-11-09T18:03:12
|
Java
|
UTF-8
|
Java
| false
| false
| 697
|
java
|
package number;
public class MultipleWords {
public static void main(String[] args) {
// 9) Given a String of: "knife", "wooden spoons", "plates", "cups",
// "forks", "pan", "pot", "trash can”, “fridge”, “dish washer”
//Go through the array and print the value if there is multiple words.
String [] words = {"knife", "wooden spoons", " plates", "cups", "forks", "pan", "pot", "trash can", "fridge", "dish washer"};
for(int i=0; i < words.length; i++) {
if(words[i].trim().contains(" ")) {
// trim() takes care of spaces before or after the words
System.out.println(words[i]);
}
}
}
}
|
[
"57569728+venerakadyr@users.noreply.github.com"
] |
57569728+venerakadyr@users.noreply.github.com
|
b868b3c4611f4663a46625bce575c8d01ed9dfa5
|
1cfdd8cad18976c3b81b703b96a67c6f7fc67882
|
/oriented_object_model_practise/Ming_to_eat/src/main/java/com/ayl/gupao/version_1/preparemeal/PrepareMealFactory.java
|
27323f37a4e0459382a979b359aaa0442193a0d0
|
[] |
no_license
|
brucewin6688/gupao-homework
|
a557ccb0383373ed0579946a14ee1b3d6dfc0482
|
dee0de3cccecebeef22ed9b03c6bfa5aaf783b1e
|
refs/heads/master
| 2020-04-19T05:08:23.907761
| 2018-04-14T17:49:59
| 2018-04-14T17:49:59
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 211
|
java
|
package com.ayl.gupao.version_1.preparemeal;
import com.ayl.gupao.version_1.entity.Meal;
/**
* @author AYL 2018/4/7 16:12
*/
public interface PrepareMealFactory {
Meal prepareMeal(String...dishes);
}
|
[
"445465143@qq.com"
] |
445465143@qq.com
|
46aca9f1699d83e16a670adbad00318f2b4a5008
|
fb444d7cbeecdb22f5a5735f2ba4bf6ad71b95c6
|
/app.backend/src/main/java/de/jdynameta/jdy/spring/app/config/RestResponseEntityExceptionHandler.java
|
5b02b06c40ae736f0818f865186933689ceedac3
|
[] |
no_license
|
schnurlei/jdy
|
006cad4a79f59c2175d27b5429aeb5a238d314c9
|
8c96bdc7c7530010e67fea357971ef4bac88d221
|
refs/heads/master
| 2020-03-28T17:24:49.343694
| 2019-09-13T13:44:07
| 2019-09-13T13:44:07
| 148,785,336
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,693
|
java
|
package de.jdynameta.jdy.spring.app.config;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.TransactionSystemException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import javax.validation.ConstraintViolationException;
import java.sql.SQLException;
import java.time.LocalDateTime;
@RestControllerAdvice
public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler {
private static final Logger LOG = LoggerFactory.getLogger(RestResponseEntityExceptionHandler.class);
@ExceptionHandler(value = { ConstraintViolationException.class})
public ResponseEntity<Object> handleConstraintViolationException(final ConstraintViolationException ex, final WebRequest request) {
LOG.error("Exception handled by RestResponseEntityExceptionHandler", ex);
final CustomErrorResponse response = new CustomErrorResponse("SQLException", ex.getLocalizedMessage());
return this.handleExceptionInternal(ex, response,
new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
}
@ExceptionHandler(value = { TransactionSystemException.class })
public ResponseEntity<Object> handleTransactionSystemException(final TransactionSystemException ex, final WebRequest request) {
LOG.error("Exception handled by RestResponseEntityExceptionHandler", ex);
final CustomErrorResponse response = new CustomErrorResponse("TransactionSystemException", ex.getMostSpecificCause().getLocalizedMessage());
return this.handleExceptionInternal(ex, response,
new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
}
@ExceptionHandler(value = { SQLException.class })
public ResponseEntity<Object> handleSQLException(final SQLException ex, final WebRequest request) {
LOG.error("Exception handled by RestResponseEntityExceptionHandler", ex);
final CustomErrorResponse response = new CustomErrorResponse("SQLException", ex.getLocalizedMessage());
return this.handleExceptionInternal(ex, response,
new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request); }
@ExceptionHandler(value = { DataIntegrityViolationException.class })
public ResponseEntity<Object> handleDataIntegrityViolationException(final DataIntegrityViolationException ex, final WebRequest request) {
LOG.error("Exception handled by RestResponseEntityExceptionHandler", ex);
final CustomErrorResponse response = new CustomErrorResponse("DataIntegrityViolationException", ex.getMostSpecificCause().getLocalizedMessage());
return this.handleExceptionInternal(ex, response,
new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
}
public static class CustomErrorResponse {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss")
private final LocalDateTime timestamp;
private final String error;
private final String message;
public CustomErrorResponse(final String error, final String message) {
this.timestamp = LocalDateTime.now();
this.error = error;
this.message = message;
}
public LocalDateTime getTimestamp() {
return this.timestamp;
}
public String getError() {
return this.error;
}
public String getMessage() {
return this.message;
}
}
}
|
[
"rainer.schneider@exxcellent.de"
] |
rainer.schneider@exxcellent.de
|
f0f265d814220729ca9da3111831363c8db5b925
|
b7b86e6bb117aca44e357845a4381b1aee856567
|
/src/test/java/com/example/demo/controllers/UserControllerTest.java
|
b34eb13e29c7349b80546f7459ebdad839be34a3
|
[] |
no_license
|
tapsteri/udacity_ecommerce
|
3ca074a68f0722d2bcaa88e3a5887043fbc6690d
|
e2f07a284764e638ee7ae6df2ec9829fc6f1e420
|
refs/heads/master
| 2022-12-25T23:40:03.482200
| 2020-10-06T17:36:13
| 2020-10-06T17:36:13
| 300,966,826
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,009
|
java
|
package com.example.demo.controllers;
import com.example.demo.TestUtils;
import com.example.demo.model.persistence.User;
import com.example.demo.model.persistence.repositories.CartRepository;
import com.example.demo.model.persistence.repositories.UserRepository;
import com.example.demo.model.requests.CreateUserRequest;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import java.util.Optional;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class UserControllerTest {
private UserController userController;
private UserRepository userRepo = mock(UserRepository.class);
private CartRepository cartRepo = mock(CartRepository.class);
private BCryptPasswordEncoder encoder = mock(BCryptPasswordEncoder.class);
private CreateUserRequest r;
private User user;
@Before
public void setUp() {
userController = new UserController();
TestUtils.injectObjects(userController, "userRepository", userRepo);
TestUtils.injectObjects(userController, "cartRepository", cartRepo);
TestUtils.injectObjects(userController, "bCryptPasswordEncoder", encoder);
when(encoder.encode("testPassword")).thenReturn("thisIsHashed");
r = new CreateUserRequest();
r.setUsername("test");
r.setPassword("testPassword");
r.setConfirmPassword("testPassword");
user = new User();
user.setId(0L);
user.setUsername("Rob");
user.setPassword("testPassword");
when(userRepo.findByUsername("Rob")).thenReturn(user);
when(userRepo.findById(0L)).thenReturn(Optional.of(user));
}
@Test
public void create_user_happy_path() throws Exception {
final ResponseEntity<User> response = userController.createUser(r);
assertNotNull(response);
assertEquals(200, response.getStatusCodeValue());
User u = response.getBody();
assertNotNull(u);
assertEquals(0, u.getId());
assertEquals("test", u.getUsername());
assertEquals("thisIsHashed",u.getPassword());
}
@Test
public void create_user_passwords_not_match() throws Exception {
r.setConfirmPassword("notMatchPassword");
final ResponseEntity<User> response = userController.createUser(r);
assertNotNull(response);
assertEquals(400, response.getStatusCodeValue());
}
@Test
public void get_user_by_name_happy_path() throws Exception {
final ResponseEntity<User> response = userController.findByUserName("Rob");
assertNotNull(response);
assertEquals(200, response.getStatusCodeValue());
User u = response.getBody();
assertNotNull(u);
assertEquals(0, u.getId());
assertEquals("Rob", u.getUsername());
assertEquals("testPassword",u.getPassword());
}
@Test
public void get_user_by_name_not_found() throws Exception {
final ResponseEntity<User> response = userController.findByUserName("John");
assertNotNull(response);
assertEquals(404, response.getStatusCodeValue());
}
@Test
public void get_user_by_id_happy_path() throws Exception {
final ResponseEntity<User> response = userController.findById(0L);
assertNotNull(response);
assertEquals(200, response.getStatusCodeValue());
User u = response.getBody();
assertNotNull(u);
assertEquals(0, u.getId());
assertEquals("Rob", u.getUsername());
assertEquals("testPassword",u.getPassword());
}
@Test
public void get_user_by_id_not_found() throws Exception {
final ResponseEntity<User> response = userController.findById(1L);
assertNotNull(response);
assertEquals(404, response.getStatusCodeValue());
}
}
|
[
""
] | |
ef44d91d99ed46e553fa2c73f9d49711eeffa6cb
|
7af90676a3109ec9ac67046a1fa45deb1f1b108f
|
/WN/src/main/java/cn/powerun/springBoot/controller/SpotsController.java
|
92255bf822c7f8b77b4c8dfc1aeb8f43a2b6e1df
|
[] |
no_license
|
MarkXv/project-java
|
4cd3d30d2fcc21ace887aedb19f6206d9f215aef
|
693a9ea7ce39e377a22228160541fc69bf62d917
|
refs/heads/master
| 2022-12-24T18:15:11.359042
| 2019-08-27T14:12:34
| 2019-08-27T14:12:34
| 142,419,561
| 1
| 0
| null | 2022-12-16T04:54:32
| 2018-07-26T09:30:45
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 4,422
|
java
|
package cn.powerun.springBoot.controller;
import cn.powerun.springBoot.pojo.spot.Category;
import cn.powerun.springBoot.pojo.spot.Spots;
import cn.powerun.springBoot.service.CategoryService;
import cn.powerun.springBoot.service.SpotsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* Created by Administrator on 2017/10/20.
*/
@Controller
@RequestMapping("/backend/spots")
public class SpotsController {
@Autowired
private SpotsService spotsService;
@Autowired
private CategoryService categoryService;
/**
* 请求查看景点管理首页
*
* @return
*/
@RequestMapping("/index")
public String tospots(Model model) {
List<Spots> spotsList = spotsService.findAll();
List<Category> categoryList = categoryService.findAll();
model.addAttribute("spotsList", spotsList);
model.addAttribute("categoryList",categoryList);
return "pages/backend/main/manage/spots/spotsframe";
}
/**
* 请求查看页面
*
* @return
*/
@RequestMapping("/view")
public String tospotsview(Model model, String spotsId) {
Spots spots = spotsService.findSpotsById(spotsId);
model.addAttribute("spots", spots);
return "pages/backend/main/manage/spots/baseOP/spotsview";
}
/**
* 修改状态为禁用状态
*
* @param spotsIds
* @return
*/
@RequestMapping("/stop")
public String toStop(@RequestParam("spotsId") String[] spotsIds) {
Integer state = 0;
//测试
/*String[] spotsIds = {"1"};*/
System.out.println(spotsIds);
spotsService.updateState(spotsIds, state);
return "redirect:/backend/spots/index";
}
/**
* 修改状态为启用状态
*
* @param spotsIds
* @return
*/
@RequestMapping("/start")
public String toStart(@RequestParam("spotsId") String[] spotsIds) {
//测试
/*String spotsId = "200";*/
Integer state = 1;
spotsService.updateState(spotsIds, state);
return "redirect:/backend/spots/index";
}
/**
* 请求景点添加界面
*
* @return
*/
@RequestMapping("/add")
public String tospotsAdd(Model model) {
List<Category> categoryList = categoryService.findAll();
/* for (Category c : categoryList) {
System.out.println(c);
}*/
model.addAttribute("categoryList", categoryList);
return "/pages/backend/main/manage/spots/baseOP/spotsadd";
}
//保存景点信息
@RequestMapping("/save")
public String saveSpots(Spots spots/*, String imgurls*/) {
spotsService.saveSpots(spots);
//重定向到景点主页面
return "redirect:/backend/spots/index";
}
/*@RequestMapping("")*/
/**
* 请求修改页面
*/
@RequestMapping("/update")
public String tospotsupdate(Model model, String spotsId) {
List<Category> categoryList = categoryService.findAll();
Spots spots = spotsService.findSpotsById(spotsId);
model.addAttribute("categoryList", categoryList);
model.addAttribute("spots", spots);
return "pages/backend/main/manage/spots/baseOP/spotsupdate";
}
//修改景点信息
@RequestMapping("/updatespots")
public String updateSpots(Spots spots, String imgurls) {
spotsService.updateSpots(spots);
//重定向到景点主页面
return "redirect:/backend/spots/index";
}
//删除景点信息
@RequestMapping("/delete")
public String deleteSpots(@RequestParam("spotsId")String[] spotsIds, String imgurls) {
spotsService.deleteSpots(spotsIds);
//重定向到景点主页面
return "redirect:/backend/spots/index";
}
/**
* 请求景点-类别页面
*
* @return
*/
/* @RequestMapping("/spotscategory")
public String tospotscategory(Model model,String spotsId) throws JsonProcessingException {
List<Category> categoryList = categoryService.findCategoryBySpotsId(spotsId);
return "pages/backend/main/manage/spots/spots_category";
}*/
}
|
[
"markxvg@gmail.com"
] |
markxvg@gmail.com
|
ca9503dfaf6b51a2aa617eec73ac42af438c6fad
|
06af424c0f31d8ba32d315b77feeca1dbfbeff8a
|
/ProyectoBasesI/ProyectoBasesI/src/proyectobasesi/empleado.java
|
ebb5475976cfdb4f35bb6d4d427f9cf580e70641
|
[] |
no_license
|
RASanchezB/ProyectoBasesI
|
f224c324dc06d86f1f89a68b1b254dbfcce20961
|
f01ca6ad0de23071a312c6d3257259ef3c4ad85c
|
refs/heads/master
| 2020-03-29T11:17:40.627515
| 2018-09-25T19:49:33
| 2018-09-25T19:49:33
| 149,844,839
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 977
|
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 proyectobasesi;
public class empleado {
int dni;
String emp_afiliacion;
String contraseña;
public empleado(int dni, String emp_afiliacion, String contraseña) {
this.dni = dni;
this.emp_afiliacion = emp_afiliacion;
this.contraseña = contraseña;
}
public int getDni() {
return dni;
}
public void setDni(int dni) {
this.dni = dni;
}
public String getEmp_afiliacion() {
return emp_afiliacion;
}
public void setEmp_afiliacion(String emp_afiliacion) {
this.emp_afiliacion = emp_afiliacion;
}
public String getContraseña() {
return contraseña;
}
public void setContraseña(String contraseña) {
this.contraseña = contraseña;
}
}
|
[
"dam_900@unitec.edu"
] |
dam_900@unitec.edu
|
252adedc0186f3799eb25894b4df06a1e3a11998
|
54210520db4839c898942faaa7b94606443ff9d9
|
/src/test/java/com/cybertek/tests/day10_sync/ExplicitWaitExample.java
|
2f9761ea841ee5cd9347f6921c878b6c704ea3e8
|
[] |
no_license
|
davutbilgic/EU2TestNGProject-dvt
|
df208dd5b0210b5f6b2be471fee6e8f1d95e6e22
|
5d12371ab8c4f2256ec0eb38b4458e732dec03f9
|
refs/heads/master
| 2023-05-28T20:59:30.356194
| 2020-05-27T19:51:18
| 2020-05-27T19:51:18
| 265,970,810
| 0
| 0
| null | 2023-05-09T18:50:44
| 2020-05-21T23:11:08
|
Java
|
UTF-8
|
Java
| false
| false
| 1,888
|
java
|
package com.cybertek.tests.day10_sync;
import com.cybertek.utilities.WebDriverFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class ExplicitWaitExample {
WebDriver driver;
@BeforeMethod
public void setUpMethod(){
driver = WebDriverFactory.getDriver("chrome");
}
@AfterMethod
public void afterMethod() throws InterruptedException {
Thread.sleep(2000);
driver.quit();
}
@Test
public void test1(){
driver.get("http://practice.cybertekschool.com/dynamic_loading/1");
//click start button
driver.findElement(By.tagName("button")).click();
//locate username inputbox
WebElement usernameInputbox = driver.findElement(By.id("username"));
//HOW TO WAIT EXPLICITLY ?
//Create Explicit wait object
WebDriverWait wait = new WebDriverWait(driver,10);
//calling until method from wait object
wait.until(ExpectedConditions.visibilityOf(usernameInputbox));
usernameInputbox.sendKeys("MikeSmith");
}
@Test
public void test2(){
driver.get("http://practice.cybertekschool.com/dynamic_controls");
//click enable
driver.findElement(By.xpath("//button[.='Enable']")).click();
//finding inputbox
WebElement inputbox = driver.findElement(By.xpath("(//input)[2]"));
//wait until element is clickable
WebDriverWait wait = new WebDriverWait(driver,10);
wait.until(ExpectedConditions.elementToBeClickable(inputbox));
inputbox.sendKeys("MikeSmith");
}
}
|
[
"db.davutbilgic@gmail.com"
] |
db.davutbilgic@gmail.com
|
3a4a0fa765a652240c2671704c528e5f8df610f5
|
3f9f0c655ff0bf4b94f583f3301bb96984f5d5f3
|
/src/ar/com/xeven/Servicio.java
|
1c99aa051dbc3fe5b83cf0f0d13c4168f2530858
|
[] |
no_license
|
pabloacvd/CRMVentas
|
ffd88a38e5fb1ce49e5b44702aa76ab658ddbe8f
|
02e69d785c75ad64413c8b126292de1c264253a7
|
refs/heads/master
| 2023-04-18T05:26:33.663639
| 2021-04-30T01:04:12
| 2021-04-30T01:04:12
| 342,886,154
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 287
|
java
|
package ar.com.xeven;
public class Servicio implements Item{
@Override
public double getPrecio() {
return 0;
}
@Override
public String getNombre() {
return null;
}
@Override
public String getDescripcion() {
return null;
}
}
|
[
"pablo@xeven.com.ar"
] |
pablo@xeven.com.ar
|
9be3b3383b8feabceb72af783c87315611ad6126
|
2b1648f0c86cdddf164a32a956d9115f5978ca7f
|
/src/engine/AdditionEvaluator.java
|
d5518d0ccfeacb6af6c2cb04b99ef953c561f90c
|
[] |
no_license
|
konsto/mol
|
546ce4dfed38be8a96d207c235feac17f5c3fab5
|
5819a5ac8fe301c7e7dd2ddfdc4154044b5de181
|
refs/heads/master
| 2021-01-19T07:18:47.656016
| 2012-11-30T20:34:24
| 2012-11-30T20:34:24
| 40,775,149
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 209
|
java
|
package engine;
public class AdditionEvaluator implements IBinaryEvaluator {
@Override
public IObject evaluate(IObject left, IObject right) throws Exception {
return left.add(right);
}
}
|
[
"michalewandowski@gmail.com"
] |
michalewandowski@gmail.com
|
610899477467ed3608d2f65aa8635b4c491ac351
|
b7e31f4943430134de7cc0384d5ce91525df3858
|
/transfuse/src/main/java/org/androidtransfuse/model/manifest/InstallLocation.java
|
ab6ab6d056c73ecb3921ae58a736929425c8c98e
|
[
"Apache-2.0"
] |
permissive
|
johncarl81/transfuse
|
233ce44e8484f7184e3fe65aae7b9f3c1ee22d3a
|
217e00f6f09f98240254cc14f8c2c246dea1d5dc
|
refs/heads/master
| 2023-03-19T04:52:01.475202
| 2021-07-17T23:16:52
| 2021-07-17T23:16:52
| 2,416,378
| 118
| 32
|
Apache-2.0
| 2021-07-19T22:17:25
| 2011-09-19T15:57:21
|
Java
|
UTF-8
|
Java
| false
| false
| 1,006
|
java
|
/**
* Copyright 2011-2015 John Ericksen
*
* 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.androidtransfuse.model.manifest;
import org.androidtransfuse.annotations.Labeled;
public enum InstallLocation implements Labeled {
AUTO("auto"),
INTERNAL_ONLY("internalOnly"),
PREFER_EXTERNAL("preferExternal");
private String label;
private InstallLocation(String label) {
this.label = label;
}
public String getLabel() {
return label;
}
}
|
[
"johncarl81@gmail.com"
] |
johncarl81@gmail.com
|
6b425550f5747b7799fde4b36c8ae7a294c003bf
|
130f7fa215a57b7d4996ea2b7fc39d04beded8b8
|
/src/main/java/prototypepattern/Shape.java
|
436db9a24dd7b1d5a72ea0147d5e1cc13cd55cd6
|
[] |
no_license
|
runningkay/KayDesignPatternDemo
|
15c8e3da5d2224432011620f9e34c1a6d627760b
|
d50652589949348aa4d0c5fcad0f54e1f898b7e6
|
refs/heads/master
| 2021-01-11T06:05:15.314345
| 2016-09-30T07:05:47
| 2016-09-30T07:05:47
| 69,074,063
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 605
|
java
|
package prototypepattern;
/**
* Created by Bo-Young on 2016/9/25.
*/
public abstract class Shape implements Cloneable {
private String id;
protected String type;
abstract void draw();
public String getType() {
return type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Object clone() {
Object clone = null;
try {
clone = super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return clone;
}
}
|
[
"prodigal0906@aliyun.com"
] |
prodigal0906@aliyun.com
|
0ddacc9503fd7373ef2ec0ecabdf138be80a9938
|
516761a17a050ee05890b05438c3db674144c43c
|
/library/src/main/java/me/xiaopan/spear/process/ImageProcessor.java
|
793d0434f90b9973a9339218bec113456067cbac
|
[
"Apache-2.0"
] |
permissive
|
kuyun-zhangyang/Spear
|
ca43c833ea2566c38dbe8aa18d167ef32ecf9852
|
0e867a1a11df95212b69d16713aeb1fbe82d0dd4
|
refs/heads/master
| 2020-04-05T18:28:44.373350
| 2015-04-18T18:24:30
| 2015-04-18T18:24:30
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,247
|
java
|
/*
* Copyright (C) 2013 Peng fei Pan <sky@xiaopan.me>
*
* 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 me.xiaopan.spear.process;
import android.graphics.Bitmap;
import android.widget.ImageView.ScaleType;
import me.xiaopan.spear.ImageSize;
/**
* 图片处理器,你可以是实现此接口,将你的图片处理成你想要的效果
*/
public interface ImageProcessor {
/**
* 处理
* @param bitmap 要被处理的图片
* @param resize 新的尺寸
* @param scaleType 显示方式
* @return 新的图片
*/
public Bitmap process(Bitmap bitmap, ImageSize resize, ScaleType scaleType);
/**
* 获取Flag,Flag将用于计算缓存ID
* @return Flag
*/
public String getFlag();
}
|
[
"sky@xiaopan.me"
] |
sky@xiaopan.me
|
057c64d213c6620624a47477f522e629779fcec1
|
a8928dc502a8a3c3e602ddfe9aa737dcbbb37bd9
|
/jone-service/src/main/java/com/jone/service/common/ContentServiceImpl.java
|
055ae0683e884856a324661c5db57acbf8632f30
|
[] |
no_license
|
xiangjg/jone
|
efb8c3181e574522b498fd78debb5605fa3eb6e6
|
215ecd65fba02b40e6c5a53ead1fea4fc3e7d3c9
|
refs/heads/master
| 2021-08-15T00:48:57.465880
| 2017-11-17T03:35:49
| 2017-11-17T03:35:49
| 109,360,764
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 214
|
java
|
package com.jone.service.common;
import com.jone.api.common.ContentService;
import org.springframework.stereotype.Service;
@Service("contentService")
public class ContentServiceImpl implements ContentService {
}
|
[
"1991887681@qq.com"
] |
1991887681@qq.com
|
1771d3c40a22dd409e6cf2a5be98e385ce4f3cc9
|
f09d42afcdfb1b51e79f73b162fea1994c91236b
|
/idp-oidc-extension-api/src/main/java/org/geant/idpextension/oidc/messaging/context/package-info.java
|
f1bd246ec7a245a9328588fe900d0cdeb98792bb
|
[
"BSD-2-Clause"
] |
permissive
|
lhoekenga/shibboleth-idp-oidc-extension
|
369b09783db3d2f5635af906041086ceb6476c0d
|
6e523070d92ef8d01ed65515d6e1eee232d5e6fb
|
refs/heads/master
| 2020-03-25T23:56:44.874123
| 2019-04-02T18:12:39
| 2019-04-02T18:12:39
| 144,300,076
| 0
| 0
| null | 2018-08-10T15:00:20
| 2018-08-10T15:00:19
| null |
UTF-8
|
Java
| false
| false
| 1,693
|
java
|
/*
* GÉANT BSD Software License
*
* Copyright (c) 2017 - 2020, GÉANT
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the GÉANT nor the names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* Disclaimer:
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Contexts related to OIDC messaging.
*/
package org.geant.idpextension.oidc.messaging.context;
|
[
"henri.mikkonen@iki.fi"
] |
henri.mikkonen@iki.fi
|
f3ecef314cefb2c8a9320c5f4a04ba21329d7a34
|
e6a977b8c8ac1546aeeaf4e7ffd7f467324a832d
|
/ac/monitor/components/error-monitor/src/main/java/com/hp/it/perf/monitor/config/ConnectConfig.java
|
e45c29c2aec5d2ca656c71b4e3b1b2989d7044ec
|
[] |
no_license
|
shengyao15/performance_project
|
6c86d6493d2c2d79d3e0d3585f96557a8584b1f6
|
d3f7a66e9065379452fcda0bb6209a529822393c
|
refs/heads/master
| 2021-05-16T03:07:16.637843
| 2017-11-01T06:35:58
| 2017-11-01T06:35:58
| 20,017,606
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 967
|
java
|
package com.hp.it.perf.monitor.config;
import java.util.HashMap;
import java.util.Map;
public class ConnectConfig implements ConnectConfigMXBean {
private Map<String, String> configs = new HashMap<String, String>(1);
/* (non-Javadoc)
* @see com.hp.it.perf.monitor.config.ConnectConfigMXBean#getConfigs()
*/
@Override
public Map<String, String> getConfigs() {
return configs;
}
/* (non-Javadoc)
* @see com.hp.it.perf.monitor.config.ConnectConfigMXBean#setConfigs(java.util.Map)
*/
@Override
public void setConfigs(Map<String, String> configs) {
this.configs = configs;
}
/* (non-Javadoc)
* @see com.hp.it.perf.monitor.config.ConnectConfigMXBean#put(java.lang.String, java.lang.String)
*/
@Override
public void put(String k, String v){
configs.put(k, v);
}
/* (non-Javadoc)
* @see com.hp.it.perf.monitor.config.ConnectConfigMXBean#remove(java.lang.String)
*/
@Override
public void remove(String k){
configs.remove(k);
}
}
|
[
"shengyao15@126.com"
] |
shengyao15@126.com
|
1be76ab06f1cd005d92012a68ee42e83ec6b0f46
|
f0da9aa109f38e9ed0e598995536d13037d445e8
|
/Backend/models/testsrc/models/VideoTest.java
|
c9f590c115fc2a0f18841236d64af9dd137e859d
|
[] |
no_license
|
jan-verm/Design_project
|
cbd9c411c4ae97d43693d94019c1f6032c455674
|
ff6fd9664666f25d64f639a78c58cb062437c2cd
|
refs/heads/master
| 2021-06-29T12:54:13.087335
| 2017-09-20T14:37:50
| 2017-09-20T14:37:50
| 104,227,264
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,606
|
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;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Juta
*/
public class VideoTest {
/**
* Test of getTitle method, of class Video.
*/
@Test
public void testGetTitle() {
String title = "title";
Video instance = new Video(title, "", 0);
String result = instance.getTitle();
assertEquals(title, result);
}
/**
* Test of setTitle method, of class Video.
*/
@Test
public void testSetTitle() {
String title = "title";
Video instance = new Video("", "", 0);
instance.setTitle(title);
String result = instance.getTitle();
assertEquals(title, result);
}
/**
* Test of getUrl method, of class Video.
*/
@Test
public void testGetUrl() {
String url = "url";
Video instance = new Video("", "url", 0);
String result = instance.getUrl();
assertEquals(url, result);
}
/**
* Test of setUrl method, of class Video.
*/
@Test
public void testSetUrl() {
String url = "url";
Video instance = new Video("", "", 0);
instance.setUrl(url);
String result = instance.getUrl();
assertEquals(url, result);
}
/**
* Test of getDuration method, of class Video.
*/
@Test
public void testGetDuration() {
int expResult = 20;
Video instance = new Video("", "", expResult);
int result = instance.getDuration();
assertEquals(expResult, result);
}
/**
* Test of setDuration method, of class Video.
*/
@Test
public void testSetDuration() {
int duration = 20;
Video instance = new Video("", "", 0);
instance.setDuration(duration);
int result = instance.getDuration();
assertEquals(duration, result);
}
@Test
public void testGetId() {
int id = 5;
Video instance = new Video("", "", 0);
instance.setId(id);
int result = instance.getId();
assertEquals(id, result);
}
@Test
public void testSetId() {
int id = 5;
Video instance = new Video("", "", 0);
instance.setId(id);
int result = instance.getId();
assertEquals(id, result);
}
}
|
[
"jan.verm84@gmail.com"
] |
jan.verm84@gmail.com
|
25803d732ba79cc9a9bda01ca60a8b5d4dc87c5a
|
6710c7afa317bc8e1ed4009bf44b4f2966cb3d6a
|
/YOUTUBEAPP/src/main/java/dev/vn/groupbase/App.java
|
2144f3ee7abb63a9c40937c66fdf73b4642868d4
|
[] |
no_license
|
GroupBase/YouTubeApp
|
3278f09725b95424fee71e63acd5de0c2df11619
|
327ff157ebd22ee906f5269ecc1611947c5b6ae6
|
refs/heads/master
| 2020-07-29T22:50:53.504432
| 2016-11-16T04:32:52
| 2016-11-16T04:32:52
| 73,656,167
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 750
|
java
|
package dev.vn.groupbase;
import android.content.pm.PackageManager;
import gmo.hcm.net.lib.OpenSQLiteBase;
import gmo.hcm.net.lib.SQLiteDB;
import gmo.hcm.net.lib.SQLiteManager;
import gmo.hcm.net.lib.ApplicationBase;
/**
* Created by acnovn on 10/14/16.
*/
public class App extends ApplicationBase {
@Override
public void onCreate() {
super.onCreate();
PackageManager manager = this.getPackageManager();
OpenSQLiteBase openSQLiteBase = new OpenSQLiteBase(this,"official.sqlite",1,true,this.getDatabasePath("official.sqlite").getPath());
SQLiteManager.initializeInstance(openSQLiteBase);
this.sqLiteManager = SQLiteManager.getInstance();
this.db = sqLiteManager.openDatabase();
}
}
|
[
"nghiath@runsystem.net"
] |
nghiath@runsystem.net
|
71ed09b80cb88bc0d68e88a1f864859e0d65c843
|
47bfbc85976de389115f0493fe594ae90497caf6
|
/ShoppingCart/src/main/java/com/suman/dev/controller/PageController.java
|
b9b452d23e949138a6a48a9daf555c464ace6baa
|
[] |
no_license
|
ShresthaSuman/shoppingcart
|
a2ca274199b59036ea5f9ff94ab9b19c5d58ac95
|
8e131ce9a3c4a15d652dfeb6fba884c09644dcdd
|
refs/heads/master
| 2022-12-27T23:58:02.680657
| 2020-10-14T07:10:27
| 2020-10-14T07:10:27
| 279,640,778
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,118
|
java
|
package com.suman.dev.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import com.suman.dev.entity.Page;
import com.suman.dev.repository.AdminPageRepository;
@Controller
@RequestMapping("/")
public class PageController {
@Autowired
private AdminPageRepository pageRepository;
@GetMapping
public String home(Model model) {
Page page = pageRepository.findBySlug("home");
String contents= page.getContents();
model.addAttribute("page",page);
return "page";
}
@GetMapping("/{slug}")
public String otherPage(@PathVariable String slug , Model model) {
Page page =pageRepository.findBySlug(slug);
if(page == null) {
return "redirect:/page";
}
model.addAttribute("page",page);
return "page";
}
@GetMapping("/login")
public String login() {
return "login";
}
}
|
[
"shrestha.suman9803@gmail.com"
] |
shrestha.suman9803@gmail.com
|
6b22d9373a9e1fbc3c1b505605fcc40efe85e014
|
ea8fb2ba093fe8ad8d2b73bcabe580df84841ac3
|
/chapter14/GenericConstructor.java
|
a26c03a4caab4992ebeae72c866edcd922af5cbb
|
[] |
no_license
|
adarshvee/Java-9-A-Complete-Reference
|
134d8edb86b73f3b201f0d0bbb972642dbe81b54
|
7132288b211d90b2d3effc1f9c21effc51eccf89
|
refs/heads/master
| 2020-03-18T08:09:59.857277
| 2018-06-05T14:50:09
| 2018-06-05T14:50:09
| 134,494,008
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 652
|
java
|
package chapter14;
/**
* This class demonstrates the use of generics in a class-constructor. Such
* generics can apply even if the class itself is not generic
* @author Adarsh V
*/
public class GenericConstructor {
private double val;
<T extends Number> GenericConstructor(T arg) {
val = arg.doubleValue();
}
void showVal() {
System.out.println("val : " + val);
}
public static void main(String[] args) {
GenericConstructor gc1 = new GenericConstructor(10);
GenericConstructor gc2 = new GenericConstructor(12.2F);
gc1.showVal();
gc2.showVal();
}
}
|
[
"adarshvijayaraghavan@gmail.com"
] |
adarshvijayaraghavan@gmail.com
|
aa22f1e77af15729c48de318e4eb16aafbb5ffbb
|
b615ef46ae2525ac7d6cdb1e48f64931be34aca6
|
/zxing/src/main/java/cn/park/com/zxing/bean/ZxingConfig.java
|
89c6cedfeaf03b7b6ac6fc1afb8a67b2954bcc1e
|
[] |
no_license
|
muyed/wisdom-parking-android
|
29f66decf656ebc6912af3b44dd1b6bc055b65c3
|
d061ea35a1322be80eadb7e4ce18d5ed24f43e5f
|
refs/heads/master
| 2021-05-10T18:07:39.981927
| 2019-02-15T09:02:00
| 2019-02-15T09:02:00
| 118,621,218
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,416
|
java
|
package cn.park.com.zxing.bean;
import java.io.Serializable;
/**
* @author: yzq
* @date: 2017/10/27 14:48
* @declare :zxing配置类
*/
public class ZxingConfig implements Serializable {
/*是否播放声音*/
private boolean isPlayBeep = true;
/*是否震动*/
private boolean isShake = false;
/*是否显示下方的其他功能布局*/
private boolean isShowbottomLayout = true;
/*是否显示闪光灯按钮*/
private boolean isShowFlashLight = true;
/*是否显示相册按钮*/
private boolean isShowAlbum = true;
public boolean isPlayBeep() {
return isPlayBeep;
}
public void setPlayBeep(boolean playBeep) {
isPlayBeep = playBeep;
}
public boolean isShake() {
return isShake;
}
public void setShake(boolean shake) {
isShake = shake;
}
public boolean isShowbottomLayout() {
return isShowbottomLayout;
}
public void setShowbottomLayout(boolean showbottomLayout) {
isShowbottomLayout = showbottomLayout;
}
public boolean isShowFlashLight() {
return isShowFlashLight;
}
public void setShowFlashLight(boolean showFlashLight) {
isShowFlashLight = showFlashLight;
}
public boolean isShowAlbum() {
return isShowAlbum;
}
public void setShowAlbum(boolean showAlbum) {
isShowAlbum = showAlbum;
}
}
|
[
"leocheung4ever@gmail.com"
] |
leocheung4ever@gmail.com
|
b6eabcaf5e84a404d46301945826b15a8702dd02
|
ef6d9a00b0c2ce83fa355f34f6e26e9cb2814719
|
/src/MyWebServer/Response.java
|
3f0f1f2b5ad872d1801baad4d60f39489b261351
|
[] |
no_license
|
shi1123/MyWebServer
|
ddbfb4d53cee6e7a926fed73852c7143627b0343
|
6edbe3c2e5c84307edcb57ae9b076290a351b4aa
|
refs/heads/main
| 2023-06-03T22:16:24.002362
| 2021-06-19T15:13:31
| 2021-06-19T15:13:31
| 378,441,127
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 320
|
java
|
package MyWebServer;
import java.io.PrintStream;
/**将处理后的信息返回给浏览器
* @author shizhp
* @data 2015年12月24日
*/
public class Response {
private PrintStream out;
public PrintStream getOut() {
return out;
}
public void setOut(PrintStream out) {
this.out = out;
}
}
|
[
"yomingyo@gmail.com"
] |
yomingyo@gmail.com
|
2b6802fae48a6d08d4ac6e0fcb8a2432f0c9c096
|
6459035361939086aa04dae784360add15fd1241
|
/interface/src/main/java/com/kis/viewmodel/TreeNodeViewModel.java
|
691ab47671d19a06174d1e293509184c315cf094
|
[] |
no_license
|
yasikvor/KisYProject
|
777162a15b0402c33ecb7997e9166c46dd2afee9
|
8e2a01a144125973eb7d91afcdf133c10fc8c16b
|
refs/heads/master
| 2020-04-05T00:03:40.345902
| 2018-11-06T12:40:15
| 2018-11-06T12:40:15
| 156,381,741
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 18,317
|
java
|
package com.kis.viewmodel;
import com.kis.constant.ConnectionObjectConstant;
import com.kis.constant.GrammarConstants;
import com.kis.domain.TreeNode;
import com.kis.loader.dbloader.exception.ObjectNotFoundException;
import com.kis.loader.dbloader.utils.DbObjectComparator;
import com.kis.model.*;
import com.kis.printer.PrinterManager;
import com.kis.repository.LayoutRepository;
import com.kis.repository.ProjectRepository;
import com.kis.service.ScriptGenerator;
import com.kis.service.TreeNodeService;
import com.kis.task.LoadNodeTask;
import javafx.application.Platform;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.concurrent.Task;
import javafx.scene.control.*;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import org.xml.sax.SAXException;
import java.io.File;
import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Predicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
public class TreeNodeViewModel {
private final SimpleBooleanProperty visibleIndicator = new SimpleBooleanProperty();
private final SimpleObjectProperty<TreeItem<TreeNode>> root = new SimpleObjectProperty<>();
private final SimpleObjectProperty<TreeItem<TreeNode>> selectedItem = new SimpleObjectProperty<>();
private final SimpleObjectProperty<ObservableList<Map.Entry<String, String>>> tableView =
new SimpleObjectProperty<>(FXCollections.emptyObservableList());
private final SimpleStringProperty textArea = new SimpleStringProperty();
private final SimpleStringProperty searchTextField = new SimpleStringProperty();
private final SimpleBooleanProperty treeViewIsDisabled = new SimpleBooleanProperty();
private final SimpleBooleanProperty createSqlMenuItemDisabled = new SimpleBooleanProperty();
private final SimpleBooleanProperty reloadMenuItemDisabled = new SimpleBooleanProperty();
private final SimpleBooleanProperty loadAllDatabaseMenuItemDisabled = new SimpleBooleanProperty();
private final SimpleBooleanProperty tableVisible = new SimpleBooleanProperty();
private final SimpleObjectProperty<javafx.scene.Node> script = new SimpleObjectProperty<>();
public TreeNodeViewModel() {
root.addListener((observable, oldValue, newValue) -> {
if (newValue == null) {
ViewModelRepository.getRootViewModel().saveProjectDisabledProperty().set(true);
ViewModelRepository.getRootViewModel().closeProjectDisabledProperty().set(true);
ViewModelRepository.getRootViewModel().newProjectDisabledProperty().set(false);
ViewModelRepository.getRootViewModel().openProjectDisabledProperty().set(false);
} else {
ViewModelRepository.getRootViewModel().saveProjectDisabledProperty().set(false);
ViewModelRepository.getRootViewModel().closeProjectDisabledProperty().set(false);
ViewModelRepository.getRootViewModel().newProjectDisabledProperty().set(true);
ViewModelRepository.getRootViewModel().openProjectDisabledProperty().set(true);
}
});
selectedItemProperty().addListener(((observable, oldValue, newValue) -> {
if (newValue == null) {
tableVisible.set(false);
script.set(null);
return;
}
if (ConnectionModel.getConnection() == null && newValue.getValue().getAttribute(ConnectionObjectConstant.IS_LOADED) == null && DbObjectComparator.isDbObject(newValue.getValue())) {
tableVisible.set(false);
createSqlMenuItemDisabled.set(true);
} else {
updateTree(newValue);
boolean canBePrinted = DbObjectComparator.hasSql(newValue.getValue()) || newValue.getValue().is(GrammarConstants.NodeNames.SCHEMA);
boolean canBeReloaded = !canBeReloaded();
ViewModelRepository.getRootViewModel().createSqlDisabledProperty().set(canBePrinted);
ViewModelRepository.getRootViewModel().reloadDisabledProperty().set(canBeReloaded);
createSqlMenuItemDisabled.set(!canBePrinted);
reloadMenuItemDisabled.set(canBeReloaded);
if (newValue.getValue().getAttributes() != null) {
tableViewProperty().set(FXCollections.observableArrayList(filteredAttributes(newValue.getValue().getAttributes()).entrySet()));
}
tableVisible.set(haveProperties());
}
}));
}
private Map<String, String> filteredAttributes(Map<String, String> attributes) {
return attributes.entrySet().stream().
filter(isDatabaseAttribute()).
collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
private Predicate<Map.Entry<String, String>> isDatabaseAttribute() {
return attr ->
!attr.getKey().equals(ConnectionObjectConstant.IS_EXPANDED) &&
!attr.getKey().equals(ConnectionObjectConstant.IS_SELECTED) &&
!attr.getKey().equals(ConnectionObjectConstant.IS_LOADED);
}
public void saveProject(File file) {
if (NodeModel.getRoot() == null) return;
ProjectRepository.save(NodeModel.getRootTreeItem(), NodeModel.getSelectedItem(), file);
}
public void openProject(File file) throws SAXException, SQLException {
TreeItem<TreeNode> root = ProjectRepository.open(file);
this.selectedItem.set(NodeModel.getSelectedItem());
NodeModel.setRootTreeItem(root);
this.setRoot(root);
}
public void search() {
if (NodeModel.getRoot() == null) return;
setRoot(TreeNodeService.search(searchTextField.get()));
}
public void loadFullDatabase() {
treeViewIsDisabled.set(true);
visibleIndicator.set(true);
Task task = new LoadDbTask();
task.setOnSucceeded(event -> {
Platform.runLater(() -> root.set(NodeModel.getRootTreeItem()));
treeViewIsDisabled.set(false);
visibleIndicator.set(false);
});
ExecutorService service = Executors.newSingleThreadExecutor();
service.submit(task);
}
public void saveScript(File file) {
if (!selectedItem.get().getValue().is(GrammarConstants.NodeNames.SCHEMA))
ScriptGenerator.printScript(selectedItem.get(), file);
else {
treeViewIsDisabled.set(true);
visibleIndicator.set(true);
Task task = new LoadDbTask();
task.setOnSucceeded(event -> {
ScriptGenerator.printScript(NodeModel.getRootTreeItem(), file);
Platform.runLater(() -> root.set(NodeModel.getRootTreeItem()));
treeViewIsDisabled.set(false);
visibleIndicator.set(false);
});
ExecutorService service = Executors.newSingleThreadExecutor();
service.submit(task);
}
}
public void createRoot() {
this.setRoot(NodeModel.getRootTreeItem());
}
public void reload() throws ObjectNotFoundException {
ReloadNodeTask task = new ReloadNodeTask();
ExecutorService service = Executors.newSingleThreadExecutor();
service.submit(task);
}
private void updateTree(TreeItem<TreeNode> selectedItem) {
if (selectedItem.getValue().getAttribute(ConnectionObjectConstant.IS_LOADED) != null) {
printColoredScript();
}
if (selectedItem.getValue().getAttribute(ConnectionObjectConstant.IS_LOADED) == null &&
!DbObjectComparator.isDbObject(selectedItem.getValue()) &&
!DbObjectComparator.isCategory(selectedItem.getValue()))
printColoredScript();
if (!selectedItem.getValue().getChildren().isEmpty() && selectedItem.getValue().getChildren().get(0).getType().equals("Expanding...")) {
selectedItem.getValue().addAttribute(ConnectionObjectConstant.IS_LOADED, "TRUE");
treeViewIsDisabled.set(true);
selectedItem.getChildren().get(0).getValue().setType("Expanding...");
visibleIndicator.set(true);
Task task = new LoadNodeTask(selectedItem);
task.setOnSucceeded(event -> {
printColoredScript();
treeViewIsDisabled.set(false);
visibleIndicator.set(false);
});
ExecutorService service = Executors.newSingleThreadExecutor();
service.submit(task);
}
}
public void closeProject() throws SQLException {
ViewModelRepository.getRootViewModel().reloadDisabledProperty().set(true);
ViewModelRepository.getRootViewModel().createSqlDisabledProperty().set(true);
LayoutRepository.getMainStage().setTitle("KisYProject");
ViewModelRepository.getRootViewModel().loadAllDatabaseDisabledProperty().set(true);
ViewModelRepository.getTreeNodeViewModel().loadAllDatabaseMenuItemDisabledProperty().set(true);
NodeModel.close();
ConnectionModel.close();
ProjectModel.setProjectFile(null);
textArea.set("");
tableView.set(null);
tableVisible.set(false);
root.set(null);
selectedItem.set(null);
}
private boolean haveProperties() {
return !tableView.get().isEmpty();
}
public void deleteCurrentItem() {
TreeNodeService.delete(selectedItem.get());
}
private boolean canBeReloaded() {
if (ConnectionModel.getConnection() == null) return false;
TreeNode selectedTreeNode = selectedItem.get().getValue();
return DbObjectComparator.isDbObject(selectedTreeNode) ||
DbObjectComparator.isCategory(selectedTreeNode) ||
selectedTreeNode.is(GrammarConstants.NodeNames.SCHEMA);
}
private void setRoot(TreeItem<TreeNode> tree) {
this.root.set(tree);
root.get().addEventHandler(TreeItem.branchExpandedEvent(), (TreeItem.TreeModificationEvent<TreeNode> event) -> {
if (DbObjectComparator.isDbObject(event.getTreeItem().getValue()) && event.getTreeItem().getValue().getAttribute(ConnectionObjectConstant.IS_LOADED) == null)
try {
changeSelection(event.getTreeItem());
} catch (SQLException e) {
if (enterPassword())
selectedItemProperty().set(event.getTreeItem());
else
event.getTreeItem().setExpanded(false);
}
});
}
public void resetFilter() {
if (NodeModel.getRoot() == null)
return;
TreeNodeService.resetFilter();
setRoot(NodeModel.getRootTreeItem());
}
public void changeSelection(TreeItem<TreeNode> newSelectedItem) throws SQLException {
if (newSelectedItem == null)
return;
if (ConnectionModel.getConnection() == null &&
newSelectedItem.getValue().getAttribute(ConnectionObjectConstant.IS_LOADED) == null &&
DbObjectComparator.isDbObject(newSelectedItem.getValue()))
throw new SQLException();
selectedItemProperty().set(newSelectedItem);
}
public SimpleObjectProperty<TreeItem<TreeNode>> selectedItemProperty() {
return selectedItem;
}
public boolean enterPassword() {
ViewModelRepository.getConnectionViewModel().serverTextAreaProperty().set(ConnectionModel.getServer());
ViewModelRepository.getConnectionViewModel().portTextAreaProperty().set(ConnectionModel.getPort());
ViewModelRepository.getConnectionViewModel().schemaTextAreaProperty().set(ConnectionModel.getSchema());
ViewModelRepository.getConnectionViewModel().userTextAreaProperty().set(ConnectionModel.getUser());
ViewModelRepository.getConnectionViewModel().serverDisableProperty().set(true);
ViewModelRepository.getConnectionViewModel().portDisableProperty().set(true);
ViewModelRepository.getConnectionViewModel().schemaDisableProperty().set(true);
ViewModelRepository.getConnectionViewModel().userDisableProperty().set(true);
LayoutRepository.getConnectionLayout().showAndWait();
ViewModelRepository.getConnectionViewModel().serverDisableProperty().set(false);
ViewModelRepository.getConnectionViewModel().portDisableProperty().set(false);
ViewModelRepository.getConnectionViewModel().schemaDisableProperty().set(false);
ViewModelRepository.getConnectionViewModel().userDisableProperty().set(false);
return ConnectionModel.getConnection() != null;
}
public SimpleObjectProperty<TreeItem<TreeNode>> rootProperty() {
return root;
}
public SimpleObjectProperty<ObservableList<Map.Entry<String, String>>> tableViewProperty() {
return tableView;
}
public SimpleStringProperty textAreaProperty() {
return textArea;
}
public SimpleStringProperty searchTextFieldProperty() {
return searchTextField;
}
public SimpleBooleanProperty visibleIndicatorProperty() {
return visibleIndicator;
}
public SimpleBooleanProperty treeViewIsDisabledProperty() {
return treeViewIsDisabled;
}
public SimpleBooleanProperty tableVisibleProperty() {
return tableVisible;
}
public SimpleObjectProperty<javafx.scene.Node> scriptProperty() {
return script;
}
public SimpleBooleanProperty loadAllDatabaseMenuItemDisabledProperty() {
return loadAllDatabaseMenuItemDisabled;
}
private class LoadDbTask extends Task<Void> {
@Override
protected Void call() throws SQLException {
NodeModel.setRootTreeItem((TreeNodeService.loadAllDatabase()));
NodeModel.getRootTreeItem().addEventHandler(TreeItem.branchExpandedEvent(), (TreeItem.TreeModificationEvent<TreeNode> event) -> {
if (DbObjectComparator.isDbObject(event.getTreeItem().getValue()) && event.getTreeItem().getValue().getAttribute(ConnectionObjectConstant.IS_LOADED) == null)
selectedItemProperty().set(event.getTreeItem());
});
return null;
}
}
private void printColoredScript() {
TextFlow textFlow = new TextFlow();
TreeNode object = selectedItem.get().getValue();
if(DbObjectComparator.hasSql(object)) {
String sql = PrinterManager.print(object);
textFlow.getChildren().addAll(createTextFlowTexts(sql));
}
script.set(textFlow);
}
private List<Text> createTextFlowTexts(String sql) {
ArrayList<String> mysqlReservedWordsList = Collections.list(ResourceBundle.getBundle("com/kis/reservedWords", Locale.getDefault()).getKeys());
List<Text> texts = new ArrayList<>();
Pattern pattern1 = Pattern.compile("([^`\"]*)([`\"][^`\"]+[`\"])([^`\"]*)");
Matcher matcher1 = pattern1.matcher(sql);
Pattern pattern2 = Pattern.compile("([\\W]*)([\\w]+)([\\W]*)");
boolean find = false;
while (matcher1.find()) {
if (!find) {
find = true;
}
Matcher matcher2 = pattern2.matcher(matcher1.group(1));
verifyAndAddReservedWords(matcher2, texts, mysqlReservedWordsList);
texts.add(createColoredText(matcher1.group(2), Color.GREEN));
Matcher matcher3 = pattern2.matcher(matcher1.group(3));
verifyAndAddReservedWords(matcher3, texts, mysqlReservedWordsList);
}
if (!find) {
StringBuffer sb = new StringBuffer();
matcher1.appendTail(sb);
if (!sb.toString().isEmpty()) {
Matcher matcher4 = pattern2.matcher(sb.toString());
verifyAndAddReservedWords(matcher4, texts, mysqlReservedWordsList);
}
}
return texts;
}
private void verifyAndAddReservedWords(Matcher matcher, List<Text> texts, ArrayList<String> mysqlReservedWordsList) {
StringBuffer sb = new StringBuffer();
boolean find = false;
while (matcher.find()) {
if (!find) {
find = true;
}
if (matcher.group(1) != null && !matcher.group(1).isEmpty()) {
texts.add(createColoredText(matcher.group(1), Color.BLACK));
}
if (mysqlReservedWordsList.contains(matcher.group(2).toUpperCase())) {
Text text = createColoredText(matcher.group(2), Color.BLUE);
text.setFont(Font.font("Verdana", FontWeight.BOLD, 12));
texts.add(text);
} else {
texts.add(createColoredText(matcher.group(2), Color.BLACK));
}
if (matcher.group(3) != null && !matcher.group(3).isEmpty()) {
texts.add(createColoredText(matcher.group(3), Color.BLACK));
}
}
if (!find) {
matcher.appendTail(sb);
if (!sb.toString().isEmpty()) {
texts.add(createColoredText(sb.toString(), Color.BLACK));
}
}
}
private Text createColoredText(String s, Color color) {
Text text = new Text(s);
text.setFill(color);
return text;
}
private class ReloadNodeTask extends Task<Void> {
@Override
protected Void call() throws Exception {
treeViewIsDisabled.set(true);
visibleIndicator.set(true);
TreeNodeService.reload(selectedItem.get());
selectedItem.get().setExpanded(true);
return null;
}
@Override
protected void succeeded() {
treeViewIsDisabled.set(false);
visibleIndicator.set(false);
}
}
}
|
[
"kis.y@dbbest.com"
] |
kis.y@dbbest.com
|
f9aa7e6e505a39f3d4f6666175b33cc7cbf99221
|
c6dc3346f5bc2e63b18d1491b3be4f9ccebe3209
|
/src/main/java/com/hotelserver/model/search/HotelDescriptiveContentType.java
|
70093d792288ab0f98bdce5f84e18e22da09a0b2
|
[] |
no_license
|
codingBitsKolkata/hotel-server
|
bd3293172fa5c796454d59f23b333b698765adcc
|
97e5c1c3229eef72992cdbd01436f93158ba3103
|
refs/heads/master
| 2020-04-13T14:16:18.712379
| 2019-03-27T06:40:00
| 2019-03-27T06:40:00
| 163,256,941
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 31,103
|
java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2019.03.10 at 01:51:57 PM IST
//
package com.hotelserver.model.search;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for HotelDescriptiveContentType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="HotelDescriptiveContentType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="DestinationSystemsCode" type="{http://www.opentravel.org/OTA/2003/05}DestinationSystemCodesType" minOccurs="0"/>
* <element name="HotelInfo" type="{http://www.opentravel.org/OTA/2003/05}HotelInfoType" minOccurs="0"/>
* <element name="FacilityInfo" type="{http://www.opentravel.org/OTA/2003/05}FacilityInfoType" minOccurs="0"/>
* <element name="Policies" minOccurs="0">
* <complexType>
* <complexContent>
* <extension base="{http://www.opentravel.org/OTA/2003/05}PoliciesType">
* <sequence>
* </sequence>
* <attribute name="GuaranteeRoomTypeViaCRC" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* <attribute name="GuaranteeRoomTypeViaGDS" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* <attribute name="GuaranteeRoomTypeViaProperty" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* </extension>
* </complexContent>
* </complexType>
* </element>
* <element name="AreaInfo" type="{http://www.opentravel.org/OTA/2003/05}AreaInfoType" minOccurs="0"/>
* <element name="AffiliationInfo" type="{http://www.opentravel.org/OTA/2003/05}AffiliationInfoType" minOccurs="0"/>
* <element name="MultimediaDescriptions" type="{http://www.opentravel.org/OTA/2003/05}MultimediaDescriptionsType" minOccurs="0"/>
* <element name="ContactInfos" type="{http://www.opentravel.org/OTA/2003/05}ContactInfosType" minOccurs="0"/>
* <element name="TPA_Extensions" type="{http://www.opentravel.org/OTA/2003/05}TPA_ExtensionsType" minOccurs="0"/>
* <element name="GDS_Info" type="{http://www.opentravel.org/OTA/2003/05}GDS_InfoType" minOccurs="0"/>
* <element name="Viewerships" type="{http://www.opentravel.org/OTA/2003/05}ViewershipsType" minOccurs="0"/>
* <element name="EffectivePeriods" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="EffectivePeriod" maxOccurs="unbounded">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* <attribute name="Duration" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="EndPeriod" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="StartPeriod" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* <attribute name="AreaUnitOfMeasureCode" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="DistanceUnitOfMeasureCode" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="LanguageCode" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="TimeZone" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="WeightUnitOfMeasureCode" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="CurrencyCode" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="DecimalPlaces" type="{http://www.w3.org/2001/XMLSchema}integer" />
* <attribute name="UnitOfMeasure" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="UnitOfMeasureCode" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="UnitOfMeasureQuantity" type="{http://www.w3.org/2001/XMLSchema}decimal" />
* <attribute name="Duration" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="End" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="Start" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "HotelDescriptiveContentType", propOrder = {
"destinationSystemsCode",
"hotelInfo",
"facilityInfo",
"policies",
"areaInfo",
"affiliationInfo",
"multimediaDescriptions",
"contactInfos",
"tpaExtensions",
"gdsInfo",
"viewerships",
"effectivePeriods"
})
@XmlSeeAlso({
com.hotelserver.model.search.OTANotifReportRQ.NotifDetails.HotelNotifReport.HotelDescriptiveContents.HotelDescriptiveContent.class
})
public class HotelDescriptiveContentType {
@XmlElement(name = "DestinationSystemsCode")
protected DestinationSystemCodesType destinationSystemsCode;
@XmlElement(name = "HotelInfo")
protected HotelInfoType hotelInfo;
@XmlElement(name = "FacilityInfo")
protected FacilityInfoType facilityInfo;
@XmlElement(name = "Policies")
protected HotelDescriptiveContentType.Policies policies;
@XmlElement(name = "AreaInfo")
protected AreaInfoType areaInfo;
@XmlElement(name = "AffiliationInfo")
protected AffiliationInfoType affiliationInfo;
@XmlElement(name = "MultimediaDescriptions")
protected MultimediaDescriptionsType multimediaDescriptions;
@XmlElement(name = "ContactInfos")
protected ContactInfosType contactInfos;
@XmlElement(name = "TPA_Extensions")
protected TPAExtensionsType tpaExtensions;
@XmlElement(name = "GDS_Info")
protected GDSInfoType gdsInfo;
@XmlElement(name = "Viewerships")
protected ViewershipsType viewerships;
@XmlElement(name = "EffectivePeriods")
protected HotelDescriptiveContentType.EffectivePeriods effectivePeriods;
@XmlAttribute(name = "AreaUnitOfMeasureCode")
protected String areaUnitOfMeasureCode;
@XmlAttribute(name = "DistanceUnitOfMeasureCode")
protected String distanceUnitOfMeasureCode;
@XmlAttribute(name = "LanguageCode")
protected String languageCode;
@XmlAttribute(name = "TimeZone")
protected String timeZone;
@XmlAttribute(name = "WeightUnitOfMeasureCode")
protected String weightUnitOfMeasureCode;
@XmlAttribute(name = "CurrencyCode")
protected String currencyCode;
@XmlAttribute(name = "DecimalPlaces")
protected BigInteger decimalPlaces;
@XmlAttribute(name = "UnitOfMeasure")
protected String unitOfMeasure;
@XmlAttribute(name = "UnitOfMeasureCode")
protected String unitOfMeasureCode;
@XmlAttribute(name = "UnitOfMeasureQuantity")
protected BigDecimal unitOfMeasureQuantity;
@XmlAttribute(name = "Duration")
protected String duration;
@XmlAttribute(name = "End")
protected String end;
@XmlAttribute(name = "Start")
protected String start;
/**
* Gets the value of the destinationSystemsCode property.
*
* @return
* possible object is
* {@link DestinationSystemCodesType }
*
*/
public DestinationSystemCodesType getDestinationSystemsCode() {
return destinationSystemsCode;
}
/**
* Sets the value of the destinationSystemsCode property.
*
* @param value
* allowed object is
* {@link DestinationSystemCodesType }
*
*/
public void setDestinationSystemsCode(DestinationSystemCodesType value) {
this.destinationSystemsCode = value;
}
/**
* Gets the value of the hotelInfo property.
*
* @return
* possible object is
* {@link HotelInfoType }
*
*/
public HotelInfoType getHotelInfo() {
return hotelInfo;
}
/**
* Sets the value of the hotelInfo property.
*
* @param value
* allowed object is
* {@link HotelInfoType }
*
*/
public void setHotelInfo(HotelInfoType value) {
this.hotelInfo = value;
}
/**
* Gets the value of the facilityInfo property.
*
* @return
* possible object is
* {@link FacilityInfoType }
*
*/
public FacilityInfoType getFacilityInfo() {
return facilityInfo;
}
/**
* Sets the value of the facilityInfo property.
*
* @param value
* allowed object is
* {@link FacilityInfoType }
*
*/
public void setFacilityInfo(FacilityInfoType value) {
this.facilityInfo = value;
}
/**
* Gets the value of the policies property.
*
* @return
* possible object is
* {@link HotelDescriptiveContentType.Policies }
*
*/
public HotelDescriptiveContentType.Policies getPolicies() {
return policies;
}
/**
* Sets the value of the policies property.
*
* @param value
* allowed object is
* {@link HotelDescriptiveContentType.Policies }
*
*/
public void setPolicies(HotelDescriptiveContentType.Policies value) {
this.policies = value;
}
/**
* Gets the value of the areaInfo property.
*
* @return
* possible object is
* {@link AreaInfoType }
*
*/
public AreaInfoType getAreaInfo() {
return areaInfo;
}
/**
* Sets the value of the areaInfo property.
*
* @param value
* allowed object is
* {@link AreaInfoType }
*
*/
public void setAreaInfo(AreaInfoType value) {
this.areaInfo = value;
}
/**
* Gets the value of the affiliationInfo property.
*
* @return
* possible object is
* {@link AffiliationInfoType }
*
*/
public AffiliationInfoType getAffiliationInfo() {
return affiliationInfo;
}
/**
* Sets the value of the affiliationInfo property.
*
* @param value
* allowed object is
* {@link AffiliationInfoType }
*
*/
public void setAffiliationInfo(AffiliationInfoType value) {
this.affiliationInfo = value;
}
/**
* Gets the value of the multimediaDescriptions property.
*
* @return
* possible object is
* {@link MultimediaDescriptionsType }
*
*/
public MultimediaDescriptionsType getMultimediaDescriptions() {
return multimediaDescriptions;
}
/**
* Sets the value of the multimediaDescriptions property.
*
* @param value
* allowed object is
* {@link MultimediaDescriptionsType }
*
*/
public void setMultimediaDescriptions(MultimediaDescriptionsType value) {
this.multimediaDescriptions = value;
}
/**
* Gets the value of the contactInfos property.
*
* @return
* possible object is
* {@link ContactInfosType }
*
*/
public ContactInfosType getContactInfos() {
return contactInfos;
}
/**
* Sets the value of the contactInfos property.
*
* @param value
* allowed object is
* {@link ContactInfosType }
*
*/
public void setContactInfos(ContactInfosType value) {
this.contactInfos = value;
}
/**
* Gets the value of the tpaExtensions property.
*
* @return
* possible object is
* {@link TPAExtensionsType }
*
*/
public TPAExtensionsType getTPAExtensions() {
return tpaExtensions;
}
/**
* Sets the value of the tpaExtensions property.
*
* @param value
* allowed object is
* {@link TPAExtensionsType }
*
*/
public void setTPAExtensions(TPAExtensionsType value) {
this.tpaExtensions = value;
}
/**
* Gets the value of the gdsInfo property.
*
* @return
* possible object is
* {@link GDSInfoType }
*
*/
public GDSInfoType getGDSInfo() {
return gdsInfo;
}
/**
* Sets the value of the gdsInfo property.
*
* @param value
* allowed object is
* {@link GDSInfoType }
*
*/
public void setGDSInfo(GDSInfoType value) {
this.gdsInfo = value;
}
/**
* Gets the value of the viewerships property.
*
* @return
* possible object is
* {@link ViewershipsType }
*
*/
public ViewershipsType getViewerships() {
return viewerships;
}
/**
* Sets the value of the viewerships property.
*
* @param value
* allowed object is
* {@link ViewershipsType }
*
*/
public void setViewerships(ViewershipsType value) {
this.viewerships = value;
}
/**
* Gets the value of the effectivePeriods property.
*
* @return
* possible object is
* {@link HotelDescriptiveContentType.EffectivePeriods }
*
*/
public HotelDescriptiveContentType.EffectivePeriods getEffectivePeriods() {
return effectivePeriods;
}
/**
* Sets the value of the effectivePeriods property.
*
* @param value
* allowed object is
* {@link HotelDescriptiveContentType.EffectivePeriods }
*
*/
public void setEffectivePeriods(HotelDescriptiveContentType.EffectivePeriods value) {
this.effectivePeriods = value;
}
/**
* Gets the value of the areaUnitOfMeasureCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAreaUnitOfMeasureCode() {
return areaUnitOfMeasureCode;
}
/**
* Sets the value of the areaUnitOfMeasureCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAreaUnitOfMeasureCode(String value) {
this.areaUnitOfMeasureCode = value;
}
/**
* Gets the value of the distanceUnitOfMeasureCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDistanceUnitOfMeasureCode() {
return distanceUnitOfMeasureCode;
}
/**
* Sets the value of the distanceUnitOfMeasureCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDistanceUnitOfMeasureCode(String value) {
this.distanceUnitOfMeasureCode = value;
}
/**
* Gets the value of the languageCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLanguageCode() {
return languageCode;
}
/**
* Sets the value of the languageCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLanguageCode(String value) {
this.languageCode = value;
}
/**
* Gets the value of the timeZone property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTimeZone() {
return timeZone;
}
/**
* Sets the value of the timeZone property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTimeZone(String value) {
this.timeZone = value;
}
/**
* Gets the value of the weightUnitOfMeasureCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getWeightUnitOfMeasureCode() {
return weightUnitOfMeasureCode;
}
/**
* Sets the value of the weightUnitOfMeasureCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setWeightUnitOfMeasureCode(String value) {
this.weightUnitOfMeasureCode = value;
}
/**
* Gets the value of the currencyCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCurrencyCode() {
return currencyCode;
}
/**
* Sets the value of the currencyCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCurrencyCode(String value) {
this.currencyCode = value;
}
/**
* Gets the value of the decimalPlaces property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getDecimalPlaces() {
return decimalPlaces;
}
/**
* Sets the value of the decimalPlaces property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setDecimalPlaces(BigInteger value) {
this.decimalPlaces = value;
}
/**
* Gets the value of the unitOfMeasure property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUnitOfMeasure() {
return unitOfMeasure;
}
/**
* Sets the value of the unitOfMeasure property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUnitOfMeasure(String value) {
this.unitOfMeasure = value;
}
/**
* Gets the value of the unitOfMeasureCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUnitOfMeasureCode() {
return unitOfMeasureCode;
}
/**
* Sets the value of the unitOfMeasureCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUnitOfMeasureCode(String value) {
this.unitOfMeasureCode = value;
}
/**
* Gets the value of the unitOfMeasureQuantity property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getUnitOfMeasureQuantity() {
return unitOfMeasureQuantity;
}
/**
* Sets the value of the unitOfMeasureQuantity property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setUnitOfMeasureQuantity(BigDecimal value) {
this.unitOfMeasureQuantity = value;
}
/**
* Gets the value of the duration property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDuration() {
return duration;
}
/**
* Sets the value of the duration property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDuration(String value) {
this.duration = value;
}
/**
* Gets the value of the end property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEnd() {
return end;
}
/**
* Sets the value of the end property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEnd(String value) {
this.end = value;
}
/**
* Gets the value of the start property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStart() {
return start;
}
/**
* Sets the value of the start property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStart(String value) {
this.start = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="EffectivePeriod" maxOccurs="unbounded">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* <attribute name="Duration" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="EndPeriod" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="StartPeriod" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"effectivePeriod"
})
public static class EffectivePeriods {
@XmlElement(name = "EffectivePeriod", required = true)
protected List<HotelDescriptiveContentType.EffectivePeriods.EffectivePeriod> effectivePeriod;
/**
* Gets the value of the effectivePeriod property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the effectivePeriod property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEffectivePeriod().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link HotelDescriptiveContentType.EffectivePeriods.EffectivePeriod }
*
*
*/
public List<HotelDescriptiveContentType.EffectivePeriods.EffectivePeriod> getEffectivePeriod() {
if (effectivePeriod == null) {
effectivePeriod = new ArrayList<HotelDescriptiveContentType.EffectivePeriods.EffectivePeriod>();
}
return this.effectivePeriod;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* <attribute name="Duration" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="EndPeriod" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="StartPeriod" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public static class EffectivePeriod {
@XmlAttribute(name = "Duration")
protected String duration;
@XmlAttribute(name = "EndPeriod")
protected String endPeriod;
@XmlAttribute(name = "StartPeriod")
protected String startPeriod;
/**
* Gets the value of the duration property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDuration() {
return duration;
}
/**
* Sets the value of the duration property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDuration(String value) {
this.duration = value;
}
/**
* Gets the value of the endPeriod property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEndPeriod() {
return endPeriod;
}
/**
* Sets the value of the endPeriod property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEndPeriod(String value) {
this.endPeriod = value;
}
/**
* Gets the value of the startPeriod property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStartPeriod() {
return startPeriod;
}
/**
* Sets the value of the startPeriod property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStartPeriod(String value) {
this.startPeriod = value;
}
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <extension base="{http://www.opentravel.org/OTA/2003/05}PoliciesType">
* <sequence>
* </sequence>
* <attribute name="GuaranteeRoomTypeViaCRC" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* <attribute name="GuaranteeRoomTypeViaGDS" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* <attribute name="GuaranteeRoomTypeViaProperty" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public static class Policies
extends PoliciesType
{
@XmlAttribute(name = "GuaranteeRoomTypeViaCRC")
protected Boolean guaranteeRoomTypeViaCRC;
@XmlAttribute(name = "GuaranteeRoomTypeViaGDS")
protected Boolean guaranteeRoomTypeViaGDS;
@XmlAttribute(name = "GuaranteeRoomTypeViaProperty")
protected Boolean guaranteeRoomTypeViaProperty;
/**
* Gets the value of the guaranteeRoomTypeViaCRC property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isGuaranteeRoomTypeViaCRC() {
return guaranteeRoomTypeViaCRC;
}
/**
* Sets the value of the guaranteeRoomTypeViaCRC property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setGuaranteeRoomTypeViaCRC(Boolean value) {
this.guaranteeRoomTypeViaCRC = value;
}
/**
* Gets the value of the guaranteeRoomTypeViaGDS property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isGuaranteeRoomTypeViaGDS() {
return guaranteeRoomTypeViaGDS;
}
/**
* Sets the value of the guaranteeRoomTypeViaGDS property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setGuaranteeRoomTypeViaGDS(Boolean value) {
this.guaranteeRoomTypeViaGDS = value;
}
/**
* Gets the value of the guaranteeRoomTypeViaProperty property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isGuaranteeRoomTypeViaProperty() {
return guaranteeRoomTypeViaProperty;
}
/**
* Sets the value of the guaranteeRoomTypeViaProperty property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setGuaranteeRoomTypeViaProperty(Boolean value) {
this.guaranteeRoomTypeViaProperty = value;
}
}
}
|
[
"avirup.pal@gmail.com"
] |
avirup.pal@gmail.com
|
3b95a98144950fc58731603e3f149fccd36a5ac7
|
7fe650678d20a0ac07bed8ef008710c51161d22e
|
/app/src/main/java/com/feyon/myapplication/themeUtil/setter/TextColorSetter.java
|
39b54dbb34f0377609bb967d57620277cff6c277
|
[] |
no_license
|
HaleyHong/Test2
|
035688543d031030a9a5b6d9286e6d4a0a93fe35
|
9b09a419fa365d3759ca5da302a9383eacd02e2e
|
refs/heads/master
| 2020-06-25T18:10:47.145930
| 2019-07-29T05:54:25
| 2019-07-29T05:54:25
| 199,386,569
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 566
|
java
|
package com.feyon.myapplication.themeUtil.setter;
import android.content.res.Resources.Theme;
import android.widget.TextView;
/**
* TextView 文本颜色Setter
* @author mrsimple
*
*/
public class TextColorSetter extends ViewSetter {
public TextColorSetter(TextView textView, int resId) {
super(textView, resId);
}
public TextColorSetter(int viewId, int resId) {
super(viewId, resId);
}
@Override
public void setValue(Theme newTheme, int themeId) {
if (mView == null) {
return;
}
((TextView) mView).setTextColor(getColor(newTheme));
}
}
|
[
"292281446@qq.com"
] |
292281446@qq.com
|
1927224e044c814277a50ef9f30564e5b49a08df
|
477496d43be8b24a60ac1ccee12b3c887062cebd
|
/shiro-chapter23/shiro-chapter23-server/src/main/java/com/haien/chapter23/dao/OrganizationDao.java
|
2f228c98a99b9e2ea6cb299ffd4eb7d5d2b0bd04
|
[] |
no_license
|
Eliyser/my-shiro-example
|
e860ba7f5b2bb77a87b2b9ec77c46207a260b985
|
75dba475dc50530820d105da87ff8b031701e564
|
refs/heads/master
| 2020-05-20T23:45:31.231923
| 2019-05-09T14:06:04
| 2019-05-09T14:06:04
| 185,808,582
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 643
|
java
|
package com.haien.chapter23.dao;
import com.haien.chapter23.entity.Organization;
import java.util.List;
/**
* <p>Organization: Zhang Kaitao
* <p>Date: 14-1-28
* <p>Version: 1.0
*/
public interface OrganizationDao {
public Organization createOrganization(Organization organization);
public Organization updateOrganization(Organization organization);
public void deleteOrganization(Long organizationId);
Organization findOne(Long organizationId);
List<Organization> findAll();
List<Organization> findAllWithExclude(Organization excludeOraganization);
void move(Organization source, Organization target);
}
|
[
"1410343862@qq.com"
] |
1410343862@qq.com
|
f4daa159f95fd57faa1166972a003984ac0c4fe1
|
233ad8007daa4606050bf6fac6c06493e32e662b
|
/RobotCode2020New/src/main/java/frc/robot/commands/shootercommands/StopJamCommandGroup.java
|
f412214a2eeafd2f87adda04e6d7ed4941e94307
|
[] |
no_license
|
FRC930/Robot2020
|
278ffc7393b7272aef386cf39a9140a2ff7e6311
|
6185806422ec01fa8692cc4369e8007b252e6c4c
|
refs/heads/master
| 2021-07-08T11:11:06.720580
| 2020-12-22T19:07:00
| 2020-12-22T19:07:00
| 220,355,982
| 4
| 1
| null | 2020-12-22T19:07:01
| 2019-11-08T00:43:56
|
Java
|
UTF-8
|
Java
| false
| false
| 2,188
|
java
|
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
//-------- IMPORTS --------\\
package frc.robot.commands.shootercommands;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.ParallelRaceGroup;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import frc.robot.commands.hoppercommands.StopHopperStateCommand;
import frc.robot.commands.kickercommands.StopKickerCommand;
import frc.robot.commands.towercommands.ReverseTowerCommand;
import frc.robot.subsystems.KickerSubsystem;
import frc.robot.subsystems.TowerSubsystem;
//-------- COMMANDGROUP CLASS --------\\
/**
* There are two constructors for teleop and auton. The first is for auton and does not require a value to end the command group.
* The second takes a Joystick Button to stop the command group.
*/
public class StopJamCommandGroup extends ParallelRaceGroup {
//-------- CONSTRUCTORS --------\\
public StopJamCommandGroup(
TowerSubsystem towerSubsystem,
KickerSubsystem kSubsystem)
{
//Run all required commands in order so we can shoot.
addCommands(//new CheckIfShotPossibleCommand(limeLight, flywheelPistonSubsystem),
new SequentialCommandGroup(
// new RampShooterCommand(flywheelSubsystem),
// new RunFlywheelCommand(flywheelSubsystem, Constants.FLYWHEEL_SPEED),
//ShooterMath.getInstance(limeLight.getHorizontalOffset(),
//limeLight.getDistance()).getVelocity()),
new ParallelCommandGroup(new StopHopperStateCommand(), new ReverseTowerCommand(towerSubsystem), new StopKickerCommand(kSubsystem))
)
);
} // End of Constructor
} // End of Class
|
[
"aocampo2862@gmail.com"
] |
aocampo2862@gmail.com
|
4a266eb1e06d747743a7f1d9534dae5f06dd667e
|
2d35a415a7f6d208143a081fb789993d1040955d
|
/app/src/main/java/com/lala/lashop/ui/cate/SearchFragment.java
|
b302bf7c0e04c116a3ee8356f83e299e6c72439f
|
[] |
no_license
|
ch3ngxuyuan/LaShop
|
fba5b8768f4960bb86a7f46e07f930861d0ab3b2
|
23721fa463005ef68b448518e9369abab2ac35df
|
refs/heads/master
| 2020-03-23T15:01:43.653398
| 2018-04-25T09:25:43
| 2018-04-25T09:25:43
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,624
|
java
|
package com.lala.lashop.ui.cate;
import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ProgressBar;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.lala.lashop.R;
import com.lala.lashop.base.BaseFragment;
import com.lala.lashop.base.mvp.CreatePresenter;
import com.lala.lashop.ui.cate.adapter.SearchAdapter;
import com.lala.lashop.ui.cate.presenter.SearchPresenter;
import com.lala.lashop.ui.cate.view.SearchView;
import com.lala.lashop.ui.home.bean.ShopsBean;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* 查询结果
* Created by JX on 2018/3/28.
*/
@CreatePresenter(SearchPresenter.class)
public class SearchFragment extends BaseFragment<SearchView, SearchPresenter> implements SearchView {
@BindView(R.id.cate_search_rv)
RecyclerView rv;
@BindView(R.id.cate_search_progress)
ProgressBar progressBar;
private SearchAdapter mAdapter;
private List<ShopsBean> mData;
private String smallId;
@Override
public int setContentView() {
return R.layout.cate_search_fragment;
}
@Override
public void onCreate() {
mData = new ArrayList<>();
mAdapter = new SearchAdapter(R.layout.cate_search_rv_item, mData);
rv.setLayoutManager(new LinearLayoutManager(getActivity()));
rv.setAdapter(mAdapter);
rv.addItemDecoration(new DividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL));
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
Bundle bundle = new Bundle();
bundle.putString(ShopInfoActivity.SHOP_ID, mData.get(position).getId());
startActivity(ShopInfoActivity.class, bundle);
}
});
}
public void getData(String smallId) {
this.smallId = smallId;
showLoadingView();
getPresenter().search();
}
@Override
public void setData(List<ShopsBean> data) {
mAdapter.setNewData(data);
mData = mAdapter.getData();
}
@Override
public String getSmallId() {
return smallId;
}
@Override
public void showLoadingView() {
progressBar.setVisibility(View.VISIBLE);
}
@Override
public void hideMultipleView() {
progressBar.setVisibility(View.GONE);
}
}
|
[
"913835745@qq.com"
] |
913835745@qq.com
|
66a4bb3715181dd0718f3d232c60a8b5d4ad4728
|
3707564e7a9f5acb9bf784c28d9773950a29c7d1
|
/app/src/main/java/com/haobin/watermelon_all_summer/module/main/SplashActivity.java
|
8d49150f63ae0973c6589a30524b1b4200a81e5a
|
[
"Apache-2.0"
] |
permissive
|
WengHaobin/WatermelonAllSummer
|
a6cb87a4a32119bb93f17b7321d8da418a058f5a
|
74938f49713db053c453fd32c0d8a8052acaec2d
|
refs/heads/master
| 2020-03-31T20:55:05.057598
| 2018-11-14T02:44:03
| 2018-11-14T02:44:03
| 152,560,403
| 5
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,978
|
java
|
package com.haobin.watermelon_all_summer.module.main;
import android.animation.Animator;
import android.os.Bundle;
import com.airbnb.lottie.LottieAnimationView;
import com.haobin.watermelon_all_summer.R;
import butterknife.BindView;
import cn.droidlover.xdroidmvp.mvp.XActivity;
import cn.droidlover.xdroidmvp.router.Router;
/**
* Created by Wenghaobin
* on 2018/10/9
* for 启动页
*/
public class SplashActivity extends XActivity {
@BindView(R.id.animation_splash)
LottieAnimationView animationSplash;
@Override
public void initData(Bundle savedInstanceState) {
//开始动画
startAnimation();
//动画状态监听,完成了就跳转主页
animationSplash.addAnimatorListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
goToMain();
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
}
private void goToMain(){
Router.newIntent(context).to(MainActivity.class).launch();
finish();
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}
@Override
public int getLayoutId() {
return R.layout.activity_splash;
}
@Override
public Object newP() {
return null;
}
private void startAnimation() {
animationSplash.setAnimation("splash.json");
animationSplash.playAnimation();
}
private void cancelAnimation() {
if (animationSplash != null) {
animationSplash.cancelAnimation();
}
}
@Override
protected void onDestroy() {
cancelAnimation();
super.onDestroy();
}
}
|
[
"532602716@qq.com"
] |
532602716@qq.com
|
6be44843879a0df7e7d30f11c9e59fb08f7f0586
|
2b9f6c744351ce09677d07bdedc106b298e39c5c
|
/WM_Manhattan_Automation/src/main/java/PageObjects/NewTest.java
|
152dfffc252f5f5e6f8945d51b73faa1c9a70c46
|
[] |
no_license
|
Arun2254/WM_Manhattan_Automation
|
7b09155c9671d1d7caa90b288606bec2f95a8b3e
|
987e5f8bd43bebd9beb43d7d8a6b1e321b0b355d
|
refs/heads/master
| 2020-03-24T05:13:57.419259
| 2018-07-30T17:59:51
| 2018-07-30T17:59:51
| 142,480,403
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 806
|
java
|
package PageObjects;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class NewTest {
public WebDriver driver;
@BeforeTest
public void beforeTest(){
System.out.println("Before Test");
System.setProperty("webdriver.gecko.driver", "Dependencies/geckodriver_mac");
driver = new FirefoxDriver();
}
@Test
public void testEasy(){
driver.get("https://www.guru99.com/maven-jenkins-with-selenium-complete-tutorial.html");
System.out.println("Inside Test");
}
@AfterTest
public void afterTest(){
System.out.println(driver.getTitle());
System.out.println("After Test");
driver.quit();
}
}
|
[
"arun.yellapu7@gmail.com"
] |
arun.yellapu7@gmail.com
|
23f34151555d0ced2e04b1bace62f08d08346aae
|
b55a861772bdc064f644ae51431f07f75bf2ae29
|
/src/main/java/blog/template/AbsAccount.java
|
983585abbb3ec0eba55c9ead66e6486d69b2d472
|
[] |
no_license
|
nextGood/designPattern
|
f1754cd887a1b8e299c3f0ba344ce2c4b3ff73a6
|
93f0323da130eea4ae2a1e1dc080f2a71083a0e6
|
refs/heads/master
| 2021-07-09T16:45:57.170301
| 2017-10-12T02:15:23
| 2017-10-12T02:15:23
| 106,361,871
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,021
|
java
|
package blog.template;
import java.math.BigDecimal;
/**
* Created by nextGood on 2017/10/9.
*/
public abstract class AbsAccount implements IAccount {
@Override
public Double calculateInterest(Double capital) {
Double interestRate = doCalculateInterestRate();
//由于Java的简单类型不能够精确的对浮点数进行运算,BigDecimal提供精确的浮点数运算,包括加减乘除和四舍五入
return new BigDecimal(capital).multiply(new BigDecimal(interestRate)).doubleValue();
}
@Override
public Double calculateAmount(Double capital) {
//由于Java的简单类型不能够精确的对浮点数进行运算,BigDecimal提供精确的浮点数运算,包括加减乘除和四舍五入
return new BigDecimal(capital).add(new BigDecimal(calculateInterest(capital))).doubleValue();
}
/**
* 获取不同帐号类型的利息,由子类实现
*
* @return
*/
public abstract Double doCalculateInterestRate();
}
|
[
"lumingan@mindai.com"
] |
lumingan@mindai.com
|
dcdd78a6d638cef33614eb828081701b73f16a6a
|
c8d4d58f2c0af0d761c514d47277cf5d8bdbb6f5
|
/com/bridgelabz/fellowshipprogramss/functional/Quadratic.java
|
5aa87ea995512f3de4c3613f6f094002bf34271a
|
[] |
no_license
|
Pramila0526/Week1Programs
|
23d7b20220432771c29044a6fc3cf6b9050c2951
|
544584ff994aa05461fcf1e8c0dfad7abe91a097
|
refs/heads/master
| 2020-12-13T00:44:43.224835
| 2020-01-16T08:19:31
| 2020-01-16T08:19:31
| 234,269,357
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 490
|
java
|
/**
* @author : Pramila0526
* Date : 9/11/2019
* Purpose: Quadratic Equation.
*
*/
package com.bridgelabz.fellowshipprogramss.functional;
import com.bridgelabz.fellowshipprogramss.utility.Utility;
public class Quadratic {
public static void main(String[] args)
{
System.out.println("Enter the value of a b and c");
double a=Utility.doubleInput();
double b=Utility.doubleInput();
double c=Utility.doubleInput();
System.out.println(Utility.quadratic(a,b,c));
}
}
|
[
"pramila.tawari2607@gmail.com"
] |
pramila.tawari2607@gmail.com
|
9b05e27529761fba841c1fd1faf79a3ac3bb18b9
|
7ab0fddb577c06989c3718fd50f7250fcbe81821
|
/AlternativeQL/src/org/qls/ast/widget/default_widget/DefaultWidgetSet.java
|
0b22b1315543a3338417d40280f3249c55739fc3
|
[] |
no_license
|
thanus/myriad-ql
|
54ce0d4dfbd5336c9f5c1d9b7ebf7072d6bdb4a0
|
a7294c108f35a4b1c0ba90982aa41f93f7a68a51
|
refs/heads/master
| 2020-12-02T17:45:40.794417
| 2017-04-24T20:39:04
| 2017-04-24T20:39:04
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 877
|
java
|
package org.qls.ast.widget.default_widget;
import org.ql.ast.type.Type;
import org.qls.ast.page.CustomWidgetQuestion;
import java.util.HashSet;
import java.util.Set;
public class DefaultWidgetSet {
private final Set<DefaultWidget> widgetSet = new HashSet<>();
public void add(DefaultWidget defaultWidget) {
widgetSet.add(defaultWidget);
}
public void mergeWith(DefaultWidgetSet defaultWidgets) {
widgetSet.addAll(defaultWidgets.widgetSet);
}
public DefaultWidget lookupByType(Type type) {
for (DefaultWidget widget : widgetSet) {
if (widget.getType().equals(type)) {
return widget;
}
}
return null;
}
public boolean existsByType(Type type) {
return lookupByType(type) != null;
}
public int size() {
return widgetSet.size();
}
}
|
[
"joan.grigorov@gmail.com"
] |
joan.grigorov@gmail.com
|
ed3c85a830868271a193081d2331999cfab0e357
|
c81c8ec8a271bb6cefc39f8350491d349c27614d
|
/test.java
|
8777b4e043dd06d40186daa1e2b8688472ee1caf
|
[] |
no_license
|
Natthapolmnc/DataStructure
|
2445beb98ffb9b2d10dfacc4a1a379ac178a73ec
|
7c59ce5a15ea56d65c0fbf8976bf93ed92e27be8
|
refs/heads/master
| 2022-12-17T08:33:44.281624
| 2020-09-19T02:38:53
| 2020-09-19T02:38:53
| 296,772,132
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 142
|
java
|
import java.util.LinkedList;
class test{
public static void main(String[] args) {
int array[]= {12312,3,2};
array.size
}
|
[
"natthapol3011@gmail"
] |
natthapol3011@gmail
|
ac45d9b4d17c030382d9d27ebbf88999147840c3
|
ccd3ca6e9d0c03b3f7e88d2da97af0c08599e852
|
/Tema9/Ejercicio02Prueba.java
|
4c68a9f5bcc3f0c2c5c3e45e092166ce600d55f7
|
[] |
no_license
|
JorgeAlcarazKuv/EjerciciosAsignaturaProgramacion
|
ee1f2c348d3a4319bebdd7aa8806b1f6ee310b14
|
28a0fda62f846495d1c4e060c10c75f5cf777fa6
|
refs/heads/master
| 2021-01-12T16:17:59.001601
| 2017-02-01T07:30:15
| 2017-02-01T07:30:15
| 70,043,540
| 5
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,545
|
java
|
import java.util.Scanner;
/*
* @author Jorge Alcaraz Bravo
* Tema 9 Ejercicio 02
*
*/
public class Ejercicio02Prueba {
public static void main (String[] args) {
Scanner t = new Scanner(System.in);
Ejercicio02Bicicleta bici1 = new Ejercicio02Bicicleta(20);
Ejercicio02Coche coche1 = new Ejercicio02Coche(52);
coche1.setKilometrosRecorridos(12);
System.out.println("1.- Anda con la bicicleta");
System.out.println("2.- Haz el caballito con la bicicleta");
System.out.println("3.- Anda con el coche");
System.out.println("4.- Quema rueda con el coche");
System.out.println("5.- Ver kilometraje de la bicicleta");
System.out.println("6.- Ver kilometraje del coche");
System.out.println("7.- Ver kilometraje total");
System.out.println("8.- Salir");
int eleccion = 0;
while (eleccion != 8) {
System.out.print("Introduce un número: ");
eleccion = t.nextInt();
switch (eleccion) {
case 1:
bici1.andar();
break;
case 2:
bici1.hacerCaballito();
break;
case 3:
coche1.andar();
break;
case 4:
coche1.quemarRueda();
break;
case 5:
System.out.println(bici1.getKilometrosRecorridos());
break;
case 6:
System.out.println(coche1.getKilometrosRecorridos());
break;
case 7:
System.out.println(Ejercicio02Vehiculo.getKilometrosTotales());
break;
default:
}
}
}
}
|
[
"jrg.kuv@gmail.com"
] |
jrg.kuv@gmail.com
|
143f6a0d99f0e3c655187bdf32ab507585cc9a0e
|
18ee7d3df0879e14aa1fd2f176dc07f544c54817
|
/interno/src/main/java/interno/bo/ChamadoTabletBO.java
|
36c2316ba75ce332ece84c925fe0beacb2d38b70
|
[
"Apache-2.0"
] |
permissive
|
rlc07/interno
|
f2706ee7816fbf9990adfe968a3b8052a7631a4b
|
db5b418915fe05b45c6b1b976475bdb23f1b9a5d
|
refs/heads/master
| 2021-01-21T14:39:42.411235
| 2017-06-25T00:45:01
| 2017-06-25T00:45:01
| 89,748,904
| 0
| 0
| null | null | null | null |
ISO-8859-1
|
Java
| false
| false
| 3,120
|
java
|
/**
*
*/
package interno.bo;
import java.util.List;
import interno.dao.ChamadoTabletDAO;
import interno.modelo.ChamadoTablet;
/**
* @author Ronaldo
*25 de mar de 2017
*/
public class ChamadoTabletBO {
private ChamadoTabletDAO dao;
public ChamadoTabletBO(){
dao = new ChamadoTabletDAO();
}
public boolean cadastrarChamadoTablet(ChamadoTablet tablet){
boolean isValido = false;
try{
if(dao.persist(tablet)){
isValido = true;
}
}catch (Exception e) {
System.out.println("Erro ao cadastrar chamado de tablet: "+e.getMessage());
}
return isValido;
}
public List<ChamadoTablet> listarNumChamado(String numChamado){
List<ChamadoTablet> tablet = null;
try{
tablet = dao.listarNumChamado(numChamado);
}catch (Exception e) {
System.out.println("Erro ao listar chamado de tablet por numero de chamado interno: " +e.getMessage());
}
return tablet;
}
public ChamadoTablet recuperaPorID(int id){
ChamadoTablet tb = null;
try{
tb = dao.recuperaPorId(id);
}catch (Exception e) {
System.out.println("Erro ao recuperar chamado de tablet por id: " +e.getMessage());
}
return tb;
}
public boolean atualiza(ChamadoTablet tablet){
boolean isValido = false;
try{
if(dao.update(tablet)){
isValido = true;
}
}catch (Exception e) {
System.out.println("Erro ao atualizar tablet: "+e.getMessage());
}
return isValido;
}
/*Verifica se exite um tecnico responsavel pelo tablet*/
public List<ChamadoTablet> verificaTecnicoResponsavel(String chamado){
List<ChamadoTablet> tecnico = null;
try{
tecnico = dao.verificaTecnicoResponsavel(chamado);
}catch (Exception e) {
System.out.println("Erro ao verificar tecnico existente: "+e.getMessage());
}
return tecnico;
}
/*Lisa tablet manutenção*/
public List<ChamadoTablet> lsTabletManutencao(){
List<ChamadoTablet> lsTabletManutencao = null;
try{
lsTabletManutencao = dao.lsTabletManutencao();
}catch (Exception e) {
System.out.println("Erro ao listar tablet manutencao: "+e.getMessage());
}
return lsTabletManutencao;
}
/*Lista Tablet por filtro*/
public List<ChamadoTablet> listaFiltro(String condicao){
List<ChamadoTablet> lista = null;
try{
lista = dao.listaFiltro(condicao);
}catch (Exception e) {
System.out.println("Erro ao listar tablet manutencao por filtro (BO): "+e.getMessage());
}
return lista;
}
/*Verifica se o usuario x e responsavel pelo tablet*/
public List<ChamadoTablet> verificaTecnico(String nome){
List<ChamadoTablet> lista = null;
try{
lista = dao.verificaTecnico(nome);
}catch (Exception e) {
System.out.println("Erro ao listartecnico responsavel pelo tablet (BO): "+e.getMessage());
}
return lista;
}
/*Verifica se o usuario x e responsavel pelo tablet*/
public List<ChamadoTablet> verificaTecnicoQuantidade(String nome){
List<ChamadoTablet> lista = null;
try{
lista = dao.verificaTecnicoQuantidade(nome);
}catch (Exception e) {
System.out.println("Erro ao listartecnico responsavel pelo tablet (BO): "+e.getMessage());
}
return lista;
}
}
|
[
"ronaldo.lc95@hotmail.com"
] |
ronaldo.lc95@hotmail.com
|
5f34a5763521c5a0c4bb1522c05c63a44b1a2864
|
e3b5d5d0137f12720c4c2ea190c9f872412c1f9c
|
/app/src/main/java/winning/zhihuibj/fragment/LeftFragment.java
|
be44678b4b9623e84a9e27f01a95b79109199793
|
[] |
no_license
|
yeluowuhen52/ZhiHuiBJ
|
cf8b8d845d6b4d48d7c85c020729e20529be1cce
|
35c46c114ea1edb6ca7909e2e1ae3f97103d1c00
|
refs/heads/master
| 2021-06-14T00:45:53.160251
| 2016-12-01T03:40:01
| 2016-12-01T03:40:01
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 657
|
java
|
package winning.zhihuibj.fragment;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import winning.zhihuibj.Base.BaseFragment;
/**
* Created by Jiang on 2016/11/10.
*/
public class LeftFragment extends BaseFragment {
@Override
protected View initView() {
TextView tv = new TextView(getActivity());
tv.setText("左侧菜单");
return tv;
}
@Override
protected void initData() {
}
}
|
[
"JTQc5235"
] |
JTQc5235
|
b6626adc1a62e4473a97fc62a6b6c9d3c5c4bfd0
|
82ead8c00b33e93bada3d430764f958cabcaf551
|
/src/main/java/whitesquare/glslcross/glslcompiler/BytecodeVisitor.java
|
8c9b288eec3f7f06ac16bcddf6546308a4af9590
|
[
"MIT"
] |
permissive
|
baaahs/fragbyte
|
43b0d98c4f04f047db8a1067ddf1351d6add16b4
|
5470ec1105a8563917588b6557772cbd1fd4e76e
|
refs/heads/master
| 2020-06-06T01:28:32.322888
| 2019-06-20T01:58:40
| 2019-06-20T01:58:40
| 192,601,203
| 0
| 0
| null | 2019-06-18T19:33:40
| 2019-06-18T19:33:39
| null |
UTF-8
|
Java
| false
| false
| 5,482
|
java
|
package whitesquare.glslcross.glslcompiler;
import java.util.Stack;
import whitesquare.glslcross.ast.ASTVisitor;
import whitesquare.glslcross.ast.Assignment;
import whitesquare.glslcross.ast.BinaryOp;
import whitesquare.glslcross.ast.Block;
import whitesquare.glslcross.ast.Construction;
import whitesquare.glslcross.ast.Function;
import whitesquare.glslcross.ast.FunctionCall;
import whitesquare.glslcross.ast.Loop;
import whitesquare.glslcross.ast.Parameter;
import whitesquare.glslcross.ast.ReturnStatement;
import whitesquare.glslcross.ast.SwizzleValue;
import whitesquare.glslcross.ast.TernaryOp;
import whitesquare.glslcross.ast.Type;
import whitesquare.glslcross.ast.UnaryOp;
import whitesquare.glslcross.ast.Unit;
import whitesquare.glslcross.ast.Value;
import whitesquare.glslcross.ast.Variable;
import whitesquare.glslcross.ast.VariableLoad;
import whitesquare.glslcross.ast.VariableStore;
import whitesquare.glslcross.bytecode.Bytecode;
public class BytecodeVisitor implements ASTVisitor {
private LogWriter log;
private BytecodeWriter writer;
private Variable tempVar;
private Stack<Parameter> parameters = new Stack<>();
public BytecodeVisitor(BytecodeWriter writer, LogWriter log, Variable tempVar) {
this.writer = writer;
this.log = log;
this.tempVar = tempVar;
}
@Override
public void visitAssignment(Assignment assignment) {
if (assignment.value.type.size == 1 && assignment.dest.type.size > 1) {
writer.writeWideOp(Bytecode.DUPS, assignment.dest.type.size - 1);
}
}
@Override
public void visitBinaryOpBegin(BinaryOp op) {
}
@Override
public void visitBinaryOpMid(BinaryOp op) {
Type a = op.left.type, b = op.right.type;
if (a.size != b.size && a.size == 1) writer.writeWideOp(Bytecode.DUPS, b.size - a.size);
}
@Override
public void visitBinaryOpEnd(BinaryOp op) {
Type a = op.left.type, b = op.right.type;
if (a.size != b.size && b.size == 1) writer.writeWideOp(Bytecode.DUPS, a.size - b.size);
int size = Math.max(a.size, b.size);
writer.writeWideOp(Bytecode.valueOf(op.op), size);
}
@Override
public void visitBlockStart(Block block) {
}
@Override
public void visitBlockEnd(Block block) {
}
@Override
public void visitConstruction(Construction construction) {
if (construction.arguments.size() == 1) {
Type argType = construction.arguments.get(0).type;
if (construction.type.size > argType.size)
writer.writeWideOp(Bytecode.DUPS, construction.type.size - argType.size);
}
}
@Override
public void visitFunctionCall(FunctionCall call) {
writer.write(Bytecode.CALL, call.function.name);
}
@Override
public void visitFunctionBegin(Function func) {
writer.write(Bytecode.FUNC, func.name, func.inputSize, func.outputSize);
}
@Override
public void visitFunctionMid(Function func) {
while (!parameters.isEmpty()) {
Parameter parm = parameters.pop();
writer.store(parm.variable);
}
}
@Override
public void visitFunctionEnd(Function func) {
writer.write(Bytecode.RETURN);
}
@Override
public void visitLoopBegin(Loop loop) {
writer.write(Bytecode.REPEAT, loop.iterations);
}
@Override
public void visitLoopEnd(Loop loop) {
writer.write(Bytecode.ENDREPEAT);
}
@Override
public void visitParameter(Parameter parameter) {
parameters.push(parameter);
}
@Override
public void visitReturnStatement(ReturnStatement rtrn) {
writer.write(Bytecode.RETURN);
}
@Override
public void visitSwizzleValue(SwizzleValue swizzleValue) {
writer.shift(swizzleValue.swizzle, tempVar);
}
@Override
public void visitTernaryOpAfterFirst(TernaryOp op) {
Type a = op.left.type, b = op.mid.type, c = op.right.type;
int maxSize = Math.max(Math.max(a.size, b.size), c.size);
if (a.size != maxSize && a.size == 1) writer.writeWideOp(Bytecode.DUPS, maxSize - a.size);
}
@Override
public void visitTernaryOpAfterSecond(TernaryOp op) {
Type a = op.left.type, b = op.mid.type, c = op.right.type;
int maxSize = Math.max(Math.max(a.size, b.size), c.size);
if (b.size != maxSize && b.size == 1) writer.writeWideOp(Bytecode.DUPS, maxSize - b.size);
}
@Override
public void visitTernaryOpEnd(TernaryOp op) {
Type a = op.left.type, b = op.mid.type, c = op.right.type;
int maxSize = Math.max(Math.max(a.size, b.size), c.size);
if (c.size != maxSize && c.size == 1) writer.writeWideOp(Bytecode.DUPS, maxSize - c.size);
writer.writeWideOp(Bytecode.valueOf(op.op), op.type.size);
}
@Override
public void visitUnaryOp(UnaryOp op) {
writer.writeWideOp(Bytecode.valueOf(op.op), op.input.type.size);
}
@Override
public void visitUnitStart(Unit unit) {
for (Variable input : unit.inputs)
writer.input(input.name, input);
for (Variable output : unit.outputs)
writer.output(output.name, output);
}
@Override
public void visitUnitEnd(Unit unit) {
}
@Override
public void visitValue(Value value) {
if (!value.constant) {
System.out.println("Value not const!!! " + value);
return;
}
if (value.type.integer)
writer.write(Bytecode.LDC, value.intValue);
else
writer.write(Bytecode.LDC, value.floatValue);
}
@Override
public void visitVariableStore(VariableStore value) {
if (value.swizzle == null)
writer.store(value.variable);
else
writer.store(value.variable, value.swizzle);
}
@Override
public void visitVariableLoad(VariableLoad value) {
if (value.swizzle == null)
writer.load(value.variable);
else
writer.load(value.variable, value.swizzle);
}
}
|
[
"divan.burger@gmail.com"
] |
divan.burger@gmail.com
|
4007762367e544ac66b7196ef1c1e1ea613c3460
|
335708075b090668bd102ed547c61286a304f2d7
|
/pammClient/imported/org/client/grid/properties/Property.java
|
711a4e6f7bf9e711e96854e932ccc42da6c41b24
|
[] |
no_license
|
yudin-s/pammAnalytics
|
6f4288dd68cb39fcff0e6f938315c5db481b8db2
|
3d8e10b1530e553d3c8c951ee8d1ab82ef5a396c
|
refs/heads/master
| 2020-03-28T11:24:13.039414
| 2018-09-10T19:39:06
| 2018-09-10T19:39:06
| 148,208,928
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,518
|
java
|
package org.client.grid.properties;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
/**
* Java bean which contains all information about cell.
*
*/
public class Property {
private Object value;
private String text;
private String toolTip;
private Image image;
private Color textColor;
private Color backgroundColor;
private Font font;
private Boolean checked;
private Boolean checkable;
private Boolean grayed;
public Property() {
this(null);
}
/**
* Create property and initialize it's value.
* @param value value of cell
*/
public Property(Object value) {
this.value = value;
}
/**
* Create property and initialize it's value.
* Used for cells with checkbox.
* @param value value of cell text
* @param checked value of checkbox
*/
public Property(Object value, Boolean checked) {
this.value = value;
this.checked = checked;
}
public Object getValue() {
return value;
}
public Property setValue(Object value) {
this.value = value;
return this;
}
public String getText() {
return text;
}
public Property setText(String text) {
this.text = text;
return this;
}
public String getToolTip() {
return toolTip;
}
public Property setToolTip(String toolTip) {
this.toolTip = toolTip;
return this;
}
public Image getImage() {
return image;
}
public Property setImage(Image image) {
this.image = image;
return this;
}
public Color getTextColor() {
return textColor;
}
public Property setTextColor(Color textColor) {
this.textColor = textColor;
return this;
}
public Color getBackgroundColor() {
return backgroundColor;
}
public Property setBackgroundColor(Color backgroundColor) {
this.backgroundColor = backgroundColor;
return this;
}
public Font getFont() {
return font;
}
public Property setFont(Font font) {
this.font = font;
return this;
}
public Boolean isChecked() {
return checked;
}
public Property setChecked(Boolean checked) {
this.checked = checked;
return this;
}
public Boolean isCheckable() {
return checkable;
}
public Property setCheckable(Boolean checkable) {
this.checkable = checkable;
return this;
}
public Boolean isGrayed() {
return grayed;
}
public Property setGrayed(Boolean grayed) {
this.grayed = grayed;
return this;
}
}
|
[
"enfros2000@gmail.com"
] |
enfros2000@gmail.com
|
b3bc077eb2a2d072e47d4448f89dcca8a40e6b87
|
44025e778142cb077fdb2c24f9bd595c6d13ac89
|
/Arjuncarona/src/test/java/inclss.java
|
07ede8939864eb93620d2c378fdffb007c18d3a8
|
[] |
no_license
|
arjunkorandla/DemoEcommerce
|
c25d2310625df2e829214e7a77cb2d2528cef35a
|
f7b71f2bfc4a0eff8fecf9211dbe9dc40e85a738
|
refs/heads/master
| 2022-12-18T20:31:39.670280
| 2020-09-25T01:30:04
| 2020-09-25T01:30:04
| 298,436,988
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 595
|
java
|
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class inclss {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "C:\\Drverssel\\cromedrivers\\chromedriver.exe");
WebDriver object = new ChromeDriver();
object.get("https://llosite.z9.web.core.windows.net/Aut1_info.html");
object.findElement(By.xpath("/html/body/a[1]/img")).click();
}}
|
[
"arjunkorandla@gmail.com"
] |
arjunkorandla@gmail.com
|
811bcab2ac47d21a28e2af7d064e02c4d64d6fc8
|
3487fc48cec55dc022654f1d59d09d0ba31281f5
|
/src/main/java/com/kuuhaku/heartbeat/nettyServer/handle/PostManHandle.java
|
b312829e7b416b1075160c990b2ad07b5c7ca6d0
|
[] |
no_license
|
NoGame-NoLife/NettyServer
|
6a10f7ff79d6e3e04a7c761b1623019cf9d37c42
|
52aa62e7bf0f76249debe9c08f56888db93bbf3e
|
refs/heads/master
| 2022-07-24T15:04:18.098522
| 2019-12-16T10:32:58
| 2019-12-16T10:32:58
| 226,236,236
| 0
| 0
| null | 2022-06-21T02:25:54
| 2019-12-06T03:14:14
|
Java
|
UTF-8
|
Java
| false
| false
| 429
|
java
|
package com.kuuhaku.heartbeat.nettyServer.handle;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
/**
* @Description TODO
* @Author Kuuhaku
* @Date 2019/12/16 17:47
**/
public class PostManHandle extends SimpleChannelInboundHandler<byte[]> {
@Override
protected void channelRead0(ChannelHandlerContext channelHandlerContext, byte[] b) throws Exception {
}
}
|
[
"kuuhaku@msn.com"
] |
kuuhaku@msn.com
|
d29d25b3f33a43309bc4581ce6c477d87756ad90
|
fb8727dd27d9bfe71290ad4e61a318588bb52880
|
/src/main/java/org/cytoscape/pokemeow/internal/algebra/Ray3.java
|
e2562f3bb147ae9e6c0a82d32f21b7ecbe3a0bd9
|
[] |
no_license
|
rico2004/PokeMeow-Renderer
|
990973f987ca4d58dd228aefc4aa35d3d33cff95
|
9c1f7b38d5649532a6661482c75333b248013e1f
|
refs/heads/master
| 2021-06-22T11:41:30.400222
| 2017-08-28T17:49:57
| 2017-08-28T17:49:57
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 333
|
java
|
package main.java.org.cytoscape.pokemeow.internal.algebra;
public class Ray3
{
public Vector3 origin, direction;
public Ray3(Vector3 origin, Vector3 direction)
{
this.origin = origin;
this.direction = direction;
}
@Override
public String toString()
{
return origin.toString() + " -> " + direction.toString();
}
}
|
[
"zmh.leaves@gmail.com"
] |
zmh.leaves@gmail.com
|
067629703af6e981d2ac4a42897cec3d95c07b27
|
093e942f53979299f3e56c9ab1f987e5e91c13ab
|
/storm-server/src/main/java/org/apache/storm/daemon/drpc/DRPC.java
|
40939616fde88870ff69fb325200f27546b3308a
|
[
"Apache-2.0",
"GPL-1.0-or-later",
"BSD-3-Clause",
"MIT",
"BSD-2-Clause"
] |
permissive
|
Whale-Storm/Whale
|
09bab86ce0b56412bc1b984bb5d47935cf0814aa
|
9b3e5e8bffbeefa54c15cd2de7f2fb67f36d64b2
|
refs/heads/master
| 2022-09-26T10:56:51.916884
| 2020-06-11T08:36:44
| 2020-06-11T08:36:44
| 266,803,131
| 3
| 0
|
Apache-2.0
| 2022-09-17T00:00:04
| 2020-05-25T14:39:22
|
Java
|
UTF-8
|
Java
| false
| false
| 10,141
|
java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.storm.daemon.drpc;
import java.security.Principal;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.storm.DaemonConfig;
import org.apache.storm.daemon.StormCommon;
import org.apache.storm.generated.AuthorizationException;
import org.apache.storm.generated.DRPCExceptionType;
import org.apache.storm.generated.DRPCExecutionException;
import org.apache.storm.generated.DRPCRequest;
import org.apache.storm.logging.ThriftAccessLogger;
import org.apache.storm.metric.StormMetricsRegistry;
import org.apache.storm.security.auth.IAuthorizer;
import org.apache.storm.security.auth.ReqContext;
import org.apache.storm.security.auth.authorizer.DRPCAuthorizerBase;
import org.apache.storm.utils.ObjectReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.codahale.metrics.Meter;
import com.google.common.annotations.VisibleForTesting;
public class DRPC implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(DRPC.class);
private static final DRPCRequest NOTHING_REQUEST = new DRPCRequest("","");
private static final DRPCExecutionException TIMED_OUT = new DRPCExecutionException("Timed Out");
private static final DRPCExecutionException SHUT_DOWN = new DRPCExecutionException("Server Shutting Down");
private static final DRPCExecutionException DEFAULT_FAILED = new DRPCExecutionException("Request failed");
static {
TIMED_OUT.set_type(DRPCExceptionType.SERVER_TIMEOUT);
SHUT_DOWN.set_type(DRPCExceptionType.SERVER_SHUTDOWN);
DEFAULT_FAILED.set_type(DRPCExceptionType.FAILED_REQUEST);
}
private static final Meter meterServerTimedOut = StormMetricsRegistry.registerMeter("drpc:num-server-timedout-requests");
private static final Meter meterExecuteCalls = StormMetricsRegistry.registerMeter("drpc:num-execute-calls");
private static final Meter meterResultCalls = StormMetricsRegistry.registerMeter("drpc:num-result-calls");
private static final Meter meterFailRequestCalls = StormMetricsRegistry.registerMeter("drpc:num-failRequest-calls");
private static final Meter meterFetchRequestCalls = StormMetricsRegistry.registerMeter("drpc:num-fetchRequest-calls");
private static IAuthorizer mkAuthorizationHandler(String klassname, Map<String, Object> conf) {
try {
return StormCommon.mkAuthorizationHandler(klassname, conf);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private static void logAccess(String operation, String function) {
logAccess(ReqContext.context(), operation, function);
}
private static void logAccess(ReqContext reqContext, String operation, String function) {
ThriftAccessLogger.logAccessFunction(reqContext.requestID(), reqContext.remoteAddress(), reqContext.principal(), operation,
function);
}
@VisibleForTesting
static void checkAuthorization(ReqContext reqContext, IAuthorizer auth, String operation, String function)
throws AuthorizationException {
checkAuthorization(reqContext, auth, operation, function, true);
}
private static void checkAuthorization(ReqContext reqContext, IAuthorizer auth, String operation, String function, boolean log)
throws AuthorizationException {
if (reqContext != null && log) {
logAccess(reqContext, operation, function);
}
if (auth != null) {
Map<String, Object> map = new HashMap<>();
map.put(DRPCAuthorizerBase.FUNCTION_NAME, function);
if (!auth.permit(reqContext, operation, map)) {
Principal principal = reqContext.principal();
String user = (principal != null) ? principal.getName() : "unknown";
throw new AuthorizationException("DRPC request '" + operation + "' for '" + user + "' user is not authorized");
}
}
}
//Waiting to be fetched
private final ConcurrentHashMap<String, ConcurrentLinkedQueue<OutstandingRequest>> _queues =
new ConcurrentHashMap<>();
//Waiting to be returned
private final ConcurrentHashMap<String, OutstandingRequest> _requests =
new ConcurrentHashMap<>();
private final Timer _timer = new Timer();
private final AtomicLong _ctr = new AtomicLong(0);
private final IAuthorizer _auth;
public DRPC(Map<String, Object> conf) {
this(mkAuthorizationHandler((String)conf.get(DaemonConfig.DRPC_AUTHORIZER), conf),
ObjectReader.getInt(conf.get(DaemonConfig.DRPC_REQUEST_TIMEOUT_SECS), 600) * 1000);
}
public DRPC(IAuthorizer auth, long timeoutMs) {
_auth = auth;
_timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
cleanupAll(timeoutMs, TIMED_OUT);
}
}, timeoutMs/2, timeoutMs/2);
}
private void checkAuthorization(String operation, String function) throws AuthorizationException {
checkAuthorization(ReqContext.context(), _auth, operation, function);
}
private void checkAuthorizationNoLog(String operation, String function) throws AuthorizationException {
checkAuthorization(ReqContext.context(), _auth, operation, function, false);
}
private void cleanup(String id) {
OutstandingRequest req = _requests.remove(id);
if (req != null && !req.wasFetched()) {
_queues.get(req.getFunction()).remove(req);
}
}
private void cleanupAll(long timeoutMs, DRPCExecutionException exp) {
for (Entry<String, OutstandingRequest> e : _requests.entrySet()) {
OutstandingRequest req = e.getValue();
if (req.isTimedOut(timeoutMs)) {
req.fail(exp);
cleanup(e.getKey());
meterServerTimedOut.mark();
}
}
}
private String nextId() {
return String.valueOf(_ctr.incrementAndGet());
}
private ConcurrentLinkedQueue<OutstandingRequest> getQueue(String function) {
if (function == null) {
throw new IllegalArgumentException("The function for a request cannot be null");
}
ConcurrentLinkedQueue<OutstandingRequest> queue = _queues.get(function);
if (queue == null) {
_queues.putIfAbsent(function, new ConcurrentLinkedQueue<>());
queue = _queues.get(function);
}
return queue;
}
public void returnResult(String id, String result) throws AuthorizationException {
meterResultCalls.mark();
LOG.debug("Got a result {} {}", id, result);
OutstandingRequest req = _requests.get(id);
if (req != null) {
checkAuthorization("result", req.getFunction());
req.returnResult(result);
}
}
public DRPCRequest fetchRequest(String functionName) throws AuthorizationException {
meterFetchRequestCalls.mark();
checkAuthorizationNoLog("fetchRequest", functionName);
ConcurrentLinkedQueue<OutstandingRequest> q = getQueue(functionName);
OutstandingRequest req = q.poll();
if (req != null) {
//Only log accesses that fetched something
logAccess("fetchRequest", functionName);
req.fetched();
DRPCRequest ret = req.getRequest();
return ret;
}
return NOTHING_REQUEST;
}
public void failRequest(String id, DRPCExecutionException e) throws AuthorizationException {
meterFailRequestCalls.mark();
LOG.debug("Got a fail {}", id);
OutstandingRequest req = _requests.get(id);
if (req != null) {
checkAuthorization("failRequest", req.getFunction());
if (e == null) {
e = DEFAULT_FAILED;
}
req.fail(e);
}
}
public <T extends OutstandingRequest> T execute(String functionName, String funcArgs, RequestFactory<T> factory) throws AuthorizationException {
meterExecuteCalls.mark();
checkAuthorization("execute", functionName);
String id = nextId();
LOG.debug("Execute {} {}", functionName, funcArgs);
T req = factory.mkRequest(functionName, new DRPCRequest(funcArgs, id));
_requests.put(id, req);
ConcurrentLinkedQueue<OutstandingRequest> q = getQueue(functionName);
q.add(req);
return req;
}
public String executeBlocking(String functionName, String funcArgs) throws DRPCExecutionException, AuthorizationException {
BlockingOutstandingRequest req = execute(functionName, funcArgs, BlockingOutstandingRequest.FACTORY);
try {
LOG.debug("Waiting for result {} {}",functionName, funcArgs);
return req.getResult();
} catch (DRPCExecutionException e) {
throw e;
} finally {
cleanup(req.getRequest().get_request_id());
}
}
@Override
public void close() {
_timer.cancel();
cleanupAll(0, SHUT_DOWN);
}
}
|
[
"798750509@qq.com"
] |
798750509@qq.com
|
29b66ce9b0669b8c002792cf3d07259acd83afa7
|
5699a2d087c5608d7d49fd4f036266d493712b78
|
/src/distributedsystems/Node.java
|
28eb6be54640143352d686fb01aa03bab761d23e
|
[] |
no_license
|
EddyDavies/Year2_DistributedSystem
|
deac8ea9d0f44f13d786920f2d4598fb8427348c
|
11ec26b6fb0b5bc95aa3beb61f18cc82610d29bf
|
refs/heads/master
| 2020-09-13T12:47:59.136507
| 2019-11-19T20:43:19
| 2019-11-19T20:43:19
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,375
|
java
|
package distributedsystems;
import java.util.LinkedList;
public class Node{
private final int myID; //ID of this node
private int idBefore; //ID of next node in Clockwise direction
private int idAfter; //ID of next node in Anticlockwise direction
private int leaderID; // Elected leader
private int inID; //ID recieved last round from neighbour
private int sendID; //ID sent next round to neighbour
private int nodes; //number of nodes
private String status = "uknown"; //Status of current node, leader or unkown.
private boolean notLeader = false; //number of nodes
Node(int myID, int nodes){
this.myID = myID;
this.nodes = nodes;
}
public void setIDBefore(int idBefore){
this.idBefore = idBefore;
}
public void setIDAfter(int idAfter){
this.idAfter = idAfter;
}
public int getIDBefore(){
return idBefore;
}
public int getMyID(){
return myID;
}
public int getIDAfter(){
return idAfter;
}
public void isNotLeader(boolean notLeader){
this.notLeader = notLeader;
}
public boolean isNotLeader(){
return notLeader;
}
public void runLCR(PassLCR pass){
inID = pass.getID();
pass.setID(sendID);
if(!pass.isIDSent()){
sendID = myID;
status = "unknown";
} else if(pass.isLeaderSelected()) {
leaderID = pass.getLeader();
sendID = leaderID;
} else {
if(inID > myID){
sendID = inID;
status = "not leader";
} else if (inID < myID){
sendID = myID;
status = "possible leader";
} else if (inID == myID){
sendID = myID;
pass.setLeader(myID);
pass.isLeaderSelected(true);
status = "leader";
}
}
}
public int runHS(PassHS pass, int i, int round, LinkedList<Node> graph){
i = incrementI(i,pass);
while(!pass.isSent()){
round = graph.get(i).loopHS(pass, round);
i = incrementI(i,pass);
}
return round;
}
public int loopHS (PassHS pass, int round) {
round++;
// System.out.print("id="+myID+" ");
if(pass.getID() > myID){
if(pass.getHopCount()>1){
pass.setHopCount(pass.getHopCount()-1);
} else if (pass.getHopCount()==1){
pass.setHopCount(pass.getHopCount()-1);
pass.isCW(!pass.isCW());
pass.isReturning(true);
}
} else if(pass.getID() == myID){
if(!pass.isReturnig()){
pass.isLeaderSelected(true);
pass.isSent(true);
}else{
pass.isSent(true);
}
} else if(pass.getID() < myID){
// System.out.println("here");
pass.isSent(true);
pass.isNotLeader(true);
}
return round;
}
public int incrementI(int i, PassHS pass){
if (pass.isCW() == true){
i++;
} else if (pass.isCW() == false){
i--;
}
if (i==-1) {
i=nodes-1;
}else if(i==nodes){
i=0;
}
return i;
}
}
//
////
//// while(!pass.isIDSent()){ // not back at start
// System.out.println("while i="+i);
//// i = graph.get(i).loopHS(pass, i);
//// if (i==-1) {
//// i = nodes-1;
//// }
//// }
//
//
//
//
//
//
//
//
//
//
//
//
//
////
////System.out.println("getID= " + pass.getID()+" myID=" + myID);
//System.out.println("1 i=" + i + " myID=" + myID + " getID= " + pass.getID());
////// if (pass.getID() > myID){
//System.out.println("2 i=" + i + " myID=" + myID);
////// if(pass.getHopCount() > 1){//A
//System.out.println("3 i=" + i + " myID=" + myID);
////// pass.setHopCount(pass.getHopCount()-1);
////// } else if (pass.getHopCount() == 1){//B
//System.out.println("4 i=" + i + " myID=" + myID);
////// pass.isOut(false);
////// pass.isCW(!pass.isCW());
////// pass.setHopCount(pass.getHopCount()-1);
////// status = "unkown";
////// }
////// }else if (pass.getID() == myID){
//// System.out.println("id");
////// pass.isIDSent(true);
////// if(pass.isOut()) {
//// System.out.println("leader");
////// status = "leader";
////// pass.isLeaderSelected(true);
////// }
////// } else if (pass.getID() < myID){
//System.out.println("7 i=" + i + " myID=" + myID);
////// status = "not leader";
////// notLeader = true;
////// pass.isIDSent(true);
////// }
//////
////// if (pass.isCW() == true){
//System.out.println("8 i=" + i + " myID=" + myID);
////// i++;
//System.out.println("8.2 i=" + i + " myID=" + myID);
////// } else if (pass.isCW() == false){
//System.out.println("9 i=" + i + " myID=" + myID);
////// i--;
//System.out.println("9.2 i=" + i + " myID=" + myID);
////// }
////// return i;
//cf
|
[
"Edward@family-davies.co.uk"
] |
Edward@family-davies.co.uk
|
40b01101b427983aa3ea938a0f5775f163d586ec
|
64011605ebde6b3466ececb62429328f2a3b416e
|
/app/src/main/java/com/example/duy/calculator/converter/UnitConverterChildActivity.java
|
9a86f295fd40a35a92a65d903ed674e6e752ad64
|
[
"Apache-2.0"
] |
permissive
|
x-itec/ncalc
|
67aaa9f9eca00a96d5f21490b9c93d5970cc0a52
|
49c70cc3218ef831e32927b75ded37c9d540ed68
|
refs/heads/master
| 2021-01-25T01:04:43.990836
| 2017-05-26T01:25:51
| 2017-05-26T01:25:51
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 10,939
|
java
|
/*
* Copyright 2017 Tran Le Duy
*
* 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.example.duy.calculator.converter;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import com.example.duy.calculator.activities.abstract_class.AbstractAppCompatActivity;
import com.example.duy.calculator.R;
import com.example.duy.calculator.converter.utils.AreaStrategy;
import com.example.duy.calculator.converter.utils.BitrateStrategy;
import com.example.duy.calculator.converter.utils.EnergyStrategy;
import com.example.duy.calculator.converter.utils.LengthStrategy;
import com.example.duy.calculator.converter.utils.PowerStrategy;
import com.example.duy.calculator.converter.utils.Strategy;
import com.example.duy.calculator.converter.utils.TemperatureStrategy;
import com.example.duy.calculator.converter.utils.TimeStratery;
import com.example.duy.calculator.converter.utils.VelocityStrategy;
import com.example.duy.calculator.converter.utils.VolumeStrategy;
import com.example.duy.calculator.converter.utils.WeightStrategy;
import com.google.firebase.crash.FirebaseCrash;
import java.util.ArrayList;
public class UnitConverterChildActivity extends AbstractAppCompatActivity {
String TAG = UnitConverterChildActivity.class.getName();
RecyclerView mRecycleView;
private Spinner spinner;
private EditText editText;
private Strategy strategy;
private String arrUnit[];
private UnitAdapter mUnitAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_unit_converter_child);
Intent intent = getIntent();
Bundle bundle = intent.getBundleExtra("data");
int pos = bundle.getInt("POS");
String name = bundle.getString("NAME");
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(name);
setSupportActionBar(toolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
initView();
setUpSpinnerAndStratery(pos);
}
private void setUpSpinnerAndStratery(int pos) {
arrUnit = new String[]{};
switch (pos) {
case 0: //temp
arrUnit = getResources().getStringArray(R.array.temp);
setStrategy(new TemperatureStrategy(getApplicationContext()));
break;
case 1: //WEight
arrUnit = getResources().getStringArray(R.array.weight);
setStrategy(new WeightStrategy(getApplicationContext()));
break;
case 2: //temp
arrUnit = getResources().getStringArray(R.array.length);
setStrategy(new LengthStrategy(getApplicationContext()));
break;
case 3: //temp
arrUnit = getResources().getStringArray(R.array.power);
setStrategy(new PowerStrategy(getApplicationContext()));
break;
case 4: //temp
arrUnit = getResources().getStringArray(R.array.energy);
setStrategy(new EnergyStrategy(getApplicationContext()));
break;
case 5: //temp
arrUnit = getResources().getStringArray(R.array.velocity);
setStrategy(new VelocityStrategy(getApplicationContext()));
break;
case 6: //temp
setStrategy(new AreaStrategy(getApplicationContext()));
arrUnit = getResources().getStringArray(R.array.area);
break;
case 7: //temp
arrUnit = getResources().getStringArray(R.array.volume);
setStrategy(new VolumeStrategy(getApplicationContext()));
break;
case 8: //temp
arrUnit = getResources().getStringArray(R.array.bitrate);
setStrategy(new BitrateStrategy(getApplicationContext()));
break;
case 9: //temp
arrUnit = getResources().getStringArray(R.array.time);
setStrategy(new TimeStratery(getApplicationContext()));
break;
}
ArrayAdapter<String> adapterUnit = new ArrayAdapter<>(UnitConverterChildActivity.this, android.R.layout.simple_list_item_1, arrUnit);
adapterUnit.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
spinner.setAdapter(adapterUnit);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
updateListView();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
private void initView() {
editText = (EditText) findViewById(R.id.editInput);
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
updateListView();
}
@Override
public void afterTextChanged(Editable s) {
}
});
Intent intent = getIntent();
Bundle bundle = intent.getBundleExtra("data");
String text = bundle.getString("input", "");
editText.append(text);
spinner = (Spinner) findViewById(R.id.spinner_unit);
mRecycleView = (RecyclerView) findViewById(R.id.listview);
mRecycleView.setHasFixedSize(true);
LinearLayoutManager mLayout = new LinearLayoutManager(this);
mRecycleView.setLayoutManager(mLayout);
mUnitAdapter = new UnitAdapter(this, new ArrayList<ItemUnitConverter>());
mRecycleView.setAdapter(mUnitAdapter);
}
private void updateListView() {
String currentUnit = spinner.getSelectedItem().toString();
String defaultUnit = strategy.getUnitDefault();
Log.i("currentUnit", currentUnit);
ArrayList<ItemUnitConverter> list = new ArrayList<>();
if (!editText.getText().toString().equals("")) {
try {
double input = Double.parseDouble(editText.getText().toString());
double defaultValue = strategy.Convert(currentUnit, defaultUnit, input);
Log.e("INP", String.valueOf(input));
Log.e("DEF", String.valueOf(defaultValue));
for (String anArrUnit : arrUnit) {
double res = strategy.Convert(defaultUnit, anArrUnit, defaultValue);
ItemUnitConverter itemUnitConverter = new ItemUnitConverter();
itemUnitConverter.setTitle(anArrUnit);
itemUnitConverter.setRes(String.valueOf(res));
list.add(itemUnitConverter);
}
} catch (Exception e) {
e.printStackTrace();
FirebaseCrash.report(e);
}
} else {
try {
double input = 0d;
double defaultValue = strategy.Convert(currentUnit, defaultUnit, input);
Log.e("INP", String.valueOf(input));
Log.e("DEF", String.valueOf(defaultValue));
for (String anArrUnit : arrUnit) {
double res = strategy.Convert(defaultUnit, anArrUnit, defaultValue);
ItemUnitConverter itemUnitConverter = new ItemUnitConverter();
itemUnitConverter.setTitle(anArrUnit);
itemUnitConverter.setRes(String.valueOf(res));
list.add(itemUnitConverter);
}
} catch (Exception e) {
e.printStackTrace();
FirebaseCrash.report(e);
}
}
mUnitAdapter.clear();
mUnitAdapter.addAll(list);
}
public void setStrategy(Strategy strategy) {
this.strategy = strategy;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(item);
}
// class UnitAdapter extends ArrayAdapter<ItemUnitConverter> {
// private Context mContext;
// private int resource;
// private ArrayList<ItemUnitConverter> arrayList = new ArrayList<>();
//
// public UnitAdapter(Context mContext, int resource, ArrayList<ItemUnitConverter> objects) {
// super(mContext, resource, objects);
// this.mContext = mContext;
// this.resource = resource;
// this.arrayList = objects;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
// View view = LayoutInflater.from(mContext).inflate(resource, parent, false);
// ItemUnitConverter itemUnitConverter = arrayList.get(position);
// TextView txtName = (TextView) view.findViewById(R.id.txtTitle);
// TextView txtRes = (TextView) view.findViewById(R.id.txtResult);
// txtName.setText(itemUnitConverter.getTitle());
// txtRes.setText(String.valueOf(itemUnitConverter.getRes()));
// return view;
// }
//
// @Override
// public View getDropDownView(int position, View convertView, ViewGroup parent) {
// return getView(position, convertView, parent);
// }
//
// public void addUnit(ItemUnitConverter itemUnitConverter) {
// arrayList.add(itemUnitConverter);
// notifyDataSetChanged();
// }
//
// public void clear() {
// arrayList.clear();
// notifyDataSetChanged();
// }
// }
}
|
[
"tranleduy1233@gmail.com"
] |
tranleduy1233@gmail.com
|
c94fcf9150c848133e84219fa3b4d6ded1178a8e
|
75eb061709fba7ab7ab7e7dbb31c6720c353ef9e
|
/WCM_MDM_SONAMA_DB2_14June2018_2/auth/src/main/java/com/ibm/mdm/esoa/client/ScoreProviderAsProv.java
|
0cfdb3220d843b0d25f728b34c00df6ed6628ac9
|
[
"MIT"
] |
permissive
|
svanandkumar/Connect_360_Release1
|
8867ab02988af510b759d49ed344e60dfc5b542f
|
9da56fdc7bd1d57b26c516b9214f5e7ca9b740c2
|
refs/heads/master
| 2020-03-28T01:00:23.393795
| 2018-09-05T13:29:59
| 2018-09-05T13:29:59
| 147,468,585
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,482
|
java
|
package com.ibm.mdm.esoa.client;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for scoreProviderAsProv complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="scoreProviderAsProv">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="target" type="{http://client.esoa.mdm.ibm.com/}provider" minOccurs="0"/>
* <element name="record" type="{http://client.esoa.mdm.ibm.com/}provider" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "scoreProviderAsProv", propOrder = {
"target",
"record"
})
public class ScoreProviderAsProv {
protected Provider target;
protected List<Provider> record;
/**
* Gets the value of the target property.
*
* @return
* possible object is
* {@link Provider }
*
*/
public Provider getTarget() {
return target;
}
/**
* Sets the value of the target property.
*
* @param value
* allowed object is
* {@link Provider }
*
*/
public void setTarget(Provider value) {
this.target = value;
}
/**
* Gets the value of the record property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the record property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRecord().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Provider }
*
*
*/
public List<Provider> getRecord() {
if (record == null) {
record = new ArrayList<Provider>();
}
return this.record;
}
}
|
[
"anandkumar.swami@in.ibm.com"
] |
anandkumar.swami@in.ibm.com
|
e6eaa86532036fe69887f7a92b0ab548a7de6ed8
|
e79aba5c0f2b8d79e64eac0cc28b70d876d8b29e
|
/src/test/java/main/java/com/frontier/autotest/scenario_checker/Application.java
|
00926321e675e7cc2fc34be1da102d4a4ac9ffab
|
[] |
no_license
|
kvyatkovsky/autotest-scenario-checker
|
86f20089b677eddd3a25f9c159c0fb6bb9b6d665
|
6c3cac01b36d5a30c88b0a0dd009b63337ee2428
|
refs/heads/master
| 2020-07-05T02:26:02.721687
| 2016-12-13T09:27:20
| 2016-12-13T09:27:20
| 74,130,029
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 644
|
java
|
import org.jbehave.core.model.Story;
import report.Reporter;
import utils.JBehaveStoriesServiceImpl;
import utils.StoryChecker;
import java.util.List;
public class Application {
public static void main(final String[] args) {
JBehaveStoriesServiceImpl jBehaveStoriesService = new JBehaveStoriesServiceImpl();
List<Story> stories = jBehaveStoriesService.getAllStoryFiles();
StoryChecker storyChecker = new StoryChecker();
stories.forEach(story -> storyChecker.checkStory(story));
Reporter reporter = Reporter.getInstance();
reporter.printResult();
int debugStopper = 0;
}
}
|
[
"Maksym_Kviatkovskyi@epam.com"
] |
Maksym_Kviatkovskyi@epam.com
|
bc1b59e7a306ee40286ad6e8d9535d25cb08808a
|
6ebe0bfaf13dfb1e20a443966a1af6b757e63b8e
|
/tests/StaticIntArrays.java
|
4d2f1a7ba7e75ff18e02a45bf76b5b3424c94635
|
[] |
no_license
|
efraga-msx/java_grinder
|
8368df45d043655c94426da85ae4984bcbe43a7a
|
f8f69fad1c14d0713f39af88770972a0b9bf97f4
|
refs/heads/master
| 2021-01-15T20:47:44.375303
| 2016-03-02T02:32:15
| 2016-03-02T02:32:15
| 51,977,653
| 2
| 1
| null | 2016-03-02T02:32:15
| 2016-02-18T04:00:23
|
C++
|
UTF-8
|
Java
| false
| false
| 307
|
java
|
public class StaticIntArrays
{
static int[] array = { 1, 2, 3, 4 };
static public int add_nums()
{
int total = 0;
int n;
for (n = 0; n < array.length; n++)
{
total += array[n];
}
return total;
}
static public void main(String args[])
{
add_nums();
}
}
|
[
"mike@mikekohn.net"
] |
mike@mikekohn.net
|
1a314c8492817dce067ec785e7e382039c257c93
|
b5f8ce4f162e41501d71aabf480bb9b8df94201b
|
/src/main/java/sn/seysoo/repository/PersonneRepository.java
|
18b4373e4f70c4f040030efde8f46ea54c76fe42
|
[] |
no_license
|
abdoulayeyoussoufa/betail
|
56b589928844939a02a00b429f91471228f96000
|
ddc8274f002f9e3d8618514f55b857fe79e31268
|
refs/heads/master
| 2020-03-23T08:09:43.006792
| 2017-05-11T12:00:29
| 2017-05-11T12:00:29
| 141,308,588
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 312
|
java
|
package sn.seysoo.repository;
import sn.seysoo.domain.Personne;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
* Spring Data MongoDB repository for the Personne entity.
*/
@SuppressWarnings("unused")
public interface PersonneRepository extends MongoRepository<Personne,String> {
}
|
[
"layoussou@gmail.com"
] |
layoussou@gmail.com
|
ca811c06ef52eb57f83d4a21adce64e5cd448dd0
|
a626ca44de1f12587cb1784ee6f915daef0311da
|
/src/M2_ass6/InTenTwenty.java
|
f9c3877d59167459b9942f3e0d9850b188f3269e
|
[] |
no_license
|
krishnachandrika/Helloo
|
00681ffc89bfe572db9538d6c8fe7c547fb87d9f
|
3574809474224b69d3f4e5211f689096f8c9dfd1
|
refs/heads/master
| 2020-07-31T09:11:28.653891
| 2019-09-30T03:59:44
| 2019-09-30T03:59:44
| 210,556,027
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 938
|
java
|
package M2_ass6;
/**
* Given 2 int values, return true if either of them is in the range 10..20 inclusive.
*
* Input : in1020(12, 99)
* Output : true
*
* Input : in1020(21, 12)
* Output : true
*
* Input : in1020(8, 99)
* Output : false
*
* @author Siva Sankar
*/
public class InTenTwenty {
/**
* This method should return true if either of the tow numbers as parameters are in the
* range of 10..20 inclusive, false otherwise.
*
* @param a, the first integer as parameter to the method.
* @param b, the second integer as parameter to the method.
*
* @return true if either of them is in the range of 10..20 inclusive and
* false otherwise.
*/
public static boolean in1020(int a, int b) {
// Your code goes here....
if(a>=10 && a<=20 || b>=10 && b<=20){
return true;
}
else{
return false;
}
}
}
|
[
"krishnachandrika21@gmail.com"
] |
krishnachandrika21@gmail.com
|
73d1938ee4d0926ab2b2092ea59ac616b3aef650
|
6a606abd3a8d470b0a6b98271655f68b95fa3e07
|
/src/com/nmbb/oplayer/ui/helper/Utils/NonServerConnector.java
|
df87fcf489124dbf041ed6e7b6b4afb6f8f1f5cd
|
[] |
no_license
|
wwttt2004/online-cinema
|
2326e40935d4314d225f078a3d46233c0cb4a793
|
3618b5f221371d775038011063972cca9c277e59
|
refs/heads/master
| 2020-05-26T22:17:01.987195
| 2013-10-30T22:19:22
| 2013-10-30T22:19:22
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,159
|
java
|
package com.nmbb.oplayer.ui.helper.Utils;
import java.io.IOException;
import java.net.Socket;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.List;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.message.BasicHeader;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import android.util.Log;
public class NonServerConnector {
public String readDataGet(String url, String encoding) throws Exception {
HttpGet get = new HttpGet(url);
get.setHeader("Host", "5tv5.ru");
get.setHeader("Connection", "keep-alive");
get.setHeader("Accept", "*/*");
get.setHeader("X-Requested-With", "XMLHttpRequest");
get.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36");
get.setHeader("Referer", "http://5tv5.ru/");
get.setHeader("Accept-Encoding", "gzip,deflate,sdch");
get.setHeader("Accept-Language", "en-US,en;q=0.8,ru;q=0.6");
get.setHeader("Cookie", "id_ses=1377627930; otkuda=5tv5.ru; _lxretpopupignore=1; PHPSESSID=la5ndu338p1j78gt7cgv8lum13; zif=5; _ym_visorc=w; MarketGidStorage=%7B%220%22%3A%7B%22svspr%22%3A%22%22%2C%22svsds%22%3A112%2C%22TejndEEDj%22%3A%22MTM3Nzg3MTU3OTkzNDM2MjM0NDM%3D%22%7D%2C%22C36234%22%3A%7B%22page%22%3A1%2C%22time%22%3A1378388401443%7D%7D; __utma=94434712.1385363062.1377627925.1378373275.1378388402.22; __utmb=94434712.1.10.1378388402; __utmc=94434712; __utmz=94434712.1377627925.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)");
return readData(get, encoding);
}
public String readDataGet(String url, BasicHeader header) throws Exception {
HttpGet get = new HttpGet(url);
get.setHeader("Accept", "application/json");
get.setHeader(header);
return readData(get);
}
public String readDataPost(String url, List<NameValuePair> params, String encoding) throws Exception {
HttpPost httppost = new HttpPost(url);
httppost.setEntity(new UrlEncodedFormEntity(params, encoding));
return readData(httppost, encoding);
}
public String readDataPost(String url, List<NameValuePair> params, BasicHeader[] headers) throws Exception {
return readDataPost(url, params, headers, "UTF-8");
}
public String readDataPost(String url, List<NameValuePair> params, BasicHeader[] headers, String encoding) throws Exception {
HttpPost httppost = new HttpPost(url);
httppost.setHeaders(headers);
httppost.setEntity(new UrlEncodedFormEntity(params, encoding));
return readData(httppost, encoding);
}
public String readData(HttpUriRequest uri, String encoding) throws Exception {
return new String(readBytes(uri), encoding);
}
public String readData(HttpUriRequest uri) throws Exception {
return readData(uri, "UTF-8");
}
public byte [] readDataImage(String url) throws Exception {
Log.e("url", ":" + url);
HttpGet get = new HttpGet(url);
get.setHeader("Cache-Control", "max-age=86400");
get.setHeader("Accept-Ranges", "bytes");
get.setHeader("Content-Type", "image/png");
return readBytes(get);
}
public byte [] readBytes(HttpUriRequest uri) throws Exception {
HttpClient client = getNewHttpClient();
HttpEntity entity = null;
HttpResponse response = client.execute(uri);
Log.e("response.getStatusLine().getStatusCode()", ":" + response.getStatusLine());
if (response.getStatusLine().getStatusCode() == 200) {
entity = response.getEntity();
return EntityUtils.toByteArray(entity);
} else {
return null;
}
}
public static class MySSLSocketFactory extends SSLSocketFactory {
SSLContext sslContext = SSLContext.getInstance("TLS");
public MySSLSocketFactory(KeyStore truststore) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
super(truststore);
TrustManager tm = new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
public X509Certificate[] getAcceptedIssuers() {
return null;
}
};
sslContext.init(null, new TrustManager[] {tm}, null);
}
@Override
public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException {
return sslContext.getSocketFactory().createSocket(socket, host, port, autoClose);
}
@Override
public Socket createSocket() throws IOException {
return sslContext.getSocketFactory().createSocket();
}
}
public HttpClient getNewHttpClient() throws Exception {
try {
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
trustStore.load(null, null);
SSLSocketFactory sf = new MySSLSocketFactory(trustStore);
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setContentCharset(params, HTTP.UTF_8);
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
registry.register(new Scheme("https", sf, 443));
ClientConnectionManager ccm = new ThreadSafeClientConnManager(params, registry);
return new DefaultHttpClient(ccm, params);
} catch (Exception e) {
return new DefaultHttpClient();
}
}
}
|
[
"Admin@Admins-Mac.local"
] |
Admin@Admins-Mac.local
|
bbc28cabcefd4385742669d66d71672adabd752c
|
d7c77ebd42a56c0274f95c1f2c72b2a87e62d72c
|
/src/com/theironyard/MainTest.java
|
6c0ccc7539aa309357f38ebd5523099e6b41ebca
|
[] |
no_license
|
ErikSchneider/File-I-O
|
6693c53b7af017bccabccd7645b7f5dcbf9e9158
|
68997f7ffcc25baf77dccbd6f56205eda4cee3a0
|
refs/heads/master
| 2020-12-31T05:10:09.683794
| 2016-05-26T13:39:51
| 2016-05-26T13:39:51
| 59,686,548
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 844
|
java
|
package com.theironyard;
import org.junit.Test;
import static junit.framework.TestCase.assertTrue;
/**
* Created by Erik on 5/25/16.
*/
public class MainTest {
@Test
public void saveAndLoad() throws Exception {
Movie m1 = new Movie();
m1.title = "Test Title";
m1.director = "Test Director";
m1.genre = "Test Genre";
m1.rating = "Test Rating";
m1.releaseYear = "Test Release Year";
Main.saveMovie(m1);
Movie newMovie = Main.loadMovie();
assertTrue(m1 != null);
assertTrue(m1.title.equals(newMovie.title));
assertTrue(m1.director.equals(newMovie.director));
assertTrue(m1.genre.equals(newMovie.genre));
assertTrue(m1.rating.equals(newMovie.rating));
assertTrue(m1.releaseYear.equals(newMovie.releaseYear));
}
}
|
[
"eschneider1128@gmail.com"
] |
eschneider1128@gmail.com
|
ed94dbc5c706472afe6efec6b7e72bada73d82a5
|
4abfa7545c6865013c53ed157c0373edd138eb94
|
/src/com/handyedit/codeexplorer/ui/graph/MethodRenderer.java
|
e4310bed29e406a1a9096e64ff0847c306843ce0
|
[] |
no_license
|
wangshang12/NewCodeExplorer
|
cd6aad2700a27444a0a5ede1c03ad13974d8ba5e
|
a35467db576502d7d9301c1ffa7ba6e0cc4eabdf
|
refs/heads/master
| 2021-01-12T06:49:51.244256
| 2015-02-27T08:42:38
| 2015-02-27T08:42:38
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,495
|
java
|
package com.handyedit.codeexplorer.ui.graph;
import com.handyedit.codeexplorer.CodeExplorerPlugin;
import com.handyedit.codeexplorer.CodeExplorerSettings;
import com.handyedit.codeexplorer.math.Edge;
import com.handyedit.codeexplorer.model.DependencyModel;
import com.handyedit.codeexplorer.model.MethodNode;
import com.intellij.openapi.graph.builder.GraphBuilder;
import com.intellij.openapi.graph.builder.renderer.BasicGraphNodeRenderer;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.ModificationTracker;
import javax.swing.*;
/**
* @author Alexei Orishchenko
*/
public class MethodRenderer extends BasicGraphNodeRenderer<MethodNode, Edge> {
private static final Icon ICON_EXPAND = IconLoader.getIcon("/nodes/unknownJdk.png");
public MethodRenderer(GraphBuilder<MethodNode, Edge> builder, ModificationTracker tracker) {
super(builder, tracker);
}
protected Icon getIcon(MethodNode method) {
DependencyModel model = (DependencyModel) getBuilder().getGraphDataModel();
if (!model.isExplored(method, getSettings().isStructureByClick())) {
return ICON_EXPAND;
}
return method.getIcon();
}
protected String getNodeName(MethodNode method) {
return method.getName(getSettings().isShowClassName());
}
private CodeExplorerSettings getSettings() {
return CodeExplorerPlugin.getSettings(getBuilder().getProject());
}
}
|
[
"linjiangsheng@meituan.com"
] |
linjiangsheng@meituan.com
|
87f23ec9747fd0e9a8aef3ba8dac35762c809d3b
|
46016d4704d802d3f42e3ae8ebf428deccb7d95d
|
/src/org/company/app/data/entity/ClientEntity.java
|
3bc8f6ea39bb0404c6cfde17d9e7b836041d66aa
|
[] |
no_license
|
Dimazavr78/eg
|
512d50c42e50091254ad7932d64fadf21a02cd89
|
d53a9be8a809827a669eded607e0708c09b75c21
|
refs/heads/main
| 2023-03-14T06:53:05.523435
| 2021-03-08T14:20:47
| 2021-03-08T14:20:47
| 345,681,360
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,514
|
java
|
package org.company.app.data.entity;
import java.util.Date;
public class ClientEntity
{
private int id;
private String firstname;
private String lastname;
private String patronymic;
private Date birthday;
private Date regDate;
private String email;
private String phone;
private char genderCode;
private char grus;
private char pricep;
private String photoPath;
public ClientEntity(int id, String firstname, String lastname, String patronymic, Date birthday, Date regDate, String email, String phone, char genderCode, String photoPath) {
this.id = id;
this.firstname = firstname;
this.lastname = lastname;
this.patronymic = patronymic;
this.birthday = birthday;
this.regDate = regDate;
this.email = email;
this.phone = phone;
this.genderCode = genderCode;
this.photoPath = photoPath;
}
public ClientEntity(String firstname, String lastname, String patronymic, Date birthday, Date regDate, String email, String phone, char genderCode, String photoPath) {
this.id = -1;
this.firstname = firstname;
this.lastname = lastname;
this.patronymic = patronymic;
this.birthday = birthday;
this.regDate = regDate;
this.email = email;
this.phone = phone;
this.genderCode = genderCode;
this.photoPath = photoPath;
}
public ClientEntity(String firstname, String lastname, String patronymic, Date regDate, String email, String phone, char pricep, char grus) {
this.firstname = firstname;
this.lastname = lastname;
this.patronymic = patronymic;
this.regDate = regDate;
this.email = email;
this.phone = phone;
this.pricep = pricep;
this.grus = grus;
}
@Override
public String toString() {
return "ClientEntity{" +
"id=" + id +
", firstname='" + firstname + '\'' +
", lastname='" + lastname + '\'' +
", patronymic='" + patronymic + '\'' +
", birthday=" + birthday +
", regDate=" + regDate +
", email='" + email + '\'' +
", phone='" + phone + '\'' +
", genderCode=" + genderCode +
", grus=" + grus +
", pricep=" + pricep +
", photoPath='" + photoPath + '\'' +
'}';
}
public int getId() {
return id;
}
public ClientEntity setId(int id) {
this.id = id;
return this;
}
public String getFirstname() {
return firstname;
}
public ClientEntity setFirstname(String firstname) {
this.firstname = firstname;
return this;
}
public String getLastname() {
return lastname;
}
public ClientEntity setLastname(String lastname) {
this.lastname = lastname;
return this;
}
public String getPatronymic() {
return patronymic;
}
public ClientEntity setPatronymic(String patronymic) {
this.patronymic = patronymic;
return this;
}
public Date getBirthday() {
return birthday;
}
public ClientEntity setBirthday(Date birthday) {
this.birthday = birthday;
return this;
}
public Date getRegDate() {
return regDate;
}
public ClientEntity setRegDate(Date regDate) {
this.regDate = regDate;
return this;
}
public String getEmail() {
return email;
}
public ClientEntity setEmail(String email) {
this.email = email;
return this;
}
public String getPhone() {
return phone;
}
public ClientEntity setPhone(String phone) {
this.phone = phone;
return this;
}
public char getGenderCode() {
return genderCode;
}
public ClientEntity setGenderCode(char genderCode) {
this.genderCode = genderCode;
return this;
}
public char getGrus() {
return grus;
}
public void setGrus(char grus) {
this.grus = grus;
}
public char getPricep() {
return pricep;
}
public void setPricep(char pricep) {
this.pricep = pricep;
}
public String getPhotoPath() {
return photoPath;
}
public ClientEntity setPhotoPath(String photoPath) {
this.photoPath = photoPath;
return this;
}
}
|
[
"dimazavr78@gmail.com"
] |
dimazavr78@gmail.com
|
062b2b20ba0d8d6b683462abb8017c3bfc21d26a
|
b3d173b1c88a05e5cace8eb6e9b51e2d851a5ac8
|
/src/main/java/br/com/microservices/edge/Application.java
|
442096b3a80bf7dde8c90382f08e2410c6c0b3a8
|
[] |
no_license
|
fmvintu/hystrix-dashboard-service
|
2819aed118477764c822eb2f4ca6e9042594aee0
|
5e285cfd33dcc6b141776c631dece858d47d6ed7
|
refs/heads/master
| 2020-09-14T21:34:31.562584
| 2019-12-06T20:07:24
| 2019-12-06T20:07:24
| 223,263,399
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 629
|
java
|
package br.com.microservices.edge;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine;
@EnableTurbine
@EnableDiscoveryClient
@EnableHystrixDashboard
@SpringBootApplication
public class Application {
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).run(args);
}
}
|
[
"root@ip-172-31-12-49.us-east-2.compute.internal"
] |
root@ip-172-31-12-49.us-east-2.compute.internal
|
7e52246b5f27a193498253680d482397d3d5b133
|
6eb0071fca2aca18f0aa3000a8be156a8bdb30b0
|
/app/src/main/java/com/pakhendri/tracking/model/StartLocation.java
|
546fea962bce271a0584589779c784051c81ccfb
|
[] |
no_license
|
syntaxxxxx/MapTrainingPeserta
|
e8536115c5e18662b71b228c8d28eb895c4e2fbf
|
1a3129aae5e73f9ef6d2642a5bc3f3e7dc4d47a6
|
refs/heads/master
| 2020-07-01T00:46:40.029967
| 2019-08-07T07:42:15
| 2019-08-07T07:42:15
| 200,999,104
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 414
|
java
|
package com.pakhendri.tracking.model;
import com.google.gson.annotations.SerializedName;
public class StartLocation{
@SerializedName("lng")
private double lng;
@SerializedName("lat")
private double lat;
public void setLng(double lng){
this.lng = lng;
}
public double getLng(){
return lng;
}
public void setLat(double lat){
this.lat = lat;
}
public double getLat(){
return lat;
}
}
|
[
"fiqrihafzainislami@gmail.com"
] |
fiqrihafzainislami@gmail.com
|
3839ff378d793e9116cc0c23d3ff3aa9ff1d5ec0
|
a22a13560b69697e4c6bf15f166591c70c647765
|
/app/src/main/java/com/mzth/createcause/presenter/core/InfromationPresenter.java
|
30ebd2170caa03046f5475926d22bb4d658221d5
|
[] |
no_license
|
wxcican/CreateCause
|
0db480e2dc88a974f79f4c90a4db0d35e5fe375d
|
06eb3314bd719f2c1b001bcccdf3114ebc2c1223
|
refs/heads/master
| 2020-03-22T17:06:45.793891
| 2018-07-12T12:12:01
| 2018-07-12T12:12:01
| 140,373,496
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,167
|
java
|
package com.mzth.createcause.presenter.core;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import com.lzy.okgo.request.base.Request;
import com.mzth.createcause.base.BasePresenter;
import com.mzth.createcause.entity.core.CoreContentEntity;
import com.mzth.createcause.entity.core.CoreTypeEntity;
import com.mzth.createcause.model.core.InfromationVideoDataModel;
import com.mzth.createcause.view.fragment.news.INewFragment;
import com.mzth.createcause.view.fragment.news.INewsContentFragment;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by Administrator on 2018/1/17 0017.
*/
public class InfromationPresenter extends BasePresenter {
private INewFragment mINewFragment;
private INewsContentFragment mINewsContentFragment;
/**
* 初始化资讯界面
*
* @param iNewFragment
*/
public void initNewFragment(INewFragment iNewFragment) {
this.mINewFragment = iNewFragment;
}
/**
* 初始化资讯内容界面
*/
public void initNewContentFragment(INewsContentFragment iNewsContentFragment) {
this.mINewsContentFragment = iNewsContentFragment;
}
/**
* 获取分类数据
*/
public void getTypeData() {
InfromationVideoDataModel.getInfromationVideoType().queryType(new StringCallback() {
@Override
public void onStart(Request<String, ? extends Request> request) {
super.onStart(request);
if (mINewFragment != null) {
mINewFragment.onRequestStart();
}
}
@Override
public void onFinish() {
super.onFinish();
if (mINewFragment != null) {
mINewFragment.onRequestFinish();
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
if (mINewFragment != null) {
mINewFragment.onRequestError();
}
}
@Override
public void onSuccess(Response<String> response) {
try {
CoreTypeEntity mInfromactionTypeEntity = new CoreTypeEntity(new JSONObject(response.body()));
if (mInfromactionTypeEntity.getStatus() == 1) {
if (mINewFragment != null) {
mINewFragment.typeData(mInfromactionTypeEntity.getInfromactionTypeLists());
}
} else {
if (mINewFragment != null) {
mINewFragment.onToast(mInfromactionTypeEntity.getErr_msg());
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
/**
* 获取数据
*/
public void getCoreContentData(String typeID, String type, String page) {
InfromationVideoDataModel.getInfromationVideoContent().queryContent(typeID, type, page, new StringCallback() {
@Override
public void onStart(Request<String, ? extends Request> request) {
super.onStart(request);
if (mINewsContentFragment != null) {
mINewsContentFragment.onRequestStart();
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
if (mINewsContentFragment != null) {
mINewsContentFragment.onRequestError();
}
}
@Override
public void onFinish() {
super.onFinish();
if (mINewsContentFragment != null) {
mINewsContentFragment.onRequestFinish();
}
}
@Override
public void onSuccess(Response<String> response) {
if (mINewsContentFragment != null) {
try {
mINewsContentFragment.infromationLoadCoreContentData(new CoreContentEntity(new JSONObject(response.body())));
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override
public void onCacheSuccess(Response<String> response) {
super.onCacheSuccess(response);
if (mINewsContentFragment != null) {
try {
mINewsContentFragment.infromationLoadCoreContentData(new CoreContentEntity(new JSONObject(response.body())));
} catch (JSONException e) {
e.printStackTrace();
}
}
}
});
}
/**
* 刷新数据
*
* @param typeID
* @param type
* @param page
*/
public void getRefreshCoreContentData(String typeID, String type, String page) {
InfromationVideoDataModel.getInfromationVideoContent().queryContent(typeID, type, page, new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
if (mINewsContentFragment != null) {
try {
CoreContentEntity mCoreContentEntity = new CoreContentEntity(new JSONObject(response.body()));
if(mCoreContentEntity.getStatus()==1){
mINewsContentFragment.infromationContentData(mCoreContentEntity);
}else {
mINewsContentFragment.onToast(mCoreContentEntity.getErr_msg());
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
if (mINewsContentFragment != null) {
mINewsContentFragment.onRequestError();
}
}
@Override
public void onFinish() {
super.onFinish();
if (mINewsContentFragment != null) {
mINewsContentFragment.onRequestFinish();
}
}
});
}
/**
* 加载数据
* @param typeID
* @param type
* @param page
*/
public void getLoadCoreContentData(String typeID,String type, String page){
InfromationVideoDataModel.getInfromationVideoContent().queryContent(typeID, type, page, new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
try {
mINewsContentFragment.infromationLoadCoreContentData(new CoreContentEntity(new JSONObject(response.body())));
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
}
|
[
"wxcican@qq.com"
] |
wxcican@qq.com
|
9210aa78a8e72d6cafdd0354ff6c2b0b7058410a
|
ff88bb1dfe90980f30d76a673bb565987d55a178
|
/src/Aluno.java
|
634bee79274275740ab3e31ed9dd9d8204b0001c
|
[] |
no_license
|
sidneyperota/teste-json
|
92322e8779c0af25cc655982a2d34a19bdf6ceaa
|
f91959392f1d184fd3a250a2c82f4dd57fbc27b4
|
refs/heads/master
| 2020-12-15T00:11:46.046659
| 2020-01-19T15:49:54
| 2020-01-19T15:49:54
| 234,923,658
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 360
|
java
|
import java.sql.Timestamp;
public class Aluno {
private String matricula;
private String nome;
public String getMatricula() {
return matricula;
}
public void setMatricula(String matricula) {
this.matricula = matricula;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
}
|
[
"sidneyperota@gmail.com"
] |
sidneyperota@gmail.com
|
3a2476ec3542ad7fd843ef84273488b13bc88650
|
a11aebd483d9d44f62696011e57b1edfeef096a8
|
/todo-spring-quarkus/src/main/java/io/quarkus/todospringquarkus/TodoController.java
|
a6607333f428f32d85d1071bd3fa7003259ef3c3
|
[] |
no_license
|
oluotes/resource-estimation
|
e993763bdae7559a1f4ff93747d242f5b9db0732
|
0a3034e8773b55230a282796c401b61eea4ec9a8
|
refs/heads/master
| 2023-06-14T10:20:47.862465
| 2021-05-03T14:00:25
| 2021-05-03T14:00:25
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,797
|
java
|
package io.quarkus.todospringquarkus;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/todo")
public class TodoController {
@Autowired
private TodoRepository todoRepository;
@GetMapping
public List<TodoEntity> findAll() {
System.out.println("Printing mesage from: GET ");
return todoRepository.findAll(Sort.by(Sort.Direction.DESC, "id"));
}
@GetMapping("/{id}")
public TodoEntity findById(@PathVariable("id") Long id) {
System.out.println("Printing mesage from: GET By ID ");
return todoRepository.findById(id).get();
}
@PutMapping
@Transactional
public void update(@RequestBody TodoEntity resource) {
System.out.println("Printing mesage from: PUT ");
todoRepository.save(resource);
}
@PostMapping
@Transactional
public TodoEntity create(@RequestBody TodoEntity resource) {
System.out.println("Printing mesage from: POST ");
return todoRepository.save(resource);
}
@DeleteMapping("/{id}")
@Transactional
public void delete(@PathVariable("id") Long id) {
todoRepository.deleteById(id);
}
}
|
[
"ooteniya@redhat.com"
] |
ooteniya@redhat.com
|
33e2aae57932f2bb459bfc5e3662426f524149cc
|
8bddfba100e4f89217339eaff6265aca6f75d9d4
|
/src/test/java/tests/CollectionsTest.java
|
82b10df1a04f68628aad091595761b7d123cb9ac
|
[] |
no_license
|
nmatushevska/Natalya_Matushevskaya_Diploma
|
e12b7ea26972001afe4c9a644d0f4c9be14d9345
|
309f181b6c53e2f6eb6246a2efe4c96bcaecb963
|
refs/heads/master
| 2023-03-09T15:23:17.897079
| 2021-02-22T18:07:06
| 2021-02-22T18:07:06
| 332,491,184
| 0
| 0
| null | 2021-02-15T18:01:25
| 2021-01-24T15:59:43
|
Java
|
UTF-8
|
Java
| false
| false
| 1,492
|
java
|
package tests;
import org.testng.Assert;
import org.testng.annotations.Test;
import pages.CollectionsPage;
import pages.LoginPage;
public class CollectionsTest extends BaseTest {
LoginPage loginPage;
CollectionsPage collectionsPage;
@Test(groups = "one", description = "Verifying that hyperlink to the Courses page is present in empty collections",
priority = 2)
public void redirectToCoursesPresentInEmptyCollectionTest() {
loginPage = new LoginPage(driver);
collectionsPage = new CollectionsPage(driver);
loginPage.successfulLogin();
collectionsPage.openCollections();
Assert.assertTrue(collectionsPage.getRedirectToCoursesButton().isDisplayed());
}
@Test(groups = "two", description = "Verifying possibility to add course to collections and delete it", priority = 2)
public void addAndDeleteCourseTest() {
loginPage = new LoginPage(driver);
collectionsPage = new CollectionsPage(driver);
loginPage.successfulLogin();
collectionsPage.openCollections();
collectionsPage.goToCoursesPage();
collectionsPage.openRandomCourse();
collectionsPage.addCourseToCollections();
collectionsPage.openCollections();
Assert.assertTrue(collectionsPage.getDeleteCourseFromCollectionsButton().isDisplayed());
collectionsPage.deleteCourseFromCollections();
Assert.assertTrue(collectionsPage.getRedirectToCoursesButton().isDisplayed());
}
}
|
[
"n.matushevska@gmail.com"
] |
n.matushevska@gmail.com
|
844f3cc8adef6d5e3f79683ee1d3221b88200049
|
2ed6491de44f5e573e86454b6425d05263a68440
|
/src/main/java/pages/CheckboxesPage/CheckboxesPage.java
|
09af2582c3225f4bd9e5d476473f003316abe7ae
|
[] |
no_license
|
deingvard/1-webElementsTests
|
6ee5a9697a3c70156a8d4b7991a1083878462db8
|
1c12eff10fd0f8cb883c77cf8a0af75b14e1fe4f
|
refs/heads/master
| 2020-06-24T00:40:58.776413
| 2019-05-02T12:36:49
| 2019-05-02T12:36:49
| 198,797,910
| 1
| 0
| null | 2019-07-25T09:12:37
| 2019-07-25T09:12:36
| null |
UTF-8
|
Java
| false
| false
| 2,627
|
java
|
package pages.CheckboxesPage;
import pages.BasePage.BasePageObject;
import io.qameta.allure.Step;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import java.util.List;
public class CheckboxesPage extends BasePageObject {
private String url = "http://the-internet.herokuapp.com/checkboxes";
private By checkboxesAll = By.xpath("//form[@id='checkboxes']//input");
private By checkbox1 = By.xpath("//form[@id='checkboxes']//input[1]");
private By checkbox2 = By.xpath("//form[@id='checkboxes']//input[2]");
public By getCheckboxesAll() { return checkboxesAll; }
public By getCheckbox1() {
return checkbox1;
}
public By getCheckbox2() {
return checkbox2;
}
public String getUrl() {
return url;
}
@Step("selected checkbox")
public void selectCheckbox(By locator) {
WebElement checkbox = findElement(locator);
if(!checkbox.isSelected()){
checkbox.click();
}
log.info(checkbox.getText()+ " checkbox selected");
}
@Step("unselected checkbox")
public void unselectCheckbox(By locator) {
WebElement checkbox = findElement(locator);
if(checkbox.isSelected()){
checkbox.click();
}
log.info(checkbox.getText()+ " checkbox unselected");
}
@Step("checkboxes group selected")
public void selectAllCheckboxes() {
List<WebElement> checkboxes = findAllElements(checkboxesAll);
for(WebElement checkbox : checkboxes) {
if(!checkbox.isSelected()) {
checkbox.click();
}
}
log.info("all checkboxes selected");
}
@Step("checkboxes group unselected")
public void unselectAllCheckboxes() {
List<WebElement> checkboxes = findAllElements(checkboxesAll);
for(WebElement checkbox : checkboxes) {
if(checkbox.isSelected()) {
checkbox.click();
}
}
log.info("all checkboxes unselected");
}
@Step("checked is checkbox selected")
public boolean isCheckboxSelected(By locator) {
WebElement checkbox = findElement(locator);
if(!checkbox.isSelected()) {
return false;
}
return true;
}
@Step("checked is checkboxes group selected")
public boolean isAllCheckboxesSelected() {
List<WebElement> checkboxes = findAllElements(checkboxesAll);
for(WebElement checkbox : checkboxes) {
if(!checkbox.isSelected()) {
return false;
}
}
return true;
}
}
|
[
"mary.geraseva@gmail.com"
] |
mary.geraseva@gmail.com
|
538ecc6e8d0bfff625334f0ca8345d081f35dc24
|
befd84a8fa35e5b295817963af6809f9d33f11c7
|
/ProjectRSC/Server/src/com/prsc/gs/plugins/npcs/Aggie.java
|
012bb5a4840746a87623d96b6ec6ff3a535c5a96
|
[] |
no_license
|
TagsRocks/ProjectRSC
|
c036b9a0f0ebe218aa5f1165994b91112b5f7211
|
7e0f7845e15476c018f65b1125e0f3a22a642d98
|
refs/heads/master
| 2020-06-20T07:28:32.997442
| 2013-01-16T20:38:30
| 2013-01-16T20:38:30
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,949
|
java
|
package com.prsc.gs.plugins.npcs;
import com.prsc.gs.event.MiniEvent;
import com.prsc.gs.event.ShortEvent;
import com.prsc.gs.external.EntityHandler;
import com.prsc.gs.model.ChatMessage;
import com.prsc.gs.model.InvItem;
import com.prsc.gs.model.MenuHandler;
import com.prsc.gs.model.Npc;
import com.prsc.gs.model.Player;
import com.prsc.gs.model.World;
import com.prsc.gs.plugins.listeners.action.TalkToNpcListener;
import com.prsc.gs.plugins.listeners.executive.TalkToNpcExecutiveListener;
public final class Aggie implements TalkToNpcListener, TalkToNpcExecutiveListener {
public World world = World.getWorld();
int[] dyes = { 238, 239, 272 };
int[] itemReq = { 236, 241, 281 };
String[] names = { "Red dye please", "Yellow dye please", "Blue dye please", "No thanks" };
int ourOption = -1;
@Override
public void onTalkToNpc(Player player, final Npc npc) {
try {
//if(npc.getID() != 125)
// return;
player.setBusy(false);
player.informOfNpcMessage(new ChatMessage(npc, "Hi traveller, i specialize in creating different colored dyes", player));
Thread.sleep(1500);
player.informOfNpcMessage(new ChatMessage(npc, "Would you like me to create you any dyes?", player));
player.setMenuHandler(new MenuHandler(names) {
public void handleReply(final int option, final String reply) {
if (option < 0 && option > names.length || option == 3)
return;
if(reply.equalsIgnoreCase("null")) { // temp fix until switch over
return;
}
ourOption = option;
owner.informOfChatMessage(new ChatMessage(owner, reply, npc));
world.getDelayedEventHandler().add(new ShortEvent(owner) {
public void action() {
owner.informOfNpcMessage(new ChatMessage(npc, "You will need 1 " + EntityHandler.getItemDef(itemReq[ourOption]).getName() + " and 5gp for me to create this dye", owner));
world.getDelayedEventHandler().add(new ShortEvent(owner) {
public void action() {
String[] diag = { "Yes i have them", "Ill come back when i have the ingrediants" };
owner.setMenuHandler(new MenuHandler(diag) {
public void handleReply(final int option, final String reply) {
if (option == 0) {
owner.informOfChatMessage(new ChatMessage(owner, reply, npc));
world.getDelayedEventHandler().add(new ShortEvent(owner) {
public void action() {
if (owner.getInventory().countId(itemReq[ourOption]) < 1 || owner.getInventory().countId(10) < 5) {
owner.informOfNpcMessage(new ChatMessage(npc, "It seems like you don't have all what's Required, come back later.", owner));
owner.setBusy(false);
npc.setBusy(false);
npc.unblock();
return;
}
owner.informOfNpcMessage(new ChatMessage(npc, "Here is your new Dye, enjoy.", owner));
world.getDelayedEventHandler().add(new MiniEvent(owner, 1000) {
public void action() {
if (owner.getInventory().remove(itemReq[ourOption], 1) > -1 && owner.getInventory().remove(10, 5) > -1) {
owner.getInventory().add(new InvItem(dyes[ourOption]));
owner.getActionSender().sendInventory();
}
}
});
owner.setBusy(false);
npc.setBusy(false);
npc.unblock();
return;
}
});
}
else {
owner.setBusy(false);
npc.setBusy(false);
npc.unblock();
return;
}
}
});
owner.getActionSender().sendMenu(diag);
}
});
}
});
}
});
player.getActionSender().sendMenu(names);
}
catch (InterruptedException e) {
e.printStackTrace();
}
}
@Override
public boolean blockTalkToNpc(Player p, Npc n) {
return n.getID() == 125;
}
}
|
[
"openfrog@openfroglabs-pc.(none)"
] |
openfrog@openfroglabs-pc.(none)
|
70af9adcbbe753737d8f721cff57f151ca9e8097
|
95379ba98e777550a5e7bf4289bcd4be3c2b08a3
|
/java/net/sf/l2j/gameserver/taskmanager/DecayTaskManager.java
|
6612f678ba86d136f775e2e059ec104ef3e3baf7
|
[] |
no_license
|
l2brutal/aCis_gameserver
|
1311617bd8ce0964135e23d5ac2a24f83023f5fb
|
5fa7fe086940343fb4ea726a6d0138c130ddbec7
|
refs/heads/master
| 2021-01-03T04:10:26.192831
| 2019-03-19T19:44:09
| 2019-03-19T19:44:09
| 239,916,465
| 0
| 1
| null | 2020-02-12T03:12:34
| 2020-02-12T03:12:33
| null |
UTF-8
|
Java
| false
| false
| 3,057
|
java
|
package net.sf.l2j.gameserver.taskmanager;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import net.sf.l2j.commons.concurrent.ThreadPool;
import net.sf.l2j.gameserver.model.actor.Attackable;
import net.sf.l2j.gameserver.model.actor.Creature;
import net.sf.l2j.gameserver.model.actor.instance.Monster;
/**
* Destroys {@link Creature} corpse after specified time.
*/
public final class DecayTaskManager implements Runnable
{
private final Map<Creature, Long> _characters = new ConcurrentHashMap<>();
protected DecayTaskManager()
{
// Run task each second.
ThreadPool.scheduleAtFixedRate(this, 1000, 1000);
}
@Override
public final void run()
{
// List is empty, skip.
if (_characters.isEmpty())
return;
// Get current time.
final long time = System.currentTimeMillis();
// Loop all characters.
for (Map.Entry<Creature, Long> entry : _characters.entrySet())
{
// Time hasn't passed yet, skip.
if (time < entry.getValue())
continue;
final Creature character = entry.getKey();
// Decay character and remove task.
character.onDecay();
_characters.remove(character);
}
}
/**
* Adds {@link Creature} to the DecayTask with additional interval.
* @param character : {@link Creature} to be added.
* @param interval : Interval in seconds, after which the decay task is triggered.
*/
public final void add(Creature character, int interval)
{
// if character is monster
if (character instanceof Monster)
{
final Monster monster = ((Monster) character);
// monster is spoiled or seeded, double the corpse delay
if (monster.getSpoilerId() != 0 || monster.isSeeded())
interval *= 2;
}
_characters.put(character, System.currentTimeMillis() + interval * 1000);
}
/**
* Removes {@link Creature} from the DecayTask.
* @param actor : {@link Creature} to be removed.
*/
public final void cancel(Creature actor)
{
_characters.remove(actor);
}
/**
* Removes {@link Attackable} from the DecayTask.
* @param monster : {@link Attackable} to be tested.
* @return boolean : True, when action can be applied on a corpse.
*/
public final boolean isCorpseActionAllowed(Monster monster)
{
// get time and verify, if corpse exists
Long time = _characters.get(monster);
if (time == null)
return false;
// get corpse action interval, is half of corpse decay
int corpseTime = monster.getTemplate().getCorpseTime() * 1000 / 2;
// monster is spoiled or seeded, double the corpse action interval
if (monster.getSpoilerId() != 0 || monster.isSeeded())
corpseTime *= 2;
// check last corpse action time
return System.currentTimeMillis() < time - corpseTime;
}
public static final DecayTaskManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static final class SingletonHolder
{
protected static final DecayTaskManager INSTANCE = new DecayTaskManager();
}
}
|
[
"vicawnolasco@gmail.com"
] |
vicawnolasco@gmail.com
|
18caf475b6a5aa056bfad0673001f679504b5bb1
|
a6e854b7dffbaa2300bd6e01f1b24f21a752baba
|
/MANREM_V5_0/src/main/java/xml/AgentName.java
|
41641617e588f4fce7242881e1eeb277c6335024
|
[] |
no_license
|
FMSilv/MANREMv5.0
|
b2b70145d53ed7f0cceca58e64b2ae9481039c31
|
967f20f07f652618abbcd0399d1341d178490b41
|
refs/heads/master
| 2021-06-29T03:54:12.416415
| 2019-02-10T19:21:14
| 2019-02-10T19:21:14
| 170,015,866
| 0
| 0
| null | 2020-10-13T11:57:09
| 2019-02-10T19:14:55
|
Java
|
UTF-8
|
Java
| false
| false
| 1,896
|
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package xml;
import java.util.ArrayList;
/**
*
* @author Paulo Bonifacio
*/
public class AgentName {
private String Name; // local agent name
private String Type; // type id *Buyer/Seller
private String NumberAtributes;
private Volumes VolData;
private Prices PrcData;
private Config CfgData;
public String getName(){
return Name;
}
public String getType(){
return Type;
}
public String getNumberAtributes(){
return NumberAtributes;
}
public Volumes getVolData(){
return VolData;
}
public Prices getPrcData(){
return PrcData;
}
public Config getCfgData(){
return CfgData;
}
public void setName(String Name){
this.Name = Name;
}
public void setType(String Type){
this.Type = Type;
}
public void setNumberAtributes(String NumberAtributes){
this.NumberAtributes = NumberAtributes;
}
public void setVolData(Volumes VolData) {
this.VolData = VolData;
}
public void setPrcData(Prices PrcData) {
this.PrcData = PrcData;
}
public void setCfgData(Config CfgData) {
this.CfgData = CfgData;
}
public AgentName(){}
// provavelmente não é necessário
@Override
public String toString(){
return this.Name + " " + this.Type + " " + this.NumberAtributes + " "
+ this.CfgData + " " + this.PrcData + " " + this.VolData;
}
}
|
[
"filipe.m.silverio@hotmail.com"
] |
filipe.m.silverio@hotmail.com
|
90fd2522d54aabf11fb3fb2bf8062f6ebb1d3cd1
|
6fc69fcdf2b1cb41ae2804e1a0a7a519ea10455c
|
/com/google/android/gms/ads/internal/zzf.java
|
96d97212596e6b700be15cc59b708675b96fa852
|
[] |
no_license
|
earlisreal/aPPwareness
|
2c168843f0bd32e3c885f9bab68917dd324991f0
|
f538ef69f16099a85c2f1a8782d977a5715d65f4
|
refs/heads/master
| 2021-01-13T14:44:54.007944
| 2017-01-19T17:17:14
| 2017-01-19T17:17:14
| 79,504,981
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 14,134
|
java
|
package com.google.android.gms.ads.internal;
import android.content.Context;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.ViewTreeObserver.OnScrollChangedListener;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.common.internal.zzac;
import com.google.android.gms.common.util.zzs;
import com.google.android.gms.internal.zzcv;
import com.google.android.gms.internal.zzdy;
import com.google.android.gms.internal.zzec;
import com.google.android.gms.internal.zzeh;
import com.google.android.gms.internal.zzew;
import com.google.android.gms.internal.zzfx;
import com.google.android.gms.internal.zzjs;
import com.google.android.gms.internal.zzmb;
import com.google.android.gms.internal.zzop;
import com.google.android.gms.internal.zzov;
import com.google.android.gms.internal.zzpi;
import com.google.android.gms.internal.zzpy;
import com.google.android.gms.internal.zzqa;
import com.google.android.gms.internal.zzqp;
import com.google.android.gms.internal.zzqq;
import com.google.android.gms.internal.zzqq.zzc;
import com.google.android.gms.internal.zzqq.zze;
import com.google.android.gms.internal.zzqu;
import java.util.List;
@zzmb
public class zzf extends zzc implements OnGlobalLayoutListener, OnScrollChangedListener {
private boolean zzsS;
/* renamed from: com.google.android.gms.ads.internal.zzf.1 */
class C04291 implements Runnable {
final /* synthetic */ zzf zzsT;
C04291(zzf com_google_android_gms_ads_internal_zzf) {
this.zzsT = com_google_android_gms_ads_internal_zzf;
}
public void run() {
this.zzsT.zzf(this.zzsT.zzsw.zzvk);
}
}
/* renamed from: com.google.android.gms.ads.internal.zzf.2 */
class C04302 implements zze {
final /* synthetic */ zzov zzsU;
final /* synthetic */ Runnable zzsV;
C04302(zzf com_google_android_gms_ads_internal_zzf, zzov com_google_android_gms_internal_zzov, Runnable runnable) {
this.zzsU = com_google_android_gms_internal_zzov;
this.zzsV = runnable;
}
public void zzcc() {
if (!this.zzsU.zzVq) {
zzv.zzcJ();
zzpi.zzb(this.zzsV);
}
}
}
/* renamed from: com.google.android.gms.ads.internal.zzf.3 */
class C04313 implements zzc {
final /* synthetic */ zzf zzsT;
final /* synthetic */ zzov zzsW;
C04313(zzf com_google_android_gms_ads_internal_zzf, zzov com_google_android_gms_internal_zzov) {
this.zzsT = com_google_android_gms_ads_internal_zzf;
this.zzsW = com_google_android_gms_internal_zzov;
}
public void zzcd() {
new zzcv(this.zzsT.zzsw.zzqr, this.zzsW.zzMZ.getView()).zza(this.zzsW.zzMZ);
}
}
public class zza {
final /* synthetic */ zzf zzsT;
public zza(zzf com_google_android_gms_ads_internal_zzf) {
this.zzsT = com_google_android_gms_ads_internal_zzf;
}
public void onClick() {
this.zzsT.onAdClicked();
}
}
public zzf(Context context, zzec com_google_android_gms_internal_zzec, String str, zzjs com_google_android_gms_internal_zzjs, zzqa com_google_android_gms_internal_zzqa, zzd com_google_android_gms_ads_internal_zzd) {
super(context, com_google_android_gms_internal_zzec, str, com_google_android_gms_internal_zzjs, com_google_android_gms_internal_zzqa, com_google_android_gms_ads_internal_zzd);
}
private zzec zzb(com.google.android.gms.internal.zzov.zza com_google_android_gms_internal_zzov_zza) {
if (com_google_android_gms_internal_zzov_zza.zzVB.zzzo) {
return this.zzsw.zzvj;
}
AdSize adSize;
String str = com_google_android_gms_internal_zzov_zza.zzVB.zzRN;
if (str != null) {
String[] split = str.split("[xX]");
split[0] = split[0].trim();
split[1] = split[1].trim();
adSize = new AdSize(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
} else {
adSize = this.zzsw.zzvj.zzeA();
}
return new zzec(this.zzsw.zzqr, adSize);
}
private boolean zzb(@Nullable zzov com_google_android_gms_internal_zzov, zzov com_google_android_gms_internal_zzov2) {
if (com_google_android_gms_internal_zzov2.zzRK) {
View zzg = zzo.zzg(com_google_android_gms_internal_zzov2);
if (zzg == null) {
zzpy.zzbe("Could not get mediation view");
return false;
}
View nextView = this.zzsw.zzvg.getNextView();
if (nextView != null) {
if (nextView instanceof zzqp) {
((zzqp) nextView).destroy();
}
this.zzsw.zzvg.removeView(nextView);
}
if (!zzo.zzh(com_google_android_gms_internal_zzov2)) {
try {
zzb(zzg);
} catch (Throwable th) {
zzpy.zzc("Could not add mediation view to view hierarchy.", th);
return false;
}
}
} else if (!(com_google_android_gms_internal_zzov2.zzVt == null || com_google_android_gms_internal_zzov2.zzMZ == null)) {
com_google_android_gms_internal_zzov2.zzMZ.zza(com_google_android_gms_internal_zzov2.zzVt);
this.zzsw.zzvg.removeAllViews();
this.zzsw.zzvg.setMinimumWidth(com_google_android_gms_internal_zzov2.zzVt.widthPixels);
this.zzsw.zzvg.setMinimumHeight(com_google_android_gms_internal_zzov2.zzVt.heightPixels);
zzb(com_google_android_gms_internal_zzov2.zzMZ.getView());
}
if (this.zzsw.zzvg.getChildCount() > 1) {
this.zzsw.zzvg.showNext();
}
if (com_google_android_gms_internal_zzov != null) {
View nextView2 = this.zzsw.zzvg.getNextView();
if (nextView2 instanceof zzqp) {
((zzqp) nextView2).zza(this.zzsw.zzqr, this.zzsw.zzvj, this.zzsr);
} else if (nextView2 != null) {
this.zzsw.zzvg.removeView(nextView2);
}
this.zzsw.zzdl();
}
this.zzsw.zzvg.setVisibility(0);
return true;
}
private void zze(zzov com_google_android_gms_internal_zzov) {
if (!zzs.zzyA()) {
return;
}
if (this.zzsw.zzdm()) {
if (com_google_android_gms_internal_zzov.zzMZ != null) {
if (com_google_android_gms_internal_zzov.zzVp != null) {
this.zzsy.zza(this.zzsw.zzvj, com_google_android_gms_internal_zzov);
}
if (com_google_android_gms_internal_zzov.zzdz()) {
new zzcv(this.zzsw.zzqr, com_google_android_gms_internal_zzov.zzMZ.getView()).zza(com_google_android_gms_internal_zzov.zzMZ);
} else {
com_google_android_gms_internal_zzov.zzMZ.zzkV().zza(new C04313(this, com_google_android_gms_internal_zzov));
}
}
} else if (this.zzsw.zzvE != null && com_google_android_gms_internal_zzov.zzVp != null) {
this.zzsy.zza(this.zzsw.zzvj, com_google_android_gms_internal_zzov, this.zzsw.zzvE);
}
}
public void onGlobalLayout() {
zzf(this.zzsw.zzvk);
}
public void onScrollChanged() {
zzf(this.zzsw.zzvk);
}
public void setManualImpressionsEnabled(boolean z) {
zzac.zzdn("setManualImpressionsEnabled must be called from the main thread.");
this.zzsS = z;
}
public void showInterstitial() {
throw new IllegalStateException("Interstitial is NOT supported by BannerAdManager.");
}
protected zzqp zza(com.google.android.gms.internal.zzov.zza com_google_android_gms_internal_zzov_zza, @Nullable zze com_google_android_gms_ads_internal_zze, @Nullable zzop com_google_android_gms_internal_zzop) {
if (this.zzsw.zzvj.zzzm == null && this.zzsw.zzvj.zzzo) {
this.zzsw.zzvj = zzb(com_google_android_gms_internal_zzov_zza);
}
return super.zza(com_google_android_gms_internal_zzov_zza, com_google_android_gms_ads_internal_zze, com_google_android_gms_internal_zzop);
}
protected void zza(@Nullable zzov com_google_android_gms_internal_zzov, boolean z) {
super.zza(com_google_android_gms_internal_zzov, z);
if (zzo.zzh(com_google_android_gms_internal_zzov)) {
zzo.zza(com_google_android_gms_internal_zzov, new zza(this));
}
}
public boolean zza(@Nullable zzov com_google_android_gms_internal_zzov, zzov com_google_android_gms_internal_zzov2) {
if (!super.zza(com_google_android_gms_internal_zzov, com_google_android_gms_internal_zzov2)) {
return false;
}
if (!this.zzsw.zzdm() || zzb(com_google_android_gms_internal_zzov, com_google_android_gms_internal_zzov2)) {
zzqu zzlg;
if (com_google_android_gms_internal_zzov2.zzSc) {
zzf(com_google_android_gms_internal_zzov2);
zzv.zzdh().zza(this.zzsw.zzvg, (OnGlobalLayoutListener) this);
zzv.zzdh().zza(this.zzsw.zzvg, (OnScrollChangedListener) this);
if (!com_google_android_gms_internal_zzov2.zzVq) {
Runnable c04291 = new C04291(this);
zzqq zzkV = com_google_android_gms_internal_zzov2.zzMZ != null ? com_google_android_gms_internal_zzov2.zzMZ.zzkV() : null;
if (zzkV != null) {
zzkV.zza(new C04302(this, com_google_android_gms_internal_zzov2, c04291));
}
}
} else if (!this.zzsw.zzdn() || ((Boolean) zzfx.zzDQ.get()).booleanValue()) {
zza(com_google_android_gms_internal_zzov2, false);
}
if (com_google_android_gms_internal_zzov2.zzMZ != null) {
zzlg = com_google_android_gms_internal_zzov2.zzMZ.zzlg();
zzqq zzkV2 = com_google_android_gms_internal_zzov2.zzMZ.zzkV();
if (zzkV2 != null) {
zzkV2.zzlt();
}
} else {
zzlg = null;
}
if (!(this.zzsw.zzvy == null || zzlg == null)) {
zzlg.zzP(this.zzsw.zzvy.zzAE);
}
zze(com_google_android_gms_internal_zzov2);
return true;
}
zzh(0);
return false;
}
public boolean zzb(zzdy com_google_android_gms_internal_zzdy) {
return super.zzb(zze(com_google_android_gms_internal_zzdy));
}
@Nullable
public zzew zzbG() {
zzac.zzdn("getVideoController must be called from the main thread.");
return (this.zzsw.zzvk == null || this.zzsw.zzvk.zzMZ == null) ? null : this.zzsw.zzvk.zzMZ.zzlg();
}
protected boolean zzbM() {
boolean z = true;
if (!zzv.zzcJ().zza(this.zzsw.zzqr.getPackageManager(), this.zzsw.zzqr.getPackageName(), "android.permission.INTERNET")) {
zzeh.zzeO().zza(this.zzsw.zzvg, this.zzsw.zzvj, "Missing internet permission in AndroidManifest.xml.", "Missing internet permission in AndroidManifest.xml. You must have the following declaration: <uses-permission android:name=\"android.permission.INTERNET\" />");
z = false;
}
if (!zzv.zzcJ().zzy(this.zzsw.zzqr)) {
zzeh.zzeO().zza(this.zzsw.zzvg, this.zzsw.zzvj, "Missing AdActivity with android:configChanges in AndroidManifest.xml.", "Missing AdActivity with android:configChanges in AndroidManifest.xml. You must have the following declaration within the <application> element: <activity android:name=\"com.google.android.gms.ads.AdActivity\" android:configChanges=\"keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize\" />");
z = false;
}
if (!(z || this.zzsw.zzvg == null)) {
this.zzsw.zzvg.setVisibility(0);
}
return z;
}
zzdy zze(zzdy com_google_android_gms_internal_zzdy) {
if (com_google_android_gms_internal_zzdy.zzyK == this.zzsS) {
return com_google_android_gms_internal_zzdy;
}
int i = com_google_android_gms_internal_zzdy.versionCode;
long j = com_google_android_gms_internal_zzdy.zzyF;
Bundle bundle = com_google_android_gms_internal_zzdy.extras;
int i2 = com_google_android_gms_internal_zzdy.zzyG;
List list = com_google_android_gms_internal_zzdy.zzyH;
boolean z = com_google_android_gms_internal_zzdy.zzyI;
int i3 = com_google_android_gms_internal_zzdy.zzyJ;
boolean z2 = com_google_android_gms_internal_zzdy.zzyK || this.zzsS;
return new zzdy(i, j, bundle, i2, list, z, i3, z2, com_google_android_gms_internal_zzdy.zzyL, com_google_android_gms_internal_zzdy.zzyM, com_google_android_gms_internal_zzdy.zzyN, com_google_android_gms_internal_zzdy.zzyO, com_google_android_gms_internal_zzdy.zzyP, com_google_android_gms_internal_zzdy.zzyQ, com_google_android_gms_internal_zzdy.zzyR, com_google_android_gms_internal_zzdy.zzyS, com_google_android_gms_internal_zzdy.zzyT, com_google_android_gms_internal_zzdy.zzyU);
}
void zzf(@Nullable zzov com_google_android_gms_internal_zzov) {
if (com_google_android_gms_internal_zzov != null && !com_google_android_gms_internal_zzov.zzVq && this.zzsw.zzvg != null && zzv.zzcJ().zza(this.zzsw.zzvg, this.zzsw.zzqr) && this.zzsw.zzvg.getGlobalVisibleRect(new Rect(), null)) {
if (!(com_google_android_gms_internal_zzov == null || com_google_android_gms_internal_zzov.zzMZ == null || com_google_android_gms_internal_zzov.zzMZ.zzkV() == null)) {
com_google_android_gms_internal_zzov.zzMZ.zzkV().zza(null);
}
zza(com_google_android_gms_internal_zzov, false);
com_google_android_gms_internal_zzov.zzVq = true;
}
}
}
|
[
"earl.savadera@lpunetwork.edu.ph"
] |
earl.savadera@lpunetwork.edu.ph
|
68ae726f825858e3646b11d2c3c8d4c536fd443e
|
46e37a335b67c1e455c5543eca93421d1dc50531
|
/src/controlador/Main.java
|
dd29fc59e25c8475d50581a1cab86ce8814aedfc
|
[] |
no_license
|
duvanovik/Tarea3
|
bf10dedcec4e95aad2c6ca632b913e4f989ed483
|
762308c86b68168ec566b449df878013f032a697
|
refs/heads/master
| 2023-01-29T04:19:45.656724
| 2020-12-14T08:50:02
| 2020-12-14T08:50:02
| 314,404,907
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 820
|
java
|
package controlador;
//2
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("/view/colombia_map.fxml"));
Pane ventana = (Pane) loader.load();
Scene scene=new Scene(ventana);
primaryStage.setTitle("GPS Para viajeros");
primaryStage.setScene(scene);
primaryStage.show();
}catch(IOException e) {
System.out.println(e.getMessage());
}
}
public static void main(String[] args) {
launch(args);
}
}
|
[
"47836025+gustavovillada1@users.noreply.github.com"
] |
47836025+gustavovillada1@users.noreply.github.com
|
67ad67b852293d5355731cd1b6df85b54e470c34
|
eab5a0a92d72bdb2394ff52becd018620c41d54a
|
/src/com/imooc/bean/Message.java
|
e2a61b538219f88db354d48b327abb80e44a0781
|
[] |
no_license
|
525766003/Mybatis-studing-for-imooc
|
00ffe1918a6112b7c8240225b29ffd22cda9dbfc
|
96ae4d12f8a91058fd9d312d52ca1526e999b8c5
|
refs/heads/master
| 2020-04-15T02:14:16.614368
| 2015-08-28T06:00:46
| 2015-08-28T06:00:46
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 794
|
java
|
package com.imooc.bean;
/*
* 内容实体类
*/
public class Message {
/*
* 序号
*/
private String id;
/*
* 指令名称
*/
private String command;
/*
* 描述
*/
private String description;
/*
* 操作
*/
private String content;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCommand() {
return command;
}
public void setCommand(String command) {
this.command = command;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
|
[
"243284589@qq.com"
] |
243284589@qq.com
|
84b338929a06498380d8c4a17c71260546c5948e
|
dc1def0f8a0763d524d4d437c7ca17355b400085
|
/src/main/java/gamestudio/entity/Comment.java
|
f5813ecc1eba48e75b930996df39f3c87fbf994b
|
[] |
no_license
|
jrjsnc/gamestudio
|
9fdcc2abece366981ae327805bc38025930f1b53
|
ec929b8d970ef2df8867f36076885854192f7238
|
refs/heads/master
| 2021-05-12T00:05:00.905975
| 2018-01-19T12:08:56
| 2018-01-19T12:08:56
| 117,526,175
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,514
|
java
|
package gamestudio.entity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/*
CREATE TABLE comment(
ident INTEGER PRIMARY KEY,
username VARCHAR(32) NOT NULL,
game VARCHAR(32) NOT NULL,
content VARCHAR(128) NOT NULL,
createdOn TIMESTAMP NOT NULL
)
*/
@Entity
public class Comment {
@Id
@GeneratedValue
private int ident;
private String username;
private String game;
private String content;
private Date createdOn;
public Comment(String username, String game, String content, Date createdOn) {
this.username = username;
this.game = game;
this.content = content;
this.createdOn = new Timestamp(createdOn.getTime());
}
public Comment() {
}
public int getIdent() {
return ident;
}
public void setIdent(int ident) {
this.ident = ident;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getGame() {
return game;
}
public void setGame(String game) {
this.game = game;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCreatedOn() {
return createdOn;
}
public void setCreatedOn(Date createdOn) {
this.createdOn = createdOn;
}
@Override
public String toString() {
return String.format("Coment (%d %s %s %s %tc)", ident, username, game, content, createdOn);
}
}
|
[
"jurajsenic@gmail.com"
] |
jurajsenic@gmail.com
|
ee06046df0d550c979281126b8afc9fbdbcdfa7a
|
1f84291b31b6ef9ed808d606a43524e7e5cce0f6
|
/src/main/java/com/l2jserver/gameserver/instancemanager/games/Lottery.java
|
b1a28629e47d2cd336a71f56e6b306977d98860e
|
[] |
no_license
|
cucky/l2j_server_custom
|
ad57dae381fd9e7fa59a0ce455d595806f8883d7
|
980d9505824f77c7eb4c85449e0e9dabce7fc138
|
refs/heads/master
| 2021-01-19T17:25:19.131683
| 2017-03-01T09:34:02
| 2017-03-01T09:34:02
| 82,452,550
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 14,673
|
java
|
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server 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 com.l2jserver.gameserver.instancemanager.games;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jserver.Config;
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.util.Broadcast;
import com.l2jserver.util.Rnd;
public class Lottery
{
public static final long SECOND = 1000;
public static final long MINUTE = 60000;
protected static final Logger _log = Logger.getLogger(Lottery.class.getName());
private static final String INSERT_LOTTERY = "INSERT INTO games(id, idnr, enddate, prize, newprize) VALUES (?, ?, ?, ?, ?)";
private static final String UPDATE_PRICE = "UPDATE games SET prize=?, newprize=? WHERE id = 1 AND idnr = ?";
private static final String UPDATE_LOTTERY = "UPDATE games SET finished=1, prize=?, newprize=?, number1=?, number2=?, prize1=?, prize2=?, prize3=? WHERE id=1 AND idnr=?";
private static final String SELECT_LAST_LOTTERY = "SELECT idnr, prize, newprize, enddate, finished FROM games WHERE id = 1 ORDER BY idnr DESC LIMIT 1";
private static final String SELECT_LOTTERY_ITEM = "SELECT enchant_level, custom_type2 FROM items WHERE item_id = 4442 AND custom_type1 = ?";
private static final String SELECT_LOTTERY_TICKET = "SELECT number1, number2, prize1, prize2, prize3 FROM games WHERE id = 1 and idnr = ?";
protected int _number;
protected long _prize;
protected boolean _isSellingTickets;
protected boolean _isStarted;
protected long _enddate;
protected Lottery()
{
_number = 1;
_prize = Config.ALT_LOTTERY_PRIZE;
_isSellingTickets = false;
_isStarted = false;
_enddate = System.currentTimeMillis();
if (Config.ALLOW_LOTTERY)
{
(new startLottery()).run();
}
}
public static Lottery getInstance()
{
return SingletonHolder._instance;
}
public int getId()
{
return _number;
}
public long getPrize()
{
return _prize;
}
public long getEndDate()
{
return _enddate;
}
public void increasePrize(long count)
{
_prize += count;
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_PRICE))
{
ps.setLong(1, getPrize());
ps.setLong(2, getPrize());
ps.setInt(3, getId());
ps.execute();
}
catch (SQLException e)
{
_log.log(Level.WARNING, "Lottery: Could not increase current lottery prize: " + e.getMessage(), e);
}
}
public boolean isSellableTickets()
{
return _isSellingTickets;
}
public boolean isStarted()
{
return _isStarted;
}
private class startLottery implements Runnable
{
protected startLottery()
{
// Do nothing
}
@Override
public void run()
{
try (Connection con = ConnectionFactory.getInstance().getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery(SELECT_LAST_LOTTERY))
{
if (rset.next())
{
_number = rset.getInt("idnr");
if (rset.getInt("finished") == 1)
{
_number++;
_prize = rset.getLong("newprize");
}
else
{
_prize = rset.getLong("prize");
_enddate = rset.getLong("enddate");
if (_enddate <= (System.currentTimeMillis() + (2 * MINUTE)))
{
(new finishLottery()).run();
return;
}
if (_enddate > System.currentTimeMillis())
{
_isStarted = true;
ThreadPoolManager.getInstance().scheduleGeneral(new finishLottery(), _enddate - System.currentTimeMillis());
if (_enddate > (System.currentTimeMillis() + (12 * MINUTE)))
{
_isSellingTickets = true;
ThreadPoolManager.getInstance().scheduleGeneral(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
}
return;
}
}
}
}
catch (SQLException e)
{
_log.log(Level.WARNING, "Lottery: Could not restore lottery data: " + e.getMessage(), e);
}
if (Config.DEBUG)
{
_log.info("Lottery: Starting ticket sell for lottery #" + getId() + ".");
}
_isSellingTickets = true;
_isStarted = true;
Broadcast.toAllOnlinePlayers("Lottery tickets are now available for Lucky Lottery #" + getId() + ".");
Calendar finishtime = Calendar.getInstance();
finishtime.setTimeInMillis(_enddate);
finishtime.set(Calendar.MINUTE, 0);
finishtime.set(Calendar.SECOND, 0);
if (finishtime.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
{
finishtime.set(Calendar.HOUR_OF_DAY, 19);
_enddate = finishtime.getTimeInMillis();
_enddate += 604800000;
}
else
{
finishtime.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
finishtime.set(Calendar.HOUR_OF_DAY, 19);
_enddate = finishtime.getTimeInMillis();
}
ThreadPoolManager.getInstance().scheduleGeneral(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
ThreadPoolManager.getInstance().scheduleGeneral(new finishLottery(), _enddate - System.currentTimeMillis());
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_LOTTERY))
{
ps.setInt(1, 1);
ps.setInt(2, getId());
ps.setLong(3, getEndDate());
ps.setLong(4, getPrize());
ps.setLong(5, getPrize());
ps.execute();
}
catch (SQLException e)
{
_log.log(Level.WARNING, "Lottery: Could not store new lottery data: " + e.getMessage(), e);
}
}
}
private class stopSellingTickets implements Runnable
{
protected stopSellingTickets()
{
// Do nothing
}
@Override
public void run()
{
if (Config.DEBUG)
{
_log.info("Lottery: Stopping ticket sell for lottery #" + getId() + ".");
}
_isSellingTickets = false;
Broadcast.toAllOnlinePlayers(SystemMessage.getSystemMessage(SystemMessageId.LOTTERY_TICKET_SALES_TEMP_SUSPENDED));
}
}
private class finishLottery implements Runnable
{
protected finishLottery()
{
// Do nothing
}
@Override
public void run()
{
if (Config.DEBUG)
{
_log.info("Lottery: Ending lottery #" + getId() + ".");
}
int[] luckynums = new int[5];
int luckynum = 0;
for (int i = 0; i < 5; i++)
{
boolean found = true;
while (found)
{
luckynum = Rnd.get(20) + 1;
found = false;
for (int j = 0; j < i; j++)
{
if (luckynums[j] == luckynum)
{
found = true;
}
}
}
luckynums[i] = luckynum;
}
if (Config.DEBUG)
{
_log.info("Lottery: The lucky numbers are " + luckynums[0] + ", " + luckynums[1] + ", " + luckynums[2] + ", " + luckynums[3] + ", " + luckynums[4] + ".");
}
int enchant = 0;
int type2 = 0;
for (int i = 0; i < 5; i++)
{
if (luckynums[i] < 17)
{
enchant += Math.pow(2, luckynums[i] - 1);
}
else
{
type2 += Math.pow(2, luckynums[i] - 17);
}
}
if (Config.DEBUG)
{
_log.info("Lottery: Encoded lucky numbers are " + enchant + ", " + type2);
}
int count1 = 0;
int count2 = 0;
int count3 = 0;
int count4 = 0;
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_LOTTERY_ITEM))
{
ps.setInt(1, getId());
try (ResultSet rset = ps.executeQuery())
{
while (rset.next())
{
int curenchant = rset.getInt("enchant_level") & enchant;
int curtype2 = rset.getInt("custom_type2") & type2;
if ((curenchant == 0) && (curtype2 == 0))
{
continue;
}
int count = 0;
for (int i = 1; i <= 16; i++)
{
int val = curenchant / 2;
if (val != Math.round((double) curenchant / 2))
{
count++;
}
int val2 = curtype2 / 2;
if (val2 != ((double) curtype2 / 2))
{
count++;
}
curenchant = val;
curtype2 = val2;
}
if (count == 5)
{
count1++;
}
else if (count == 4)
{
count2++;
}
else if (count == 3)
{
count3++;
}
else if (count > 0)
{
count4++;
}
}
}
}
catch (SQLException e)
{
_log.log(Level.WARNING, "Lottery: Could restore lottery data: " + e.getMessage(), e);
}
long prize4 = count4 * Config.ALT_LOTTERY_2_AND_1_NUMBER_PRIZE;
long prize1 = 0;
long prize2 = 0;
long prize3 = 0;
if (count1 > 0)
{
prize1 = (long) (((getPrize() - prize4) * Config.ALT_LOTTERY_5_NUMBER_RATE) / count1);
}
if (count2 > 0)
{
prize2 = (long) (((getPrize() - prize4) * Config.ALT_LOTTERY_4_NUMBER_RATE) / count2);
}
if (count3 > 0)
{
prize3 = (long) (((getPrize() - prize4) * Config.ALT_LOTTERY_3_NUMBER_RATE) / count3);
}
if (Config.DEBUG)
{
_log.info("Lottery: " + count1 + " players with all FIVE numbers each win " + prize1 + ".");
_log.info("Lottery: " + count2 + " players with FOUR numbers each win " + prize2 + ".");
_log.info("Lottery: " + count3 + " players with THREE numbers each win " + prize3 + ".");
_log.info("Lottery: " + count4 + " players with ONE or TWO numbers each win " + prize4 + ".");
}
long newprize = getPrize() - (prize1 + prize2 + prize3 + prize4);
if (Config.DEBUG)
{
_log.info("Lottery: Jackpot for next lottery is " + newprize + ".");
}
SystemMessage sm;
if (count1 > 0)
{
// There are winners.
sm = SystemMessage.getSystemMessage(SystemMessageId.AMOUNT_FOR_WINNER_S1_IS_S2_ADENA_WE_HAVE_S3_PRIZE_WINNER);
sm.addInt(getId());
sm.addLong(getPrize());
sm.addLong(count1);
Broadcast.toAllOnlinePlayers(sm);
}
else
{
// There are no winners.
sm = SystemMessage.getSystemMessage(SystemMessageId.AMOUNT_FOR_LOTTERY_S1_IS_S2_ADENA_NO_WINNER);
sm.addInt(getId());
sm.addLong(getPrize());
Broadcast.toAllOnlinePlayers(sm);
}
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_LOTTERY))
{
ps.setLong(1, getPrize());
ps.setLong(2, newprize);
ps.setInt(3, enchant);
ps.setInt(4, type2);
ps.setLong(5, prize1);
ps.setLong(6, prize2);
ps.setLong(7, prize3);
ps.setInt(8, getId());
ps.execute();
}
catch (SQLException e)
{
_log.log(Level.WARNING, "Lottery: Could not store finished lottery data: " + e.getMessage(), e);
}
ThreadPoolManager.getInstance().scheduleGeneral(new startLottery(), MINUTE);
_number++;
_isStarted = false;
}
}
public int[] decodeNumbers(int enchant, int type2)
{
int res[] = new int[5];
int id = 0;
int nr = 1;
while (enchant > 0)
{
int val = enchant / 2;
if (val != Math.round((double) enchant / 2))
{
res[id++] = nr;
}
enchant /= 2;
nr++;
}
nr = 17;
while (type2 > 0)
{
int val = type2 / 2;
if (val != ((double) type2 / 2))
{
res[id++] = nr;
}
type2 /= 2;
nr++;
}
return res;
}
public long[] checkTicket(L2ItemInstance item)
{
return checkTicket(item.getCustomType1(), item.getEnchantLevel(), item.getCustomType2());
}
public long[] checkTicket(int id, int enchant, int type2)
{
long res[] =
{
0,
0
};
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_LOTTERY_TICKET))
{
ps.setInt(1, id);
try (ResultSet rs = ps.executeQuery())
{
if (rs.next())
{
int curenchant = rs.getInt("number1") & enchant;
int curtype2 = rs.getInt("number2") & type2;
if ((curenchant == 0) && (curtype2 == 0))
{
return res;
}
int count = 0;
for (int i = 1; i <= 16; i++)
{
int val = curenchant / 2;
if (val != Math.round((double) curenchant / 2))
{
count++;
}
int val2 = curtype2 / 2;
if (val2 != ((double) curtype2 / 2))
{
count++;
}
curenchant = val;
curtype2 = val2;
}
switch (count)
{
case 0:
break;
case 5:
res[0] = 1;
res[1] = rs.getLong("prize1");
break;
case 4:
res[0] = 2;
res[1] = rs.getLong("prize2");
break;
case 3:
res[0] = 3;
res[1] = rs.getLong("prize3");
break;
default:
res[0] = 4;
res[1] = 200;
}
if (Config.DEBUG)
{
_log.warning("count: " + count + ", id: " + id + ", enchant: " + enchant + ", type2: " + type2);
}
}
}
}
catch (SQLException e)
{
_log.log(Level.WARNING, "Lottery: Could not check lottery ticket #" + id + ": " + e.getMessage(), e);
}
return res;
}
private static class SingletonHolder
{
protected static final Lottery _instance = new Lottery();
}
}
|
[
"Michal@Michal"
] |
Michal@Michal
|
401f882ab2818a91d2b0b0fd870a174ab7ac1d02
|
ec5fe8f20dfe82b479cea3da24c78190f768e086
|
/cas-4.1.0/cas-server-core-api/src/main/java/org/jasig/cas/services/RegisteredServiceUsernameAttributeProvider.java
|
d9e14d39596d68ade6ca978f89a8300a3eb210da
|
[
"MIT",
"Apache-2.0",
"CDDL-1.1",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0",
"LGPL-2.0-or-later",
"LGPL-2.1-or-later",
"W3C",
"BSD-3-Clause",
"GPL-1.0-or-later",
"SAX-PD",
"LicenseRef-scancode-free-unknown",
"MPL-1.1",
"GPL-2.0-only",
"LicenseRef-scancode-jsr-107-jcache-spec-2013",
"LicenseRef-scancode-public-domain",
"EPL-1.0",
"Classpath-exception-2.0",
"LGPL-2.1-only"
] |
permissive
|
hsj-xiaokang/springboot-shiro-cas-mybatis
|
b4cf76dc2994d63f771da0549cf711ea674e53bf
|
3673a9a9b279dd1e624c1a7a953182301f707997
|
refs/heads/master
| 2022-06-26T15:28:49.854390
| 2020-12-06T04:43:13
| 2020-12-06T04:43:13
| 103,009,179
| 42
| 24
|
MIT
| 2022-06-25T07:27:42
| 2017-09-10T06:35:28
|
Java
|
UTF-8
|
Java
| false
| false
| 1,551
|
java
|
/*
* Licensed to Apereo under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Apereo 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 the following location:
*
* 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.jasig.cas.services;
import org.jasig.cas.authentication.principal.Principal;
import org.jasig.cas.authentication.principal.Service;
import java.io.Serializable;
/**
* Strategy interface to define what username attribute should
* be returned for a given registered service.
* @author Misagh Moayyed
* @since 4.1.0
*/
public interface RegisteredServiceUsernameAttributeProvider extends Serializable {
/**
* Resolve the username that is to be returned to CAS clients.
*
* @param principal the principal
* @param service the service for which attribute should be calculated
* @return the username value configured for this service
*/
String resolveUsername(Principal principal, Service service);
}
|
[
"2356899074@qq.com"
] |
2356899074@qq.com
|
e1d2040d4357a2097f7b492b1490a8c9bfbfe62e
|
97bd43f52fcac1f4a06d5a46f5a8ddb31116ffc1
|
/Downloads/inc.komarraju.learning.spring/inc.komarraju.learning.spring/src/main/java/springlearning/ParseCSV.java
|
341cdcdd3fef05e8c0673dd4362f89278d06ad94
|
[] |
no_license
|
Sasikomarraju/marfileoperations
|
fbd89bf765104d47823f6c1f41c6cc6c541940ab
|
38e9986595a6f48393aabb33f4ec7c27eeb892a0
|
refs/heads/master
| 2020-05-07T10:14:10.102779
| 2019-04-09T16:07:58
| 2019-04-09T16:07:58
| 180,410,284
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,426
|
java
|
package springlearning;
import java.io.FileReader;
import com.opencsv.CSVReader;
public class ParseCSV {
public static void main(String[] args) {
try {
//csv file containing data
String strFile = "C:/Users/skoma814/Desktop/Batch Merge/Account_Merge_Taskforce Cases_test23.csv";
CSVReader reader = new CSVReader(new FileReader(strFile));
String [] nextLine;
int lineNumber = 0;
while ((nextLine = reader.readNext()) != null) {
//System.out.println("Line # " + lineNumber);
// System.out.print(nextLine[0]);
//System.out.print(" ");
//System.out.print(nextLine[1]);
//System.out.print("\n");
String[] tokens = nextLine[1].split(",");
CombineCase combineCase = new CombineCase(nextLine);
for (String s:tokens ) {
System.out.println("token element:" + s);
}
String tempDescription = combineCase.formatDescription(nextLine[1]);
//if (tempDescription != null && !tempDescription.equals("") ) {
//tempDescription = (tempDescription).replace('"', ' ') + "," ;
System.out.println("Returned from method:" + tempDescription);
//}
// System.out.println("tempDescription:" + tempDescription);
lineNumber++;
}
}
catch(Exception e) {
e.printStackTrace();
}
}
}
|
[
"skoma814@marriott.com"
] |
skoma814@marriott.com
|
3bd87b9ba9af44dd058bcb78787922f35e5d6a23
|
99e9a5ed41886ec62411e531313e115f8e2944a2
|
/spring-boot-all/spring-boot-security/src/main/java/com/itsz/springboot/security/boot/SecurityBootApplication.java
|
2d297fba5384dbcff0b9a1b633347e31cd3d82e2
|
[] |
no_license
|
hbzhou/hello-world
|
aef92fca6b8cdedcbe57ee67d3b068290d153fa7
|
b09f95b0dfa9e5b26c3a6cd2526b402328feed78
|
refs/heads/master
| 2022-07-07T16:01:15.737046
| 2020-06-08T13:30:29
| 2020-06-08T13:30:29
| 206,464,023
| 1
| 0
| null | 2022-06-21T04:06:45
| 2019-09-05T03:10:31
|
Java
|
UTF-8
|
Java
| false
| false
| 870
|
java
|
package com.itsz.springboot.security.boot;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.util.UUID;
@SpringBootApplication(
scanBasePackages = {
"com.itsz.springboot.security.boot",
"com.itsz.springboot.security.auth.controller",
"com.itsz.springboot.security.auth.filter",
"com.itsz.springboot.security.user.service"
}
)
public class SecurityBootApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(SecurityBootApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
System.out.println(UUID.randomUUID().toString());
}
}
|
[
"hb.zhou@itsz.cn"
] |
hb.zhou@itsz.cn
|
dff0d5620ee9fa0a2d226a10b8b37d62d3a8f6dd
|
908b9859a4b45dca4d916720122a1b40c0fafe43
|
/labs/ebms/src/main/java/somapa/ptc/xml/nsw/DigestMethodDescriptor.java
|
a93884e125dcf2bc2fc476863725a196c568b59a
|
[] |
no_license
|
mugabarigiraCHUK/scotomax-hman
|
778a3b48c9ac737414beaee9d72d1138a1e5b1ee
|
786478731338b5af7a86cada2e4582ddb3b2569f
|
refs/heads/master
| 2021-01-10T06:50:26.179698
| 2012-08-13T16:35:46
| 2012-08-13T16:35:46
| 46,422,699
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,044
|
java
|
/*
* This class was automatically generated with
* <a href="http://castor.exolab.org">Castor 0.9.4</a>, using an
* XML Schema.
* $Id$
*/
package somapa.ptc.xml.nsw;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.mapping.AccessMode;
import org.exolab.castor.mapping.ClassDescriptor;
import org.exolab.castor.mapping.FieldDescriptor;
import org.exolab.castor.xml.*;
import org.exolab.castor.xml.FieldValidator;
import org.exolab.castor.xml.TypeValidator;
import org.exolab.castor.xml.XMLFieldDescriptor;
import org.exolab.castor.xml.handlers.*;
import org.exolab.castor.xml.util.XMLFieldDescriptorImpl;
import org.exolab.castor.xml.validators.*;
/**
*
*
* @version $Revision$ $Date$
**/
public class DigestMethodDescriptor extends DigestMethodTypeDescriptor {
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
private java.lang.String nsPrefix;
private java.lang.String nsURI;
private java.lang.String xmlName;
private org.exolab.castor.xml.XMLFieldDescriptor identity;
//----------------/
//- Constructors -/
//----------------/
public DigestMethodDescriptor() {
super();
setExtendsWithoutFlatten(new DigestMethodTypeDescriptor());
nsURI = "http://www.w3.org/2000/09/xmldsig#";
xmlName = "DigestMethod";
} //-- somapa.ptc.xml.nsw.DigestMethodDescriptor()
//-----------/
//- Methods -/
//-----------/
/**
**/
public org.exolab.castor.mapping.AccessMode getAccessMode()
{
return null;
} //-- org.exolab.castor.mapping.AccessMode getAccessMode()
/**
**/
public org.exolab.castor.mapping.ClassDescriptor getExtends()
{
return super.getExtends();
} //-- org.exolab.castor.mapping.ClassDescriptor getExtends()
/**
**/
public org.exolab.castor.mapping.FieldDescriptor getIdentity()
{
if (identity == null)
return super.getIdentity();
return identity;
} //-- org.exolab.castor.mapping.FieldDescriptor getIdentity()
/**
**/
public java.lang.Class getJavaClass()
{
return somapa.ptc.xml.nsw.DigestMethod.class;
} //-- java.lang.Class getJavaClass()
/**
**/
public java.lang.String getNameSpacePrefix()
{
return nsPrefix;
} //-- java.lang.String getNameSpacePrefix()
/**
**/
public java.lang.String getNameSpaceURI()
{
return nsURI;
} //-- java.lang.String getNameSpaceURI()
/**
**/
public org.exolab.castor.xml.TypeValidator getValidator()
{
return this;
} //-- org.exolab.castor.xml.TypeValidator getValidator()
/**
**/
public java.lang.String getXMLName()
{
return xmlName;
} //-- java.lang.String getXMLName()
}
|
[
"developmax@ad344d4b-5b83-fe1d-98cd-db9ebd70f650"
] |
developmax@ad344d4b-5b83-fe1d-98cd-db9ebd70f650
|
ee510c6f6b52421cdb254bb77bc8ca0407493b7b
|
d438b8b4b7953e20586019adcef6133587a1bdd3
|
/peppol-smp-server-webapp/src/main/java/com/helger/peppol/smpserver/mock/MockSMPClient.java
|
61765e2195801aa295461ce4c03820630dd0148e
|
[] |
no_license
|
jannewaren/peppol-smp-server
|
98ecdbd90010f7e60e9e2e4e32cb58ec5443aa21
|
1e1cb0878def390f0d165e906d92b7c36734ca2c
|
refs/heads/master
| 2021-07-14T05:09:15.555610
| 2017-10-16T16:40:12
| 2017-10-16T16:40:12
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,030
|
java
|
/**
* Copyright (C) 2014-2017 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.peppol.smpserver.mock;
import com.helger.commons.url.URLHelper;
import com.helger.peppol.smpclient.SMPClient;
/**
* A special SMP client customized for testing purposes only.
*
* @author Philip Helger
*/
public class MockSMPClient extends SMPClient
{
public MockSMPClient ()
{
super (URLHelper.getAsURI (MockWebServer.BASE_URI_HTTP));
}
}
|
[
"philip@helger.com"
] |
philip@helger.com
|
ca6d988b3ffa1bdefadf40dddae91ef39dbbbca9
|
da07292a4e8366ead0da54a45c15958f93c92ac7
|
/modules/gui/src/com/bernatskyi/delta/gui/reporting/storage/StorageReportParametes.java
|
3597fc12a555262ccc215df2e1803dedba7f7d3a
|
[] |
no_license
|
BYuriy/delta
|
4345ac621d2f2f656514fb5629989489b4c94c9e
|
0ae23b6ee467e0c7943f4f24fd5ce5b4b466ef48
|
refs/heads/master
| 2021-01-19T07:31:17.695115
| 2016-03-01T21:57:35
| 2016-03-01T21:57:35
| 42,828,272
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,365
|
java
|
/*
* Copyright (c) 2015 delta
*/
package com.bernatskyi.delta.gui.reporting.storage;
import com.bernatskyi.delta.entity.Storage;
import com.haulmont.cuba.gui.WindowManager;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.components.actions.BaseAction;
import com.haulmont.cuba.gui.data.CollectionDatasource;
import com.haulmont.cuba.gui.data.ValueListener;
import org.apache.commons.collections.CollectionUtils;
import javax.inject.Named;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* @author Yuriy
*/
public class StorageReportParametes extends AbstractWindow {
@Named("cancellButton")
private Button cancelButton;
@Named("generateReportButton")
private Button generateButton;
@Named("dateParameterField")
private DateField dateField;
@Named("storagesTokenList")
private TokenList storagesTokenList;
@Named("allStoragesDs")
private CollectionDatasource<Storage, UUID> allStoragesDs;
@Override
public void init(Map<String, Object> params) {
cancelButton.setAction(new DialogAction(DialogAction.Type.CANCEL) {
@Override
public void actionPerform(Component component) {
close(Window.CLOSE_ACTION_ID);
}
});
generateButton.setAction(new BaseAction("GENERATE_STORAGE_REPORT_ACTION") {
@Override
public void actionPerform(Component component) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("date", dateField.getValue());
parameters.put(
"storages", CollectionUtils.isNotEmpty(storagesTokenList.getDatasource().getItems())
? storagesTokenList.getDatasource().getItems()
: allStoragesDs.getItems()
);
openWindow("delta$StorageReport", WindowManager.OpenType.THIS_TAB, parameters);
}
});
// generateButton.setEnabled(false);
dateField.setValue(new Date());
dateField.addListener(new ValueListener() {
@Override
public void valueChanged(Object source, String property, Object prevValue, Object value) {
generateButton.setEnabled(value != null);
}
});
}
}
|
[
"vZ242FCOZ3Z3qwer"
] |
vZ242FCOZ3Z3qwer
|
505731f7b4aa891765e436e3fa76cefc8f44ebef
|
ae0e91e20e2f32db1f92bfb0e7f840b641b17806
|
/stuff/src/main/java/net/byte2data/consept/designpatterns/behavioral/strategy/streetfighter/context/concretes/ChunLi.java
|
4727bc4eed8a53cc967448a0e97bb5c5f954f1a9
|
[] |
no_license
|
bariscinar/byte2data
|
784907ef6d588faff8a007dbb814f37a220ad09e
|
98363c8cacaa265683b86e278359ad7443cffdab
|
refs/heads/master
| 2022-12-01T21:06:38.410181
| 2019-07-17T12:52:08
| 2019-07-17T12:52:08
| 197,385,184
| 0
| 0
| null | 2022-11-24T08:54:15
| 2019-07-17T12:29:03
|
Java
|
UTF-8
|
Java
| false
| false
| 348
|
java
|
package net.byte2data.consept.designpatterns.behavioral.strategy.streetfighter.context.concretes;
import net.byte2data.consept.designpatterns.behavioral.strategy.streetfighter.context.AbstractCharacter;
public class ChunLi extends AbstractCharacter {
@Override
public void display() {
System.out.println("IM TOO HOT!!");
}
}
|
[
"baris@linxa.com"
] |
baris@linxa.com
|
0dc1291b9d08d0c8d9d72eb2912e1cff0dcba888
|
9d32980f5989cd4c55cea498af5d6a413e08b7a2
|
/A5_8_1_0/src/main/java/com/android/server/CommonTimeManagementService.java
|
87f39fd91395250559f6f287c5546d75d27b5425
|
[] |
no_license
|
liuhaosource/OppoFramework
|
e7cc3bcd16958f809eec624b9921043cde30c831
|
ebe39acabf5eae49f5f991c5ce677d62b683f1b6
|
refs/heads/master
| 2023-06-03T23:06:17.572407
| 2020-11-30T08:40:07
| 2020-11-30T08:40:07
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 11,993
|
java
|
package com.android.server;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.INetworkManagementEventObserver;
import android.net.InterfaceConfiguration;
import android.os.Binder;
import android.os.CommonTimeConfig;
import android.os.CommonTimeConfig.OnServerDiedListener;
import android.os.Handler;
import android.os.INetworkManagementService;
import android.os.INetworkManagementService.Stub;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.util.Log;
import com.android.internal.util.DumpUtils;
import com.android.server.display.OppoBrightUtils;
import com.android.server.face.FaceDaemonWrapper;
import com.android.server.net.BaseNetworkObserver;
import java.io.FileDescriptor;
import java.io.PrintWriter;
class CommonTimeManagementService extends Binder {
private static final boolean ALLOW_WIFI;
private static final String ALLOW_WIFI_PROP = "ro.common_time.allow_wifi";
private static final boolean AUTO_DISABLE;
private static final String AUTO_DISABLE_PROP = "ro.common_time.auto_disable";
private static final byte BASE_SERVER_PRIO;
private static final InterfaceScoreRule[] IFACE_SCORE_RULES;
private static final int NATIVE_SERVICE_RECONNECT_TIMEOUT = 5000;
private static final int NO_INTERFACE_TIMEOUT = SystemProperties.getInt(NO_INTERFACE_TIMEOUT_PROP, OppoBrightUtils.SPECIAL_AMBIENT_LIGHT_HORIZON);
private static final String NO_INTERFACE_TIMEOUT_PROP = "ro.common_time.no_iface_timeout";
private static final String SERVER_PRIO_PROP = "ro.common_time.server_prio";
private static final String TAG = CommonTimeManagementService.class.getSimpleName();
private CommonTimeConfig mCTConfig;
private OnServerDiedListener mCTServerDiedListener = new -$Lambda$qXtDhnbBL0MhXoSy7vXxLi-Juu4(this);
private BroadcastReceiver mConnectivityMangerObserver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
CommonTimeManagementService.this.reevaluateServiceState();
}
};
private final Context mContext;
private String mCurIface;
private boolean mDetectedAtStartup = false;
private byte mEffectivePrio = BASE_SERVER_PRIO;
private INetworkManagementEventObserver mIfaceObserver = new BaseNetworkObserver() {
public void interfaceStatusChanged(String iface, boolean up) {
CommonTimeManagementService.this.reevaluateServiceState();
}
public void interfaceLinkStateChanged(String iface, boolean up) {
CommonTimeManagementService.this.reevaluateServiceState();
}
public void interfaceAdded(String iface) {
CommonTimeManagementService.this.reevaluateServiceState();
}
public void interfaceRemoved(String iface) {
CommonTimeManagementService.this.reevaluateServiceState();
}
};
private final Object mLock = new Object();
private INetworkManagementService mNetMgr;
private Handler mNoInterfaceHandler = new Handler();
private Runnable mNoInterfaceRunnable = new -$Lambda$VaVGUZuNs2jqHMhhxPzwNl4zK-M((byte) 1, this);
private Handler mReconnectHandler = new Handler();
private Runnable mReconnectRunnable = new -$Lambda$VaVGUZuNs2jqHMhhxPzwNl4zK-M((byte) 0, this);
private static class InterfaceScoreRule {
public final String mPrefix;
public final byte mScore;
public InterfaceScoreRule(String prefix, byte score) {
this.mPrefix = prefix;
this.mScore = score;
}
}
static {
boolean z;
if (SystemProperties.getInt(AUTO_DISABLE_PROP, 1) != 0) {
z = true;
} else {
z = false;
}
AUTO_DISABLE = z;
if (SystemProperties.getInt(ALLOW_WIFI_PROP, 0) != 0) {
z = true;
} else {
z = false;
}
ALLOW_WIFI = z;
int tmp = SystemProperties.getInt(SERVER_PRIO_PROP, 1);
if (tmp < 1) {
BASE_SERVER_PRIO = (byte) 1;
} else if (tmp > 30) {
BASE_SERVER_PRIO = (byte) 30;
} else {
BASE_SERVER_PRIO = (byte) tmp;
}
if (ALLOW_WIFI) {
IFACE_SCORE_RULES = new InterfaceScoreRule[]{new InterfaceScoreRule("wlan", (byte) 1), new InterfaceScoreRule("eth", (byte) 2)};
return;
}
IFACE_SCORE_RULES = new InterfaceScoreRule[]{new InterfaceScoreRule("eth", (byte) 2)};
}
public CommonTimeManagementService(Context context) {
this.mContext = context;
}
void systemRunning() {
if (ServiceManager.checkService("common_time.config") == null) {
Log.i(TAG, "No common time service detected on this platform. Common time services will be unavailable.");
return;
}
this.mDetectedAtStartup = true;
this.mNetMgr = Stub.asInterface(ServiceManager.getService("network_management"));
try {
this.mNetMgr.registerObserver(this.mIfaceObserver);
} catch (RemoteException e) {
}
IntentFilter filter = new IntentFilter();
filter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
this.mContext.registerReceiver(this.mConnectivityMangerObserver, filter);
connectToTimeConfig();
}
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (!DumpUtils.checkDumpPermission(this.mContext, TAG, pw)) {
return;
}
if (this.mDetectedAtStartup) {
synchronized (this.mLock) {
String str;
pw.println("Current Common Time Management Service Config:");
String str2 = " Native service : %s";
Object[] objArr = new Object[1];
if (this.mCTConfig == null) {
str = "reconnecting";
} else {
str = "alive";
}
objArr[0] = str;
pw.println(String.format(str2, objArr));
str2 = " Bound interface : %s";
objArr = new Object[1];
objArr[0] = this.mCurIface == null ? "unbound" : this.mCurIface;
pw.println(String.format(str2, objArr));
str2 = " Allow WiFi : %s";
objArr = new Object[1];
objArr[0] = ALLOW_WIFI ? Shell.NIGHT_MODE_STR_YES : Shell.NIGHT_MODE_STR_NO;
pw.println(String.format(str2, objArr));
str2 = " Allow Auto Disable : %s";
objArr = new Object[1];
objArr[0] = AUTO_DISABLE ? Shell.NIGHT_MODE_STR_YES : Shell.NIGHT_MODE_STR_NO;
pw.println(String.format(str2, objArr));
pw.println(String.format(" Server Priority : %d", new Object[]{Byte.valueOf(this.mEffectivePrio)}));
pw.println(String.format(" No iface timeout : %d", new Object[]{Integer.valueOf(NO_INTERFACE_TIMEOUT)}));
}
return;
}
pw.println("Native Common Time service was not detected at startup. Service is unavailable");
}
private void cleanupTimeConfig() {
this.mReconnectHandler.removeCallbacks(this.mReconnectRunnable);
this.mNoInterfaceHandler.removeCallbacks(this.mNoInterfaceRunnable);
if (this.mCTConfig != null) {
this.mCTConfig.release();
this.mCTConfig = null;
}
}
private void connectToTimeConfig() {
cleanupTimeConfig();
try {
synchronized (this.mLock) {
this.mCTConfig = new CommonTimeConfig();
this.mCTConfig.setServerDiedListener(this.mCTServerDiedListener);
this.mCurIface = this.mCTConfig.getInterfaceBinding();
this.mCTConfig.setAutoDisable(AUTO_DISABLE);
this.mCTConfig.setMasterElectionPriority(this.mEffectivePrio);
}
if (NO_INTERFACE_TIMEOUT >= 0) {
this.mNoInterfaceHandler.postDelayed(this.mNoInterfaceRunnable, (long) NO_INTERFACE_TIMEOUT);
}
reevaluateServiceState();
} catch (RemoteException e) {
scheduleTimeConfigReconnect();
}
}
private void scheduleTimeConfigReconnect() {
cleanupTimeConfig();
Log.w(TAG, String.format("Native service died, will reconnect in %d mSec", new Object[]{Integer.valueOf(5000)}));
this.mReconnectHandler.postDelayed(this.mReconnectRunnable, FaceDaemonWrapper.TIMEOUT_FACED_BINDERCALL_CHECK);
}
private void handleNoInterfaceTimeout() {
if (this.mCTConfig != null) {
Log.i(TAG, "Timeout waiting for interface to come up. Forcing networkless master mode.");
if (-7 == this.mCTConfig.forceNetworklessMasterMode()) {
scheduleTimeConfigReconnect();
}
}
}
private void reevaluateServiceState() {
String bindIface = null;
int bestScore = -1;
try {
String[] ifaceList = this.mNetMgr.listInterfaces();
if (ifaceList != null) {
for (String iface : ifaceList) {
byte thisScore = (byte) -1;
for (InterfaceScoreRule r : IFACE_SCORE_RULES) {
if (iface.contains(r.mPrefix)) {
thisScore = r.mScore;
break;
}
}
if (thisScore > bestScore) {
InterfaceConfiguration config = this.mNetMgr.getInterfaceConfig(iface);
if (config != null && config.isActive()) {
bindIface = iface;
byte bestScore2 = thisScore;
}
}
}
}
} catch (RemoteException e) {
bindIface = null;
}
boolean doRebind = true;
synchronized (this.mLock) {
if (bindIface != null) {
if (this.mCurIface == null) {
Log.e(TAG, String.format("Binding common time service to %s.", new Object[]{bindIface}));
this.mCurIface = bindIface;
}
}
if (bindIface == null) {
if (this.mCurIface != null) {
Log.e(TAG, "Unbinding common time service.");
this.mCurIface = null;
}
}
if (bindIface != null) {
if (!(this.mCurIface == null || (bindIface.equals(this.mCurIface) ^ 1) == 0)) {
Log.e(TAG, String.format("Switching common time service binding from %s to %s.", new Object[]{this.mCurIface, bindIface}));
this.mCurIface = bindIface;
}
}
doRebind = false;
}
if (doRebind && this.mCTConfig != null) {
byte newPrio;
if (bestScore > 0) {
newPrio = (byte) (BASE_SERVER_PRIO * bestScore);
} else {
newPrio = BASE_SERVER_PRIO;
}
if (newPrio != this.mEffectivePrio) {
this.mEffectivePrio = newPrio;
this.mCTConfig.setMasterElectionPriority(this.mEffectivePrio);
}
if (this.mCTConfig.setNetworkBinding(this.mCurIface) != 0) {
scheduleTimeConfigReconnect();
} else if (NO_INTERFACE_TIMEOUT >= 0) {
this.mNoInterfaceHandler.removeCallbacks(this.mNoInterfaceRunnable);
if (this.mCurIface == null) {
this.mNoInterfaceHandler.postDelayed(this.mNoInterfaceRunnable, (long) NO_INTERFACE_TIMEOUT);
}
}
}
}
}
|
[
"dstmath@163.com"
] |
dstmath@163.com
|
365e9b96c7fb10b036c46128b625b8a8b9e1ffe6
|
55bf526949e399838334d201a9743633c584f53f
|
/tests/org.jboss.tools.teiid.reddeer/src/org/jboss/tools/teiid/reddeer/preference/DriverDefinitionPreferencePageExt.java
|
2fa583916e1ad6312294d8e29ea6ebcf3e9d3d7a
|
[] |
no_license
|
jniederm/jbosstools-integration-tests
|
615377fc65d56387e20cb7b449a8d6c38756c2c1
|
2d43dc88a77492194567dcc4b4771af054db53ae
|
refs/heads/master
| 2021-01-21T01:27:35.301358
| 2013-08-27T15:27:22
| 2013-08-27T19:46:45
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,695
|
java
|
package org.jboss.tools.teiid.reddeer.preference;
import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.SWT;
import org.jboss.reddeer.eclipse.datatools.ui.DriverDefinition;
import org.jboss.reddeer.eclipse.datatools.ui.DriverTemplate;
import org.jboss.reddeer.eclipse.datatools.ui.preference.DriverDefinitionPreferencePage;
import org.jboss.reddeer.eclipse.datatools.ui.wizard.DriverDefinitionPage;
import org.jboss.reddeer.eclipse.datatools.ui.wizard.DriverDefinitionWizard;
import org.jboss.reddeer.swt.impl.button.PushButton;
import org.jboss.reddeer.swt.util.Bot;
public class DriverDefinitionPreferencePageExt extends DriverDefinitionPreferencePage {
@Override
public void open() {
if (isRunningOnMacOs()) {
Bot.get().shells()[0].pressShortcut(SWT.COMMAND, ',');
}
super.open();
}
public void addDriverDefinition(DriverDefinition driverDefinition) {
new PushButton("Add...").click();
new DriverDefinitionWizardExt(driverDefinition).execute();
new PushButton("OK").click();
}
private static boolean isRunningOnMacOs() {
return Platform.getOS().equalsIgnoreCase("macosx");
}
private class DriverDefinitionWizardExt extends DriverDefinitionWizard {
private DriverDefinition driverDefinition;
public DriverDefinitionWizardExt(DriverDefinition driverDefinition) {
this.driverDefinition = driverDefinition;
}
public void execute() {
DriverTemplate drvTemp = driverDefinition.getDriverTemplate();
DriverDefinitionPage page = getFirstPage();
page.selectDriverTemplate(drvTemp.getType(), drvTemp.getVersion());
page.setName(driverDefinition.getDriverName());
page.addDriverLibrary(driverDefinition.getDriverLibrary());
}
}
}
|
[
"vpakan@redhat.com"
] |
vpakan@redhat.com
|
5d047219b3b08f4b0930edbc486e2945d182e8a8
|
1a44919227bf3846d43eef6e67b770b0b72d105b
|
/app/src/main/java/com/example/android/bakingapp/data/models/Recipe.java
|
0fe0f01b3e7ed3f8395d21a57f3a0a41bd9b64f6
|
[] |
no_license
|
ghenamd/BakingApp
|
64914af6419e32e0fd843bef08e8f2b8fe6fe004
|
b0a8d797feadb35a730b0eda8c0188aeb7e973cd
|
refs/heads/master
| 2020-03-08T19:48:27.530521
| 2018-08-21T09:43:31
| 2018-08-21T09:43:31
| 128,364,595
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,898
|
java
|
package com.example.android.bakingapp.data.models;
import android.arch.persistence.room.Ignore;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
import java.util.List;
public class Recipe implements Parcelable {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("ingredients")
@Expose
@Ignore
private ArrayList<Ingredient> ingredients ;
@SerializedName("steps")
@Expose
@Ignore
private ArrayList<Step> steps ;
@SerializedName("servings")
@Expose
private Integer servings;
@SerializedName("image")
@Expose
private String image;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Ingredient> getIngredients() {
return ingredients;
}
public void setIngredients(ArrayList<Ingredient> ingredients) {
this.ingredients = ingredients;
}
public List<Step> getSteps() {
return steps;
}
public void setSteps(ArrayList<Step> steps) {
this.steps = steps;
}
public Integer getServings() {
return servings;
}
public void setServings(Integer servings) {
this.servings = servings;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeValue(this.id);
dest.writeString(this.name);
dest.writeTypedList(this.ingredients);
dest.writeList(this.steps);
dest.writeValue(this.servings);
dest.writeString(this.image);
}
public Recipe() {
}
protected Recipe(Parcel in) {
this.id = (Integer) in.readValue(Integer.class.getClassLoader());
this.name = in.readString();
this.ingredients = in.createTypedArrayList(Ingredient.CREATOR);
this.steps = new ArrayList<Step>();
in.readList(this.steps, Step.class.getClassLoader());
this.servings = (Integer) in.readValue(Integer.class.getClassLoader());
this.image = in.readString();
}
public static final Parcelable.Creator<Recipe> CREATOR = new Parcelable.Creator<Recipe>() {
@Override
public Recipe createFromParcel(Parcel source) {
return new Recipe(source);
}
@Override
public Recipe[] newArray(int size) {
return new Recipe[size];
}
};
}
|
[
"evaflorn@yahoo.com"
] |
evaflorn@yahoo.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.