blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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;
}
}
| [
"[email protected]"
] | |
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);
}
}
| [
"[email protected]"
] | |
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);
}
}
}
}
}
| [
"[email protected]"
] | |
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());
}
}
| [
""
] | |
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;
}
}
| [
"[email protected]"
] | |
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;
}
}
| [
"[email protected]"
] | |
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 <[email protected]>
*
* 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();
}
| [
"[email protected]"
] | |
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;
}
}
| [
"[email protected]"
] | |
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;
}
} | [
"[email protected]"
] | |
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";
}
}
| [
"[email protected]"
] | |
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; | [
"[email protected]"
] | |
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);
}
}
| [
"[email protected]"
] | |
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;
}
}
}
| [
"[email protected]"
] | |
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();
}
}
| [
"[email protected]"
] | |
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 {
}
| [
"[email protected]"
] | |
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
| [
"[email protected]"
] | |
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));
}
}
| [
"[email protected]"
] | |
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();
}
}
| [
"[email protected]"
] | |
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);
}
}
}
| [
"[email protected]"
] | |
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 |
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;
}
}
| [
"[email protected]"
] | |
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;
}
}
| [
"[email protected]"
] | |
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));
}
}
| [
"[email protected]"
] | |
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:
}
}
}
}
| [
"[email protected]"
] | |
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();
}
}
| [
"[email protected]"
] | |
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();
}
}
| [
"[email protected]"
] | |
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);
}
}
| [
"[email protected]"
] | |
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();
} | [
"[email protected]"
] | |
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();
}
}
| [
"[email protected]"
] | |
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);
}
| [
"[email protected]"
] | |
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 |
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);
}
}
| [
"[email protected]"
] | |
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 | [
"[email protected]"
] | |
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();
}}
| [
"[email protected]"
] | |
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;
}
}
| [
"[email protected]"
] | |
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;
}
}
| [
"[email protected]"
] | |
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 {
}
}
| [
"[email protected]"
] | |
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);
}
}
| [
"[email protected]"
] | |
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();
}
} | [
"[email protected]"
] | |
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;
}
}
| [
"[email protected]"
] | |
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();
}
}
| [
"[email protected]"
] | |
228d21a55480c7ee4f3dae7d0bd13344bcd21bfc | b1f37fb2e7c42602eabaf57d3f0042e805b98c4a | /cit202/assignment7/SelectionSort.java | 1cb88768303202f9d291d3523146bc0d3e4c1280 | [] | no_license | rpgist/cis-203 | bab5852f3c96879ad3e2c0d7e087e754f2f615a0 | 3501f9f15314ac2aaa35ae70295b3883329df07f | refs/heads/master | 2021-06-11T02:14:55.293743 | 2021-03-10T14:49:01 | 2021-03-10T14:49:01 | 90,420,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,314 | java | import java.util.*;
public class SelectionSort implements Sorter {
// field
private int [] a;
// constructor
public SelectionSort (int [] a) {
this.a = a;
}
// Postcondition: array a is sorted
public void sort() {
selectionSort(0);
}
// Postcondition: array a is sorted (using selection sort)
private void selectionSort(int position) {
if (position == a.length)
return;
else{
int min = findMinPosition(position, position+1);
swap (position, min);
selectionSort(position+1);
}
}
// Parameter: thisPosition, the position in the array we are selecting for
// Returns: the position in the array (between thisPosition and a.length-1)
// where the smallest value is held
private int findMinPosition(int thisPosition, int nextPosition) {
if (nextPosition == a.length)
return thisPosition;
else if( a[nextPosition]<a[thisPosition])
return findMinPosition(nextPosition, nextPosition+1);
else
return findMinPosition(thisPosition, nextPosition+1);
}
// Parameters: i, j - two positions in array a
// Postcondition: the values at a[i] with a[j] have been swapped
public void swap(int i, int j) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
| [
"[email protected]"
] | |
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> {
}
| [
"[email protected]"
] | |
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());
}
} | [
"[email protected]"
] | |
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;
}
}
} | [
"[email protected]"
] | |
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);
}
}
| [
"[email protected]"
] | |
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;
}
}
| [
"[email protected]"
] | |
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;
}
}
| [
"[email protected]"
] | |
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;
}
}
}
| [
"[email protected]"
] | |
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();
// }
// }
}
| [
"[email protected]"
] | |
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) |
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));
}
} | [
"[email protected]"
] | |
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;
}
} | [
"[email protected]"
] | |
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();
}
}
}
| [
"[email protected]"
] | |
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();
}
}
});
}
}
| [
"[email protected]"
] | |
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);
}
}
| [
"[email protected]"
] | |
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();
}
}
} | [
"[email protected]"
] | |
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);
}
}
| [
"[email protected]"
] | |
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;
}
}
| [
"[email protected]"
] | |
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;
}
}
| [
"[email protected]"
] | |
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));
}
}
| [
"[email protected]"
] | |
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);
}
| [
"[email protected]"
] | |
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());
}
} | [
"[email protected]"
] | |
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);
}
}
| [
"[email protected]"
] | |
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;
}
}
| [
"[email protected]"
] | |
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());
}
}
}
| [
"[email protected]"
] | |
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();
}
} | [
"[email protected]"
] | |
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 |
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!!");
}
}
| [
"[email protected]"
] | |
2b7b824c200b1da2619357a74383bd6b9c2b7ff8 | 45b0b5ae73296b72eee2aac6f7114ecdcf042fd9 | /Main.java | 68eb44632e553c44c5d7e5366ad2f8b624904b75 | [] | no_license | jones7jk/Lab8 | a8e76f64559ad809d9f5be20c9d793586fd926d9 | 10e7577e4023d7b2e681911c266c702bd354623a | refs/heads/master | 2023-01-07T00:52:17.939194 | 2020-11-11T04:03:55 | 2020-11-11T04:03:55 | 311,858,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Main {
public static void main(String args[]) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new GuessingGame();
}
});
}
}
| [
"[email protected]"
] | |
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());
}
}
| [
"[email protected]"
] | |
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 |
da9df3f18eaeb3b0e2e72257d335daa2c16702b7 | f205085970bf9a4dfe50d096492d3f4c91869742 | /src/com/company/homeWork2_6/ServerGUI.java | 49e128dadcffc561421e4913a3256d3e3d46e5c2 | [] | no_license | Katyrin/HomeWork | 7c79ad1ac7704c23380100cf3ae845d67448d741 | 908f25edffbfb74d8b168ed542e720d7e729a25f | refs/heads/master | 2023-01-24T17:45:22.396666 | 2020-12-02T11:06:48 | 2020-12-02T11:06:48 | 293,003,844 | 0 | 0 | null | 2020-12-02T11:06:49 | 2020-09-05T04:42:34 | Java | UTF-8 | Java | false | false | 2,086 | java | package com.company.homeWork2_6;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ServerGUI extends JFrame implements ActionListener, Thread.UncaughtExceptionHandler {
private static final int POS_X = 1000;
private static final int POS_Y = 550;
private static final int WIDTH = 200;
private static final int HEIGHT = 100;
private final ChatServer chatServer = new ChatServer();
private final JButton btnStart = new JButton("Start");
private final JButton btnStop = new JButton("Stop");
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new ServerGUI();
}
});
}
private ServerGUI(){
Thread.setDefaultUncaughtExceptionHandler(this);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds(POS_X,POS_Y,WIDTH,HEIGHT);
setResizable(false);
setTitle("Chat server");
setAlwaysOnTop(true);
setLayout(new GridLayout(1,2));
btnStart.addActionListener(this);
btnStop.addActionListener(this);
add(btnStart);
add(btnStop);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
Object src = e.getSource();
if (src == btnStop){
chatServer.stop();
}else if (src == btnStart){
chatServer.start(8189);
}else {
throw new RuntimeException("Unknown action source " + src);
}
}
@Override
public void uncaughtException(Thread t, Throwable e) {
e.printStackTrace();
String msg;
StackTraceElement[] ste = e.getStackTrace();
msg = String.format("Exception in \"%s\" %s: %s\n\tat %s", t.getName(), e.getClass().getCanonicalName(),
e.getMessage(), ste[0]);
JOptionPane.showMessageDialog(null, msg, "Exception", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
}
| [
"[email protected]"
] | |
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 |
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);
}
}
}
}
}
| [
"[email protected]"
] | |
b4623f5bd048d25a5b23c733934a34bd368b48dc | 5b1ddb93c1487fb471b19361c07fe783af010392 | /app/src/test/java/com/kyuwankim/android/activitycontrol/ExampleUnitTest.java | 37f269a8777133dcfb0359aaa23a130f07896e88 | [] | no_license | kyuwankim/ActivityControl | aa9a94df1142927a3db9b9ac4fd95a74232aada1 | a70b9d3b7dda5e3ae5f3214e9b2d8fef43d5ae11 | refs/heads/master | 2021-01-23T02:11:06.175994 | 2017-05-31T06:26:35 | 2017-05-31T06:26:35 | 92,912,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.kyuwankim.android.activitycontrol;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
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];
}
};
}
| [
"[email protected]"
] | |
7304a887e5fe2ff2f681d4e27fabf9123c069ad1 | 8b47b926339bee9f6557fdbeed2a50f4b35f4056 | /55 treemap/treemap-codes/src/main/java/example2/TreeMapDemo2.java | fd6b5086b1808d9cdc51bec8b5cf08f46bb405f7 | [] | no_license | mittulmandhan/java-interview-prep | e084d78b6b4546349649d47d9f2fd9bb23afced4 | 090e7c509a94c1f98c9b30c6ddf9ad308a0c9f51 | refs/heads/master | 2023-05-28T10:29:42.463935 | 2023-05-20T19:50:57 | 2023-05-20T19:50:57 | 208,800,245 | 1 | 1 | null | 2020-05-22T00:56:57 | 2019-09-16T12:58:46 | Java | UTF-8 | Java | false | false | 738 | java | package example2;
import java.util.Map;
import java.util.TreeMap;
public class TreeMapDemo2 {
public static void main(String[] args) {
Map<Employee, Department> employeeTreeMap = new TreeMap<>(new EmployeeComparator());
employeeTreeMap.put(new Employee(1, "Sant"), new Department("IT"));
employeeTreeMap.put(new Employee(2, "Ram"), new Department("Sales"));
employeeTreeMap.put(new Employee(3, "Raheem"), new Department("Human Resource"));
employeeTreeMap.put(new Employee(4, "Insaan"), new Department("Data Science"));
employeeTreeMap.put(new Employee(5, "Danav"), new Department("Marketing"));
employeeTreeMap.put(new Employee(6, "Devta"), new Department("Management"));
System.out.println(employeeTreeMap);
}
}
| [
"[email protected]"
] | |
a47901d1efc879bc6010811be1dd1c3bb186db27 | 416a0ee548e4a90eacbabda768f8d892c34d9dd9 | /src/main/java/org/synyx/urlaubsverwaltung/core/mail/MailBuilder.java | 055492dce4906d819e7f07e678e87471be81306f | [
"Apache-2.0"
] | permissive | Faldrian/urlaubsverwaltung | 8b29e313465ffc67b583f0629e3800c40455df65 | 3f11a986da0e8d1224d006d43b6e0e90a73a53a9 | refs/heads/master | 2020-04-19T17:33:13.882325 | 2019-03-05T15:09:07 | 2019-03-05T15:09:07 | 168,338,362 | 0 | 0 | Apache-2.0 | 2019-01-30T12:21:28 | 2019-01-30T12:21:28 | null | UTF-8 | Java | false | false | 1,856 | java | package org.synyx.urlaubsverwaltung.core.mail;
import org.apache.commons.lang.CharEncoding;
import org.apache.velocity.app.VelocityEngine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.velocity.VelocityEngineUtils;
import java.util.Map;
/**
* Builds mail content by filling Velocity templates with data.
*
* @author Aljona Murygina - [email protected]
*/
@Service
class MailBuilder {
private static final String TEMPLATE_PATH = "/org/synyx/urlaubsverwaltung/core/mail/";
private static final String TEMPLATE_TYPE = ".vm";
private final VelocityEngine velocityEngine;
@Autowired
MailBuilder(VelocityEngine velocityEngine) {
this.velocityEngine = velocityEngine;
}
/**
* Build text that can be set as mail body using the given model to fill the template with the given name.
*
* @param templateName of the template to be used
* @param model to fill the template
*
* @return the text representation of the filled template
*/
String buildMailBody(String templateName, Map<String, Object> model) {
return VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, getFullyQualifiedTemplateName(templateName),
CharEncoding.UTF_8, model);
}
/**
* Get fully qualified template name including path and file extension of the given template name.
*
* @param templateName to get the fully qualified template name of
*
* @return the fully qualified template name using {@value #TEMPLATE_PATH} as path and {@value #TEMPLATE_TYPE} as
* file extension
*/
private String getFullyQualifiedTemplateName(String templateName) {
return TEMPLATE_PATH + templateName + TEMPLATE_TYPE;
}
}
| [
"[email protected]"
] | |
32d6259e616ca0d9bbacc2a9cc8147fdc6373c09 | 9fb58c2f9c2f199dea278f6fa960f7bda50f31b3 | /src/main/java/org/launchcode/models/Menu.java | 8dd47a309adc967b04505dc37aa0eb8780d52f35 | [] | no_license | LRRamsey/cheese-mvc | a27bfc34b7faedca19dd4c4e267fcb0782c47fd4 | 9371e90d4f4346002839bf9ddb9c2ba10cfc1c1d | refs/heads/master | 2021-08-31T15:46:47.746767 | 2017-12-21T23:14:14 | 2017-12-21T23:14:14 | 114,162,558 | 0 | 0 | null | 2017-12-13T19:51:13 | 2017-12-13T19:51:13 | null | UTF-8 | Java | false | false | 966 | java | package org.launchcode.models;
import org.launchcode.models.Cheese;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
@Entity
public class Menu {
@Id
@GeneratedValue
private int id;
@NotNull
@Size(min=3, max=128)
private String name;
@ManyToMany
private List<Cheese> cheeses = new ArrayList<>();
public void addItem(Cheese item) {cheeses.add(item);}
public Menu() {
}
public Menu(String name){
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Cheese> getCheeses() {
return cheeses;
}
public int getId() {
return id;
}
}
| [
"[email protected]"
] | |
db8d56e2b078774857098a99a2637234cef6bc4b | 612b1b7f5201f3ff1a550b09c96218053e195519 | /modules/gui/src/com/haulmont/cuba/gui/components/UiPermissionAware.java | a055b73291e24233860cdfb52f077eccbd14522d | [
"Apache-2.0"
] | permissive | cuba-platform/cuba | ffb83fe0b089056e8da11d96a40c596d8871d832 | 36e0c73d4e3b06f700173c4bc49c113838c1690b | refs/heads/master | 2023-06-24T02:03:12.525885 | 2023-06-19T14:13:06 | 2023-06-19T14:13:06 | 54,624,511 | 1,434 | 303 | Apache-2.0 | 2023-08-31T18:57:38 | 2016-03-24T07:55:56 | Java | UTF-8 | Java | false | false | 1,329 | java | /*
* Copyright (c) 2008-2018 Haulmont.
*
* 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.haulmont.cuba.gui.components;
import com.haulmont.cuba.gui.app.security.role.edit.UiPermissionDescriptor;
/**
* State of subcomponents can be managed by UI permissions.
*/
public interface UiPermissionAware {
/**
* Change state of subcomponent according to the {@code permissionValue}.
*
* @param permissionDescriptor descriptor which contains id of subcomponent and UI permission value
* which will be applied to this subcomponent or ids of subcomponent and its action
* and UI permission value which will be applied to subcomponent's action
*/
void applyPermission(UiPermissionDescriptor permissionDescriptor);
} | [
"[email protected]"
] | |
906a88eec0786ff6ad18cacd05af6b12d461d44f | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_1/src/f/a/d/Calc_1_1_5039.java | d957a883a74da7f912a3e782c29819961d286a98 | [] | no_license | chalstrick/bigRepo1 | ac7fd5785d475b3c38f1328e370ba9a85a751cff | dad1852eef66fcec200df10083959c674fdcc55d | refs/heads/master | 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 131 | java | package f.a.d;
public class Calc_1_1_5039 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
| [
"[email protected]"
] | |
4eed866fa3b0b705e9ef154a2ba521cad3030236 | 8fbe8cc95d7327f8a69cfd8459662c5a07a56169 | /app/src/main/java/org/gdgsrilanka/io/subpages/Questions.java | d55000deba17a58c46c8159f9938851fca033bff | [] | no_license | AjaySharvesh3/ezevent | f6ab18e585b2de45d74706f476e9593f6bc8beb0 | 1bec24e761e8b901cd45fd67612aec52d13649f5 | refs/heads/master | 2020-03-30T16:52:20.524477 | 2018-10-03T06:22:44 | 2018-10-03T06:22:44 | 151,431,362 | 0 | 1 | null | 2018-10-03T15:03:29 | 2018-10-03T15:03:28 | null | UTF-8 | Java | false | false | 3,051 | java | package org.gdgsrilanka.io.subpages;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import org.gdgsrilanka.io.R;
import org.gdgsrilanka.io.subpages.questions.Question;
import java.util.HashMap;
import java.util.Map;
/**
* A simple {@link Fragment} subclass.
*/
public class Questions extends Fragment {
public Questions() {
// Required empty public constructor
}
ImageView bg;
EditText question;
Button submit;
FirebaseDatabase database;
DatabaseReference myRef;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
final View v = inflater.inflate(R.layout.fragment_questions, container, false);
question = v.findViewById(R.id.question);
submit = v.findViewById(R.id.qsubmit);
database = FirebaseDatabase.getInstance();
myRef = database.getReference("messages");
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(question.getText().toString().trim().length() == 0){
Toast.makeText(getContext(), "Please enter your question.", Toast.LENGTH_SHORT).show();
} else {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
// User is signed in
String email = user.getEmail();
String name = user.getDisplayName();
Long tsLong = System.currentTimeMillis()/1000;
String timestamp = tsLong.toString();
String prashne = question.getText().toString();
String key = myRef.child("messages").push().getKey();
Question questiono = new Question(name, email, prashne, timestamp);
Map<String, Object> postValues = questiono.toMap();
Map<String, Object> childUpdates = new HashMap<>();
childUpdates.put(key, postValues);
myRef.updateChildren(childUpdates);
Toast.makeText(getContext(),"Question successfully posted.",Toast.LENGTH_SHORT).show();
question.setText("");
}
}
}
});
return v;
}
}
| [
"[email protected]"
] | |
9401842be3e602c596ea8a968ff019ee64017150 | 428014437663316a7624fea45051d8543edfaafd | /code/java/Erp/src/com/ljq/model/THuanjing.java | 9f546d32b744a18d7a0db002828dd6ba20bdf34e | [] | no_license | ljq199612/00 | 8276c2683b9b223d72bd1a7efc7b882e9f8bee32 | 3f7bfae2bac2b6fbc8ced48284d97ddf9ac094c6 | refs/heads/master | 2023-05-11T10:59:33.039004 | 2020-03-14T07:18:24 | 2020-03-14T07:18:24 | 247,225,509 | 1 | 0 | null | 2023-05-08T18:33:13 | 2020-03-14T06:37:17 | Vim script | UTF-8 | Java | false | false | 1,867 | java | package com.ljq.model;
/**
* THuanjing generated by MyEclipse Persistence Tools
*/
public class THuanjing implements java.io.Serializable
{
// Fields
private Integer id;
private String bianhao;
private String mingcheng;
private String weizhi;
private String mianji;
private String shijian;
private String jinian;
private String del;
// Constructors
/** default constructor */
public THuanjing()
{
}
/** full constructor */
public THuanjing(String bianhao, String mingcheng, String weizhi,
String mianji, String shijian, String jinian)
{
this.bianhao = bianhao;
this.mingcheng = mingcheng;
this.weizhi = weizhi;
this.mianji = mianji;
this.shijian = shijian;
this.jinian = jinian;
}
// Property accessors
public Integer getId()
{
return this.id;
}
public String getDel()
{
return del;
}
public void setDel(String del)
{
this.del = del;
}
public void setId(Integer id)
{
this.id = id;
}
public String getBianhao()
{
return this.bianhao;
}
public void setBianhao(String bianhao)
{
this.bianhao = bianhao;
}
public String getMingcheng()
{
return this.mingcheng;
}
public void setMingcheng(String mingcheng)
{
this.mingcheng = mingcheng;
}
public String getWeizhi()
{
return this.weizhi;
}
public void setWeizhi(String weizhi)
{
this.weizhi = weizhi;
}
public String getMianji()
{
return this.mianji;
}
public void setMianji(String mianji)
{
this.mianji = mianji;
}
public String getShijian()
{
return this.shijian;
}
public void setShijian(String shijian)
{
this.shijian = shijian;
}
public String getJinian()
{
return this.jinian;
}
public void setJinian(String jinian)
{
this.jinian = jinian;
}
} | [
"[email protected]"
] | |
9d24718c6c2d98b490111de1c79ca49bae069ca6 | 30ce7b28d4c6288401c47acc69b2fb4e70b9e39a | /src/test/java/be/recipe/recipe/controllers/IngredientControllerTest.java | f76026a67f1510cd9665902fe41f01a8d680cc4b | [] | no_license | ErgunAhmet/spring-recipe-app | 07d958eccd354dfadba86edb7faf0602cb61f3f9 | 1ee24ff856a488f32ad72cba998dc378ca2dcda5 | refs/heads/master | 2023-05-02T23:59:32.092346 | 2021-05-18T15:15:41 | 2021-05-18T15:15:41 | 350,484,308 | 0 | 0 | null | 2021-05-18T15:16:00 | 2021-03-22T20:45:29 | Java | UTF-8 | Java | false | false | 5,428 | java | package be.recipe.recipe.controllers;
import be.recipe.recipe.commands.IngredientCommand;
import be.recipe.recipe.commands.RecipeCommand;
import be.recipe.recipe.service.IngredientService;
import be.recipe.recipe.service.RecipeService;
import be.recipe.recipe.service.UnitOfMeasureService;
import lombok.SneakyThrows;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import java.util.HashSet;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
class IngredientControllerTest {
@Mock
IngredientService ingredientService;
@Mock
UnitOfMeasureService unitOfMeasureService;
@Mock
RecipeService recipeService;
IngredientController controller;
MockMvc mockMvc;
@BeforeEach
public void setUp() {
MockitoAnnotations.initMocks(this);
controller = new IngredientController(recipeService, ingredientService, unitOfMeasureService);
mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
}
@SneakyThrows
@Test
public void testListIngredients(){
//given
RecipeCommand recipeCommand = new RecipeCommand();
when(recipeService.findCommandById(anyLong())).thenReturn(recipeCommand);
//when
mockMvc.perform(get("/recipe/1/ingredients"))
.andExpect(status().isOk())
.andExpect(view().name("recipe/ingredient/list"))
.andExpect(model().attributeExists("recipe"));
//then
verify(recipeService, times(1)).findCommandById(anyLong());
}
@SneakyThrows
@Test
public void testShowIngredient() {
//given
IngredientCommand ingredientCommand = new IngredientCommand();
//when
when(ingredientService.findByRecipeIdAndIngredientId(anyLong(), anyLong())).thenReturn(ingredientCommand);
//then
mockMvc.perform(get("/recipe/1/ingredient/2/show"))
.andExpect(status().isOk())
.andExpect(view().name("recipe/ingredient/show"))
.andExpect(model().attributeExists("ingredient"));
}
@Test
public void testNewIngredientForm() throws Exception {
//given
RecipeCommand recipeCommand = new RecipeCommand();
recipeCommand.setId(1L);
//when
when(recipeService.findCommandById(anyLong())).thenReturn(recipeCommand);
when(unitOfMeasureService.listAllUoms()).thenReturn(new HashSet<>());
//then
mockMvc.perform(get("/recipe/1/ingredient/new"))
.andExpect(status().isOk())
.andExpect(view().name("recipe/ingredient/ingredientform"))
.andExpect(model().attributeExists("ingredient"))
.andExpect(model().attributeExists("uomList"));
verify(recipeService, times(1)).findCommandById(anyLong());
}
@Test
public void testUpdateIngredientForm() throws Exception {
//given
IngredientCommand ingredientCommand = new IngredientCommand();
//when
when(ingredientService.findByRecipeIdAndIngredientId(anyLong(), anyLong())).thenReturn(ingredientCommand);
when(unitOfMeasureService.listAllUoms()).thenReturn(new HashSet<>());
//then
mockMvc.perform(get("/recipe/1/ingredient/2/update"))
.andExpect(status().isOk())
.andExpect(view().name("recipe/ingredient/ingredientform"))
.andExpect(model().attributeExists("ingredient"))
.andExpect(model().attributeExists("uomList"));
}
@Test
public void testSaveOrUpdate() throws Exception {
//given
IngredientCommand command = new IngredientCommand();
command.setId(3L);
command.setRecipeId(2L);
//when
when(ingredientService.saveIngredientCommand(any())).thenReturn(command);
//then
mockMvc.perform(post("/recipe/2/ingredient")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.param("id", "")
.param("description", "some string")
)
.andExpect(status().is3xxRedirection())
.andExpect(view().name("redirect:/recipe/2/ingredient/3/show"));
}
@Test
public void testDeleteIngredient() throws Exception {
//then
mockMvc.perform(get("/recipe/2/ingredient/3/delete")
)
.andExpect(status().is3xxRedirection())
.andExpect(view().name("redirect:/recipe/2/ingredients"));
verify(ingredientService, times(1)).deleteById(anyLong(), anyLong());
}
}
| [
"[email protected]"
] | |
72e17b4ddc239c9f769429873d2f99c6bcb9716f | 8d6a11f6d0fcbf6c54713c16ed5a620ae3810754 | /Assignment/Cls/src/main/java/com/ArabBank/lombok/Cls/Skills.java | 2612d8b2ba4cc3db4c97a40dd0b13c349abf371f | [] | no_license | monassar97/Lambda | f059eaedc6aa6beba12008956c474db34e0424cb | 741153c18184e824ba355971f537d643642af67f | refs/heads/master | 2022-06-01T14:59:45.552878 | 2019-12-16T08:27:55 | 2019-12-16T08:27:55 | 228,188,629 | 0 | 0 | null | 2022-05-20T21:19:14 | 2019-12-15T13:27:09 | JavaScript | UTF-8 | Java | false | false | 155 | java | package com.ArabBank.lombok.Cls;
public class Skills {
private String InterpersonalSkills;
private String Responsiveness;
private String Initiative;
}
| [
"[email protected]"
] | |
3130d22c9fc127df12ab92990a86c3a45da4e866 | 513c1f02b556b0666038df76fbb3778b02e9291a | /src/main/java/com/ford/Item.java | 0e52fddae75d45ddfea0bc96fcd63300bf0b5503 | [] | no_license | jojujohn/Fun-Times | ce4a8a08d5b8059fdd4535820c18f2ed4e6f8b94 | a8cf9f2d54ee13c3ce379193a438ca8b08eaa708 | refs/heads/main | 2023-02-27T11:50:41.529918 | 2021-02-01T04:58:30 | 2021-02-01T04:58:30 | 334,653,023 | 0 | 0 | null | 2021-01-31T12:45:30 | 2021-01-31T12:45:30 | null | UTF-8 | Java | false | false | 559 | java | /**
*
*/
package com.ford;
/**
* @author jopr2
*
*/
public class Item {
private Product product;
@Override
public String toString() {
return "Item [product=" + product + ", qty=" + qty + "]";
}
int qty;
public Item(Product product,int qty) {
this.product=product;
this.qty=qty;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public int getQty() {
return qty;
}
public void setQty(int qty) {
this.qty = qty;
}
}
| [
"[email protected]"
] | |
d8f2c1f620448b4d38efc40da95b4bf0a1cb3231 | b8f26aac9f055b6fbf1d628cc4be8e29cb61d4fc | /src/main/java/lt/akademija/Model/Admin.java | 63c1d28a275cf651e42bdfc08a362933c185e532 | [] | no_license | EziukuLigonine/Ligonine2.0 | 43e5baae5fb640cdd506192086e2df28f2abd27c | 2592a3896b23b534361474f8fd28935d4498620e | refs/heads/master | 2021-04-27T18:59:06.134562 | 2018-03-14T06:20:41 | 2018-03-14T06:20:41 | 122,349,482 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 260 | java | package lt.akademija.Model;
import javax.persistence.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@Entity
@Table(name = "ADMIN")
@PrimaryKeyJoinColumn(name = "adminId")
@DiscriminatorValue("Admin")
public class Admin extends User {
}
| [
"[email protected]"
] | |
b1e1623204b5e4e5ca9531c9aa7d08280e3d21bc | f00608e6b3cba1d466046768ec26541285b3a58e | /src/main/java/com/koala/learn/dao/HtmlTestMapper.java | 0fbb469b1762a985171db528193ca1ff941e0b85 | [] | no_license | zangml/PHMLearnGit | 72325092e5ede9997aef0a13fef0ff70e7142bf0 | 86a3fa353b21085c5071ab3f30ffcbaf19568888 | refs/heads/master | 2020-04-08T08:05:03.797886 | 2018-12-14T03:16:42 | 2018-12-14T03:16:42 | 159,164,334 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package com.koala.learn.dao;
import com.koala.learn.entity.HtmlTest;
import java.util.List;
public interface HtmlTestMapper {
int deleteByPrimaryKey(Integer id);
int insert(HtmlTest record);
int insertSelective(HtmlTest record);
HtmlTest selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(HtmlTest record);
int updateByPrimaryKeyWithBLOBs(HtmlTest record);
int updateByPrimaryKey(HtmlTest record);
List<HtmlTest> selectByType(int typeId);
} | [
"[email protected]"
] | |
b95386e0b076f73c722b3847d55e1b0722b9008b | 29c084850cb4dd2731aeba00ceb47a088692c5c6 | /src/main/java/mmarquee/demo/PointerOver.java | 308cf17364c83c3168b6cf7abf7e6741b2455867 | [] | no_license | ezarubaeva/gs-win-automation | a119b4bdeb95433d92f78094fd5ba379375cc37e | 57febb0f920422e4c6068eb258eceeb7d92fe9a5 | refs/heads/master | 2021-09-12T02:15:58.133435 | 2018-04-13T17:29:06 | 2018-04-13T17:29:06 | 118,453,105 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 227 | java | package mmarquee.demo;
/**
* Created by Mark Humphreys on 12/02/2017.
*/
public class PointerOver {
public static void main(String[] args) {
DemoPointOver main = new DemoPointOver();
main.run();
}
}
| [
"[email protected]"
] | |
c3e1dca3208c88bcfcea4301ce6c30f110e22223 | ac9244ea93103d593ae406dd54fab79adbc59e7a | /src/headfirst/designpatterns/command/remote/LivingroomLightOffCommand.java | 3795a327d54c9d80fe6b5d5c404d10e3c5216b23 | [] | no_license | bofei222/Head-First-Design-Patterns | 11f731a3b28ca79d40624ed3a5b09503af41308a | cb65d5ea77f1105bfb8622a8c5acf90b9287764e | refs/heads/master | 2021-07-20T23:22:20.418016 | 2020-05-08T23:48:56 | 2020-05-08T23:48:56 | 144,090,495 | 0 | 0 | null | 2018-08-09T02:19:40 | 2018-08-09T02:19:40 | null | UTF-8 | Java | false | false | 258 | java | package headfirst.designpatterns.command.remote;
public class LivingroomLightOffCommand implements Command {
Light light;
public LivingroomLightOffCommand(Light light) {
this.light = light;
}
public void execute() {
light.off();
}
}
| [
"[email protected]"
] | |
53e052c6b60c21c66289ce47e1a6a81da7379957 | da514f4f46058d2e71a1fc1900565651478a7daa | /gateway-service/src/main/java/com/github/chenhaiyangs/gateway/service/storage/mock/vo/MockVo.java | 5dc26d4b1802187d8ba657db07f23204e942c4ff | [] | no_license | MicrophoneBen/easy-gateway | 16211a00d644de2e1302302c2cd59bf55c4f5014 | fe713651236378592b2e12ad0f6d3a390e2ffe5e | refs/heads/master | 2020-09-08T14:43:53.124533 | 2019-01-12T13:54:09 | 2019-01-12T13:54:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 605 | java | package com.github.chenhaiyangs.gateway.service.storage.mock.vo;
import com.github.chenhaiyangs.gateway.common.model.base.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
/**
* mock组件Vo类
* @author chenhaiyang
*/
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class MockVo extends BaseModel{
/**
* id
*/
private int id;
/**
* apiId
*/
private int apiId;
/**
* 请求的body
*/
private String body;
/**
* 是否被禁用
*/
private boolean forbidden;
}
| [
"[email protected]"
] | |
e2d0e5c8d3057dc3ee8681a9aa1fc7eecac79331 | 63495e5e565c2d64a32141b260aac964c49fb259 | /restaurant/src/restaurant/Boisson.java | 4ee47225e71dbd72a2efb1b5991d3d0a89468088 | [] | no_license | arkior/repositorySimplon | f9e29199af0ba1338563ba348de43201d6cc9b86 | d51ea18058b5b5b616e1f33b797e82a98b64c514 | refs/heads/master | 2022-12-25T05:55:29.755654 | 2020-09-25T18:30:25 | 2020-09-25T18:30:25 | 298,642,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package restaurant;
public class Boisson
{
private final String EAU_PLATE ="EAU PLATE";
private final String EAU_GAZEUSE ="EAU GAZEUSE";
private final String SODA ="SODA";
//constructeur
public Boisson() {}
public String getEauPlate()
{
return this.EAU_PLATE;
}
public String getEauGazeuse()
{
return this.EAU_GAZEUSE;
}
public String getSoda()
{
return this.SODA;
}
}
| [
"[email protected]"
] | |
a56bb6cca082d98e93aa0f6f8402c024b6c37fef | 520bfe7ae5d0c2d0da69b9780fe8dbd85d075feb | /app/src/main/java/acsiustech/wolaapp/WishlistActivity.java | 9490d9c60a63ed723ede3b253303e111e30ea262 | [] | no_license | naseemirza/AcsiusProjects | 41945952eaddf5589a1ae2216ee6e17c0dad3b0e | ae3a1bd2da0c0ccc460d38d9a3c343d009d334f0 | refs/heads/master | 2020-06-20T13:58:57.421990 | 2019-07-16T07:36:06 | 2019-07-16T07:36:06 | 197,144,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 803 | java | package acsiustech.wolaapp;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Html;
public class WishlistActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wishlist);
getSupportActionBar().setTitle(Html.fromHtml("<font color='#0000'>Wishlist </font>"));
final Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_black_24dp);
upArrow.setColorFilter(getResources().getColor(R.color.colorBlack), PorterDuff.Mode.SRC_ATOP);
getSupportActionBar().setHomeAsUpIndicator(upArrow);
}
}
| [
"[email protected]"
] | |
6a35a2714c4181f3de33a929b6a8d806b43c3467 | f23ea452060bc1ebc987f6fe7a82dce1f397ffd0 | /webserver/src/test/java/webserver/service/UserServiceTest.java | b6e9c7ba552764c5692c4215e0fc20d91995f960 | [] | no_license | shaburovgena/Diagnostic | 69c376aa123768f54d84532de250f65d1b1e0548 | b496c0a8d9137f8b79738c71e16e50fab8c1496c | refs/heads/master | 2022-11-28T11:51:14.086891 | 2019-10-21T05:44:27 | 2019-10-21T05:44:27 | 160,184,123 | 0 | 0 | null | 2022-11-24T04:24:17 | 2018-12-03T12:00:10 | Java | UTF-8 | Java | false | false | 3,869 | java | package webserver.service;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.junit4.SpringRunner;
import webserver.domain.Role;
import webserver.domain.User;
import webserver.repos.UserRepo;
import java.util.Collections;
@RunWith(SpringRunner.class)
@SpringBootTest
public class UserServiceTest {
@Autowired
private UserService userService;
//Подменяем реальные объекты заглушками
@MockBean
private UserRepo userRepo;
//Реальная отправка сообщений в этом тесте не нужна, важен только факт обращения к методу
@MockBean
private MailSender mailSender;
//Шифрование пароля для теста не нужно
@MockBean
private PasswordEncoder passwordEncoder;
@Test
public void addUser() {
User user = new User();
user.setEmail("[email protected]");
User isUserCreated = userService.addUser(user);
Assert.assertTrue(isUserCreated == null); //Ожидаем true
Assert.assertNotNull(user.getActivationCode());
Assert.assertTrue(CoreMatchers.is(user.getRoles()).matches(Collections.singleton(Role.USER)));
//Spy объект Mockito для проверки факта обращений к указанному методу
Mockito.verify(userRepo, Mockito.times(1)).save(user);//Счетчик обращений к методу сохранения
Mockito.verify(mailSender, Mockito.times(1))//Счетчик обращений к методу отправки сообщения
.send(
ArgumentMatchers.eq(user.getEmail()),
ArgumentMatchers.anyString(),
ArgumentMatchers.anyString()
);
}
@Test
public void addUserFailTest() {
User user = new User();
user.setUsername("Ivan");
Mockito.doReturn(new User()) //Должен вернуть пользователя User
.when(userRepo) //когда в репозитории userRepo
.findByUsername("Ivan");//вызывается метод findByUsername
User isUserCreated = userService.addUser(user);
Assert.assertFalse(isUserCreated != null);
Mockito.verify(userRepo, Mockito.times(0)).save(ArgumentMatchers.any(User.class));
Mockito.verify(mailSender, Mockito.times(0))
.send(
ArgumentMatchers.anyString(),
ArgumentMatchers.anyString(),
ArgumentMatchers.anyString()
);
}
@Test
public void activateUser() {
User user = new User();
user.setActivationCode("Ok!");
Mockito.doReturn(user)
.when(userRepo)
.findByActivationCode("activate");
boolean isUserActivated = userService.activateUser("activate");
Assert.assertTrue(isUserActivated);
Assert.assertNull(user.getActivationCode());
Mockito.verify(userRepo, Mockito.times(1)).save(user);
}
@Test
public void activateUserFailTest() {
boolean isUserActivated = userService.activateUser("activate me");
Assert.assertFalse(isUserActivated);
Mockito.verify(userRepo, Mockito.times(0)).save(ArgumentMatchers.any(User.class));
}
} | [
"[email protected]"
] | |
c3fee6ff5e8fe3b7bbdc3b1027db2204e410a7ed | 5ec06dab1409d790496ce082dacb321392b32fe9 | /clients/jaxrs-resteasy/generated/src/gen/java/org/openapitools/model/ComAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties.java | 033331eb04af7e3712c29746ec0e90e7fa928d04 | [
"Apache-2.0"
] | permissive | shinesolutions/swagger-aem-osgi | e9d2385f44bee70e5bbdc0d577e99a9f2525266f | c2f6e076971d2592c1cbd3f70695c679e807396b | refs/heads/master | 2022-10-29T13:07:40.422092 | 2021-04-09T07:46:03 | 2021-04-09T07:46:03 | 190,217,155 | 3 | 3 | Apache-2.0 | 2022-10-05T03:26:20 | 2019-06-04T14:23:28 | null | UTF-8 | Java | false | false | 7,721 | java | package org.openapitools.model;
import java.util.Objects;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import org.openapitools.model.ConfigNodePropertyInteger;
import org.openapitools.model.ConfigNodePropertyString;
import javax.validation.constraints.*;
import io.swagger.annotations.*;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen", date = "2019-08-05T00:59:30.156Z[GMT]")
public class ComAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties {
private ConfigNodePropertyString translationFactory = null;
private ConfigNodePropertyString defaultConnectorLabel = null;
private ConfigNodePropertyString defaultConnectorAttribution = null;
private ConfigNodePropertyString defaultConnectorWorkspaceId = null;
private ConfigNodePropertyString defaultConnectorSubscriptionKey = null;
private ConfigNodePropertyString languageMapLocation = null;
private ConfigNodePropertyString categoryMapLocation = null;
private ConfigNodePropertyInteger retryAttempts = null;
private ConfigNodePropertyInteger timeoutCount = null;
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("translationFactory")
public ConfigNodePropertyString getTranslationFactory() {
return translationFactory;
}
public void setTranslationFactory(ConfigNodePropertyString translationFactory) {
this.translationFactory = translationFactory;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("defaultConnectorLabel")
public ConfigNodePropertyString getDefaultConnectorLabel() {
return defaultConnectorLabel;
}
public void setDefaultConnectorLabel(ConfigNodePropertyString defaultConnectorLabel) {
this.defaultConnectorLabel = defaultConnectorLabel;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("defaultConnectorAttribution")
public ConfigNodePropertyString getDefaultConnectorAttribution() {
return defaultConnectorAttribution;
}
public void setDefaultConnectorAttribution(ConfigNodePropertyString defaultConnectorAttribution) {
this.defaultConnectorAttribution = defaultConnectorAttribution;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("defaultConnectorWorkspaceId")
public ConfigNodePropertyString getDefaultConnectorWorkspaceId() {
return defaultConnectorWorkspaceId;
}
public void setDefaultConnectorWorkspaceId(ConfigNodePropertyString defaultConnectorWorkspaceId) {
this.defaultConnectorWorkspaceId = defaultConnectorWorkspaceId;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("defaultConnectorSubscriptionKey")
public ConfigNodePropertyString getDefaultConnectorSubscriptionKey() {
return defaultConnectorSubscriptionKey;
}
public void setDefaultConnectorSubscriptionKey(ConfigNodePropertyString defaultConnectorSubscriptionKey) {
this.defaultConnectorSubscriptionKey = defaultConnectorSubscriptionKey;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("languageMapLocation")
public ConfigNodePropertyString getLanguageMapLocation() {
return languageMapLocation;
}
public void setLanguageMapLocation(ConfigNodePropertyString languageMapLocation) {
this.languageMapLocation = languageMapLocation;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("categoryMapLocation")
public ConfigNodePropertyString getCategoryMapLocation() {
return categoryMapLocation;
}
public void setCategoryMapLocation(ConfigNodePropertyString categoryMapLocation) {
this.categoryMapLocation = categoryMapLocation;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("retryAttempts")
public ConfigNodePropertyInteger getRetryAttempts() {
return retryAttempts;
}
public void setRetryAttempts(ConfigNodePropertyInteger retryAttempts) {
this.retryAttempts = retryAttempts;
}
/**
**/
@ApiModelProperty(value = "")
@JsonProperty("timeoutCount")
public ConfigNodePropertyInteger getTimeoutCount() {
return timeoutCount;
}
public void setTimeoutCount(ConfigNodePropertyInteger timeoutCount) {
this.timeoutCount = timeoutCount;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ComAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties comAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties = (ComAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties) o;
return Objects.equals(translationFactory, comAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties.translationFactory) &&
Objects.equals(defaultConnectorLabel, comAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties.defaultConnectorLabel) &&
Objects.equals(defaultConnectorAttribution, comAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties.defaultConnectorAttribution) &&
Objects.equals(defaultConnectorWorkspaceId, comAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties.defaultConnectorWorkspaceId) &&
Objects.equals(defaultConnectorSubscriptionKey, comAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties.defaultConnectorSubscriptionKey) &&
Objects.equals(languageMapLocation, comAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties.languageMapLocation) &&
Objects.equals(categoryMapLocation, comAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties.categoryMapLocation) &&
Objects.equals(retryAttempts, comAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties.retryAttempts) &&
Objects.equals(timeoutCount, comAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties.timeoutCount);
}
@Override
public int hashCode() {
return Objects.hash(translationFactory, defaultConnectorLabel, defaultConnectorAttribution, defaultConnectorWorkspaceId, defaultConnectorSubscriptionKey, languageMapLocation, categoryMapLocation, retryAttempts, timeoutCount);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ComAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties {\n");
sb.append(" translationFactory: ").append(toIndentedString(translationFactory)).append("\n");
sb.append(" defaultConnectorLabel: ").append(toIndentedString(defaultConnectorLabel)).append("\n");
sb.append(" defaultConnectorAttribution: ").append(toIndentedString(defaultConnectorAttribution)).append("\n");
sb.append(" defaultConnectorWorkspaceId: ").append(toIndentedString(defaultConnectorWorkspaceId)).append("\n");
sb.append(" defaultConnectorSubscriptionKey: ").append(toIndentedString(defaultConnectorSubscriptionKey)).append("\n");
sb.append(" languageMapLocation: ").append(toIndentedString(languageMapLocation)).append("\n");
sb.append(" categoryMapLocation: ").append(toIndentedString(categoryMapLocation)).append("\n");
sb.append(" retryAttempts: ").append(toIndentedString(retryAttempts)).append("\n");
sb.append(" timeoutCount: ").append(toIndentedString(timeoutCount)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
] | |
9e6eb4d46a29248b283915e48fb1d2cb35427c94 | 62eb9ce1b39e85073cc66f6531a9a9b9c8033725 | /src/java/us/kbase/narrativemethodstore/ValidateTypeParams.java | 8c9f2364ad6971bc4e4ab5952fbf6845c42f6d46 | [
"MIT"
] | permissive | kbase/kb_sdk | b042e40c7b586554979fd3bcca126359c94ab68f | 3a7e1b29491d8e976eb965b480254385de8f5d54 | refs/heads/develop | 2023-03-22T09:56:09.670295 | 2023-03-15T22:09:45 | 2023-03-15T22:09:45 | 33,894,860 | 23 | 43 | MIT | 2023-03-15T22:09:47 | 2015-04-13T21:23:48 | Java | UTF-8 | Java | false | false | 3,109 | java |
package us.kbase.narrativemethodstore;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* <p>Original spec-file type: ValidateTypeParams</p>
*
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("com.googlecode.jsonschema2pojo")
@JsonPropertyOrder({
"id",
"spec_json",
"display_yaml",
"extra_files"
})
public class ValidateTypeParams {
@JsonProperty("id")
private java.lang.String id;
@JsonProperty("spec_json")
private java.lang.String specJson;
@JsonProperty("display_yaml")
private java.lang.String displayYaml;
@JsonProperty("extra_files")
private Map<String, String> extraFiles;
private Map<java.lang.String, Object> additionalProperties = new HashMap<java.lang.String, Object>();
@JsonProperty("id")
public java.lang.String getId() {
return id;
}
@JsonProperty("id")
public void setId(java.lang.String id) {
this.id = id;
}
public ValidateTypeParams withId(java.lang.String id) {
this.id = id;
return this;
}
@JsonProperty("spec_json")
public java.lang.String getSpecJson() {
return specJson;
}
@JsonProperty("spec_json")
public void setSpecJson(java.lang.String specJson) {
this.specJson = specJson;
}
public ValidateTypeParams withSpecJson(java.lang.String specJson) {
this.specJson = specJson;
return this;
}
@JsonProperty("display_yaml")
public java.lang.String getDisplayYaml() {
return displayYaml;
}
@JsonProperty("display_yaml")
public void setDisplayYaml(java.lang.String displayYaml) {
this.displayYaml = displayYaml;
}
public ValidateTypeParams withDisplayYaml(java.lang.String displayYaml) {
this.displayYaml = displayYaml;
return this;
}
@JsonProperty("extra_files")
public Map<String, String> getExtraFiles() {
return extraFiles;
}
@JsonProperty("extra_files")
public void setExtraFiles(Map<String, String> extraFiles) {
this.extraFiles = extraFiles;
}
public ValidateTypeParams withExtraFiles(Map<String, String> extraFiles) {
this.extraFiles = extraFiles;
return this;
}
@JsonAnyGetter
public Map<java.lang.String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperties(java.lang.String name, Object value) {
this.additionalProperties.put(name, value);
}
@Override
public java.lang.String toString() {
return ((((((((((("ValidateTypeParams"+" [id=")+ id)+", specJson=")+ specJson)+", displayYaml=")+ displayYaml)+", extraFiles=")+ extraFiles)+", additionalProperties=")+ additionalProperties)+"]");
}
}
| [
"[email protected]"
] | |
70d6f73f1dfd6a9c9bfac2361e62b58dfdcd1062 | 8b3a993c0306399b0ead0e9204a18b670b8e9ed2 | /src/CatsAreAwesome/cat.java | 2e8a6401aec5765b87f0c950684bdbd6485d9061 | [] | no_license | faizbinmokhtar99/BasicRolePlayingGame | cd9d04ba168be0dc2366d413d7897462247e1804 | 27596d2f349ea7691f3bb137b6c2a5275eb11d6c | refs/heads/master | 2023-03-24T08:44:09.417824 | 2021-03-23T08:50:42 | 2021-03-23T08:50:42 | 350,640,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 274 | 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 CatsAreAwesome;
/**
*
* @author Admin-PC
*/
class cat {
}
| [
"Faiz@DESKTOP-EPGO5RR"
] | Faiz@DESKTOP-EPGO5RR |
a8e2d75ec87847be8351d21247f0489a23811234 | 97a96db92631eb18085aee76904f58dd651c6d55 | /src/main/java/com/semantic/api/specification/PeopleFeedSpecification.java | 8f4874264ffad96fd0cc18653f5349d55312c299 | [] | no_license | maan82/semantic-api | 49232fbd266bcab1df15831df8561a1678066894 | 409a9bd115c1ded06ad7fad8f10b19d790de1cf8 | refs/heads/master | 2016-09-06T04:39:15.076620 | 2015-01-18T13:23:10 | 2015-01-18T13:23:10 | 29,415,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,865 | java | package com.semantic.api.specification;
import com.semantic.api.domain.Filter;
import com.semantic.api.domain.Mixin;
import org.apache.http.client.utils.URIBuilder;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
public class PeopleFeedSpecification implements FeedSpecification {
public static final String URI_BUILD_ERROR = "URI build error";
public static final String BIRTH_PLACE = "birth_place";
public static final String AGE = "age";
private String basePath;
private String name;
private Integer page;
private Integer pageSize;
private Set<String> mixins;
public PeopleFeedSpecification(String basePath, String name, Set<String> mixins, Integer page, Integer pageSize) {
this.basePath = basePath;
this.name = name;
this.page = page;
this.pageSize = pageSize;
this.mixins = mixins;
}
public String getBasePath() {
return basePath;
}
public String getName() {
return name;
}
public Integer getPage() {
return page;
}
public Integer getPageSize() {
return pageSize;
}
public Set<String> getMixins() {
return mixins;
}
@Override
public String getNextPageLink() {
return buildUri(page != null ? new Integer(page + 1): page).toString();
}
@Override
public String getPreviousPageLink() {
return buildUri(page != null ? new Integer(page - 1): page).toString();
}
public List<Filter> getRemainingFilters() {
List<Filter> filters = new ArrayList<Filter>();
if (getName() == null) {
filters.add(new Filter("name", "false", "string", "Filter for subset of people that have name", null));
}
if (getPage() == null) {
filters.add(new Filter("page", "false", "integer", "which page of results to return", null));
}
if (getPageSize() == null) {
filters.add(new Filter("page_size", "false", "integer", "number of results in each page", null));
}
return filters;
}
public List<Mixin> getRemainingMixins() {
List<Mixin> mixinList = new ArrayList<Mixin>();
try {
if (!getMixins().contains(AGE)) {
URIBuilder builder = new URIBuilder(buildUri(getPage()));
builder.addParameter("mixin", AGE);
mixinList.add(new Mixin(AGE, "mixin to return age of the person", builder.build().toString()));
}
if (!getMixins().contains(BIRTH_PLACE)) {
URIBuilder builder = new URIBuilder(buildUri(getPage()));
builder.addParameter("mixin", BIRTH_PLACE);
mixinList.add(new Mixin(BIRTH_PLACE, "mixin to return place of birth", builder.build().toString()));
}
} catch (URISyntaxException e) {
throw new RuntimeException(URI_BUILD_ERROR);
}
return mixinList;
}
URIBuilder create() {
return new URIBuilder();
}
private URI buildUri(Integer pageNumber) {
URIBuilder builder = create();
builder.setPath(basePath);
addParameter(builder, "name", name);
for (String mixin:new TreeSet<String>(mixins)) {
addParameter(builder, "mixin", mixin);
}
addParameter(builder, "page", pageNumber);
addParameter(builder, "page_size", pageSize);
try {
return builder.build();
} catch (URISyntaxException e) {
throw new RuntimeException(URI_BUILD_ERROR);
}
}
private void addParameter(URIBuilder uriBuilder, String name, Object value) {
if (value != null) {
uriBuilder.addParameter(name, value.toString());
}
}
}
| [
"[email protected]"
] | |
0de505d47a06b4d3e76f2e199c2ca6c93dda9ef1 | 23ab16194e101a2c6d083968d85dee19d50cb388 | /src/main/java/com/jspxcms/core/service/impl/ScoreGroupServiceImpl.java | 693a9a5885fdc59d68c580cbec879dceee7e2003 | [] | no_license | XLjavaHome/jspxcms-8.0.2-release | 4d5a5597dbe4289b4bf43e18dd08c58959fea16c | 255be80dfa7ee7c8fd35f1465fbb2bbfdf46e334 | refs/heads/master | 2021-07-17T20:22:26.153775 | 2017-10-26T08:13:53 | 2017-10-26T08:15:35 | 108,381,697 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,589 | java | package com.jspxcms.core.service.impl;
import com.jspxcms.common.orm.Limitable;
import com.jspxcms.common.orm.RowSide;
import com.jspxcms.common.orm.SearchFilter;
import com.jspxcms.core.domain.ScoreGroup;
import com.jspxcms.core.domain.ScoreItem;
import com.jspxcms.core.domain.Site;
import com.jspxcms.core.listener.SiteDeleteListener;
import com.jspxcms.core.repository.ScoreGroupDao;
import com.jspxcms.core.service.ScoreGroupService;
import com.jspxcms.core.service.ScoreItemService;
import com.jspxcms.core.service.SiteService;
import com.jspxcms.core.support.DeleteException;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@Service
@Transactional(readOnly = true)
public class ScoreGroupServiceImpl implements ScoreGroupService, SiteDeleteListener {
public List<ScoreGroup> findList(Integer siteId, Map<String, String[]> params, Sort sort) {
return dao.findAll(spec(siteId, params), sort);
}
public RowSide<ScoreGroup> findSide(Integer siteId, Map<String, String[]> params, ScoreGroup bean, Integer position, Sort sort) {
if (position == null) {
return new RowSide<ScoreGroup>();
}
Limitable limit = RowSide.limitable(position, sort);
List<ScoreGroup> list = dao.findAll(spec(siteId, params), limit);
return RowSide.create(list, bean);
}
private Specification<ScoreGroup> spec(final Integer siteId, Map<String, String[]> params) {
Collection<SearchFilter> filters = SearchFilter.parse(params).values();
final Specification<ScoreGroup> fsp = SearchFilter.spec(filters, ScoreGroup.class);
Specification<ScoreGroup> sp = new Specification<ScoreGroup>() {
public Predicate toPredicate(Root<ScoreGroup> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
Predicate pred = fsp.toPredicate(root, query, cb);
if (siteId != null) {
pred = cb.and(pred, cb.equal(root.get("site").get("id"), siteId));
}
return pred;
}
};
return sp;
}
public ScoreGroup findByNumber(Integer siteId, String number) {
List<ScoreGroup> list = dao.findBySiteIdAndNumber(siteId, number);
return !list.isEmpty() ? list.get(0) : null;
}
public ScoreGroup findTopOne(Integer siteId) {
return dao.findTopOne(siteId);
}
public ScoreGroup get(Integer id) {
return dao.findOne(id);
}
public boolean numberExist(String number, Integer siteId) {
return dao.countByNumber(number, siteId) > 0;
}
@Transactional
public ScoreGroup save(ScoreGroup bean, String[] name, Integer[] score, String[] icon, Integer siteId) {
Site site = siteService.get(siteId);
bean.setSite(site);
bean.applyDefaultValue();
bean = dao.save(bean);
scoreItemService.save(name, score, icon, bean);
return bean;
}
@Transactional
public ScoreGroup update(ScoreGroup bean, Integer[] itemId, String[] itemName, Integer[] itemScore, String[] itemIcon) {
bean.applyDefaultValue();
bean = dao.save(bean);
scoreItemService.update(itemId, itemName, itemScore, itemIcon, bean);
return bean;
}
@Transactional
public ScoreGroup[] batchUpdate(Integer[] id, String[] name, String[] number, String[] description) {
ScoreGroup[] beans = new ScoreGroup[id.length];
for (int i = 0, len = id.length; i < len; i++) {
beans[i] = get(id[i]);
beans[i].setSeq(i);
beans[i].setName(name[i]);
beans[i].setNumber(number[i]);
beans[i].setDescription(description[i]);
beans[i].applyDefaultValue();
dao.save(beans[i]);
}
return beans;
}
@Transactional
public ScoreGroup delete(Integer id) {
ScoreGroup entity = dao.findOne(id);
for (ScoreItem item : entity.getItems()) {
scoreItemService.delete(item);
}
dao.delete(entity);
return entity;
}
@Transactional
public ScoreGroup[] delete(Integer[] ids) {
ScoreGroup[] beans = new ScoreGroup[ids.length];
for (int i = 0; i < ids.length; i++) {
beans[i] = delete(ids[i]);
}
return beans;
}
public void preSiteDelete(Integer[] ids) {
if (ArrayUtils.isNotEmpty(ids)) {
if (dao.countBySiteId(Arrays.asList(ids)) > 0) {
throw new DeleteException("scoreGroup.management");
}
}
}
private ScoreItemService scoreItemService;
private SiteService siteService;
@Autowired
public void setScoreItemService(ScoreItemService scoreItemService) {
this.scoreItemService = scoreItemService;
}
@Autowired
public void setSiteService(SiteService siteService) {
this.siteService = siteService;
}
private ScoreGroupDao dao;
@Autowired
public void setDao(ScoreGroupDao dao) {
this.dao = dao;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.